This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit 9128d9b24ba54890f9dfd9057c0b2f30b4daceb8 Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Mon May 15 12:34:10 2017 +0200 Windows client. - Move PulseManager MsgBox functions to main window: GUI functions should be used only from main thread. --- debian/changelog | 5 ++++- src/onmainwindow.cpp | 17 +++++++++++++++++ src/onmainwindow.h | 1 + src/pulsemanager.cpp | 32 ++++++++++++++++++-------------- src/pulsemanager.h | 3 ++- 5 files changed, 42 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index 832c740..038ae9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -159,9 +159,12 @@ x2goclient (4.1.0.1-0x2go1) UNRELEASED; urgency=medium - Interaction with SSH server (for example for changing expired password). Fixes: #592. - Fixing setting widget style issue in InteractionDialog on + Windows client. - SSH Interaction for SSH Broker and SSH Server. - SSH Iteraction for method keyboard-interactive. - Windows client. + - Move PulseManager MsgBox functions to main window: + GUI functions should be used only from main thread. + [ Robert Parts ] * New upstream version (4.1.0.1): - res/i18n/x2goclient_et.ts: update Estonian translation file. diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 3c1014e..e1d5b93 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -1522,9 +1522,12 @@ void ONMainWindow::closeClient() #if defined (Q_OS_DARWIN) || defined (Q_OS_WIN) if (pulseManager) { + disconnect(pulseManager, SIGNAL(sig_pulse_user_warning(bool, const QString&, const QString&, bool)), + this, SLOT(slotShowPAMSGDialog(bool, const QString&, const QString&, bool))); delete (pulseManager); if (pulseManagerThread) { + pulseManagerThread->quit (); pulseManagerThread->wait (); } @@ -6747,6 +6750,8 @@ void ONMainWindow::pulseManagerWrapper () { { pulseManagerThread = new QThread (0); pulseManager = new PulseManager (); + connect(pulseManager, SIGNAL(sig_pulse_user_warning(bool, const QString&, const QString&, bool)), + this, SLOT(slotShowPAMSGDialog(bool, const QString&, const QString&, bool))); pulseManager->set_debug (debugging); @@ -9073,6 +9078,18 @@ void ONMainWindow::slotScDaemonError (QProcess::ProcessError error) { trayQuit (); } +void ONMainWindow::slotShowPAMSGDialog(bool error, const QString& main_text, const QString& info_text, bool modal) +{ + if(error) + { + show_RichText_ErrorMsgBox(main_text, info_text,modal); + } + else + { + show_RichText_WarningMsgBox(main_text, info_text, modal); + } +} + void ONMainWindow::slotGpgError() { diff --git a/src/onmainwindow.h b/src/onmainwindow.h index a294d1e..9e749d3 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -1050,6 +1050,7 @@ public slots: void setFocus(); private slots: + void slotShowPAMSGDialog(bool error, const QString& main_text, const QString& info_text, bool modal); void slotSnameChanged ( const QString& ); void slotSelectedFromList ( SessionButton* session ); void slotSessEnter(); diff --git a/src/pulsemanager.cpp b/src/pulsemanager.cpp index 98ab6ee..4b144e2 100644 --- a/src/pulsemanager.cpp +++ b/src/pulsemanager.cpp @@ -146,7 +146,7 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()), for (buf = ptr = NULL; ptr == NULL; path_len += 20) { if (NULL == (buf = static_cast<char *> (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!"), + emit sig_pulse_user_warning (true, tr ("Could not allocate buffer for getting current working directory!"), QString (), true); abort (); @@ -158,7 +158,7 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()), if ((NULL == ptr) && (ERANGE != errno)) { int saved_errno = errno; x2goErrorf (17) << "getcwd() failed: " << QString (strerror (saved_errno)); - show_RichText_ErrorMsgBox (tr ("getcwd() failed!"), + emit sig_pulse_user_warning (true, tr ("getcwd() failed!"), QString (strerror (saved_errno)), true); abort (); @@ -407,7 +407,7 @@ 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!"), + emit sig_pulse_user_warning (true, tr ("Error fetching PulseAudio version number!"), tr ("Unexpected character found when parsing version string for major version number") + ": '" + QString (*cit) + "'.", true); @@ -432,7 +432,7 @@ 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!"), + emit sig_pulse_user_warning (true, tr ("Error fetching PulseAudio version number!"), tr ("Unexpected character found when parsing version string for minor version number") + ": '" + QString (*cit) + "'.", true); @@ -450,7 +450,7 @@ 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!"), + emit sig_pulse_user_warning (true, tr ("Error fetching PulseAudio version number!"), tr ("Unexpected character found when parsing version string for micro version number") + ": '" + QString (*cit) + "'.", true); @@ -465,7 +465,7 @@ void PulseManager::fetch_pulseaudio_version () { if (numbers_skip[0]) { x2goErrorf (30) << "Supposed to skip major version number. Something is wrong."; - show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"), + emit sig_pulse_user_warning (true, tr ("Error fetching PulseAudio version number!"), tr ("Supposed to skip major version number. " "Something is wrong."), true); @@ -479,7 +479,7 @@ 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!"), + emit sig_pulse_user_warning (true, tr ("Error fetching PulseAudio version number!"), tr ("Unable to convert major version number string to integer."), true); stop_processing = true; @@ -497,7 +497,7 @@ 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!"), + emit sig_pulse_user_warning (true, tr ("Error fetching PulseAudio version number!"), tr ("Unable to convert minor version number string to integer."), true); stop_processing = true; @@ -511,7 +511,7 @@ 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!"), + emit sig_pulse_user_warning (true, tr ("Error fetching PulseAudio version number!"), tr ("Unable to convert micro version number string to integer."), true); stop_processing = true; @@ -536,14 +536,14 @@ void PulseManager::fetch_pulseaudio_version () { if (!found) { x2goErrorf (19) << "Unable to fetch PulseAudio version - unexpected format."; - show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"), + emit sig_pulse_user_warning (true, tr ("Error fetching PulseAudio version number!"), tr ("Unexpected format encountered."), true); } } else { x2goErrorf (18) << "Unable to start PulseAudio to fetch its version number."; - show_RichText_ErrorMsgBox (tr ("Error fetching PulseAudio version number!"), + emit sig_pulse_user_warning (true, tr ("Error fetching PulseAudio version number!"), tr ("Unable to start PulseAudio binary."), true); } @@ -773,9 +773,13 @@ void PulseManager::slot_play_startup_sound () { } void PulseManager::slot_on_pulse_finished (int exit_code) { - if (!exit_code) + if (exit_code) + { x2goDebug << "Warning! Pulseaudio's exit code is non-zero."; + show_startup_warning(true); + } + x2goDebug << "Pulseaudio finished with code:"<<exit_code; QByteArray ba (pulse_server_->readAllStandardOutput ()); char *data = ba.data (); x2goDebug << data; @@ -916,7 +920,7 @@ QProcess::ProcessState PulseManager::state () { return (state_); } -void PulseManager::show_startup_warning (bool play_startup_sound) const { +void PulseManager::show_startup_warning (bool play_startup_sound){ QString main_text, informative_text; if (!(play_startup_sound)) { @@ -933,5 +937,5 @@ void PulseManager::show_startup_warning (bool play_startup_sound) const { "https://wiki.x2go.org/doku.php/wiki:bugs" "</a></center>\n"); - show_RichText_WarningMsgBox (main_text, informative_text, true); + emit sig_pulse_user_warning (false, main_text, informative_text, true); } diff --git a/src/pulsemanager.h b/src/pulsemanager.h index c9359d7..1472596 100644 --- a/src/pulsemanager.h +++ b/src/pulsemanager.h @@ -90,7 +90,7 @@ class PulseManager: public QObject { bool is_server_running () const; - void show_startup_warning (bool play_startup_sound = false) const; + void show_startup_warning (bool play_startup_sound = false); private slots: @@ -100,6 +100,7 @@ class PulseManager: public QObject { signals: void sig_pulse_server_terminated (); + void sig_pulse_user_warning(bool error, const QString& main_text, const QString& inf_text, bool modal); private: -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git