All Classes Namespaces Functions Variables Enumerations Properties Pages
pencil2d.h
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 #ifndef PENCIL2D_H
19 #define PENCIL2D_H
20 
21 #include <QApplication>
22 #include <memory>
23 #include "pencilerror.h"
24 
25 class MainWindow2;
26 class QLockFile;
27 
31 #define pencil2D \
32  (static_cast<Pencil2D *>(QCoreApplication::instance()))
33 
37 class Pencil2D : public QApplication
38 {
39  Q_OBJECT
40 
41 public:
48  explicit Pencil2D(int &argc, char **argv);
49  ~Pencil2D() override;
50 
62 
71  bool isInstanceOpen();
72 
73  bool event(QEvent* event) override;
74 
75 signals:
82  void openFileRequested(QString filename);
83 
84 private:
88  void installTranslators();
94  void prepareGuiStartup(const QString &inputPath);
95 
96  std::unique_ptr<MainWindow2> mainWindow;
97 
98  std::unique_ptr<QLockFile> mProcessLock;
99 };
100 
101 #endif // PENCIL2D_H
Status handleCommandLineOptions()
Parses supplied command line arguments and performs the appropriate actions, such as running the comm...
Definition: pencil2d.cpp:72
The main application class handling startup as well as the main loop.
Definition: pencil2d.h:37
Pencil2D(int &argc, char **argv)
Initializes the application with the given command line arguments.
Definition: pencil2d.cpp:44
void openFileRequested(QString filename)
Emitted when the operating system requests that a file should be opened.
Q_OBJECTQ_OBJECT
void prepareGuiStartup(const QString &inputPath)
Readies the graphical UI for entering the main loop.
Definition: pencil2d.cpp:165
void installTranslators()
Sets up translators for the application locale configured by the user or the system locale...
Definition: pencil2d.cpp:137
bool isInstanceOpen()
Checks if multiple instances of Pencil2D are open.
Definition: pencil2d.cpp:109