GUI: Renamed methods 'Check' => 'Analyze'

This commit is contained in:
Daniel Marjamäki 2017-07-30 11:19:47 +02:00
parent d09cdfd63f
commit d423a8c640
3 changed files with 31 additions and 31 deletions

View File

@ -84,8 +84,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
connect(mUI.mActionPrint, SIGNAL(triggered()), mUI.mResults, SLOT(print())); connect(mUI.mActionPrint, SIGNAL(triggered()), mUI.mResults, SLOT(print()));
connect(mUI.mActionPrintPreview, SIGNAL(triggered()), mUI.mResults, SLOT(printPreview())); connect(mUI.mActionPrintPreview, SIGNAL(triggered()), mUI.mResults, SLOT(printPreview()));
connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close()));
connect(mUI.mActionAnalyzeFiles, SIGNAL(triggered()), this, SLOT(checkFiles())); connect(mUI.mActionAnalyzeFiles, SIGNAL(triggered()), this, SLOT(analyzeFiles()));
connect(mUI.mActionAnalyzeDirectory, SIGNAL(triggered()), this, SLOT(checkDirectory())); connect(mUI.mActionAnalyzeDirectory, SIGNAL(triggered()), this, SLOT(analyzeDirectory()));
connect(mUI.mActionSettings, SIGNAL(triggered()), this, SLOT(programSettings())); connect(mUI.mActionSettings, SIGNAL(triggered()), this, SLOT(programSettings()));
connect(mUI.mActionClearResults, SIGNAL(triggered()), this, SLOT(clearResults())); connect(mUI.mActionClearResults, SIGNAL(triggered()), this, SLOT(clearResults()));
connect(mUI.mActionOpenXML, SIGNAL(triggered()), this, SLOT(openResults())); 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.mActionViewStats, SIGNAL(triggered()), this, SLOT(showStatistics()));
connect(mUI.mActionLibraryEditor, SIGNAL(triggered()), this, SLOT(showLibraryEditor())); connect(mUI.mActionLibraryEditor, SIGNAL(triggered()), this, SLOT(showLibraryEditor()));
connect(mUI.mActionReanalyzeModified, SIGNAL(triggered()), this, SLOT(reCheckModified())); connect(mUI.mActionReanalyzeModified, SIGNAL(triggered()), this, SLOT(reAnalyzeModified()));
connect(mUI.mActionReanalyzeAll, SIGNAL(triggered()), this, SLOT(reCheckAll())); 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())); connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(save()));
// About menu // About menu
@ -477,7 +477,7 @@ void MainWindow::doCheckFiles(const QStringList &files)
mThread->check(checkSettings, true); 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 // Initialize dummy ThreadResult as ErrorLogger
ThreadResult result; ThreadResult result;
@ -500,10 +500,10 @@ void MainWindow::checkCode(const QString& code, const QString& filename)
clearResults(); clearResults();
mUI.mResults->checkingStarted(1); mUI.mResults->checkingStarted(1);
cppcheck.check(filename.toStdString(), code.toStdString()); cppcheck.check(filename.toStdString(), code.toStdString());
checkDone(); analysisDone();
} }
QStringList MainWindow::selectFilesToCheck(QFileDialog::FileMode mode) QStringList MainWindow::selectFilesToAnalyze(QFileDialog::FileMode mode)
{ {
if (mProject) { if (mProject) {
QMessageBox msgBox(this); QMessageBox msgBox(this);
@ -553,9 +553,9 @@ QStringList MainWindow::selectFilesToCheck(QFileDialog::FileMode mode)
return selected; 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() : ""); const QString file0 = (selected.size() ? selected[0].toLower() : "");
if (file0.endsWith(".sln") || file0.endsWith(".vcxproj") || file0.endsWith(compile_commands_json)) { if (file0.endsWith(".sln") || file0.endsWith(".vcxproj") || file0.endsWith(compile_commands_json)) {
@ -585,9 +585,9 @@ void MainWindow::checkFiles()
doCheckFiles(selected); doCheckFiles(selected);
} }
void MainWindow::checkDirectory() void MainWindow::analyzeDirectory()
{ {
QStringList dir = selectFilesToCheck(QFileDialog::DirectoryOnly); QStringList dir = selectFilesToAnalyze(QFileDialog::DirectoryOnly);
if (dir.isEmpty()) if (dir.isEmpty())
return; return;
@ -849,7 +849,7 @@ Settings MainWindow::getCppcheckSettings()
return result; return result;
} }
void MainWindow::checkDone() void MainWindow::analysisDone()
{ {
if (mExiting) { if (mExiting) {
close(); 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) void MainWindow::reCheckSelected(QStringList files, bool all)
@ -979,7 +979,7 @@ void MainWindow::reCheckSelected(QStringList files, bool all)
mThread->setCheckStartTime(saveCheckStartTime); mThread->setCheckStartTime(saveCheckStartTime);
} }
void MainWindow::reCheck(bool all) void MainWindow::reAnalyze(bool all)
{ {
const QStringList files = mThread->getReCheckFiles(all); const QStringList files = mThread->getReCheckFiles(all);
if (files.empty()) if (files.empty())
@ -1068,8 +1068,8 @@ void MainWindow::enableCheckButtons(bool enable)
mUI.mActionStop->setEnabled(!enable); mUI.mActionStop->setEnabled(!enable);
mUI.mActionAnalyzeFiles->setEnabled(enable); mUI.mActionAnalyzeFiles->setEnabled(enable);
if (!enable || mThread->hasPreviousFiles()) { if (!enable || mProject || mThread->hasPreviousFiles()) {
mUI.mActionReanalyzeModified->setEnabled(enable); mUI.mActionReanalyzeModified->setEnabled(!mProject && enable);
mUI.mActionReanalyzeAll->setEnabled(enable); mUI.mActionReanalyzeAll->setEnabled(enable);
} }
@ -1276,7 +1276,7 @@ void MainWindow::aboutToShowViewMenu()
mUI.mActionToolBarFilter->setChecked(mUI.mToolBarFilter->isVisible()); mUI.mActionToolBarFilter->setChecked(mUI.mToolBarFilter->isVisible());
} }
void MainWindow::stopChecking() void MainWindow::stopAnalysis()
{ {
mThread->stop(); mThread->stop();
mUI.mResults->disableProgressbar(); mUI.mResults->disableProgressbar();

View File

@ -68,15 +68,15 @@ public:
* @param code Content of the (virtual) file to be checked * @param code Content of the (virtual) file to be checked
* @param filename Name of the (virtual) file to be checked - determines language. * @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: public slots:
/** @brief Slot for check files menu item */ /** @brief Slot for check files menu item */
void checkFiles(); void analyzeFiles();
/** @brief Slot to recheck all files */ /** @brief Slot to recheck all files */
void reCheckAll(); void reAnalyzeAll();
/** /**
* @brief Slot to recheck selected files * @brief Slot to recheck selected files
@ -85,7 +85,7 @@ public slots:
void performSelectedFilesCheck(QStringList selectedFilesList); void performSelectedFilesCheck(QStringList selectedFilesList);
/** @brief Slot to recheck modified files */ /** @brief Slot to recheck modified files */
void reCheckModified(); void reAnalyzeModified();
/** @brief Slot to clear all search results */ /** @brief Slot to clear all search results */
void clearResults(); void clearResults();
@ -136,7 +136,7 @@ public slots:
void uncheckAll(); void uncheckAll();
/** @brief Slot for check directory menu item */ /** @brief Slot for check directory menu item */
void checkDirectory(); void analyzeDirectory();
/** @brief Slot to open program's settings dialog */ /** @brief Slot to open program's settings dialog */
void programSettings(); void programSettings();
@ -180,7 +180,7 @@ public slots:
protected slots: protected slots:
/** @brief Slot for checkthread's done signal */ /** @brief Slot for checkthread's done signal */
void checkDone(); void analysisDone();
/** @brief Lock down UI while checking */ /** @brief Lock down UI while checking */
void checkLockDownUI(); void checkLockDownUI();
@ -201,7 +201,7 @@ protected slots:
void aboutToShowViewMenu(); void aboutToShowViewMenu();
/** @brief Slot when stop checking button is pressed */ /** @brief Slot when stop checking button is pressed */
void stopChecking(); void stopAnalysis();
/** @brief Open help file contents */ /** @brief Open help file contents */
void openHelpContents(); void openHelpContents();
@ -224,7 +224,7 @@ protected slots:
private: private:
/** @brief Rechecks files */ /** @brief Rechecks files */
void reCheck(bool all); void reAnalyze(bool all);
/** /**
* @brief Recheck selected files * @brief Recheck selected files
@ -265,7 +265,7 @@ private:
* @param mode Dialog open mode (files or directories) * @param mode Dialog open mode (files or directories)
* @return QStringList of files or directories that were selected to check * @return QStringList of files or directories that were selected to check
*/ */
QStringList selectFilesToCheck(QFileDialog::FileMode mode); QStringList selectFilesToAnalyze(QFileDialog::FileMode mode);
/** /**
* @brief Check project * @brief Check project

View File

@ -34,5 +34,5 @@ void ScratchPad::checkButtonClicked()
QString filename = mUI.lineEdit->text(); QString filename = mUI.lineEdit->text();
if (filename.isEmpty()) if (filename.isEmpty())
filename = "test.cpp"; filename = "test.cpp";
mMainWindow.checkCode(mUI.plainTextEdit->toPlainText(), filename); mMainWindow.analyzeCode(mUI.plainTextEdit->toPlainText(), filename);
} }