summaryrefslogtreecommitdiff
path: root/src/nxmaccessmanager.h
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-10-05 10:11:55 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-10-05 10:11:55 -0400
commit3fe54c8431b9c1e792a235b9b370267447c3210c (patch)
tree15949037523cda7304888278955b5fdf7ba9e06a /src/nxmaccessmanager.h
parent73556ad0845ee6dea2ec9f1fa50903de0448fa91 (diff)
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
Diffstat (limited to 'src/nxmaccessmanager.h')
-rw-r--r--src/nxmaccessmanager.h65
1 files changed, 33 insertions, 32 deletions
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 <http://www.gnu.org/licenses/>.
#include <set>
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::ValidationProgressDialog> 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<ValidationProgressDialog> m_ProgressDialog;
QString m_MOVersion;
NexusKeyValidator m_validator;
States m_validationState;