Skip to content

Commit 252fab2

Browse files
committed
GUI: Renamed common functions
1 parent 0d8b7af commit 252fab2

6 files changed

Lines changed: 23 additions & 23 deletions

File tree

gui/applicationdialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ void ApplicationDialog::Browse()
6060
#endif // Q_OS_WIN
6161
QString selectedFile = QFileDialog::getOpenFileName(this,
6262
tr("Select viewer application"),
63-
GetPath(SETTINGS_LAST_APP_PATH),
63+
getPath(SETTINGS_LAST_APP_PATH),
6464
filter);
6565

6666
if (!selectedFile.isEmpty()) {
67-
SetPath(SETTINGS_LAST_APP_PATH, selectedFile);
67+
setPath(SETTINGS_LAST_APP_PATH, selectedFile);
6868
QString path(QDir::toNativeSeparators(selectedFile));
6969
mUI.mPath->setText(path);
7070
}

gui/common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <QDir>
2424

2525

26-
QString GetPath(const QString &type)
26+
QString getPath(const QString &type)
2727
{
2828
QSettings settings;
2929
QString path = settings.value(type, "").toString();
@@ -37,7 +37,7 @@ QString GetPath(const QString &type)
3737
return path;
3838
}
3939

40-
void SetPath(const QString &type, const QString &value)
40+
void setPath(const QString &type, const QString &value)
4141
{
4242
QSettings settings;
4343
settings.setValue(type, value);

gui/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@
106106
* @param type Type of path to obtain
107107
* @return Best path fo provided type
108108
*/
109-
QString GetPath(const QString &type);
109+
QString getPath(const QString &type);
110110

111111
/**
112112
* @brief Stores last used path of specified type
113113
* Stores provided path as last used path for specified type.
114114
* @param type Type of the path to store
115115
* @param value Path to store
116116
*/
117-
void SetPath(const QString &type, const QString &value);
117+
void setPath(const QString &type, const QString &value);
118118

119119
/// @}
120120
#endif

gui/mainwindow.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ void MainWindow::doCheckProject(ImportProject p)
377377

378378
QDir inf(mCurrentDirectory);
379379
const QString checkPath = inf.canonicalPath();
380-
SetPath(SETTINGS_LAST_CHECK_PATH, checkPath);
380+
setPath(SETTINGS_LAST_CHECK_PATH, checkPath);
381381

382382
checkLockDownUI(); // lock UI while checking
383383

@@ -433,7 +433,7 @@ void MainWindow::doCheckFiles(const QStringList &files)
433433
mThread->SetFiles(fileNames);
434434
QDir inf(mCurrentDirectory);
435435
const QString checkPath = inf.canonicalPath();
436-
SetPath(SETTINGS_LAST_CHECK_PATH, checkPath);
436+
setPath(SETTINGS_LAST_CHECK_PATH, checkPath);
437437

438438
checkLockDownUI(); // lock UI while checking
439439

@@ -501,7 +501,7 @@ QStringList MainWindow::selectFilesToCheck(QFileDialog::FileMode mode)
501501

502502
selected = QFileDialog::getOpenFileNames(this,
503503
tr("Select files to check"),
504-
GetPath(SETTINGS_LAST_CHECK_PATH),
504+
getPath(SETTINGS_LAST_CHECK_PATH),
505505
tr("C/C++ Source, Compile database, Visual Studio (%1 %2 *.sln *.vcxproj)")
506506
.arg(FileList::getDefaultFilters().join(" "))
507507
.arg(compile_commands_json));
@@ -515,7 +515,7 @@ QStringList MainWindow::selectFilesToCheck(QFileDialog::FileMode mode)
515515
} else if (mode == QFileDialog::DirectoryOnly) {
516516
QString dir = QFileDialog::getExistingDirectory(this,
517517
tr("Select directory to check"),
518-
GetPath(SETTINGS_LAST_CHECK_PATH));
518+
getPath(SETTINGS_LAST_CHECK_PATH));
519519
if (!dir.isEmpty()) {
520520
qDebug() << "Setting current directory to: " << dir;
521521
mCurrentDirectory = dir;
@@ -525,7 +525,7 @@ QStringList MainWindow::selectFilesToCheck(QFileDialog::FileMode mode)
525525
}
526526
}
527527

528-
SetPath(SETTINGS_LAST_CHECK_PATH, mCurrentDirectory);
528+
setPath(SETTINGS_LAST_CHECK_PATH, mCurrentDirectory);
529529

530530
return selected;
531531
}
@@ -1002,7 +1002,7 @@ void MainWindow::openResults()
10021002
const QString filter(tr("XML files (*.xml)"));
10031003
QString selectedFile = QFileDialog::getOpenFileName(this,
10041004
tr("Open the report file"),
1005-
GetPath(SETTINGS_LAST_RESULT_PATH),
1005+
getPath(SETTINGS_LAST_RESULT_PATH),
10061006
filter,
10071007
&selectedFilter);
10081008

@@ -1021,7 +1021,7 @@ void MainWindow::loadResults(const QString selectedFile)
10211021
mUI.mActionRecheckModified->setEnabled(false);
10221022
mUI.mActionRecheckAll->setEnabled(false);
10231023
mUI.mResults->ReadErrorsXml(selectedFile);
1024-
SetPath(SETTINGS_LAST_RESULT_PATH, selectedFile);
1024+
setPath(SETTINGS_LAST_RESULT_PATH, selectedFile);
10251025
}
10261026
}
10271027

@@ -1160,7 +1160,7 @@ void MainWindow::save()
11601160
const QString filter(tr("XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)"));
11611161
QString selectedFile = QFileDialog::getSaveFileName(this,
11621162
tr("Save the report file"),
1163-
GetPath(SETTINGS_LAST_RESULT_PATH),
1163+
getPath(SETTINGS_LAST_RESULT_PATH),
11641164
filter,
11651165
&selectedFilter);
11661166

@@ -1195,7 +1195,7 @@ void MainWindow::save()
11951195
}
11961196

11971197
mUI.mResults->Save(selectedFile, type);
1198-
SetPath(SETTINGS_LAST_RESULT_PATH, selectedFile);
1198+
setPath(SETTINGS_LAST_RESULT_PATH, selectedFile);
11991199
}
12001200
}
12011201

@@ -1273,13 +1273,13 @@ void MainWindow::openProjectFile()
12731273
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
12741274
const QString filepath = QFileDialog::getOpenFileName(this,
12751275
tr("Select Project File"),
1276-
GetPath(SETTINGS_LAST_PROJECT_PATH),
1276+
getPath(SETTINGS_LAST_PROJECT_PATH),
12771277
filter);
12781278

12791279
if (!filepath.isEmpty()) {
12801280
const QFileInfo fi(filepath);
12811281
if (fi.exists() && fi.isFile() && fi.isReadable()) {
1282-
SetPath(SETTINGS_LAST_PROJECT_PATH, filepath);
1282+
setPath(SETTINGS_LAST_PROJECT_PATH, filepath);
12831283
loadProjectFile(filepath);
12841284
}
12851285
}
@@ -1367,13 +1367,13 @@ void MainWindow::newProjectFile()
13671367
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
13681368
QString filepath = QFileDialog::getSaveFileName(this,
13691369
tr("Select Project Filename"),
1370-
GetPath(SETTINGS_LAST_PROJECT_PATH),
1370+
getPath(SETTINGS_LAST_PROJECT_PATH),
13711371
filter);
13721372

13731373
if (filepath.isEmpty())
13741374
return;
13751375

1376-
SetPath(SETTINGS_LAST_PROJECT_PATH, filepath);
1376+
setPath(SETTINGS_LAST_PROJECT_PATH, filepath);
13771377

13781378
enableProjectActions(true);
13791379
QFileInfo inf(filepath);

gui/resultstree.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,10 +742,10 @@ QString ResultsTree::AskFileDir(const QString &file)
742742
msgbox.exec();
743743

744744
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Directory"),
745-
GetPath(SETTINGS_LAST_SOURCE_PATH),
745+
getPath(SETTINGS_LAST_SOURCE_PATH),
746746
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
747747
mCheckPath = dir;
748-
SetPath(SETTINGS_LAST_SOURCE_PATH, dir);
748+
setPath(SETTINGS_LAST_SOURCE_PATH, dir);
749749
return dir;
750750
}
751751

gui/settingsdialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,11 @@ void SettingsDialog::AddIncludePath()
322322
{
323323
QString selectedDir = QFileDialog::getExistingDirectory(this,
324324
tr("Select include directory"),
325-
GetPath(SETTINGS_LAST_INCLUDE_PATH));
325+
getPath(SETTINGS_LAST_INCLUDE_PATH));
326326

327327
if (!selectedDir.isEmpty()) {
328328
AddIncludePath(selectedDir);
329-
SetPath(SETTINGS_LAST_INCLUDE_PATH, selectedDir);
329+
setPath(SETTINGS_LAST_INCLUDE_PATH, selectedDir);
330330
}
331331
}
332332

0 commit comments

Comments
 (0)