[47873e]: src / startup.cpp Maximize Restore History

Download this file

startup.cpp    80 lines (62 with data), 2.7 kB

 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
// Copyright (C) 2011 David Sugar, Haakon Eriksen, GNU Free Call Foundation
//
// This file is part of SwitchView.
//
// SwitchView is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// SwitchView is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SwitchView. If not, see <http://www.gnu.org/licenses/>.
#include "switchview.h"
#include <QTranslator>
#include <QLocale>
// this assures qt translations are up before initializing argument parser...
static void parse(int argc, char **argv)
{
shell::flagopt helpflag('h',"--help", strdup(SwitchView::tr("display this list").toUtf8().data()));
shell::flagopt althelp('?', NULL, NULL);
shell::flagopt admin('a', "--admin", strdup(SwitchView::tr("when starting as admin application").toUtf8().data()));
shell::flagopt start('s', "--startup", strdup(SwitchView::tr("when starting at user login").toUtf8().data()));
shell::flagopt test('t', "--testing", strdup(SwitchView::tr("testing without warnings").toUtf8().data()));
shell args(argc, argv);
if(is(helpflag) || is(althelp)) {
printf("%s\n", SwitchView::tr("Usage: switchview [options]...").toUtf8().data());
printf("%s\n\n", SwitchView::tr("GNU SIP Witch Desktop Control").toUtf8().data());
printf("%s\n", SwitchView::tr("Options:").toUtf8().data());
shell::help();
printf("\n%s\n", SwitchView::tr("Report bugs to dyfet@gnu.org").toUtf8().data());
exit(0);
}
if(is(test)) {
startup = true;
testing = true;
}
if(is(admin))
alwaysopen = true;
if(is(start))
startup = true;
}
PROGRAM_MAIN(argc, argv)
{
shell::bind("switchview");
shell::relocate(*argv);
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("GNU Telephony");
QCoreApplication::setOrganizationDomain("gnutelephony.org");
QCoreApplication::setApplicationName("SwitchView");
QTranslator translator;
translator.load(QLocale::system().name(), *shell::path(shell::SYSTEM_PREFIX, TRANSLATIONS));
app.installTranslator(&translator);
Coastal::icons();
parse(argc, argv);
SwitchView::start();
QApplication::exec();
PROGRAM_EXIT(0);
}