summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-04 10:35:10 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-04 10:35:10 +0200
commit299e529fb955eecbc2bc2f2d8830c4f54fe5777d (patch)
treed116e9b5e21790cb8cf854b116742d15fd309ac4 /gui
parent0fe80d8926fc35d23d99f551aef753be16c8939e (diff)
various: don't use qSort/qStableSort
Diffstat (limited to 'gui')
-rw-r--r--gui/process_detector.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/gui/process_detector.cpp b/gui/process_detector.cpp
index f9fa4b59..f0a66fa5 100644
--- a/gui/process_detector.cpp
+++ b/gui/process_detector.cpp
@@ -75,25 +75,25 @@ int process_detector::add_row(QString exe_name, QString profile)
{
int i = ui.tableWidget->rowCount();
ui.tableWidget->insertRow(i);
-
+
QComboBox* cb = new QComboBox();
cb->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
cb->addItem("");
cb->addItems(group::ini_list());
ui.tableWidget->setCellWidget(i, 1, cb);
-
+
QTableWidgetItem* twi = new QTableWidgetItem(exe_name);
ui.tableWidget->setItem(i, 0, twi);
-
+
{
BrowseButton* b = new BrowseButton(twi);
b->setText("...");
QObject::connect(b, SIGNAL(pressed()), b, SLOT(browse()));
ui.tableWidget->setCellWidget(i, 2, b);
}
-
+
cb->setCurrentText(profile);
-
+
return i;
}
@@ -102,7 +102,7 @@ void process_detector::add_items()
auto names = s.split_process_names();
ui.tableWidget->clearContents();
auto keys = names.keys();
- qSort(keys);
+ std::sort(keys.begin(), keys.end());
for (auto n : keys)
add_row(n, names[n]);
}
@@ -113,28 +113,28 @@ process_detector::process_detector(QWidget* parent) : QWidget(parent)
setFixedSize(size());
connect(ui.add, SIGNAL(pressed()), this, SLOT(add()));
connect(ui.remove, SIGNAL(pressed()), this, SLOT(remove()));
-
+
add_items();
-
+
QResizeEvent e(ui.tableWidget->size(), ui.tableWidget->size());
ui.tableWidget->resizeEvent(&e);
-
+
settings s;
-
+
ui.enabled->setChecked(s.is_enabled());
}
void process_detector::save()
{
QString str;
-
+
for (int i = 0; i < ui.tableWidget->rowCount(); i++)
{
auto exe = ui.tableWidget->item(i, 0)->text();
auto profile = reinterpret_cast<QComboBox*>(ui.tableWidget->cellWidget(i, 1))->currentText();
str += "|" + exe + ":" + profile;
}
-
+
s.set_game_list(str);
s.set_is_enabled(ui.enabled->isChecked());
}
@@ -159,22 +159,22 @@ bool process_detector_worker::should_stop()
{
if (last_exe_name == "")
return false;
-
+
settings s;
-
+
if (!s.is_enabled())
{
last_exe_name = "";
return false;
}
-
+
QStringList exe_list = get_all_executable_names();
-
+
if (exe_list.contains(last_exe_name))
return false;
-
+
last_exe_name = "";
-
+
return true;
}
@@ -186,17 +186,17 @@ bool process_detector_worker::config_to_start(QString& str)
last_exe_name = "";
return false;
}
-
+
auto filenames = s.split_process_names();
QStringList exe_list = get_all_executable_names();
-
+
// assuming manual stop by user button click.
// don't automatically start again while the same process is running.
if (last_exe_name != "" && exe_list.contains(last_exe_name))
return false;
// it's gone, we can start automatically again
last_exe_name = "";
-
+
for (auto& name : exe_list)
{
if (filenames.contains(name))
@@ -206,6 +206,6 @@ bool process_detector_worker::config_to_start(QString& str)
return str != "";
}
}
-
+
return false;
}