1 /**********************************************************************************************
2     Copyright (C) 2017 Oliver Eichler <oliver.eichler@gmx.de>
3 
4     This program is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License
15     along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 
17 **********************************************************************************************/
18 
19 #include "CMainWindow.h"
20 #include "CSingleInstanceProxy.h"
21 #include "setup/IAppSetup.h"
22 #include "version.h"
23 
24 #include <QApplication>
25 #include <QtWidgets>
26 
main(int argc,char ** argv)27 int main(int argc, char** argv)
28 {
29     QApplication app(argc, argv);
30 
31     QCoreApplication::setApplicationName("QMapTool");
32     QCoreApplication::setOrganizationName("QLandkarte");
33     QCoreApplication::setOrganizationDomain("qlandkarte.org");
34 
35     IAppSetup& env = IAppSetup::createInstance(qApp);
36     env.processArguments();
37     env.initLogHandler();
38     env.initQMapTool();
39 
40     // make sure this is the one and only instance on the system
41     CSingleInstanceProxy s(qlOpts->arguments);
42 
43     QSplashScreen* splash = nullptr;
44     if (!qlOpts->nosplash)
45     {
46         QPixmap pic(":/pic/splash.png");
47         QPainter p(&pic);
48         QFont f = p.font();
49         f.setBold(true);
50 
51         p.setPen(Qt::black);
52         p.setFont(f);
53         p.drawText(260, 195, "QMapTool, V " VER_STR);
54 
55         splash = new QSplashScreen(pic);
56 #ifdef Q_OS_MAC
57         // remove the splash screen flag on OS-X as workaround for the reported bug
58         // https://bugreports.qt.io/browse/QTBUG-49576
59         splash->setWindowFlags(splash->windowFlags() & (~Qt::SplashScreen));
60 #endif
61         splash->show();
62     }
63 
64     CMainWindow w;
65     w.show();
66 
67     if(nullptr != splash)
68     {
69         splash->finish(&w);
70         delete splash;
71     }
72 
73     return app.exec();
74 }
75 
76 
77