Media: Show alert while media services restart
This commit is contained in:
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <Alert.h>
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
@@ -185,7 +184,8 @@ MediaWindow::MediaWindow(BRect frame)
|
|||||||
fVideoInputs(5, true),
|
fVideoInputs(5, true),
|
||||||
fVideoOutputs(5, true),
|
fVideoOutputs(5, true),
|
||||||
fInitCheck(B_OK),
|
fInitCheck(B_OK),
|
||||||
fRestartThread(-1)
|
fRestartThread(-1),
|
||||||
|
fRestartAlert(NULL)
|
||||||
{
|
{
|
||||||
_InitWindow();
|
_InitWindow();
|
||||||
|
|
||||||
@@ -307,13 +307,16 @@ MediaWindow::UpdateOutputListItem(MediaListItem::media_type type,
|
|||||||
bool
|
bool
|
||||||
MediaWindow::QuitRequested()
|
MediaWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
status_t exit = B_OK;
|
|
||||||
if (fRestartThread > 0) {
|
if (fRestartThread > 0) {
|
||||||
wait_for_thread(fRestartThread, &exit);
|
BString text(B_TRANSLATE("Quitting Media now will stop"
|
||||||
if (exit != B_OK) {
|
"restarting the media services. Flaky or unavailable media"
|
||||||
fprintf(stderr, "MediaWindow::QuitRequested wait_for_thread"
|
"functionality is likely the result."));
|
||||||
" returned with an error: %s\n", strerror(exit));
|
|
||||||
}
|
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
|
// Stop watching the MediaRoster
|
||||||
fCurrentNode.SetTo(NULL);
|
fCurrentNode.SetTo(NULL);
|
||||||
@@ -658,6 +661,11 @@ MediaWindow::_RestartMediaServices(void* data)
|
|||||||
shutdown_media_server();
|
shutdown_media_server();
|
||||||
launch_media_server();
|
launch_media_server();
|
||||||
|
|
||||||
|
if (window->fRestartAlert != NULL
|
||||||
|
&& window->fRestartAlert->Lock()) {
|
||||||
|
window->fRestartAlert->Quit();
|
||||||
|
}
|
||||||
|
|
||||||
return window->PostMessage(ML_RESTART_THREAD_FINISHED);
|
return window->PostMessage(ML_RESTART_THREAD_FINISHED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#define MEDIA_WINDOW_H
|
#define MEDIA_WINDOW_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <Alert.h>
|
||||||
#include <ListView.h>
|
#include <ListView.h>
|
||||||
#include <MediaAddOn.h>
|
#include <MediaAddOn.h>
|
||||||
#include <ParameterWeb.h>
|
#include <ParameterWeb.h>
|
||||||
@@ -109,6 +110,7 @@ private:
|
|||||||
|
|
||||||
status_t fInitCheck;
|
status_t fInitCheck;
|
||||||
thread_id fRestartThread;
|
thread_id fRestartThread;
|
||||||
|
BAlert* fRestartAlert;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user