X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fcoresessionwidget.cpp;h=f3f987db0ff7dc68f769254dfb929d817a5e08b2;hp=2cce145916aa6429207a8bbec4d5003fcaba6123;hb=91c69d07871f2c081f8eb7d5e199b7997070f185;hpb=9ef86f499753853c3751aee7da54d186837a5161 diff --git a/src/qtui/coresessionwidget.cpp b/src/qtui/coresessionwidget.cpp index 2cce1459..f3f987db 100644 --- a/src/qtui/coresessionwidget.cpp +++ b/src/qtui/coresessionwidget.cpp @@ -1,33 +1,58 @@ +/*************************************************************************** + * Copyright (C) 2005-2016 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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include + +#include "client.h" #include "coresessionwidget.h" -#include -#include -#include -#include -#include -#include CoreSessionWidget::CoreSessionWidget(QWidget *parent) : QWidget(parent) { ui.setupUi(this); - layout()->setContentsMargins(0, 0, 0, 0); - layout()->setSpacing(0); + connect(ui.disconnectButton, SIGNAL(released()), this, SLOT(disconnectClicked())); } void CoreSessionWidget::setData(QMap map) { - QLabel *iconSecure = ui.iconSecure; - QPushButton *disconnectButton = ui.disconnectButton; - - ui.labelRemoteAddress->setText(map["remoteAddress"].toString()); + ui.sessionGroup->setTitle(map["remoteAddress"].toString()); ui.labelLocation->setText(map["location"].toString()); ui.labelClient->setText(map["clientVersion"].toString()); ui.labelVersionDate->setText(map["clientVersionDate"].toString()); - ui.labelUptime - ->setText(map["connectedSince"].toDateTime().toLocalTime().toString(Qt::DateFormat::SystemLocaleShortDate)); + ui.labelUptime->setText(map["connectedSince"].toDateTime().toLocalTime().toString(Qt::DateFormat::SystemLocaleShortDate)); if (map["location"].toString().isEmpty()) { ui.labelLocation->hide(); ui.labelLocationTitle->hide(); } + ui.labelSecure->setText(map["secure"].toBool() ? tr("Yes") : tr("No")); + + auto features = Quassel::Features(map["features"].toInt()); + ui.disconnectButton->setVisible(features.testFlag(Quassel::Feature::RemoteDisconnect)); + + bool success = false; + _peerId = map["id"].toInt(&success); + if (!success) _peerId = -1; +} + +void CoreSessionWidget::disconnectClicked() +{ + emit disconnectClicked(_peerId); }