summaryrefslogtreecommitdiff
path: root/main.cpp
blob: 65b08d76a7394703b25045e028afcd7699fa74ec (plain) (blame)
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
#include "qpsxserial.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QStringList param_list;

    for(int i = 1; i < argc; i++)
    {
        param_list.append(argv[i]);
    }

    QPSXSerial* w;

    if(param_list.isEmpty() == true)
    {
        w = new QPSXSerial(0, GUI_APP);
    }
    else
    {
        w = new QPSXSerial(0, CLI_APP);
    }

    w->setParamList(param_list);

    if(param_list.isEmpty() == true)
    {
        w->show();
    }
    else
    {
        // This will cause the application to exit when
        // the task signals finished.
        QObject::connect(w, SIGNAL(finished(void)), &a, SLOT(quit(void)));

        // This will run the task from the application event loop.
        QTimer::singleShot(0, w, SLOT(cli_run()));
    }

    return a.exec();
}