BAlert: play user-selected sound
* Alert sounds are separate from notifications Change-Id: I9e5545084faea354ddd339154c10b54d6479b404 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8477 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
f081c0202d
commit
64f088f495
@@ -6,6 +6,7 @@
|
||||
* Axel Dörfler, [email protected]
|
||||
* Erik Jaesler, [email protected]
|
||||
* John Scipione, [email protected]
|
||||
* Ron Ben Aroya, [email protected]
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,6 +19,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Beep.h>
|
||||
#include <Bitmap.h>
|
||||
#include <Button.h>
|
||||
#include <ControlLook.h>
|
||||
@@ -25,6 +27,7 @@
|
||||
#include <FindDirectory.h>
|
||||
#include <IconUtils.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <MediaSounds.h>
|
||||
#include <MenuField.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <Path.h>
|
||||
@@ -279,6 +282,7 @@ BAlert::Go()
|
||||
|
||||
_Prepare();
|
||||
Show();
|
||||
_PlaySound();
|
||||
|
||||
if (window != NULL) {
|
||||
status_t status;
|
||||
@@ -316,6 +320,7 @@ BAlert::Go(BInvoker* invoker)
|
||||
fInvoker = invoker;
|
||||
_Prepare();
|
||||
Show();
|
||||
_PlaySound();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -654,6 +659,26 @@ BAlert::_Prepare()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BAlert::_PlaySound()
|
||||
{
|
||||
switch (Type()) {
|
||||
case B_INFO_ALERT:
|
||||
system_beep(MEDIA_SOUNDS_INFORMATION_ALERT);
|
||||
break;
|
||||
case B_WARNING_ALERT:
|
||||
system_beep(MEDIA_SOUNDS_IMPORTANT_ALERT);
|
||||
break;
|
||||
case B_STOP_ALERT:
|
||||
system_beep(MEDIA_SOUNDS_ERROR_ALERT);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - TAlertView
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ if $(RUN_WITHOUT_APP_SERVER) != 0 {
|
||||
SetSubDirSupportedPlatforms haiku libbe_test ;
|
||||
|
||||
UseLibraryHeaders agg ;
|
||||
UsePrivateHeaders app input print interface locale shared support tracker ;
|
||||
UsePrivateHeaders app input print interface locale media shared support tracker ;
|
||||
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src kits tracker ] ;
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ MediaFilesManager::MediaFilesManager()
|
||||
} kInitialItems[] = {
|
||||
{MEDIA_TYPE_SOUNDS, MEDIA_SOUNDS_BEEP},
|
||||
{MEDIA_TYPE_SOUNDS, MEDIA_SOUNDS_STARTUP},
|
||||
{MEDIA_TYPE_SOUNDS, MEDIA_SOUNDS_INFORMATION_ALERT},
|
||||
{MEDIA_TYPE_SOUNDS, MEDIA_SOUNDS_IMPORTANT_ALERT},
|
||||
{MEDIA_TYPE_SOUNDS, MEDIA_SOUNDS_ERROR_ALERT},
|
||||
{MEDIA_TYPE_SOUNDS, MEDIA_SOUNDS_KEY_DOWN},
|
||||
{MEDIA_TYPE_SOUNDS, MEDIA_SOUNDS_KEY_REPEAT},
|
||||
{MEDIA_TYPE_SOUNDS, MEDIA_SOUNDS_KEY_UP},
|
||||
|
||||
Reference in New Issue
Block a user