From fafdb146004401355db5245cc1f7c241c00cf991 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Fri, 7 Jun 2019 19:26:54 -0400
Subject: fixed EditExecutablesDialog being opened without a parent removed
Executable's constructor with values, replaced with default ctor + setters,
all these strings were much too error-prone added Executable ctor overload to
convert from ExecutableInfo plugin executables now override most of the
custom changes renamed browseButton to browseBinaryButton to avoid confusion
with the other browseDirButton fixed both browse dialogs not handling cancel
EditExecutablesDialog's list used to change the text color for custom
executables, replaced with italics
---
src/editexecutablesdialog.ui | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index 4f9223d5..adda050c 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -80,7 +80,7 @@
-
-
+
Browse filesystem
@@ -310,7 +310,7 @@ Right now the only case I know of where this needs to be overwritten is for the
executablesListBox
titleEdit
binaryEdit
- browseButton
+ browseBinaryButton
workingDirEdit
browseDirButton
argumentsEdit
--
cgit v1.3.1
From 840dba26bacd044164d3236218e42f441433252c Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Fri, 7 Jun 2019 19:55:41 -0400
Subject: rework of the executables dialog to have a horizontal splitter and
use a standard QDialogButtonBox
---
src/editexecutablesdialog.cpp | 10 +-
src/editexecutablesdialog.h | 5 +-
src/editexecutablesdialog.ui | 613 +++++++++++++++++++++++-------------------
3 files changed, 347 insertions(+), 281 deletions(-)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index a3b2808a..559bc8f0 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -42,6 +42,9 @@ EditExecutablesDialog::EditExecutablesDialog(
, m_GamePlugin(game)
{
ui->setupUi(this);
+ ui->splitter->setSizes({200, 1});
+ ui->splitter->setStretchFactor(0, 0);
+ ui->splitter->setStretchFactor(1, 1);
refreshExecutablesWidget();
@@ -367,8 +370,10 @@ void EditExecutablesDialog::on_overwriteAppIDBox_toggled(bool checked)
ui->appIDOverwriteEdit->setEnabled(checked);
}
-void EditExecutablesDialog::on_closeButton_clicked()
+void EditExecutablesDialog::on_buttonBox_clicked(QAbstractButton*)
{
+ // there's only a close button for now, so the actual button doesn't matter
+
if (executableChanged()) {
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Save Changes?"),
tr("You made changes to the current executable, do you want to save them?"),
@@ -382,7 +387,8 @@ void EditExecutablesDialog::on_closeButton_clicked()
refreshExecutablesWidget();
}
}
- this->accept();
+
+ accept();
}
void EditExecutablesDialog::on_executablesListBox_clicked(const QModelIndex ¤t)
diff --git a/src/editexecutablesdialog.h b/src/editexecutablesdialog.h
index 3a856afa..07d6459c 100644
--- a/src/editexecutablesdialog.h
+++ b/src/editexecutablesdialog.h
@@ -22,10 +22,11 @@ along with Mod Organizer. If not, see .
#include "tutorabledialog.h"
#include
-#include
#include "executableslist.h"
#include "profile.h"
#include "iplugingame.h"
+#include
+#include
namespace Ui {
class EditExecutablesDialog;
@@ -88,7 +89,7 @@ private slots:
void on_browseDirButton_clicked();
- void on_closeButton_clicked();
+ void on_buttonBox_clicked(QAbstractButton *button);
void delayedRefresh();
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index adda050c..1cf1116a 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -6,8 +6,8 @@
0
0
- 426
- 460
+ 524
+ 366
@@ -21,293 +21,354 @@
-
-
-
- List of configured executables
+
+
+
+ 0
+ 100
+
-
- This is a list of your configured executables. Executables in grey are automatically recognised and can not be modified.
-
-
- QAbstractItemView::InternalMove
-
-
- Qt::TargetMoveAction
-
-
- QAbstractItemView::ExtendedSelection
-
-
-
- -
-
-
-
-
-
- Title
-
-
-
- -
-
-
- Name of the executable. This is only for display purposes.
-
-
- Name of the executable. This is only for display purposes.
-
-
-
-
-
- -
-
-
-
-
-
- Binary
-
-
-
- -
-
-
- Binary to run
-
-
- Binary to run
-
-
-
- -
-
-
- Browse filesystem
-
-
- Browse filesystem for the executable to run.
-
-
- ...
-
-
-
-
-
- -
-
-
-
-
-
- Start in
-
-
-
- -
-
-
- -
-
-
- ...
-
-
-
-
-
- -
-
-
-
-
-
- Arguments
-
-
-
- -
-
-
- Arguments to pass to the application
-
-
- Arguments to pass to the application
-
-
-
-
-
- -
-
-
-
-
-
- Allow the Steam AppID to be used for this executable to be changed.
-
-
- Allow the Steam AppID to be used for this executable to be changed.
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Qt::Horizontal
+
+
+ false
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ List of configured executables
+
+
+ This is a list of your configured executables. Executables in grey are automatically recognised and can not be modified.
+
+
+ QAbstractItemView::InternalMove
+
+
+ Qt::TargetMoveAction
+
+
+ QAbstractItemView::ExtendedSelection
+
+
+
+
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
-
+
+
+ Title
+
+
+
+ -
+
+
+ Name of the executable. This is only for display purposes.
+
+
+ Name of the executable. This is only for display purposes.
+
+
+
+
+
+ -
+
+
-
+
+
+ Binary
+
+
+
+ -
+
+
+ Binary to run
+
+
+ Binary to run
+
+
+
+ -
+
+
+ Browse filesystem
+
+
+ Browse filesystem for the executable to run.
+
+
+ ...
+
+
+
+
+
+ -
+
+
-
+
+
+ Start in
+
+
+
+ -
+
+
+ -
+
+
+ ...
+
+
+
+
+
+ -
+
+
-
+
+
+ Arguments
+
+
+
+ -
+
+
+ Arguments to pass to the application
+
+
+ Arguments to pass to the application
+
+
+
+
+
+ -
+
+
-
+
+
+ Allow the Steam AppID to be used for this executable to be changed.
+
+
+ Allow the Steam AppID to be used for this executable to be changed.
Every game/tool distributed through Steam has a unique ID. MO needs to know this ID to start those programs directly, otherwise the program is started by steam and then MO will not work. By default, MO will use the AppID for the game.
Right now the only case I know of where this needs to be overwritten is for the Skyrim Creation Kit which has its own AppID. This overwrite is already preconfigured.
-
-
- Overwrite Steam AppID
-
-
-
- -
-
-
- false
-
-
- Steam AppID to use for this executable that differs from the games AppID.
-
-
- Steam AppID to use for this executable that differs from the games AppID.
+
+
+ Overwrite Steam AppID
+
+
+
+ -
+
+
+ false
+
+
+ Steam AppID to use for this executable that differs from the games AppID.
+
+
+ Steam AppID to use for this executable that differs from the games AppID.
Every game/tool distributed through Steam has a unique ID. MO needs to know this ID to start those programs directly, otherwise the program is started by steam and then MO will not work. By default, MO will use the AppID for the game (usually 72850).
Right now the only case I know of where this needs to be overwritten is for the Skyrim Creation Kit which has its own AppID (usually 202480). This overwrite is already preconfigured.
-
-
-
-
-
- -
-
-
-
-
-
- If this is enabled, new files are created in the specified mod instead of the "Overwrite" mod.
-
-
- Create Files in Mod instead of Overwrite (*)
-
-
-
- -
-
-
- false
-
-
-
-
-
- -
-
-
-
-
-
- If this is enabled, the configured libraries will be automatically loaded when this executable is launched.
-
-
- Force Load Libraries (*)
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- false
-
-
- Configure Libraries
-
-
-
-
-
- -
-
-
- Use Application's Icon for shortcuts
-
+
+
+
+
+
+ -
+
+
-
+
+
+ If this is enabled, new files are created in the specified mod instead of the "Overwrite" mod.
+
+
+ Create Files in Mod instead of Overwrite (*)
+
+
+
+ -
+
+
+ false
+
+
+
+
+
+ -
+
+
-
+
+
+ If this is enabled, the configured libraries will be automatically loaded when this executable is launched.
+
+
+ Force Load Libraries (*)
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+ Configure Libraries
+
+
+
+
+
+ -
+
+
+ Use Application's Icon for shortcuts
+
+
+
+ -
+
+
+ (*) This setting is profile-specific
+
+
+
+ -
+
+
-
+
+
+ Add an executable
+
+
+ Add an executable
+
+
+ Add
+
+
+
+ :/new/guiresources/resources/list-add.png:/new/guiresources/resources/list-add.png
+
+
+
+ -
+
+
+ Remove the selected executable
+
+
+ Remove the selected executable
+
+
+ Remove
+
+
+
+ :/new/guiresources/resources/list-remove.png:/new/guiresources/resources/list-remove.png
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
-
-
-
- (*) This setting is profile-specific
+
+
+ QDialogButtonBox::Close
- -
-
-
-
-
-
- Add an executable
-
-
- Add an executable
-
-
- Add
-
-
-
- :/new/guiresources/resources/list-add.png:/new/guiresources/resources/list-add.png
-
-
-
- -
-
-
- Remove the selected executable
-
-
- Remove the selected executable
-
-
- Remove
-
-
-
- :/new/guiresources/resources/list-remove.png:/new/guiresources/resources/list-remove.png
-
-
-
-
-
- -
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Close
-
-
-
-
-
- executablesListBox
titleEdit
binaryEdit
browseBinaryButton
@@ -318,10 +379,8 @@ Right now the only case I know of where this needs to be overwritten is for the
appIDOverwriteEdit
newFilesModCheckBox
newFilesModBox
- useAppIconCheckBox
addButton
removeButton
- closeButton
--
cgit v1.3.1
From 5556e2b152decad3392c30c9760a5584454b52e6 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Fri, 7 Jun 2019 20:08:53 -0400
Subject: replaced close with ok/cancel moved add/remove below the list
---
src/editexecutablesdialog.cpp | 9 +-
src/editexecutablesdialog.h | 3 +-
src/editexecutablesdialog.ui | 218 +++++++++++++++++++++++-------------------
3 files changed, 125 insertions(+), 105 deletions(-)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index 559bc8f0..f7348889 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -370,10 +370,8 @@ void EditExecutablesDialog::on_overwriteAppIDBox_toggled(bool checked)
ui->appIDOverwriteEdit->setEnabled(checked);
}
-void EditExecutablesDialog::on_buttonBox_clicked(QAbstractButton*)
+void EditExecutablesDialog::on_buttonBox_accepted()
{
- // there's only a close button for now, so the actual button doesn't matter
-
if (executableChanged()) {
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Save Changes?"),
tr("You made changes to the current executable, do you want to save them?"),
@@ -391,6 +389,11 @@ void EditExecutablesDialog::on_buttonBox_clicked(QAbstractButton*)
accept();
}
+void EditExecutablesDialog::on_buttonBox_rejected()
+{
+ reject();
+}
+
void EditExecutablesDialog::on_executablesListBox_clicked(const QModelIndex ¤t)
{
if (current.isValid()) {
diff --git a/src/editexecutablesdialog.h b/src/editexecutablesdialog.h
index 07d6459c..7f389b24 100644
--- a/src/editexecutablesdialog.h
+++ b/src/editexecutablesdialog.h
@@ -89,7 +89,8 @@ private slots:
void on_browseDirButton_clicked();
- void on_buttonBox_clicked(QAbstractButton *button);
+ void on_buttonBox_accepted();
+ void on_buttonBox_rejected();
void delayedRefresh();
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index 1cf1116a..52bbf187 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -6,8 +6,8 @@
0
0
- 524
- 366
+ 710
+ 293
@@ -82,6 +82,70 @@
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Add an executable
+
+
+ Add an executable
+
+
+ Add
+
+
+
+ :/new/guiresources/resources/list-add.png:/new/guiresources/resources/list-add.png
+
+
+
+ -
+
+
+ Remove the selected executable
+
+
+ Remove the selected executable
+
+
+ Remove
+
+
+
+ :/new/guiresources/resources/list-remove.png:/new/guiresources/resources/list-remove.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
@@ -99,15 +163,18 @@
0
-
-
-
-
+
+
+ 20
+
+
-
Title
- -
+
-
Name of the executable. This is only for display purposes.
@@ -117,73 +184,69 @@
-
-
- -
-
-
-
+
-
Binary
- -
-
-
- Binary to run
-
-
- Binary to run
-
-
-
- -
-
-
- Browse filesystem
-
-
- Browse filesystem for the executable to run.
-
-
- ...
-
-
+
-
+
+
-
+
+
+ Binary to run
+
+
+ Binary to run
+
+
+
+ -
+
+
+ Browse filesystem
+
+
+ Browse filesystem for the executable to run.
+
+
+ ...
+
+
+
+
-
-
- -
-
-
-
+
-
Start in
- -
-
-
- -
-
-
- ...
-
-
+
-
+
+
-
+
+
+ -
+
+
+ ...
+
+
+
+
-
-
- -
-
-
-
+
-
Arguments
- -
+
-
Arguments to pass to the application
@@ -258,7 +321,7 @@ Right now the only case I know of where this needs to be overwritten is for the
If this is enabled, the configured libraries will be automatically loaded when this executable is launched.
- Force Load Libraries (*)
+ Force Load Libraries (Profile Specific)
@@ -294,51 +357,6 @@ Right now the only case I know of where this needs to be overwritten is for the
- -
-
-
- (*) This setting is profile-specific
-
-
-
- -
-
-
-
-
-
- Add an executable
-
-
- Add an executable
-
-
- Add
-
-
-
- :/new/guiresources/resources/list-add.png:/new/guiresources/resources/list-add.png
-
-
-
- -
-
-
- Remove the selected executable
-
-
- Remove the selected executable
-
-
- Remove
-
-
-
- :/new/guiresources/resources/list-remove.png:/new/guiresources/resources/list-remove.png
-
-
-
-
-
-
@@ -362,19 +380,17 @@ Right now the only case I know of where this needs to be overwritten is for the
-
- QDialogButtonBox::Close
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
- titleEdit
binaryEdit
browseBinaryButton
workingDirEdit
browseDirButton
- argumentsEdit
overwriteAppIDBox
appIDOverwriteEdit
newFilesModCheckBox
--
cgit v1.3.1
From 39d953c838d459085b4044c9ca5bda0248e47f6b Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Fri, 7 Jun 2019 21:03:25 -0400
Subject: load plugin executables after settings, allows for changing the order
added warning that an executable is provided by a plugin, disable widgets
that can't be changed refactoring EditExecutablesDialog
---
src/editexecutablesdialog.cpp | 134 +++++++++++---
src/editexecutablesdialog.h | 9 +-
src/editexecutablesdialog.ui | 405 ++++++++++++++++++++++--------------------
src/executableslist.cpp | 4 +-
4 files changed, 328 insertions(+), 224 deletions(-)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index f7348889..8494c892 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -47,15 +47,96 @@ EditExecutablesDialog::EditExecutablesDialog(
ui->splitter->setStretchFactor(1, 1);
refreshExecutablesWidget();
-
ui->newFilesModBox->addItems(modList.allMods());
m_ForcedLibraries = m_Profile->determineForcedLibraries(ui->titleEdit->text());
+
+ updateUI(nullptr);
+}
+
+EditExecutablesDialog::~EditExecutablesDialog() = default;
+
+void EditExecutablesDialog::updateUI(const Executable* e)
+{
+ if (e) {
+ setEdits(*e);
+ } else {
+ clearEdits();
+ ui->removeButton->setEnabled(false);
+ }
+}
+
+void EditExecutablesDialog::clearEdits()
+{
+ ui->titleEdit->clear();
+ ui->binaryEdit->clear();
+ ui->workingDirEdit->clear();
+ ui->argumentsEdit->clear();
+ ui->overwriteAppIDBox->setChecked(false);
+ ui->appIDOverwriteEdit->clear();
+ ui->newFilesModCheckBox->setChecked(false);
+ ui->newFilesModBox->setCurrentIndex(-1);
+ ui->forceLoadCheckBox->setChecked(false);
+ ui->useAppIconCheckBox->setChecked(false);
+
+ ui->pluginProvidedLabel->setVisible(false);
}
-EditExecutablesDialog::~EditExecutablesDialog()
+void EditExecutablesDialog::setEdits(const Executable& e)
{
- delete ui;
+ ui->titleEdit->setText(e.title());
+ ui->binaryEdit->setText(QDir::toNativeSeparators(e.binaryInfo().absoluteFilePath()));
+ ui->workingDirEdit->setText(QDir::toNativeSeparators(e.workingDirectory()));
+ ui->argumentsEdit->setText(e.arguments());
+ ui->overwriteAppIDBox->setChecked(!e.steamAppID().isEmpty());
+ ui->appIDOverwriteEdit->setText(e.steamAppID());
+ ui->useAppIconCheckBox->setChecked(e.usesOwnIcon());
+
+ int modIndex = -1;
+
+ QString customOverwrite = m_Profile->setting("custom_overwrites", e.title()).toString();
+ if (!customOverwrite.isEmpty()) {
+ modIndex = ui->newFilesModBox->findText(customOverwrite);
+ }
+
+ ui->newFilesModCheckBox->setChecked(modIndex != -1);
+ ui->newFilesModBox->setCurrentIndex(modIndex);
+
+ const bool forcedLibraries = m_Profile->forcedLibrariesEnabled(e.title());
+ ui->forceLoadCheckBox->setChecked(forcedLibraries);
+ ui->forceLoadButton->setEnabled(forcedLibraries);
+
+ ui->pluginProvidedLabel->setVisible(!e.isCustom());
+
+ // only enabled for custom executables
+ ui->titleEdit->setEnabled(e.isCustom());
+ ui->binaryEdit->setEnabled(e.isCustom());
+ ui->browseBinaryButton->setEnabled(e.isCustom());
+ ui->workingDirEdit->setEnabled(e.isCustom());
+ ui->browseWorkingDirButton->setEnabled(e.isCustom());
+ ui->argumentsEdit->setEnabled(e.isCustom());
+ ui->overwriteAppIDBox->setEnabled(e.isCustom());
+ ui->appIDOverwriteEdit->setEnabled(e.isCustom());
+ ui->useAppIconCheckBox->setEnabled(e.isCustom());
+
+ // always enabled
+ ui->newFilesModCheckBox->setEnabled(true);
+ ui->newFilesModBox->setEnabled(true);
+ ui->forceLoadCheckBox->setEnabled(true);
+}
+
+void EditExecutablesDialog::resetInput()
+{
+ ui->binaryEdit->setText("");
+ ui->titleEdit->setText("");
+ ui->workingDirEdit->clear();
+ ui->argumentsEdit->setText("");
+ ui->appIDOverwriteEdit->clear();
+ ui->overwriteAppIDBox->setChecked(false);
+ ui->useAppIconCheckBox->setChecked(false);
+ ui->newFilesModCheckBox->setChecked(false);
+ ui->forceLoadCheckBox->setChecked(false);
+ m_CurrentItem = nullptr;
}
ExecutablesList EditExecutablesDialog::getExecutablesList() const
@@ -95,8 +176,8 @@ void EditExecutablesDialog::refreshExecutablesWidget()
ui->executablesListBox->addItem(newItem);
}
- ui->addButton->setEnabled(false);
- ui->removeButton->setEnabled(false);
+ //ui->addButton->setEnabled(false);
+ //ui->removeButton->setEnabled(false);
}
@@ -131,20 +212,6 @@ void EditExecutablesDialog::updateButtonStates()
ui->addButton->setEnabled(enabled);
}
-void EditExecutablesDialog::resetInput()
-{
- ui->binaryEdit->setText("");
- ui->titleEdit->setText("");
- ui->workingDirEdit->clear();
- ui->argumentsEdit->setText("");
- ui->appIDOverwriteEdit->clear();
- ui->overwriteAppIDBox->setChecked(false);
- ui->useAppIconCheckBox->setChecked(false);
- ui->newFilesModCheckBox->setChecked(false);
- ui->forceLoadCheckBox->setChecked(false);
- m_CurrentItem = nullptr;
-}
-
void EditExecutablesDialog::saveExecutable()
{
@@ -260,7 +327,7 @@ void EditExecutablesDialog::on_browseBinaryButton_clicked()
}
}
-void EditExecutablesDialog::on_browseDirButton_clicked()
+void EditExecutablesDialog::on_browseWorkingDirButton_clicked()
{
QString dirName = FileDialogMemory::getExistingDirectory("editExecutableDirectory", this,
tr("Select a directory"));
@@ -359,10 +426,27 @@ bool EditExecutablesDialog::executableChanged()
}
void EditExecutablesDialog::on_executablesListBox_itemSelectionChanged()
{
- if (ui->executablesListBox->selectedItems().size() == 0) {
- // deselected
- resetInput();
+ const auto selection = ui->executablesListBox->selectedItems();
+
+ if (selection.empty()) {
+ updateUI(nullptr);
+ return;
+ }
+
+ auto* item = selection[0];
+ if (!item) {
+ return;
}
+
+ const auto& title = item->text();
+ auto itor = m_ExecutablesList.find(title);
+
+ if (itor == m_ExecutablesList.end()) {
+ qWarning().nospace() << "selection: executable '" << title << "' not found";
+ return;
+ }
+
+ updateUI(&*itor);
}
void EditExecutablesDialog::on_overwriteAppIDBox_toggled(bool checked)
@@ -395,7 +479,7 @@ void EditExecutablesDialog::on_buttonBox_rejected()
}
void EditExecutablesDialog::on_executablesListBox_clicked(const QModelIndex ¤t)
-{
+{/*
if (current.isValid()) {
if (executableChanged()) {
@@ -459,7 +543,7 @@ void EditExecutablesDialog::on_executablesListBox_clicked(const QModelIndex &cur
bool forcedLibraries = m_Profile->forcedLibrariesEnabled(ui->titleEdit->text());
ui->forceLoadButton->setEnabled(forcedLibraries);
ui->forceLoadCheckBox->setChecked(forcedLibraries);
- }
+ }*/
}
void EditExecutablesDialog::on_newFilesModCheckBox_toggled(bool checked)
diff --git a/src/editexecutablesdialog.h b/src/editexecutablesdialog.h
index 7f389b24..bb1538ef 100644
--- a/src/editexecutablesdialog.h
+++ b/src/editexecutablesdialog.h
@@ -87,7 +87,7 @@ private slots:
void on_overwriteAppIDBox_toggled(bool checked);
- void on_browseDirButton_clicked();
+ void on_browseWorkingDirButton_clicked();
void on_buttonBox_accepted();
void on_buttonBox_rejected();
@@ -113,7 +113,7 @@ private:
void updateButtonStates();
private:
- Ui::EditExecutablesDialog *ui;
+ std::unique_ptr ui;
QListWidgetItem *m_CurrentItem;
@@ -124,6 +124,11 @@ private:
QList m_ForcedLibraries;
const MOBase::IPluginGame *m_GamePlugin;
+
+
+ void updateUI(const Executable* e);
+ void clearEdits();
+ void setEdits(const Executable& e);
};
#endif // EDITEXECUTABLESDIALOG_H
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index 52bbf187..2c9a74f3 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -7,15 +7,9 @@
0
0
710
- 293
+ 348
-
-
- 200
- 200
-
-
Modify Executables
@@ -77,9 +71,6 @@
Qt::TargetMoveAction
-
- QAbstractItemView::ExtendedSelection
-
-
@@ -163,197 +154,221 @@
0
-
-
-
- 20
-
-
-
-
-
- Title
-
-
-
- -
-
-
- Name of the executable. This is only for display purposes.
-
-
- Name of the executable. This is only for display purposes.
-
-
-
- -
-
-
- Binary
-
-
-
- -
-
-
-
-
-
- Binary to run
-
-
- Binary to run
-
-
-
- -
-
-
- Browse filesystem
-
-
- Browse filesystem for the executable to run.
-
-
- ...
-
-
-
-
-
- -
-
-
- Start in
-
-
-
- -
-
-
-
-
-
- -
-
-
- ...
-
-
-
-
-
- -
-
-
- Arguments
-
-
-
- -
-
-
- Arguments to pass to the application
-
-
- Arguments to pass to the application
-
-
-
-
-
- -
-
-
-
-
-
- Allow the Steam AppID to be used for this executable to be changed.
-
-
- Allow the Steam AppID to be used for this executable to be changed.
+
+
+
+ 10
+
+
-
+
+
+ 20
+
+
-
+
+
+ Title
+
+
+
+ -
+
+
+ Name of the executable. This is only for display purposes.
+
+
+ Name of the executable. This is only for display purposes.
+
+
+
+ -
+
+
+ Binary
+
+
+
+ -
+
+
-
+
+
+ Binary to run
+
+
+ Binary to run
+
+
+
+ -
+
+
+ Browse filesystem
+
+
+ Browse filesystem for the executable to run.
+
+
+ ...
+
+
+
+
+
+ -
+
+
+ Start in
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ ...
+
+
+
+
+
+ -
+
+
+ Arguments
+
+
+
+ -
+
+
+ Arguments to pass to the application
+
+
+ Arguments to pass to the application
+
+
+
+
+
+ -
+
+
-
+
+
+ Allow the Steam AppID to be used for this executable to be changed.
+
+
+ Allow the Steam AppID to be used for this executable to be changed.
Every game/tool distributed through Steam has a unique ID. MO needs to know this ID to start those programs directly, otherwise the program is started by steam and then MO will not work. By default, MO will use the AppID for the game.
Right now the only case I know of where this needs to be overwritten is for the Skyrim Creation Kit which has its own AppID. This overwrite is already preconfigured.
-
-
- Overwrite Steam AppID
-
-
-
- -
-
-
- false
-
-
- Steam AppID to use for this executable that differs from the games AppID.
-
-
- Steam AppID to use for this executable that differs from the games AppID.
+
+
+ Overwrite Steam AppID
+
+
+
+ -
+
+
+ false
+
+
+ Steam AppID to use for this executable that differs from the games AppID.
+
+
+ Steam AppID to use for this executable that differs from the games AppID.
Every game/tool distributed through Steam has a unique ID. MO needs to know this ID to start those programs directly, otherwise the program is started by steam and then MO will not work. By default, MO will use the AppID for the game (usually 72850).
Right now the only case I know of where this needs to be overwritten is for the Skyrim Creation Kit which has its own AppID (usually 202480). This overwrite is already preconfigured.
-
-
-
-
-
- -
-
-
-
-
-
- If this is enabled, new files are created in the specified mod instead of the "Overwrite" mod.
-
-
- Create Files in Mod instead of Overwrite (*)
-
-
-
- -
-
-
- false
-
-
-
-
-
- -
-
-
-
-
-
- If this is enabled, the configured libraries will be automatically loaded when this executable is launched.
-
-
- Force Load Libraries (Profile Specific)
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- false
-
-
- Configure Libraries
-
-
-
-
+
+
+
+
+
+ -
+
+
-
+
+
+ If this is enabled, new files are created in the specified mod instead of the "Overwrite" mod.
+
+
+ Create Files in Mod instead of Overwrite (*)
+
+
+
+ -
+
+
+ false
+
+
+
+
+
+ -
+
+
-
+
+
+ If this is enabled, the configured libraries will be automatically loaded when this executable is launched.
+
+
+ Force Load Libraries (Profile Specific)
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+ Configure Libraries
+
+
+
+
+
+ -
+
+
+ Use Application's Icon for shortcuts
+
+
+
+
+
-
-
+
+
+
+ true
+
+
- Use Application's Icon for shortcuts
+ This executable is provided by the game plugin
+
+
+ Qt::AlignCenter
@@ -390,7 +405,7 @@ Right now the only case I know of where this needs to be overwritten is for the
binaryEdit
browseBinaryButton
workingDirEdit
- browseDirButton
+ browseWorkingDirButton
overwriteAppIDBox
appIDOverwriteEdit
newFilesModCheckBox
diff --git a/src/executableslist.cpp b/src/executableslist.cpp
index d884bdf2..8174eb1b 100644
--- a/src/executableslist.cpp
+++ b/src/executableslist.cpp
@@ -65,8 +65,6 @@ bool ExecutablesList::empty() const
void ExecutablesList::load(const MOBase::IPluginGame* game, QSettings& settings)
{
- addFromPlugin(game);
-
qDebug("setting up configured executables");
int numCustomExecutables = settings.beginReadArray("customExecutables");
@@ -91,6 +89,8 @@ void ExecutablesList::load(const MOBase::IPluginGame* game, QSettings& settings)
}
settings.endArray();
+
+ addFromPlugin(game);
}
void ExecutablesList::store(QSettings& settings)
--
cgit v1.3.1
From b8199f0c471f2b5ee2b070a96b42ad0040cddf2f Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Fri, 7 Jun 2019 21:57:29 -0400
Subject: renamed most of the widgets to shorter or more descriptive names
(newFilesModCheckBox?) modifying widgets calls save()
---
src/editexecutablesdialog.cpp | 361 +++++++++++++++++++++++-------------------
src/editexecutablesdialog.h | 40 +++--
src/editexecutablesdialog.ui | 63 ++++----
3 files changed, 257 insertions(+), 207 deletions(-)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index 941ab4e0..621c670f 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -40,7 +40,7 @@ EditExecutablesDialog::EditExecutablesDialog(
, m_executablesList(executablesList)
, m_profile(profile)
, m_gamePlugin(game)
- , m_dirty(false)
+ , m_settingUI(false)
{
ui->setupUi(this);
ui->splitter->setSizes({200, 1});
@@ -48,108 +48,189 @@ EditExecutablesDialog::EditExecutablesDialog(
ui->splitter->setStretchFactor(1, 1);
refreshExecutablesWidget();
- ui->newFilesModBox->addItems(modList.allMods());
+ ui->mods->addItems(modList.allMods());
- m_forcedLibraries = m_profile->determineForcedLibraries(ui->titleEdit->text());
+ m_forcedLibraries = m_profile->determineForcedLibraries(ui->title->text());
+
+ // title textbox also has to change the list item, will call save manually
+ connect(ui->title, &QLineEdit::textChanged, [&](auto&& s){ onTitleChanged(s); });
+ connect(ui->binary, &QLineEdit::textChanged, [&]{ save(); });
+ connect(ui->workingDirectory, &QLineEdit::textChanged, [&]{ save(); });
+ connect(ui->arguments, &QLineEdit::textChanged, [&]{ save(); });
updateUI(nullptr);
}
EditExecutablesDialog::~EditExecutablesDialog() = default;
+QListWidgetItem* EditExecutablesDialog::selectedItem()
+{
+ const auto selection = ui->list->selectedItems();
+
+ if (selection.empty()) {
+ return nullptr;
+ }
+
+ return selection[0];
+}
+
+Executable* EditExecutablesDialog::selectedExe()
+{
+ auto* item = selectedItem();
+ if (!item) {
+ return nullptr;
+ }
+
+ const auto& title = item->text();
+ auto itor = m_executablesList.find(title);
+
+ if (itor == m_executablesList.end()) {
+ return nullptr;
+ }
+
+ return &*itor;
+}
+
void EditExecutablesDialog::updateUI(const Executable* e)
{
+ m_settingUI = true;
+
if (e) {
setEdits(*e);
- ui->removeButton->setEnabled(e->isCustom());
+ ui->remove->setEnabled(e->isCustom());
} else {
clearEdits();
- ui->removeButton->setEnabled(false);
+ ui->remove->setEnabled(false);
}
+
+ m_settingUI = false;
}
void EditExecutablesDialog::clearEdits()
{
- ui->titleEdit->clear();
- ui->binaryEdit->clear();
- ui->workingDirEdit->clear();
- ui->argumentsEdit->clear();
- ui->overwriteAppIDBox->setChecked(false);
- ui->appIDOverwriteEdit->clear();
- ui->newFilesModCheckBox->setChecked(false);
- ui->newFilesModBox->setCurrentIndex(-1);
- ui->forceLoadCheckBox->setChecked(false);
- ui->useAppIconCheckBox->setChecked(false);
+ ui->title->clear();
+ ui->binary->clear();
+ ui->workingDirectory->clear();
+ ui->arguments->clear();
+ ui->overwriteSteamAppID->setChecked(false);
+ ui->steamAppID->clear();
+ ui->createFilesInMod->setChecked(false);
+ ui->mods->setCurrentIndex(-1);
+ ui->forceLoadLibraries->setChecked(false);
+ ui->useApplicationIcon->setChecked(false);
ui->pluginProvidedLabel->setVisible(false);
}
void EditExecutablesDialog::setEdits(const Executable& e)
{
- ui->titleEdit->setText(e.title());
- ui->binaryEdit->setText(QDir::toNativeSeparators(e.binaryInfo().absoluteFilePath()));
- ui->workingDirEdit->setText(QDir::toNativeSeparators(e.workingDirectory()));
- ui->argumentsEdit->setText(e.arguments());
- ui->overwriteAppIDBox->setChecked(!e.steamAppID().isEmpty());
- ui->appIDOverwriteEdit->setText(e.steamAppID());
- ui->useAppIconCheckBox->setChecked(e.usesOwnIcon());
+ ui->title->setText(e.title());
+ ui->binary->setText(QDir::toNativeSeparators(e.binaryInfo().absoluteFilePath()));
+ ui->workingDirectory->setText(QDir::toNativeSeparators(e.workingDirectory()));
+ ui->arguments->setText(e.arguments());
+ ui->overwriteSteamAppID->setChecked(!e.steamAppID().isEmpty());
+ ui->steamAppID->setText(e.steamAppID());
+ ui->useApplicationIcon->setChecked(e.usesOwnIcon());
int modIndex = -1;
QString customOverwrite = m_profile->setting("custom_overwrites", e.title()).toString();
if (!customOverwrite.isEmpty()) {
- modIndex = ui->newFilesModBox->findText(customOverwrite);
+ modIndex = ui->mods->findText(customOverwrite);
}
- ui->newFilesModCheckBox->setChecked(modIndex != -1);
- ui->newFilesModBox->setCurrentIndex(modIndex);
+ ui->createFilesInMod->setChecked(modIndex != -1);
+ ui->mods->setCurrentIndex(modIndex);
const bool forcedLibraries = m_profile->forcedLibrariesEnabled(e.title());
- ui->forceLoadCheckBox->setChecked(forcedLibraries);
- ui->forceLoadButton->setEnabled(forcedLibraries);
+ ui->forceLoadLibraries->setChecked(forcedLibraries);
+ ui->configureLibraries->setEnabled(forcedLibraries);
ui->pluginProvidedLabel->setVisible(!e.isCustom());
// only enabled for custom executables
- ui->titleEdit->setEnabled(e.isCustom());
- ui->binaryEdit->setEnabled(e.isCustom());
- ui->browseBinaryButton->setEnabled(e.isCustom());
- ui->workingDirEdit->setEnabled(e.isCustom());
- ui->browseWorkingDirButton->setEnabled(e.isCustom());
- ui->argumentsEdit->setEnabled(e.isCustom());
- ui->overwriteAppIDBox->setEnabled(e.isCustom());
- ui->appIDOverwriteEdit->setEnabled(e.isCustom());
- ui->useAppIconCheckBox->setEnabled(e.isCustom());
+ ui->title->setEnabled(e.isCustom());
+ ui->binary->setEnabled(e.isCustom());
+ ui->browseBinary->setEnabled(e.isCustom());
+ ui->workingDirectory->setEnabled(e.isCustom());
+ ui->browseWorkingDirectory->setEnabled(e.isCustom());
+ ui->arguments->setEnabled(e.isCustom());
+ ui->overwriteSteamAppID->setEnabled(e.isCustom());
+ ui->steamAppID->setEnabled(e.isCustom());
+ ui->useApplicationIcon->setEnabled(e.isCustom());
// always enabled
- ui->newFilesModCheckBox->setEnabled(true);
- ui->newFilesModBox->setEnabled(true);
- ui->forceLoadCheckBox->setEnabled(true);
+ ui->createFilesInMod->setEnabled(true);
+ ui->mods->setEnabled(true);
+ ui->forceLoadLibraries->setEnabled(true);
}
+void EditExecutablesDialog::save()
+{
+ if (m_settingUI) {
+ // the ui is currently being set, ignore changes
+ return;
+ }
+
+ auto* e = selectedExe();
+ if (!e) {
+ qWarning("trying to save but nothing is selected");
+ return;
+ }
+
+ qDebug().nospace() << "saving '" << e->title() << "'";
+
+ e->title(ui->title->text());
+ e->binaryInfo(ui->binary->text());
+ e->workingDirectory(ui->workingDirectory->text());
+ e->arguments(ui->arguments->text());
+
+ if (ui->overwriteSteamAppID->isChecked()) {
+ e->steamAppID(ui->steamAppID->text());
+ } else {
+ e->steamAppID("");
+ }
+}
+
+void EditExecutablesDialog::onTitleChanged(const QString& s)
+{
+ if (m_settingUI) {
+ // the ui is currently being set, ignore changes
+ return;
+ }
+ // must save first because it relies on the text in the list to find the
+ // executable to modify
+ save();
+ // once the executable is saved, the list item must be changed to match the
+ // new name
+ if (auto* i=selectedItem()) {
+ i->setText(s);
+ }
+}
void EditExecutablesDialog::resetInput()
{
- ui->binaryEdit->setText("");
- ui->titleEdit->setText("");
- ui->workingDirEdit->clear();
- ui->argumentsEdit->setText("");
- ui->appIDOverwriteEdit->clear();
- ui->overwriteAppIDBox->setChecked(false);
- ui->useAppIconCheckBox->setChecked(false);
- ui->newFilesModCheckBox->setChecked(false);
- ui->forceLoadCheckBox->setChecked(false);
+ ui->binary->setText("");
+ ui->title->setText("");
+ ui->workingDirectory->clear();
+ ui->arguments->setText("");
+ ui->overwriteSteamAppID->setChecked(false);
+ ui->createFilesInMod->setChecked(false);
+ ui->forceLoadLibraries->setChecked(false);
+ ui->steamAppID->clear();
+ ui->useApplicationIcon->setChecked(false);
+
m_currentItem = nullptr;
}
ExecutablesList EditExecutablesDialog::getExecutablesList() const
{
ExecutablesList newList;
- for (int i = 0; i < ui->executablesListBox->count(); ++i) {
- const auto& title = ui->executablesListBox->item(i)->text();
+ for (int i = 0; i < ui->list->count(); ++i) {
+ const auto& title = ui->list->item(i)->text();
auto itor = m_executablesList.find(title);
if (itor == m_executablesList.end()) {
@@ -167,7 +248,7 @@ ExecutablesList EditExecutablesDialog::getExecutablesList() const
void EditExecutablesDialog::refreshExecutablesWidget()
{
- ui->executablesListBox->clear();
+ ui->list->clear();
for(const auto& exe : m_executablesList) {
QListWidgetItem *newItem = new QListWidgetItem(exe.title());
@@ -179,7 +260,7 @@ void EditExecutablesDialog::refreshExecutablesWidget()
newItem->setFont(f);
}
- ui->executablesListBox->addItem(newItem);
+ ui->list->addItem(newItem);
}
//ui->addButton->setEnabled(false);
@@ -187,28 +268,18 @@ void EditExecutablesDialog::refreshExecutablesWidget()
}
-void EditExecutablesDialog::on_binaryEdit_textChanged(const QString &name)
-{
- updateButtonStates();
-}
-
-void EditExecutablesDialog::on_workingDirEdit_textChanged(const QString &dir)
-{
- updateButtonStates();
-}
-
void EditExecutablesDialog::updateButtonStates()
{
bool enabled = true;
- QString filePath(ui->binaryEdit->text());
+ QString filePath(ui->binary->text());
QFileInfo fileInfo(filePath);
if (!fileInfo.exists())
enabled = false;
if (!fileInfo.isFile())
enabled = false;
- QString dirPath(ui->workingDirEdit->text());
+ QString dirPath(ui->workingDirectory->text());
if (!dirPath.isEmpty()) {
QDir dirInfo(dirPath);
if (!dirInfo.exists())
@@ -222,41 +293,41 @@ void EditExecutablesDialog::updateButtonStates()
void EditExecutablesDialog::saveExecutable()
{
Executable::Flags flags = Executable::CustomExecutable;
- if (ui->useAppIconCheckBox->isChecked())
+ if (ui->useApplicationIcon->isChecked())
flags |= Executable::UseApplicationIcon;
m_executablesList.setExecutable(Executable()
- .title(ui->titleEdit->text())
- .binaryInfo(QDir::fromNativeSeparators(ui->binaryEdit->text()))
- .arguments(ui->argumentsEdit->text())
- .steamAppID(ui->overwriteAppIDBox->isChecked() ? ui->appIDOverwriteEdit->text() : "")
- .workingDirectory(QDir::fromNativeSeparators(ui->workingDirEdit->text()))
+ .title(ui->title->text())
+ .binaryInfo(QDir::fromNativeSeparators(ui->binary->text()))
+ .arguments(ui->arguments->text())
+ .steamAppID(ui->overwriteSteamAppID->isChecked() ? ui->steamAppID->text() : "")
+ .workingDirectory(QDir::fromNativeSeparators(ui->workingDirectory->text()))
.flags(flags));
- if (ui->newFilesModCheckBox->isChecked()) {
- m_profile->storeSetting("custom_overwrites", ui->titleEdit->text(),
- ui->newFilesModBox->currentText());
+ if (ui->createFilesInMod->isChecked()) {
+ m_profile->storeSetting("custom_overwrites", ui->title->text(),
+ ui->mods->currentText());
}
else {
- m_profile->removeSetting("custom_overwrites", ui->titleEdit->text());
+ m_profile->removeSetting("custom_overwrites", ui->title->text());
}
- m_profile->removeForcedLibraries(ui->titleEdit->text());
- m_profile->storeForcedLibraries(ui->titleEdit->text(), m_forcedLibraries);
- m_profile->setForcedLibrariesEnabled(ui->titleEdit->text(), ui->forceLoadCheckBox->isChecked());
+ m_profile->removeForcedLibraries(ui->title->text());
+ m_profile->storeForcedLibraries(ui->title->text(), m_forcedLibraries);
+ m_profile->setForcedLibrariesEnabled(ui->title->text(), ui->forceLoadLibraries->isChecked());
}
void EditExecutablesDialog::delayedRefresh()
{
- QModelIndex index = ui->executablesListBox->currentIndex();
+ /*QModelIndex index = ui->executablesListBox->currentIndex();
resetInput();
refreshExecutablesWidget();
- on_executablesListBox_clicked(index);
+ on_executablesListBox_clicked(index);*/
}
-void EditExecutablesDialog::on_forceLoadButton_clicked()
+void EditExecutablesDialog::on_configureLibraries_clicked()
{
ForcedLoadDialog dialog(m_gamePlugin, this);
dialog.setValues(m_forcedLibraries);
@@ -265,13 +336,13 @@ void EditExecutablesDialog::on_forceLoadButton_clicked()
}
}
-void EditExecutablesDialog::on_forceLoadCheckBox_toggled()
+void EditExecutablesDialog::on_forceLoadLibraries_toggled(bool checked)
{
- ui->forceLoadButton->setEnabled(ui->forceLoadCheckBox->isChecked());
+ ui->configureLibraries->setEnabled(ui->forceLoadLibraries->isChecked());
}
-void EditExecutablesDialog::on_addButton_clicked()
+void EditExecutablesDialog::on_add_clicked()
{
if (executableChanged()) {
saveExecutable();
@@ -281,7 +352,7 @@ void EditExecutablesDialog::on_addButton_clicked()
refreshExecutablesWidget();
}
-void EditExecutablesDialog::on_browseBinaryButton_clicked()
+void EditExecutablesDialog::on_browseBinary_clicked()
{
QString binaryName = FileDialogMemory::getOpenFileName(
"editExecutableBinary", this, tr("Select a binary"), QString(),
@@ -319,21 +390,21 @@ void EditExecutablesDialog::on_browseBinaryButton_clicked()
tr("MO requires 32-bit java to run this application. If you already have it installed, select javaw.exe "
"from that installation as the binary."));
} else {
- ui->binaryEdit->setText(binaryPath);
+ ui->binary->setText(binaryPath);
}
- ui->workingDirEdit->setText(QDir::toNativeSeparators(QFileInfo(binaryName).absolutePath()));
- ui->argumentsEdit->setText("-jar \"" + QDir::toNativeSeparators(binaryName) + "\"");
+ ui->workingDirectory->setText(QDir::toNativeSeparators(QFileInfo(binaryName).absolutePath()));
+ ui->arguments->setText("-jar \"" + QDir::toNativeSeparators(binaryName) + "\"");
} else {
- ui->binaryEdit->setText(QDir::toNativeSeparators(binaryName));
+ ui->binary->setText(QDir::toNativeSeparators(binaryName));
}
- if (ui->titleEdit->text().isEmpty()) {
- ui->titleEdit->setText(QFileInfo(binaryName).baseName());
+ if (ui->title->text().isEmpty()) {
+ ui->title->setText(QFileInfo(binaryName).baseName());
}
}
-void EditExecutablesDialog::on_browseWorkingDirButton_clicked()
+void EditExecutablesDialog::on_browseWorkingDirectory_clicked()
{
QString dirName = FileDialogMemory::getExistingDirectory("editExecutableDirectory", this,
tr("Select a directory"));
@@ -343,43 +414,22 @@ void EditExecutablesDialog::on_browseWorkingDirButton_clicked()
return;
}
- ui->workingDirEdit->setText(dirName);
+ ui->workingDirectory->setText(dirName);
}
-void EditExecutablesDialog::on_removeButton_clicked()
+void EditExecutablesDialog::on_remove_clicked()
{
- if (QMessageBox::question(this, tr("Confirm"), tr("Really remove \"%1\" from executables?").arg(ui->titleEdit->text()),
+ if (QMessageBox::question(this, tr("Confirm"), tr("Really remove \"%1\" from executables?").arg(ui->title->text()),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- m_profile->removeSetting("custom_overwrites", ui->titleEdit->text());
- m_profile->removeForcedLibraries(ui->titleEdit->text());
- m_executablesList.remove(ui->titleEdit->text());
+ m_profile->removeSetting("custom_overwrites", ui->title->text());
+ m_profile->removeForcedLibraries(ui->title->text());
+ m_executablesList.remove(ui->title->text());
}
resetInput();
refreshExecutablesWidget();
}
-void EditExecutablesDialog::on_titleEdit_textChanged(const QString &arg1)
-{
- /*QPushButton *addButton = findChild("addButton");
- QPushButton *removeButton = findChild("removeButton");
-
- QListWidget *executablesWidget = findChild("executablesListBox");
-
- QList existingItems = executablesWidget->findItems(arg1, Qt::MatchFixedString);
-
- addButton->setEnabled(arg1.length() != 0);
-
- if (existingItems.count() == 0) {
- addButton->setText(tr("Add"));
- removeButton->setEnabled(false);
- } else {
- // existing item. is it a custom one?
- addButton->setText(tr("Modify"));
- removeButton->setEnabled(true);
- }*/
-}
-
bool EditExecutablesDialog::executableChanged()
{
@@ -409,58 +459,39 @@ bool EditExecutablesDialog::executableChanged()
lhs.library() == rhs.library() &&
lhs.process() == rhs.process();
});
- forcedLibrariesDirty |= m_profile->setting("forced_libraries", ui->titleEdit->text() + "/enabled", false).toBool() !=
- ui->forceLoadCheckBox->isChecked();
-
- return selectedExecutable.title() != ui->titleEdit->text()
- || selectedExecutable.arguments() != ui->argumentsEdit->text()
- || selectedExecutable.steamAppID() != ui->appIDOverwriteEdit->text()
- || !storedCustomOverwrite.isEmpty() != ui->newFilesModCheckBox->isChecked()
- || !storedCustomOverwrite.isEmpty() && (storedCustomOverwrite != ui->newFilesModBox->currentText())
- || selectedExecutable.workingDirectory() != QDir::fromNativeSeparators(ui->workingDirEdit->text())
- || selectedExecutable.binaryInfo().absoluteFilePath() != QDir::fromNativeSeparators(ui->binaryEdit->text())
- || selectedExecutable.usesOwnIcon() != ui->useAppIconCheckBox->isChecked()
+ forcedLibrariesDirty |= m_profile->setting("forced_libraries", ui->title->text() + "/enabled", false).toBool() !=
+ ui->forceLoadLibraries->isChecked();
+
+ return selectedExecutable.title() != ui->title->text()
+ || selectedExecutable.arguments() != ui->arguments->text()
+ || selectedExecutable.steamAppID() != ui->steamAppID->text()
+ || !storedCustomOverwrite.isEmpty() != ui->createFilesInMod->isChecked()
+ || !storedCustomOverwrite.isEmpty() && (storedCustomOverwrite != ui->mods->currentText())
+ || selectedExecutable.workingDirectory() != QDir::fromNativeSeparators(ui->workingDirectory->text())
+ || selectedExecutable.binaryInfo().absoluteFilePath() != QDir::fromNativeSeparators(ui->binary->text())
+ || selectedExecutable.usesOwnIcon() != ui->useApplicationIcon->isChecked()
|| forcedLibrariesDirty
;
} else {
- QFileInfo fileInfo(ui->binaryEdit->text());
- return !ui->binaryEdit->text().isEmpty()
- && !ui->titleEdit->text().isEmpty()
+ QFileInfo fileInfo(ui->binary->text());
+ return !ui->binary->text().isEmpty()
+ && !ui->title->text().isEmpty()
&& fileInfo.exists()
&& fileInfo.isFile();
}
}
-void EditExecutablesDialog::on_executablesListBox_itemSelectionChanged()
-{
- const auto selection = ui->executablesListBox->selectedItems();
-
- if (selection.empty()) {
- updateUI(nullptr);
- return;
- }
-
- auto* item = selection[0];
- if (!item) {
- return;
- }
-
- const auto& title = item->text();
- auto itor = m_executablesList.find(title);
- if (itor == m_executablesList.end()) {
- qWarning().nospace() << "selection: executable '" << title << "' not found";
- return;
- }
-
- updateUI(&*itor);
+void EditExecutablesDialog::on_list_itemSelectionChanged()
+{
+ updateUI(selectedExe());
}
-void EditExecutablesDialog::on_overwriteAppIDBox_toggled(bool checked)
+void EditExecutablesDialog::on_overwriteSteamAppID_toggled(bool checked)
{
- ui->appIDOverwriteEdit->setEnabled(checked);
+ ui->steamAppID->setEnabled(checked);
}
-void EditExecutablesDialog::on_buttonBox_accepted()
+void EditExecutablesDialog::on_buttons_accepted()
{
if (executableChanged()) {
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Save Changes?"),
@@ -479,13 +510,13 @@ void EditExecutablesDialog::on_buttonBox_accepted()
accept();
}
-void EditExecutablesDialog::on_buttonBox_rejected()
+void EditExecutablesDialog::on_buttons_rejected()
{
reject();
}
-void EditExecutablesDialog::on_executablesListBox_clicked(const QModelIndex ¤t)
-{/*
+/*void EditExecutablesDialog::on_executablesListBox_clicked(const QModelIndex ¤t)
+{
if (current.isValid()) {
if (executableChanged()) {
@@ -549,10 +580,14 @@ void EditExecutablesDialog::on_executablesListBox_clicked(const QModelIndex &cur
bool forcedLibraries = m_Profile->forcedLibrariesEnabled(ui->titleEdit->text());
ui->forceLoadButton->setEnabled(forcedLibraries);
ui->forceLoadCheckBox->setChecked(forcedLibraries);
- }*/
+ }
+}*/
+
+void EditExecutablesDialog::on_createFilesInMod_toggled(bool checked)
+{
+ ui->mods->setEnabled(checked);
}
-void EditExecutablesDialog::on_newFilesModCheckBox_toggled(bool checked)
+void EditExecutablesDialog::on_useApplicationIcon_toggled(bool checked)
{
- ui->newFilesModBox->setEnabled(checked);
}
diff --git a/src/editexecutablesdialog.h b/src/editexecutablesdialog.h
index 9214941d..f28658e3 100644
--- a/src/editexecutablesdialog.h
+++ b/src/editexecutablesdialog.h
@@ -59,43 +59,51 @@ public:
ExecutablesList getExecutablesList() const;
private slots:
- void on_newFilesModCheckBox_toggled(bool checked);
- void on_binaryEdit_textChanged(const QString &arg1);
- void on_workingDirEdit_textChanged(const QString &arg1);
- void on_addButton_clicked();
- void on_browseBinaryButton_clicked();
- void on_removeButton_clicked();
- void on_titleEdit_textChanged(const QString &arg1);
- void on_overwriteAppIDBox_toggled(bool checked);
- void on_browseWorkingDirButton_clicked();
- void on_buttonBox_accepted();
- void on_buttonBox_rejected();
+ void on_list_itemSelectionChanged();
+
+ void on_add_clicked();
+ void on_remove_clicked();
+
+ void on_overwriteSteamAppID_toggled(bool checked);
+ void on_createFilesInMod_toggled(bool checked);
+ void on_forceLoadLibraries_toggled(bool checked);
+ void on_useApplicationIcon_toggled(bool checked);
+
+ void on_browseBinary_clicked();
+ void on_browseWorkingDirectory_clicked();
+ void on_configureLibraries_clicked();
+
+ void on_buttons_accepted();
+ void on_buttons_rejected();
+
void delayedRefresh();
- void on_executablesListBox_itemSelectionChanged();
- void on_executablesListBox_clicked(const QModelIndex &index);
- void on_forceLoadButton_clicked();
- void on_forceLoadCheckBox_toggled();
private:
std::unique_ptr ui;
ExecutablesList m_executablesList;
Profile *m_profile;
const MOBase::IPluginGame *m_gamePlugin;
- bool m_dirty;
+ bool m_settingUI;
QListWidgetItem *m_currentItem;
QList m_forcedLibraries;
+ QListWidgetItem* selectedItem();
+ Executable* selectedExe();
+
void updateUI(const Executable* e);
void clearEdits();
void setEdits(const Executable& e);
+ void save();
void resetInput();
void refreshExecutablesWidget();
bool executableChanged();
void updateButtonStates();
void saveExecutable();
+
+ void onTitleChanged(const QString& s);
};
#endif // EDITEXECUTABLESDIALOG_H
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index 2c9a74f3..6cb8e0b8 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -58,7 +58,7 @@
0
-
-
+
List of configured executables
@@ -89,7 +89,7 @@
-
-
+
Add an executable
@@ -106,7 +106,7 @@
-
-
+
Remove the selected executable
@@ -172,7 +172,7 @@
-
-
+
Name of the executable. This is only for display purposes.
@@ -191,7 +191,7 @@
-
-
-
+
Binary to run
@@ -201,7 +201,7 @@
-
-
+
Browse filesystem
@@ -225,10 +225,10 @@
-
-
-
+
-
-
+
...
@@ -244,7 +244,7 @@
-
-
+
Arguments to pass to the application
@@ -258,7 +258,7 @@
-
-
-
+
Allow the Steam AppID to be used for this executable to be changed.
@@ -273,7 +273,7 @@ Right now the only case I know of where this needs to be overwritten is for the
-
-
+
false
@@ -292,7 +292,7 @@ Right now the only case I know of where this needs to be overwritten is for the
-
-
-
+
If this is enabled, new files are created in the specified mod instead of the "Overwrite" mod.
@@ -302,7 +302,7 @@ Right now the only case I know of where this needs to be overwritten is for the
-
-
+
false
@@ -313,12 +313,12 @@ Right now the only case I know of where this needs to be overwritten is for the
-
-
-
+
If this is enabled, the configured libraries will be automatically loaded when this executable is launched.
- Force Load Libraries (Profile Specific)
+ Force Load Libraries (*)
@@ -336,7 +336,7 @@ Right now the only case I know of where this needs to be overwritten is for the
-
-
+
false
@@ -348,12 +348,19 @@ Right now the only case I know of where this needs to be overwritten is for the
-
-
+
Use Application's Icon for shortcuts
+ -
+
+
+ (*) Profile Specific
+
+
+
@@ -393,7 +400,7 @@ Right now the only case I know of where this needs to be overwritten is for the
-
-
+
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
@@ -402,16 +409,16 @@ Right now the only case I know of where this needs to be overwritten is for the
- binaryEdit
- browseBinaryButton
- workingDirEdit
- browseWorkingDirButton
- overwriteAppIDBox
- appIDOverwriteEdit
- newFilesModCheckBox
- newFilesModBox
- addButton
- removeButton
+ binary
+ browseBinary
+ workingDirectory
+ browseWorkingDirectory
+ overwriteSteamAppID
+ steamAppID
+ createFilesInMod
+ mods
+ add
+ remove
--
cgit v1.3.1
From 98d5602c9951b49f8033161d8497553293070f8f Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 9 Jun 2019 11:53:20 -0400
Subject: adjusted the position of the "(*) Profile Specific" label comments
---
src/editexecutablesdialog.cpp | 3 +++
src/editexecutablesdialog.ui | 3 +++
2 files changed, 6 insertions(+)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index cb6ec6e8..96f4660a 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -485,12 +485,15 @@ void EditExecutablesDialog::on_browseBinary_clicked()
return;
}
+ // setting binary
if (binaryName.endsWith(".jar", Qt::CaseInsensitive)) {
+ // special case for jar files, uses the system java installation
setJarBinary(binaryName);
} else {
ui->binary->setText(QDir::toNativeSeparators(binaryName));
}
+ // setting title if currently empty
if (ui->title->text().isEmpty()) {
const auto prefix = QFileInfo(binaryName).baseName();
const auto newTitle = makeNonConflictingTitle(prefix);
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index 6cb8e0b8..7a5fa27f 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -359,6 +359,9 @@ Right now the only case I know of where this needs to be overwritten is for the
(*) Profile Specific
+
+ 5
+
--
cgit v1.3.1
From cbe6dd93b1607f9b95037c2e131f34c27d32753d Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 9 Jun 2019 11:56:22 -0400
Subject: made the default size of the dialog a bit larger
---
src/editexecutablesdialog.ui | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index 7a5fa27f..e85256c8 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -7,7 +7,7 @@
0
0
710
- 348
+ 440
--
cgit v1.3.1
From 5fa7fd7fb9f3a8f67e8842420d7a2ad600722119 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 9 Jun 2019 17:05:51 -0400
Subject: moved add/remove to the top, changed them to tool buttons with icons,
added up/down buttons
---
src/editexecutablesdialog.cpp | 48 +++++++++++++++++++++++++
src/editexecutablesdialog.h | 3 ++
src/editexecutablesdialog.ui | 84 +++++++++++++++++++++++++------------------
3 files changed, 101 insertions(+), 34 deletions(-)
(limited to 'src/editexecutablesdialog.ui')
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 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
@@ -57,24 +57,15 @@
0
- -
-
-
- List of configured executables
-
-
- This is a list of your configured executables. Executables in grey are automatically recognised and can not be modified.
-
-
- QAbstractItemView::InternalMove
-
-
- Qt::TargetMoveAction
-
-
-
-
+
-
+
+
+ Executables
+
+
+
-
@@ -89,7 +80,7 @@
-
-
+
Add an executable
@@ -100,13 +91,13 @@
Add
-
- :/new/guiresources/resources/list-add.png:/new/guiresources/resources/list-add.png
+
+ :/MO/gui/add:/MO/gui/add
-
-
+
Remove the selected executable
@@ -117,26 +108,51 @@
Remove
-
- :/new/guiresources/resources/list-remove.png:/new/guiresources/resources/list-remove.png
+
+ :/MO/gui/resources/list-remove.png:/MO/gui/resources/list-remove.png
-
-
-
- Qt::Horizontal
+
+
+ Move the executable up in the list
-
-
- 40
- 20
-
+
+
+ :/MO/gui/resources/go-up.png:/MO/gui/resources/go-up.png
-
+
+
+ -
+
+
+ Move the executable down in the list
+
+
+
+ :/MO/gui/resources/go-down.png:/MO/gui/resources/go-down.png
+
+
+ -
+
+
+ List of configured executables
+
+
+ This is a list of your configured executables. Executables in grey are automatically recognised and can not be modified.
+
+
+ QAbstractItemView::InternalMove
+
+
+ Qt::TargetMoveAction
+
+
+
@@ -420,9 +436,9 @@ Right now the only case I know of where this needs to be overwritten is for the
steamAppID
createFilesInMod
mods
- add
- remove
-
+
+
+
--
cgit v1.3.1
From c8e1b4ab3a51cfe0f39a6f0d78cf0988c380549c Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 9 Jun 2019 17:43:10 -0400
Subject: changed the down/up pngs to be slightly offset vertically from what
they were, they did not look aligned when next to each other added
status/tooltip/whatsthis strings to new buttons change enabled status of
up/down dynamically simplified move() to just move by one
---
src/editexecutablesdialog.cpp | 87 ++++++++++++++++++++++++++----------------
src/editexecutablesdialog.h | 6 ++-
src/editexecutablesdialog.ui | 24 ++++++++++++
src/resources/go-down.png | Bin 874 -> 937 bytes
src/resources/go-up.png | Bin 877 -> 974 bytes
5 files changed, 82 insertions(+), 35 deletions(-)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index 9747a86f..e2772757 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -64,7 +64,7 @@ EditExecutablesDialog::EditExecutablesDialog(OrganizerCore& oc, QWidget* parent)
if (ui->list->count() > 0) {
ui->list->item(0)->setSelected(true);
} else {
- updateUI(nullptr);
+ updateUI(nullptr, nullptr);
}
}
@@ -184,23 +184,40 @@ QListWidgetItem* EditExecutablesDialog::createListItem(const Executable& exe)
return newItem;
}
-void EditExecutablesDialog::updateUI(const Executable* e)
+void EditExecutablesDialog::updateUI(
+ const QListWidgetItem* item, const Executable* e)
{
// the ui is currently being set, ignore changes
m_settingUI = true;
if (e) {
setEdits(*e);
- ui->remove->setEnabled(e->isCustom());
} else {
clearEdits();
- ui->remove->setEnabled(false);
}
+ setButtons(item, e);
+
// any changes from now on are from the user
m_settingUI = false;
}
+void EditExecutablesDialog::setButtons(
+ const QListWidgetItem* item, const Executable* e)
+{
+ // add is always enabled
+
+ if (item) {
+ ui->remove->setEnabled(e->isCustom());
+ ui->up->setEnabled(canMove(item, -1));
+ ui->down->setEnabled(canMove(item, +1));
+ } else {
+ ui->remove->setEnabled(false);
+ ui->up->setEnabled(false);
+ ui->down->setEnabled(false);
+ }
+}
+
void EditExecutablesDialog::clearEdits()
{
ui->title->clear();
@@ -348,47 +365,41 @@ void EditExecutablesDialog::save()
}
}
-void EditExecutablesDialog::moveSelection(int by)
+bool EditExecutablesDialog::canMove(const QListWidgetItem* item, int direction)
{
- auto* item = selectedItem();
if (!item) {
- return;
+ return false;
}
- // moving down the list
- while (by > 0) {
- const auto row = ui->list->row(item);
+ if (direction < 0) {
+ // moving up
+ return (ui->list->row(item) > 0);
- if (row >= (ui->list->count() - 1)) {
- break;
- }
-
- ui->list->takeItem(row);
- ui->list->insertItem(row + 1, item);
- item->setSelected(true);
-
- --by;
+ } else if (direction > 0) {
+ // moving down
+ return (ui->list->row(item) < (ui->list->count() - 1));
}
- // moving up the list
- while (by < 0) {
- const auto row = ui->list->row(item);
+ return false;
+}
- if (row <= 0) {
- break;
- }
+void EditExecutablesDialog::move(QListWidgetItem* item, int direction)
+{
+ if (!canMove(item, direction)) {
+ return;
+ }
- ui->list->takeItem(row);
- ui->list->insertItem(row - 1, item);
- item->setSelected(true);
+ const auto row = ui->list->row(item);
- ++by;
- }
+ // removing item
+ ui->list->takeItem(row);
+ ui->list->insertItem(row + (direction > 0 ? 1 : -1), item);
+ item->setSelected(true);
}
void EditExecutablesDialog::on_list_itemSelectionChanged()
{
- updateUI(selectedExe());
+ updateUI(selectedItem(), selectedExe());
}
void EditExecutablesDialog::on_add_clicked()
@@ -448,12 +459,22 @@ void EditExecutablesDialog::on_remove_clicked()
void EditExecutablesDialog::on_up_clicked()
{
- moveSelection(-1);
+ auto* item = selectedItem();
+ if (!item) {
+ return;
+ }
+
+ move(item, -1);
}
void EditExecutablesDialog::on_down_clicked()
{
- moveSelection(+1);
+ auto* item = selectedItem();
+ if (!item) {
+ return;
+ }
+
+ move(item, +1);
}
bool EditExecutablesDialog::isTitleConflicting(const QString& s)
diff --git a/src/editexecutablesdialog.h b/src/editexecutablesdialog.h
index 80ec56df..10a6166f 100644
--- a/src/editexecutablesdialog.h
+++ b/src/editexecutablesdialog.h
@@ -142,11 +142,13 @@ private:
void fillExecutableList();
QListWidgetItem* createListItem(const Executable& exe);
- void updateUI(const Executable* e);
+ void updateUI(const QListWidgetItem* item, const Executable* e);
void clearEdits();
void setEdits(const Executable& e);
+ void setButtons(const QListWidgetItem* item, const Executable* e);
void save();
- void moveSelection(int by);
+ bool canMove(const QListWidgetItem* item, int direction);
+ void move(QListWidgetItem* item, int direction);
void setJarBinary(const QString& binaryName);
std::optional makeNonConflictingTitle(const QString& prefix);
bool isTitleConflicting(const QString& s);
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index 9801a75c..fb65dbbe 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -84,6 +84,9 @@
Add an executable
+
+ Add an executable
+
Add an executable
@@ -101,6 +104,9 @@
Remove the selected executable
+
+ Remove the selected executable
+
Remove the selected executable
@@ -115,6 +121,15 @@
-
+
+ Move the executable up in the list
+
+
+ Move the executable up in the list
+
+
+ Move the executable up in the list
+
Move the executable up in the list
@@ -126,6 +141,15 @@
-
+
+ Move the executable down in the list
+
+
+ Move the executable down in the list
+
+
+ Move the executable down in the list
+
Move the executable down in the list
diff --git a/src/resources/go-down.png b/src/resources/go-down.png
index af237881..bf0ce4fd 100644
Binary files a/src/resources/go-down.png and b/src/resources/go-down.png differ
diff --git a/src/resources/go-up.png b/src/resources/go-up.png
index b0a0cd72..a4b4e022 100644
Binary files a/src/resources/go-up.png and b/src/resources/go-up.png differ
--
cgit v1.3.1
From b04782877e34254ae0205c71d0bf15bef1633749 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 9 Jun 2019 17:51:15 -0400
Subject: reduced margins around edit widgets, increased splitter handle width
to separate the top buttons from the edit widgets a bit more
---
src/editexecutablesdialog.ui | 12 ++++++++++++
1 file changed, 12 insertions(+)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index fb65dbbe..83d81225 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -40,6 +40,9 @@
Qt::Horizontal
+
+ 9
+
false
@@ -196,6 +199,15 @@
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
10
--
cgit v1.3.1
From 82975a6a38d0807e962b0e4b6cbd76337dc8189c Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Wed, 12 Jun 2019 15:32:07 -0400
Subject: reduced spacing between buttons, removed chatty logging
---
src/editexecutablesdialog.cpp | 2 --
src/editexecutablesdialog.ui | 6 ++++++
2 files changed, 6 insertions(+), 2 deletions(-)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index e2772757..6c0522e4 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -316,8 +316,6 @@ void EditExecutablesDialog::save()
return;
}
- qDebug().nospace() << "saving '" << e->title() << "'";
-
// title may have changed, start with the stuff using it
// custom overwrites
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index 83d81225..9b6c8153 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -48,6 +48,9 @@
+
+ 3
+
0
@@ -62,6 +65,9 @@
-
+
+ 0
+
-
--
cgit v1.3.1
From 7671725436551b7254ea89ff6985c5491fcc743d Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Fri, 14 Jun 2019 04:30:33 -0400
Subject: removed concept of custom executables, everything is modifiable added
apply button to dialog added reset button that re-adds plugin executables and
renames existing ones if needed moved executables files to their filter in
visual studio
---
src/CMakeLists.txt | 11 +--
src/editexecutablesdialog.cpp | 143 ++++++++++++++++++++------------------
src/editexecutablesdialog.h | 9 +--
src/editexecutablesdialog.ui | 37 +++++-----
src/executableslist.cpp | 156 ++++++++++++++++++++++++------------------
src/executableslist.h | 24 +++++--
src/mainwindow.cpp | 3 +-
src/pch.h | 1 +
8 files changed, 221 insertions(+), 163 deletions(-)
(limited to 'src/editexecutablesdialog.ui')
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5623a851..645a5a73 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -293,7 +293,6 @@ set(core
categories
shared/directoryentry
directoryrefresher
- executableslist
installationmanager
instancemanager
loadmechanism
@@ -309,7 +308,6 @@ set(dialogs
activatemodsdialog
categoriesdialog
credentialsdialog
- editexecutablesdialog
filedialogmemory
forcedloaddialog
forcedloaddialogwidget
@@ -333,6 +331,11 @@ set(downloads
downloadmanager
)
+set(executables
+ executableslist
+ editexecutablesdialog
+)
+
set(locking
ilockedwaitingforprocess
lockeddialog
@@ -412,8 +415,8 @@ set(widgets
)
set(src_filters
- application core browser dialogs downloads locking modinfo modlist plugins
- previews profiles settings utilities widgets
+ application core browser dialogs downloads executables locking modinfo
+ modlist plugins previews profiles settings utilities widgets
)
foreach(filter in list ${src_filters})
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index 6c0522e4..882bb8b5 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -49,8 +49,9 @@ EditExecutablesDialog::EditExecutablesDialog(OrganizerCore& oc, QWidget* parent)
m_customOverwrites.load(m_organizerCore.currentProfile(), m_executablesList);
m_forcedLibraries.load(m_organizerCore.currentProfile(), m_executablesList);
- fillExecutableList();
+ fillList();
ui->mods->addItems(m_organizerCore.modList()->allMods());
+ setDirty(false);
// some widgets need to do more than just save() and have their own handler
connect(ui->binary, &QLineEdit::textChanged, [&]{ save(); });
@@ -59,13 +60,7 @@ EditExecutablesDialog::EditExecutablesDialog(OrganizerCore& oc, QWidget* parent)
connect(ui->steamAppID, &QLineEdit::textChanged, [&]{ save(); });
connect(ui->mods, &QComboBox::currentTextChanged, [&]{ save(); });
connect(ui->useApplicationIcon, &QCheckBox::toggled, [&]{ save(); });
-
- // select the first one in the list, if any
- if (ui->list->count() > 0) {
- ui->list->item(0)->setSelected(true);
- } else {
- updateUI(nullptr, nullptr);
- }
+ connect(ui->list->model(), &QAbstractItemModel::rowsMoved, [&]{ saveOrder(); });
}
EditExecutablesDialog::~EditExecutablesDialog() = default;
@@ -132,6 +127,15 @@ void EditExecutablesDialog::commitChanges()
// set the new executables list
m_organizerCore.setExecutablesList(newExecutables);
+
+ setDirty(false);
+}
+
+void EditExecutablesDialog::setDirty(bool b)
+{
+ if (auto* button=ui->buttons->button(QDialogButtonBox::Apply)) {
+ button->setEnabled(b);
+ }
}
QListWidgetItem* EditExecutablesDialog::selectedItem()
@@ -162,26 +166,25 @@ Executable* EditExecutablesDialog::selectedExe()
return &*itor;
}
-void EditExecutablesDialog::fillExecutableList()
+void EditExecutablesDialog::fillList()
{
ui->list->clear();
for(const auto& exe : m_executablesList) {
ui->list->addItem(createListItem(exe));
}
+
+ // select the first one in the list, if any
+ if (ui->list->count() > 0) {
+ ui->list->item(0)->setSelected(true);
+ } else {
+ updateUI(nullptr, nullptr);
+ }
}
QListWidgetItem* EditExecutablesDialog::createListItem(const Executable& exe)
{
- QListWidgetItem *newItem = new QListWidgetItem(exe.title());
-
- if (!exe.isCustom()) {
- auto f = newItem->font();
- f.setItalic(true);
- newItem->setFont(f);
- }
-
- return newItem;
+ return new QListWidgetItem(exe.title());
}
void EditExecutablesDialog::updateUI(
@@ -205,14 +208,12 @@ void EditExecutablesDialog::updateUI(
void EditExecutablesDialog::setButtons(
const QListWidgetItem* item, const Executable* e)
{
- // add is always enabled
+ // add and remove are always enabled
if (item) {
- ui->remove->setEnabled(e->isCustom());
ui->up->setEnabled(canMove(item, -1));
ui->down->setEnabled(canMove(item, +1));
} else {
- ui->remove->setEnabled(false);
ui->up->setEnabled(false);
ui->down->setEnabled(false);
}
@@ -243,7 +244,6 @@ void EditExecutablesDialog::clearEdits()
ui->configureLibraries->setEnabled(false);
ui->useApplicationIcon->setEnabled(false);
ui->useApplicationIcon->setChecked(false);
- ui->pluginProvidedLabel->setVisible(false);
}
void EditExecutablesDialog::setEdits(const Executable& e)
@@ -287,19 +287,15 @@ void EditExecutablesDialog::setEdits(const Executable& e)
ui->configureLibraries->setEnabled(hasForcedLibraries);
}
- ui->pluginProvidedLabel->setVisible(!e.isCustom());
-
- // only enabled for custom executables
- ui->title->setEnabled(e.isCustom());
- ui->binary->setEnabled(e.isCustom());
- ui->browseBinary->setEnabled(e.isCustom());
- ui->workingDirectory->setEnabled(e.isCustom());
- ui->browseWorkingDirectory->setEnabled(e.isCustom());
- ui->arguments->setEnabled(e.isCustom());
- ui->overwriteSteamAppID->setEnabled(e.isCustom());
- ui->useApplicationIcon->setEnabled(e.isCustom());
-
// always enabled
+ ui->title->setEnabled(true);
+ ui->binary->setEnabled(true);
+ ui->browseBinary->setEnabled(true);
+ ui->workingDirectory->setEnabled(true);
+ ui->browseWorkingDirectory->setEnabled(true);
+ ui->arguments->setEnabled(true);
+ ui->overwriteSteamAppID->setEnabled(true);
+ ui->useApplicationIcon->setEnabled(true);
ui->createFilesInMod->setEnabled(true);
ui->forceLoadLibraries->setEnabled(true);
}
@@ -361,6 +357,14 @@ void EditExecutablesDialog::save()
} else {
e->flags(e->flags() & (~Executable::UseApplicationIcon));
}
+
+ setDirty(true);
+}
+
+void EditExecutablesDialog::saveOrder()
+{
+ m_executablesList = getExecutablesList();
+ setDirty(true);
}
bool EditExecutablesDialog::canMove(const QListWidgetItem* item, int direction)
@@ -393,6 +397,8 @@ void EditExecutablesDialog::move(QListWidgetItem* item, int direction)
ui->list->takeItem(row);
ui->list->insertItem(row + (direction > 0 ? 1 : -1), item);
item->setSelected(true);
+
+ setDirty(true);
}
void EditExecutablesDialog::on_list_itemSelectionChanged()
@@ -400,22 +406,43 @@ void EditExecutablesDialog::on_list_itemSelectionChanged()
updateUI(selectedItem(), selectedExe());
}
+void EditExecutablesDialog::on_reset_clicked()
+{
+ const auto title = tr("Reset plugin executables");
+
+ const auto text = tr(
+ "This will restore all the executables provided by the game plugin. If "
+ "there are existing executables with the same names, they will be "
+ "automatically renamed and left unchanged.");
+
+ const auto buttons = QMessageBox::Ok | QMessageBox::Cancel;
+
+ if (QMessageBox::question(this, title, text, buttons) != QMessageBox::Ok) {
+ return;
+ }
+
+ m_executablesList.resetFromPlugin(m_organizerCore.managedGame());
+ fillList();
+
+ setDirty(true);
+}
+
void EditExecutablesDialog::on_add_clicked()
{
- auto title = makeNonConflictingTitle(tr("New Executable"));
+ auto title = m_executablesList.makeNonConflictingTitle(tr("New Executable"));
if (!title) {
return;
}
- auto e = Executable()
- .title(*title)
- .flags(Executable::CustomExecutable);
+ const Executable e(*title);
m_executablesList.setExecutable(e);
auto* item = createListItem(e);
ui->list->addItem(item);
item->setSelected(true);
+
+ setDirty(true);
}
void EditExecutablesDialog::on_remove_clicked()
@@ -453,6 +480,8 @@ void EditExecutablesDialog::on_remove_clicked()
} else {
ui->list->item(currentRow)->setSelected(true);
}
+
+ setDirty(true);
}
void EditExecutablesDialog::on_up_clicked()
@@ -563,7 +592,7 @@ void EditExecutablesDialog::on_browseBinary_clicked()
// setting title if currently empty
if (ui->title->text().isEmpty()) {
const auto prefix = QFileInfo(binaryName).baseName();
- const auto newTitle = makeNonConflictingTitle(prefix);
+ const auto newTitle = m_executablesList.makeNonConflictingTitle(prefix);
if (newTitle) {
ui->title->setText(*newTitle);
@@ -607,15 +636,16 @@ void EditExecutablesDialog::on_configureLibraries_clicked()
}
}
-void EditExecutablesDialog::on_buttons_accepted()
+void EditExecutablesDialog::on_buttons_clicked(QAbstractButton* b)
{
- commitChanges();
- accept();
-}
-
-void EditExecutablesDialog::on_buttons_rejected()
-{
- reject();
+ if (b == ui->buttons->button(QDialogButtonBox::Ok)) {
+ commitChanges();
+ accept();
+ } else if (b == ui->buttons->button(QDialogButtonBox::Apply)) {
+ commitChanges();
+ } else {
+ reject();
+ }
}
void EditExecutablesDialog::setJarBinary(const QString& binaryName)
@@ -641,25 +671,6 @@ void EditExecutablesDialog::setJarBinary(const QString& binaryName)
save();
}
-std::optional EditExecutablesDialog::makeNonConflictingTitle(
- const QString& prefix)
-{
- QString title = prefix;
-
- for (int i=1; i<100; ++i) {
- if (!m_executablesList.titleExists(title)) {
- return title;
- }
-
- title = prefix + QString(" (%1)").arg(i);
- }
-
- qCritical().nospace()
- << "ran out of executable titles for prefix '" << prefix << "'";
-
- return {};
-}
-
void CustomOverwrites::load(Profile* p, const ExecutablesList& exes)
{
diff --git a/src/editexecutablesdialog.h b/src/editexecutablesdialog.h
index 10a6166f..4a04ef42 100644
--- a/src/editexecutablesdialog.h
+++ b/src/editexecutablesdialog.h
@@ -110,6 +110,7 @@ public:
private slots:
void on_list_itemSelectionChanged();
+ void on_reset_clicked();
void on_add_clicked();
void on_remove_clicked();
void on_up_clicked();
@@ -124,8 +125,7 @@ private slots:
void on_browseWorkingDirectory_clicked();
void on_configureLibraries_clicked();
- void on_buttons_accepted();
- void on_buttons_rejected();
+ void on_buttons_clicked(QAbstractButton* b);
private:
std::unique_ptr ui;
@@ -140,19 +140,20 @@ private:
QListWidgetItem* selectedItem();
Executable* selectedExe();
- void fillExecutableList();
+ void fillList();
QListWidgetItem* createListItem(const Executable& exe);
void updateUI(const QListWidgetItem* item, const Executable* e);
void clearEdits();
void setEdits(const Executable& e);
void setButtons(const QListWidgetItem* item, const Executable* e);
void save();
+ void saveOrder();
bool canMove(const QListWidgetItem* item, int direction);
void move(QListWidgetItem* item, int direction);
void setJarBinary(const QString& binaryName);
- std::optional makeNonConflictingTitle(const QString& prefix);
bool isTitleConflicting(const QString& s);
void commitChanges();
+ void setDirty(bool b);
};
#endif // EDITEXECUTABLESDIALOG_H
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index 9b6c8153..a42dbeed 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -168,6 +168,26 @@
+ -
+
+
+ Adds the executables provided by the game plugin and moves any existing executables out of the way
+
+
+ Adds the executables provided by the game plugin and moves any existing executables out of the way
+
+
+ Adds the executables provided by the game plugin and moves any existing executables out of the way
+
+
+ Reset
+
+
+
+ :/MO/gui/edit_clear:/MO/gui/edit_clear
+
+
+
-
@@ -425,21 +445,6 @@ Right now the only case I know of where this needs to be overwritten is for the
- -
-
-
-
- true
-
-
-
- This executable is provided by the game plugin
-
-
- Qt::AlignCenter
-
-
-
-
@@ -463,7 +468,7 @@ Right now the only case I know of where this needs to be overwritten is for the
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+ QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok
diff --git a/src/executableslist.cpp b/src/executableslist.cpp
index 0283a845..daf200a6 100644
--- a/src/executableslist.cpp
+++ b/src/executableslist.cpp
@@ -74,8 +74,6 @@ void ExecutablesList::load(const MOBase::IPluginGame* game, QSettings& settings)
settings.setArrayIndex(i);
Executable::Flags flags;
- if (settings.value("custom", true).toBool())
- flags |= Executable::CustomExecutable;
if (settings.value("toolbar", false).toBool())
flags |= Executable::ShowInToolbar;
if (settings.value("ownicon", false).toBool())
@@ -92,7 +90,7 @@ void ExecutablesList::load(const MOBase::IPluginGame* game, QSettings& settings)
settings.endArray();
- addFromPlugin(game);
+ addFromPlugin(game, IgnoreExisting);
}
void ExecutablesList::store(QSettings& settings)
@@ -106,29 +104,33 @@ void ExecutablesList::store(QSettings& settings)
settings.setArrayIndex(count++);
settings.setValue("title", item.title());
- settings.setValue("custom", item.isCustom());
settings.setValue("toolbar", item.isShownOnToolbar());
settings.setValue("ownicon", item.usesOwnIcon());
-
- if (item.isCustom()) {
- settings.setValue("binary", item.binaryInfo().absoluteFilePath());
- settings.setValue("arguments", item.arguments());
- settings.setValue("workingDirectory", item.workingDirectory());
- settings.setValue("steamAppID", item.steamAppID());
- }
+ settings.setValue("binary", item.binaryInfo().absoluteFilePath());
+ settings.setValue("arguments", item.arguments());
+ settings.setValue("workingDirectory", item.workingDirectory());
+ settings.setValue("steamAppID", item.steamAppID());
}
settings.endArray();
}
-void ExecutablesList::addFromPlugin(IPluginGame const *game)
+void ExecutablesList::resetFromPlugin(MOBase::IPluginGame const *game)
+{
+ qDebug("resetting plugin executables");
+ addFromPlugin(game, MoveExisting);
+}
+
+void ExecutablesList::addFromPlugin(IPluginGame const *game, SetFlags flags)
{
Q_ASSERT(game != nullptr);
for (const ExecutableInfo &info : game->executables()) {
- if (info.isValid()) {
- setExecutable({info, Executable::UseApplicationIcon});
+ if (!info.isValid()) {
+ continue;
}
+
+ setExecutable({info, Executable::UseApplicationIcon}, flags);
}
const QFileInfo eppBin(QCoreApplication::applicationDirPath() + "/explorer++/Explorer++.exe");
@@ -137,12 +139,14 @@ void ExecutablesList::addFromPlugin(IPluginGame const *game)
const auto args = QString("\"%1\"")
.arg(QDir::toNativeSeparators(game->dataDirectory().absolutePath()));
- setExecutable(Executable()
+ const auto exe = Executable()
.title("Explore Virtual Folder")
.binaryInfo(eppBin)
.arguments(args)
.workingDirectory(eppBin.absolutePath())
- .flags(Executable::UseApplicationIcon));
+ .flags(Executable::UseApplicationIcon);
+
+ setExecutable(exe, flags);
}
}
@@ -188,28 +192,81 @@ bool ExecutablesList::titleExists(const QString &title) const
return std::find_if(m_Executables.begin(), m_Executables.end(), test) != m_Executables.end();
}
-void ExecutablesList::setExecutable(const Executable &executable)
+void ExecutablesList::setExecutable(const Executable &exe)
+{
+ setExecutable(exe, MergeExisting);
+}
+
+void ExecutablesList::setExecutable(const Executable &exe, SetFlags flags)
{
- auto itor = find(executable.title());
+ auto itor = find(exe.title());
+
+ if (itor != end()) {
+ if (flags == IgnoreExisting) {
+ return;
+ }
+
+ if (flags == MoveExisting) {
+ const auto newTitle = makeNonConflictingTitle(exe.title());
+ if (!newTitle) {
+ qCritical().nospace()
+ << "executable '" << exe.title() << "' was in the way but could "
+ << "not be renamed";
+
+ return;
+ }
+
+ qWarning().nospace()
+ << "executable '" << itor->title() << "' was in the way and was "
+ << "renamed to '" << *newTitle << "'";
+
+ itor->title(*newTitle);
+ itor = end();
+ }
+ }
if (itor == m_Executables.end()) {
- m_Executables.push_back(executable);
+ m_Executables.push_back(exe);
} else {
- itor->mergeFrom(executable);
+ itor->mergeFrom(exe);
}
}
void ExecutablesList::remove(const QString &title)
{
- for (std::vector::iterator iter = m_Executables.begin(); iter != m_Executables.end(); ++iter) {
- if (iter->isCustom() && (iter->title() == title)) {
- m_Executables.erase(iter);
- break;
+ auto itor = find(title);
+ if (itor != m_Executables.end()) {
+ m_Executables.erase(itor);
+ }
+}
+
+std::optional ExecutablesList::makeNonConflictingTitle(
+ const QString& prefix)
+{
+ const int max = 100;
+
+ QString title = prefix;
+
+ for (int i=1; i.
#include "executableinfo.h"
#include
+#include
#include
#include
@@ -37,14 +38,13 @@ class Executable
public:
enum Flag
{
- CustomExecutable = 0x01,
ShowInToolbar = 0x02,
UseApplicationIcon = 0x04
};
Q_DECLARE_FLAGS(Flags, Flag);
- Executable() = default;
+ Executable(QString title={});
/**
* @brief Executable from plugin
@@ -65,7 +65,6 @@ public:
Executable& workingDirectory(const QString& s);
Executable& flags(Flags f);
- bool isCustom() const;
bool isShownOnToolbar() const;
void setShownOnToolbar(bool state);
bool usesOwnIcon() const;
@@ -106,6 +105,8 @@ public:
*/
void load(const MOBase::IPluginGame* game, QSettings& settings);
+ void resetFromPlugin(MOBase::IPluginGame const *game);
+
/**
* @brief writes the current list to the settings
*/
@@ -166,13 +167,28 @@ public:
**/
void remove(const QString &title);
+ std::optional makeNonConflictingTitle(const QString& prefix);
+
private:
+ enum SetFlags
+ {
+ IgnoreExisting = 1,
+ MergeExisting,
+ MoveExisting
+ };
+
std::vector m_Executables;
/**
* @brief add the executables preconfigured for this game
**/
- void addFromPlugin(MOBase::IPluginGame const *game);
+ void addFromPlugin(MOBase::IPluginGame const *game, SetFlags flags);
+
+ /**
+ * @brief add a new executable to the list
+ * @param executable
+ */
+ void setExecutable(const Executable &exe, SetFlags flags);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Executable::Flags)
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 15a6eb62..b5e9c320 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -5513,8 +5513,7 @@ void MainWindow::addAsExecutable()
.title(name)
.binaryInfo(binaryInfo)
.arguments(arguments)
- .workingDirectory(targetInfo.absolutePath())
- .flags(Executable::CustomExecutable));
+ .workingDirectory(targetInfo.absolutePath()));
refreshExecutablesList();
}
diff --git a/src/pch.h b/src/pch.h
index e86c0da6..1d8df43a 100644
--- a/src/pch.h
+++ b/src/pch.h
@@ -13,6 +13,7 @@
#include
#include