[X2Go-Commits] [x2goclient] 162/197: src/pulsemanager.{cpp, h}: port to new debugging feature.

git-admin at x2go.org git-admin at x2go.org
Thu Jun 30 23:53:33 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 7c3821230570b7019ab8554d18923a0a71401ffe
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat May 7 03:02:26 2016 +0200

    src/pulsemanager.{cpp,h}: port to new debugging feature.
---
 debian/changelog     |    1 +
 src/pulsemanager.cpp |   69 +++++++++++++++++++++-----------------------------
 src/pulsemanager.h   |   11 +-------
 3 files changed, 31 insertions(+), 50 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f62828b..e2ec75f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -300,6 +300,7 @@ x2goclient (4.0.5.2-0x2go1) UNRELEASED; urgency=medium
     - src/pulsemanager.cpp: hide Windows-only code behind #ifdefs. Otherwise
       we'll get compile failures on non-Windows platforms.
     - src/pulsemanager.{cpp,h}: add debugging setter and private variable.
+    - src/pulsemanager.{cpp,h}: port to new debugging feature.
   * debian/control:
     - Maintainer change in package: X2Go Developers <x2go-dev at lists.x2go.org>.
     - Uploaders: add myself. Also, force a rebuild due to the changed
diff --git a/src/pulsemanager.cpp b/src/pulsemanager.cpp
index 6fe8418..ed841eb 100644
--- a/src/pulsemanager.cpp
+++ b/src/pulsemanager.cpp
@@ -24,11 +24,6 @@
 #include "pulsemanager.h"
 #include "x2gologdebug.h"
 
-#ifndef DEBUG
-#define DEBUG_UNDEF
-#define DEBUG
-#endif // defined (NDEBUG)
-
 PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()),
                                 pulse_X2Go_ ("/.x2go/pulse"),
                                 server_binary_ (QString ("")),
@@ -144,10 +139,10 @@ void PulseManager::start_generic () {
     connect (pulse_server_, SIGNAL (finished (int)),
              this,          SLOT (slot_on_pulse_finished (int)));
 
-#ifdef DEBUG
-    // Give PA a little time to come up.
-    QTimer::singleShot (3000, this, SLOT (slot_play_startup_sound ()));
-#endif // defined (DEBUG)
+    if (debug_) {
+      // Give PA a little time to come up.
+      QTimer::singleShot (3000, this, SLOT (slot_play_startup_sound ()));
+    }
   }
 }
 
@@ -163,11 +158,11 @@ void PulseManager::start_osx () {
                         + QString::number (pulse_version_minor_)
                         + "/modules").absolutePath ()
                << "--high-priority";
-#ifdef DEBUG
-  server_args_ << "--log-level=debug"
-               << "--verbose"
-               << "--log-target=file:" + pulse_dir_.absolutePath () + "/pulse.log";
-#endif // defined (DEBUG)
+  if (debug_) {
+    server_args_ << "--log-level=debug"
+                 << "--verbose"
+                 << "--log-target=file:" + pulse_dir_.absolutePath () + "/pulse.log";
+  }
 
   if (generate_server_config () && generate_client_config ()) {
     cleanup_client_dir ();
@@ -191,12 +186,11 @@ void PulseManager::start_win () {
                                                           + "."
                                                           + QString::number (pulse_version_minor_)
                                                           + "/modules/").absolutePath ());
-#ifdef DEBUG
-  /* FIXME: need a way to request debugging. */
-  server_args_ << "--log-level=debug"
-               << "--verbose"
-               << "--log-target=file:" + pulse_dir_.absolutePath () + "\\pulse.log";
-#endif // defined (DEBUG)
+  if (debug_) {
+    server_args_ << "--log-level=debug"
+                 << "--verbose"
+                 << "--log-target=file:" + pulse_dir_.absolutePath () + "\\pulse.log";
+  }
 
   /*
    * Fix for x2goclient bug #526.
@@ -550,27 +544,27 @@ void PulseManager::create_client_dir () {
 }
 
 void PulseManager::slot_play_startup_sound () {
-#ifdef DEBUG
-  QProcess play_file (0);
-  QString play_file_binary (app_dir_);
-  QString play_file_file (play_file_binary);
+  if (!debug_) {
+    QProcess play_file (0);
+    QString play_file_binary (app_dir_);
+    QString play_file_file (play_file_binary);
 
 #ifdef Q_OS_DARWIN
-  play_file_binary += "/../exe/paplay";
-  play_file_file += "/../Resources/startup.wav";
+    play_file_binary += "/../exe/paplay";
+    play_file_file += "/../Resources/startup.wav";
 #elif defined (Q_OS_WIN)
-  playFileBinary += "/pulse/paplay.exe";
-  playFileFile += "/startup.wav";
+    playFileBinary += "/pulse/paplay.exe";
+    playFileFile += "/startup.wav";
 #endif // defined (Q_OS_DARWIN)
 
-  QStringList args (play_file_file);
-  play_file.setWorkingDirectory (server_working_dir_);
-  play_file.setProcessEnvironment (env_);
-  play_file.start (play_file_binary, args);
+    QStringList args (play_file_file);
+    play_file.setWorkingDirectory (server_working_dir_);
+    play_file.setProcessEnvironment (env_);
+    play_file.start (play_file_binary, args);
 
-  if (play_file.waitForStarted ())
-    play_file.waitForFinished ();
-#endif // defined (DEBUG)
+    if (play_file.waitForStarted ())
+      play_file.waitForFinished ();
+  }
 }
 
 void PulseManager::on_pulse_finished (int exit_code) {
@@ -714,8 +708,3 @@ void PulseManager::restart () {
 QProcess::ProcessState PulseManager::state () {
   return (state_);
 }
-
-#ifdef DEBUG_UNDEF
-#undef DEBUG
-#undef DEBUG_UNDEF
-#endif // defined (DEBUG_UNDEF)
diff --git a/src/pulsemanager.h b/src/pulsemanager.h
index 1d06de0..9d6cec5 100644
--- a/src/pulsemanager.h
+++ b/src/pulsemanager.h
@@ -20,11 +20,6 @@
 #ifndef PULSEMANAGER_H
 #define PULSEMANAGER_H
 
-#ifdef NDEBUG
-#define NDEBUG_DEFINE
-#undef NDEBUG
-#endif // defined (NDEBUG)
-
 #include <iostream>
 #include <QDir>
 #include <QTcpSocket>
@@ -121,12 +116,8 @@ class PulseManager: public QObject {
 
     bool record_;
     bool playback_;
+
     bool debug_;
 };
 
-#ifdef NDEBUG_DEFINE
-#define NDEBUG
-#undef NDEBUG_DEFINE
-#endif // defined (NDEBUG_DEFINE)
-
 #endif // PULSEMANAGER_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