xref: /haiku/src/apps/mediaconverter/MediaConverterWindow.h (revision ce74de863fbcf59c775b186ebcffb75029895db3)
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 // Copyright 2010-2013, Haiku, Inc. All Rights Reserved.
5 // This file may be used under the terms of the Be Sample Code License.
6 #ifndef MEDIA_CONVERTER_WINDOW_H
7 #define MEDIA_CONVERTER_WINDOW_H
8 
9 
10 #include <Directory.h>
11 #include <MediaDefs.h>
12 #include <MediaFormats.h>
13 #include <Window.h>
14 
15 
16 class BBox;
17 class BButton;
18 class BFilePanel;
19 class BMediaFile;
20 class BMenuField;
21 class BSlider;
22 class BStringView;
23 class BTextControl;
24 class MediaFileInfoView;
25 class MediaFileListView;
26 class StatusView;
27 
28 class MediaConverterWindow : public BWindow {
29 public:
30 								MediaConverterWindow(BRect frame);
31 	virtual						~MediaConverterWindow();
32 
33 protected:
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 			bool				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				_UpdateBBoxLayoutInsets(BBox* box);
78 			void				_CreateMenu();
79 			void				_DestroyMenu();
80 			void				_SetOutputFolder(BEntry entry);
81 
82 private:
83 			BButton*			fConvertButton;
84 
85 			BButton*			fDestButton;
86 			BButton*			fPreviewButton;
87 			BBox*				fSourcesBox;
88 			BBox*				fInfoBox;
89 			BBox*				fOutputBox;
90 
91 			BMenuBar*			fMenuBar;
92 			BMenuField*			fFormatMenu;
93 			BMenuField*			fVideoMenu;
94 			BMenuField*			fAudioMenu;
95 			BStringView*		fFileStatus;
96 			BStringView*		fStatus;
97 			MediaFileListView*	fListView;
98 			MediaFileInfoView*	fInfoView;
99 			BStringView*		fOutputFolder;
100 			BTextControl*		fStartDurationTC;
101 			BTextControl*		fEndDurationTC;
102 
103 			BSlider*			fVideoQualitySlider;
104 			BSlider*			fAudioQualitySlider;
105 
106 			int32				fVideoQuality;
107 			int32				fAudioQuality;
108 
109 			BFilePanel*			fSaveFilePanel;
110 			BFilePanel*			fOpenFilePanel;
111 
112 			BDirectory			fOutputDir;
113 			bool				fOutputDirSpecified;
114 
115 			bool				fEnabled;
116 			bool				fConverting;
117 			bool				fCancelling;
118 };
119 
120 #endif // MEDIA_CONVERTER_WINDOW_H
121 
122 
123