X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fcoreconfigwizard.h;h=2943c15842587c262763f3f652b4f1b5927eec7c;hp=91b532fc09db6b787bbd692f9039bc86f0030f1e;hb=54ebc1bf00f4f9a8376629925329f0e72be04662;hpb=029c6d402af7b00b320dd5ce48f230783a88957a diff --git a/src/qtui/coreconfigwizard.h b/src/qtui/coreconfigwizard.h index 91b532fc..2943c158 100644 --- a/src/qtui/coreconfigwizard.h +++ b/src/qtui/coreconfigwizard.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,144 +15,186 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef _CORECONFIGWIZARD_H_ -#define _CORECONFIGWIZARD_H_ +#pragma once + +#include +#include -#include #include #include #include "ui_coreconfigwizardintropage.h" #include "ui_coreconfigwizardadminuserpage.h" +#include "ui_coreconfigwizardauthenticationselectionpage.h" #include "ui_coreconfigwizardstorageselectionpage.h" #include "ui_coreconfigwizardsyncpage.h" +class CoreConnection; + namespace CoreConfigWizardPages { - class SyncPage; - class SyncRelayPage; + +class SyncPage; +class SyncRelayPage; + }; -class CoreConfigWizard : public QWizard { - Q_OBJECT +class CoreConfigWizard : public QWizard +{ + Q_OBJECT - public: +public: enum { - IntroPage, - AdminUserPage, - StorageSelectionPage, - SyncPage, - SyncRelayPage, - StorageDetailsPage, - ConclusionPage + IntroPage, + AdminUserPage, + AuthenticationSelectionPage, + StorageSelectionPage, + SyncPage, + SyncRelayPage, + StorageDetailsPage, + ConclusionPage }; - CoreConfigWizard(const QList &backends, QWidget *parent = 0); - QHash backends() const; + CoreConfigWizard(CoreConnection *connection, const QVariantList &backendInfos, const QVariantList &authInfos, QWidget *parent = 0); + + inline CoreConnection *coreConnection() const { return _connection; } - signals: +signals: void setupCore(const QVariant &setupData); - void loginToCore(const QVariantMap &loginData); + void loginToCore(const QString &user, const QString &password, bool rememberPassword); - public slots: - void loginSuccess(); +public slots: void syncFinished(); - private slots: - void prepareCoreSetup(const QString &backend, const QVariantMap &connectionProperties); +private slots: + void prepareCoreSetup(const QString &backend, const QVariantMap &properties, const QString &authenticator, const QVariantMap &authProperties); void coreSetupSuccess(); void coreSetupFailed(const QString &); void startOver(); - private: - QHash _backends; +private: CoreConfigWizardPages::SyncPage *syncPage; CoreConfigWizardPages::SyncRelayPage *syncRelayPage; + + CoreConnection *_connection; }; + namespace CoreConfigWizardPages { - class IntroPage : public QWizardPage { +class IntroPage : public QWizardPage +{ + Q_OBJECT + +public: + IntroPage(QWidget *parent = 0); + int nextId() const; +private: + Ui::CoreConfigWizardIntroPage ui; +}; + + +class AdminUserPage : public QWizardPage +{ Q_OBJECT - public: - IntroPage(QWidget *parent = 0); - int nextId() const; - private: - Ui::CoreConfigWizardIntroPage ui; - }; +public: + AdminUserPage(QWidget *parent = 0); + int nextId() const; + bool isComplete() const; +private: + Ui::CoreConfigWizardAdminUserPage ui; +}; + - class AdminUserPage : public QWizardPage { +class AuthenticationSelectionPage : public QWizardPage +{ Q_OBJECT + using FieldInfo = std::tuple; + +public: + AuthenticationSelectionPage(const QVariantList &authInfos, QWidget *parent = 0); + int nextId() const; + QString displayName() const; + QString authenticator() const; + QVariantMap authProperties() const; + +private slots: + void on_backendList_currentIndexChanged(int index); + +private: + Ui::CoreConfigWizardAuthenticationSelectionPage ui; + std::vector _authProperties; + std::vector> _authFields; +}; - public: - AdminUserPage(QWidget *parent = 0); - int nextId() const; - bool isComplete() const; - private: - Ui::CoreConfigWizardAdminUserPage ui; - }; - class StorageSelectionPage : public QWizardPage { +class StorageSelectionPage : public QWizardPage +{ Q_OBJECT + using FieldInfo = std::tuple; + +public: + StorageSelectionPage(const QVariantList &backendInfos, QWidget *parent = 0); + int nextId() const; + QString displayName() const; + QString backend() const; + QVariantMap backendProperties() const; + +private slots: + void on_backendList_currentIndexChanged(int index); + +private: + Ui::CoreConfigWizardStorageSelectionPage ui; + std::vector _backendProperties; + std::vector> _backendFields; +}; - public: - StorageSelectionPage(const QHash &backends, QWidget *parent = 0); - int nextId() const; - QString selectedBackend() const; - QVariantMap connectionProperties() const; - - private slots: - void on_backendList_currentIndexChanged(); - private: - Ui::CoreConfigWizardStorageSelectionPage ui; - QGroupBox *_connectionBox; - QHash _backends; - }; - - class SyncPage : public QWizardPage { + +class SyncPage : public QWizardPage +{ Q_OBJECT - public: - SyncPage(QWidget *parent = 0); - void initializePage(); - int nextId() const; - bool isComplete() const; +public: + SyncPage(QWidget *parent = 0); + void initializePage(); + int nextId() const; + bool isComplete() const; + +public slots: + void setStatus(const QString &status); + void setError(bool); + void setComplete(bool); - public slots: - void setStatus(const QString &status); - void setError(bool); - void setComplete(bool); +signals: + void setupCore(const QString &backend, const QVariantMap &, const QString &authenticator, const QVariantMap &); - signals: - void setupCore(const QString &backend, const QVariantMap &); +private: + Ui::CoreConfigWizardSyncPage ui; + bool _complete {false}; + bool _hasError {false}; +}; - private: - Ui::CoreConfigWizardSyncPage ui; - bool complete; - bool hasError; - }; - class SyncRelayPage : public QWizardPage { +class SyncRelayPage : public QWizardPage +{ Q_OBJECT - public: - SyncRelayPage(QWidget *parent = 0); - int nextId() const; - enum Mode { Success, Error }; +public: + SyncRelayPage(QWidget *parent = 0); + int nextId() const; + enum Mode { Success, Error }; - public slots: - void setMode(Mode); +public slots: + void setMode(Mode); - signals: - void startOver() const; +signals: + void startOver() const; - private: - Mode mode; - }; +private: + Mode mode; +}; } - -#endif