QtBase  v6.3.1
qcoreapplication_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2021 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QCOREAPPLICATION_P_H
41 #define QCOREAPPLICATION_P_H
42 
43 //
44 // W A R N I N G
45 // -------------
46 //
47 // This file is not part of the Qt API. It exists purely as an
48 // implementation detail. This header file may change from version to
49 // version without notice, or even be removed.
50 //
51 // We mean it.
52 //
53 
54 #include "QtCore/qcoreapplication.h"
55 #if QT_CONFIG(commandlineparser)
56 #include "QtCore/qcommandlineoption.h"
57 #endif
58 #include "QtCore/qreadwritelock.h"
59 #include "QtCore/qtranslator.h"
60 #if QT_CONFIG(settings)
61 #include "QtCore/qsettings.h"
62 #endif
63 #ifndef QT_NO_QOBJECT
64 #include "private/qobject_p.h"
65 #include "private/qlocking_p.h"
66 #endif
67 
68 #ifdef Q_OS_MACOS
69 #include "private/qcore_mac_p.h"
70 #endif
71 
73 
75 
77 
78 #ifndef QT_NO_QOBJECT
79 class QEvent;
80 #endif
81 
82 class Q_CORE_EXPORT QCoreApplicationPrivate
83 #ifndef QT_NO_QOBJECT
84  : public QObjectPrivate
85 #endif
86 {
87  Q_DECLARE_PUBLIC(QCoreApplication)
88 
89 public:
90  enum Type {
91  Tty,
92  Gui
93  };
94 
95  QCoreApplicationPrivate(int &aargc, char **aargv, uint flags);
96 
97  // If not inheriting from QObjectPrivate: force this class to be polymorphic
98 #ifdef QT_NO_QOBJECT
99  virtual
100 #endif
102 
103  void init();
104 
105  QString appName() const;
106  QString appVersion() const;
107 
108 #ifdef Q_OS_DARWIN
109  static QString infoDictionaryStringProperty(const QString &propertyName);
110 #endif
111 
112  static void initLocale();
113 
114  static bool checkInstance(const char *method);
115 
116 #if QT_CONFIG(commandlineparser)
117  virtual void addQtOptions(QList<QCommandLineOption> *options);
118 #endif
119 
120 #ifndef QT_NO_QOBJECT
121  bool sendThroughApplicationEventFilters(QObject *, QEvent *);
122  static bool sendThroughObjectEventFilters(QObject *, QEvent *);
123  static bool notify_helper(QObject *, QEvent *);
124  static inline void setEventSpontaneous(QEvent *e, bool spontaneous) { e->m_spont = spontaneous; }
125 
126  virtual void createEventDispatcher();
127  virtual void eventDispatcherReady();
128  static void removePostedEvent(QEvent *);
129 #ifdef Q_OS_WIN
130  static void removePostedTimerEvent(QObject *object, int timerId);
131 #endif
132 
134  void ref();
135  void deref();
136  virtual bool canQuitAutomatically();
137  void quitAutomatically();
138  virtual void quit();
139 
141  static QThread *mainThread();
142  static bool threadRequiresCoreApplication();
143 
144  static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data);
145 
146  static void checkReceiverThread(QObject *receiver);
147  void cleanupThreadData();
148 
150  {
152  std::unique_lock<QMutex> locker;
153 
154  void unlock() { locker.unlock(); }
155  };
156  static QPostEventListLocker lockThreadPostEventList(QObject *object);
157 #endif // QT_NO_QOBJECT
158 
159  int &argc;
160  char **argv;
161 #if defined(Q_OS_WIN)
162  int origArgc;
163  char **origArgv; // store unmodified arguments for QCoreApplication::arguments()
164 #endif
165  void appendApplicationPathToLibraryPaths(void);
166 
167 #ifndef QT_NO_TRANSLATION
170  static bool isTranslatorInstalled(QTranslator *translator);
171 #endif
172 
174 
177  static void setApplicationFilePath(const QString &path);
178  static inline void clearApplicationFilePath() { delete cachedApplicationFilePath; cachedApplicationFilePath = nullptr; }
179 
180 #ifndef QT_NO_QOBJECT
181  void execCleanup();
182 
183  bool in_exec;
186 
188  static bool is_app_running;
189  static bool is_app_closing;
190 #endif
191 
192  static bool setuidAllowed;
193  static uint attribs;
194  static inline bool testAttribute(uint flag) { return attribs & (1 << flag); }
196 
197  void processCommandLineArguments();
198  QString qmljs_debug_arguments; // a string containing arguments for js/qml debugging.
199  inline QString qmljsDebugArgumentsString() const { return qmljs_debug_arguments; }
200 
201 #ifdef QT_NO_QOBJECT
203 #endif
204 };
205 
207 
208 #endif // QCOREAPPLICATION_P_H
The QAbstractEventDispatcher class provides an interface to manage Qt's event queue.
The QAtomicInt class provides platform-independent atomic operations on int.
Definition: qatomic.h:158
The QCoreApplication class provides an event loop for Qt applications without UI.
static void setEventSpontaneous(QEvent *e, bool spontaneous)
QCoreApplicationPrivate::Type application_type
QString qmljsDebugArgumentsString() const
static QAbstractEventDispatcher * eventDispatcher
static QString * cachedApplicationFilePath
static QBasicAtomicPointer< QThread > theMainThread
static bool testAttribute(uint flag)
static void clearApplicationFilePath()
The QEvent class is the base class of all event classes. Event objects contain event parameters.
Definition: qcoreevent.h:58
Definition: qlist.h:108
QObject * q_ptr
Definition: qobject.h:98
The QObject class is the base class of all Qt objects.
Definition: qobject.h:125
The QReadWriteLock class provides read-write locking.
The QString class provides a Unicode character string.
Definition: qstring.h:388
The QTranslator class provides internationalization support for text output.
Definition: qtranslator.h:55
double e
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld init[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head if pixblock_size cache_preload_simple endif process_pixblock_tail pixinterleave dst_w_basereg irp if pixblock_size chunk_size tst beq if DST_W else pixst DST_W else mov ORIG_W endif add lsl if lsl endif if lsl endif lsl endif lsl endif lsl endif subs mov DST_W if regs_shortage str endif bge start_of_loop_label endm macro generate_composite_function
QT_BEGIN_NAMESPACE typedef QList< QTranslator * > QTranslatorList
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
unsigned int uint
Definition: qglobal.h:334
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint ref
GLsizei const GLchar *const * path
Definition: qopenglext.h:4283
const GLint * attribs
Definition: qopenglext.h:11241
QThreadData * threadData
std::unique_lock< QMutex > locker
void unlock()
Definition: moc.h:48