2 * MainApp.h - Media Player for the Haiku Operating System
4 * Copyright (C) 2006 Marcus Overhagen <marcus@overhagen.de>
5 * Copyright (C) 2008 Stephan Aßmus <superstippi@gmx.de>
7 * Released under the terms of the MIT license.
13 #include <Application.h>
20 M_NEW_PLAYER
= 'nwpl',
21 M_PLAYER_QUIT
= 'plqt',
24 M_SHOW_OPEN_PANEL
= 'swop',
25 M_SHOW_SAVE_PANEL
= 'swsp',
26 // "target" - This BMessenger will be sent the result message.
27 // "message" - This message will be sent back to the target, with
28 // the additional fields that a BFilePanel provides.
29 // If no result message is specified, the constants below
31 // "title" - String that will be used to name the panel window.
32 // "label" - String that will be used to name the Default button.
34 M_OPEN_PANEL_RESULT
= 'oprs',
35 M_SAVE_PANEL_RESULT
= 'sprs',
37 M_OPEN_PREVIOUS_PLAYLIST
= 'oppp',
39 M_URL_RECEIVED
= 'urrc'
43 #define NAME "MediaPlayer"
50 class MainApp
: public BApplication
{
55 MainWin
* NewWindow(BMessage
* message
= NULL
);
56 int32
PlayerCount() const;
59 virtual bool QuitRequested();
60 virtual void ReadyToRun();
61 virtual void RefsReceived(BMessage
* message
);
62 virtual void ArgvReceived(int32 argc
, char** argv
);
63 virtual void MessageReceived(BMessage
* message
);
66 void _ShowSettingsWindow();
67 void _BroadcastMessage(const BMessage
& message
);
69 void _ShowOpenFilePanel(const BMessage
* message
);
70 void _ShowSaveFilePanel(const BMessage
* message
);
71 void _ShowFilePanel(BFilePanel
* panel
,
72 uint32 command
, const BMessage
* message
,
73 const char* defaultTitle
,
74 const char* defaultLabel
);
76 void _HandleOpenPanelResult(
77 const BMessage
* message
);
78 void _HandleSavePanelResult(
79 const BMessage
* message
);
80 void _HandleFilePanelResult(BFilePanel
* panel
,
81 const BMessage
* message
);
83 void _StoreCurrentPlaylist(
84 const BMessage
* message
) const;
85 status_t
_RestoreCurrentPlaylist(
86 BMessage
* message
) const;
88 void _InstallPlaylistMimeType();
92 SettingsWindow
* fSettingsWindow
;
94 BFilePanel
* fOpenFilePanel
;
95 BFilePanel
* fSaveFilePanel
;
96 entry_ref fLastFilePanelFolder
;
98 bool fAudioWindowFrameSaved
;
99 bigtime_t fLastSavedAudioWindowCreationTime
;
102 extern MainApp
* gMainApp
;
103 extern const char* kAppSig
;
105 #endif // __MAIN_APP_H