From da86ee7178494e6e5404887ddac98d5e107cc747 Mon Sep 17 00:00:00 2001 From: Marcus Eggenberger Date: Sun, 15 Feb 2009 18:01:08 +0100 Subject: [PATCH] fixes #542 - show identities and network settings on first start --- src/client/client.cpp | 25 -- src/client/client.h | 2 - src/qtui/CMakeLists.txt | 5 + src/qtui/ircconnectionwizard.cpp | 164 +++++++++++ src/qtui/ircconnectionwizard.h | 91 ++++++ src/qtui/mainwin.cpp | 6 + src/qtui/settingspages/identityeditwidget.cpp | 13 + src/qtui/settingspages/identityeditwidget.h | 1 + src/qtui/settingspages/networkssettingspage.h | 100 +++---- src/qtui/simplenetworkeditor.cpp | 133 +++++++++ src/qtui/simplenetworkeditor.h | 60 ++++ src/qtui/ui/simplenetworkeditor.ui | 262 ++++++++++++++++++ 12 files changed, 785 insertions(+), 77 deletions(-) create mode 100644 src/qtui/ircconnectionwizard.cpp create mode 100644 src/qtui/ircconnectionwizard.h create mode 100644 src/qtui/simplenetworkeditor.cpp create mode 100644 src/qtui/simplenetworkeditor.h create mode 100644 src/qtui/ui/simplenetworkeditor.ui diff --git a/src/client/client.cpp b/src/client/client.cpp index b0f68e4b..bbca2525 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -301,9 +301,6 @@ void Client::setSyncedToCore() { connect(bufferViewManager(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog())); connect(bufferViewManager(), SIGNAL(initDone()), this, SLOT(createDefaultBufferView())); - createDefaultIdentity(); - createDefaultNetworks(); - _syncedToCore = true; emit connected(); emit coreConnectionStateChanged(true); @@ -323,28 +320,6 @@ void Client::createDefaultBufferView() { } } -void Client::createDefaultIdentity() { - if(_identities.isEmpty()) { - Identity identity; - identity.setToDefaults(); - identity.setIdentityName(tr("Default Identity")); - createIdentity(identity); - } -} - -void Client::createDefaultNetworks() { - if(_networks.isEmpty()) { - QStringList defaultNets = Network::presetNetworks(true); - foreach(QString net, defaultNets) { - NetworkInfo info = Network::networkInfoFromPreset(net); - if(info.networkName.isEmpty()) - continue; - QStringList defaultChans = Network::presetDefaultChannels(net); - createNetwork(info, defaultChans); - } - } -} - void Client::disconnectFromCore() { if(!isConnected()) return; diff --git a/src/client/client.h b/src/client/client.h index 3679d652..c0e07d88 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -185,8 +185,6 @@ private slots: void setSyncedToCore(); void requestInitialBacklog(); void createDefaultBufferView(); - void createDefaultIdentity(); - void createDefaultNetworks(); private: Client(QObject *parent = 0); diff --git a/src/qtui/CMakeLists.txt b/src/qtui/CMakeLists.txt index 3364c57d..f70e4651 100644 --- a/src/qtui/CMakeLists.txt +++ b/src/qtui/CMakeLists.txt @@ -30,6 +30,7 @@ set(SOURCES debuglogwidget.cpp debugmessagemodelfilter.cpp inputwidget.cpp + ircconnectionwizard.cpp jumpkeyhandler.cpp mainpage.cpp mainwin.cpp @@ -43,6 +44,7 @@ set(SOURCES sessionsettings.cpp settingsdlg.cpp settingspagedlg.cpp + simplenetworkeditor.cpp systemtray.cpp systraynotificationbackend.cpp taskbarnotificationbackend.cpp @@ -74,6 +76,7 @@ set(MOC_HDRS debuglogwidget.h debugmessagemodelfilter.h inputwidget.h + ircconnectionwizard.h jumpkeyhandler.h mainpage.h mainwin.h @@ -84,6 +87,7 @@ set(MOC_HDRS qtuimessageprocessor.h settingsdlg.h settingspagedlg.h + simplenetworkeditor.h systemtray.h systraynotificationbackend.h taskbarnotificationbackend.h @@ -120,6 +124,7 @@ set(FORMS nicklistwidget.ui settingsdlg.ui settingspagedlg.ui + simplenetworkeditor.ui topicwidget.ui) if(HAVE_KDE) diff --git a/src/qtui/ircconnectionwizard.cpp b/src/qtui/ircconnectionwizard.cpp new file mode 100644 index 00000000..e952c863 --- /dev/null +++ b/src/qtui/ircconnectionwizard.cpp @@ -0,0 +1,164 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * 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. * + ***************************************************************************/ + +#include "ircconnectionwizard.h" + +#include "client.h" +#include "identityeditwidget.h" +#include "simplenetworkeditor.h" + +#include + +IrcConnectionWizard::IrcConnectionWizard(QWidget *parent, Qt::WindowFlags flags) + : QWizard(parent, flags), + _introductionPage(0), + _identityPage(0), + _networkPage(0) +{ + + _introductionPage = createIntroductionPage(this); + _identityPage = new IdentityPage(this); + _networkPage = new NetworkPage(this); + + + addPage(_introductionPage); + addPage(_identityPage); + addPage(_networkPage); + + setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); + + setOptions(options() | (QWizard::WizardOptions)(QWizard::NoDefaultButton | QWizard::CancelButtonOnLeft)); + setOption(QWizard::NoCancelButton, false); + + connect(button(QWizard::FinishButton), SIGNAL(clicked()), this, SLOT(finishClicked())); + setButtonText(QWizard::FinishButton, tr("Save && Connect")); +} + +QWizardPage *IrcConnectionWizard::createIntroductionPage(QWidget *parent) { + QWizardPage *page = new QWizardPage(parent); + page->setTitle(QObject::tr("Welcome to Quassel IRC")); + + QLabel *label = new QLabel(QObject::tr("This Wizard will help you setting up your default identity and your irc network connection. " + "You can abort this wizard in any step, if you want to setup your identity and IRC connection in more detail." + "This can be done in the settings."), page); + label->setWordWrap(true); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(label); + page->setLayout(layout); + return page; +} + +void IrcConnectionWizard::finishClicked() { + 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))); + Client::createIdentity(*identity); + } +} + +void IrcConnectionWizard::identityReady(IdentityId id) { + disconnect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(identityReady(IdentityId))); + NetworkPage *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))); + 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); + Q_ASSERT(net); + net->requestConnect(); + deleteLater(); +} + +// ============================== +// Wizard Pages +// ============================== + +// Identity Page +IdentityPage::IdentityPage(QWidget *parent) + : QWizardPage(parent), + _identityEditWidget(new IdentityEditWidget(this)), + _identity(0) +{ + setTitle(tr("Setup Identity")); + + if(Client::identityIds().isEmpty()) { + _identity = new CertIdentity(-1, this); + _identity->setToDefaults(); + _identity->setIdentityName(tr("Default Identity")); + } else { + _identity = new CertIdentity(*Client::identity(Client::identityIds().first()), this); + } + + _identityEditWidget->displayIdentity(_identity); + _identityEditWidget->showAdvanced(false); + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(_identityEditWidget); + setLayout(layout); +} + +CertIdentity *IdentityPage::identity() { + _identityEditWidget->saveToIdentity(_identity); + return _identity; +} + + +// Network Page +NetworkPage::NetworkPage(QWidget *parent) + : QWizardPage(parent), + _networkEditor(new SimpleNetworkEditor(this)) +{ + + QStringList defaultNets = Network::presetNetworks(true); + if(!defaultNets.isEmpty()) { + NetworkInfo info = Network::networkInfoFromPreset(defaultNets[0]); + if(!info.networkName.isEmpty()) { + _networkInfo = info; + _channelList = Network::presetDefaultChannels(defaultNets[0]); + } + } + + _networkEditor->displayNetworkInfo(_networkInfo); + _networkEditor->setDefaultChannels(_channelList); + + setTitle(tr("Setup Network Connection")); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(_networkEditor); + setLayout(layout); +} + +NetworkInfo NetworkPage::networkInfo() { + _networkEditor->saveToNetworkInfo(_networkInfo); + return _networkInfo; +} + +QStringList NetworkPage::channelList() { + _channelList = _networkEditor->defaultChannels(); + return _channelList; +} diff --git a/src/qtui/ircconnectionwizard.h b/src/qtui/ircconnectionwizard.h new file mode 100644 index 00000000..aa65a039 --- /dev/null +++ b/src/qtui/ircconnectionwizard.h @@ -0,0 +1,91 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * 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. * + ***************************************************************************/ + +#ifndef IRCCONNECTIONWIZARD_H +#define IRCCONNECTIONWIZARD_H + +#include + +#include "types.h" + +class IrcConnectionWizard : public QWizard { + Q_OBJECT + +public: + IrcConnectionWizard(QWidget *parent = 0, Qt::WindowFlags flags = 0); + + static QWizardPage *createIntroductionPage(QWidget *parent = 0); + +private slots: + void finishClicked(); + void identityReady(IdentityId id); + void networkReady(NetworkId id); + +private: + QWizardPage *_introductionPage; + QWizardPage *_identityPage; + QWizardPage *_networkPage; +}; + + +// ============================== +// Wizard Pages +// ============================== + +// Identity Page +#include "clientidentity.h" + +class IdentityEditWidget; + +class IdentityPage : public QWizardPage { + Q_OBJECT + +public: + IdentityPage(QWidget *parent = 0); + + CertIdentity *identity(); + +private: + IdentityEditWidget *_identityEditWidget; + CertIdentity *_identity; +}; + + +// Network Page +#include "network.h" + +class SimpleNetworkEditor; + +class NetworkPage : public QWizardPage { + Q_OBJECT + +public: + NetworkPage(QWidget *parent = 0); + + NetworkInfo networkInfo(); + QStringList channelList(); + +private: + SimpleNetworkEditor *_networkEditor; + NetworkInfo _networkInfo; + QStringList _channelList; +}; + +#endif //IRCCONNECTIONWIZARD_H diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index df444319..655cdcd2 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -55,6 +55,7 @@ #include "inputwidget.h" #include "inputline.h" #include "irclistmodel.h" +#include "ircconnectionwizard.h" #include "jumpkeyhandler.h" #include "msgprocessorstatuswidget.h" #include "nicklistwidget.h" @@ -606,6 +607,11 @@ void MainWin::setConnectedState() { coreLagLabel->setVisible(!Client::internalCore()); updateIcon(); systemTray()->setState(SystemTray::Active); + + if(Client::networkIds().isEmpty()) { + IrcConnectionWizard *wizard = new IrcConnectionWizard(this, Qt::Sheet); + wizard->show(); + } } void MainWin::loadLayout() { diff --git a/src/qtui/settingspages/identityeditwidget.cpp b/src/qtui/settingspages/identityeditwidget.cpp index b652c7bb..025196cd 100644 --- a/src/qtui/settingspages/identityeditwidget.cpp +++ b/src/qtui/settingspages/identityeditwidget.cpp @@ -209,6 +209,19 @@ void IdentityEditWidget::on_nickDown_clicked() { } } +void IdentityEditWidget::showAdvanced(bool advanced) { + int idx = ui.tabWidget->indexOf(ui.advancedTab); + if(advanced) { + if(idx != -1) + return; // already added + ui.tabWidget->addTab(ui.advancedTab, tr("Advanced")); + } else { + if(idx == -1) + return; // already removed + ui.tabWidget->removeTab(idx); + } +} + #ifdef HAVE_SSL void IdentityEditWidget::setSslState(SslState state) { switch(state) { diff --git a/src/qtui/settingspages/identityeditwidget.h b/src/qtui/settingspages/identityeditwidget.h index 2879c9f4..6516c577 100644 --- a/src/qtui/settingspages/identityeditwidget.h +++ b/src/qtui/settingspages/identityeditwidget.h @@ -48,6 +48,7 @@ public: public slots: void setSslState(SslState state); + void showAdvanced(bool advanced); protected: #ifdef HAVE_SSL diff --git a/src/qtui/settingspages/networkssettingspage.h b/src/qtui/settingspages/networkssettingspage.h index 40d0276f..bafc6456 100644 --- a/src/qtui/settingspages/networkssettingspage.h +++ b/src/qtui/settingspages/networkssettingspage.h @@ -35,63 +35,63 @@ class NetworksSettingsPage : public SettingsPage { Q_OBJECT - public: - NetworksSettingsPage(QWidget *parent = 0); +public: + NetworksSettingsPage(QWidget *parent = 0); - bool aboutToSave(); + bool aboutToSave(); - public slots: - void save(); - void load(); +public slots: + void save(); + void load(); - private slots: - void widgetHasChanged(); - void setWidgetStates(); - void coreConnectionStateChanged(bool); - void networkConnectionStateChanged(Network::ConnectionState state); - void networkConnectionError(const QString &msg); - - void displayNetwork(NetworkId); - void setItemState(NetworkId, QListWidgetItem *item = 0); - - void clientNetworkAdded(NetworkId); - void clientNetworkRemoved(NetworkId); - void clientNetworkUpdated(); - - void clientIdentityAdded(IdentityId); - void clientIdentityRemoved(IdentityId); - void clientIdentityUpdated(); - - void on_networkList_itemSelectionChanged(); - void on_addNetwork_clicked(); - void on_deleteNetwork_clicked(); - void on_renameNetwork_clicked(); - void on_editIdentities_clicked(); - - // void on_connectNow_clicked(); - - void on_serverList_itemSelectionChanged(); - void on_addServer_clicked(); - void on_deleteServer_clicked(); - void on_editServer_clicked(); - void on_upServer_clicked(); - void on_downServer_clicked(); +private slots: + void widgetHasChanged(); + void setWidgetStates(); + void coreConnectionStateChanged(bool); + void networkConnectionStateChanged(Network::ConnectionState state); + void networkConnectionError(const QString &msg); + + void displayNetwork(NetworkId); + void setItemState(NetworkId, QListWidgetItem *item = 0); + + void clientNetworkAdded(NetworkId); + void clientNetworkRemoved(NetworkId); + void clientNetworkUpdated(); + + void clientIdentityAdded(IdentityId); + void clientIdentityRemoved(IdentityId); + void clientIdentityUpdated(); + + void on_networkList_itemSelectionChanged(); + void on_addNetwork_clicked(); + void on_deleteNetwork_clicked(); + void on_renameNetwork_clicked(); + void on_editIdentities_clicked(); + + // void on_connectNow_clicked(); + + void on_serverList_itemSelectionChanged(); + void on_addServer_clicked(); + void on_deleteServer_clicked(); + void on_editServer_clicked(); + void on_upServer_clicked(); + void on_downServer_clicked(); - private: - Ui::NetworksSettingsPage ui; +private: + Ui::NetworksSettingsPage ui; - NetworkId currentId; - QHash networkInfos; - bool _ignoreWidgetChanges; + NetworkId currentId; + QHash networkInfos; + bool _ignoreWidgetChanges; - QPixmap connectedIcon, connectingIcon, disconnectedIcon; + QPixmap connectedIcon, connectingIcon, disconnectedIcon; - void reset(); - bool testHasChanged(); - QListWidgetItem *insertNetwork(NetworkId); - QListWidgetItem *insertNetwork(const NetworkInfo &info); - QListWidgetItem *networkItem(NetworkId) const; - void saveToNetworkInfo(NetworkInfo &); + void reset(); + bool testHasChanged(); + QListWidgetItem *insertNetwork(NetworkId); + QListWidgetItem *insertNetwork(const NetworkInfo &info); + QListWidgetItem *networkItem(NetworkId) const; + void saveToNetworkInfo(NetworkInfo &); }; diff --git a/src/qtui/simplenetworkeditor.cpp b/src/qtui/simplenetworkeditor.cpp new file mode 100644 index 00000000..a185e62b --- /dev/null +++ b/src/qtui/simplenetworkeditor.cpp @@ -0,0 +1,133 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * 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. * + ***************************************************************************/ + +#include "simplenetworkeditor.h" + +#include "iconloader.h" + +#include "networkssettingspage.h" + +SimpleNetworkEditor::SimpleNetworkEditor(QWidget *parent) + : QWidget(parent) +{ + ui.setupUi(this); + + ui.addServer->setIcon(SmallIcon("list-add")); + ui.deleteServer->setIcon(SmallIcon("edit-delete")); + ui.editServer->setIcon(SmallIcon("configure")); + ui.upServer->setIcon(SmallIcon("go-up")); + ui.downServer->setIcon(SmallIcon("go-down")); + + connect(ui.networkNameEdit, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); + connect(ui.channelList, SIGNAL(textChanged()), this, SIGNAL(widgetHasChanged())); +} + +void SimpleNetworkEditor::setWidgetStates() { + if(ui.serverList->selectedItems().count()) { + ui.editServer->setEnabled(true); + ui.deleteServer->setEnabled(true); + ui.upServer->setEnabled(ui.serverList->currentRow() > 0); + ui.downServer->setEnabled(ui.serverList->currentRow() < ui.serverList->count() - 1); + } else { + ui.editServer->setEnabled(false); + ui.deleteServer->setEnabled(false); + ui.upServer->setEnabled(false); + ui.downServer->setEnabled(false); + } +} + +void SimpleNetworkEditor::displayNetworkInfo(const NetworkInfo &networkInfo) { + _networkInfo = networkInfo; + + ui.serverList->clear(); + foreach(Network::Server server, _networkInfo.serverList) { + QListWidgetItem *item = new QListWidgetItem(QString("%1:%2").arg(server.host).arg(server.port)); + if(server.useSsl) + item->setIcon(SmallIcon("document-encrypt")); + ui.serverList->addItem(item); + } + + ui.networkNameEdit->setText(_networkInfo.networkName); + setWidgetStates(); +} + +void SimpleNetworkEditor::saveToNetworkInfo(NetworkInfo &networkInfo) { + _networkInfo.networkName = ui.networkNameEdit->text(); + networkInfo = _networkInfo; +} + +QStringList SimpleNetworkEditor::defaultChannels() const { + return ui.channelList->toPlainText().split("\n", QString::SkipEmptyParts); +} + +void SimpleNetworkEditor::setDefaultChannels(const QStringList &channels) { + ui.channelList->setPlainText(channels.join("\n")); +} + +void SimpleNetworkEditor::on_serverList_itemSelectionChanged() { + setWidgetStates(); +} + +void SimpleNetworkEditor::on_addServer_clicked() { + ServerEditDlg dlg(Network::Server(), this); + if(dlg.exec() == QDialog::Accepted) { + _networkInfo.serverList.append(dlg.serverData()); + displayNetworkInfo(_networkInfo); + ui.serverList->setCurrentRow(ui.serverList->count() - 1); + emit widgetHasChanged(); + } +} + +void SimpleNetworkEditor::on_editServer_clicked() { + int cur = ui.serverList->currentRow(); + ServerEditDlg dlg(_networkInfo.serverList[cur], this); + if(dlg.exec() == QDialog::Accepted) { + _networkInfo.serverList[cur] = dlg.serverData(); + displayNetworkInfo(_networkInfo); + ui.serverList->setCurrentRow(cur); + emit widgetHasChanged(); + } +} + +void SimpleNetworkEditor::on_deleteServer_clicked() { + int cur = ui.serverList->currentRow(); + _networkInfo.serverList.removeAt(cur); + displayNetworkInfo(_networkInfo); + ui.serverList->setCurrentRow(qMin(cur, ui.serverList->count() - 1)); + emit widgetHasChanged(); +} + +void SimpleNetworkEditor::on_upServer_clicked() { + int cur = ui.serverList->currentRow(); + Network::Server server = _networkInfo.serverList.takeAt(cur); + _networkInfo.serverList.insert(cur - 1, server); + displayNetworkInfo(_networkInfo); + ui.serverList->setCurrentRow(cur - 1); + emit widgetHasChanged(); +} + +void SimpleNetworkEditor::on_downServer_clicked() { + int cur = ui.serverList->currentRow(); + Network::Server server = _networkInfo.serverList.takeAt(cur); + _networkInfo.serverList.insert(cur + 1, server); + displayNetworkInfo(_networkInfo); + ui.serverList->setCurrentRow(cur + 1); + emit widgetHasChanged(); +} diff --git a/src/qtui/simplenetworkeditor.h b/src/qtui/simplenetworkeditor.h new file mode 100644 index 00000000..d4130609 --- /dev/null +++ b/src/qtui/simplenetworkeditor.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2005-08 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * 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. * + ***************************************************************************/ + +#ifndef SIMPLENETWORKEDITOR_H +#define SIMPLENETWORKEDITOR_H + +#include "ui_simplenetworkeditor.h" + +#include "network.h" + +class SimpleNetworkEditor : public QWidget { + Q_OBJECT + +public: + SimpleNetworkEditor(QWidget *parent = 0); + + void displayNetworkInfo(const NetworkInfo &networkInfo); + void saveToNetworkInfo(NetworkInfo &networkInfo); + + QStringList defaultChannels() const; + void setDefaultChannels(const QStringList &channels); + +signals: + void widgetHasChanged(); + +private slots: + // code duplication from settingspages/networkssettingspage.{h|cpp} + void on_serverList_itemSelectionChanged(); + void on_addServer_clicked(); + void on_deleteServer_clicked(); + void on_editServer_clicked(); + void on_upServer_clicked(); + void on_downServer_clicked(); + + void setWidgetStates(); + +private: + Ui::SimpleNetworkEditor ui; + + NetworkInfo _networkInfo; +}; + +#endif //SIMPLENETWORKEDITOR_H diff --git a/src/qtui/ui/simplenetworkeditor.ui b/src/qtui/ui/simplenetworkeditor.ui new file mode 100644 index 00000000..2c4c62ae --- /dev/null +++ b/src/qtui/ui/simplenetworkeditor.ui @@ -0,0 +1,262 @@ + + SimpleNetworkEditor + + + + 0 + 0 + 467 + 413 + + + + + 0 + 0 + + + + + + + + + + + + Networkname: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Servers + + + + + + + 1 + 0 + + + + + 170 + 16777215 + + + + + + + + + + + 0 + 0 + + + + &Edit... + + + + ../settingspages../settingspages + + + + + + + + 0 + 0 + + + + &Add... + + + + :/16x16/actions/oxygen/16x16/actions/list-add.png:/16x16/actions/oxygen/16x16/actions/list-add.png + + + + + + + + 0 + 0 + + + + De&lete + + + + :/16x16/actions/oxygen/16x16/actions/edit-delete.png:/16x16/actions/oxygen/16x16/actions/edit-delete.png + + + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + Move upwards in list + + + ... + + + + :/16x16/actions/oxygen/16x16/actions/go-up.png:/16x16/actions/oxygen/16x16/actions/go-up.png + + + + + + + Move downwards in list + + + ... + + + + :/16x16/actions/oxygen/16x16/actions/go-down.png:/16x16/actions/oxygen/16x16/actions/go-down.png + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Channels + + + + + + + 170 + 16777215 + + + + + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + Enter a list of channels you want to join after the IRC connection has been established. + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + -- 2.20.1