diff options
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ee7ee139..1f1d5f95 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -100,6 +100,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QNetworkProxy> #include <QtConcurrentRun> #include <QCoreApplication> +#include <scopeguard.h> #ifdef TEST_MODELS @@ -1289,10 +1290,11 @@ HANDLE MainWindow::spawnBinaryDirect(const QFileInfo &binary, const QString &arg } while (m_RefreshProgress->isVisible()) { - ::Sleep(1000); + ::Sleep(100); QCoreApplication::processEvents(); } + // TODO: should also pass arguments if (m_AboutToRun(binary.absoluteFilePath())) { return startBinary(binary, arguments, profileName, m_Settings.logLevel(), currentDirectory, true); } else { @@ -1323,10 +1325,15 @@ void MainWindow::spawnProgram(const QString &fileName, const QString &argumentsA } */ + void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments, const QDir ¤tDirectory, bool closeAfterStart, const QString &steamAppID) { storeSettings(); + LockedDialog *dialog = new LockedDialog(this); + dialog->show(); + ON_BLOCK_EXIT([&] () { dialog->hide(); dialog->deleteLater(); }); + HANDLE processHandle = spawnBinaryDirect(binary, arguments, m_CurrentProfile->getName(), currentDirectory, steamAppID); if (processHandle != INVALID_HANDLE_VALUE) { if (closeAfterStart) { @@ -1334,12 +1341,9 @@ void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments, } else { this->setEnabled(false); - LockedDialog *dialog = new LockedDialog(this); - dialog->show(); - QCoreApplication::processEvents(); - while ((::WaitForSingleObject(processHandle, 1000) == WAIT_TIMEOUT) && + while ((::WaitForSingleObject(processHandle, 100) == WAIT_TIMEOUT) && !dialog->unlockClicked()) { // keep processing events so the app doesn't appear dead QCoreApplication::processEvents(); @@ -1350,8 +1354,6 @@ void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments, if (GameInfo::instance().getLoadOrderMechanism() == GameInfo::TYPE_FILETIME) { QFile::remove(m_CurrentProfile->getLoadOrderFileName()); } - dialog->hide(); - dialog->deleteLater(); } } } @@ -2205,7 +2207,7 @@ std::vector<unsigned int> MainWindow::activeProblems() const if (m_UnloadedPlugins.size() != 0) { problems.push_back(PROBLEM_PLUGINSNOTLOADED); } - if (m_PluginList.enabledCount() > 256) { + if (m_PluginList.enabledCount() > 255) { problems.push_back(PROBLEM_TOOMANYPLUGINS); } return problems; @@ -2238,7 +2240,7 @@ QString MainWindow::fullDescription(unsigned int key) const return result; } break; case PROBLEM_TOOMANYPLUGINS: { - return tr("The game doesn't allow more than 256 active plugins (including the official ones) to be loaded. You have to disable some unused plugins or " + return tr("The game doesn't allow more than 255 active plugins (including the official ones) to be loaded. You have to disable some unused plugins or " "merge some plugins into one. You can find a guide here: <a href=\"http://wiki.step-project.com/Guide:Merging_Plugins\">http://wiki.step-project.com/Guide:Merging_Plugins</a>"); } break; default: { |
