1 /***************************************************************************
2 * Copyright (C) 2005-2016 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef _CORECONFIGWIZARD_H_
22 #define _CORECONFIGWIZARD_H_
26 #include <QVariantMap>
28 #include "ui_coreconfigwizardintropage.h"
29 #include "ui_coreconfigwizardadminuserpage.h"
30 #include "ui_coreconfigwizardauthenticationselectionpage.h"
31 #include "ui_coreconfigwizardstorageselectionpage.h"
32 #include "ui_coreconfigwizardsyncpage.h"
36 namespace CoreConfigWizardPages {
41 class CoreConfigWizard : public QWizard
49 AuthenticationSelectionPage,
57 CoreConfigWizard(CoreConnection *connection, const QList<QVariant> &backends, const QList<QVariant> &authenticators, QWidget *parent = 0);
58 QHash<QString, QVariant> backends() const;
59 QHash<QString, QVariant> authenticators() const;
61 inline CoreConnection *coreConnection() const { return _connection; }
64 void setupCore(const QVariant &setupData);
65 void loginToCore(const QString &user, const QString &password, bool rememberPassword);
72 void prepareCoreSetup(const QString &backend, const QVariantMap &properties, const QString &authenticator, const QVariantMap &authProperties);
73 void coreSetupSuccess();
74 void coreSetupFailed(const QString &);
78 QHash<QString, QVariant> _backends;
79 QHash<QString, QVariant> _authenticators;
81 CoreConfigWizardPages::SyncPage *syncPage;
82 CoreConfigWizardPages::SyncRelayPage *syncRelayPage;
84 CoreConnection *_connection;
88 namespace CoreConfigWizardPages {
89 class IntroPage : public QWizardPage
94 IntroPage(QWidget *parent = 0);
97 Ui::CoreConfigWizardIntroPage ui;
101 class AdminUserPage : public QWizardPage
106 AdminUserPage(QWidget *parent = 0);
108 bool isComplete() const;
110 Ui::CoreConfigWizardAdminUserPage ui;
113 // Authentication selection before storage selection.
114 class AuthenticationSelectionPage : public QWizardPage
119 AuthenticationSelectionPage(const QHash<QString, QVariant> &backends, QWidget *parent = 0);
121 QString selectedBackend() const;
122 QVariantMap connectionProperties() const;
125 void on_backendList_currentIndexChanged();
127 Ui::CoreConfigWizardAuthenticationSelectionPage ui;
128 QGroupBox *_connectionBox;
129 QHash<QString, QVariant> _backends;
132 class StorageSelectionPage : public QWizardPage
137 StorageSelectionPage(const QHash<QString, QVariant> &backends, QWidget *parent = 0);
139 QString selectedBackend() const;
140 QVariantMap connectionProperties() const;
143 void on_backendList_currentIndexChanged();
145 Ui::CoreConfigWizardStorageSelectionPage ui;
146 QGroupBox *_connectionBox;
147 QHash<QString, QVariant> _backends;
150 class SyncPage : public QWizardPage
155 SyncPage(QWidget *parent = 0);
156 void initializePage();
158 bool isComplete() const;
161 void setStatus(const QString &status);
163 void setComplete(bool);
166 void setupCore(const QString &backend, const QVariantMap &, const QString &authenticator, const QVariantMap &);
169 Ui::CoreConfigWizardSyncPage ui;
175 class SyncRelayPage : public QWizardPage
180 SyncRelayPage(QWidget *parent = 0);
182 enum Mode { Success, Error };
188 void startOver() const;