GUI: minor gui updates

* when loading xml results, show filename in window title
 * when xml results are loaded, enable the save/print/etc buttons
This commit is contained in:
Daniel Marjamäki 2018-04-12 08:15:04 +02:00
parent a36dad918a
commit 308e044769
2 changed files with 17 additions and 14 deletions

View File

@ -158,10 +158,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
enableCheckButtons(true);
mUI.mActionPrint->setShortcut(QKeySequence::Print);
mUI.mActionPrint->setEnabled(false);
mUI.mActionPrintPreview->setEnabled(false);
mUI.mActionClearResults->setEnabled(false);
mUI.mActionSave->setEnabled(false);
enableResultsButtons();
enableProjectOpenActions(true);
enableProjectActions(false);
@ -962,12 +959,7 @@ void MainWindow::analysisDone()
}
}
if (mUI.mResults->hasResults()) {
mUI.mActionClearResults->setEnabled(true);
mUI.mActionSave->setEnabled(true);
mUI.mActionPrint->setEnabled(true);
mUI.mActionPrintPreview->setEnabled(true);
}
enableResultsButtons();
for (int i = 0; i < MaxRecentProjects + 1; i++) {
if (mRecentProjectActs[i] != nullptr)
@ -1086,10 +1078,7 @@ void MainWindow::reAnalyze(bool all)
void MainWindow::clearResults()
{
mUI.mResults->clear(true);
mUI.mActionClearResults->setEnabled(false);
mUI.mActionSave->setEnabled(false);
mUI.mActionPrint->setEnabled(false);
mUI.mActionPrintPreview->setEnabled(false);
enableResultsButtons();
}
void MainWindow::openResults()
@ -1136,6 +1125,7 @@ void MainWindow::loadResults(const QString selectedFile)
mUI.mActionReanalyzeAll->setEnabled(false);
mUI.mResults->readErrorsXml(selectedFile);
setPath(SETTINGS_LAST_RESULT_PATH, selectedFile);
formatAndSetTitle(selectedFile);
}
void MainWindow::loadResults(const QString selectedFile, const QString sourceDirectory)
@ -1160,6 +1150,15 @@ void MainWindow::enableCheckButtons(bool enable)
mUI.mActionAnalyzeDirectory->setEnabled(enable);
}
void MainWindow::enableResultsButtons()
{
bool enabled = mUI.mResults->hasResults();
mUI.mActionClearResults->setEnabled(enabled);
mUI.mActionSave->setEnabled(enabled);
mUI.mActionPrint->setEnabled(enabled);
mUI.mActionPrintPreview->setEnabled(enabled);
}
void MainWindow::showStyle(bool checked)
{
mUI.mResults->showResults(ShowTypes::ShowStyle, checked);
@ -1442,6 +1441,7 @@ bool MainWindow::loadLastResults()
mUI.mResults->readErrorsXml(lastResults);
mUI.mResults->setCheckDirectory(mSettings->value(SETTINGS_LAST_CHECK_PATH,QString()).toString());
mUI.mActionViewStats->setEnabled(true);
enableResultsButtons();
return true;
}

View File

@ -255,6 +255,9 @@ private:
/** @brief Helper function to enable/disable all check,recheck buttons */
void enableCheckButtons(bool enable);
/** @brief Helper function to enable/disable results buttons (clear,save,print) */
void enableResultsButtons();
/**
* @brief Select files/or directory to analyze.
* Helper function to open a dialog to ask user to select files or