diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-06 07:28:11 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-06 07:45:04 -0500 |
| commit | decd5c1828f495be4e230c9fc6fb79dd9bfdfb81 (patch) | |
| tree | fddae0025e65bd1d5064bf8ad6fa73a23aa750e9 /src/lockwidget.h | |
| parent | 4f84565085e19b6f6939783c64ebf95599f879be (diff) | |
renamed lockwidget files to uilocker
Diffstat (limited to 'src/lockwidget.h')
| -rw-r--r-- | src/lockwidget.h | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/src/lockwidget.h b/src/lockwidget.h deleted file mode 100644 index d8c22999..00000000 --- a/src/lockwidget.h +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include <QMainWindow> -#include <mutex> - -class UILockerInterface; - -class UILocker -{ - friend class UILockerInterface; - -public: - // reason to show the widget - // - enum Reasons - { - NoReason = 0, - - // lock the ui - LockUI, - - // because the output is required - OutputRequired, - - // to prevent exiting until all processes are completed - PreventExit - }; - - // returned by result() - // - enum Results - { - NoResult = 0, - - // the widget is still up - StillLocked, - - // force unlock was clicked - ForceUnlocked, - - // cancel was clicked - Cancelled - }; - - - class Session - { - public: - ~Session(); - - void unlock(); - void setInfo(DWORD pid, const QString& name); - Results result() const; - - DWORD pid() const; - const QString& name() const; - - private: - mutable std::mutex m_mutex; - DWORD m_pid; - QString m_name; - }; - - - UILocker(); - ~UILocker(); - - static UILocker& instance(); - - void setUserInterface(QWidget* parent); - - std::shared_ptr<Session> lock(Reasons reason); - - Results result() const; - -private: - QWidget* m_parent; - std::unique_ptr<UILockerInterface> m_ui; - std::vector<std::weak_ptr<Session>> m_sessions; - std::atomic<Results> m_result; - std::vector<QPointer<QWidget>> m_disabled; - - void createUi(Reasons reason); - - void unlockCurrent(); - void unlock(Session* s); - void updateLabel(); - - void onForceUnlock(); - void onCancel(); - - void disableAll(); - void enableAll(); - void disable(QWidget* w); -}; |
