This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit b60fa91f82aae683922abf83afad03ebcb81548f Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Thu Apr 21 11:43:24 2022 +0200 Add splash screen option when starting in hidden mode. --- debian/changelog | 1 + src/help.cpp | 3 ++- src/onmainwindow.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++++ src/onmainwindow.h | 5 +++++ src/onmainwindow_privat.h | 2 +- 5 files changed, 57 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 36c46fe..d62e590 100644 --- a/debian/changelog +++ b/debian/changelog @@ -39,6 +39,7 @@ x2goclient (4.1.2.3-0x2go1) UNRELEASED; urgency=medium - Support for OPENSSH PRIVATE KEY format sent from broker. - Do not show client in broker mode if startet in "hidden" mode. - Enable/Disable session view buttons inside of sessions explorer. + - Add splash screen option when starting in hidden mode. [ Ryan Schmidt ] * New upstream version (4.1.2.3): diff --git a/src/help.cpp b/src/help.cpp index eeebab1..3dc3b8d 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -168,7 +168,8 @@ help::params_t help::build_params () { ADD_OPT ("--broker-logoutbt", QT_TRANSLATE_NOOP ("Help", "Enables broker logout button.")); ADD_OPT ("--background=<svg-file|dir>", QT_TRANSLATE_NOOP ("Help", "Use a custom/branded background image (SVG format) for X2Go Client's main window. If a directory is given, will randomly pick an SVG file inside of it.")); ADD_OPT ("--branding=<svg-file>", QT_TRANSLATE_NOOP ("Help", "Use a custom icon (SVG format) for additional branding to replace the default in the lower left corner of X2Go Client's main window.")); -#if defined (Q_OS_WIN) + ADD_OPT ("--splash=<pixmap-file>", QT_TRANSLATE_NOOP ("Help", "Show splash screen if starting in hidden mode using specified pixmap file.")); + #if defined (Q_OS_WIN) ADD_OPT ("--xserver-start-limit=<num>", QT_TRANSLATE_NOOP ("Help", "Limit the X.Org Server start count to at most <num> tries. Default: \"3\"." NEWLINE "If <num> is zero or a negative number, no limit is imposed." NEWLINE "The limits for <num> are platform dependent. If the passed value is out of bounds, X2Go Client falls back to the default value.")); diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 9be99d4..4f9e53a 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -136,6 +136,7 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) changeBrokerPass=false; resumeAfterSuspending=false; forceToShowTrayicon=false; + splash=0; /* Initialize at least these variables before they get filled via loadSettings() * They have to be initialized as they are used in closeEvent() and closeClient()... @@ -284,6 +285,32 @@ ONMainWindow::~ONMainWindow() x2goDebug<<"Finished destructor hooks for X2Go Client's main window."; } +void ONMainWindow::initSplash() +{ + if(!startHidden) + return; + if(splashPix.length()<1) + return; + QPixmap px(splashPix); + if(px.isNull()) + { + x2goDebug<<"Can't load "<<splashPix<<" not showing splash screen"; + return; + } + splash=new QSplashScreen(px, Qt::WindowStaysOnTopHint); + splash->show(); +} + +void ONMainWindow::destroySplash() +{ + if(splash) + { + splash->close(); + delete splash; + splash=0; + } +} + void ONMainWindow::initUI() { @@ -300,6 +327,8 @@ void ONMainWindow::initUI() } #endif + initSplash(); + if ( ONMainWindow::portable ) { if ( portableDataPath.length() <=0 ) @@ -1138,6 +1167,10 @@ void ONMainWindow::setBrokerStatus(const QString& text, bool error) p.setColor(QPalette::WindowText, QColor(22,103,39)); statusBar()->setPalette(p); statusBar()->showMessage(text); + if(splash) + { + splash->showMessage(text, Qt::AlignLeft|Qt::AlignBottom, Qt::white); + } } @@ -1425,6 +1458,7 @@ void ONMainWindow::slotResize ( const QSize sz ) void ONMainWindow::closeClient() { + destroySplash(); x2goInfof(6)<<tr("Closing X2Go Client ..."); if(trayIcon) trayIcon->hide(); @@ -2394,6 +2428,7 @@ void ONMainWindow::slotReadSessions() if ( !defaultSession&& startHidden ) { startHidden=false; + destroySplash(); slotResize(); show(); activateWindow(); @@ -2455,6 +2490,7 @@ void ONMainWindow::slotReadSessions() if ( !sfound && startHidden ) { startHidden=false; + destroySplash(); slotResize(); show(); activateWindow(); @@ -2954,6 +2990,7 @@ void ONMainWindow::slotSelectedFromList ( SessionButton* session ) if ( startHidden && nopass==false && (!brokerMode) ) { startHidden=false; + destroySplash(); slotResize(); show(); activateWindow(); @@ -3277,6 +3314,7 @@ void ONMainWindow::slotSshServerAuthError ( int error, QString sshMessage, SshMa if ( startHidden ) { startHidden=false; + destroySplash(); slotResize(); show(); activateWindow(); @@ -6878,6 +6916,7 @@ void ONMainWindow::slotProxyStderr() sendEventToBroker(CONNECTED); } setStatStatus ( tr ( "running" ) ); + destroySplash(); if (trayEnabled) { if (!useLdap) @@ -7264,6 +7303,10 @@ void ONMainWindow::setStatStatus ( QString status ) } sessionStatusDlg->hide(); } + if(splash) + { + splash->showMessage(status, Qt::AlignLeft|Qt::AlignBottom, Qt::white); + } } @@ -8156,6 +8199,11 @@ bool ONMainWindow::parseParameter ( QString param ) config.brokerurl=value; return true; } + if( setting == "--splash") + { + splashPix=value; + return true; + } if ( setting == "--broker-cacertfile") { config.brokerCaCertFile=expandHome(value); diff --git a/src/onmainwindow.h b/src/onmainwindow.h index b69b4ea..f84ff26 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -80,6 +80,7 @@ class InteractionDialog; class QNetworkAccessManager; class QNetworkReply; class SessionExplorer; +class QSplashScreen; struct user { int uin; @@ -600,6 +601,8 @@ private: bool startMaximized; bool closeDisconnect; bool startHidden; + QString splashPix; + QSplashScreen* splash; bool keepTrayIcon; bool hideFolderSharing; bool brokerNoauthWithSessionUsername; @@ -943,6 +946,8 @@ private: QString suspendTerminateSessionFromBroker; void initUI(); + void initSplash(); + void destroySplash(); void sendEventToBroker(client_events ev); void suspendFromBroker(const QString& sid); void terminateFromBroker(const QString& sid); diff --git a/src/onmainwindow_privat.h b/src/onmainwindow_privat.h index 3a4ba82..dd22134 100644 --- a/src/onmainwindow_privat.h +++ b/src/onmainwindow_privat.h @@ -40,7 +40,7 @@ #include <QVBoxLayout> #include <QHBoxLayout> #include <QFile> - +#include <QSplashScreen> #include "httpbrokerclient.h" #include <QTimer> #include <QComboBox> -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git