GUI: modernize, replace NULL with nullptr

This commit is contained in:
Daniel Marjamäki 2017-07-31 15:19:51 +02:00
parent 373f33406b
commit 17d9f88d9e
1 changed files with 16 additions and 16 deletions

View File

@ -54,9 +54,9 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
mSettings(settings), mSettings(settings),
mApplications(new ApplicationList(this)), mApplications(new ApplicationList(this)),
mTranslation(th), mTranslation(th),
mLogView(NULL), mLogView(nullptr),
mScratchPad(NULL), mScratchPad(nullptr),
mProjectFile(NULL), mProjectFile(nullptr),
mPlatformActions(new QActionGroup(this)), mPlatformActions(new QActionGroup(this)),
mCStandardActions(new QActionGroup(this)), mCStandardActions(new QActionGroup(this)),
mCppStandardActions(new QActionGroup(this)), mCppStandardActions(new QActionGroup(this)),
@ -162,7 +162,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
connect(mRecentProjectActs[i], SIGNAL(triggered()), connect(mRecentProjectActs[i], SIGNAL(triggered()),
this, SLOT(openRecentProject())); this, SLOT(openRecentProject()));
} }
mRecentProjectActs[MaxRecentProjects] = NULL; // The separator mRecentProjectActs[MaxRecentProjects] = nullptr; // The separator
mUI.mActionProjectMRU->setVisible(false); mUI.mActionProjectMRU->setVisible(false);
updateMRUMenuItems(); updateMRUMenuItems();
@ -659,17 +659,17 @@ Library::Error MainWindow::loadLibrary(Library *library, QString filename)
// Try to load the library from the project folder.. // Try to load the library from the project folder..
if (mProjectFile) { if (mProjectFile) {
QString path = QFileInfo(mProjectFile->getFilename()).canonicalPath(); QString path = QFileInfo(mProjectFile->getFilename()).canonicalPath();
ret = library->load(NULL, (path+"/"+filename).toLatin1()); ret = library->load(nullptr, (path+"/"+filename).toLatin1());
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
return ret; return ret;
} }
// Try to load the library from the application folder.. // Try to load the library from the application folder..
const QString appPath = QFileInfo(QCoreApplication::applicationFilePath()).canonicalPath(); const QString appPath = QFileInfo(QCoreApplication::applicationFilePath()).canonicalPath();
ret = library->load(NULL, (appPath+"/"+filename).toLatin1()); ret = library->load(nullptr, (appPath+"/"+filename).toLatin1());
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
return ret; return ret;
ret = library->load(NULL, (appPath+"/cfg/"+filename).toLatin1()); ret = library->load(nullptr, (appPath+"/cfg/"+filename).toLatin1());
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
return ret; return ret;
@ -677,10 +677,10 @@ Library::Error MainWindow::loadLibrary(Library *library, QString filename)
// Try to load the library from CFGDIR.. // Try to load the library from CFGDIR..
const QString cfgdir = CFGDIR; const QString cfgdir = CFGDIR;
if (!cfgdir.isEmpty()) { if (!cfgdir.isEmpty()) {
ret = library->load(NULL, (cfgdir+"/"+filename).toLatin1()); ret = library->load(nullptr, (cfgdir+"/"+filename).toLatin1());
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
return ret; return ret;
ret = library->load(NULL, (cfgdir+"/cfg/"+filename).toLatin1()); ret = library->load(nullptr, (cfgdir+"/cfg/"+filename).toLatin1());
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
return ret; return ret;
} }
@ -689,10 +689,10 @@ Library::Error MainWindow::loadLibrary(Library *library, QString filename)
// Try to load the library from the cfg subfolder.. // Try to load the library from the cfg subfolder..
const QString datadir = mSettings->value("DATADIR", QString()).toString(); const QString datadir = mSettings->value("DATADIR", QString()).toString();
if (!datadir.isEmpty()) { if (!datadir.isEmpty()) {
ret = library->load(NULL, (datadir+"/"+filename).toLatin1()); ret = library->load(nullptr, (datadir+"/"+filename).toLatin1());
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
return ret; return ret;
ret = library->load(NULL, (datadir+"/cfg/"+filename).toLatin1()); ret = library->load(nullptr, (datadir+"/cfg/"+filename).toLatin1());
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
return ret; return ret;
} }
@ -884,7 +884,7 @@ void MainWindow::analysisDone()
} }
for (int i = 0; i < MaxRecentProjects + 1; i++) { for (int i = 0; i < MaxRecentProjects + 1; i++) {
if (mRecentProjectActs[i] != NULL) if (mRecentProjectActs[i] != nullptr)
mRecentProjectActs[i]->setEnabled(true); mRecentProjectActs[i]->setEnabled(true);
} }
@ -910,7 +910,7 @@ void MainWindow::checkLockDownUI()
mScratchPad->setEnabled(false); mScratchPad->setEnabled(false);
for (int i = 0; i < MaxRecentProjects + 1; i++) { for (int i = 0; i < MaxRecentProjects + 1; i++) {
if (mRecentProjectActs[i] != NULL) if (mRecentProjectActs[i] != nullptr)
mRecentProjectActs[i]->setEnabled(false); mRecentProjectActs[i]->setEnabled(false);
} }
} }
@ -1443,7 +1443,7 @@ void MainWindow::newProjectFile()
void MainWindow::closeProjectFile() void MainWindow::closeProjectFile()
{ {
delete mProjectFile; delete mProjectFile;
mProjectFile = NULL; mProjectFile = nullptr;
enableProjectActions(false); enableProjectActions(false);
enableProjectOpenActions(true); enableProjectOpenActions(true);
formatAndSetTitle(); formatAndSetTitle();
@ -1472,7 +1472,7 @@ void MainWindow::editProjectFile()
void MainWindow::showLogView() void MainWindow::showLogView()
{ {
if (mLogView == NULL) if (mLogView == nullptr)
mLogView = new LogView; mLogView = new LogView;
mLogView->show(); mLogView->show();
@ -1563,7 +1563,7 @@ void MainWindow::openRecentProject()
void MainWindow::updateMRUMenuItems() void MainWindow::updateMRUMenuItems()
{ {
for (int i = 0; i < MaxRecentProjects + 1; i++) { for (int i = 0; i < MaxRecentProjects + 1; i++) {
if (mRecentProjectActs[i] != NULL) if (mRecentProjectActs[i] != nullptr)
mUI.mMenuFile->removeAction(mRecentProjectActs[i]); mUI.mMenuFile->removeAction(mRecentProjectActs[i]);
} }