This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit bea0a60fe79eeeb244f3e6d9af20b30e4478fc65 Author: Walid Moghrabi <w.moghrabi@servicemagic.eu> Date: Fri Aug 18 08:44:20 2017 +0200 {src/{help.cpp,onmainwindow.{cpp,h}},man/man1/x2goclient.1}: let --background take a directory and randomly pick an SVG file in there. Fixes: #1165. --- debian/changelog | 6 ++++++ man/man1/x2goclient.1 | 3 ++- src/help.cpp | 2 +- src/onmainwindow.cpp | 16 ++++++++++++++++ src/onmainwindow.h | 1 + 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8ce225f..652c1ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -225,6 +225,12 @@ x2goclient (4.1.0.1-0x2go1) UNRELEASED; urgency=medium - {src/{help.cpp,onmainwindow.{cpp,h}},man/man1/x2goclient.1}: add new --branding option that replaces the seal logo. Fixes: #1162. + [ Walid Moghrabi ] + * New upstream version (4.1.0.1): + - {src/{help.cpp,onmainwindow.{cpp,h}},man/man1/x2goclient.1}: let + --background take a directory and randomly pick an SVG file in there. + Fixes: #1165. + -- X2Go Release Manager <git-admin@x2go.org> Wed, 22 Feb 2017 07:13:10 +0100 x2goclient (4.1.0.0-0x2go1) unstable; urgency=medium diff --git a/man/man1/x2goclient.1 b/man/man1/x2goclient.1 index d90a888..f58c32c 100644 --- a/man/man1/x2goclient.1 +++ b/man/man1/x2goclient.1 @@ -94,9 +94,10 @@ The support information is provided via a simple HTML file. Example: .RE .\} .TP -\*(T<\fB\-\-background=<svg-file>\fR\*(T> +\*(T<\fB\-\-background=<svg-file|dir>\fR\*(T> Use a custom/branded background image (SVG format) for X2Go Client's main window (i.e. replace the blue gradient area in X2Go Client by some background of your own (business/workgroup/project). +If a directory is given, will randomly pick an SVG file inside of it. .TP \*(T<\fB\-\-branding=<svg-file>\fR\*(T> Use a custom icon (SVG format) for additional branding to replace the default in the lower left corner of X2Go Client's main window. diff --git a/src/help.cpp b/src/help.cpp index d83f856..f6cf50b 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -158,7 +158,7 @@ help::params_t help::build_params () { ADD_OPT ("--broker-ssh-key=<path to key>", QT_TRANSLATE_NOOP ("Help", "Sets the path to an SSH key to use for authentication against an SSH session broker. The client's behavior is undefined if this flag is used for non-SSH session brokers.")); ADD_OPT ("--broker-autologin", QT_TRANSLATE_NOOP ("Help", "Enables the use of the default SSH key or SSH agent for authentication against an SSH session broker. The client's behavior is undefined if this flag is used for non-SSH session brokers.")); ADD_OPT ("--broker-noauth", QT_TRANSLATE_NOOP ("Help", "Does not ask for user credentials during session broker authentication. This can be useful if you are using an HTTP(S) session broker without authentication. If you run an HTTP(S) server without authentication, but with user-specific profiles, then put the user name into the broker URL (refer to --broker-url.) The user name then will be extracted from the broker URL and be sent to the session broker. The client's behavior is undef [...] - ADD_OPT ("--background=<svg-file>", QT_TRANSLATE_NOOP ("Help", "Use a custom/branded background image (SVG format) for X2Go Client's main window.")); + 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.")); # undef NEWLINE diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 4829c6e..b7f65d7 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -346,6 +346,22 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) #ifndef Q_WS_HILDON + + // See if BGFile is a directory and retrieve an SVG file randomly from within + QFileInfo bg_dir(BGFile); + if (bg_dir.isDir()) + { + QDirIterator it(BGFile, QStringList() << "*.svg", QDir::Files, QDirIterator::NoIteratorFlags); + QStringList fileList; + while (it.hasNext()) + fileList << it.next(); + + qsrand(QTime::currentTime().msec()); + int max=fileList.size(); + int random_selector=qrand() % max; + BGFile=fileList.at(random_selector); + } + if (BGFile.size()) bgFrame=new SVGFrame ( ( QString ) BGFile,true,fr ); else diff --git a/src/onmainwindow.h b/src/onmainwindow.h index b8e7362..a7aa00d 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -44,6 +44,7 @@ #include <QTranslator> #include <QLocale> #include <QProcessEnvironment> +#include <QDirIterator> #include "sshmasterconnection.h" #include "non_modal_messagebox.h" -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git