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 * 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.
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.
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.
25 #include <Application.h>
32 M_NEW_PLAYER
= 'nwpl',
33 M_PLAYER_QUIT
= 'plqt',
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
43 // "title" - String that will be used to name the panel window.
44 // "label" - String that will be used to name the Default button.
46 M_OPEN_PANEL_RESULT
= 'oprs',
47 M_SAVE_PANEL_RESULT
= 'sprs',
49 M_OPEN_PREVIOUS_PLAYLIST
= 'oppp',
51 M_URL_RECEIVED
= 'urrc'
55 #define NAME "MediaPlayer"
62 class MainApp
: public BApplication
{
67 MainWin
* NewWindow(BMessage
* message
= NULL
);
68 int32
PlayerCount() const;
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
);
78 void _ShowSettingsWindow();
79 void _BroadcastMessage(const BMessage
& message
);
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
);
88 void _HandleOpenPanelResult(
89 const BMessage
* message
);
90 void _HandleSavePanelResult(
91 const BMessage
* message
);
92 void _HandleFilePanelResult(BFilePanel
* panel
,
93 const BMessage
* message
);
95 void _StoreCurrentPlaylist(
96 const BMessage
* message
) const;
97 status_t
_RestoreCurrentPlaylist(
98 BMessage
* message
) const;
100 void _InstallPlaylistMimeType();
104 SettingsWindow
* fSettingsWindow
;
106 BFilePanel
* fOpenFilePanel
;
107 BFilePanel
* fSaveFilePanel
;
108 entry_ref fLastFilePanelFolder
;
110 bool fAudioWindowFrameSaved
;
111 bigtime_t fLastSavedAudioWindowCreationTime
;
114 extern MainApp
* gMainApp
;
115 extern const char* kAppSig
;
117 #endif // __MAIN_APP_H