From d423a8c640c4d311855025b6e071d179225a3807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 30 Jul 2017 11:19:47 +0200 Subject: [PATCH] GUI: Renamed methods 'Check' => 'Analyze' --- gui/mainwindow.cpp | 42 +++++++++++++++++++++--------------------- gui/mainwindow.h | 18 +++++++++--------- gui/scratchpad.cpp | 2 +- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index c75e22727..83ea24dc7 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -84,8 +84,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : connect(mUI.mActionPrint, SIGNAL(triggered()), mUI.mResults, SLOT(print())); connect(mUI.mActionPrintPreview, SIGNAL(triggered()), mUI.mResults, SLOT(printPreview())); connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close())); - connect(mUI.mActionAnalyzeFiles, SIGNAL(triggered()), this, SLOT(checkFiles())); - connect(mUI.mActionAnalyzeDirectory, SIGNAL(triggered()), this, SLOT(checkDirectory())); + connect(mUI.mActionAnalyzeFiles, SIGNAL(triggered()), this, SLOT(analyzeFiles())); + connect(mUI.mActionAnalyzeDirectory, SIGNAL(triggered()), this, SLOT(analyzeDirectory())); connect(mUI.mActionSettings, SIGNAL(triggered()), this, SLOT(programSettings())); connect(mUI.mActionClearResults, SIGNAL(triggered()), this, SLOT(clearResults())); connect(mUI.mActionOpenXML, SIGNAL(triggered()), this, SLOT(openResults())); @@ -105,10 +105,10 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(showStatistics())); connect(mUI.mActionLibraryEditor, SIGNAL(triggered()), this, SLOT(showLibraryEditor())); - connect(mUI.mActionReanalyzeModified, SIGNAL(triggered()), this, SLOT(reCheckModified())); - connect(mUI.mActionReanalyzeAll, SIGNAL(triggered()), this, SLOT(reCheckAll())); + connect(mUI.mActionReanalyzeModified, SIGNAL(triggered()), this, SLOT(reAnalyzeModified())); + connect(mUI.mActionReanalyzeAll, SIGNAL(triggered()), this, SLOT(reAnalyzeAll())); - connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(stopChecking())); + connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(stopAnalysis())); connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(save())); // About menu @@ -477,7 +477,7 @@ void MainWindow::doCheckFiles(const QStringList &files) mThread->check(checkSettings, true); } -void MainWindow::checkCode(const QString& code, const QString& filename) +void MainWindow::analyzeCode(const QString& code, const QString& filename) { // Initialize dummy ThreadResult as ErrorLogger ThreadResult result; @@ -500,10 +500,10 @@ void MainWindow::checkCode(const QString& code, const QString& filename) clearResults(); mUI.mResults->checkingStarted(1); cppcheck.check(filename.toStdString(), code.toStdString()); - checkDone(); + analysisDone(); } -QStringList MainWindow::selectFilesToCheck(QFileDialog::FileMode mode) +QStringList MainWindow::selectFilesToAnalyze(QFileDialog::FileMode mode) { if (mProject) { QMessageBox msgBox(this); @@ -553,9 +553,9 @@ QStringList MainWindow::selectFilesToCheck(QFileDialog::FileMode mode) return selected; } -void MainWindow::checkFiles() +void MainWindow::analyzeFiles() { - QStringList selected = selectFilesToCheck(QFileDialog::ExistingFiles); + QStringList selected = selectFilesToAnalyze(QFileDialog::ExistingFiles); const QString file0 = (selected.size() ? selected[0].toLower() : ""); if (file0.endsWith(".sln") || file0.endsWith(".vcxproj") || file0.endsWith(compile_commands_json)) { @@ -585,9 +585,9 @@ void MainWindow::checkFiles() doCheckFiles(selected); } -void MainWindow::checkDirectory() +void MainWindow::analyzeDirectory() { - QStringList dir = selectFilesToCheck(QFileDialog::DirectoryOnly); + QStringList dir = selectFilesToAnalyze(QFileDialog::DirectoryOnly); if (dir.isEmpty()) return; @@ -849,7 +849,7 @@ Settings MainWindow::getCppcheckSettings() return result; } -void MainWindow::checkDone() +void MainWindow::analysisDone() { if (mExiting) { close(); @@ -939,14 +939,14 @@ void MainWindow::programSettings() } } -void MainWindow::reCheckModified() +void MainWindow::reAnalyzeModified() { - reCheck(false); + reAnalyze(false); } -void MainWindow::reCheckAll() +void MainWindow::reAnalyzeAll() { - reCheck(true); + reAnalyze(true); } void MainWindow::reCheckSelected(QStringList files, bool all) @@ -979,7 +979,7 @@ void MainWindow::reCheckSelected(QStringList files, bool all) mThread->setCheckStartTime(saveCheckStartTime); } -void MainWindow::reCheck(bool all) +void MainWindow::reAnalyze(bool all) { const QStringList files = mThread->getReCheckFiles(all); if (files.empty()) @@ -1068,8 +1068,8 @@ void MainWindow::enableCheckButtons(bool enable) mUI.mActionStop->setEnabled(!enable); mUI.mActionAnalyzeFiles->setEnabled(enable); - if (!enable || mThread->hasPreviousFiles()) { - mUI.mActionReanalyzeModified->setEnabled(enable); + if (!enable || mProject || mThread->hasPreviousFiles()) { + mUI.mActionReanalyzeModified->setEnabled(!mProject && enable); mUI.mActionReanalyzeAll->setEnabled(enable); } @@ -1276,7 +1276,7 @@ void MainWindow::aboutToShowViewMenu() mUI.mActionToolBarFilter->setChecked(mUI.mToolBarFilter->isVisible()); } -void MainWindow::stopChecking() +void MainWindow::stopAnalysis() { mThread->stop(); mUI.mResults->disableProgressbar(); diff --git a/gui/mainwindow.h b/gui/mainwindow.h index e8a19c901..de7ddb3cc 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -68,15 +68,15 @@ public: * @param code Content of the (virtual) file to be checked * @param filename Name of the (virtual) file to be checked - determines language. */ - void checkCode(const QString& code, const QString& filename); + void analyzeCode(const QString& code, const QString& filename); public slots: /** @brief Slot for check files menu item */ - void checkFiles(); + void analyzeFiles(); /** @brief Slot to recheck all files */ - void reCheckAll(); + void reAnalyzeAll(); /** * @brief Slot to recheck selected files @@ -85,7 +85,7 @@ public slots: void performSelectedFilesCheck(QStringList selectedFilesList); /** @brief Slot to recheck modified files */ - void reCheckModified(); + void reAnalyzeModified(); /** @brief Slot to clear all search results */ void clearResults(); @@ -136,7 +136,7 @@ public slots: void uncheckAll(); /** @brief Slot for check directory menu item */ - void checkDirectory(); + void analyzeDirectory(); /** @brief Slot to open program's settings dialog */ void programSettings(); @@ -180,7 +180,7 @@ public slots: protected slots: /** @brief Slot for checkthread's done signal */ - void checkDone(); + void analysisDone(); /** @brief Lock down UI while checking */ void checkLockDownUI(); @@ -201,7 +201,7 @@ protected slots: void aboutToShowViewMenu(); /** @brief Slot when stop checking button is pressed */ - void stopChecking(); + void stopAnalysis(); /** @brief Open help file contents */ void openHelpContents(); @@ -224,7 +224,7 @@ protected slots: private: /** @brief Rechecks files */ - void reCheck(bool all); + void reAnalyze(bool all); /** * @brief Recheck selected files @@ -265,7 +265,7 @@ private: * @param mode Dialog open mode (files or directories) * @return QStringList of files or directories that were selected to check */ - QStringList selectFilesToCheck(QFileDialog::FileMode mode); + QStringList selectFilesToAnalyze(QFileDialog::FileMode mode); /** * @brief Check project diff --git a/gui/scratchpad.cpp b/gui/scratchpad.cpp index 875db4882..a882a78d2 100644 --- a/gui/scratchpad.cpp +++ b/gui/scratchpad.cpp @@ -34,5 +34,5 @@ void ScratchPad::checkButtonClicked() QString filename = mUI.lineEdit->text(); if (filename.isEmpty()) filename = "test.cpp"; - mMainWindow.checkCode(mUI.plainTextEdit->toPlainText(), filename); + mMainWindow.analyzeCode(mUI.plainTextEdit->toPlainText(), filename); }