X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fcoreconnectionstatuswidget.cpp;h=cce95520c9c53969c989c94c70990e21ae9a769d;hp=4ce89c09a402171b3130a8abee73bea0a0fbe3c2;hb=HEAD;hpb=921e54680da16fcf2adb7a90506875aceb6633a4 diff --git a/src/qtui/coreconnectionstatuswidget.cpp b/src/qtui/coreconnectionstatuswidget.cpp index 4ce89c09..2617c8c1 100644 --- a/src/qtui/coreconnectionstatuswidget.cpp +++ b/src/qtui/coreconnectionstatuswidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 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 * @@ -20,34 +20,32 @@ #include "coreconnectionstatuswidget.h" -#include - #include "client.h" +#include "icon.h" #include "signalproxy.h" -CoreConnectionStatusWidget::CoreConnectionStatusWidget(CoreConnection *connection, QWidget *parent) - : QWidget(parent), - _coreConnection(connection) +CoreConnectionStatusWidget::CoreConnectionStatusWidget(CoreConnection* connection, QWidget* parent) + : QWidget(parent) + , _coreConnection(connection) { ui.setupUi(this); ui.lagLabel->hide(); ui.sslLabel->hide(); update(); - connect(coreConnection(), SIGNAL(progressTextChanged(QString)), ui.messageLabel, SLOT(setText(QString))); - connect(coreConnection(), SIGNAL(progressValueChanged(int)), ui.progressBar, SLOT(setValue(int))); - connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), ui.progressBar, SLOT(setRange(int, int))); - connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), this, SLOT(progressRangeChanged(int, int))); + connect(coreConnection(), &CoreConnection::progressTextChanged, ui.messageLabel, &QLabel::setText); + connect(coreConnection(), &CoreConnection::progressValueChanged, ui.progressBar, &QProgressBar::setValue); + connect(coreConnection(), &CoreConnection::progressRangeChanged, ui.progressBar, &QProgressBar::setRange); + connect(coreConnection(), &CoreConnection::progressRangeChanged, this, &CoreConnectionStatusWidget::progressRangeChanged); - connect(coreConnection(), SIGNAL(stateChanged(CoreConnection::ConnectionState)), SLOT(connectionStateChanged(CoreConnection::ConnectionState))); - connect(coreConnection(), SIGNAL(connectionError(QString)), ui.messageLabel, SLOT(setText(QString))); - connect(coreConnection(), SIGNAL(lagUpdated(int)), SLOT(updateLag(int))); + connect(coreConnection(), &CoreConnection::stateChanged, this, &CoreConnectionStatusWidget::connectionStateChanged); + connect(coreConnection(), &CoreConnection::connectionError, ui.messageLabel, &QLabel::setText); + connect(coreConnection(), &CoreConnection::lagUpdated, this, &CoreConnectionStatusWidget::updateLag); } - void CoreConnectionStatusWidget::update() { - CoreConnection *conn = coreConnection(); + CoreConnection* conn = coreConnection(); if (conn->progressMaximum() >= 0) { ui.progressBar->setMinimum(conn->progressMinimum()); ui.progressBar->setMaximum(conn->progressMaximum()); @@ -60,7 +58,6 @@ void CoreConnectionStatusWidget::update() ui.messageLabel->setText(conn->progressText()); } - void CoreConnectionStatusWidget::updateLag(int msecs) { if (msecs >= 0) { @@ -75,16 +72,15 @@ void CoreConnectionStatusWidget::updateLag(int msecs) } } - void CoreConnectionStatusWidget::connectionStateChanged(CoreConnection::ConnectionState state) { if (state >= CoreConnection::Connected) { if (coreConnection()->isEncrypted()) { - ui.sslLabel->setPixmap(QIcon::fromTheme("security-high").pixmap(16)); + ui.sslLabel->setPixmap(icon::get("security-high").pixmap(16)); ui.sslLabel->setToolTip(tr("The connection to your core is encrypted with SSL.")); } else { - ui.sslLabel->setPixmap(QIcon::fromTheme("security-low").pixmap(16)); + ui.sslLabel->setPixmap(icon::get("security-low").pixmap(16)); ui.sslLabel->setToolTip(tr("The connection to your core is not encrypted.")); } ui.sslLabel->show(); @@ -93,7 +89,6 @@ void CoreConnectionStatusWidget::connectionStateChanged(CoreConnection::Connecti ui.sslLabel->hide(); } - void CoreConnectionStatusWidget::progressRangeChanged(int min, int max) { Q_UNUSED(min)