summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-06-09 17:05:51 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-06-15 14:40:40 -0400
commit5fa7fd7fb9f3a8f67e8842420d7a2ad600722119 (patch)
treeb430028b757695c649fa74a84978802ad44d1fb3
parentcbe6dd93b1607f9b95037c2e131f34c27d32753d (diff)
moved add/remove to the top, changed them to tool buttons with icons, added up/down buttons
-rw-r--r--src/editexecutablesdialog.cpp48
-rw-r--r--src/editexecutablesdialog.h3
-rw-r--r--src/editexecutablesdialog.ui84
3 files changed, 101 insertions, 34 deletions
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index 96f4660a..9747a86f 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -348,6 +348,44 @@ void EditExecutablesDialog::save()
}
}
+void EditExecutablesDialog::moveSelection(int by)
+{
+ auto* item = selectedItem();
+ if (!item) {
+ return;
+ }
+
+ // moving down the list
+ while (by > 0) {
+ const auto row = ui->list->row(item);
+
+ if (row >= (ui->list->count() - 1)) {
+ break;
+ }
+
+ ui->list->takeItem(row);
+ ui->list->insertItem(row + 1, item);
+ item->setSelected(true);
+
+ --by;
+ }
+
+ // moving up the list
+ while (by < 0) {
+ const auto row = ui->list->row(item);
+
+ if (row <= 0) {
+ break;
+ }
+
+ ui->list->takeItem(row);
+ ui->list->insertItem(row - 1, item);
+ item->setSelected(true);
+
+ ++by;
+ }
+}
+
void EditExecutablesDialog::on_list_itemSelectionChanged()
{
updateUI(selectedExe());
@@ -408,6 +446,16 @@ void EditExecutablesDialog::on_remove_clicked()
}
}
+void EditExecutablesDialog::on_up_clicked()
+{
+ moveSelection(-1);
+}
+
+void EditExecutablesDialog::on_down_clicked()
+{
+ moveSelection(+1);
+}
+
bool EditExecutablesDialog::isTitleConflicting(const QString& s)
{
for (const auto& exe : m_executablesList) {
diff --git a/src/editexecutablesdialog.h b/src/editexecutablesdialog.h
index 4957ebff..80ec56df 100644
--- a/src/editexecutablesdialog.h
+++ b/src/editexecutablesdialog.h
@@ -112,6 +112,8 @@ private slots:
void on_add_clicked();
void on_remove_clicked();
+ void on_up_clicked();
+ void on_down_clicked();
void on_title_textChanged(const QString& s);
void on_overwriteSteamAppID_toggled(bool checked);
@@ -144,6 +146,7 @@ private:
void clearEdits();
void setEdits(const Executable& e);
void save();
+ void moveSelection(int by);
void setJarBinary(const QString& binaryName);
std::optional<QString> makeNonConflictingTitle(const QString& prefix);
bool isTitleConflicting(const QString& s);
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index e85256c8..9801a75c 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -58,24 +58,15 @@
<number>0</number>
</property>
<item>
- <widget class="QListWidget" name="list">
- <property name="toolTip">
- <string>List of configured executables</string>
- </property>
- <property name="whatsThis">
- <string>This is a list of your configured executables. Executables in grey are automatically recognised and can not be modified.</string>
- </property>
- <property name="dragDropMode">
- <enum>QAbstractItemView::InternalMove</enum>
- </property>
- <property name="defaultDropAction">
- <enum>Qt::TargetMoveAction</enum>
- </property>
- </widget>
- </item>
- <item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Executables</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -89,7 +80,7 @@
</spacer>
</item>
<item>
- <widget class="QPushButton" name="add">
+ <widget class="QToolButton" name="add">
<property name="toolTip">
<string>Add an executable</string>
</property>
@@ -100,13 +91,13 @@
<string>Add</string>
</property>
<property name="icon">
- <iconset>
- <normaloff>:/new/guiresources/resources/list-add.png</normaloff>:/new/guiresources/resources/list-add.png</iconset>
+ <iconset resource="resources.qrc">
+ <normaloff>:/MO/gui/add</normaloff>:/MO/gui/add</iconset>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="remove">
+ <widget class="QToolButton" name="remove">
<property name="toolTip">
<string>Remove the selected executable</string>
</property>
@@ -117,26 +108,51 @@
<string>Remove</string>
</property>
<property name="icon">
- <iconset>
- <normaloff>:/new/guiresources/resources/list-remove.png</normaloff>:/new/guiresources/resources/list-remove.png</iconset>
+ <iconset resource="resources.qrc">
+ <normaloff>:/MO/gui/resources/list-remove.png</normaloff>:/MO/gui/resources/list-remove.png</iconset>
</property>
</widget>
</item>
<item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <widget class="QToolButton" name="up">
+ <property name="text">
+ <string>Move the executable up in the list</string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
+ <property name="icon">
+ <iconset resource="resources.qrc">
+ <normaloff>:/MO/gui/resources/go-up.png</normaloff>:/MO/gui/resources/go-up.png</iconset>
</property>
- </spacer>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="down">
+ <property name="text">
+ <string>Move the executable down in the list</string>
+ </property>
+ <property name="icon">
+ <iconset resource="resources.qrc">
+ <normaloff>:/MO/gui/resources/go-down.png</normaloff>:/MO/gui/resources/go-down.png</iconset>
+ </property>
+ </widget>
</item>
</layout>
</item>
+ <item>
+ <widget class="QListWidget" name="list">
+ <property name="toolTip">
+ <string>List of configured executables</string>
+ </property>
+ <property name="whatsThis">
+ <string>This is a list of your configured executables. Executables in grey are automatically recognised and can not be modified.</string>
+ </property>
+ <property name="dragDropMode">
+ <enum>QAbstractItemView::InternalMove</enum>
+ </property>
+ <property name="defaultDropAction">
+ <enum>Qt::TargetMoveAction</enum>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="widget" native="true">
@@ -420,9 +436,9 @@ Right now the only case I know of where this needs to be overwritten is for the
<tabstop>steamAppID</tabstop>
<tabstop>createFilesInMod</tabstop>
<tabstop>mods</tabstop>
- <tabstop>add</tabstop>
- <tabstop>remove</tabstop>
</tabstops>
- <resources/>
+ <resources>
+ <include location="resources.qrc"/>
+ </resources>
<connections/>
</ui>