/***************************************************************************
- * Copyright (C) 2005-2015 by the Quassel Project *
+ * Copyright (C) 2005-2020 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "simplenetworkeditor.h"
-#include <QIcon>
-
+#include "icon.h"
#include "networkssettingspage.h"
-SimpleNetworkEditor::SimpleNetworkEditor(QWidget *parent)
+SimpleNetworkEditor::SimpleNetworkEditor(QWidget* parent)
: QWidget(parent)
{
ui.setupUi(this);
- ui.addServer->setIcon(QIcon::fromTheme("list-add"));
- ui.deleteServer->setIcon(QIcon::fromTheme("edit-delete"));
- ui.editServer->setIcon(QIcon::fromTheme("configure"));
- ui.upServer->setIcon(QIcon::fromTheme("go-up"));
- ui.downServer->setIcon(QIcon::fromTheme("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()) {
}
}
-
-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(QIcon::fromTheme("document-encrypt"));
+ item->setIcon(icon::get("document-encrypt"));
ui.serverList->addItem(item);
}
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);
}
}
-
void SimpleNetworkEditor::on_editServer_clicked()
{
int cur = ui.serverList->currentRow();
}
}
-
void SimpleNetworkEditor::on_deleteServer_clicked()
{
int cur = ui.serverList->currentRow();
emit widgetHasChanged();
}
-
void SimpleNetworkEditor::on_upServer_clicked()
{
int cur = ui.serverList->currentRow();
emit widgetHasChanged();
}
-
void SimpleNetworkEditor::on_downServer_clicked()
{
int cur = ui.serverList->currentRow();