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_coreconfigwizardstorageselectionpage.h"
31 #include "ui_coreconfigwizardsyncpage.h"
35 namespace CoreConfigWizardPages {
40 class CoreConfigWizard : public QWizard
55 CoreConfigWizard(CoreConnection *connection, const QList<QVariant> &backends, QWidget *parent = 0);
56 QHash<QString, QVariant> backends() const;
58 inline CoreConnection *coreConnection() const { return _connection; }
61 void setupCore(const QVariant &setupData);
62 void loginToCore(const QString &user, const QString &password, bool rememberPassword);
69 void prepareCoreSetup(const QString &backend, const QVariantMap &connectionProperties);
70 void coreSetupSuccess();
71 void coreSetupFailed(const QString &);
75 QHash<QString, QVariant> _backends;
76 CoreConfigWizardPages::SyncPage *syncPage;
77 CoreConfigWizardPages::SyncRelayPage *syncRelayPage;
79 CoreConnection *_connection;
83 namespace CoreConfigWizardPages {
84 class IntroPage : public QWizardPage
89 IntroPage(QWidget *parent = 0);
92 Ui::CoreConfigWizardIntroPage ui;
96 class AdminUserPage : public QWizardPage
101 AdminUserPage(QWidget *parent = 0);
103 bool isComplete() const;
105 Ui::CoreConfigWizardAdminUserPage ui;
109 class StorageSelectionPage : public QWizardPage
114 StorageSelectionPage(const QHash<QString, QVariant> &backends, QWidget *parent = 0);
116 QString selectedBackend() const;
117 QVariantMap connectionProperties() const;
120 void on_backendList_currentIndexChanged();
122 Ui::CoreConfigWizardStorageSelectionPage ui;
123 QGroupBox *_connectionBox;
124 QHash<QString, QVariant> _backends;
128 class SyncPage : public QWizardPage
133 SyncPage(QWidget *parent = 0);
134 void initializePage();
136 bool isComplete() const;
139 void setStatus(const QString &status);
141 void setComplete(bool);
144 void setupCore(const QString &backend, const QVariantMap &);
147 Ui::CoreConfigWizardSyncPage ui;
153 class SyncRelayPage : public QWizardPage
158 SyncRelayPage(QWidget *parent = 0);
160 enum Mode { Success, Error };
166 void startOver() const;