From 299e529fb955eecbc2bc2f2d8830c4f54fe5777d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 4 Jul 2016 10:35:10 +0200 Subject: various: don't use qSort/qStableSort --- gui/process_detector.cpp | 44 ++++++++++++++++++++-------------------- spline-widget/functionconfig.cpp | 4 ++-- 2 files changed, 24 insertions(+), 24 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(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; } diff --git a/spline-widget/functionconfig.cpp b/spline-widget/functionconfig.cpp index e66a6812..915510ca 100644 --- a/spline-widget/functionconfig.cpp +++ b/spline-widget/functionconfig.cpp @@ -127,7 +127,7 @@ void Map::reload() { if (cur.input.size()) { - qStableSort(cur.input.begin(), cur.input.end(), sortFn); + std::stable_sort(cur.input.begin(), cur.input.end(), sortFn); QList input = cur.input; auto& data = cur.data; @@ -217,7 +217,7 @@ void Map::addPoint(QPointF pt) QMutexLocker foo(&_mutex); cur.input.append(pt); reload(); - qStableSort(cur.input.begin(), cur.input.end(), sortFn); + std::stable_sort(cur.input.begin(), cur.input.end(), sortFn); } void Map::movePoint(int idx, QPointF pt) -- cgit v1.2.3