55 #include <private/qprocess_p.h> 60 #include <private/qthread_p.h> 64 #include <private/qfactoryloader_p.h> 65 #include <private/qfunctions_p.h> 66 #include <private/qlocale_p.h> 67 #include <private/qmutexpool_p.h> 73 # include "qeventdispatcher_symbian_p.h" 74 # include "private/qcore_symbian_p.h" 75 # include "private/qfilesystemengine_p.h" 76 # include <apacmdln.h> 77 #elif defined(Q_OS_UNIX) 78 # if defined(Q_OS_BLACKBERRY) 83 # if !defined(QT_NO_GLIB) 105 # include <taskLib.h> 109 # include <sys/neutrino.h> 110 # include <pthread.h> 132 static CApaCommandLine* apaCommandLine = 0;
133 static char *apaTail = 0;
136 static void qt_cleanup_apa_cmd_line()
138 delete apaCommandLine;
146 static inline void qt_init_symbian_apa_arguments(
int &argc,
char **&argv)
151 CApaCommandLine* commandLine = QCoreApplicationPrivate::symbianCommandLine();
153 TPtrC8 apaCmdLine = commandLine->TailEnd();
154 int tailLen = apaCmdLine.Length();
156 apaTail =
reinterpret_cast<char *
>(
qMalloc(tailLen + 1));
157 qMemCopy(apaTail, reinterpret_cast<const char *>(apaCmdLine.Ptr()), tailLen);
158 apaTail[tailLen] =
'\0';
161 *apaArgv = qWinCmdLine<char>(apaTail, tailLen, argc);
162 apaArgv->
insert(0, argv[0]);
164 argv = apaArgv->
data();
170 CApaCommandLine* QCoreApplicationPrivate::symbianCommandLine()
174 if (!apaCommandLine) {
175 TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(apaCommandLine);
176 if (err == KErrNone) {
180 return apaCommandLine;
185 #if defined(Q_WS_WIN) || defined(Q_WS_MAC) 190 #if defined(QT3_SUPPORT) 191 bool QCoreApplicationPrivate::useQt3Support =
true;
194 #if !defined(Q_OS_WIN) 199 CFTypeRef string = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR(
"CFBundleName"));
209 if (applicationName.isNull()) {
211 applicationName = macMenuBarName();
213 if (applicationName.isEmpty() && argv[0]) {
214 char *p = strrchr(argv[0],
'/');
218 return applicationName;
226 qWarning(
"QApplication::%s: Please instantiate the QApplication object first",
function);
234 int j = argc ? 1 : 0;
235 for (
int i = 1; i < argc; ++i) {
236 if (argv[i] && *argv[i] !=
'-') {
243 }
else if (arg ==
"-qmljsdebugger" && i < argc - 1) {
263 qt_signal_spy_callback_set = callback_set;
275 QVFuncList *list = postRList();
283 QVFuncList *list = postRList();
291 QVFuncList *list = 0;
294 }
QT_CATCH(
const std::bad_alloc &) {
323 : globalStatic(_globalStatic)
328 CTrapCleanup *
cleanup = CTrapCleanup::New();
345 return staticTrolltechConf();
372 #ifndef QT_NO_LIBRARY 377 #ifndef QT_NO_LIBRARY 380 #ifndef QT_NO_QOBJECT 389 #ifdef Q_OS_BLACKBERRY 392 void loadManifest() {
393 static bool manifestLoadAttempt =
false;
394 if (manifestLoadAttempt)
397 manifestLoadAttempt =
true;
403 while (!metafile.
atEnd() && (application.isEmpty() || applicationVersion.isEmpty() || orgName.isEmpty())) {
407 else if (line.
startsWith(
"Application-Version:"))
420 #ifndef QT_NO_LIBRARY 429 :
QObjectPrivate(), argc(aargc), argv(aargv), application_type(0), eventFilter(0),
430 in_exec(false), aboutToQuitEmitted(false)
432 app_compile_version = flags & 0xffffff;
433 #if defined(QT3_SUPPORT) 434 useQt3Support = !(flags & 0x01000000);
436 static const char *
const empty =
"";
437 if (argc == 0 || argv == 0) {
439 argv = (
char **)∅
441 QCoreApplicationPrivate::is_app_closing =
false;
444 qt_init_symbian_apa_arguments(argc, argv);
455 ThreadCtl(_NTO_TCTL_ALIGN_FAULT, &tv);
461 if (pthread_getschedparam(0, &sched_policy, ¶m) == 0 && sched_policy != SCHED_RR) {
462 sched_policy = SCHED_RR;
463 pthread_setschedparam(0, sched_policy, ¶m);
469 qWarning(
"WARNING: QApplication was not created in the main() thread.");
476 void *
data = &threadData->tls;
482 for (
int i = 0; i < threadData->postEventList.size(); ++i) {
483 const QPostEvent &pe = threadData->postEventList.at(i);
485 --pe.
receiver->d_func()->postedEvents;
490 threadData->postEventList.clear();
491 threadData->postEventList.recursion = 0;
492 threadData->quitNow =
false;
499 #if defined(Q_OS_SYMBIAN) 500 eventDispatcher =
new QEventDispatcherSymbian(q);
501 #elif defined(Q_OS_UNIX) 502 # if defined(Q_OS_BLACKBERRY) 505 # if !defined(QT_NO_GLIB) 512 #elif defined(Q_OS_WIN) 515 # error "QEventDispatcher not yet ported to this platform" 523 return theMainThread;
526 #if !defined (QT_NO_DEBUG) || defined (QT_MAC_FRAMEWORK_BUILD) 532 "QCoreApplication::sendEvent",
534 "Current thread %1. Receiver '%2' (of type '%3') was created in thread %4")
543 #elif defined(Q_OS_SYMBIAN) && defined (QT_NO_DEBUG) 552 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) 553 QStringList *app_libpaths = coreappdata()->app_libpaths;
555 # if defined(Q_OS_SYMBIAN) 566 app_libpaths->
append(app_location);
572 return *qmljs_debug_arguments();
692 if (
self &&
self->d_func()->eventDispatcher)
693 self->d_func()->eventDispatcher->
flush();
714 QCoreApplicationPrivate::eventDispatcher->
startingUp();
715 #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_LIBRARY) 722 #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE) 723 d_func()->symbianInit();
731 QCoreApplicationPrivate::eventDispatcher->
startingUp();
732 #if defined(Q_OS_SYMBIAN) 733 #ifndef QT_NO_LIBRARY 739 #ifndef QT_NO_SYSTEMLOCALE 740 d_func()->symbianInit();
742 #endif //Q_OS_SYMBIAN 752 setlocale(LC_ALL,
"");
753 qt_locale_initialized =
true;
756 Q_ASSERT_X(!
self,
"QCoreApplication",
"there should be only one application object");
757 QCoreApplication::self =
this;
770 if (!QCoreApplicationPrivate::eventDispatcher)
771 QCoreApplicationPrivate::eventDispatcher =
d->threadData->eventDispatcher;
773 if (!QCoreApplicationPrivate::eventDispatcher)
774 d->createEventDispatcher();
775 Q_ASSERT(QCoreApplicationPrivate::eventDispatcher != 0);
777 if (!QCoreApplicationPrivate::eventDispatcher->
parent())
778 QCoreApplicationPrivate::eventDispatcher->
moveToThread(
d->threadData->thread);
782 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) 783 if (!coreappdata()->app_libpaths) {
787 d->appendApplicationPathToLibraryPaths();
791 #if defined(Q_OS_UNIX) && !(defined(QT_NO_PROCESS)) 798 extern void qt_core_eval_init(
uint);
799 qt_core_eval_init(
d->application_type);
802 #if defined(Q_OS_SYMBIAN) \ 803 && defined(Q_CC_NOKIAX86) \ 816 CleanupClosePushL(loader);
817 User::LeaveIfError(loader.Connect());
818 User::LeaveIfError(loader.CancelLazyDllUnload());
819 CleanupStack::PopAndDestroy(&loader);
823 d->processCommandLineArguments();
828 #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE) 829 void QCoreApplicationPrivate::symbianInit()
831 if (!environmentChangeNotifier)
832 environmentChangeNotifier.reset(
new QEnvironmentChangeNotifier);
845 QCoreApplicationPrivate::is_app_closing =
true;
846 QCoreApplicationPrivate::is_app_running =
false;
848 #if !defined(QT_NO_THREAD) 849 #if !defined(QT_NO_CONCURRENT) 857 if (globalThreadPool)
863 d_func()->threadData->eventDispatcher = 0;
864 if (QCoreApplicationPrivate::eventDispatcher)
865 QCoreApplicationPrivate::eventDispatcher->
closingDown();
866 QCoreApplicationPrivate::eventDispatcher = 0;
868 #ifndef QT_NO_LIBRARY 869 delete coreappdata()->app_libpaths;
870 coreappdata()->app_libpaths = 0;
891 QCoreApplicationPrivate::attribs |= 1 << attribute;
893 QCoreApplicationPrivate::attribs &= ~(1 << attribute);
933 void *cbdata[] = { receiver,
event, &result };
946 #ifdef QT_JAMBI_BUILD 948 int *oldDeleteWatch = QObjectPrivate::setDeleteWatch(d, &deleteWatch);
956 returnValue =
notify(receiver, event);
962 #ifdef QT_JAMBI_BUILD 967 QObjectPrivate::resetDeleteWatch(d, oldDeleteWatch, deleteWatch);
1020 if (QCoreApplicationPrivate::is_app_closing)
1023 if (receiver == 0) {
1024 qWarning(
"QCoreApplication::notify: Unexpected null receiver");
1029 d->checkReceiverThread(receiver);
1032 return receiver->
isWidgetType() ? false :
d->notify_helper(receiver, event);
1037 if (receiver->d_func()->threadData == this->threadData) {
1039 for (
int i = 0; i < eventFilters.size(); ++i) {
1040 register QObject *obj = eventFilters.at(i);
1043 if (obj->d_func()->threadData != threadData) {
1044 qWarning(
"QCoreApplication: Application event filter cannot be in a different thread.");
1057 if (receiver != q) {
1058 for (
int i = 0; i < receiver->d_func()->eventFilters.size(); ++i) {
1059 register QObject *obj = receiver->d_func()->eventFilters.at(i);
1062 if (obj->d_func()->threadData != receiver->d_func()->threadData) {
1063 qWarning(
"QCoreApplication: Object event filter cannot be in a different thread.");
1080 if (sendThroughApplicationEventFilters(receiver, event))
1083 if (sendThroughObjectEventFilters(receiver, event))
1086 return receiver->
event(event);
1175 if (start.
elapsed() > maxtime)
1177 if (flags & QEventLoop::DeferredDeletion)
1217 QThreadData *threadData =
self->d_func()->threadData;
1223 qWarning(
"QCoreApplication::exec: The event loop is already running");
1229 self->d_func()->in_exec =
true;
1230 self->d_func()->aboutToQuitEmitted =
false;
1231 int returnCode = eventLoop.
exec();
1234 self->d_func()->in_exec =
false;
1235 if (!
self->d_func()->aboutToQuitEmitted)
1237 self->d_func()->aboutToQuitEmitted =
true;
1270 eventLoop->
exit(returnCode);
1352 if (receiver == 0) {
1353 qWarning(
"QCoreApplication::postEvent: Unexpected null receiver");
1358 QThreadData *
volatile * pdata = &receiver->d_func()->threadData;
1370 while (data != *pdata) {
1386 if (receiver->d_func()->postedEvents
1387 &&
self &&
self->compressEvent(event, receiver, &data->
postEventList)) {
1394 event->d =
reinterpret_cast<QEventPrivate *
>(
quintptr(data->loopLevel));
1400 data->postEventList.addEvent(
QPostEvent(receiver, event, priority));
1401 eventDeleter.
take();
1403 ++receiver->d_func()->postedEvents;
1404 data->canWait =
false;
1407 if (data->eventDispatcher)
1408 data->eventDispatcher->wakeUp();
1428 for (
int i=0; i<postedEvents->
size(); ++i) {
1440 && receiver->d_func()->postedEvents > 0) {
1441 for (
int i = 0; i < postedEvents->
size(); ++i) {
1491 if (event_type == -1) {
1496 if (receiver && receiver->d_func()->threadData !=
data) {
1497 qWarning(
"QCoreApplication::sendPostedEvents: Cannot send " 1498 "posted events for objects in another thread");
1505 if (event_type == QEvent::ChildInserted) {
1508 receiver->d_func()->sendPendingChildInsertedEvents();
1514 event_type = QEvent::ChildInsertedRequest;
1525 if (data->
postEventList.
size() == 0 || (receiver && !receiver->d_func()->postedEvents)) {
1538 while (i < data->postEventList.size()) {
1548 if ((receiver && receiver != pe.
receiver) || (event_type && event_type != pe.
event->
type())) {
1557 const bool allowDeferredDelete =
1562 if (!allowDeferredDelete) {
1564 if (!event_type && !receiver) {
1579 --r->d_func()->postedEvents;
1580 Q_ASSERT(r->d_func()->postedEvents >= 0);
1588 #ifdef QT_NO_EXCEPTIONS 1672 if (eventType == QEvent::ChildInserted)
1673 eventType = QEvent::ChildInsertedRequest;
1683 if (receiver && !receiver->d_func()->postedEvents)
1692 for (
int i = 0; i < n; ++i) {
1695 if ((!receiver || pe.
receiver == receiver)
1696 && (pe.
event && (eventType == 0 || pe.
event->
type() == eventType))) {
1697 --pe.
receiver->d_func()->postedEvents;
1699 if (pe.
event->
type() == QEvent::ChildInsertedRequest)
1700 pe.
receiver->d_func()->pendingChildInsertedEvents.clear();
1713 if (receiver && eventType == 0) {
1714 Q_ASSERT(!receiver->d_func()->postedEvents);
1724 for (
int i = 0; i < events.
count(); ++i) {
1741 if (!event || !event->
posted)
1749 #if defined(QT_DEBUG) 1750 qDebug(
"QCoreApplication::removePostedEvent: Internal error: %p %d is posted",
1751 (
void*)event, event->
type());
1758 if (pe.
event == event) {
1760 qWarning(
"QCoreApplication::removePostedEvent: Event of type %d deleted while posted to %s %s",
1765 --pe.
receiver->d_func()->postedEvents;
1841 #ifndef QT_NO_TRANSLATION 1867 if (!translationFile)
1875 #ifndef QT_NO_TRANSLATION_BUILDER 1876 if (translationFile->
isEmpty())
1894 if (!translationFile)
1909 const char *disambiguation,
Encoding encoding)
1911 return translate(context, sourceText, disambiguation, encoding, -1);
1931 result->
replace(percentPos, len, fmt);
1987 const char *disambiguation,
Encoding encoding,
int n)
1994 if (
self && !
self->d_func()->translators.isEmpty()) {
1997 for (it =
self->d_func()->translators.constBegin(); it !=
self->d_func()->translators.
constEnd(); ++
it) {
1998 translationFile = *
it;
1999 result = translationFile->
translate(context, sourceText, disambiguation, n);
2006 #ifdef QT_NO_TEXTCODEC 2030 return QCoreApplication::self
2031 && QCoreApplication::self->d_func()->translators.contains(translator);
2034 #endif //QT_NO_TRANSLATE 2063 qWarning(
"QCoreApplication::applicationDirPath: Please instantiate the QApplication object first");
2069 #
if defined(Q_OS_SYMBIAN)
2072 RFs& fs = qt_s60GetRFs();
2075 driveChar = (RProcess().FileName())[0];
2080 TDriveInfo driveInfo;
2081 TInt err = fs.CharToDrive(driveChar, drive);
2082 if (err == KErrNone) {
2083 err = fs.Drive(driveInfo, drive);
2085 if (err != KErrNone || (driveInfo.iDriveAtt & KDriveAttRom) || (driveInfo.iMediaAtt
2086 & KMediaAttWriteProtected)) {
2087 drive = fs.GetSystemDrive();
2088 fs.DriveToChar(drive, driveChar);
2093 TFileName privatePath;
2094 fs.PrivatePath(privatePath);
2095 appPath = qt_TDesC2QString(privatePath);
2124 qWarning(
"QCoreApplication::applicationFilePath: Please instantiate the QApplication object first");
2135 #elif defined(Q_OS_BLACKBERRY) 2138 const bool zygotized = fileInfo.
exists();
2147 const size_t maximum_path =
static_cast<size_t>(pathconf(
"/",_PC_PATH_MAX));
2148 char buff[maximum_path+1];
2149 if (_cmdname(buff)) {
2153 qWarning(
"QCoreApplication::applicationFilePath: _cmdname() failed");
2157 if (!executables.
empty()) {
2165 #elif defined(Q_WS_MAC) 2167 if(!qAppFileName_str.
isEmpty()) {
2173 #if defined(Q_OS_SYMBIAN) 2176 TInt err = proc.Open(proc.Id());
2177 if (err == KErrNone) {
2178 TFileName procName = proc.FileName();
2179 appPath.
append(
QString(reinterpret_cast<const QChar*>(procName.Ptr()), procName.Length()));
2186 #elif defined( Q_OS_UNIX ) 2225 if (candidate_fi.
exists() && !candidate_fi.
isDir()) {
2226 absPath = candidate;
2250 #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) 2251 return GetCurrentProcessId();
2252 #elif defined(Q_OS_VXWORKS) 2253 return (pid_t) taskIdCurrent;
2270 qWarning(
"QCoreApplication::argc: Please instantiate the QApplication object first");
2273 return self->d_func()->argc;
2288 qWarning(
"QCoreApplication::argv: Please instantiate the QApplication object first");
2291 return self->d_func()->argv;
2338 qWarning(
"QCoreApplication::arguments: Please instantiate the QApplication object first");
2344 #if defined(Q_OS_WINCE) 2345 wchar_t tempFilename[MAX_PATH+1];
2346 if (GetModuleFileName(0, tempFilename, MAX_PATH)) {
2347 tempFilename[MAX_PATH] = 0;
2350 #endif // Q_OS_WINCE 2353 if (
self->d_func()->application_type) {
2355 for (
int a = 0;
a < list.
count(); ++
a) {
2358 if (l1arg ==
"-qdevel" ||
2359 l1arg ==
"-qdebug" ||
2360 l1arg ==
"-reverse" ||
2361 l1arg ==
"-stylesheet" ||
2362 l1arg ==
"-widgetcount")
2367 else if (l1arg ==
"-style" ||
2368 l1arg ==
"-qmljsdebugger" ||
2369 l1arg ==
"-session" ||
2370 l1arg ==
"-graphicssystem" ||
2371 l1arg ==
"-testability")
2379 const int ac =
self->d_func()->argc;
2380 char **
const av =
self->d_func()->argv;
2381 for (
int a = 0;
a < ac; ++
a) {
2413 coreappdata()->orgName = orgName;
2418 #ifdef Q_OS_BLACKBERRY 2419 coreappdata()->loadManifest();
2421 return coreappdata()->orgName;
2444 coreappdata()->orgDomain = orgDomain;
2449 return coreappdata()->orgDomain;
2470 coreappdata()->application = application;
2475 #ifdef Q_OS_BLACKBERRY 2476 coreappdata()->loadManifest();
2479 QString appname = coreappdata() ? coreappdata()->application :
QString();
2481 appname = QCoreApplication::self->d_func()->appName();
2501 coreappdata()->applicationVersion = version;
2506 #ifdef Q_OS_BLACKBERRY 2507 coreappdata()->loadManifest();
2509 return coreappdata()->applicationVersion;
2512 #ifndef QT_NO_LIBRARY 2514 #if defined(Q_OS_SYMBIAN) 2515 void qt_symbian_installLibraryPaths(
QString installPathPlugins,
QStringList& libPaths)
2518 QString tempPath = installPathPlugins;
2522 RFs& fs = qt_s60GetRFs();
2523 TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.
constData()));
2525 _LIT(KStartDir,
"Y:");
2526 TFileName dirPath(KStartDir);
2527 dirPath.Append(tempPathPtr);
2528 TFindFile finder(fs);
2529 TInt err = finder.FindByDir(tempPathPtr, dirPath);
2530 while (err == KErrNone) {
2531 QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()),
2532 finder.File().Length());
2535 libPaths.
append(foundDir);
2536 err = finder.Find();
2569 if (!coreappdata()->app_libpaths) {
2572 #if defined(Q_OS_SYMBIAN) 2574 qt_symbian_installLibraryPaths(installPathPlugins, *app_libpaths);
2580 if (!app_libpaths->
contains(installPathPlugins))
2581 app_libpaths->
append(installPathPlugins);
2587 if (
self)
self->d_func()->appendApplicationPathToLibraryPaths();
2591 #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) 2600 && !app_libpaths->
contains(canonicalPath)) {
2601 app_libpaths->
append(canonicalPath);
2606 return *(coreappdata()->app_libpaths);
2626 if (!coreappdata()->app_libpaths)
2628 *(coreappdata()->app_libpaths) = paths;
2661 && !coreappdata()->app_libpaths->contains(canonicalPath)) {
2662 coreappdata()->app_libpaths->
prepend(canonicalPath);
2685 coreappdata()->app_libpaths->removeAll(canonicalPath);
2689 #if defined(Q_OS_SYMBIAN) 2690 void QCoreApplicationPrivate::rebuildInstallLibraryPaths()
2701 QStringList &app_libpaths = *coreappdata()->app_libpaths;
2704 bool installPathFound =
false;
2705 foreach (
QString path, app_libpaths) {
2708 if (!installPathFound)
2709 qt_symbian_installLibraryPaths(nativeInstallPathPlugins, newPaths);
2710 installPathFound =
true;
2715 app_libpaths = newPaths;
2719 #endif //QT_NO_LIBRARY 2794 return d->eventFilter(message, result);
2812 if (eventDispatcher)
2895 int QCoreApplication::enter_loop()
2900 qWarning(
"QCoreApplication::enter_loop: Must be called from the main thread");
2904 int returnCode = eventLoop.
exec();
2916 void QCoreApplication::exit_loop()
2921 if (data !=
self->d_func()->threadData) {
2922 qWarning(
"QCoreApplication::exit_loop: Must be called from the main thread");
2936 int QCoreApplication::loopLevel()
2940 return self->d_func()->threadData->eventLoops.size();
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static void removeLibraryPath(const QString &)
Removes path from the library path list.
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
The QDir class provides access to directory structures and their contents.
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QT_DEPRECATED int argc()
Use arguments().
static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QString qtTrId(const char *id, int n)
virtual void startingUp()
bool sendThroughApplicationEventFilters(QObject *, QEvent *)
static bool checkInstance(const char *method)
static void cleanup()
Cleans up the QThread system.
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
static QStringList qWinCmdArgs(QString cmdLine)
Encoding
This enum type defines the 8-bit encoding of character string arguments to translate(): ...
QIntegerForSizeof< void * >::Unsigned quintptr
static bool versionSupported()
static bool is_app_running
static void finish(void **)
#define QT_END_NAMESPACE
This macro expands to.
void lock()
Locks the mutex.
~QCoreApplicationPrivate()
The QMutex class provides access serialization between threads.
void qt_register_signal_spy_callbacks(const QSignalSpyCallbackSet &callback_set)
QString cachedApplicationFilePath
QString absoluteFilePath(const QString &fileName) const
Returns the absolute path name of a file in the directory.
char * data()
Returns a pointer to the data stored in the byte array.
QString cachedApplicationDirPath
const QChar at(int i) const
Returns the character at the given index position in the string.
#define it(className, varName)
void qAddPostRoutine(QtCleanUpFunction p)
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
static void postEvent(QObject *receiver, QEvent *event)
Adds the event event, with the object receiver as the receiver of the event, to an event queue and re...
The QSettings class provides persistent platform-independent application settings.
static QString applicationFilePath()
Returns the file path of the application executable.
static QAbstractEventDispatcher * instance(QThread *thread=0)
Returns a pointer to the event dispatcher object for the specified thread.
static QString qmljsDebugArguments()
static glyph_t stripped(glyph_t glyph)
static void removeTranslator(QTranslator *messageFile)
Removes the translation file translationFile from the list of translation files used by this applicat...
QString objectName
the name of this object
QString & replace(int i, int len, QChar after)
#define at(className, varName)
The QByteArray class provides an array of bytes.
int length() const
Returns the number of characters in this string.
static void setAttribute(Qt::ApplicationAttribute attribute, bool on=true)
Sets the attribute attribute if on is true; otherwise clears the attribute.
#define Q_WS_WIN
Defined on Windows.
QString & prepend(QChar c)
T * take()
Returns the value of the pointer referenced by this object.
bool empty() const
This function is provided for STL compatibility.
static int exec()
Enters the main event loop and waits until exit() is called.
static void addLibraryPath(const QString &)
Prepends path to the beginning of the library path list, ensuring that it is searched for libraries f...
void unlock()
Unlocks this mutex locker.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
static QString toQString(CFStringRef cfstr)
static bool testAttribute(uint flag)
void addEvent(const QPostEvent &ev)
QString absoluteFilePath() const
Returns an absolute path including the file name.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
bool exists() const
Returns true if the file exists; otherwise returns false.
static QThread * theMainThread
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
Q_CORE_EXPORT void * qMalloc(size_t size)
bool notify_helper(QObject *, QEvent *)
EventFilter setEventFilter(EventFilter filter)
Replaces the event filter function for the QCoreApplication with filter and returns the pointer to th...
static QString macMenuBarName()
bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
QString applicationVersion
The QString class provides a Unicode character string.
void appendApplicationPathToLibraryPaths(void)
static QT_DEPRECATED char ** argv()
Use arguments() instead.
virtual bool compressEvent(QEvent *, QObject *receiver, QPostEventList *)
Returns true if event was compressed away (possibly deleted) and should not be added to the list...
The QVector class is a template class that provides a dynamic array.
The QObject class is the base class of all Qt objects.
static void installTranslator(QTranslator *messageFile)
Adds the translation file translationFile to the list of translation files to be used for translation...
bool startsWith(const QByteArray &a) const
Returns true if this byte array starts with byte array ba; otherwise returns false.
void Q_CORE_EXPORT qt_call_post_routines()
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
static QChar separator()
Returns the native directory separator: "/" under Unix (including Mac OS X) and "\\" under Windows...
The QElapsedTimer class provides a fast way to calculate elapsed times.
static void replacePercentN(QString *result, int n)
The QChar class provides a 16-bit Unicode character.
qint64 elapsed() const
Returns the number of milliseconds since this QElapsedTimer was last started.
static void processEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Processes all pending events for the calling thread according to the specified flags until there are ...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
static QFileSystemEntry currentPath()
static QString decodeName(const QByteArray &localFileName)
This does the reverse of QFile::encodeName() using localFileName.
bool exists() const
Returns true if the file specified by fileName() exists; otherwise returns false. ...
void relock()
Relocks an unlocked mutex locker.
Q_CORE_EXPORT void qDebug(const char *,...)
static void quit()
Tells the application to exit with return code 0 (success).
QByteArray right(int len) const
Returns a byte array that contains the rightmost len bytes of this byte array.
friend class const_iterator
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
static QThreadData * get2(QThread *thread)
void append(const T &t)
Inserts value at the end of the list.
virtual bool notify(QObject *, QEvent *)
Sends event to receiver: {receiver}->event(event).
static QString applicationDirPath()
Returns the directory that contains the application executable.
Q_CORE_EXPORT uint qGlobalPostedEventsCount()
The QThreadPool class manages a collection of QThreads.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static void initializeProcessManager()
virtual QString appName() const
static bool isEmpty(const char *str)
The QEventLoop class provides a means of entering and leaving an event loop.
static QString tempPath()
void truncate(int pos)
Truncates the string at the given position index.
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory; otherwise ret...
static bool activateCallbacks(Callback, void **)
void waitForDone()
Waits for each thread to exit and removes all threads from the thread pool.
T takeFirst()
Removes the first item in the list and returns it.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Q_GLOBAL_STATIC_WITH_ARGS(QSettings, staticTrolltechConf,(QSettings::UserScope, QLatin1String("Trolltech"))) QSettings *QCoreApplicationPrivate
QCoreApplication(int &argc, char **argv)
Constructs a Qt kernel application.
void checkReceiverThread(QObject *receiver)
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
static void setOrganizationDomain(const QString &orgDomain)
QByteArray trimmed() const
Returns a byte array that has whitespace removed from the start and the end.
void prepend(const T &t)
Inserts value at the beginning of the list.
static QDir current()
Returns the application's current directory.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
QMutexUnlocker(QMutex *m)
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
QBasicAtomicPointer< T > pointer
Q_CORE_EXPORT void qWarning(const char *,...)
static qint64 applicationPid()
Returns the current process ID for the application.
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
void qt_set_current_thread_to_main_thread()
QPostEventList postEventList
QChar toUpper() const
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the ch...
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
void moveToThread(QThread *thread)
Changes the thread affinity for this object and its children.
static void split(QT_FT_Vector *b)
static void sendPostedEvents()
virtual void wakeUp()=0
Wakes up the event loop.
static QTextCodec * codecForTr()
Returns the codec used by QObject::tr() on its argument.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
static void setOrganizationName(const QString &orgName)
static int app_compile_version
static QString cleanPath(const QString &path)
Removes all multiple directory separators "/" and resolves any "."s or ".."s found in the path...
QByteArray mid(int index, int len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos...
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
void unlock()
Unlocks the mutex.
virtual void createEventDispatcher()
void aboutToQuit()
This signal is emitted when the application is about to quit the main event loop, e...
void processCommandLineArguments()
static void setApplicationVersion(const QString &version)
static bool hasPendingEvents()
This function returns true if there are pending events; otherwise returns false.
const T & at(int i) const
Returns the item at index position i in the vector.
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
static bool startingUp()
Returns true if an application object has not been created yet; otherwise returns false...
virtual void closingDown()
static bool createDirectory(const QFileSystemEntry &entry, bool createParents)
QStringList * app_libpaths
int length() const
Same as size().
void * qMemCopy(void *dest, const void *src, size_t n)
T & first()
Returns a reference to the first item in the list.
The QTranslator class provides internationalization support for text output.
const char * constData() const
Returns a pointer to the data stored in the byte array.
bool isNull() const
Returns true if this string is null; otherwise returns false.
QString toUnicode(const QByteArray &) const
Converts a from the encoding of this codec to Unicode, and returns the result in a QString...
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
void insert(int i, const T &t)
Inserts value at index position i in the vector.
The QCoreApplication class provides an event loop for console Qt applications.
virtual QString translate(const char *context, const char *sourceText, const char *disambiguation=0) const
Returns the translation for the key (context, sourceText, disambiguation).
#define Q_ASSERT_X(cond, where, what)
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
iterator erase(iterator pos)
Removes the item associated with the iterator pos from the list, and returns an iterator to the next ...
void exit(int returnCode=0)
Tells the event loop to exit with a return code.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
QString & append(QChar c)
int compare(const QString &s) const
static bool closingDown()
Returns true if the application objects are being destroyed; otherwise returns false.
The QFile class provides an interface for reading from and writing to files.
static QString applicationVersion()
virtual bool hasPendingEvents()=0
Returns true if there is an event waiting; otherwise returns false.
The QTimerEvent class contains parameters that describe a timer event.
static QAbstractEventDispatcher * eventDispatcher
static QThread * mainThread()
virtual bool processEvents(QEventLoop::ProcessEventsFlags flags)=0
Processes pending events that match flags until there are no more events to process.
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
qint64 readLine(char *data, qint64 maxlen)
This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes...
void Q_CORE_EXPORT qt_startup_hook()
virtual bool isEmpty() const
Returns true if this translator is empty, otherwise returns false.
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
~QCoreApplication()
Destroys the QCoreApplication object.
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
static QStringList libraryPaths()
Returns a list of paths that the application will search when dynamically loading libraries...
static QString location(LibraryLocation)
Returns the location specified by loc.
static bool isTranslatorInstalled(QTranslator *translator)
QObject * parent() const
Returns a pointer to the parent object.
bool notifyInternal(QObject *receiver, QEvent *event)
bool(* EventFilter)(void *message, long *result)
A function with the following signature that can be used as an event filter:
Q_GLOBAL_STATIC(QString, qmljs_debug_arguments)
static void exit(int retcode=0)
Tells the application to exit with a return code.
int size() const
Returns the number of items in the list.
QString canonicalPath() const
Returns the canonical path, i.e.
QSignalSpyCallbackSet Q_CORE_EXPORT qt_signal_spy_callback_set
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
static QThreadPool * globalInstance()
Returns the global QThreadPool instance.
static QString organizationDomain()
QList< QtCleanUpFunction > QVFuncList
static QThreadData * current()
static bool is_app_closing
static QString organizationName()
friend class QCoreApplicationPrivate
static void setApplicationName(const QString &application)
static void setLibraryPaths(const QStringList &)
Sets the list of directories to search when loading libraries to paths.
static QCoreApplication * self
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Q_CORE_EXPORT bool qt_locale_initialized
T * data()
Returns a pointer to the data stored in the vector.
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
static QStringList arguments()
Returns the list of command-line arguments.
removePostedEvents
Removes all events of the given eventType that were posted using postEvent() for receiver.
QTranslatorList translators
QThread * thread() const
Returns the thread in which the object lives.
static QString applicationName()
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
QString path() const
Returns the file's path.
bool isSymLink() const
Returns true if this object points to a symbolic link (or to a shortcut on Windows); otherwise return...
bool filterEvent(void *message, long *result)
Sends message through the event filter that was set by setEventFilter().
The QFileInfo class provides system-independent file information.
void qRemovePostRoutine(QtCleanUpFunction p)
bool atEnd() const
Returns true if the end of the file has been reached; otherwise returns false.
QString filePath() const
Returns the file name, including the path (which may be absolute or relative).
virtual void close()
Calls QFile::flush() and closes the file.
bool sendThroughObjectEventFilters(QObject *, QEvent *)
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
The QThread class provides a platform-independent way to manage threads.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
int size() const
Returns the number of items in the vector.
QAbstractEventDispatcher * eventDispatcher
static QMutex * globalInstanceGet(const void *address)
Returns a QMutex from the global mutex pool.
void start()
Starts this timer.
QStringList entryList(Filters filters=NoFilter, SortFlags sort=NoSort) const
Returns a list of the names of all the files and directories in the directory, ordered according to t...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void swap(QList< T > &other)
Swaps list other with this list.
const QChar * constData() const
Returns a pointer to the data stored in the QString.
int exec(ProcessEventsFlags flags=AllEvents)
Enters the main event loop and waits until exit() is called.
The QAbstractEventDispatcher class provides an interface to manage Qt's event queue.
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
Qt::HANDLE qt_application_thread_id
static void flush()
Flushes the platform specific event queues.
virtual bool winEventFilter(MSG *message, long *result)
The message procedure calls this function for every message received.
The QList class is a template class that provides lists.
void(* QtCleanUpFunction)()
static void removePostedEvent(QEvent *)
Removes event from the queue of posted events, and emits a warning message if appropriate.
T & top()
Returns a reference to the stack's top item.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
static Qt::HANDLE currentThreadId()
Returns the thread handle of the currently executing thread.
QStack< QEventLoop * > eventLoops