summaryrefslogtreecommitdiffhomepage
path: root/gui/process_detector.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-26 22:25:22 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-26 23:05:21 +0200
commitd65936200a2756e6619a109fa6fa673b91df802e (patch)
tree80b6b6fc7ba9023cbe47290b8ae1bc5468a19bb1 /gui/process_detector.cpp
parent4046773c41ee3c0f65840828ab983cfd13451c85 (diff)
modernize C++ syntax
No visible changes (hopefully).
Diffstat (limited to 'gui/process_detector.cpp')
-rw-r--r--gui/process_detector.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/gui/process_detector.cpp b/gui/process_detector.cpp
index 7563d521..969b1856 100644
--- a/gui/process_detector.cpp
+++ b/gui/process_detector.cpp
@@ -58,7 +58,7 @@ QHash<QString, QString> proc_detector_settings::split_process_names()
QHash<QString, QString> ret;
QString str = get_game_list();
QStringList pairs = str.split(RECORD_SEPARATOR, QString::SkipEmptyParts);
- for (auto pair : pairs)
+ for (auto const& pair : pairs)
{
QList<QString> tmp = pair.split(UNIT_SEPARATOR);
if (tmp.count() != 2)
@@ -67,7 +67,7 @@ QHash<QString, QString> proc_detector_settings::split_process_names()
continue;
if (tmp[1].contains(UNIT_SEPARATOR) || tmp[1].contains(RECORD_SEPARATOR))
continue;
- if (tmp[0] == QLatin1String("") || tmp[1] == QLatin1String(""))
+ if (tmp[0].isEmpty() || tmp[1].isEmpty())
continue;
ret[tmp[0]] = tmp[1];
}
@@ -76,21 +76,19 @@ QHash<QString, QString> proc_detector_settings::split_process_names()
void BrowseButton::browse()
{
- QFileDialog dialog(this);
- dialog.setFileMode(QFileDialog::ExistingFile);
QString dir_path = QFileInfo(group::ini_pathname()).absolutePath();
- QString filename = dialog.getOpenFileName(
- this,
- tr("Set executable name"),
- dir_path,
- tr("Executable (*.exe);;All Files (*)"));
+ QString filename = QFileDialog::getOpenFileName(
+ this,
+ tr("Set executable name"),
+ dir_path,
+ tr("Executable (*.exe);;All Files (*)"));
QDir::setCurrent(OPENTRACK_BASE_PATH);
filename = QFileInfo(filename).fileName();
if (!filename.isNull())
twi->setText(filename);
}
-int process_detector::add_row(QString exe_name, QString profile)
+int process_detector::add_row(QString const& exe_name, QString const& profile)
{
int i = ui.tableWidget->rowCount();
ui.tableWidget->insertRow(i);
@@ -122,7 +120,7 @@ void process_detector::add_items()
ui.tableWidget->clearContents();
auto keys = names.keys();
std::sort(keys.begin(), keys.end());
- for (auto n : keys)
+ for (auto const& n : keys)
add_row(n, names[n]);
}