File indexing completed on 2024-12-22 04:34:59

0001 /*
0002     SPDX-FileCopyrightText: 2009 Nokia Corporation and /or its subsidiary(-ies).
0003     Contact: Qt Software Information (qt-info@nokia.com)
0004 
0005     This file is part of the QtCore module of the Qt Toolkit.
0006 
0007     $QT_BEGIN_LICENSE:LGPL$
0008     Commercial Usage
0009     Licensees holding valid Qt Commercial licenses may use this file in
0010     accordance with the Qt Commercial License Agreement provided with the
0011     Software or, alternatively, in accordance with the terms contained in
0012     a written agreement between you and Nokia.
0013 
0014     GNU Lesser General Public License Usage
0015     Alternatively, this file may be used under the terms of the GNU Lesser
0016     General Public License version 2.1 as published by the Free Software
0017     Foundation and appearing in the file LICENSE.LGPL included in the
0018     packaging of this file.  Please review the following information to
0019     ensure the GNU Lesser General Public License version 2.1 requirements
0020     will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
0021 
0022     In addition, as a special exception, Nokia gives you certain
0023     additional rights. These rights are described in the Nokia Qt LGPL
0024     Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
0025     package.
0026 
0027     GNU General Public License Usage
0028     Alternatively, this file may be used under the terms of the GNU
0029     General Public License version 3.0 as published by the Free Software
0030     Foundation and appearing in the file LICENSE.GPL included in the
0031     packaging of this file.  Please review the following information to
0032     ensure the GNU General Public License version 3.0 requirements will be
0033     met: https://www.gnu.org/licenses/gpl-3.0.html.
0034 
0035     If you are unsure which license is appropriate for your use, please
0036     contact the sales department at qt-sales@nokia.com.
0037     $QT_END_LICENSE$
0038 
0039 */
0040 
0041 #ifndef QCOREAPPLICATION_P_H
0042 #define QCOREAPPLICATION_P_H
0043 
0044 //
0045 //  W A R N I N G
0046 //  -------------
0047 //
0048 // This file is not part of the Qt API.  It exists purely as an
0049 // implementation detail.  This header file may change from version to
0050 // version without notice, or even be removed.
0051 //
0052 // We mean it.
0053 //
0054 
0055 #include "QtCore/qcoreapplication.h"
0056 #include "QtCore/qtranslator.h"
0057 #include "private/qobject_p.h"
0058 
0059 QT_BEGIN_NAMESPACE
0060 
0061 typedef QList<QTranslator*> QTranslatorList;
0062 
0063 class QAbstractEventDispatcher;
0064 
0065 class Q_CORE_EXPORT QCoreApplicationPrivate : public QObjectPrivate
0066 {
0067     Q_DECLARE_PUBLIC(QCoreApplication)
0068 
0069 public:
0070     QCoreApplicationPrivate(int &aargc,  char **aargv);
0071     ~QCoreApplicationPrivate();
0072 
0073     bool sendThroughApplicationEventFilters(QObject *, QEvent *);
0074     bool sendThroughObjectEventFilters(QObject *, QEvent *);
0075     bool notify_helper(QObject *, QEvent *);
0076 
0077     virtual QString appName() const;
0078     virtual void createEventDispatcher();
0079     static void removePostedEvent(QEvent *);
0080 #ifdef Q_OS_WIN
0081     static void removePostedTimerEvent(QObject *object, int timerId);
0082 #endif
0083 
0084 #ifdef Q_OS_MAC
0085     static QString macMenuBarName();
0086 #endif
0087 
0088     static QThread *theMainThread;
0089     static QThread *mainThread();
0090     static bool checkInstance(const char *method);
0091     static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data);
0092     static void removePostedEvents_unlocked(QObject *receiver, int type, QThreadData *data);
0093 
0094 #if !defined (QT_NO_DEBUG) || defined (QT_MAC_FRAMEWORK_BUILD)
0095     void checkReceiverThread(QObject *receiver);
0096 #endif
0097     int &argc;
0098     char **argv;
0099     void appendApplicationPathToLibraryPaths(void);
0100 
0101 #ifndef QT_NO_TRANSLATION
0102     QTranslatorList translators;
0103 #endif
0104     uint application_type;
0105 
0106     QCoreApplication::EventFilter eventFilter;
0107 
0108     bool in_exec;
0109     bool aboutToQuitEmitted;
0110     QString cachedApplicationDirPath;
0111     QString cachedApplicationFilePath;
0112 
0113     static bool isTranslatorInstalled(QTranslator *translator);
0114 
0115     static QAbstractEventDispatcher *eventDispatcher;
0116     static bool is_app_running;
0117     static bool is_app_closing;
0118 
0119     static uint attribs;
0120     static inline bool testAttribute(uint flag) { return attribs & (1 << flag); }
0121 };
0122 
0123 QT_END_NAMESPACE
0124 
0125 #endif // QCOREAPPLICATION_P_H