X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fcoreconfigwizard.cpp;h=4e4587023369f94c780cf6280d7c01f3773c42e3;hp=4b8c7c50888f7b4c154356ce4e25660fa91cb430;hb=e2188dc438be6f3eb0d9cdf47d28821aefe9835e;hpb=9f91e0dd3c4eb5c2e2dedfc8d36a068d433d51b1 diff --git a/src/qtui/coreconfigwizard.cpp b/src/qtui/coreconfigwizard.cpp index 4b8c7c50..4e458702 100644 --- a/src/qtui/coreconfigwizard.cpp +++ b/src/qtui/coreconfigwizard.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * 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 * @@ -18,17 +18,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include "coreconfigwizard.h" + #include #include #include #include -#include #include -#include "coreconfigwizard.h" -#include "coreconnection.h" - #include "client.h" +#include "coreconnection.h" +#include "icon.h" namespace { @@ -54,10 +54,11 @@ QGroupBox *createFieldBox(const QString &title, const std::vector &fi // 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()) { @@ -98,7 +99,7 @@ QVariantMap propertiesFromFieldWidgets(QGroupBox *fieldBox, const std::vector(fieldInfo).type()) { case QVariant::Int: { - QSpinBox *spinBox = fieldBox->findChild(key); + auto *spinBox = fieldBox->findChild(key); if (spinBox) value = spinBox->value(); else @@ -106,7 +107,7 @@ QVariantMap propertiesFromFieldWidgets(QGroupBox *fieldBox, const std::vectorfindChild(key); + auto *lineEdit = fieldBox->findChild(key); if (lineEdit) value = lineEdit->text(); else @@ -159,7 +160,7 @@ CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QVariantLis 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))); @@ -317,11 +318,7 @@ AuthenticationSelectionPage::AuthenticationSelectionPage(const QVariantList &aut 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); @@ -346,11 +343,7 @@ QString AuthenticationSelectionPage::displayName() const QString AuthenticationSelectionPage::authenticator() const { -#if QT_VERSION >= 0x050200 return ui.backendList->currentData().toString(); -#else - return ui.backendList->itemData(ui.backendList->currentIndex()).toString(); -#endif } @@ -423,11 +416,7 @@ StorageSelectionPage::StorageSelectionPage(const QVariantList &backendInfos, QWi 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); @@ -452,11 +441,7 @@ QString StorageSelectionPage::displayName() const QString StorageSelectionPage::backend() const { -#if QT_VERSION >= 0x050200 return ui.backendList->currentData().toString(); -#else - return ui.backendList->itemData(ui.backendList->currentIndex()).toString(); -#endif } @@ -492,13 +477,13 @@ void SyncPage::initializePage() emit completeChanged(); // Fill in sync info about the storage layer. - StorageSelectionPage *storagePage = qobject_cast(wizard()->page(CoreConfigWizard::StorageSelectionPage)); + auto *storagePage = qobject_cast(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(wizard()->page(CoreConfigWizard::AuthenticationSelectionPage)); + auto *authPage = qobject_cast(wizard()->page(CoreConfigWizard::AuthenticationSelectionPage)); QString authenticator = authPage->authenticator(); QVariantMap authProperties = authPage->authProperties(); ui.authenticator->setText(authPage->displayName()); @@ -562,4 +547,4 @@ int SyncRelayPage::nextId() const emit startOver(); return 0; } -}; /* namespace CoreConfigWizardPages */ +} /* namespace CoreConfigWizardPages */