modernize: Use auto where the type is clear from context
[quassel.git] / src / qtui / ircconnectionwizard.cpp
index 8f6b0c7..1210b5c 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 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  *
@@ -15,7 +15,7 @@
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
 #include "ircconnectionwizard.h"
 #include "client.h"
 #include "identityeditwidget.h"
 #include "simplenetworkeditor.h"
+#include "presetnetworks.h"
 
 #include <QVBoxLayout>
 
 IrcConnectionWizard::IrcConnectionWizard(QWidget *parent, Qt::WindowFlags flags)
-    : QWizard(parent, flags),
-    _introductionPage(0),
-    _identityPage(0),
-    _networkPage(0)
+    : QWizard(parent, flags)
 {
     _introductionPage = createIntroductionPage(this);
     _identityPage = new IdentityPage(this);
@@ -52,14 +50,14 @@ IrcConnectionWizard::IrcConnectionWizard(QWidget *parent, Qt::WindowFlags flags)
 
 QWizardPage *IrcConnectionWizard::createIntroductionPage(QWidget *parent)
 {
-    QWizardPage *page = new QWizardPage(parent);
+    auto *page = new QWizardPage(parent);
     page->setTitle(QObject::tr("Welcome to Quassel IRC"));
 
     QLabel *label = new QLabel(QObject::tr("This wizard will help you to set up your default identity and your IRC network connection.<br>"
                                            "This only covers basic settings. You can cancel this wizard any time and use the settings dialog for more detailed changes."), page);
     label->setWordWrap(true);
 
-    QVBoxLayout *layout = new QVBoxLayout;
+    auto *layout = new QVBoxLayout;
     layout->addWidget(label);
     page->setLayout(layout);
     return page;
@@ -83,7 +81,7 @@ void IrcConnectionWizard::finishClicked()
 void IrcConnectionWizard::identityReady(IdentityId id)
 {
     disconnect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(identityReady(IdentityId)));
-    NetworkPage *networkPage = static_cast<NetworkPage *>(_networkPage);
+    auto *networkPage = static_cast<NetworkPage *>(_networkPage);
     NetworkInfo networkInfo = networkPage->networkInfo();
     QStringList channels = networkPage->channelList();
     networkInfo.identity = id;
@@ -109,8 +107,7 @@ void IrcConnectionWizard::networkReady(NetworkId id)
 // Identity Page
 IdentityPage::IdentityPage(QWidget *parent)
     : QWizardPage(parent),
-    _identityEditWidget(new IdentityEditWidget(this)),
-    _identity(0)
+    _identityEditWidget(new IdentityEditWidget(this))
 {
     setTitle(tr("Setup Identity"));
 
@@ -125,7 +122,7 @@ IdentityPage::IdentityPage(QWidget *parent)
 
     _identityEditWidget->displayIdentity(_identity);
     _identityEditWidget->showAdvanced(false);
-    QVBoxLayout *layout = new QVBoxLayout;
+    auto *layout = new QVBoxLayout;
     layout->addWidget(_identityEditWidget);
     setLayout(layout);
 }
@@ -143,12 +140,12 @@ NetworkPage::NetworkPage(QWidget *parent)
     : QWizardPage(parent),
     _networkEditor(new SimpleNetworkEditor(this))
 {
-    QStringList defaultNets = Network::presetNetworks(true);
+    QStringList defaultNets = PresetNetworks::names(true);
     if (!defaultNets.isEmpty()) {
-        NetworkInfo info = Network::networkInfoFromPreset(defaultNets[0]);
+        NetworkInfo info = PresetNetworks::networkInfo(defaultNets[0]);
         if (!info.networkName.isEmpty()) {
             _networkInfo = info;
-            _channelList = Network::presetDefaultChannels(defaultNets[0]);
+            _channelList = PresetNetworks::defaultChannels(defaultNets[0]);
         }
     }
 
@@ -157,7 +154,7 @@ NetworkPage::NetworkPage(QWidget *parent)
 
     setTitle(tr("Setup Network Connection"));
 
-    QVBoxLayout *layout = new QVBoxLayout;
+    auto *layout = new QVBoxLayout;
     layout->addWidget(_networkEditor);
     setLayout(layout);
 }