1 // Copyright (C) 2012-2019 The VPaint Developers.
2 // See the COPYRIGHT file at the top-level directory of this distribution
3 // and at https://github.com/dalboris/vpaint/blob/master/COPYRIGHT
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #include "Application.h"
18 #include "MainWindow.h"
19 #include "Global.h"
20 #include "UpdateCheck.h"
21 #include "GLUtils.h"
22 
main(int argc,char * argv[])23 int main(int argc, char *argv[])
24 {
25 
26     // Init OpenGL. Must be called before QApplication creation. See Qt doc:
27     //
28     // Calling QSurfaceFormat::setDefaultFormat() before constructing the
29     // QApplication instance is mandatory on some platforms (for example,
30     // macOS) when an OpenGL core profile context is requested. This is to
31     // ensure that resource sharing between contexts stays functional as all
32     // internal contexts are created using the correct version and profile.
33     //
34     GLUtils::init();
35 
36 
37     Application app(argc, argv);
38     MainWindow mainWindow;
39     UpdateCheck update(&mainWindow);
40 
41     // About window
42     if(global()->settings().showAboutDialogAtStartup())
43     {
44         mainWindow.about();
45     }
46 
47     update.showWhenReady();
48 
49     // Main window
50     QObject::connect(&app, SIGNAL(openFileRequested(QString)), &mainWindow, SLOT(open_(QString)));
51     app.emitOpenFileRequest();
52     mainWindow.show();
53 
54     return app.exec();
55 }
56