From c7101be7d8a077eba563a6fd6f15ec8169eeca51 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 25 Jun 2016 11:47:15 +0100 Subject: Some refactoring of the spawn code and to make waitForApplication get the right error code (usually) A note: It is possible for the executed program to completely exit before MO attempts to get hold of the pid from the job handle, in which case strangeness will happen (this has always been an issue) --- src/mainwindow.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 096ce94b..702e661d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1608,18 +1608,31 @@ void MainWindow::storeSettings(QSettings &settings) void MainWindow::lock() { + if (m_LockDialog != nullptr) { + ++m_LockCount; + return; + } m_LockDialog = new LockedDialog(qApp->activeWindow()); m_LockDialog->show(); setEnabled(false); + m_LockDialog->setEnabled(true); //What's the point otherwise? + ++m_LockCount; } void MainWindow::unlock() { - if (m_LockDialog != nullptr) { + //If you come through here with a null lock pointer, it's a bug! + if (m_LockDialog == nullptr) { + qDebug("Unlocking main window when already unlocked"); + return; + } + --m_LockCount; + if (m_LockCount == 0) { m_LockDialog->hide(); m_LockDialog->deleteLater(); + m_LockDialog = nullptr; + setEnabled(true); } - setEnabled(true); } bool MainWindow::unlockClicked() @@ -1631,6 +1644,13 @@ bool MainWindow::unlockClicked() } } +void MainWindow::setProcessName(QString const &name) +{ + if (m_LockDialog != nullptr) { + m_LockDialog->setProcessName(name); + } +} + void MainWindow::on_btnRefreshData_clicked() { m_OrganizerCore.refreshDirectoryStructure(); -- cgit v1.3.1 From 42407866e9f04cac3c1bad0e1002e23c6f0d5064 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Mon, 27 Jun 2016 21:21:54 +0100 Subject: Some include-what-you-use suggested changes --- src/mainwindow.cpp | 1 + src/pluginlist.cpp | 1 + src/settings.cpp | 27 +++++++++++++++++++++++---- src/settings.h | 24 +++++++++++++++++++----- 4 files changed, 44 insertions(+), 9 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 702e661d..72ee8d6a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -34,6 +34,7 @@ along with Mod Organizer. If not, see . #include "organizercore.h" #include "pluginlistsortproxy.h" #include "previewgenerator.h" +#include "serverinfo.h" #include "savegameinfo.h" #include "spawn.h" #include "versioninfo.h" diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index bf5a09dc..96757ec6 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -33,6 +33,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include #include #include #include diff --git a/src/settings.cpp b/src/settings.cpp index 6e82b3ca..03e13826 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -19,23 +19,42 @@ along with Mod Organizer. If not, see . #include "settings.h" +#include "pluginsetting.h" +#include "serverinfo.h" #include "settingsdialog.h" -#include "utility.h" -#include "helper.h" -#include +#include "versioninfo.h" +#include "appconfig.h" #include +#include #include #include #include #include -#include +#include +#include +#include +#include #include +#include #include +#include +#include #include #include +#include +#include +#include // for Qt::UserRole, etc +#include // for qDebug, qWarning + +#include // For ShellExecuteW, HINSTANCE, etc + +#include // for sort #include +#include // for runtime_error +#include +#include // for pair, make_pair using namespace MOBase; diff --git a/src/settings.h b/src/settings.h index 1ee16e76..9f6adaa7 100644 --- a/src/settings.h +++ b/src/settings.h @@ -21,20 +21,34 @@ along with Mod Organizer. If not, see . #define WORKAROUNDS_H #include "loadmechanism.h" -#include "serverinfo.h" -#include +#include +#include +#include +#include #include -#include -#include +#include +#include +#include //for uint + +#include +#include + +class QCheckBox; +class QComboBox; +class QLineEdit; +class QListWidget; +class QWidget; + +struct ServerInfo; namespace MOBase { + class IPlugin; class IPluginGame; } class SettingsDialog; -class QCheckBox; /** * manages the settings for Mod Organizer. The settings are not cached -- cgit v1.3.1