summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-10-30 23:42:59 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-11-06 07:44:57 -0500
commitdb0b92776b5c9a34ebb1a5ce5c3f0b105844ee16 (patch)
tree4024b434840a21d37cac3c43f229fb2c3ce5a91a /src/mainwindow.cpp
parent2aa70de49e89245467299d94d76825bad31c63a2 (diff)
added lockwidget to replace all the other dialogs
rewrote ProcessRunner to have a bunch of setters and then a run() fixed bad exit code when waiting on a process that's already completed removed lock()/unlock() from main window, ProcessRunner is in charge of that now
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp44
1 files changed, 4 insertions, 40 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index ce5280a6..7d3d20b3 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -57,7 +57,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "downloadlistwidget.h"
#include "messagedialog.h"
#include "installationmanager.h"
-#include "lockeddialog.h"
#include "waitingonclosedialog.h"
#include "downloadlistsortproxy.h"
#include "motddialog.h"
@@ -1311,9 +1310,10 @@ bool MainWindow::canExit()
}
}
- m_exitAfterWait = true;
- m_OrganizerCore.processRunner().waitForAllUSVFSProcessesWithLock();
- if (!m_exitAfterWait) { // if operation cancelled
+ const auto r = m_OrganizerCore.processRunner()
+ .waitForAllUSVFSProcessesWithLock(LockWidget::PreventExit);
+
+ if (r == ProcessRunner::Cancelled) {
return false;
}
@@ -2258,42 +2258,6 @@ void MainWindow::storeSettings()
s.widgets().saveIndex(ui->executablesListBox);
}
-ILockedWaitingForProcess* MainWindow::lock()
-{
- if (m_LockDialog != nullptr) {
- ++m_LockCount;
- return m_LockDialog;
- }
- if (m_exitAfterWait)
- m_LockDialog = new WaitingOnCloseDialog(this);
- else
- m_LockDialog = new LockedDialog(this, true);
- m_LockDialog->setModal(true);
- m_LockDialog->show();
- setEnabled(false);
- m_LockDialog->setEnabled(true); //What's the point otherwise?
- ++m_LockCount;
- return m_LockDialog;
-}
-
-void MainWindow::unlock()
-{
- //If you come through here with a null lock pointer, it's a bug!
- if (m_LockDialog == nullptr) {
- log::debug("Unlocking main window when already unlocked");
- return;
- }
- --m_LockCount;
- if (m_LockCount == 0) {
- if (m_exitAfterWait && m_LockDialog->canceled())
- m_exitAfterWait = false;
- m_LockDialog->hide();
- m_LockDialog->deleteLater();
- m_LockDialog = nullptr;
- setEnabled(true);
- }
-}
-
QWidget* MainWindow::qtWidget()
{
return this;