From: Shane Synan Date: Mon, 14 May 2018 06:00:19 +0000 (-0500) Subject: client: Fix core sessions unsupported warning X-Git-Tag: travis-deploy-test~84 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=744080e8b9e6d32aaeb3d08eaf1a576076735957 client: Fix core sessions unsupported warning Move core session supported check to CoreInfoDlg, and show a warning bar if sessions aren't supported. A "Details" button offers additional information on needing to upgrade. Older core versions didn't provide any core session information, so the individual session widgets would have never shown up. Thanks to @justjanne for reporting this. --- diff --git a/src/qtui/coreinfodlg.cpp b/src/qtui/coreinfodlg.cpp index 2f8736c1..299a94fa 100644 --- a/src/qtui/coreinfodlg.cpp +++ b/src/qtui/coreinfodlg.cpp @@ -18,6 +18,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include + #include "coreinfodlg.h" #include "client.h" @@ -30,6 +32,9 @@ CoreInfoDlg::CoreInfoDlg(QWidget *parent) : QDialog(parent) { coreInfoChanged(coreInfo->coreData()); + // Warning icon + ui.coreUnsupportedIcon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(16)); + updateUptime(); startTimer(1000); } @@ -73,6 +78,9 @@ void CoreInfoDlg::coreInfoChanged(const QVariantMap &coreInfo) { } ui.coreSessionScrollArea->setVisible(coreSessionSupported); + + // Hide the information bar when core sessions are supported + ui.coreUnsupportedWidget->setVisible(!coreSessionSupported); } @@ -102,3 +110,13 @@ void CoreInfoDlg::updateUptime() { void CoreInfoDlg::disconnectClicked(int peerId) { Client::kickClient(peerId); } + +void CoreInfoDlg::on_coreUnsupportedDetails_clicked() +{ + QMessageBox::warning(this, + tr("Active sessions unsupported"), + QString("

%1


%2

" + ).arg(tr("Your Quassel core is too old to show active sessions"), + tr("You need a Quassel core v0.13.0 or newer to view and " + "disconnect other connected clients."))); +} diff --git a/src/qtui/coreinfodlg.h b/src/qtui/coreinfodlg.h index 85a92116..15140f79 100644 --- a/src/qtui/coreinfodlg.h +++ b/src/qtui/coreinfodlg.h @@ -43,6 +43,11 @@ private slots: void updateUptime(); void disconnectClicked(int peerId); + /** + * Event handler for core unspported Details button + */ + void on_coreUnsupportedDetails_clicked(); + private: Ui::CoreInfoDlg ui; QMap _widgets; diff --git a/src/qtui/coresessionwidget.cpp b/src/qtui/coresessionwidget.cpp index d31122db..97993f4f 100644 --- a/src/qtui/coresessionwidget.cpp +++ b/src/qtui/coresessionwidget.cpp @@ -50,28 +50,19 @@ void CoreSessionWidget::setData(QMap map) ui.disconnectButton->setEnabled(true); ui.disconnectButton->setToolTip(tr("End the client's session, disconnecting it")); } 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. + // + // (During the development of 0.13, there was a period of time where active sessions existed + // but did not provide the disconnect option. We can overlook this.) + // Either core or client doesn't support it, disable the option ui.disconnectButton->setEnabled(false); - if (!Client::isCoreFeatureEnabled(Quassel::Feature::RemoteDisconnect)) { - // Until RemoteDisconnect was implemented, the Quassel core didn't forward client - // features. A client might support features and we'll never hear about it. - // This check shouldn't be necessary for later features if the core supports at least - // RemoteDisconnect. - - // Core doesn't support this feature (we don't know about the client) - ui.disconnectButton->setToolTip( - QString("

%1

%2
%3

").arg( - tr("End the client's session, disconnecting it"), - tr("Your Quassel core does not support this feature"), - tr("You need a Quassel core v0.13.0 or newer in order to end connected " - "sessions."))); - } else { - // Client doesn't support this feature - ui.disconnectButton->setToolTip( - QString("

%1

%2

").arg( - tr("End the client's session, disconnecting it"), - tr("This client does not support being remotely disconnected"))); - } + // 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"))); } bool success = false; diff --git a/src/qtui/ui/coreinfodlg.ui b/src/qtui/ui/coreinfodlg.ui index 57f24280..11b6dcd2 100644 --- a/src/qtui/ui/coreinfodlg.ui +++ b/src/qtui/ui/coreinfodlg.ui @@ -13,7 +13,7 @@ Core Information - + @@ -74,6 +74,60 @@ + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + [icon] + + + + + + + + 0 + 0 + + + + Your Quassel core is too old to show active sessions + + + + + + + Details... + + + + + + @@ -93,8 +147,8 @@ 0 0 - 550 - 187 + 546 + 161