diff options
| author | Thomas Tanner <trtanner@btinternet.com> | 2016-06-25 11:47:15 +0100 |
|---|---|---|
| committer | Thomas Tanner <trtanner@btinternet.com> | 2016-06-25 11:47:15 +0100 |
| commit | c7101be7d8a077eba563a6fd6f15ec8169eeca51 (patch) | |
| tree | 7aec5619a3a6f953b2dd114b9590737facd42616 /src/mainwindow.cpp | |
| parent | d80a77a4cba35e9be01f57ac2c1b3cea3a00e516 (diff) | |
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)
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
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();
|
