Qt 4.8
Classes | Typedefs | Functions | Variables
qcoreapplication.cpp File Reference
#include "qcoreapplication.h"
#include "qcoreapplication_p.h"
#include "qabstracteventdispatcher.h"
#include "qcoreevent.h"
#include "qeventloop.h"
#include "qcorecmdlineargs_p.h"
#include <qdatastream.h>
#include <qdebug.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qhash.h>
#include <private/qprocess_p.h>
#include <qtextcodec.h>
#include <qthread.h>
#include <qthreadpool.h>
#include <qthreadstorage.h>
#include <private/qthread_p.h>
#include <qelapsedtimer.h>
#include <qlibraryinfo.h>
#include <qvarlengtharray.h>
#include <private/qfactoryloader_p.h>
#include <private/qfunctions_p.h>
#include <private/qlocale_p.h>
#include <private/qmutexpool_p.h>
#include "qeventdispatcher_glib_p.h"
#include "qeventdispatcher_unix_p.h"
#include "qeventdispatcher_win_p.h"
#include "qcore_mac_p.h"
#include <stdlib.h>
#include <locale.h>

Go to the source code of this file.

Classes

struct  QCoreApplicationData
 
class  QMutexUnlocker
 

Typedefs

typedef QList< QtCleanUpFunctionQVFuncList
 

Functions

 Q_GLOBAL_STATIC (QString, qmljs_debug_arguments)
 
 Q_GLOBAL_STATIC_WITH_ARGS (QSettings, staticTrolltechConf,(QSettings::UserScope, QLatin1String("Trolltech"))) QSettings *QCoreApplicationPrivate
 
void qAddPostRoutine (QtCleanUpFunction p)
 
QString qAppFileName ()
 
QString qAppName ()
 
Q_CORE_EXPORT uint qGlobalPostedEventsCount ()
 
void qRemovePostRoutine (QtCleanUpFunction p)
 
void Q_CORE_EXPORT qt_call_post_routines ()
 
void qt_register_signal_spy_callbacks (const QSignalSpyCallbackSet &callback_set)
 
void qt_set_current_thread_to_main_thread ()
 
void Q_CORE_EXPORT qt_startup_hook ()
 
QString qtTrId (const char *id, int n)
 
static void replacePercentN (QString *result, int n)
 

Variables

Qt::HANDLE qt_application_thread_id = 0
 
Q_CORE_EXPORT bool qt_locale_initialized = false
 
QSignalSpyCallbackSet Q_CORE_EXPORT qt_signal_spy_callback_set = { 0, 0, 0, 0 }
 

Typedef Documentation

◆ QVFuncList

Definition at line 270 of file qcoreapplication.cpp.

Function Documentation

◆ Q_GLOBAL_STATIC()

Q_GLOBAL_STATIC ( QString  ,
qmljs_debug_arguments   
)

◆ Q_GLOBAL_STATIC_WITH_ARGS()

Q_GLOBAL_STATIC_WITH_ARGS ( QSettings  ,
staticTrolltechConf  ,
(QSettings::UserScope, QLatin1String("Trolltech"))   
)

Definition at line 341 of file qcoreapplication.cpp.

Referenced by QCoreApplication::setApplicationVersion().

344 {
345  return staticTrolltechConf();
346 }

◆ qAddPostRoutine()

void qAddPostRoutine ( QtCleanUpFunction  p)
related

◆ qAppFileName()

QString qAppFileName ( )

Definition at line 51 of file qcoreapplication_mac.cpp.

Referenced by QCoreApplication::applicationFilePath(), QCoreApplicationPrivate::appName(), and QSystemLibrary::load().

52 {
53  static QString appFileName;
54  if (appFileName.isEmpty()) {
55  QCFType<CFURLRef> bundleURL(CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
56  if(bundleURL) {
57  QCFString cfPath(CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle));
58  if(cfPath)
59  appFileName = cfPath;
60  }
61  }
62  return appFileName;
63 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704

◆ qAppName()

QString qAppName ( )

Definition at line 575 of file qcoreapplication.cpp.

Referenced by getNetWmState(), qt_mac_menu_merge_text(), qt_tablet_cleanup_wce(), and sm_performSaveYourself().

576 {
578  return QString();
579  return QCoreApplication::instance()->d_func()->appName();
580 }
static bool checkInstance(const char *method)
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QCoreApplication * instance()
Returns a pointer to the application&#39;s QCoreApplication (or QApplication) instance.

◆ qGlobalPostedEventsCount()

Q_CORE_EXPORT uint qGlobalPostedEventsCount ( )

◆ qRemovePostRoutine()

void qRemovePostRoutine ( QtCleanUpFunction  p)

Definition at line 281 of file qcoreapplication.cpp.

282 {
283  QVFuncList *list = postRList();
284  if (!list)
285  return;
286  list->removeAll(p);
287 }
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ qt_call_post_routines()

void Q_CORE_EXPORT qt_call_post_routines ( )

Definition at line 289 of file qcoreapplication.cpp.

Referenced by initResources(), QApplication::~QApplication(), and QCoreApplication::~QCoreApplication().

290 {
291  QVFuncList *list = 0;
292  QT_TRY {
293  list = postRList();
294  } QT_CATCH(const std::bad_alloc &) {
295  // ignore - if we can't allocate a post routine list,
296  // there's a high probability that there's no post
297  // routine to be executed :)
298  }
299  if (!list)
300  return;
301  while (!list->isEmpty())
302  (list->takeFirst())();
303 }
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
T takeFirst()
Removes the first item in the list and returns it.
Definition: qlist.h:489
#define QT_CATCH(A)
Definition: qglobal.h:1537
#define QT_TRY
Definition: qglobal.h:1536
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ qt_register_signal_spy_callbacks()

void qt_register_signal_spy_callbacks ( const QSignalSpyCallbackSet callback_set)

Definition at line 261 of file qcoreapplication.cpp.

Referenced by QSignalDumper::endDump(), and QSignalDumper::startDump().

262 {
263  qt_signal_spy_callback_set = callback_set;
264 }
QSignalSpyCallbackSet Q_CORE_EXPORT qt_signal_spy_callback_set

◆ qt_set_current_thread_to_main_thread()

void qt_set_current_thread_to_main_thread ( )

Definition at line 355 of file qcoreapplication.cpp.

Referenced by QInternal::activateCallbacks(), and QInternal::callFunction().

356 {
358 }
static QThread * theMainThread
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
Definition: qthread.cpp:419

◆ qt_startup_hook()

void Q_CORE_EXPORT qt_startup_hook ( )

Definition at line 266 of file qcoreapplication.cpp.

Referenced by QCoreApplication::init().

267 {
268 }

◆ qtTrId()

QString qtTrId ( const char *  id,
int  n 
)

Definition at line 2023 of file qcoreapplication.cpp.

Referenced by QScript::functionQsTrId().

2024 {
2026 }
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)

◆ replacePercentN()

static void replacePercentN ( QString result,
int  n 
)
static

Definition at line 1914 of file qcoreapplication.cpp.

Referenced by QCoreApplication::translate().

1915 {
1916  if (n >= 0) {
1917  int percentPos = 0;
1918  int len = 0;
1919  while ((percentPos = result->indexOf(QLatin1Char('%'), percentPos + len)) != -1) {
1920  len = 1;
1921  QString fmt;
1922  if (result->at(percentPos + len) == QLatin1Char('L')) {
1923  ++len;
1924  fmt = QLatin1String("%L1");
1925  } else {
1926  fmt = QLatin1String("%1");
1927  }
1928  if (result->at(percentPos + len) == QLatin1Char('n')) {
1929  fmt = fmt.arg(n);
1930  ++len;
1931  result->replace(percentPos, len, fmt);
1932  len = fmt.length();
1933  }
1934  }
1935  }
1936 }
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

Variable Documentation

◆ qt_application_thread_id

Qt::HANDLE qt_application_thread_id = 0

◆ qt_locale_initialized

Q_CORE_EXPORT bool qt_locale_initialized = false

◆ qt_signal_spy_callback_set

QSignalSpyCallbackSet Q_CORE_EXPORT qt_signal_spy_callback_set = { 0, 0, 0, 0 }