From 3fe54c8431b9c1e792a235b9b370267447c3210c Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sat, 5 Oct 2019 10:11:55 -0400
Subject: now using ui file for validation progress dialog moved elapsed timer
to NexusKeyValidator, progress dialog now just shows what the validator is
doing, which allows for hiding and showing it at any time recreate the dialog
when the parent changes, avoids theme errors
---
src/nxmaccessmanager.h | 65 +++++++++++++++++++++++++-------------------------
1 file changed, 33 insertions(+), 32 deletions(-)
(limited to 'src/nxmaccessmanager.h')
diff --git a/src/nxmaccessmanager.h b/src/nxmaccessmanager.h
index 0c85153b..2a4c066c 100644
--- a/src/nxmaccessmanager.h
+++ b/src/nxmaccessmanager.h
@@ -31,39 +31,9 @@ along with Mod Organizer. If not, see .
#include
namespace MOBase { class IPluginGame; }
+namespace Ui { class ValidationProgressDialog; }
class NXMAccessManager;
-class ValidationProgressDialog : private QDialog
-{
- Q_OBJECT;
-
-public:
- ValidationProgressDialog(std::chrono::seconds timeout);
-
- void setParentWidget(QWidget* w);
-
- void start();
- void stop();
-
- using QDialog::show;
-
-protected:
- void showEvent(QShowEvent* e) override;
- void closeEvent(QCloseEvent* e) override;
-
-private:
- std::chrono::seconds m_timeout;
- QProgressBar* m_bar;
- QDialogButtonBox* m_buttons;
- QTimer* m_timer;
- QElapsedTimer m_elapsed;
- bool m_first;
-
- void onButton(QAbstractButton* b);
- void onTimer();
-};
-
-
class NexusSSOLogin
{
public:
@@ -138,12 +108,15 @@ public:
void cancel();
bool isActive() const;
+ QElapsedTimer elapsed() const;
+ std::chrono::seconds timeout() const;
private:
NXMAccessManager& m_manager;
QNetworkReply* m_reply;
QTimer m_timeout;
bool m_active;
+ QElapsedTimer m_elapsed;
void setState(States s, const QString& error={});
@@ -159,6 +132,34 @@ private:
};
+class ValidationProgressDialog : public QDialog
+{
+ Q_OBJECT;
+
+public:
+ ValidationProgressDialog(const NexusKeyValidator& v);
+
+ void setParentWidget(QWidget* w);
+
+ void start();
+ void stop();
+
+protected:
+ void showEvent(QShowEvent* e) override;
+ void closeEvent(QCloseEvent* e) override;
+
+private:
+ std::unique_ptr ui;
+ const NexusKeyValidator& m_validator;
+ QTimer* m_updateTimer;
+ bool m_first;
+
+ void onHide();
+ void onCancel();
+ void onTimer();
+};
+
+
/**
* @brief access manager extended to handle nxm links
**/
@@ -224,7 +225,7 @@ private:
};
QWidget* m_TopLevel;
- mutable ValidationProgressDialog* m_ProgressDialog;
+ mutable std::unique_ptr m_ProgressDialog;
QString m_MOVersion;
NexusKeyValidator m_validator;
States m_validationState;
--
cgit v1.3.1