diff --git a/forms/advanced-scene-switcher.ui b/forms/advanced-scene-switcher.ui index 15b8ba5c..28fb264c 100644 --- a/forms/advanced-scene-switcher.ui +++ b/forms/advanced-scene-switcher.ui @@ -546,6 +546,91 @@ 4 + + + + + 22 + 22 + + + + + + + + ../../../forms/images/up.svg../../../forms/images/up.svg + + + true + + + upArrowIconSmall + + + + + + + + 22 + 22 + + + + + + + + ../../../forms/images/down.svg../../../forms/images/down.svg + + + true + + + downArrowIconSmall + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + Qt::Vertical + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + @@ -834,6 +919,91 @@ + + + + + 22 + 22 + + + + + + + + ../../../forms/images/up.svg../../../forms/images/up.svg + + + true + + + upArrowIconSmall + + + + + + + + 22 + 22 + + + + + + + + ../../../forms/images/down.svg../../../forms/images/down.svg + + + true + + + downArrowIconSmall + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + Qt::Vertical + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + diff --git a/src/executable-switch.cpp b/src/executable-switch.cpp index 181a94ee..d05ba3e7 100644 --- a/src/executable-switch.cpp +++ b/src/executable-switch.cpp @@ -43,6 +43,36 @@ void SceneSwitcher::on_executables_currentRowChanged(int idx) } } +void SceneSwitcher::on_executableUp_clicked() +{ + int index = ui->executables->currentRow(); + if (index != -1 && index != 0) + { + ui->executables->insertItem(index - 1, ui->executables->takeItem(index)); + ui->executables->setCurrentRow(index - 1); + + lock_guard lock(switcher->m); + + iter_swap(switcher->executableSwitches.begin() + index, + switcher->executableSwitches.begin() + index - 1); + } +} + +void SceneSwitcher::on_executableDown_clicked() +{ + int index = ui->executables->currentRow(); + if (index != -1 && index != ui->executables->count() - 1) + { + ui->executables->insertItem(index + 1, ui->executables->takeItem(index)); + ui->executables->setCurrentRow(index + 1); + + lock_guard lock(switcher->m); + + iter_swap(switcher->executableSwitches.begin() + index, + switcher->executableSwitches.begin() + index + 1); + } +} + void SceneSwitcher::on_executableAdd_clicked() { QString sceneName = ui->executableScenes->currentText(); diff --git a/src/headers/advanced-scene-switcher.hpp b/src/headers/advanced-scene-switcher.hpp index 591e2348..99b7601b 100644 --- a/src/headers/advanced-scene-switcher.hpp +++ b/src/headers/advanced-scene-switcher.hpp @@ -51,6 +51,8 @@ public: public slots: void on_switches_currentRowChanged(int idx); + void on_up_clicked(); + void on_down_clicked(); void on_add_clicked(); void on_remove_clicked(); void on_noMatchDontSwitch_clicked(); @@ -99,6 +101,8 @@ public slots: void on_writePathLineEdit_textChanged(const QString &text); void on_browseButton_2_clicked(); + void on_executableUp_clicked(); + void on_executableDown_clicked(); void on_executableAdd_clicked(); void on_executableRemove_clicked(); void on_executables_currentRowChanged(int idx); diff --git a/src/window-title-switch.cpp b/src/window-title-switch.cpp index 0b65a66b..791b6a5d 100644 --- a/src/window-title-switch.cpp +++ b/src/window-title-switch.cpp @@ -27,6 +27,36 @@ bool isFocused(std::string &title) return (equals || matches); } +void SceneSwitcher::on_up_clicked() +{ + int index = ui->switches->currentRow(); + if (index != -1 && index != 0) + { + ui->switches->insertItem(index - 1, ui->switches->takeItem(index)); + ui->switches->setCurrentRow(index - 1); + + lock_guard lock(switcher->m); + + iter_swap(switcher->windowSwitches.begin() + index, + switcher->windowSwitches.begin() + index - 1); + } +} + +void SceneSwitcher::on_down_clicked() +{ + int index = ui->switches->currentRow(); + if (index != -1 && index != ui->switches->count() - 1) + { + ui->switches->insertItem(index + 1, ui->switches->takeItem(index)); + ui->switches->setCurrentRow(index + 1); + + lock_guard lock(switcher->m); + + iter_swap(switcher->windowSwitches.begin() + index, + switcher->windowSwitches.begin() + index + 1); + } +} + void SceneSwitcher::on_add_clicked() { QString sceneName = ui->scenes->currentText();