summaryrefslogtreecommitdiff
path: root/src/settingsdialognexus.h
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-07-30 00:48:46 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2020-11-03 11:39:06 -0500
commitc4df6b8ec98feb34cc9b9785e6d4d0eac6b3f571 (patch)
treec874d57f52243362ab2e7114c3d409b6326729cc /src/settingsdialognexus.h
parentc699aeb6d862f2c0960de126538931e4f13368b7 (diff)
split nexus connection stuff into NexusConnectionUI so it can be reused in the instance creation dialog
removed the PluginContainer* parameter from NexusInterface::instance() - it's a singleton, so it only needs to be given once, not every time - it doesn't even matter because the first time instance() is called, it creates the singleton, but the plugin container is always null - and setPluginContainer() is called much later from OrganizerCore with the correct value added non functional nexus page to instance creation dialog
Diffstat (limited to 'src/settingsdialognexus.h')
-rw-r--r--src/settingsdialognexus.h55
1 files changed, 42 insertions, 13 deletions
diff --git a/src/settingsdialognexus.h b/src/settingsdialognexus.h
index 2cb1cc1e..0adf67c7 100644
--- a/src/settingsdialognexus.h
+++ b/src/settingsdialognexus.h
@@ -5,38 +5,67 @@
#include "settingsdialog.h"
#include "nxmaccessmanager.h"
-class NexusSettingsTab : public SettingsTab
+class NexusConnectionUI : public QObject
{
+ Q_OBJECT;
+
public:
- NexusSettingsTab(Settings& settings, SettingsDialog& dialog);
- void update();
+ NexusConnectionUI(Settings& s, QWidget* parent=nullptr);
+
+ void set(
+ QAbstractButton* connectButton,
+ QAbstractButton* disconnectButton,
+ QAbstractButton* manualButton,
+ QListWidget* logList);
+
+ void connect();
+ void manual();
+ void disconnect();
+
+signals:
+ void stateChanged();
+ void keyChanged();
private:
+ QWidget* m_parent;
+ Settings& m_settings;
+ QAbstractButton* m_connect;
+ QAbstractButton* m_disconnect;
+ QAbstractButton* m_manual;
+ QListWidget* m_log;
+
std::unique_ptr<NexusSSOLogin> m_nexusLogin;
std::unique_ptr<NexusKeyValidator> m_nexusValidator;
- void on_nexusConnect_clicked();
- void on_nexusManualKey_clicked();
- void on_nexusDisconnect_clicked();
- void on_clearCacheButton_clicked();
- void on_associateButton_clicked();
+ void addLog(const QString& s);
+
+ void updateState();
void validateKey(const QString& key);
bool setKey(const QString& key);
bool clearKey();
- void updateNexusState();
- void updateNexusButtons();
- void updateNexusData();
-
void onSSOKeyChanged(const QString& key);
void onSSOStateChanged(NexusSSOLogin::States s, const QString& e);
void onValidatorFinished(
ValidationAttempt::Result r, const QString& message,
std::optional<APIUserAccount> useR);
+};
+
- void addNexusLog(const QString& s);
+class NexusSettingsTab : public SettingsTab
+{
+public:
+ NexusSettingsTab(Settings& settings, SettingsDialog& dialog);
+ void update();
+
+private:
+ NexusConnectionUI m_connectionUI;
+
+ void on_clearCacheButton_clicked();
+ void on_associateButton_clicked();
+ void updateNexusData();
};
#endif // SETTINGSDIALOGNEXUS_H