+CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QVariantList &backendInfos, const QVariantList &authInfos, QWidget *parent)
+ : QWizard(parent),
+ _connection{connection}
+{
+ setModal(true);
+ setAttribute(Qt::WA_DeleteOnClose);
+
+ setPage(IntroPage, new CoreConfigWizardPages::IntroPage(this));
+ setPage(AdminUserPage, new CoreConfigWizardPages::AdminUserPage(this));
+ setPage(AuthenticationSelectionPage, new CoreConfigWizardPages::AuthenticationSelectionPage(authInfos, this));
+ setPage(StorageSelectionPage, new CoreConfigWizardPages::StorageSelectionPage(backendInfos, this));
+ syncPage = new CoreConfigWizardPages::SyncPage(this);
+ connect(syncPage, SIGNAL(setupCore(const QString &, const QVariantMap &, const QString &, const QVariantMap &)),
+ SLOT(prepareCoreSetup(const QString &, const QVariantMap &, const QString &, const QVariantMap &)));
+ setPage(SyncPage, syncPage);
+ syncRelayPage = new CoreConfigWizardPages::SyncRelayPage(this);
+ connect(syncRelayPage, SIGNAL(startOver()), this, SLOT(startOver()));
+ setPage(SyncRelayPage, syncRelayPage);
+
+ setStartId(IntroPage);
+
+#ifndef Q_OS_MAC
+ setWizardStyle(ModernStyle);
+#endif
+
+ setOption(HaveHelpButton, false);
+ setOption(NoBackButtonOnStartPage, true);
+ setOption(HaveNextButtonOnLastPage, false);
+ setOption(HaveFinishButtonOnEarlyPages, false);
+ setOption(NoCancelButton, true);
+ setOption(IndependentPages, true);
+
+ setModal(true);
+
+ setWindowTitle(CoreConfigWizard::tr("Core Configuration Wizard"));
+ setPixmap(QWizard::LogoPixmap, icon::get("quassel").pixmap(48));
+
+ connect(connection, SIGNAL(coreSetupSuccess()), SLOT(coreSetupSuccess()));
+ connect(connection, SIGNAL(coreSetupFailed(QString)), SLOT(coreSetupFailed(QString)));
+ connect(connection, SIGNAL(synchronized()), SLOT(syncFinished()));
+ connect(this, SIGNAL(rejected()), connection, SLOT(disconnectFromCore()));
+
+
+ // Resize all pages to the size hint of the largest one, so the wizard is large enough
+ QSize maxSize;
+ for (int id : pageIds()) {
+ auto p = page(id);
+ p->adjustSize();
+ maxSize = maxSize.expandedTo(p->sizeHint());
+ }
+ for (int id : pageIds()) {
+ page(id)->setFixedSize(maxSize);
+ }