xref: /haiku/src/apps/mediaconverter/MediaConverterWindow.h (revision 93a78ecaa45114d68952d08c4778f073515102f2)
1 // Copyright 1999, Be Incorporated. All Rights Reserved.
2 // Copyright 2000-2004, Jun Suzuki. All Rights Reserved.
3 // Copyright 2007, Stephan Aßmus. All Rights Reserved.
4 // This file may be used under the terms of the Be Sample Code License.
5 #ifndef MEDIA_CONVERTER_WINDOW_H
6 #define MEDIA_CONVERTER_WINDOW_H
7 
8 
9 #include <Directory.h>
10 #include <MediaDefs.h>
11 #include <MediaFormats.h>
12 #include <Window.h>
13 
14 
15 class BBox;
16 class BButton;
17 class BFilePanel;
18 class BMenuField;
19 class BSlider;
20 class BStringView;
21 class BTextControl;
22 class MediaFileInfoView;
23 class MediaFileListView;
24 class StatusView;
25 
26 class MediaConverterWindow : public BWindow {
27 	public:
28 								MediaConverterWindow(BRect frame);
29 	virtual						~MediaConverterWindow();
30 
31 	protected:
32 //	virtual void				DispatchMessage(BMessage* message,
33 //									BHandler* handler);
34 	virtual void				MessageReceived(BMessage* message);
35 	virtual bool				QuitRequested();
36 
37 	public:
38 			void				LanguageChanged();
39 
40 			void				BuildFormatMenu();
41 			void				BuildAudioVideoMenus();
42 			void				GetSelectedFormatInfo(
43 									media_file_format** _format,
44 									media_codec_info** _audio,
45 									media_codec_info** _video);
46 
47 			void				SetStatusMessage(const char *message);
48 			void				SetFileMessage(const char *message);
49 
50 			void				AddSourceFile(BMediaFile* file,
51 									const entry_ref& ref);
52 			void				RemoveSourceFile(int32 index);
53 			int32				CountSourceFiles();
54 			status_t			GetSourceFileAt(int32 index, BMediaFile** _file,
55 									entry_ref* ref);
56 
57 			void				SourceFileSelectionChanged();
58 
59 			void				SetEnabled(bool enabled, bool convertEnabled);
60 			bool				IsEnabled();
61 
62 			const char*			StartDuration() const;
63 			const char*			EndDuration() const;
64 
65 			int32				AudioQuality() const
66 									{ return fAudioQuality; }
67 			int32				VideoQuality() const
68 									{ return fVideoQuality; }
69 
70 			void				SetAudioQualityLabel(const char* label);
71 			void				SetVideoQualityLabel(const char* label);
72 
73 			BDirectory			OutputDirectory() const;
74 
75 	private:
76 			void				_UpdateLabels();
77 			void				_CreateMenu();
78 			void				_DestroyMenu();
79 			void				_SetOutputFolder(BEntry entry);
80 
81 			media_format		fDummyFormat;
82 			BButton*			fConvertButton;
83 
84 			BButton*			fDestButton;
85 			BButton*			fPreviewButton;
86 			BBox*				fBox1;
87 			BBox*				fBox2;
88 			BBox*				fBox3;
89 
90 			BMenuBar*			fMenuBar;
91 			BMenuField*			fFormatMenu;
92 			BMenuField*			fVideoMenu;
93 			BMenuField*			fAudioMenu;
94 			StatusView*			fStatusView;
95 			StatusView*			fStatusView2;
96 			MediaFileListView*	fListView;
97 			MediaFileInfoView*	fInfoView;
98 			BStringView*		fOutputFolder;
99 			BTextControl*		fStartDurationTC;
100 			BTextControl*		fEndDurationTC;
101 
102 			BSlider*			fVideoQualitySlider;
103 			BSlider*			fAudioQualitySlider;
104 
105 			int32				fVideoQuality;
106 			int32				fAudioQuality;
107 
108 			BFilePanel*			fSaveFilePanel;
109 			BFilePanel*			fOpenFilePanel;
110 
111 			BDirectory			fOutputDir;
112 			bool				fOutputDirSpecified;
113 
114 			bool				fEnabled;
115 			bool				fConverting;
116 			bool				fCancelling;
117 };
118 
119 #endif // MEDIA_CONVERTER_WINDOW_H
120 
121 
122