All Classes Namespaces Functions Variables Enumerations Properties Pages
main.cpp
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2020 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 
18 #include <clocale>
19 
20 #include <QSettings>
21 
22 #include "log.h"
23 #include "pencil2d.h"
24 #include "pencildef.h"
25 #include "pencilerror.h"
26 #include "platformhandler.h"
27 
32 int main(int argc, char* argv[])
33 {
34  // iss #940
35  // Force dot separator on numbers because some localizations
36  // use comma as separator.
37  std::setlocale(LC_NUMERIC, "en_US.UTF-8");
38 
39  Q_INIT_RESOURCE(core_lib);
40  PlatformHandler::initialise();
41  initCategoryLogging();
42 
43  // Temporary solution for high DPI displays
44  // EnableHighDpiScaling is a just in case mechanism in the event that we
45  // want to disable this without recompiling, see #922
46  QSettings settings(PENCIL2D, PENCIL2D);
47  if (settings.value("EnableHighDpiScaling", "true").toBool())
48  {
49  // Enable auto screen scaling on high dpi display, for example, a 4k monitor
50  // This attr has to be set before the QApplication is constructed
51  // Only works on Windows & X11
53  }
54 
55  Pencil2D app(argc, argv);
56  switch (app.handleCommandLineOptions().code())
57  {
58  case Status::OK:
59  return Pencil2D::exec();
60  case Status::SAFE:
61  return EXIT_SUCCESS;
62  default:
63  return EXIT_FAILURE;
64  }
65 }
The main application class handling startup as well as the main loop.
Definition: pencil2d.h:34
void setAttribute(Qt::ApplicationAttribute attribute, bool on)
AA_EnableHighDpiScaling