xref: /haiku/src/apps/mediaconverter/MediaConverterWindow.h (revision 204dee708a999d5a71d0cb9497650ee7cef85d0a)
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 BMediaFile;
19 class BMenuField;
20 class BSlider;
21 class BStringView;
22 class BTextControl;
23 class MediaFileInfoView;
24 class MediaFileListView;
25 class StatusView;
26 
27 class MediaConverterWindow : public BWindow {
28 public:
29 								MediaConverterWindow(BRect frame);
30 	virtual						~MediaConverterWindow();
31 
32 protected:
33 	virtual void				MessageReceived(BMessage* message);
34 	virtual bool				QuitRequested();
35 
36 public:
37 			void				LanguageChanged();
38 
39 			void				BuildFormatMenu();
40 			void				BuildAudioVideoMenus();
41 			void				GetSelectedFormatInfo(
42 									media_file_format** _format,
43 									media_codec_info** _audio,
44 									media_codec_info** _video);
45 
46 			void				SetStatusMessage(const char *message);
47 			void				SetFileMessage(const char *message);
48 
49 			bool				AddSourceFile(BMediaFile* file,
50 									const entry_ref& ref);
51 			void				RemoveSourceFile(int32 index);
52 			int32				CountSourceFiles();
53 			status_t			GetSourceFileAt(int32 index, BMediaFile** _file,
54 									entry_ref* ref);
55 
56 			void				SourceFileSelectionChanged();
57 
58 			void				SetEnabled(bool enabled, bool convertEnabled);
59 			bool				IsEnabled();
60 
61 			const char*			StartDuration() const;
62 			const char*			EndDuration() const;
63 
64 			int32				AudioQuality() const
65 									{ return fAudioQuality; }
66 			int32				VideoQuality() const
67 									{ return fVideoQuality; }
68 
69 			void				SetAudioQualityLabel(const char* label);
70 			void				SetVideoQualityLabel(const char* label);
71 
72 			BDirectory			OutputDirectory() const;
73 
74 private:
75 			void				_UpdateLabels();
76 			void				_UpdateBBoxLayoutInsets(BBox* box);
77 			void				_CreateMenu();
78 			void				_DestroyMenu();
79 			void				_SetOutputFolder(BEntry entry);
80 
81 private:
82 			BButton*			fConvertButton;
83 
84 			BButton*			fDestButton;
85 			BButton*			fPreviewButton;
86 			BBox*				fSourcesBox;
87 			BBox*				fInfoBox;
88 			BBox*				fOutputBox;
89 
90 			BMenuBar*			fMenuBar;
91 			BMenuField*			fFormatMenu;
92 			BMenuField*			fVideoMenu;
93 			BMenuField*			fAudioMenu;
94 			BStringView*		fFileStatus;
95 			BStringView*		fStatus;
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