[X2Go-Commits] [x2goclient] 07/07: src/pulsemanager.cpp: add error message boxes throughout PulseManager.
git-admin at x2go.org
git-admin at x2go.org
Wed Jun 22 03:15:54 CEST 2016
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch bugfix/osx
in repository x2goclient.
commit 5198af66896c8b6af24f41a64449c0a1c859f6a0
Author: Mihai Moldovan <ionic at ionic.de>
Date: Wed Jun 22 03:14:20 2016 +0200
src/pulsemanager.cpp: add error message boxes throughout PulseManager.
Don't just abort () the program.
---
debian/changelog | 2 ++
src/pulsemanager.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 0a573f2..52d0769 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -345,6 +345,8 @@ x2goclient (4.0.5.2-0x2go1) UNRELEASED; urgency=medium
required.
- src/x2goutils.{cpp,h}: add application modality parameter to
show_RichText_Generic_MsgBox () and its wrappers.
+ - src/pulsemanager.cpp: add error message boxes throughout PulseManager.
+ Don't just abort () the program.
* debian/control:
- Maintainer change in package: X2Go Developers <x2go-dev at lists.x2go.org>.
diff --git a/src/pulsemanager.cpp b/src/pulsemanager.cpp
index 9ec2da8..1cb7a7e 100644
--- a/src/pulsemanager.cpp
+++ b/src/pulsemanager.cpp
@@ -21,14 +21,13 @@
#include <stdlib.h>
#include <QSysInfo>
-#if QT_VERSION < 0x050000
-#include "x2goutils.h"
-#else /* QT_VERSION < 0x050000 */
+#if QT_VERSION >= 0x050000
#include <QStandardPaths>
-#endif /* QT_VERSION < 0x050000 */
+#endif /* QT_VERSION >= 0x050000 */
#include "pulsemanager.h"
#include "x2gologdebug.h"
+#include "x2goutils.h"
PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
pulse_X2Go_ ("/.x2go/pulse"),
@@ -83,6 +82,13 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
if (server_binary_.isEmpty ()) {
x2goErrorf (29) << "Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories.";
+ show_RichText_ErrorMsgBox (tr ("Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories."),
+ tr ("If you downloaded the bundled, pre-compiled version from the official home page, "
+ "please report a bug on:\n"
+ "<center><a href=\"https://wiki.x2go.org/doku.php/wiki:bugs\">"
+ "https://wiki.x2go.org/doku.php/wiki:bugs"
+ "</a></center>\n"),
+ true);
abort ();
}
else {
@@ -114,6 +120,13 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
if (server_binary_.isEmpty ()) {
x2goErrorf (28) << "Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories.";
+ show_RichText_ErrorMsgBox (tr ("Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories."),
+ tr ("If you downloaded the bundled, pre-compiled version from the official home page, "
+ "please report a bug on:\n"
+ "<center><a href=\"https://wiki.x2go.org/doku.php/wiki:bugs\">"
+ "https://wiki.x2go.org/doku.php/wiki:bugs"
+ "</a></center>\n"),
+ true);
abort ();
}
}
@@ -150,6 +163,9 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
for (buf = ptr = NULL; ptr == NULL; path_len += 20) {
if (NULL == (buf = realloc (buf, path_len))) {
x2goErrorf (16) << "Could not allocate buffer for getting current working directory!";
+ show_RichText_ErrorMsgBox (tr ("Could not allocate buffer for getting current working directory!"),
+ QString (),
+ true);
abort ();
}
@@ -157,7 +173,11 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
ptr = getcwd (buf, path_len);
if ((NULL == ptr) && (ERANGE != erange)) {
- x2goErrorf (17) << "getcwd() failed: " << QString (strerror (errno));
+ int saved_errno = errno;
+ x2goErrorf (17) << "getcwd() failed: " << QString (strerror (saved_errno));
+ show_RichText_ErrorMsgBox (tr ("getcwd() failed!"),
+ QString (strerror (saved_errno)),
+ true);
abort ();
}
}
@@ -365,6 +385,9 @@ void PulseManager::fetch_pulseaudio_version () {
if (!convert_success) {
x2goErrorf (20) << "Unable to convert major version number string to integer.";
+ show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"),
+ tr ("Unable to convert major version number string to integer."),
+ true);
abort ();
}
@@ -372,6 +395,10 @@ void PulseManager::fetch_pulseaudio_version () {
}
else {
x2goErrorf (21) << "Unexpected character found when parsing version string for major version number: '" << QString (*cit) << "'.";
+ show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"),
+ tr ("Unexpected character found when parsing version string for major version number")
+ + ": '" + QString (*cit) + "'.",
+ true);
abort ();
}
}
@@ -390,6 +417,9 @@ void PulseManager::fetch_pulseaudio_version () {
if (!convert_success) {
x2goErrorf (22) << "Unable to convert minor version number string to integer.";
+ show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"),
+ tr ("Unable to convert minor version number string to integer."),
+ true);
abort ();
}
@@ -405,6 +435,10 @@ void PulseManager::fetch_pulseaudio_version () {
}
else {
x2goErrorf (23) << "Unexpected character found when parsing version string for minor version number: '" << QString (*cit) << "'.";
+ show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"),
+ tr ("Unexpected character found when parsing version string for minor version number")
+ + ": '" + QString (*cit) + "'.",
+ true);
abort ();
}
}
@@ -420,6 +454,9 @@ void PulseManager::fetch_pulseaudio_version () {
if (!convert_success) {
x2goErrorf (24) << "Unable to convert micro version number string to integer.";
+ show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"),
+ tr ("Unable to convert micro version number string to integer."),
+ true);
abort ();
}
@@ -427,6 +464,10 @@ void PulseManager::fetch_pulseaudio_version () {
}
else {
x2goErrorf (25) << "Unexpected character found when parsing version string for micro version number: '" << QString (*cit) << "'.";
+ show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"),
+ tr ("Unexpected character found when parsing version string for micro version number")
+ + ": '" + QString (*cit) + "'.",
+ true);
abort ();
}
}
@@ -452,11 +493,17 @@ void PulseManager::fetch_pulseaudio_version () {
if (!found) {
x2goErrorf (19) << "Unable to fetch PulseAudio version - unexpected format. Exiting.";
+ show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"),
+ tr ("Unexpected format encountered."),
+ true);
abort ();
}
}
else {
x2goErrorf (18) << "Unable to start PulseAudio to fetch its version number. Exiting.";
+ show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"),
+ tr ("Unable to start PulseAudio binary."),
+ true);
abort ();
}
}
--
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