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 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * version 2 as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 * 20 */ 21 #ifndef __MAIN_APP_H 22 #define __MAIN_APP_H 23 24 25 #include <Application.h> 26 #include <Entry.h> 27 28 #include "MainWin.h" 29 30 31 enum { 32 M_NEW_PLAYER = 'nwpl', 33 M_PLAYER_QUIT = 'plqt', 34 M_SETTINGS = 'stng', 35 36 M_SHOW_OPEN_PANEL = 'swop', 37 M_SHOW_SAVE_PANEL = 'swsp', 38 // "target" - This BMessenger will be sent the result message. 39 // "message" - This message will be sent back to the target, with 40 // the additional fields that a BFilePanel provides. 41 // If no result message is specified, the constants below 42 // will be used. 43 // "title" - String that will be used to name the panel window. 44 // "label" - String that will be used to name the Default button. 45 46 M_OPEN_PANEL_RESULT = 'oprs', 47 M_SAVE_PANEL_RESULT = 'sprs', 48 49 M_OPEN_PREVIOUS_PLAYLIST = 'oppp', 50 51 M_URL_RECEIVED = 'urrc' 52 }; 53 54 55 #define NAME "MediaPlayer" 56 57 58 class BFilePanel; 59 class SettingsWindow; 60 61 62 class MainApp : public BApplication { 63 public: 64 MainApp(); 65 virtual ~MainApp(); 66 67 MainWin* NewWindow(BMessage* message = NULL); 68 int32 PlayerCount() const; 69 70 private: 71 virtual bool QuitRequested(); 72 virtual void ReadyToRun(); 73 virtual void RefsReceived(BMessage* message); 74 virtual void ArgvReceived(int32 argc, char** argv); 75 virtual void MessageReceived(BMessage* message); 76 77 private: 78 void _ShowSettingsWindow(); 79 void _BroadcastMessage(const BMessage& message); 80 81 void _ShowOpenFilePanel(const BMessage* message); 82 void _ShowSaveFilePanel(const BMessage* message); 83 void _ShowFilePanel(BFilePanel* panel, 84 uint32 command, const BMessage* message, 85 const char* defaultTitle, 86 const char* defaultLabel); 87 88 void _HandleOpenPanelResult( 89 const BMessage* message); 90 void _HandleSavePanelResult( 91 const BMessage* message); 92 void _HandleFilePanelResult(BFilePanel* panel, 93 const BMessage* message); 94 95 void _StoreCurrentPlaylist( 96 const BMessage* message) const; 97 status_t _RestoreCurrentPlaylist( 98 BMessage* message) const; 99 100 void _InstallPlaylistMimeType(); 101 102 private: 103 int32 fPlayerCount; 104 SettingsWindow* fSettingsWindow; 105 106 BFilePanel* fOpenFilePanel; 107 BFilePanel* fSaveFilePanel; 108 entry_ref fLastFilePanelFolder; 109 110 bool fAudioWindowFrameSaved; 111 bigtime_t fLastSavedAudioWindowCreationTime; 112 }; 113 114 extern MainApp* gMainApp; 115 extern const char* kAppSig; 116 117 #endif // __MAIN_APP_H 118