X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fcoresessionwidget.cpp;h=545a9f0f1b74b1ee67cf6622c3b1fa017dac4422;hp=29f323e1afd78bc6806dd0baa1e7bb3e6af96194;hb=edc55b1f86cf613a332eeeb5d85537a54120dfa5;hpb=41a136e99bffde8e203fb1abff7c9affbbb16a8b diff --git a/src/qtui/coresessionwidget.cpp b/src/qtui/coresessionwidget.cpp index 29f323e1..545a9f0f 100644 --- a/src/qtui/coresessionwidget.cpp +++ b/src/qtui/coresessionwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2019 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,18 +18,18 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include "coresessionwidget.h" + #include #include "client.h" -#include "coresessionwidget.h" #include "util.h" - -CoreSessionWidget::CoreSessionWidget(QWidget *parent) +CoreSessionWidget::CoreSessionWidget(QWidget* parent) : QWidget(parent) { ui.setupUi(this); - connect(ui.disconnectButton, SIGNAL(released()), this, SLOT(disconnectClicked())); + connect(ui.disconnectButton, &QPushButton::released, this, &CoreSessionWidget::onDisconnectClicked); } void CoreSessionWidget::setData(QMap map) @@ -41,11 +41,9 @@ void CoreSessionWidget::setData(QMap map) ui.labelVersionDate->setText(QString("%1").arg(tr("Unknown date"))); } else { - ui.labelVersionDate->setText(tryFormatUnixEpoch(map["clientVersionDate"].toString(), - Qt::DateFormat::DefaultLocaleShortDate)); + ui.labelVersionDate->setText(tryFormatUnixEpoch(map["clientVersionDate"].toString(), Qt::DateFormat::DefaultLocaleShortDate)); } - ui.labelUptime->setText(map["connectedSince"].toDateTime() - .toLocalTime().toString(Qt::DateFormat::DefaultLocaleShortDate)); + ui.labelUptime->setText(map["connectedSince"].toDateTime().toLocalTime().toString(Qt::DateFormat::DefaultLocaleShortDate)); if (map["location"].toString().isEmpty()) { ui.labelLocation->hide(); ui.labelLocationTitle->hide(); @@ -57,7 +55,8 @@ void CoreSessionWidget::setData(QMap map) // Both client and core support it, enable the button ui.disconnectButton->setEnabled(true); ui.disconnectButton->setToolTip(tr("End the client's session, disconnecting it")); - } else { + } + else { // For any active sessions to be displayed, the core must support this feature. We can // assume the client doesn't support being remotely disconnected. // @@ -68,17 +67,17 @@ void CoreSessionWidget::setData(QMap map) ui.disconnectButton->setEnabled(false); // Assuming the client lacks support, set the tooltip accordingly ui.disconnectButton->setToolTip( - QString("

%1

%2

").arg( - tr("End the client's session, disconnecting it"), - tr("This client does not support being remotely disconnected"))); + QString("

%1

%2

") + .arg(tr("End the client's session, disconnecting it"), tr("This client does not support being remotely disconnected"))); } bool success = false; _peerId = map["id"].toInt(&success); - if (!success) _peerId = -1; + if (!success) + _peerId = -1; } -void CoreSessionWidget::disconnectClicked() +void CoreSessionWidget::onDisconnectClicked() { // Don't allow the End Session button to be spammed; Quassel's protocol isn't lossy and it // should reach the destination eventually...