xref: /haiku/src/apps/mediaconverter/MediaEncoderWindow.cpp (revision 1294543de9ac0eff000eaea1b18368c36435d08e)
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 #include "MediaEncoderWindow.h"
6 
7 #include <stdio.h>
8 
9 #include <View.h>
10 
11 #include "Strings.h"
12 
13 
14 MediaEncoderWindow::MediaEncoderWindow(BRect frame, BView* view)
15 	: BWindow(frame, ENCODER_PARAMETERS, B_DOCUMENT_WINDOW_LOOK,
16 		B_MODAL_APP_WINDOW_FEEL,
17 		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
18 {
19 	// create and acquire the quit semaphore
20 	fQuitSem = create_sem(0, "encoder_view");
21 
22 	fView = view;
23 	AddChild(fView);
24 	ResizeTo(fView->Bounds().Width(), fView->Bounds().Height());
25 }
26 
27 
28 MediaEncoderWindow::~MediaEncoderWindow()
29 {
30 	// The view must continue to exist until conversion complete.
31 	RemoveChild(fView);
32 	delete_sem(fQuitSem);
33 }
34 
35 
36 void
37 MediaEncoderWindow::MessageReceived(BMessage *msg)
38 {
39 }
40 
41 
42 bool
43 MediaEncoderWindow::QuitRequested()
44 {
45 	return true;
46 }
47 
48 
49 void
50 MediaEncoderWindow::Go()
51 {
52 	this->Show();
53 
54 	// wait until window is quit
55 	while (acquire_sem(fQuitSem) == B_INTERRUPTED)
56 		;
57 }
58 
59