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