summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2011-10-07 12:45:33 (GMT)
committerJan-Arve Saether <jan-arve.saether@nokia.com>2011-10-07 12:45:33 (GMT)
commit74251fb0fc57b1e0f7db0b561e4aa4c0347f6f37 (patch)
treec502d03701b8a700f9c0e83aadac4acc7ea975d5 /src
parent1bfef526ef3d1deb7cf0f11dc1880f33937a85ac (diff)
downloadQt-74251fb0fc57b1e0f7db0b561e4aa4c0347f6f37.zip
Qt-74251fb0fc57b1e0f7db0b561e4aa4c0347f6f37.tar.gz
Qt-74251fb0fc57b1e0f7db0b561e4aa4c0347f6f37.tar.bz2
simplify the code by using QSystemLibrary a bit smarter
Merge-request: 2655 Reviewed-by: Jan-Arve Saether <jan-arve.saether@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp12
-rw-r--r--src/gui/kernel/qapplication_win.cpp41
-rw-r--r--src/network/kernel/qhostinfo_win.cpp13
3 files changed, 26 insertions, 40 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 84663fa..3e367b7 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -328,13 +328,15 @@ static void resolveTimerAPI()
return;
#endif
triedResolve = true;
-#if !defined(Q_OS_WINCE)
- qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeSetEvent");
- qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeKillEvent");
+#ifndef Q_OS_WINCE
+ QSystemLibrary library(QLatin1String("Mmtimer"));
#else
- qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent");
- qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent");
+ QSystemLibrary library(QLatin1String("winmm"));
#endif
+ if (library.load()) {
+ qtimeSetEvent = (ptimeSetEvent)library.resolve("timeSetEvent");
+ qtimeKillEvent = (ptimeKillEvent)library.resolve("timeKillEvent");
+ }
}
}
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 756cb56..bca3acc 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -854,19 +854,15 @@ void qt_init(QApplicationPrivate *priv, int)
qt_win_initialize_directdraw();
#ifndef Q_OS_WINCE
- ptrUpdateLayeredWindowIndirect =
- (PtrUpdateLayeredWindowIndirect) QSystemLibrary::resolve(QLatin1String("user32"),
- "UpdateLayeredWindowIndirect");
- ptrUpdateLayeredWindow =
- (PtrUpdateLayeredWindow) QSystemLibrary::resolve(QLatin1String("user32"),
- "UpdateLayeredWindow");
+ QSystemLibrary user32(QLatin1String("user32"));
+ ptrUpdateLayeredWindowIndirect = (PtrUpdateLayeredWindowIndirect)user32.resolve("UpdateLayeredWindowIndirect");
+ ptrUpdateLayeredWindow = (PtrUpdateLayeredWindow)user32.resolve("UpdateLayeredWindow");
if (ptrUpdateLayeredWindow && !ptrUpdateLayeredWindowIndirect)
ptrUpdateLayeredWindowIndirect = qt_updateLayeredWindowIndirect;
// Notify Vista and Windows 7 that we support highter DPI settings
- ptrSetProcessDPIAware = (PtrSetProcessDPIAware)
- QSystemLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware");
+ ptrSetProcessDPIAware = (PtrSetProcessDPIAware)user32.resolve("SetProcessDPIAware");
if (ptrSetProcessDPIAware)
ptrSetProcessDPIAware();
#endif
@@ -886,29 +882,16 @@ void qt_init(QApplicationPrivate *priv, int)
priv->GetGestureExtraArgs = (PtrGetGestureExtraArgs) &TKGetGestureExtraArguments;
#elif !defined(Q_WS_WINCE)
#if !defined(QT_NO_NATIVE_GESTURES)
- priv->GetGestureInfo =
- (PtrGetGestureInfo)QSystemLibrary::resolve(QLatin1String("user32"),
- "GetGestureInfo");
- priv->GetGestureExtraArgs =
- (PtrGetGestureExtraArgs)QSystemLibrary::resolve(QLatin1String("user32"),
- "GetGestureExtraArgs");
- priv->CloseGestureInfoHandle =
- (PtrCloseGestureInfoHandle)QSystemLibrary::resolve(QLatin1String("user32"),
- "CloseGestureInfoHandle");
- priv->SetGestureConfig =
- (PtrSetGestureConfig)QSystemLibrary::resolve(QLatin1String("user32"),
- "SetGestureConfig");
- priv->GetGestureConfig =
- (PtrGetGestureConfig)QSystemLibrary::resolve(QLatin1String("user32"),
- "GetGestureConfig");
+ priv->GetGestureInfo = (PtrGetGestureInfo)user32.resolve("GetGestureInfo");
+ priv->GetGestureExtraArgs = (PtrGetGestureExtraArgs)user32.resolve("GetGestureExtraArgs");
+ priv->CloseGestureInfoHandle = (PtrCloseGestureInfoHandle)user32.resolve("CloseGestureInfoHandle");
+ priv->SetGestureConfig = (PtrSetGestureConfig)user32.resolve("SetGestureConfig");
+ priv->GetGestureConfig = (PtrGetGestureConfig)user32.resolve("GetGestureConfig");
#endif // QT_NO_NATIVE_GESTURES
QSystemLibrary libTheme(QLatin1String("uxtheme"));
- priv->BeginPanningFeedback =
- (PtrBeginPanningFeedback)libTheme.resolve("BeginPanningFeedback");
- priv->UpdatePanningFeedback =
- (PtrUpdatePanningFeedback)libTheme.resolve("UpdatePanningFeedback");
- priv->EndPanningFeedback =
- (PtrEndPanningFeedback)libTheme.resolve("EndPanningFeedback");
+ priv->BeginPanningFeedback = (PtrBeginPanningFeedback)libTheme.resolve("BeginPanningFeedback");
+ priv->UpdatePanningFeedback = (PtrUpdatePanningFeedback)libTheme.resolve("UpdatePanningFeedback");
+ priv->EndPanningFeedback = (PtrEndPanningFeedback)libTheme.resolve("EndPanningFeedback");
#endif
#endif // QT_NO_GESTURES
}
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index 6fc5b7b..03e72c4 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -85,14 +85,15 @@ static void resolveLibrary()
// Attempt to resolve getaddrinfo(); without it we'll have to fall
// back to gethostbyname(), which has no IPv6 support.
#if !defined(Q_OS_WINCE)
- local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getaddrinfo");
- local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "freeaddrinfo");
- local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getnameinfo");
+ QSystemLibrary ws2lib(QLatin1String("ws2_32"));
#else
- local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getaddrinfo");
- local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "freeaddrinfo");
- local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getnameinfo");
+ QSystemLibrary ws2lib(QLatin1String("ws2"));
#endif
+ if (ws2lib.load()) {
+ local_getaddrinfo = (getaddrinfoProto)ws2lib.resolve("getaddrinfo");
+ local_freeaddrinfo = (freeaddrinfoProto)ws2lib.resolve("freeaddrinfo");
+ local_getnameinfo = (getnameinfoProto)ws2lib.resolve("getnameinfo");
+ }
}
#if defined(Q_OS_WINCE)