[X2Go-Commits] [x2goclient] 01/01: {{configdialog, onmainwindow}.cpp, x2goutils.{cpp, h}}: new helper functions show_XQuartz_not_found_error(), show_XQuartz_start_error() and show_XQuartz_generic_error().

git-admin at x2go.org git-admin at x2go.org
Mon Apr 27 23:23:22 CEST 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit 4a7c05b2f45e04fae93e2709670ba238c461ae14
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Apr 27 23:22:13 2015 +0200

    {{configdialog,onmainwindow}.cpp,x2goutils.{cpp,h}}: new helper functions show_XQuartz_not_found_error(), show_XQuartz_start_error() and show_XQuartz_generic_error().
    
    The first two are calling the latter one.
    
    Replace previous messages in configdialog.cpp and onmainwindow.cpp with
    the helpers, because they are supposed to pop up a dialog showing almost
    the same message.
---
 debian/changelog     |    6 ++++++
 src/configdialog.cpp |   19 +------------------
 src/onmainwindow.cpp |    5 +----
 src/x2goutils.cpp    |   40 ++++++++++++++++++++++++++++++++++++++++
 src/x2goutils.h      |    6 ++++++
 5 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 88d8266..2f34680 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -338,6 +338,12 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low
       PULSE_CLIENTCONFIG setting once more.
     - {macbuild,res/osxbundle/postbuild}.sh: add support for git information
       if not building from a tag. Also includes build date.
+    - {{configdialog,onmainwindow}.cpp,x2goutils.{cpp,h}}: new helper
+      functions show_XQuartz_not_found_error(), show_XQuartz_start_error() and
+      show_XQuartz_generic_error(). The first two are calling the latter one.
+      Replace previous messages in configdialog.cpp and onmainwindow.cpp with
+      the helpers, because they are supposed to pop up a dialog showing almost
+      the same message.
 
   [ Fernando Pedemonte ]
   * New upstream release (4.0.4.0):
diff --git a/src/configdialog.cpp b/src/configdialog.cpp
index e4e932a..b58ca27 100644
--- a/src/configdialog.cpp
+++ b/src/configdialog.cpp
@@ -536,24 +536,7 @@ void ConfigDialog::slot_findXDarwin ()
     QString version;
     QString path = findXDarwin (version);
     if (path.isEmpty ()) {
-        show_RichText_WarningMsgBox (tr ("x2goclient could not find any suitable X11 Server."),
-                                     tr ("MacPorts users, please install either the port <b>xorg-server</b>\n"
-                                         "or the port <b>xorg-server-devel</b>.\n"
-                                         "Upon successful installation, please follow the instructions printed\n"
-                                         "by the port utility to autostart/load the server.\n\n"
-
-                                         "All other users, please obtain and install XQuartz from:\n"
-
-                                         "<center><a href=\"https://xquartz.macosforge.org/\">"
-                                             "https://xquartz.macosforge.org/"
-                                         "</a></center>\n\n"
-
-                                         "Afterwards, restart x2goclient and\n"
-                                         "select the correct path to the X11 application.\n"
-                                         "This will most likely be\n"
-                                         "<center><b>/Applications/MacPorts/X11.app</b></center>\n"
-                                         "or\n"
-                                         "<center><b>/Applications/Utilities/XQuartz.app</b></center>"));
+      show_XQuartz_not_found_error ();
     }
     else {
         QString minVer = "2.1.0";
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index b497444..a661ed1 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -8727,10 +8727,7 @@ QString ONMainWindow::getXDisplay()
         }
     }
     // And if not, error out.
-    QMessageBox::critical (
-        this,tr ( "Can't connect to X server\nPlease check your settings" ),
-        tr (
-            "Can't start X server\nPlease check your settings" ) );
+    show_XQuartz_start_error ();
     slotConfig();
     return QString::null;
 }
diff --git a/src/x2goutils.cpp b/src/x2goutils.cpp
index 60b437b..c1d7b0b 100644
--- a/src/x2goutils.cpp
+++ b/src/x2goutils.cpp
@@ -147,3 +147,43 @@ bool font_is_monospaced (const QFont &font) {
   const QFontInfo font_info (font);
   return (font_info.fixedPitch ());
 }
+
+#ifdef Q_OS_DARWIN
+void show_XQuartz_not_found_error () {
+  show_XQuartz_generic_error (tr ("X2Go Client could not find any suitable X11 server."),
+                              QString ());
+}
+
+void show_XQuartz_start_error () {
+  show_XQuartz_generic_error (tr ("X2Go Client could not start X11 server."),
+                              tr ("X2Go Client requires XQuartz to be installed.\n\n"
+                                  "If XQuartz is already installed on your system,\n"
+                                  "please select the correct path in the now upcoming dialog.\n"
+                                  "Refer to the end of this message for path examples,\n"
+                                  "in case you do not know the exact location yourself.\n\n"
+                                  "Should you have <b>not</b> installed XQuartz yet, please\n"
+                                  "follow the outlined steps:\n\n"));
+}
+
+void show_XQuartz_generic_error (const QString &main_error, const QString &additional_info) {
+  show_RichText_WarningMsgBox (main_error,
+                               additional_info +
+                               tr ("MacPorts users, please install either the port <b>xorg-server</b>\n"
+                                   "or the port <b>xorg-server-devel</b>.\n"
+                                   "Upon successful installation, please follow the instructions printed\n"
+                                   "by the port utility to autostart/load the server.\n\n"
+
+                                   "All other users, please obtain and install XQuartz from:\n"
+
+                                   "<center><a href=\"https://xquartz.macosforge.org/\">"
+                                       "https://xquartz.macosforge.org/"
+                                   "</a></center>\n\n"
+
+                                   "Afterwards, restart X2Go Client and select the correct path\n"
+                                   "to the X11 application in the general X2Go Client settings.\n"
+                                   "This will most likely be\n"
+                                   "<center><b>/Applications/MacPorts/X11.app</b></center>\n"
+                                   "or\n"
+                                   "<center><b>/Applications/Utilities/XQuartz.app</b></center>"));
+}
+#endif /* defined (Q_OS_DARWIN) */
diff --git a/src/x2goutils.h b/src/x2goutils.h
index 8b3f3ea..b90ac50 100644
--- a/src/x2goutils.h
+++ b/src/x2goutils.h
@@ -37,4 +37,10 @@ QString git_changelog_extract_commit_sha (const QString &gitlog);
 
 bool font_is_monospaced (const QFont &font);
 
+#ifdef Q_OS_DARWIN
+void show_XQuartz_not_found_error ();
+void show_XQuartz_start_error ();
+void show_XQuartz_generic_error (const QString &main_error, const QString &additional_info);
+#endif /* defined (Q_OS_DARWIN) */
+
 #endif /* !defined (X2GOUTILS_H) */

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list