qt4-b-gone: Remove all code supporting Qt < 5.5 and KDE4
[quassel.git] / src / qtui / coreconfigwizard.cpp
index a9453fa..ebb23b8 100644 (file)
@@ -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  *
  *   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"
 
 namespace {
 
@@ -54,10 +54,11 @@ QGroupBox *createFieldBox(const QString &title, const std::vector<FieldInfo> &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()) {
@@ -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)));
@@ -188,7 +189,7 @@ void CoreConfigWizard::prepareCoreSetup(const QString &backend, const QVariantMa
 
     // 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 {
@@ -267,7 +268,7 @@ AdminUserPage::AdminUserPage(QWidget *parent) : QWizardPage(parent)
 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 {
@@ -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
 }