summaryrefslogtreecommitdiffstats
path: root/beos/HBApp.cpp
blob: 52afce8159f34d10fdf9d8f46b7d3fe7143da153 (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: HBApp.cpp,v 1.1.1.1 2003/11/03 12:03:51 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 <signal.h>

#include "HBApp.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 );
}