1 /* 2 * MainApp.h - Media Player for the Haiku Operating System 3 * 4 * Copyright (C) 2006 Marcus Overhagen <marcus@overhagen.de> 5 * Copyright (C) 2008 Stephan Aßmus <superstippi@gmx.de> 6 * 7 * Released under the terms of the MIT license. 8 */ 9 #ifndef __MAIN_APP_H 10 #define __MAIN_APP_H 11 12 13 #include <Application.h> 14 #include <Entry.h> 15 16 #include "MainWin.h" 17 18 19 enum { 20 M_NEW_PLAYER = 'nwpl', 21 M_PLAYER_QUIT = 'plqt', 22 M_SETTINGS = 'stng', 23 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. 33 34 M_OPEN_PANEL_RESULT = 'oprs', 35 M_SAVE_PANEL_RESULT = 'sprs', 36 37 M_OPEN_PREVIOUS_PLAYLIST = 'oppp', 38 39 M_URL_RECEIVED = 'urrc' 40 }; 41 42 43 #define NAME "MediaPlayer" 44 45 46 class BFilePanel; 47 class SettingsWindow; 48 49 50 class MainApp : public BApplication { 51 public: 52 MainApp(); 53 virtual ~MainApp(); 54 55 MainWin* NewWindow(BMessage* message = NULL); 56 int32 PlayerCount() const; 57 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); 64 65 private: 66 void _ShowSettingsWindow(); 67 void _BroadcastMessage(const BMessage& message); 68 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); 75 76 void _HandleOpenPanelResult( 77 const BMessage* message); 78 void _HandleSavePanelResult( 79 const BMessage* message); 80 void _HandleFilePanelResult(BFilePanel* panel, 81 const BMessage* message); 82 83 void _StoreCurrentPlaylist( 84 const BMessage* message) const; 85 status_t _RestoreCurrentPlaylist( 86 BMessage* message) const; 87 88 void _InstallPlaylistMimeType(); 89 90 private: 91 int32 fPlayerCount; 92 SettingsWindow* fSettingsWindow; 93 94 BFilePanel* fOpenFilePanel; 95 BFilePanel* fSaveFilePanel; 96 entry_ref fLastFilePanelFolder; 97 98 bool fAudioWindowFrameSaved; 99 bigtime_t fLastSavedAudioWindowCreationTime; 100 }; 101 102 extern MainApp* gMainApp; 103 extern const char* kAppSig; 104 105 #endif // __MAIN_APP_H 106