1 /***************************************************************************
2 * Copyright (C) 2005-09 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 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 {
54 CoreConfigWizard(CoreConnection *connection, const QList<QVariant> &backends, QWidget *parent = 0);
55 QHash<QString, QVariant> backends() const;
57 inline CoreConnection *coreConnection() const { return _connection; }
60 void setupCore(const QVariant &setupData);
61 void loginToCore(const QString &user, const QString &password, bool rememberPassword);
68 void prepareCoreSetup(const QString &backend, const QVariantMap &connectionProperties);
69 void coreSetupSuccess();
70 void coreSetupFailed(const QString &);
74 QHash<QString, QVariant> _backends;
75 CoreConfigWizardPages::SyncPage *syncPage;
76 CoreConfigWizardPages::SyncRelayPage *syncRelayPage;
78 CoreConnection *_connection;
81 namespace CoreConfigWizardPages {
83 class IntroPage : public QWizardPage {
87 IntroPage(QWidget *parent = 0);
90 Ui::CoreConfigWizardIntroPage ui;
93 class AdminUserPage : public QWizardPage {
97 AdminUserPage(QWidget *parent = 0);
99 bool isComplete() const;
101 Ui::CoreConfigWizardAdminUserPage ui;
104 class StorageSelectionPage : public QWizardPage {
108 StorageSelectionPage(const QHash<QString, QVariant> &backends, QWidget *parent = 0);
110 QString selectedBackend() const;
111 QVariantMap connectionProperties() const;
114 void on_backendList_currentIndexChanged();
116 Ui::CoreConfigWizardStorageSelectionPage ui;
117 QGroupBox *_connectionBox;
118 QHash<QString, QVariant> _backends;
121 class SyncPage : public QWizardPage {
125 SyncPage(QWidget *parent = 0);
126 void initializePage();
128 bool isComplete() const;
131 void setStatus(const QString &status);
133 void setComplete(bool);
136 void setupCore(const QString &backend, const QVariantMap &);
139 Ui::CoreConfigWizardSyncPage ui;
144 class SyncRelayPage : public QWizardPage {
148 SyncRelayPage(QWidget *parent = 0);
150 enum Mode { Success, Error };
156 void startOver() const;