GUI: Minor tweaks. Rename variables. Make sure statistics menu option is enabled at startup if there are last results

This commit is contained in:
Daniel Marjamäki 2018-02-16 22:22:13 +01:00
parent 5acbae8cfa
commit 79be1257ca
1 changed files with 15 additions and 14 deletions

View File

@ -188,16 +188,16 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
mUI.mActionEditProjectFile->setEnabled(mProjectFile != nullptr); mUI.mActionEditProjectFile->setEnabled(mProjectFile != nullptr);
for (int i = 0; i < mPlatforms.getCount(); i++) { for (int i = 0; i < mPlatforms.getCount(); i++) {
Platform plat = mPlatforms.mPlatforms[i]; Platform platform = mPlatforms.mPlatforms[i];
QAction *act = new QAction(this); QAction *action = new QAction(this);
plat.mActMainWindow = act; platform.mActMainWindow = action;
mPlatforms.mPlatforms[i] = plat; mPlatforms.mPlatforms[i] = platform;
act->setText(plat.mTitle); action->setText(platform.mTitle);
act->setData(plat.mType); action->setData(platform.mType);
act->setCheckable(true); action->setCheckable(true);
act->setActionGroup(mPlatformActions); action->setActionGroup(mPlatformActions);
mUI.mMenuAnalyze->insertAction(mUI.mActionPlatforms, act); mUI.mMenuAnalyze->insertAction(mUI.mActionPlatforms, action);
connect(act, SIGNAL(triggered()), this, SLOT(selectPlatform())); connect(action, SIGNAL(triggered()), this, SLOT(selectPlatform()));
} }
mUI.mActionC89->setActionGroup(mCStandardActions); mUI.mActionC89->setActionGroup(mCStandardActions);
@ -216,12 +216,12 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
// For other platforms default to unspecified/default which means the // For other platforms default to unspecified/default which means the
// platform Cppcheck GUI was compiled on. // platform Cppcheck GUI was compiled on.
#if defined(_WIN32) #if defined(_WIN32)
const Settings::PlatformType defaultPlat = Settings::Win32W; const Settings::PlatformType defaultPlatform = Settings::Win32W;
#else #else
const Settings::PlatformType defaultPlat = Settings::Unspecified; const Settings::PlatformType defaultPlatform = Settings::Unspecified;
#endif #endif
Platform &plat = mPlatforms.get((Settings::PlatformType)mSettings->value(SETTINGS_CHECKED_PLATFORM, defaultPlat).toInt()); Platform &platform = mPlatforms.get((Settings::PlatformType)mSettings->value(SETTINGS_CHECKED_PLATFORM, defaultPlatform).toInt());
plat.mActMainWindow->setChecked(true); platform.mActMainWindow->setChecked(true);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -1421,6 +1421,7 @@ bool MainWindow::loadLastResults()
return false; return false;
mUI.mResults->readErrorsXml(lastResults); mUI.mResults->readErrorsXml(lastResults);
mUI.mResults->setCheckDirectory(mSettings->value(SETTINGS_LAST_CHECK_PATH,QString()).toString()); mUI.mResults->setCheckDirectory(mSettings->value(SETTINGS_LAST_CHECK_PATH,QString()).toString());
mUI.mActionViewStats->setEnabled(true);
return true; return true;
} }