1 /*
2  * Carla application
3  * Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * For a full copy of the GNU General Public License see the doc/GPL.txt file.
16  */
17 
18 #ifndef CARLA_APP_HPP_INCLUDED
19 #define CARLA_APP_HPP_INCLUDED
20 
21 //---------------------------------------------------------------------------------------------------------------------
22 // Imports (Global)
23 
24 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
25 # pragma GCC diagnostic push
26 # pragma GCC diagnostic ignored "-Wconversion"
27 # pragma GCC diagnostic ignored "-Weffc++"
28 # pragma GCC diagnostic ignored "-Wsign-conversion"
29 #endif
30 
31 #include <QtCore/QCoreApplication>
32 #include <QtCore/QString>
33 
34 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
35 # pragma GCC diagnostic pop
36 #endif
37 
38 //---------------------------------------------------------------------------------------------------------------------
39 
40 class QApplication;
41 
42 //---------------------------------------------------------------------------------------------------------------------
43 // Imports (Custom)
44 
45 #include "CarlaJuceUtils.hpp"
46 
47 //---------------------------------------------------------------------------------------------------------------------
48 
49 class CarlaApplication
50 {
51 public:
52     CarlaApplication(const QString appName, int& argc, char* argv[]);
53 
exec() const54     int exec() const
55     {
56         return fApp->exec();
57     }
58 
quit() const59     void quit() const
60     {
61         fApp->quit();
62     }
63 
getApp() const64     QCoreApplication* getApp() const noexcept
65     {
66         return fApp;
67     }
68 
69 private:
70     QCoreApplication* fApp;
71 
72     QApplication* createApp(const QString& appName, int& argc, char* argv[]);
73 
74     CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaApplication)
75 };
76 
77 //---------------------------------------------------------------------------------------------------------------------
78 
79 #endif // CARLA_APP_HPP_INCLUDED
80