This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit a77b1494e96388ed725e2b16037ab5321deb65aa Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Mon May 11 11:25:55 2020 -0500 Display state of broker connection in status bar. --- debian/changelog | 1 + src/httpbrokerclient.cpp | 8 ++++++++ src/onmainwindow.cpp | 28 ++++++++++++++++++++++++---- src/onmainwindow.h | 1 + 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index dc66d51..9625ac9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ x2goclient (4.1.2.3-0x2go1) UNRELEASED; urgency=medium - Set correct aspect ratio for x2go and ON logos. - Download alternative resource files from http server. - Support for PNG background images. + - Display state of broker connection in status bar. [ Ryan Schmidt ] * New upstream version (4.1.2.3): diff --git a/src/httpbrokerclient.cpp b/src/httpbrokerclient.cpp index 2589f5f..da08fed 100644 --- a/src/httpbrokerclient.cpp +++ b/src/httpbrokerclient.cpp @@ -37,6 +37,7 @@ #include <QTemporaryFile> #include <QInputDialog> #include "InteractionDialog.h" +#include <QStatusBar> HttpBrokerClient::HttpBrokerClient ( ONMainWindow* wnd, ConfigFile* cfg ) @@ -414,12 +415,14 @@ void HttpBrokerClient::slotEventSent(bool success, QString answer, int) if(!success) { x2goDebug<<answer; + mainWindow->setBrokerStatus(tr("Disconnected from broker: ")+answer, true); QMessageBox::critical(0,tr("Error"),answer); emit fatalHttpError(); return; } if(!checkAccess(answer)) return; + mainWindow->setBrokerStatus(tr("Connected to broker")); x2goDebug<<"event sent:"<<answer; if(answer.indexOf("SUSPEND")!=-1) { @@ -591,8 +594,12 @@ void HttpBrokerClient::slotListSessions(bool success, QString answer, int) emit fatalHttpError(); return; } + if(!checkAccess(answer)) return; + + mainWindow->setBrokerStatus(tr("Connected to broker")); + createIniFile(answer); emit sessionsLoaded(); } @@ -632,6 +639,7 @@ void HttpBrokerClient::slotRequestFinished ( QNetworkReply* reply ) if(reply->error() != QNetworkReply::NoError) { x2goDebug<<"Broker HTTP request failed with error: "<<reply->errorString(); + mainWindow->setBrokerStatus(tr("Disconnected from broker: ")+reply->errorString(), true); if(reply == eventRequest) { reply->deleteLater(); diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index fd8c46c..e61a631 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -316,6 +316,9 @@ void ONMainWindow::initUI() trayIconInit(); + if(brokerMode) + statusBar()->show(); + if ( embedMode ) { @@ -1101,6 +1104,7 @@ void ONMainWindow::slotGetBrokerAuth() config.brokerAuthenticated = false; bBrokerLogout->setEnabled (false); + statusBar()->showMessage(config.brokerurl); if(config.brokerUser.length()>0) { login->setText(config.brokerUser); @@ -1112,6 +1116,17 @@ void ONMainWindow::slotGetBrokerAuth() slotSessEnter(); } +void ONMainWindow::setBrokerStatus(const QString& text, bool error) +{ + QPalette p=statusBar()->palette(); + if(error) + p.setColor(QPalette::WindowText, QColor(204,54,54)); + else + p.setColor(QPalette::WindowText, QColor(22,103,39)); + statusBar()->setPalette(p); + statusBar()->showMessage(text); +} + void ONMainWindow::trayIconInit() { @@ -7032,8 +7047,11 @@ void ONMainWindow::setStatStatus ( QString status ) } if ( !embedMode || !proxyWinEmbedded ) { - statusBar()->showMessage ( ""); - statusBar()->hide(); + if(!brokerMode) + { + statusBar()->showMessage ( ""); + statusBar()->hide(); + } QString srv; if ( brokerMode ) { @@ -13024,7 +13042,8 @@ void ONMainWindow::slotEmbedToolBar() statusLabel=new QLabel; stb->addWidget ( statusLabel ); #ifndef Q_OS_WIN - statusBar()->hide(); + if(!brokerMode) + statusBar()->hide(); #endif } else @@ -13195,7 +13214,8 @@ QSize ONMainWindow::getEmbedAreaSize() statusBar()->show(); QSize sz=bgFrame->size(); // sz.setHeight(sz.height()-statusBar()->size().height()); - statusBar()->hide(); + if(!brokerMode) + statusBar()->hide(); return sz; } diff --git a/src/onmainwindow.h b/src/onmainwindow.h index fec31de..b2ebae6 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -570,6 +570,7 @@ public: void setEmbedSessionActionsEnabled ( bool enable ); bool startSshd (key_types key_type = RSA_KEY_TYPE); QSize getEmbedAreaSize(); + void setBrokerStatus(const QString& text, bool error=false); #ifdef Q_OS_WIN static QString cygwinPath ( const QString& winPath ); void startXOrg(std::size_t start_offset = 0); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git