fixed some clang-tidy warnings in gui code (#2565)

This commit is contained in:
Oliver Stöneberg 2020-03-07 11:33:08 +01:00 committed by GitHub
parent b795d30db6
commit 91beccb304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 24 additions and 24 deletions

View File

@ -185,7 +185,7 @@ void ApplicationList::clear()
mDefaultApplicationIndex = -1; mDefaultApplicationIndex = -1;
} }
bool ApplicationList::checkAndAddApplication(QString appPath, QString name, QString parameters) bool ApplicationList::checkAndAddApplication(const QString& appPath, const QString& name, const QString& parameters)
{ {
if (QFileInfo(appPath).exists() && QFileInfo(appPath).isExecutable()) { if (QFileInfo(appPath).exists() && QFileInfo(appPath).isExecutable()) {
Application app; Application app;

View File

@ -116,7 +116,7 @@ protected:
private: private:
bool checkAndAddApplication(QString appPath, QString name, QString parameters); bool checkAndAddApplication(const QString& appPath, const QString& name, const QString& parameters);
/** /**
* @brief List of applications * @brief List of applications

View File

@ -70,7 +70,7 @@ void CheckThread::run()
const std::string &buildDir = mCppcheck.settings().buildDir; const std::string &buildDir = mCppcheck.settings().buildDir;
if (!buildDir.empty()) { if (!buildDir.empty()) {
std::map<std::string,std::size_t> files2; std::map<std::string,std::size_t> files2;
for (QString file : mFiles) for (const QString& file : mFiles)
files2[file.toStdString()] = 0; files2[file.toStdString()] = 0;
mCppcheck.analyseWholeProgram(buildDir, files2); mCppcheck.analyseWholeProgram(buildDir, files2);
} }

View File

@ -60,7 +60,7 @@ QString toFilterString(const QMap<QString,QString>& filters, bool addAllSupporte
// We're using the description of the filters as the map keys, the file // We're using the description of the filters as the map keys, the file
// name patterns are our values. The generated filter string list will // name patterns are our values. The generated filter string list will
// thus be sorted alphabetically over the descriptions. // thus be sorted alphabetically over the descriptions.
for (auto k: filters.keys()) { for (const auto& k: filters.keys()) {
entries << QString("%1 (%2)").arg(k).arg(filters.value(k)); entries << QString("%1 (%2)").arg(k).arg(filters.value(k));
} }

View File

@ -271,7 +271,7 @@ void LibraryDialog::sortFunctions(bool sort)
} }
} }
void LibraryDialog::filterFunctions(QString filter) void LibraryDialog::filterFunctions(const QString& filter)
{ {
QList<QListWidgetItem *> allItems = mUi->functions->findItems(QString(), Qt::MatchContains); QList<QListWidgetItem *> allItems = mUi->functions->findItems(QString(), Qt::MatchContains);

View File

@ -47,7 +47,7 @@ private slots:
void changeFunction(); void changeFunction();
void editArg(); void editArg();
void editFunctionName(QListWidgetItem*); void editFunctionName(QListWidgetItem*);
void filterFunctions(QString); void filterFunctions(const QString&);
void selectFunction(); void selectFunction();
void sortFunctions(bool); void sortFunctions(bool);

View File

@ -762,7 +762,7 @@ Library::Error MainWindow::loadLibrary(Library *library, const QString &filename
return ret; return ret;
} }
bool MainWindow::tryLoadLibrary(Library *library, QString filename) bool MainWindow::tryLoadLibrary(Library *library, const QString& filename)
{ {
const Library::Error error = loadLibrary(library, filename); const Library::Error error = loadLibrary(library, filename);
if (error.errorcode != Library::ErrorCode::OK) { if (error.errorcode != Library::ErrorCode::OK) {

View File

@ -384,7 +384,7 @@ private:
* @param filename filename (no path) * @param filename filename (no path)
* @return True if no error * @return True if no error
*/ */
bool tryLoadLibrary(Library *library, QString filename); bool tryLoadLibrary(Library *library, const QString& filename);
/** /**
* @brief Update project MRU items in File-menu. * @brief Update project MRU items in File-menu.

View File

@ -241,7 +241,7 @@ void ProjectFile::readBuildDir(QXmlStreamReader &reader)
case QXmlStreamReader::ProcessingInstruction: case QXmlStreamReader::ProcessingInstruction:
break; break;
} }
} while (1); } while (true);
} }
void ProjectFile::readImportProject(QXmlStreamReader &reader) void ProjectFile::readImportProject(QXmlStreamReader &reader)
@ -266,7 +266,7 @@ void ProjectFile::readImportProject(QXmlStreamReader &reader)
case QXmlStreamReader::ProcessingInstruction: case QXmlStreamReader::ProcessingInstruction:
break; break;
} }
} while (1); } while (true);
} }
bool ProjectFile::readBool(QXmlStreamReader &reader) bool ProjectFile::readBool(QXmlStreamReader &reader)
@ -291,7 +291,7 @@ bool ProjectFile::readBool(QXmlStreamReader &reader)
case QXmlStreamReader::ProcessingInstruction: case QXmlStreamReader::ProcessingInstruction:
break; break;
} }
} while (1); } while (true);
} }
int ProjectFile::readInt(QXmlStreamReader &reader, int defaultValue) int ProjectFile::readInt(QXmlStreamReader &reader, int defaultValue)
@ -316,7 +316,7 @@ int ProjectFile::readInt(QXmlStreamReader &reader, int defaultValue)
case QXmlStreamReader::ProcessingInstruction: case QXmlStreamReader::ProcessingInstruction:
break; break;
} }
} while (1); } while (true);
} }
void ProjectFile::readIncludeDirs(QXmlStreamReader &reader) void ProjectFile::readIncludeDirs(QXmlStreamReader &reader)
@ -537,7 +537,7 @@ void ProjectFile::readPlatform(QXmlStreamReader &reader)
case QXmlStreamReader::ProcessingInstruction: case QXmlStreamReader::ProcessingInstruction:
break; break;
} }
} while (1); } while (true);
} }
@ -912,7 +912,7 @@ void ProjectFile::SafeChecks::loadFromXml(QXmlStreamReader &xmlReader)
case QXmlStreamReader::ProcessingInstruction: case QXmlStreamReader::ProcessingInstruction:
break; break;
} }
} while (1); } while (true);
} }
void ProjectFile::SafeChecks::saveToXml(QXmlStreamWriter &xmlWriter) const void ProjectFile::SafeChecks::saveToXml(QXmlStreamWriter &xmlWriter) const

View File

@ -1243,7 +1243,7 @@ void ResultsTree::setCheckDirectory(const QString &dir)
} }
QString ResultsTree::getCheckDirectory(void) QString ResultsTree::getCheckDirectory()
{ {
return mCheckPath; return mCheckPath;
} }

View File

@ -128,7 +128,7 @@ public:
* @return Directory containing source files * @return Directory containing source files
*/ */
QString getCheckDirectory(void); QString getCheckDirectory();
/** /**
* @brief Check if there are any visible results in view. * @brief Check if there are any visible results in view.

View File

@ -251,7 +251,7 @@ void ResultsView::setCheckDirectory(const QString &dir)
mUI.mTree->setCheckDirectory(dir); mUI.mTree->setCheckDirectory(dir);
} }
QString ResultsView::getCheckDirectory(void) QString ResultsView::getCheckDirectory()
{ {
return mUI.mTree->getCheckDirectory(); return mUI.mTree->getCheckDirectory();
} }
@ -433,9 +433,9 @@ void ResultsView::debugError(const ErrorItem &item)
mUI.mListLog->addItem(item.ToString()); mUI.mListLog->addItem(item.ToString());
} }
void ResultsView::bughuntingReportLine(QString line) void ResultsView::bughuntingReportLine(const QString& line)
{ {
for (QString s: line.split("\n")) { for (const QString& s: line.split("\n")) {
if (s.isEmpty()) if (s.isEmpty())
continue; continue;
if (s.startsWith("[function-report] ")) if (s.startsWith("[function-report] "))

View File

@ -131,7 +131,7 @@ public:
* @return Directory containing source files * @return Directory containing source files
*/ */
QString getCheckDirectory(void); QString getCheckDirectory();
/** /**
* @brief Inform the view that checking has started * @brief Inform the view that checking has started
@ -326,7 +326,7 @@ public slots:
/** /**
* \brief bughunting report line * \brief bughunting report line
*/ */
void bughuntingReportLine(QString line); void bughuntingReportLine(const QString& line);
/** /**
* \brief Clear log messages * \brief Clear log messages

View File

@ -69,7 +69,7 @@ void ThreadHandler::setCheckFiles(bool all)
} }
} }
void ThreadHandler::setCheckFiles(QStringList files) void ThreadHandler::setCheckFiles(const QStringList& files)
{ {
if (mRunningThreadCount == 0) { if (mRunningThreadCount == 0) {
mResults.setFiles(files); mResults.setFiles(files);
@ -287,5 +287,5 @@ QDateTime ThreadHandler::getCheckStartTime() const
void ThreadHandler::setCheckStartTime(QDateTime checkStartTime) void ThreadHandler::setCheckStartTime(QDateTime checkStartTime)
{ {
mCheckStartTime = checkStartTime; mCheckStartTime = std::move(checkStartTime);
} }

View File

@ -128,7 +128,7 @@ public:
* *
* @param files list of files to be checked * @param files list of files to be checked
*/ */
void setCheckFiles(QStringList files); void setCheckFiles(const QStringList& files);
/** /**
* @brief Is checking running? * @brief Is checking running?