summaryrefslogtreecommitdiffstats
path: root/beos/HandBrake.cpp
blob: b5f13196bbadb93c3ccc798721609a9a7d4c8a11 (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
/* $Id: HandBrake.cpp,v 1.8 2003/10/13 22:23:02 titer Exp $

   This file is part of the HandBrake source code.
   Homepage: <http://beos.titer.org/handbrake/>.
   It may be used under the terms of the GNU General Public License. */

#include <signal.h>

#include "HandBrake.h"
#include "MainWindow.h"

void SigHandler( int signal )
{
    /* Ugly way to exit cleanly when hitting Ctrl-C */
    ((HBApp*) be_app)->fWindow->PostMessage( B_QUIT_REQUESTED );
}

int main()
{
    signal( SIGINT,  SigHandler );
    signal( SIGHUP,  SigHandler );
    signal( SIGQUIT, SigHandler );

    /* Run the BApplication */
    HBApp * app = new HBApp();
    app->Run();
    delete app;
    return 0;
}

/* Constructor */
HBApp::HBApp()
    : BApplication("application/x-vnd.titer-handbrake" )
{
    fWindow = new MainWindow();
    fWindow->Show();
}

void HBApp::MessageReceived( BMessage * message )
{
    switch( message->what )
    {
        case B_SAVE_REQUESTED:
            fWindow->PostMessage( message );
            break;

        default:
            BApplication::MessageReceived( message );
            break;
    }
}

void HBApp::RefsReceived( BMessage * message )
{
    fWindow->PostMessage( message );
}