diff options
author | handbrake <[email protected]> | 2006-01-14 13:21:55 +0000 |
---|---|---|
committer | handbrake <[email protected]> | 2006-01-14 13:21:55 +0000 |
commit | dc8de40de13c3f3e643b980a95ef48ccafb542e3 (patch) | |
tree | 953b97afe7082bbe2ce4247c703a51aa8e29a3c9 /beos/MainWindow.cpp | |
parent | 4beb6a8b483c9d84677b21cc271ce315f136335c (diff) |
HandBrake 0.6.0-test1
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@10 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'beos/MainWindow.cpp')
-rw-r--r-- | beos/MainWindow.cpp | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/beos/MainWindow.cpp b/beos/MainWindow.cpp deleted file mode 100644 index 53ea7fcfe..000000000 --- a/beos/MainWindow.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* $Id: MainWindow.cpp,v 1.4 2003/11/09 21:35:06 titer Exp $ - - This file is part of the HandBrake source code. - Homepage: <http://handbrake.m0k.org/>. - It may be used under the terms of the GNU General Public License. */ - -#include <Alert.h> -#include <Application.h> -#include <Screen.h> - -#include "MainWindow.h" -#include "ScanView.h" -#include "RipView.h" - -MainWindow::MainWindow() - : BWindow( BRect( 0,0,10,10 ), "HandBrake " VERSION, B_TITLED_WINDOW, - B_NOT_RESIZABLE | B_NOT_ZOOMABLE ) -{ - fHandle = HBInit( 1, 0 ); - - /* Add the scan view */ - fScanView = new ScanView( fHandle ); - fRipView = new RipView( fHandle ); - AddChild( fScanView ); - - /* Resize to fit */ - ResizeTo( fScanView->Bounds().Width(), fScanView->Bounds().Height() ); - - BScreen screen; - MoveTo( ( screen.Frame().Width() - fRipView->Bounds().Width() ) / 2, - ( screen.Frame().Height() - fRipView->Bounds().Height() ) / 2 ); - - /* Update the interface */ - fDie = false; - fUpdateThread = spawn_thread( (int32 (*)(void *)) UpdateInterface, - "interface", B_DISPLAY_PRIORITY, this ); - resume_thread( fUpdateThread ); -} - -bool MainWindow::QuitRequested() -{ - /* Clean up */ - fDie = true; - long exit_value; - wait_for_thread( fUpdateThread, &exit_value ); - HBClose( &fHandle ); - - /* Stop the application */ - be_app->PostMessage( B_QUIT_REQUESTED ); - return true; -} - -void MainWindow::MessageReceived( BMessage * message ) -{ - switch( message->what ) - { - case B_ABOUT_REQUESTED: - { - BAlert * alert; - alert = new BAlert( "About HandBrake", - "HandBrake " VERSION "\n\n" - "by Eric Petit <[email protected]>\n" - "Homepage : <http://handbrake.m0k.org/>\n\n" - "No, you don't want to know where this stupid app " - "name comes from.\n\n" - "Thanks to BGA for pointing out very cool bugs ;)", - "Woot !" ); - alert->Go( NULL ); - break; - } - - case B_REFS_RECEIVED: - case SCAN_RADIO: - case SCAN_BROWSE_BUTTON: - case SCAN_OPEN: - fScanView->MessageReceived( message ); - break; - - case B_SAVE_REQUESTED: - case RIP_TITLE_POPUP: - case RIP_BITRATE_RADIO: - case RIP_TARGET_CONTROL: - case RIP_CROP_BUTTON: - case RIP_BROWSE_BUTTON: - case RIP_SUSPEND_BUTTON: - case RIP_RIP_BUTTON: - fRipView->MessageReceived( message ); - break; - - default: - BWindow::MessageReceived( message ); - break; - } -} - -void MainWindow::UpdateInterface( MainWindow * _this ) -{ - uint64_t time; - int64_t wait; - - while( !_this->fDie ) - { - /* Update every 0.1 sec */ - time = system_time(); - - _this->_UpdateInterface(); - - wait = 100000 - ( system_time() - time ); - if( wait > 0 ) - { - snooze( wait ); - } - } -} - -void MainWindow::_UpdateInterface() -{ - if( !Lock() ) - { - fprintf( stderr, "Lock() failed\n" ); - return; - } - - int modeChanged; - HBStatus status; - - modeChanged = HBGetStatus( fHandle, &status ); - - switch( status.mode ) - { - case HB_MODE_UNDEF: - case HB_MODE_NEED_DEVICE: - break; - - case HB_MODE_SCANNING: - case HB_MODE_INVALID_DEVICE: - fScanView->UpdateIntf( status, modeChanged ); - break; - - case HB_MODE_READY_TO_RIP: - if( !modeChanged ) - break; - - RemoveChild( fScanView ); - ResizeTo( fRipView->Bounds().Width(), - fRipView->Bounds().Height() ); - AddChild( fRipView ); - fRipView->UpdateIntf( status, modeChanged ); - break; - - case HB_MODE_ENCODING: - case HB_MODE_PAUSED: - case HB_MODE_DONE: - case HB_MODE_CANCELED: - case HB_MODE_ERROR: - fRipView->UpdateIntf( status, modeChanged ); - break; - - default: - break; - } - - Unlock(); -} - |