hrev49581 adds 1 changeset to branch 'master'
old head: 9a36e655d71c73c317a02ee1c16185970d77abb4
new head: d9971ae7aace9f9a3fd44558ebb64c706ce3bf11
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=d9971ae7aace+%5E9a36e655d71c
----------------------------------------------------------------------------
d9971ae7aace: Media: Show alert while media services restart
[ Dario Casalinuovo <b.vitruvio@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev49581
Commit: d9971ae7aace9f9a3fd44558ebb64c706ce3bf11
URL: http://cgit.haiku-os.org/haiku/commit/?id=d9971ae7aace
Author: Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
Date: Wed Aug 26 14:35:18 2015 UTC
----------------------------------------------------------------------------
2 files changed, 18 insertions(+), 8 deletions(-)
src/preferences/media/MediaWindow.cpp | 24 ++++++++++++++++--------
src/preferences/media/MediaWindow.h | 2 ++
----------------------------------------------------------------------------
diff --git a/src/preferences/media/MediaWindow.cpp
b/src/preferences/media/MediaWindow.cpp
index 30ab051..7efd90d 100644
--- a/src/preferences/media/MediaWindow.cpp
+++ b/src/preferences/media/MediaWindow.cpp
@@ -12,7 +12,6 @@
#include <stdio.h>
-#include <Alert.h>
#include <Application.h>
#include <Autolock.h>
#include <Button.h>
@@ -185,7 +184,8 @@ MediaWindow::MediaWindow(BRect frame)
fVideoInputs(5, true),
fVideoOutputs(5, true),
fInitCheck(B_OK),
- fRestartThread(-1)
+ fRestartThread(-1),
+ fRestartAlert(NULL)
{
_InitWindow();
@@ -307,13 +307,16 @@
MediaWindow::UpdateOutputListItem(MediaListItem::media_type type,
bool
MediaWindow::QuitRequested()
{
- status_t exit = B_OK;
if (fRestartThread > 0) {
- wait_for_thread(fRestartThread, &exit);
- if (exit != B_OK) {
- fprintf(stderr, "MediaWindow::QuitRequested
wait_for_thread"
- " returned with an error: %s\n",
strerror(exit));
- }
+ BString text(B_TRANSLATE("Quitting Media now will stop"
+ "restarting the media services. Flaky or unavailable
media"
+ "functionality is likely the result."));
+
+ fRestartAlert = new BAlert(B_TRANSLATE("Warning!"), text,
+ B_TRANSLATE("Quit anyway"), NULL, NULL,
+ B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
+
+ fRestartAlert->Go();
}
// Stop watching the MediaRoster
fCurrentNode.SetTo(NULL);
@@ -658,6 +661,11 @@ MediaWindow::_RestartMediaServices(void* data)
shutdown_media_server();
launch_media_server();
+ if (window->fRestartAlert != NULL
+ && window->fRestartAlert->Lock()) {
+ window->fRestartAlert->Quit();
+ }
+
return window->PostMessage(ML_RESTART_THREAD_FINISHED);
}
diff --git a/src/preferences/media/MediaWindow.h
b/src/preferences/media/MediaWindow.h
index 5d75867..a9390bf 100644
--- a/src/preferences/media/MediaWindow.h
+++ b/src/preferences/media/MediaWindow.h
@@ -10,6 +10,7 @@
#define MEDIA_WINDOW_H
+#include <Alert.h>
#include <ListView.h>
#include <MediaAddOn.h>
#include <ParameterWeb.h>
@@ -109,6 +110,7 @@ private:
status_t fInitCheck;
thread_id fRestartThread;
+ BAlert* fRestartAlert;
};