From 8c72077febaea485200adcf1e9f615902e930def Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Tue, 29 Oct 2019 10:03:59 -0400
Subject: replaced uilock by a progress callback in spawn waiting for process
now gets the whole process tree to find an interesting process
---
src/lockeddialogbase.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
(limited to 'src/lockeddialogbase.cpp')
diff --git a/src/lockeddialogbase.cpp b/src/lockeddialogbase.cpp
index b18f7429..0876a511 100644
--- a/src/lockeddialogbase.cpp
+++ b/src/lockeddialogbase.cpp
@@ -18,7 +18,7 @@ along with Mod Organizer. If not, see .
*/
#include "lockeddialogbase.h"
-
+#include "envmodule.h"
#include
#include
#include
@@ -63,6 +63,11 @@ bool LockedDialogBase::canceled() const {
return m_Canceled;
}
+void LockedDialogBase::setProcessInformation(DWORD pid, const QString& name)
+{
+ setProcessName(QString("%1 (%2)").arg(name).arg(pid));
+}
+
void LockedDialogBase::unlock() {
m_Unlocked = true;
}
--
cgit v1.3.1
From 72dd230cdc60e74446caceb5cfb4c6d32e4f6f68 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Thu, 31 Oct 2019 05:58:41 -0400
Subject: removed unused files fixed handle leak when starting steam
---
src/CMakeLists.txt | 17 +-----
src/ilockedwaitingforprocess.h | 14 -----
src/iuserinterface.h | 1 -
src/lockeddialog.cpp | 71 ------------------------
src/lockeddialog.h | 57 --------------------
src/lockeddialog.ui | 98 ---------------------------------
src/lockeddialogbase.cpp | 78 ---------------------------
src/lockeddialogbase.h | 64 ----------------------
src/mainwindow.cpp | 1 -
src/organizercore.cpp | 1 -
src/spawn.cpp | 3 +-
src/spawn.h | 2 -
src/waitingonclosedialog.cpp | 71 ------------------------
src/waitingonclosedialog.h | 56 -------------------
src/waitingonclosedialog.ui | 119 -----------------------------------------
15 files changed, 2 insertions(+), 651 deletions(-)
delete mode 100644 src/ilockedwaitingforprocess.h
delete mode 100644 src/lockeddialog.cpp
delete mode 100644 src/lockeddialog.h
delete mode 100644 src/lockeddialog.ui
delete mode 100644 src/lockeddialogbase.cpp
delete mode 100644 src/lockeddialogbase.h
delete mode 100644 src/waitingonclosedialog.cpp
delete mode 100644 src/waitingonclosedialog.h
delete mode 100644 src/waitingonclosedialog.ui
(limited to 'src/lockeddialogbase.cpp')
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 168b79dc..06f2cd1e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -82,9 +82,6 @@ SET(organizer_SRCS
main.cpp
loghighlighter.cpp
loglist.cpp
- lockeddialogbase.cpp
- lockeddialog.cpp
- waitingonclosedialog.cpp
loadmechanism.cpp
installationmanager.cpp
filedialogmemory.cpp
@@ -206,9 +203,6 @@ SET(organizer_HDRS
mainwindow.h
loghighlighter.h
loglist.h
- lockeddialogbase.h
- lockeddialog.h
- waitingonclosedialog.h
loadmechanism.h
installationmanager.h
filedialogmemory.h
@@ -246,7 +240,6 @@ SET(organizer_HDRS
viewmarkingscrollbar.h
plugincontainer.h
organizercore.h
- ilockedwaitingforprocess.h
iuserinterface.h
instancemanager.h
usvfsconnector.h
@@ -293,8 +286,6 @@ SET(organizer_UIS
modinfodialog.ui
messagedialog.ui
mainwindow.ui
- lockeddialog.ui
- waitingonclosedialog.ui
editexecutablesdialog.ui
credentialsdialog.ui
categoriesdialog.ui
@@ -397,12 +388,6 @@ set(executables
editexecutablesdialog
)
-set(locking
- ilockedwaitingforprocess
- lockeddialog
- lockeddialogbase
-)
-
set(modinfo
modinfo
modinfobackup
@@ -500,7 +485,7 @@ set(widgets
)
set(src_filters
- application core browser dialogs downloads env executables locking modinfo
+ application core browser dialogs downloads env executables modinfo
modinfo\\dialog modlist plugins previews profiles settings settingsdialog
utilities widgets
)
diff --git a/src/ilockedwaitingforprocess.h b/src/ilockedwaitingforprocess.h
deleted file mode 100644
index 4d1e786f..00000000
--- a/src/ilockedwaitingforprocess.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef ILOCKEDWAITINGFORPROCESS_H
-#define ILOCKEDWAITINGFORPROCESS_H
-
-class QString;
-
-class ILockedWaitingForProcess
-{
-public:
- virtual bool unlockForced() const = 0;
- virtual void setProcessName(QString const &) = 0;
- virtual void setProcessInformation(DWORD pid, const QString& name) = 0;
-};
-
-#endif // ILOCKEDWAITINGFORPROCESS_H
diff --git a/src/iuserinterface.h b/src/iuserinterface.h
index e5755f03..99caceb1 100644
--- a/src/iuserinterface.h
+++ b/src/iuserinterface.h
@@ -3,7 +3,6 @@
#include "modinfodialogfwd.h"
-#include "ilockedwaitingforprocess.h"
#include "lockwidget.h"
#include
#include
diff --git a/src/lockeddialog.cpp b/src/lockeddialog.cpp
deleted file mode 100644
index 143d5838..00000000
--- a/src/lockeddialog.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-Copyright (C) 2012 Sebastian Herbord. All rights reserved.
-
-This file is part of Mod Organizer.
-
-Mod Organizer is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Mod Organizer is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Mod Organizer. If not, see .
-*/
-
-#include "lockeddialog.h"
-#include "ui_lockeddialog.h"
-
-#include
-#include
-#include
-#include // for Qt::FramelessWindowHint, etc
-
-LockedDialog::LockedDialog(QWidget *parent, bool unlockByButton)
- : LockedDialogBase(parent, !unlockByButton)
- , ui(new Ui::LockedDialog)
-{
- ui->setupUi(this);
-
- // Supposedly the Qt::CustomizeWindowHint should use a customized window
- // allowing us to select if there is a close button. In practice this doesn't
- // seem to work. We will ignore pressing the close button if unlockByButton == true
- Qt::WindowFlags flags =
- this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint;
- if (m_allowClose)
- flags |= Qt::WindowCloseButtonHint;
- this->setWindowFlags(flags);
-
- if (!unlockByButton)
- {
- ui->unlockButton->hide();
- ui->verticalLayout->addItem(
- new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
- }
-}
-
-LockedDialog::~LockedDialog()
-{
- delete ui;
-}
-
-
-void LockedDialog::setProcessName(const QString &name)
-{
- ui->processLabel->setText(name);
-}
-
-void LockedDialog::on_unlockButton_clicked()
-{
- unlock();
-}
-
-void LockedDialog::unlock() {
- LockedDialogBase::unlock();
- ui->label->setText("unlocking may take a few seconds");
- ui->unlockButton->setEnabled(false);
-}
diff --git a/src/lockeddialog.h b/src/lockeddialog.h
deleted file mode 100644
index 36c16429..00000000
--- a/src/lockeddialog.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-Copyright (C) 2012 Sebastian Herbord. All rights reserved.
-
-This file is part of Mod Organizer.
-
-Mod Organizer is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Mod Organizer is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Mod Organizer. If not, see .
-*/
-
-#pragma once
-
-#include "lockeddialogbase.h"
-
-namespace Ui {
- class LockedDialog;
-}
-
-/**
- * a small borderless dialog displayed while the Mod Organizer UI is locked
- * The dialog contains only a label and a button to force the UI to be unlocked
- *
- * The UI gets locked while running external applications since they may modify the
- * data on which Mod Organizer works. After the UI is unlocked (manually or after the
- * external application closed) MO will refresh all of its data sources
- **/
-class LockedDialog : public LockedDialogBase
-{
- Q_OBJECT
-
-public:
- explicit LockedDialog(QWidget *parent = 0, bool unlockByButton = false);
- ~LockedDialog();
-
- void setProcessName(const QString &name) override;
-
-protected:
-
- void unlock() override;
-
-private slots:
-
- void on_unlockButton_clicked();
-
-private:
-
- Ui::LockedDialog *ui;
-};
diff --git a/src/lockeddialog.ui b/src/lockeddialog.ui
deleted file mode 100644
index 0ec2e467..00000000
--- a/src/lockeddialog.ui
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
- LockedDialog
-
-
-
- 0
- 0
- 317
- 151
-
-
-
- Running virtualized processes
-
-
- -
-
-
- This dialog should disappear automatically if the application/game is done. Click unlock if it didn't.
-
-
- MO is locked while the executable is running.
-
-
- Qt::AlignCenter
-
-
- true
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 10
-
-
-
-
- -
-
-
-
- true
-
-
-
- color: grey;
-
-
-
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 10
-
-
-
-
- -
-
-
- Unlock
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 10
-
-
-
-
-
-
-
-
-
diff --git a/src/lockeddialogbase.cpp b/src/lockeddialogbase.cpp
deleted file mode 100644
index 0876a511..00000000
--- a/src/lockeddialogbase.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-Copyright (C) 2012 Sebastian Herbord. All rights reserved.
-
-This file is part of Mod Organizer.
-
-Mod Organizer is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Mod Organizer is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Mod Organizer. If not, see .
-*/
-
-#include "lockeddialogbase.h"
-#include "envmodule.h"
-#include
-#include
-#include
-#include // for Qt::FramelessWindowHint, etc
-
-LockedDialogBase::LockedDialogBase(QWidget *parent, bool allowClose)
- : QDialog(parent)
- , m_Unlocked(false)
- , m_Canceled(false)
- , m_allowClose(allowClose)
-{
- if (parent != nullptr) {
- QPoint position = parent->mapToGlobal(QPoint(parent->width() / 2, parent->height() / 2));
- position.rx() -= this->width() / 2;
- position.ry() -= this->height() / 2;
- move(position);
- }
-}
-
-void LockedDialogBase::resizeEvent(QResizeEvent *event)
-{
- QWidget *par = parentWidget();
- if (par != nullptr) {
- QPoint position = par->mapToGlobal(QPoint(par->width() / 2, par->height() / 2));
- position.rx() -= event->size().width() / 2;
- position.ry() -= event->size().height() / 2;
- move(position);
- }
-}
-
-void LockedDialogBase::reject()
-{
- if (m_allowClose)
- unlock();
-}
-
-bool LockedDialogBase::unlockForced() const {
- return m_Unlocked;
-}
-
-bool LockedDialogBase::canceled() const {
- return m_Canceled;
-}
-
-void LockedDialogBase::setProcessInformation(DWORD pid, const QString& name)
-{
- setProcessName(QString("%1 (%2)").arg(name).arg(pid));
-}
-
-void LockedDialogBase::unlock() {
- m_Unlocked = true;
-}
-
-void LockedDialogBase::cancel() {
- m_Canceled = true;
-}
-
diff --git a/src/lockeddialogbase.h b/src/lockeddialogbase.h
deleted file mode 100644
index 4ebad4c7..00000000
--- a/src/lockeddialogbase.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-Copyright (C) 2012 Sebastian Herbord. All rights reserved.
-
-This file is part of Mod Organizer.
-
-Mod Organizer is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Mod Organizer is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Mod Organizer. If not, see .
-*/
-
-#pragma once
-
-#include "ilockedwaitingforprocess.h"
-#include // for QDialog
-#include // for Q_OBJECT, slots
-#include // for QString
-
-class QResizeEvent;
-class QWidget;
-
-/**
- * a small borderless dialog displayed while the Mod Organizer UI is locked
- * The dialog contains only a label and a button to force the UI to be unlocked
- *
- * The UI gets locked while running external applications since they may modify the
- * data on which Mod Organizer works. After the UI is unlocked (manually or after the
- * external application closed) MO will refresh all of its data sources
- **/
-class LockedDialogBase : public QDialog, public ILockedWaitingForProcess
-{
- Q_OBJECT
-
-public:
- explicit LockedDialogBase(QWidget *parent, bool allowClose);
-
- bool unlockForced() const override;
-
- virtual bool canceled() const;
-
- void setProcessInformation(DWORD pid, const QString& name) override;
-
-protected:
-
- virtual void resizeEvent(QResizeEvent *event);
-
- virtual void reject();
-
- virtual void unlock();
-
- virtual void cancel();
-
- bool m_Unlocked;
- bool m_Canceled;
- bool m_allowClose;
-};
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 631a31d8..9453f07c 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -57,7 +57,6 @@ along with Mod Organizer. If not, see .
#include "downloadlistwidget.h"
#include "messagedialog.h"
#include "installationmanager.h"
-#include "waitingonclosedialog.h"
#include "downloadlistsortproxy.h"
#include "motddialog.h"
#include "filedialogmemory.h"
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index 3c535868..dda60f76 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -29,7 +29,6 @@
#include "appconfig.h"
#include
#include
-#include "lockeddialog.h"
#include "instancemanager.h"
#include
#include "previewdialog.h"
diff --git a/src/spawn.cpp b/src/spawn.cpp
index b331db01..62745542 100644
--- a/src/spawn.cpp
+++ b/src/spawn.cpp
@@ -27,8 +27,6 @@ along with Mod Organizer. If not, see .
#include "envmodule.h"
#include "settings.h"
#include "settingsdialogworkarounds.h"
-#include
-#include
#include
#include
#include
@@ -645,6 +643,7 @@ bool startSteam(QWidget* parent)
HANDLE ph = INVALID_HANDLE_VALUE;
const auto e = spawn(sp, ph);
+ ::CloseHandle(ph);
if (e != ERROR_SUCCESS) {
// make sure username and passwords are not shown
diff --git a/src/spawn.h b/src/spawn.h
index 0464ffd6..9fb346b0 100644
--- a/src/spawn.h
+++ b/src/spawn.h
@@ -28,8 +28,6 @@ along with Mod Organizer. If not, see .
class Settings;
-namespace MOBase { class IPluginGame; }
-
namespace spawn
{
diff --git a/src/waitingonclosedialog.cpp b/src/waitingonclosedialog.cpp
deleted file mode 100644
index 565d0a36..00000000
--- a/src/waitingonclosedialog.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-Copyright (C) 2012 Sebastian Herbord. All rights reserved.
-
-This file is part of Mod Organizer.
-
-Mod Organizer is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Mod Organizer is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Mod Organizer. If not, see .
-*/
-
-#include "waitingonclosedialog.h"
-#include "ui_waitingonclosedialog.h"
-
-#include
-#include
-#include
-#include // for Qt::FramelessWindowHint, etc
-
-WaitingOnCloseDialog::WaitingOnCloseDialog(QWidget *parent)
- : LockedDialogBase(parent,true)
- , ui(new Ui::WaitingOnCloseDialog)
-{
- ui->setupUi(this);
-
- // Supposedly the Qt::CustomizeWindowHint should use a customized window
- // allowing us to select if there is a close button. In practice this doesn't
- // seem to work. We will ignore pressing the close button if unlockByButton == true
- Qt::WindowFlags flags =
- this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint;
- if (m_allowClose)
- flags |= Qt::WindowCloseButtonHint;
- this->setWindowFlags(flags);
-}
-
-WaitingOnCloseDialog::~WaitingOnCloseDialog()
-{
- delete ui;
-}
-
-
-void WaitingOnCloseDialog::setProcessName(const QString &name)
-{
- ui->processLabel->setText(name);
-}
-
-void WaitingOnCloseDialog::on_closeButton_clicked()
-{
- unlock();
-}
-
-void WaitingOnCloseDialog::on_cancelButton_clicked()
-{
- cancel();
- unlock();
-}
-
-void WaitingOnCloseDialog::unlock() {
- LockedDialogBase::unlock();
- ui->label->setText("unlocking may take a few seconds");
- ui->closeButton->setEnabled(false);
- ui->cancelButton->setEnabled(false);
-}
diff --git a/src/waitingonclosedialog.h b/src/waitingonclosedialog.h
deleted file mode 100644
index 6650c390..00000000
--- a/src/waitingonclosedialog.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright (C) 2012 Sebastian Herbord. All rights reserved.
-
-This file is part of Mod Organizer.
-
-Mod Organizer is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Mod Organizer is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Mod Organizer. If not, see .
-*/
-
-#pragma once
-
-#include "lockeddialogbase.h"
-
-namespace Ui {
- class WaitingOnCloseDialog;
-}
-
-/**
- * Similar to the LockedDialog but used for waiting on running process during
- * a process close request which requries a slightly different dialog.
- **/
-class WaitingOnCloseDialog : public LockedDialogBase
-{
- Q_OBJECT
-
-public:
- explicit WaitingOnCloseDialog(QWidget *parent = 0);
- ~WaitingOnCloseDialog();
-
- bool canceled() const { return m_Canceled; }
-
- void setProcessName(const QString &name) override;
-
-protected:
-
- void unlock() override;
-
-private slots:
-
- void on_closeButton_clicked();
- void on_cancelButton_clicked();
-
-private:
-
- Ui::WaitingOnCloseDialog *ui;
-};
diff --git a/src/waitingonclosedialog.ui b/src/waitingonclosedialog.ui
deleted file mode 100644
index 9c7818e0..00000000
--- a/src/waitingonclosedialog.ui
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
- WaitingOnCloseDialog
-
-
-
- 0
- 0
- 317
- 151
-
-
-
- Waiting for virtualized processes
-
-
- -
-
-
- This dialog should disappear automatically if the application/game is done.
-
-
- Virtualized processes are still running, it is prefered to keep MO running until they are finished.
-
-
- true
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 10
-
-
-
-
- -
-
-
-
- true
-
-
-
- color: grey;
-
-
-
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 10
-
-
-
-
- -
-
-
-
-
-
- Close Now
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Cancel
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 10
-
-
-
-
-
-
-
-
-
--
cgit v1.3.1