This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch bugfix/osx in repository x2goclient. from 2c0687a onmainwindow.cpp: adapt SSH host key warning message to new usermode sshd possibilities. new 26c86b7 configdialog.cpp: make XQuartz detection algorithm QStringList-based and add MacPorts location. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 2 ++ src/configdialog.cpp | 66 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 22 deletions(-) -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 26c86b7ffd9da900b5def2df5b145c9c74d8561f Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Mar 13 02:52:21 2015 +0100 configdialog.cpp: make XQuartz detection algorithm QStringList-based and add MacPorts location. --- debian/changelog | 2 ++ src/configdialog.cpp | 66 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/debian/changelog b/debian/changelog index 069b173..b51ab6a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -237,6 +237,8 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low allow it to come up. - onmainwindow.cpp: adapt SSH host key warning message to new usermode sshd possibilities. + - configdialog.cpp: make XQuartz detection algorithm QStringList-based and + add MacPorts location. -- X2Go Release Manager <git-admin@x2go.org> Thu, 19 Feb 2015 13:25:28 +0100 diff --git a/src/configdialog.cpp b/src/configdialog.cpp index e0c7861..e4e932a 100644 --- a/src/configdialog.cpp +++ b/src/configdialog.cpp @@ -33,6 +33,7 @@ #include "x2gologdebug.h" #include "printwidget.h" #include <QTabWidget> +#include <algorithm> #include "x2goclientconfig.h" #include "connectionwidget.h" #include "settingswidget.h" @@ -463,34 +464,55 @@ QString ConfigDialog::retMaxXDarwinVersion ( QString v1, QString v2 ) QString ConfigDialog::findXDarwin ( QString& version, QString path ) { if (path.isEmpty ()) { - QString dir1 = "/Applications/Utilities/XQuartz.app"; - QString ver1 = "0.0.0"; - if (QFile::exists (dir1 + "/Contents/Info.plist")) { - QSettings vst (dir1 + "/Contents/Info.plist", - QSettings::NativeFormat); - ver1 = vst.value ("CFBundleShortVersionString", - (QVariant) "0.0.0").toString (); + QStringList locations; + locations << "/Applications/Utilities/XQuartz.app" + << "/usr/X11/X11.app" + << "/Applications/MacPorts/X11.app"; + + QStringList versions; + + QStringList::const_iterator const_it; + for (const_it = locations.constBegin (); const_it != locations.constEnd (); ++const_it) { + QFile info_plist (*const_it + "/Contents/Info.plist"); + + if (info_plist.exists ()) { + QSettings settings (info_plist.fileName (), QSettings::NativeFormat); + versions << settings.value ("CFBundleShortVersionString", (QVariant) "0.0.0").toString (); + } + else { + versions << QString ("0.0.0"); + } } - QString dir2 = "/usr/X11/X11.app"; - QString ver2 = "0.0.0";; - if (QFile::exists (dir2 + "/Contents/Info.plist")) { - QSettings vst (dir2 + "/Contents/Info.plist", - QSettings::NativeFormat); - ver2 = vst.value ("CFBundleShortVersionString", - (QVariant) "0.0.0").toString (); + QString max_ver = QString (); + std::size_t max_idx = 0; + if (locations.size () < 1) { + version = QString ("0.0.0"); + return (QString ()); + } + else if (locations.size () == 1) { + max_ver = versions.at (0); + max_idx = 0; } - if ((ver1.compare (ver2) == 0) && - (ver1.compare (QString ("0.0.0")) == 0)) { - return (QString ()); + else { + max_ver = versions.at (0); + max_idx = 0; + for (std::size_t i = 1; i < static_cast<std::size_t> (locations.size ()); ++i) { + QString cur_ver = versions.at (i); + if (retMaxXDarwinVersion (max_ver, cur_ver).compare (cur_ver) == 0) { + max_ver = cur_ver; + max_idx = i; + } + } } - else if (retMaxXDarwinVersion (ver1, ver2) == ver1) { - version = ver1; - return dir1; + + version = max_ver; + + if (max_ver.compare (QString ("0.0.0")) == 0) { + return (QString ()); } else { - version = ver2; - return dir2; + return (locations.at (max_idx)); } } else { -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git