diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index f66443475..bf12054c2 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -66,7 +66,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : { mUI.setupUi(this); mThread = new ThreadHandler(this); - mUI.mResults->Initialize(mSettings, mApplications, mThread); + mUI.mResults->initialize(mSettings, mApplications, mThread); // Filter timer to delay filtering results slightly while typing mFilterTimer = new QTimer(this); @@ -256,7 +256,7 @@ void MainWindow::loadSettings() mSettings->value(SETTINGS_WINDOW_HEIGHT, 600).toInt()); } - ShowTypes *types = mUI.mResults->GetShowTypes(); + ShowTypes *types = mUI.mResults->getShowTypes(); mUI.mActionShowStyle->setChecked(types->isShown(ShowTypes::ShowStyle)); mUI.mActionShowErrors->setChecked(types->isShown(ShowTypes::ShowErrors)); mUI.mActionShowWarnings->setChecked(types->isShown(ShowTypes::ShowWarnings)); @@ -352,7 +352,7 @@ void MainWindow::saveSettings() const mApplications->saveSettings(); mSettings->setValue(SETTINGS_LANGUAGE, mTranslation->GetCurrentLanguage()); - mUI.mResults->SaveSettings(mSettings); + mUI.mResults->saveSettings(mSettings); } void MainWindow::doCheckProject(ImportProject p) @@ -370,10 +370,10 @@ void MainWindow::doCheckProject(ImportProject p) enableProjectActions(false); } - mUI.mResults->Clear(true); + mUI.mResults->clear(true); mThread->ClearFiles(); - mUI.mResults->CheckingStarted(p.fileSettings.size()); + mUI.mResults->checkingStarted(p.fileSettings.size()); QDir inf(mCurrentDirectory); const QString checkPath = inf.canonicalPath(); @@ -381,7 +381,7 @@ void MainWindow::doCheckProject(ImportProject p) checkLockDownUI(); // lock UI while checking - mUI.mResults->SetCheckDirectory(checkPath); + mUI.mResults->setCheckDirectory(checkPath); Settings checkSettings = getCppcheckSettings(); checkSettings.force = false; @@ -415,7 +415,7 @@ void MainWindow::doCheckFiles(const QStringList &files) } QStringList fileNames = pathList.getFileList(); - mUI.mResults->Clear(true); + mUI.mResults->clear(true); mThread->ClearFiles(); if (fileNames.isEmpty()) { @@ -428,7 +428,7 @@ void MainWindow::doCheckFiles(const QStringList &files) return; } - mUI.mResults->CheckingStarted(fileNames.count()); + mUI.mResults->checkingStarted(fileNames.count()); mThread->SetFiles(fileNames); QDir inf(mCurrentDirectory); @@ -437,7 +437,7 @@ void MainWindow::doCheckFiles(const QStringList &files) checkLockDownUI(); // lock UI while checking - mUI.mResults->SetCheckDirectory(checkPath); + mUI.mResults->setCheckDirectory(checkPath); Settings checkSettings = getCppcheckSettings(); if (mProject) @@ -475,7 +475,7 @@ void MainWindow::checkCode(const QString& code, const QString& filename) // Check checkLockDownUI(); clearResults(); - mUI.mResults->CheckingStarted(1); + mUI.mResults->checkingStarted(1); cppcheck.check(filename.toStdString(), code.toStdString()); checkDone(); } @@ -833,7 +833,7 @@ void MainWindow::checkDone() return; } - mUI.mResults->CheckingFinished(); + mUI.mResults->checkingFinished(); enableCheckButtons(true); mUI.mActionSettings->setEnabled(true); mUI.mActionOpenXML->setEnabled(true); @@ -852,7 +852,7 @@ void MainWindow::checkDone() if (mScratchPad) mScratchPad->setEnabled(true); - if (mUI.mResults->HasResults()) { + if (mUI.mResults->hasResults()) { mUI.mActionClearResults->setEnabled(true); mUI.mActionSave->setEnabled(true); mUI.mActionPrint->setEnabled(true); @@ -896,7 +896,7 @@ void MainWindow::programSettings() SettingsDialog dialog(mApplications, mTranslation, this); if (dialog.exec() == QDialog::Accepted) { dialog.SaveSettingValues(); - mUI.mResults->UpdateSettings(dialog.ShowFullPath(), + mUI.mResults->updateSettings(dialog.ShowFullPath(), dialog.SaveFullPath(), dialog.SaveAllErrors(), dialog.ShowNoErrorsMessage(), @@ -925,18 +925,18 @@ void MainWindow::reCheckSelected(QStringList files, bool all) return; // Clear details, statistics and progress - mUI.mResults->Clear(false); + mUI.mResults->clear(false); for (int i = 0; i < files.size(); ++i) - mUI.mResults->ClearRecheckFile(files[i]); + mUI.mResults->clearRecheckFile(files[i]); - mCurrentDirectory = mUI.mResults->GetCheckDirectory(); + mCurrentDirectory = mUI.mResults->getCheckDirectory(); FileList pathList; pathList.addPathList(files); if (mProject) pathList.addExcludeList(mProject->getProjectFile()->getExcludedPaths()); QStringList fileNames = pathList.getFileList(); checkLockDownUI(); // lock UI while checking - mUI.mResults->CheckingStarted(fileNames.size()); + mUI.mResults->checkingStarted(fileNames.size()); mThread->SetCheckFiles(fileNames); // Saving last check start time, otherwise unchecked modified files will not be @@ -954,14 +954,14 @@ void MainWindow::reCheck(bool all) return; // Clear details, statistics and progress - mUI.mResults->Clear(all); + mUI.mResults->clear(all); // Clear results for changed files for (int i = 0; i < files.size(); ++i) - mUI.mResults->Clear(files[i]); + mUI.mResults->clear(files[i]); checkLockDownUI(); // lock UI while checking - mUI.mResults->CheckingStarted(files.size()); + mUI.mResults->checkingStarted(files.size()); if (mProject) qDebug() << "Rechecking project file" << mProject->getProjectFile()->getFilename(); @@ -972,7 +972,7 @@ void MainWindow::reCheck(bool all) void MainWindow::clearResults() { - mUI.mResults->Clear(true); + mUI.mResults->clear(true); mUI.mActionClearResults->setEnabled(false); mUI.mActionSave->setEnabled(false); mUI.mActionPrint->setEnabled(false); @@ -981,7 +981,7 @@ void MainWindow::clearResults() void MainWindow::openResults() { - if (mUI.mResults->HasResults()) { + if (mUI.mResults->hasResults()) { QMessageBox msgBox(this); msgBox.setWindowTitle(tr("Cppcheck")); const QString msg(tr("Current results will be cleared.\n\n" @@ -1017,10 +1017,10 @@ void MainWindow::loadResults(const QString selectedFile) if (mProject) closeProjectFile(); mIsLogfileLoaded = true; - mUI.mResults->Clear(true); + mUI.mResults->clear(true); mUI.mActionRecheckModified->setEnabled(false); mUI.mActionRecheckAll->setEnabled(false); - mUI.mResults->ReadErrorsXml(selectedFile); + mUI.mResults->readErrorsXml(selectedFile); setPath(SETTINGS_LAST_RESULT_PATH, selectedFile); } } @@ -1028,7 +1028,7 @@ void MainWindow::loadResults(const QString selectedFile) void MainWindow::loadResults(const QString selectedFile, const QString sourceDirectory) { loadResults(selectedFile); - mUI.mResults->SetCheckDirectory(sourceDirectory); + mUI.mResults->setCheckDirectory(sourceDirectory); } void MainWindow::enableCheckButtons(bool enable) @@ -1046,32 +1046,32 @@ void MainWindow::enableCheckButtons(bool enable) void MainWindow::showStyle(bool checked) { - mUI.mResults->ShowResults(ShowTypes::ShowStyle, checked); + mUI.mResults->showResults(ShowTypes::ShowStyle, checked); } void MainWindow::showErrors(bool checked) { - mUI.mResults->ShowResults(ShowTypes::ShowErrors, checked); + mUI.mResults->showResults(ShowTypes::ShowErrors, checked); } void MainWindow::showWarnings(bool checked) { - mUI.mResults->ShowResults(ShowTypes::ShowWarnings, checked); + mUI.mResults->showResults(ShowTypes::ShowWarnings, checked); } void MainWindow::showPortability(bool checked) { - mUI.mResults->ShowResults(ShowTypes::ShowPortability, checked); + mUI.mResults->showResults(ShowTypes::ShowPortability, checked); } void MainWindow::showPerformance(bool checked) { - mUI.mResults->ShowResults(ShowTypes::ShowPerformance, checked); + mUI.mResults->showResults(ShowTypes::ShowPerformance, checked); } void MainWindow::showInformation(bool checked) { - mUI.mResults->ShowResults(ShowTypes::ShowInformation, checked); + mUI.mResults->showResults(ShowTypes::ShowInformation, checked); } void MainWindow::checkAll() @@ -1194,7 +1194,7 @@ void MainWindow::save() type = Report::CSV; } - mUI.mResults->Save(selectedFile, type); + mUI.mResults->save(selectedFile, type); setPath(SETTINGS_LAST_RESULT_PATH, selectedFile); } } @@ -1238,7 +1238,7 @@ void MainWindow::setLanguage(const QString &code) if (mTranslation->SetLanguage(code)) { //Translate everything that is visible here mUI.retranslateUi(this); - mUI.mResults->Translate(); + mUI.mResults->translate(); delete mLogView; mLogView = 0; } @@ -1254,7 +1254,7 @@ void MainWindow::aboutToShowViewMenu() void MainWindow::stopChecking() { mThread->Stop(); - mUI.mResults->DisableProgressbar(); + mUI.mResults->disableProgressbar(); } void MainWindow::openHelpContents() @@ -1434,7 +1434,7 @@ void MainWindow::showStatistics() statsDialog.setPathSelected(mCurrentDirectory); statsDialog.setNumberOfFilesScanned(mThread->GetPreviousFilesCount()); statsDialog.setScanDuration(mThread->GetPreviousScanDuration() / 1000.0); - statsDialog.setStatistics(mUI.mResults->GetStatistics()); + statsDialog.setStatistics(mUI.mResults->getStatistics()); statsDialog.exec(); } @@ -1461,7 +1461,7 @@ void MainWindow::debugError(const ErrorItem &item) void MainWindow::filterResults() { - mUI.mResults->FilterResults(mLineEditFilter->text()); + mUI.mResults->filterResults(mLineEditFilter->text()); } void MainWindow::enableProjectActions(bool enable) diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 1a9d8332c..7445c976e 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -53,7 +53,7 @@ ResultsView::ResultsView(QWidget * parent) : connect(mUI.mTree, SIGNAL(selectionChanged(const QModelIndex &)), this, SLOT(UpdateDetails(const QModelIndex &))); } -void ResultsView::Initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler) +void ResultsView::initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler) { mUI.mProgress->setMinimum(0); mUI.mProgress->setVisible(false); @@ -70,7 +70,7 @@ ResultsView::~ResultsView() //dtor } -void ResultsView::Clear(bool results) +void ResultsView::clear(bool results) { if (results) { mUI.mTree->clear(); @@ -86,58 +86,58 @@ void ResultsView::Clear(bool results) mUI.mProgress->setFormat("%p%"); } -void ResultsView::Clear(const QString &filename) +void ResultsView::clear(const QString &filename) { mUI.mTree->clear(filename); } -void ResultsView::ClearRecheckFile(const QString &filename) +void ResultsView::clearRecheckFile(const QString &filename) { mUI.mTree->clearRecheckFile(filename); } -void ResultsView::Progress(int value, const QString& description) +void ResultsView::progress(int value, const QString& description) { mUI.mProgress->setValue(value); mUI.mProgress->setFormat(QString("%p% (%1)").arg(description)); } -void ResultsView::Error(const ErrorItem &item) +void ResultsView::error(const ErrorItem &item) { if (mUI.mTree->addErrorItem(item)) { - emit GotResults(); + emit gotResults(); mStatistics->addItem(ShowTypes::SeverityToShowType(item.severity)); } } -void ResultsView::ShowResults(ShowTypes::ShowType type, bool show) +void ResultsView::showResults(ShowTypes::ShowType type, bool show) { mUI.mTree->showResults(type, show); } -void ResultsView::CollapseAllResults() +void ResultsView::collapseAllResults() { mUI.mTree->collapseAll(); } -void ResultsView::ExpandAllResults() +void ResultsView::expandAllResults() { mUI.mTree->expandAll(); } -void ResultsView::ShowHiddenResults() +void ResultsView::showHiddenResults() { mUI.mTree->showHiddenResults(); } -void ResultsView::FilterResults(const QString& filter) +void ResultsView::filterResults(const QString& filter) { mUI.mTree->filterResults(filter); } -void ResultsView::Save(const QString &filename, Report::Type type) const +void ResultsView::save(const QString &filename, Report::Type type) const { - if (!HasResults()) { + if (!hasResults()) { QMessageBox msgBox; msgBox.setText(tr("No errors found, nothing to save.")); msgBox.setIcon(QMessageBox::Critical); @@ -180,7 +180,7 @@ void ResultsView::Save(const QString &filename, Report::Type type) const } } -void ResultsView::Print() +void ResultsView::print() { QPrinter printer; QPrintDialog dialog(&printer, this); @@ -188,10 +188,10 @@ void ResultsView::Print() if (dialog.exec() != QDialog::Accepted) return; - Print(&printer); + print(&printer); } -void ResultsView::PrintPreview() +void ResultsView::printPreview() { QPrinter printer; QPrintPreviewDialog dialog(&printer, this); @@ -199,9 +199,9 @@ void ResultsView::PrintPreview() dialog.exec(); } -void ResultsView::Print(QPrinter* printer) +void ResultsView::print(QPrinter* printer) { - if (!HasResults()) { + if (!hasResults()) { QMessageBox msgBox; msgBox.setText(tr("No errors found, nothing to print.")); msgBox.setIcon(QMessageBox::Critical); @@ -215,7 +215,7 @@ void ResultsView::Print(QPrinter* printer) doc.print(printer); } -void ResultsView::UpdateSettings(bool showFullPath, +void ResultsView::updateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showNoErrorsMessage, @@ -226,17 +226,17 @@ void ResultsView::UpdateSettings(bool showFullPath, mShowNoErrorsMessage = showNoErrorsMessage; } -void ResultsView::SetCheckDirectory(const QString &dir) +void ResultsView::setCheckDirectory(const QString &dir) { mUI.mTree->setCheckDirectory(dir); } -QString ResultsView::GetCheckDirectory(void) +QString ResultsView::getCheckDirectory(void) { return mUI.mTree->getCheckDirectory(); } -void ResultsView::CheckingStarted(int count) +void ResultsView::checkingStarted(int count) { mUI.mProgress->setVisible(true); mUI.mProgress->setMaximum(PROGRESS_MAX); @@ -244,7 +244,7 @@ void ResultsView::CheckingStarted(int count) mUI.mProgress->setFormat(tr("%p% (%1 of %2 files checked)").arg(0).arg(count)); } -void ResultsView::CheckingFinished() +void ResultsView::checkingFinished() { mUI.mProgress->setVisible(false); mUI.mProgress->setFormat("%p%"); @@ -252,7 +252,7 @@ void ResultsView::CheckingFinished() //Should we inform user of non visible/not found errors? if (mShowNoErrorsMessage) { //Tell user that we found no errors - if (!HasResults()) { + if (!hasResults()) { QMessageBox msg(QMessageBox::Information, tr("Cppcheck"), tr("No errors found."), @@ -275,17 +275,17 @@ void ResultsView::CheckingFinished() } } -bool ResultsView::HasVisibleResults() const +bool ResultsView::hasVisibleResults() const { return mUI.mTree->hasVisibleResults(); } -bool ResultsView::HasResults() const +bool ResultsView::hasResults() const { return mUI.mTree->hasResults(); } -void ResultsView::SaveSettings(QSettings *settings) +void ResultsView::saveSettings(QSettings *settings) { mUI.mTree->saveSettings(); QByteArray state = mUI.mVerticalSplitter->saveState(); @@ -293,17 +293,17 @@ void ResultsView::SaveSettings(QSettings *settings) mUI.mVerticalSplitter->restoreState(state); } -void ResultsView::Translate() +void ResultsView::translate() { mUI.mTree->translate(); } -void ResultsView::DisableProgressbar() +void ResultsView::disableProgressbar() { mUI.mProgress->setEnabled(false); } -void ResultsView::ReadErrorsXml(const QString &filename) +void ResultsView::readErrorsXml(const QString &filename) { const int version = XmlReport::determineVersion(filename); if (version == 0) { @@ -346,7 +346,7 @@ void ResultsView::ReadErrorsXml(const QString &filename) mUI.mTree->setCheckDirectory(""); } -void ResultsView::UpdateDetails(const QModelIndex &index) +void ResultsView::updateDetails(const QModelIndex &index) { QStandardItemModel *model = qobject_cast(mUI.mTree->model()); QStandardItem *item = model->itemFromIndex(index); diff --git a/gui/resultsview.h b/gui/resultsview.h index 96fac8e3c..4c549afd6 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -45,7 +45,7 @@ class ResultsView : public QWidget { public: explicit ResultsView(QWidget * parent = 0); - void Initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler); + void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler); virtual ~ResultsView(); /** @@ -55,23 +55,23 @@ public: * @param type Type of error to show/hide * @param show Should specified errors be shown (true) or hidden (false) */ - void ShowResults(ShowTypes::ShowType type, bool show); + void showResults(ShowTypes::ShowType type, bool show); /** * @brief Clear results and statistics and reset progressinfo. * @param results Remove all the results from view? */ - void Clear(bool results); + void clear(bool results); /** * @brief Remove a file from the results. */ - void Clear(const QString &filename); + void clear(const QString &filename); /** * @brief Remove a recheck file from the results. */ - void ClearRecheckFile(const QString &filename); + void clearRecheckFile(const QString &filename); /** * @brief Save results to a file @@ -79,7 +79,7 @@ public: * @param filename Filename to save results to * @param type Type of the report. */ - void Save(const QString &filename, Report::Type type) const; + void save(const QString &filename, Report::Type type) const; /** * @brief Update tree settings @@ -91,7 +91,7 @@ public: * @param showErrorId Show error id? * @param showInconclusive Show inconclusive? */ - void UpdateSettings(bool showFullPath, + void updateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showNoErrorsMessage, @@ -104,7 +104,7 @@ public: * This is used to split error file path to relative if necessary * @param dir Directory we are checking */ - void SetCheckDirectory(const QString &dir); + void setCheckDirectory(const QString &dir); /** * @brief Get the directory we are checking @@ -112,62 +112,62 @@ public: * @return Directory containing source files */ - QString GetCheckDirectory(void); + QString getCheckDirectory(void); /** * @brief Inform the view that checking has started * * @param count Count of files to be checked. */ - void CheckingStarted(int count); + void checkingStarted(int count); /** * @brief Inform the view that checking finished. * */ - void CheckingFinished(); + void checkingFinished(); /** * @brief Do we have visible results to show? * * @return true if there is at least one warning/error to show. */ - bool HasVisibleResults() const; + bool hasVisibleResults() const; /** * @brief Do we have results from check? * * @return true if there is at least one warning/error, hidden or visible. */ - bool HasResults() const; + bool hasResults() const; /** * @brief Save View's settings * * @param settings program settings. */ - void SaveSettings(QSettings *settings); + void saveSettings(QSettings *settings); /** * @brief Translate this view * */ - void Translate(); + void translate(); - void DisableProgressbar(); + void disableProgressbar(); /** * @brief Read errors from report XML file. * @param filename Report file to read. * */ - void ReadErrorsXml(const QString &filename); + void readErrorsXml(const QString &filename); /** * @brief Return checking statistics. * @return Pointer to checking statistics. */ - CheckStatistics *GetStatistics() const { + CheckStatistics *getStatistics() const { return mStatistics; } @@ -175,7 +175,7 @@ public: * @brief Return Showtypes. * @return Pointer to Showtypes. */ - ShowTypes * GetShowTypes() const { + ShowTypes * getShowTypes() const { return &mUI.mTree->mShowSeverities; } @@ -185,21 +185,21 @@ signals: * @brief Signal to be emitted when we have results * */ - void GotResults(); + void gotResults(); /** * @brief Signal that results have been hidden or shown * * @param hidden true if there are some hidden results, or false if there are not */ - void ResultsHidden(bool hidden); + void resultsHidden(bool hidden); /** * @brief Signal to perform recheck of selected files * * @param selectedFilesList list of selected files */ - void CheckSelected(QStringList selectedFilesList); + void checkSelected(QStringList selectedFilesList); public slots: @@ -209,57 +209,57 @@ public slots: * @param value Current progress value * @param description Description to accompany the progress */ - void Progress(int value, const QString& description); + void progress(int value, const QString& description); /** * @brief Slot for new error to be displayed * * @param item Error data */ - void Error(const ErrorItem &item); + void error(const ErrorItem &item); /** * @brief Collapse all results in the result list. */ - void CollapseAllResults(); + void collapseAllResults(); /** * @brief Expand all results in the result list. */ - void ExpandAllResults(); + void expandAllResults(); /** * @brief Filters the results in the result list. */ - void FilterResults(const QString& filter); + void filterResults(const QString& filter); /** * @brief Show hidden results in the result list. */ - void ShowHiddenResults(); + void showHiddenResults(); /** * @brief Update detailed message when selected item is changed. * * @param index Position of new selected item. */ - void UpdateDetails(const QModelIndex &index); + void updateDetails(const QModelIndex &index); /** * @brief Slot opening a print dialog to print the current report */ - void Print(); + void print(); /** * @brief Slot printing the current report to the printer. * @param printer The printer used for printing the report. */ - void Print(QPrinter* printer); + void print(QPrinter* printer); /** * @brief Slot opening a print preview dialog */ - void PrintPreview(); + void printPreview(); protected: /** @@ -270,8 +270,6 @@ protected: Ui::ResultsView mUI; CheckStatistics *mStatistics; - -private: }; /// @} #endif // RESULTSVIEW_H