repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / mediaplayer / MainApp.h
blobcbede30a2ccbdfc4a706d330e72636b983c436a3
1 /*
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.
8 */
9 #ifndef __MAIN_APP_H
10 #define __MAIN_APP_H
13 #include <Application.h>
14 #include <Entry.h>
16 #include "MainWin.h"
19 enum {
20 M_NEW_PLAYER = 'nwpl',
21 M_PLAYER_QUIT = 'plqt',
22 M_SETTINGS = 'stng',
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
30 // will be used.
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"
46 class BFilePanel;
47 class SettingsWindow;
50 class MainApp : public BApplication {
51 public:
52 MainApp();
53 virtual ~MainApp();
55 MainWin* NewWindow(BMessage* message = NULL);
56 int32 PlayerCount() const;
58 private:
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);
65 private:
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();
90 private:
91 int32 fPlayerCount;
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