1 /* 2 SPDX-FileCopyrightText: 2009 Nokia Corporation and /or its subsidiary(-ies). 3 Contact: Qt Software Information (qt-info@nokia.com) 4 5 This file is part of the QtCore module of the Qt Toolkit. 6 7 $QT_BEGIN_LICENSE:LGPL$ 8 Commercial Usage 9 Licensees holding valid Qt Commercial licenses may use this file in 10 accordance with the Qt Commercial License Agreement provided with the 11 Software or, alternatively, in accordance with the terms contained in 12 a written agreement between you and Nokia. 13 14 GNU Lesser General Public License Usage 15 Alternatively, this file may be used under the terms of the GNU Lesser 16 General Public License version 2.1 as published by the Free Software 17 Foundation and appearing in the file LICENSE.LGPL included in the 18 packaging of this file. Please review the following information to 19 ensure the GNU Lesser General Public License version 2.1 requirements 20 will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 21 22 In addition, as a special exception, Nokia gives you certain 23 additional rights. These rights are described in the Nokia Qt LGPL 24 Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 25 package. 26 27 GNU General Public License Usage 28 Alternatively, this file may be used under the terms of the GNU 29 General Public License version 3.0 as published by the Free Software 30 Foundation and appearing in the file LICENSE.GPL included in the 31 packaging of this file. Please review the following information to 32 ensure the GNU General Public License version 3.0 requirements will be 33 met: https://www.gnu.org/licenses/gpl-3.0.html. 34 35 If you are unsure which license is appropriate for your use, please 36 contact the sales department at qt-sales@nokia.com. 37 $QT_END_LICENSE$ 38 39 */ 40 41 #ifndef QCOREAPPLICATION_P_H 42 #define QCOREAPPLICATION_P_H 43 44 // 45 // W A R N I N G 46 // ------------- 47 // 48 // This file is not part of the Qt API. It exists purely as an 49 // implementation detail. This header file may change from version to 50 // version without notice, or even be removed. 51 // 52 // We mean it. 53 // 54 55 #include "QtCore/qcoreapplication.h" 56 #include "QtCore/qtranslator.h" 57 #include "private/qobject_p.h" 58 59 QT_BEGIN_NAMESPACE 60 61 typedef QList<QTranslator*> QTranslatorList; 62 63 class QAbstractEventDispatcher; 64 65 class Q_CORE_EXPORT QCoreApplicationPrivate : public QObjectPrivate 66 { 67 Q_DECLARE_PUBLIC(QCoreApplication) 68 69 public: 70 QCoreApplicationPrivate(int &aargc, char **aargv); 71 ~QCoreApplicationPrivate(); 72 73 bool sendThroughApplicationEventFilters(QObject *, QEvent *); 74 bool sendThroughObjectEventFilters(QObject *, QEvent *); 75 bool notify_helper(QObject *, QEvent *); 76 77 virtual QString appName() const; 78 virtual void createEventDispatcher(); 79 static void removePostedEvent(QEvent *); 80 #ifdef Q_OS_WIN 81 static void removePostedTimerEvent(QObject *object, int timerId); 82 #endif 83 84 #ifdef Q_OS_MAC 85 static QString macMenuBarName(); 86 #endif 87 88 static QThread *theMainThread; 89 static QThread *mainThread(); 90 static bool checkInstance(const char *method); 91 static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data); 92 static void removePostedEvents_unlocked(QObject *receiver, int type, QThreadData *data); 93 94 #if !defined (QT_NO_DEBUG) || defined (QT_MAC_FRAMEWORK_BUILD) 95 void checkReceiverThread(QObject *receiver); 96 #endif 97 int &argc; 98 char **argv; 99 void appendApplicationPathToLibraryPaths(void); 100 101 #ifndef QT_NO_TRANSLATION 102 QTranslatorList translators; 103 #endif 104 uint application_type; 105 106 QCoreApplication::EventFilter eventFilter; 107 108 bool in_exec; 109 bool aboutToQuitEmitted; 110 QString cachedApplicationDirPath; 111 QString cachedApplicationFilePath; 112 113 static bool isTranslatorInstalled(QTranslator *translator); 114 115 static QAbstractEventDispatcher *eventDispatcher; 116 static bool is_app_running; 117 static bool is_app_closing; 118 119 static uint attribs; testAttribute(uint flag)120 static inline bool testAttribute(uint flag) { return attribs & (1 << flag); } 121 }; 122 123 QT_END_NAMESPACE 124 125 #endif // QCOREAPPLICATION_P_H 126