Changeset 871
- Timestamp:
- Jun 9, 2011, 8:17:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/util/qsystemtrayicon_pm.cpp
r856 r871 246 246 } 247 247 248 template <typename T> 249 inline T AssignFromVoidPtr(T &var, void *val) { var = (T)val; return var; } 250 251 static bool gotApis = false; 252 253 static bool resolveApis() 254 { 255 static bool tried = false; 256 257 if (!tried) { 258 tried = true; 259 260 do { 261 // link to the xsystray API DLL at runtime 262 QLibrary xsystray(QLatin1String("xsystray")); 263 264 #define R(f) if (AssignFromVoidPtr(f, xsystray.resolve(#f)) == NULL) break 265 266 R(xstQuerySysTrayVersion); 267 R(xstAddSysTrayIcon); 268 R(xstReplaceSysTrayIcon); 269 R(xstRemoveSysTrayIcon); 270 R(xstSetSysTrayIconToolTip); 271 R(xstQuerySysTrayIconRect); 272 R(xstShowSysTrayIconBalloon); 273 R(xstHideSysTrayIconBalloon); 274 R(xstGetSysTrayCreatedMsgId); 275 R(xstGetSysTrayMaxTextLen); 276 277 #undef R 278 279 // initialize some constants 280 WM_XST_CREATED = xstGetSysTrayCreatedMsgId(); 281 MaxTextLen = xstGetSysTrayMaxTextLen(); 282 283 gotApis = true; 284 285 } while (0); 286 } 287 288 return gotApis; 289 } 290 248 291 void QSystemTrayIconPrivate::install_sys() 249 292 { 293 if (!gotApis && !resolveApis()) 294 return; 295 250 296 Q_Q(QSystemTrayIcon); 251 297 if (!sys) { … … 308 354 } 309 355 310 template <typename T>311 inline T AssignFromVoidPtr(T &var, void *val) { var = (T)val; return var; }312 313 356 bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys() 314 357 { 315 static bool tried = false; 316 if (!tried) { 317 tried = true; 318 319 // link to the xsystray DLL at runtime 320 QLibrary xsystray(QLatin1String("xsystray")); 321 322 #define R(f) if (AssignFromVoidPtr(f, xsystray.resolve(#f)) == NULL) return false 323 324 R(xstQuerySysTrayVersion); 325 R(xstAddSysTrayIcon); 326 R(xstReplaceSysTrayIcon); 327 R(xstRemoveSysTrayIcon); 328 R(xstSetSysTrayIconToolTip); 329 R(xstQuerySysTrayIconRect); 330 R(xstShowSysTrayIconBalloon); 331 R(xstHideSysTrayIconBalloon); 332 R(xstGetSysTrayCreatedMsgId); 333 R(xstGetSysTrayMaxTextLen); 334 335 #undef R 336 337 // initialize some constants 338 WM_XST_CREATED = xstGetSysTrayCreatedMsgId(); 339 MaxTextLen = xstGetSysTrayMaxTextLen(); 340 } 341 358 if (!gotApis && !resolveApis()) 359 return false; 342 360 return xstQuerySysTrayVersion(0, 0, 0); 343 361 }
Note:
See TracChangeset
for help on using the changeset viewer.