mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-31 05:35:36 -05:00
Add ability to reorder Window and Executable switches with arrows
This commit is contained in:
@@ -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<mutex> 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<mutex> lock(switcher->m);
|
||||
|
||||
iter_swap(switcher->executableSwitches.begin() + index,
|
||||
switcher->executableSwitches.begin() + index + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSwitcher::on_executableAdd_clicked()
|
||||
{
|
||||
QString sceneName = ui->executableScenes->currentText();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<mutex> 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<mutex> lock(switcher->m);
|
||||
|
||||
iter_swap(switcher->windowSwitches.begin() + index,
|
||||
switcher->windowSwitches.begin() + index + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneSwitcher::on_add_clicked()
|
||||
{
|
||||
QString sceneName = ui->scenes->currentText();
|
||||
|
||||
Reference in New Issue
Block a user