X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsimplenetworkeditor.cpp;h=cdff48af102b1c382861b839521a8366851c0291;hp=22ff3a9ad6822d69d9986eb767a19c084f60ac6e;hb=HEAD;hpb=694f9bfbf7f1af19108461c7e00d133e55082bce diff --git a/src/qtui/simplenetworkeditor.cpp b/src/qtui/simplenetworkeditor.cpp index 22ff3a9a..f0c81746 100644 --- a/src/qtui/simplenetworkeditor.cpp +++ b/src/qtui/simplenetworkeditor.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-2022 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,31 +15,29 @@ * 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 "simplenetworkeditor.h" -#include "iconloader.h" - +#include "icon.h" #include "networkssettingspage.h" -SimpleNetworkEditor::SimpleNetworkEditor(QWidget *parent) +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")); + ui.addServer->setIcon(icon::get("list-add")); + ui.deleteServer->setIcon(icon::get("edit-delete")); + ui.editServer->setIcon(icon::get("configure")); + ui.upServer->setIcon(icon::get("go-up")); + ui.downServer->setIcon(icon::get("go-down")); - connect(ui.networkNameEdit, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.channelList, SIGNAL(textChanged()), this, SIGNAL(widgetHasChanged())); + connect(ui.networkNameEdit, &QLineEdit::textEdited, this, &SimpleNetworkEditor::widgetHasChanged); + connect(ui.channelList, &QTextEdit::textChanged, this, &SimpleNetworkEditor::widgetHasChanged); } - void SimpleNetworkEditor::setWidgetStates() { if (ui.serverList->selectedItems().count()) { @@ -56,16 +54,15 @@ void SimpleNetworkEditor::setWidgetStates() } } - -void SimpleNetworkEditor::displayNetworkInfo(const NetworkInfo &networkInfo) +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)); + 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")); + item->setIcon(icon::get("document-encrypt")); ui.serverList->addItem(item); } @@ -73,32 +70,27 @@ void SimpleNetworkEditor::displayNetworkInfo(const NetworkInfo &networkInfo) setWidgetStates(); } - -void SimpleNetworkEditor::saveToNetworkInfo(NetworkInfo &networkInfo) +void SimpleNetworkEditor::saveToNetworkInfo(NetworkInfo& networkInfo) { _networkInfo.networkName = ui.networkNameEdit->text(); networkInfo = _networkInfo; } - QStringList SimpleNetworkEditor::defaultChannels() const { - return ui.channelList->toPlainText().split("\n", QString::SkipEmptyParts); + return ui.channelList->toPlainText().split("\n", QString::SkipEmptyParts); } - -void SimpleNetworkEditor::setDefaultChannels(const QStringList &channels) +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); @@ -110,7 +102,6 @@ void SimpleNetworkEditor::on_addServer_clicked() } } - void SimpleNetworkEditor::on_editServer_clicked() { int cur = ui.serverList->currentRow(); @@ -123,7 +114,6 @@ void SimpleNetworkEditor::on_editServer_clicked() } } - void SimpleNetworkEditor::on_deleteServer_clicked() { int cur = ui.serverList->currentRow(); @@ -133,7 +123,6 @@ void SimpleNetworkEditor::on_deleteServer_clicked() emit widgetHasChanged(); } - void SimpleNetworkEditor::on_upServer_clicked() { int cur = ui.serverList->currentRow(); @@ -144,7 +133,6 @@ void SimpleNetworkEditor::on_upServer_clicked() emit widgetHasChanged(); } - void SimpleNetworkEditor::on_downServer_clicked() { int cur = ui.serverList->currentRow();