/***************************************************************************
- * Copyright (C) 2005-2016 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 *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#include "coreconfigwizard.h"
+
#include <QDebug>
#include <QAbstractButton>
#include <QCoreApplication>
#include <QFormLayout>
-#include <QIcon>
#include <QSpinBox>
-#include "coreconfigwizard.h"
-#include "coreconnection.h"
-
#include "client.h"
+#include "coreconnection.h"
+#include "icon.h"
+#include "util.h"
namespace {
// provide specialized config widgets for those (which may be a good idea anyway, e.g. if we
// think about client-side translations...)
- QGroupBox *fieldBox = new QGroupBox;
+ auto *fieldBox = new QGroupBox;
fieldBox->setTitle(title);
+ auto *formLayout = new QFormLayout;
+ fieldBox->setLayout(formLayout);
- QFormLayout *formLayout = new QFormLayout(fieldBox);
for (auto &&fieldInfo : fieldInfos) {
QWidget *widget {nullptr};
switch (std::get<2>(fieldInfo).type()) {
QVariant value;
switch (std::get<2>(fieldInfo).type()) {
case QVariant::Int: {
- QSpinBox *spinBox = fieldBox->findChild<QSpinBox *>(key);
+ auto *spinBox = fieldBox->findChild<QSpinBox *>(key);
if (spinBox)
value = spinBox->value();
else
break;
}
case QVariant::String: {
- QLineEdit *lineEdit = fieldBox->findChild<QLineEdit *>(key);
+ auto *lineEdit = fieldBox->findChild<QLineEdit *>(key);
if (lineEdit)
value = lineEdit->text();
else
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 &)));
+ connect(syncPage, &CoreConfigWizardPages::SyncPage::setupCore,
+ this, &CoreConfigWizard::prepareCoreSetup);
setPage(SyncPage, syncPage);
syncRelayPage = new CoreConfigWizardPages::SyncRelayPage(this);
- connect(syncRelayPage, SIGNAL(startOver()), this, SLOT(startOver()));
+ connect(syncRelayPage, &CoreConfigWizardPages::SyncRelayPage::startOver, this, &CoreConfigWizard::startOver);
setPage(SyncRelayPage, syncRelayPage);
setStartId(IntroPage);
setModal(true);
setWindowTitle(CoreConfigWizard::tr("Core Configuration Wizard"));
- setPixmap(QWizard::LogoPixmap, QIcon::fromTheme("quassel", QIcon(":/icons/quassel.png")).pixmap(48));
+ 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()));
+ connect(connection, &CoreConnection::coreSetupSuccess, this, &CoreConfigWizard::coreSetupSuccess);
+ connect(connection, &CoreConnection::coreSetupFailed, this, &CoreConfigWizard::coreSetupFailed);
+ connect(connection, &CoreConnection::synchronized, this, &CoreConfigWizard::syncFinished);
+ connect(this, &QDialog::rejected, connection, selectOverload<>(&CoreConnection::disconnectFromCore));
// Resize all pages to the size hint of the largest one, so the wizard is large enough
// FIXME? We need to be able to set up older cores that don't have auth backend support.
// So if the core doesn't support that feature, don't pass those parameters.
- if (!(Client::coreFeatures() & Quassel::Authenticators)) {
+ if (!Client::isCoreFeatureEnabled(Quassel::Feature::Authenticators)) {
coreConnection()->setupCore(Protocol::SetupData(field("adminUser.user").toString(), field("adminUser.password").toString(), backend, properties));
}
else {
int AdminUserPage::nextId() const
{
// If the core doesn't support auth backends, skip that page!
- if (!(Client::coreFeatures() & Quassel::Authenticators)) {
+ if (!Client::isCoreFeatureEnabled(Quassel::Feature::Authenticators)) {
return CoreConfigWizard::StorageSelectionPage;
}
else {
setSizePolicy({QSizePolicy::Fixed, QSizePolicy::Fixed});
QSizePolicy sp{QSizePolicy::MinimumExpanding, QSizePolicy::Fixed};
-#if QT_VERSION >= 0x050200
sp.setRetainSizeWhenHidden(true);
-#else
- ui.authSettingsStack->setVisible(true); // ugly hack that will show an empty box, but we'll deprecate Qt4 soon anyway
-#endif
ui.descriptionStack->setSizePolicy(sp);
ui.authSettingsStack->setSizePolicy(sp);
QString AuthenticationSelectionPage::authenticator() const
{
-#if QT_VERSION >= 0x050200
return ui.backendList->currentData().toString();
-#else
- return ui.backendList->itemData(ui.backendList->currentIndex()).toString();
-#endif
}
setSizePolicy({QSizePolicy::Fixed, QSizePolicy::Fixed});
QSizePolicy sp{QSizePolicy::MinimumExpanding, QSizePolicy::Fixed};
-#if QT_VERSION >= 0x050200
sp.setRetainSizeWhenHidden(true);
-#else
- ui.storageSettingsStack->setVisible(true); // ugly hack that will show an empty box, but we'll deprecate Qt4 soon anyway
-#endif
ui.descriptionStack->setSizePolicy(sp);
ui.storageSettingsStack->setSizePolicy(sp);
QString StorageSelectionPage::backend() const
{
-#if QT_VERSION >= 0x050200
return ui.backendList->currentData().toString();
-#else
- return ui.backendList->itemData(ui.backendList->currentIndex()).toString();
-#endif
}
emit completeChanged();
// Fill in sync info about the storage layer.
- StorageSelectionPage *storagePage = qobject_cast<StorageSelectionPage *>(wizard()->page(CoreConfigWizard::StorageSelectionPage));
+ auto *storagePage = qobject_cast<StorageSelectionPage *>(wizard()->page(CoreConfigWizard::StorageSelectionPage));
QString backend = storagePage->backend();
QVariantMap backendProperties = storagePage->backendProperties();
ui.backend->setText(storagePage->displayName());
// Fill in sync info about the authentication layer.
- AuthenticationSelectionPage *authPage = qobject_cast<AuthenticationSelectionPage *>(wizard()->page(CoreConfigWizard::AuthenticationSelectionPage));
+ auto *authPage = qobject_cast<AuthenticationSelectionPage *>(wizard()->page(CoreConfigWizard::AuthenticationSelectionPage));
QString authenticator = authPage->authenticator();
QVariantMap authProperties = authPage->authProperties();
ui.authenticator->setText(authPage->displayName());
emit startOver();
return 0;
}
-}; /* namespace CoreConfigWizardPages */
+} /* namespace CoreConfigWizardPages */