X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fircconnectionwizard.cpp;h=72e732b48d49606b3581f30df13e9d943e4b4eeb;hp=a73ad516cbba35a2cb2263313f34f75c7d67dee3;hb=c1cf157116de7fc3da96203aa6f03c38c7ebb650;hpb=b571f515e6e2ec9fcc69e600f4f6d5aecfe86f29 diff --git a/src/qtui/ircconnectionwizard.cpp b/src/qtui/ircconnectionwizard.cpp index a73ad516..72e732b4 100644 --- a/src/qtui/ircconnectionwizard.cpp +++ b/src/qtui/ircconnectionwizard.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 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 * @@ -20,18 +20,15 @@ #include "ircconnectionwizard.h" +#include + #include "client.h" #include "identityeditwidget.h" -#include "simplenetworkeditor.h" #include "presetnetworks.h" +#include "simplenetworkeditor.h" -#include - -IrcConnectionWizard::IrcConnectionWizard(QWidget *parent, Qt::WindowFlags flags) - : QWizard(parent, flags), - _introductionPage(0), - _identityPage(0), - _networkPage(0) +IrcConnectionWizard::IrcConnectionWizard(QWidget* parent, Qt::WindowFlags flags) + : QWizard(parent, flags) { _introductionPage = createIntroductionPage(this); _identityPage = new IdentityPage(this); @@ -46,72 +43,69 @@ IrcConnectionWizard::IrcConnectionWizard(QWidget *parent, Qt::WindowFlags flags) setOptions(options() | (QWizard::WizardOptions)(QWizard::NoDefaultButton | QWizard::CancelButtonOnLeft)); setOption(QWizard::NoCancelButton, false); - connect(button(QWizard::FinishButton), SIGNAL(clicked()), this, SLOT(finishClicked())); + connect(button(QWizard::FinishButton), &QAbstractButton::clicked, this, &IrcConnectionWizard::finishClicked); setButtonText(QWizard::FinishButton, tr("Save && Connect")); } - -QWizardPage *IrcConnectionWizard::createIntroductionPage(QWidget *parent) +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.
" - "This only covers basic settings. You can cancel this wizard any time and use the settings dialog for more detailed changes."), page); + QLabel* label = new QLabel( + QObject::tr( + "This wizard will help you to set up your default identity and your IRC network connection.
" + "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; } - void IrcConnectionWizard::finishClicked() { - CertIdentity *identity = static_cast(_identityPage)->identity(); + CertIdentity* identity = static_cast(_identityPage)->identity(); if (identity->id().isValid()) { Client::updateIdentity(identity->id(), identity->toVariantMap()); identityReady(identity->id()); } else { - connect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(identityReady(IdentityId))); + connect(Client::instance(), &Client::identityCreated, this, &IrcConnectionWizard::identityReady); Client::createIdentity(*identity); } } - void IrcConnectionWizard::identityReady(IdentityId id) { - disconnect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(identityReady(IdentityId))); - NetworkPage *networkPage = static_cast(_networkPage); + disconnect(Client::instance(), &Client::identityCreated, this, &IrcConnectionWizard::identityReady); + auto* networkPage = static_cast(_networkPage); NetworkInfo networkInfo = networkPage->networkInfo(); QStringList channels = networkPage->channelList(); networkInfo.identity = id; - connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(networkReady(NetworkId))); + connect(Client::instance(), &Client::networkCreated, this, &IrcConnectionWizard::networkReady); Client::createNetwork(networkInfo, channels); } - void IrcConnectionWizard::networkReady(NetworkId id) { - disconnect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(networkReady(NetworkId))); - const Network *net = Client::network(id); + disconnect(Client::instance(), &Client::networkCreated, this, &IrcConnectionWizard::networkReady); + const Network* net = Client::network(id); Q_ASSERT(net); net->requestConnect(); deleteLater(); } - // ============================== // Wizard Pages // ============================== // Identity Page -IdentityPage::IdentityPage(QWidget *parent) - : QWizardPage(parent), - _identityEditWidget(new IdentityEditWidget(this)), - _identity(0) +IdentityPage::IdentityPage(QWidget* parent) + : QWizardPage(parent) + , _identityEditWidget(new IdentityEditWidget(this)) { setTitle(tr("Setup Identity")); @@ -126,23 +120,21 @@ IdentityPage::IdentityPage(QWidget *parent) _identityEditWidget->displayIdentity(_identity); _identityEditWidget->showAdvanced(false); - QVBoxLayout *layout = new QVBoxLayout; + auto* layout = new QVBoxLayout; layout->addWidget(_identityEditWidget); setLayout(layout); } - -CertIdentity *IdentityPage::identity() +CertIdentity* IdentityPage::identity() { _identityEditWidget->saveToIdentity(_identity); return _identity; } - // Network Page -NetworkPage::NetworkPage(QWidget *parent) - : QWizardPage(parent), - _networkEditor(new SimpleNetworkEditor(this)) +NetworkPage::NetworkPage(QWidget* parent) + : QWizardPage(parent) + , _networkEditor(new SimpleNetworkEditor(this)) { QStringList defaultNets = PresetNetworks::names(true); if (!defaultNets.isEmpty()) { @@ -158,19 +150,17 @@ NetworkPage::NetworkPage(QWidget *parent) setTitle(tr("Setup Network Connection")); - QVBoxLayout *layout = new QVBoxLayout; + auto* layout = new QVBoxLayout; layout->addWidget(_networkEditor); setLayout(layout); } - NetworkInfo NetworkPage::networkInfo() { _networkEditor->saveToNetworkInfo(_networkInfo); return _networkInfo; } - QStringList NetworkPage::channelList() { _channelList = _networkEditor->defaultChannels();