diff options
author | miniak <milan.burda@gmail.com> | 2010-04-09 12:04:43 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-04-09 12:04:43 (GMT) |
commit | ef3b0420bfa9ef810267d174922ff2477f983c8d (patch) | |
tree | 74de9a2f2974b94a02cc5f013938df1cad2f69b3 /src/corelib/kernel | |
parent | 6a9e6f4780f5fc3aaf34f93c85de575f81c91e48 (diff) | |
download | Qt-ef3b0420bfa9ef810267d174922ff2477f983c8d.zip Qt-ef3b0420bfa9ef810267d174922ff2477f983c8d.tar.gz Qt-ef3b0420bfa9ef810267d174922ff2477f983c8d.tar.bz2 |
Remove obsolete function set_winapp_name()
Make sure that qWinAppInst(), qWinAppPrevInst(), qWinAppCmdShow() return correct values.
Merge-request: 2263
Reviewed-by: Thierry Bastian <thierry.bastian@nokia.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 7 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication_win.cpp | 51 |
2 files changed, 14 insertions, 44 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 8fc3fb8..f30f301 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -522,8 +522,6 @@ QCoreApplication::QCoreApplication(int &argc, char **argv) } -extern void set_winapp_name(); - // ### move to QCoreApplicationPrivate constructor? void QCoreApplication::init() { @@ -534,11 +532,6 @@ void QCoreApplication::init() qt_locale_initialized = true; #endif -#ifdef Q_WS_WIN - // Get the application name/instance if qWinMain() was not invoked - set_winapp_name(); -#endif - Q_ASSERT_X(!self, "QCoreApplication", "there should be only one application object"); QCoreApplication::self = this; diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index c1925e7..040b2cc 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -52,26 +52,26 @@ QT_BEGIN_NAMESPACE -char appFileName[MAX_PATH]; // application file name -char theAppName[MAX_PATH]; // application name -HINSTANCE appInst = 0; // handle to app instance -HINSTANCE appPrevInst = 0; // handle to prev app instance -int appCmdShow = 0; bool usingWinMain = false; // whether the qWinMain() is used or not Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle { - return appInst; + return GetModuleHandle(0); } Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app handle { - return appPrevInst; + return 0; } Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command { - return appCmdShow; + STARTUPINFO startupInfo; + GetStartupInfo(&startupInfo); + + return (startupInfo.dwFlags & STARTF_USESHOWWINDOW) + ? startupInfo.wShowWindow + : SW_SHOWDEFAULT; } Q_CORE_EXPORT QString qAppFileName() // get application file name @@ -115,25 +115,6 @@ Q_CORE_EXPORT QString qAppFileName() // get application file name return res; } -void set_winapp_name() -{ - static bool already_set = false; - if (!already_set) { - already_set = true; - - QString moduleName = qAppFileName(); - - QByteArray filePath = moduleName.toLocal8Bit(); - QByteArray fileName = QFileInfo(moduleName).baseName().toLocal8Bit(); - - memcpy(appFileName, filePath.constData(), filePath.length()); - memcpy(theAppName, fileName.constData(), fileName.length()); - - if (appInst == 0) - appInst = GetModuleHandle(0); - } -} - QString QCoreApplicationPrivate::appName() const { return QFileInfo(qAppFileName()).baseName(); @@ -198,20 +179,16 @@ void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam, already_called = true; usingWinMain = true; - // Install default debug handler - + // Install default debug handler qInstallMsgHandler(qWinMsgHandler); - // Create command line - + // Create command line argv = qWinCmdLine<char>(cmdParam, int(strlen(cmdParam)), argc); - // Get Windows parameters - - appInst = instance; - appPrevInst = prevInstance; - appCmdShow = cmdShow; - set_winapp_name(); + // Ignore Windows parameters + Q_UNUSED(instance); + Q_UNUSED(prevInstance); + Q_UNUSED(cmdShow); } /*! |