mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-10-01 13:59:31 -05:00
Add ability to reorder Window and Executable switches with arrows
This commit is contained in:
@@ -546,6 +546,91 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="up">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>../../../forms/images/up.svg</normaloff>../../../forms/images/up.svg</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string>upArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="down">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>../../../forms/images/down.svg</normaloff>../../../forms/images/down.svg</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string>downArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_43">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>5</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_12">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_42">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>5</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="add">
|
<widget class="QPushButton" name="add">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@@ -834,6 +919,91 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="executableUp">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>../../../forms/images/up.svg</normaloff>../../../forms/images/up.svg</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string>upArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="executableDown">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>../../../forms/images/down.svg</normaloff>../../../forms/images/down.svg</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="themeID" stdset="0">
|
||||||
|
<string>downArrowIconSmall</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_45">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>5</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_11">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_44">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>5</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="executableAdd">
|
<widget class="QPushButton" name="executableAdd">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
|
|||||||
@@ -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()
|
void SceneSwitcher::on_executableAdd_clicked()
|
||||||
{
|
{
|
||||||
QString sceneName = ui->executableScenes->currentText();
|
QString sceneName = ui->executableScenes->currentText();
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_switches_currentRowChanged(int idx);
|
void on_switches_currentRowChanged(int idx);
|
||||||
|
void on_up_clicked();
|
||||||
|
void on_down_clicked();
|
||||||
void on_add_clicked();
|
void on_add_clicked();
|
||||||
void on_remove_clicked();
|
void on_remove_clicked();
|
||||||
void on_noMatchDontSwitch_clicked();
|
void on_noMatchDontSwitch_clicked();
|
||||||
@@ -99,6 +101,8 @@ public slots:
|
|||||||
void on_writePathLineEdit_textChanged(const QString &text);
|
void on_writePathLineEdit_textChanged(const QString &text);
|
||||||
void on_browseButton_2_clicked();
|
void on_browseButton_2_clicked();
|
||||||
|
|
||||||
|
void on_executableUp_clicked();
|
||||||
|
void on_executableDown_clicked();
|
||||||
void on_executableAdd_clicked();
|
void on_executableAdd_clicked();
|
||||||
void on_executableRemove_clicked();
|
void on_executableRemove_clicked();
|
||||||
void on_executables_currentRowChanged(int idx);
|
void on_executables_currentRowChanged(int idx);
|
||||||
|
|||||||
@@ -27,6 +27,36 @@ bool isFocused(std::string &title)
|
|||||||
return (equals || matches);
|
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()
|
void SceneSwitcher::on_add_clicked()
|
||||||
{
|
{
|
||||||
QString sceneName = ui->scenes->currentText();
|
QString sceneName = ui->scenes->currentText();
|
||||||
|
|||||||
Reference in New Issue
Block a user