From 347ac2b8b5f34a2583ae7844e0dfd79773657270 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Fri, 11 Jan 2019 01:39:05 -0600 Subject: Support for force loading libraries --- src/forcedloaddialogwidget.ui | 104 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/forcedloaddialogwidget.ui (limited to 'src/forcedloaddialogwidget.ui') diff --git a/src/forcedloaddialogwidget.ui b/src/forcedloaddialogwidget.ui new file mode 100644 index 00000000..4df78beb --- /dev/null +++ b/src/forcedloaddialogwidget.ui @@ -0,0 +1,104 @@ + + + ForcedLoadDialogWidget + + + + 0 + 0 + 400 + 41 + + + + + 0 + 0 + + + + Form + + + + + + + + + + + + + The name of the process that should be forced to load a library. + + + The name of the process that should be forced to load a library. + + + Process name + + + + + + + + 0 + 0 + + + + + 32 + 0 + + + + + 32 + 16777215 + + + + Browse for a process. + + + Browse for a process. + + + ... + + + + + + + Library to load + + + + + + + + 32 + 16777215 + + + + Browse for a library. + + + Browse for a library. + + + ... + + + + + + + + -- cgit v1.3.1 From 96b6677ed9d3b647e30bb40d7bb820f1894edbca Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Fri, 11 Jan 2019 03:14:41 -0600 Subject: Fixes to library load widget --- src/editexecutablesdialog.cpp | 5 +++-- src/editexecutablesdialog.h | 4 ++++ src/forcedloaddialog.cpp | 9 +++++---- src/forcedloaddialog.h | 4 +++- src/forcedloaddialogwidget.cpp | 33 +++++++++++++++++++++++++++------ src/forcedloaddialogwidget.h | 5 ++++- src/forcedloaddialogwidget.ui | 12 ++++++++++++ src/mainwindow.cpp | 3 ++- 8 files changed, 60 insertions(+), 15 deletions(-) (limited to 'src/forcedloaddialogwidget.ui') diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp index 212993f1..4b1cdb5d 100644 --- a/src/editexecutablesdialog.cpp +++ b/src/editexecutablesdialog.cpp @@ -33,12 +33,13 @@ using namespace MOShared; EditExecutablesDialog::EditExecutablesDialog( const ExecutablesList &executablesList, const ModList &modList, - Profile *profile, QWidget *parent) + Profile *profile, const IPluginGame *game, QWidget *parent) : TutorableDialog("EditExecutables", parent) , ui(new Ui::EditExecutablesDialog) , m_CurrentItem(nullptr) , m_ExecutablesList(executablesList) , m_Profile(profile) + , m_GamePlugin(game) { ui->setupUi(this); @@ -139,7 +140,7 @@ void EditExecutablesDialog::delayedRefresh() void EditExecutablesDialog::on_forceLoadButton_clicked() { - ForcedLoadDialog dialog(this); + ForcedLoadDialog dialog(m_GamePlugin, this); dialog.setValues(m_ForcedLibraries); if (dialog.exec() == QDialog::Accepted) { m_ForcedLibraries = dialog.values(); diff --git a/src/editexecutablesdialog.h b/src/editexecutablesdialog.h index 82e63e15..0169b8ca 100644 --- a/src/editexecutablesdialog.h +++ b/src/editexecutablesdialog.h @@ -25,6 +25,7 @@ along with Mod Organizer. If not, see . #include #include "executableslist.h" #include "profile.h" +#include "iplugingame.h" namespace Ui { class EditExecutablesDialog; @@ -52,6 +53,7 @@ public: explicit EditExecutablesDialog(const ExecutablesList &executablesList, const ModList &modList, Profile *profile, + const MOBase::IPluginGame *game, QWidget *parent = 0); ~EditExecutablesDialog(); @@ -114,6 +116,8 @@ private: Profile *m_Profile; QList m_ForcedLibraries; + + const MOBase::IPluginGame *m_GamePlugin; }; #endif // EDITEXECUTABLESDIALOG_H diff --git a/src/forcedloaddialog.cpp b/src/forcedloaddialog.cpp index ad30a58c..ab0bd583 100644 --- a/src/forcedloaddialog.cpp +++ b/src/forcedloaddialog.cpp @@ -8,9 +8,10 @@ using namespace MOBase; -ForcedLoadDialog::ForcedLoadDialog(QWidget *parent) : +ForcedLoadDialog::ForcedLoadDialog(const IPluginGame *game, QWidget *parent) : QDialog(parent), - ui(new Ui::ForcedLoadDialog) + ui(new Ui::ForcedLoadDialog), + m_GamePlugin(game) { ui->setupUi(this); } @@ -25,7 +26,7 @@ void ForcedLoadDialog::setValues(QList &val ui->tableWidget->clearContents(); for (int i = 0; i < values.count(); i++) { - ForcedLoadDialogWidget *item = new ForcedLoadDialogWidget(this); + ForcedLoadDialogWidget *item = new ForcedLoadDialogWidget(m_GamePlugin, this); item->setEnabled(values[i].enabled()); item->setProcess(values[i].process()); item->setLibraryPath(values[i].library()); @@ -59,7 +60,7 @@ void ForcedLoadDialog::on_addRowButton_clicked() { int row = ui->tableWidget->rowCount(); ui->tableWidget->insertRow(row); - ForcedLoadDialogWidget *item = new ForcedLoadDialogWidget(this); + ForcedLoadDialogWidget *item = new ForcedLoadDialogWidget(m_GamePlugin, this); ui->tableWidget->setCellWidget(row, 0, item); ui->tableWidget->resizeRowsToContents(); } diff --git a/src/forcedloaddialog.h b/src/forcedloaddialog.h index 68460d91..6a88bccf 100644 --- a/src/forcedloaddialog.h +++ b/src/forcedloaddialog.h @@ -5,6 +5,7 @@ #include #include "executableinfo.h" +#include "iplugingame.h" namespace Ui { class ForcedLoadDialog; @@ -15,7 +16,7 @@ class ForcedLoadDialog : public QDialog Q_OBJECT public: - explicit ForcedLoadDialog(QWidget *parent = nullptr); + explicit ForcedLoadDialog(const MOBase::IPluginGame *game, QWidget *parent = nullptr); ~ForcedLoadDialog(); void setValues(QList &values); @@ -27,6 +28,7 @@ private slots: private: Ui::ForcedLoadDialog *ui; + const MOBase::IPluginGame *m_GamePlugin; }; #endif // FORCEDLOADDIALOG_H diff --git a/src/forcedloaddialogwidget.cpp b/src/forcedloaddialogwidget.cpp index 61805068..10069c35 100644 --- a/src/forcedloaddialogwidget.cpp +++ b/src/forcedloaddialogwidget.cpp @@ -5,9 +5,12 @@ #include "executableinfo.h" -ForcedLoadDialogWidget::ForcedLoadDialogWidget(QWidget *parent) : +using namespace MOBase; + +ForcedLoadDialogWidget::ForcedLoadDialogWidget(const IPluginGame *game, QWidget *parent) : QWidget(parent), - ui(new Ui::ForcedLoadDialogWidget) + ui(new Ui::ForcedLoadDialogWidget), + m_GamePlugin(game) { ui->setupUi(this); } @@ -68,20 +71,38 @@ void ForcedLoadDialogWidget::on_enabledBox_toggled() void ForcedLoadDialogWidget::on_libraryPathBrowseButton_clicked() { - QDir gameDir("D:/Games/Steam Library/steamapps/common/Fallout 4"); + QDir gameDir(m_GamePlugin->gameDirectory()); QString startPath = gameDir.absolutePath(); QString result = QFileDialog::getOpenFileName(nullptr, "Select a library...", startPath, "Dynamic link library (*.dll)", nullptr, QFileDialog::ReadOnly); if (!result.isEmpty()) { - ui->libraryPathEdit->setText(result); + QFileInfo fileInfo(result); + QString relativePath = gameDir.relativeFilePath(fileInfo.filePath()); + QString filePath = fileInfo.filePath(); + if (!relativePath.startsWith("..")) { + filePath = relativePath; + } + + if (fileInfo.exists()) { + ui->libraryPathEdit->setText(filePath); + } else { + qCritical("%ls does not exist", filePath.toStdWString().c_str()); + } } } void ForcedLoadDialogWidget::on_processBrowseButton_clicked() { - QDir gameDir("D:/Games/Steam Library/steamapps/common/Fallout 4"); + QDir gameDir(m_GamePlugin->gameDirectory()); QString startPath = gameDir.absolutePath(); QString result = QFileDialog::getOpenFileName(nullptr, "Select a process...", startPath, "Executable (*.exe)", nullptr, QFileDialog::ReadOnly); if (!result.isEmpty()) { - ui->processEdit->setText(QFile(result).fileName()); + QFileInfo fileInfo(result); + QString fileName = fileInfo.fileName(); + + if (fileInfo.exists()) { + ui->processEdit->setText(fileName); + } else { + qCritical("%ls does not exist", fileInfo.filePath().toStdWString().c_str()); + } } } diff --git a/src/forcedloaddialogwidget.h b/src/forcedloaddialogwidget.h index 06ad0009..eb7c3f4d 100644 --- a/src/forcedloaddialogwidget.h +++ b/src/forcedloaddialogwidget.h @@ -2,6 +2,7 @@ #define FORCEDLOADDIALOGWIDGET_H #include +#include "iplugingame.h" namespace Ui { class ForcedLoadDialogWidget; @@ -12,7 +13,7 @@ class ForcedLoadDialogWidget : public QWidget Q_OBJECT public: - explicit ForcedLoadDialogWidget(QWidget *parent = nullptr); + explicit ForcedLoadDialogWidget(const MOBase::IPluginGame *game, QWidget *parent = nullptr); ~ForcedLoadDialogWidget(); bool getEnabled(); @@ -33,6 +34,8 @@ private slots: private: Ui::ForcedLoadDialogWidget *ui; bool m_Forced; + const MOBase::IPluginGame *m_GamePlugin; + }; #endif // FORCEDLOADDIALOGWIDGET_H diff --git a/src/forcedloaddialogwidget.ui b/src/forcedloaddialogwidget.ui index 4df78beb..d4766489 100644 --- a/src/forcedloaddialogwidget.ui +++ b/src/forcedloaddialogwidget.ui @@ -22,6 +22,12 @@ + + If checked, the specified library will be force loaded for the specified process. + + + If checked, the specified library will be force loaded for the specified process. + @@ -73,6 +79,12 @@ + + The path to the library to be loaded. This may be a path relative to the managed game's directory or may be an absolute path to somewhere else. + + + The path to the library to be loaded. This may be a path relative to the managed game's directory or may be an absolute path to somewhere else. + Library to load diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0ebad6ae..144d2371 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2069,7 +2069,8 @@ bool MainWindow::modifyExecutablesDialog() try { EditExecutablesDialog dialog(*m_OrganizerCore.executablesList(), *m_OrganizerCore.modList(), - m_OrganizerCore.currentProfile()); + m_OrganizerCore.currentProfile(), + m_OrganizerCore.managedGame()); QSettings &settings = m_OrganizerCore.settings().directInterface(); QString key = QString("geometry/%1").arg(dialog.objectName()); if (settings.contains(key)) { -- cgit v1.3.1 From b41c99b742bbb9eee854f177a26da3218f24f2ac Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Fri, 11 Jan 2019 10:29:47 -0600 Subject: Remove window title of widget --- src/forcedloaddialogwidget.ui | 3 --- src/organizer_en.ts | 23 +++++++++-------------- 2 files changed, 9 insertions(+), 17 deletions(-) (limited to 'src/forcedloaddialogwidget.ui') diff --git a/src/forcedloaddialogwidget.ui b/src/forcedloaddialogwidget.ui index d4766489..4be215eb 100644 --- a/src/forcedloaddialogwidget.ui +++ b/src/forcedloaddialogwidget.ui @@ -16,9 +16,6 @@ 0 - - Form - diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 5eef32ba..91faa4d0 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -1169,53 +1169,48 @@ Right now the only case I know of where this needs to be overwritten is for the ForcedLoadDialogWidget - - Form - - - + - If checked, the specified library will be force loaded for the specified process. + - The name of the process that should be forced to load a library. - + Process name + - Browse for a process. - - + + ... + - The path to the library to be loaded. This may be a path relative to the managed game's directory or may be an absolute path to somewhere else. - + Library to load + - Browse for a library. -- cgit v1.3.1