summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/documentmanager.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2017-09-29 11:42:26 +0200
committerEike Ziller <eike.ziller@qt.io>2017-09-29 10:46:28 +0000
commit5e622a32032079a8fc1a1018d21be54b434e6217 (patch)
tree94860e429b4e14cda3cebf6e42e87ab6366bdf55 /src/plugins/coreplugin/documentmanager.cpp
parentcac9db78df1a8b1f4d2bcf20ba12b75df540a5d6 (diff)
downloadqt-creator-5e622a32032079a8fc1a1018d21be54b434e6217.tar.gz
Use nullptr and member initialization in document manager
Change-Id: Iddd446d10cf3fd0a59d46d6ed3ba335f0c93e118 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/documentmanager.cpp')
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index 536252845d..43b6cb212f 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -153,20 +153,20 @@ public:
QList<DocumentManager::RecentFile> m_recentFiles;
static const int m_maxRecentFiles = 7;
- QFileSystemWatcher *m_fileWatcher; // Delayed creation.
- QFileSystemWatcher *m_linkWatcher; // Delayed creation (only UNIX/if a link is seen).
- bool m_blockActivated;
+ QFileSystemWatcher *m_fileWatcher = nullptr; // Delayed creation.
+ QFileSystemWatcher *m_linkWatcher = nullptr; // Delayed creation (only UNIX/if a link is seen).
+ bool m_blockActivated = false;
bool m_checkOnFocusChange = false;
- QString m_lastVisitedDirectory;
+ QString m_lastVisitedDirectory = QDir::currentPath();
QString m_defaultLocationForNewFiles;
FileName m_projectsDirectory;
- bool m_useProjectsDirectory;
+ bool m_useProjectsDirectory = true;
QString m_buildDirectory;
// When we are calling into an IDocument
// we don't want to receive a changed()
// signal
// That makes the code easier
- IDocument *m_blockedIDocument;
+ IDocument *m_blockedIDocument = nullptr;
};
static DocumentManager *m_instance;
@@ -210,13 +210,7 @@ void DocumentManagerPrivate::onApplicationFocusChange()
m_instance->checkForReload();
}
-DocumentManagerPrivate::DocumentManagerPrivate() :
- m_fileWatcher(0),
- m_linkWatcher(0),
- m_blockActivated(false),
- m_lastVisitedDirectory(QDir::currentPath()),
- m_useProjectsDirectory(true),
- m_blockedIDocument(0)
+DocumentManagerPrivate::DocumentManagerPrivate()
{
connect(qApp, &QApplication::focusChanged, this, &DocumentManagerPrivate::onApplicationFocusChange);
}
@@ -273,7 +267,7 @@ static void addFileInfo(IDocument *document, const QString &filePath,
const QString watchedFilePath = d->m_states.value(filePathKey).watchedFilePath;
qCDebug(log) << "adding (" << (isLink ? "link" : "full") << ") watch for"
<< watchedFilePath;
- QFileSystemWatcher *watcher = 0;
+ QFileSystemWatcher *watcher = nullptr;
if (isLink)
watcher = d->linkWatcher();
else
@@ -432,7 +426,7 @@ void DocumentManager::renamedFile(const QString &from, const QString &to)
removeFileInfo(document);
document->setFilePath(FileName::fromString(to));
addFileInfo(document);
- d->m_blockedIDocument = 0;
+ d->m_blockedIDocument = nullptr;
}
emit m_instance->allDocumentsRenamed(from, to);
}
@@ -620,7 +614,7 @@ static bool saveModifiedFilesHelper(const QList<IDocument *> &documents,
// There can be several IDocuments pointing to the same file
// Prefer one that is not readonly
// (even though it *should* not happen that the IDocuments are inconsistent with readonly)
- if (!modifiedDocumentsMap.key(name, 0) || !document->isFileReadOnly())
+ if (!modifiedDocumentsMap.key(name, nullptr) || !document->isFileReadOnly())
modifiedDocumentsMap.insert(document, name);
}
}
@@ -830,10 +824,17 @@ bool DocumentManager::saveAllModifiedDocumentsSilently(bool *canceled,
\a FailedToClose will contain a list of documents that could not be saved if passed into the
method.
*/
-bool DocumentManager::saveModifiedDocumentsSilently(const QList<IDocument *> &documents, bool *canceled,
+bool DocumentManager::saveModifiedDocumentsSilently(const QList<IDocument *> &documents,
+ bool *canceled,
QList<IDocument *> *failedToClose)
{
- return saveModifiedFilesHelper(documents, QString(), canceled, true, QString(), 0, failedToClose);
+ return saveModifiedFilesHelper(documents,
+ QString(),
+ canceled,
+ true,
+ QString(),
+ nullptr,
+ failedToClose);
}
/*!
@@ -1181,7 +1182,7 @@ void DocumentManager::checkForReload()
errorStrings << errorString;
}
- d->m_blockedIDocument = 0;
+ d->m_blockedIDocument = nullptr;
}
if (!filesToDiff.isEmpty()) {