blob: 702c74d949f23d2d6b3c50b413e835e561634562 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#include "HBApp.h"
#include "MainWindow.h"
#include "ScanWindow.h"
#include "hb.h"
int main()
{
HBApp * app = new HBApp();
app->Run();
delete app;
return 0;
}
HBApp::HBApp()
: BApplication( "application/x-vnd.titer-handbrake" )
{
fHandle = hb_init( HB_DEBUG_ALL, 0 );
fMainWin = new MainWindow( fHandle );
fScanWin = new ScanWindow( fHandle );
fScanWin->AddToSubset( fMainWin );
fMainWin->Show();
fScanWin->Show();
SetPulseRate( 200000 ); /* 0.2 second */
}
void HBApp::MessageReceived( BMessage * message )
{
switch( message->what )
{
default:
BApplication::MessageReceived( message );
break;
}
}
void HBApp::RefsReceived( BMessage * message )
{
}
void HBApp::Pulse()
{
hb_state_t s;
hb_get_state( fHandle, &s );
switch( s.state )
{
case HB_STATE_IDLE:
break;
case HB_STATE_SCANNING:
fScanWin->Update( &s );
break;
case HB_STATE_SCANDONE:
if( hb_list_count( hb_get_titles( fHandle ) ) )
{
/* Success */
fScanWin->Hide();
fMainWin->Update( &s );
}
else
{
/* Invalid volume */
fScanWin->Update( &s );
}
break;
case HB_STATE_WORKING:
case HB_STATE_PAUSED:
case HB_STATE_WORKDONE:
fMainWin->Update( &s );
break;
}
}
bool HBApp::QuitRequested()
{
hb_close( &fHandle );
return BApplication::QuitRequested();
}
|