Changeset 50934 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 31, 2014 6:29:17 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.cpp
r50931 r50934 32 32 const QString &strActive /* = QString() */) 33 33 { 34 QIcon iconSet; 35 36 Assert(!strNormal.isEmpty()); 37 iconSet.addFile(strNormal, QSize(), 38 QIcon::Normal); 34 /* Prepare fallback icon: */ 35 static QIcon nullIcon; 36 37 /* Prepare icon: */ 38 QIcon icon; 39 40 /* Add 'normal' pixmap: */ 41 AssertReturn(!strNormal.isEmpty(), nullIcon); 42 addName(icon, strNormal, QIcon::Normal); 43 44 /* Add 'disabled' pixmap (if any): */ 39 45 if (!strDisabled.isEmpty()) 40 iconSet.addFile(strDisabled, QSize(), 41 QIcon::Disabled); 46 addName(icon, strDisabled, QIcon::Disabled); 47 48 /* Add 'active' pixmap (if any): */ 42 49 if (!strActive.isEmpty()) 43 iconSet.addFile(strActive, QSize(), 44 QIcon::Active); 45 return iconSet; 50 addName(icon, strActive, QIcon::Active); 51 52 /* Return icon: */ 53 return icon; 46 54 } 47 55 48 56 /* static */ 49 57 QIcon UIIconPool::iconSetOnOff(const QString &strNormal, const QString strNormalOff, 50 const QString &strDisabled /* = QString() */, 51 const QString &strDisabledOff /* = QString() */, 52 const QString &strActive /* = QString() */, 53 const QString &strActiveOff /* = QString() */) 54 { 55 QIcon iconSet; 56 57 Assert(!strNormal.isEmpty()); 58 iconSet.addFile(strNormal, QSize(), QIcon::Normal, QIcon::On); 59 if (!strNormalOff.isEmpty()) 60 iconSet.addFile(strNormalOff, QSize(), QIcon::Normal, QIcon::Off); 61 58 const QString &strDisabled /* = QString() */, const QString &strDisabledOff /* = QString() */, 59 const QString &strActive /* = QString() */, const QString &strActiveOff /* = QString() */) 60 { 61 /* Prepare fallback icon: */ 62 static QIcon nullIcon; 63 64 /* Prepare icon: */ 65 QIcon icon; 66 67 /* Add 'normal' on/off pixmaps: */ 68 AssertReturn(!strNormal.isEmpty(), nullIcon); 69 addName(icon, strNormal, QIcon::Normal, QIcon::On); 70 AssertReturn(!strNormalOff.isEmpty(), nullIcon); 71 addName(icon, strNormalOff, QIcon::Normal, QIcon::Off); 72 73 /* Add 'disabled' on/off pixmaps (if any): */ 62 74 if (!strDisabled.isEmpty()) 63 iconSet.addFile(strDisabled, QSize(), QIcon::Disabled, QIcon::On);75 addName(icon, strDisabled, QIcon::Disabled, QIcon::On); 64 76 if (!strDisabledOff.isEmpty()) 65 iconSet.addFile(strDisabledOff, QSize(), QIcon::Disabled, QIcon::Off); 66 77 addName(icon, strDisabledOff, QIcon::Disabled, QIcon::Off); 78 79 /* Add 'active' on/off pixmaps (if any): */ 67 80 if (!strActive.isEmpty()) 68 iconSet.addFile(strActive, QSize(), QIcon::Active, QIcon::On);81 addName(icon, strActive, QIcon::Active, QIcon::On); 69 82 if (!strActiveOff.isEmpty()) 70 iconSet.addFile(strActive, QSize(), QIcon::Active, QIcon::Off); 71 72 return iconSet; 83 addName(icon, strActiveOff, QIcon::Active, QIcon::Off); 84 85 /* Return icon: */ 86 return icon; 73 87 } 74 88 … … 195 209 } 196 210 211 /* static */ 212 void UIIconPool::addName(QIcon &icon, const QString &strName, 213 QIcon::Mode mode /* = QIcon::Normal */, QIcon::State state /* = QIcon::Off */) 214 { 215 /* Prepare pixmap on the basis of passed value: */ 216 QPixmap pixmap(strName); 217 /* Add pixmap: */ 218 icon.addPixmap(pixmap, mode, state); 219 220 #ifdef Q_WS_MAC 221 /* Test if HiDPI icons enabled: */ 222 if (qApp->testAttribute(Qt::AA_UseHighDpiPixmaps)) 223 { 224 /* Parse name to prefix and suffix: */ 225 QString strPrefix = strName.section('.', 0, -2); 226 QString strSuffix = strName.section('.', -1, -1); 227 /* Prepare HiDPI pixmap on the basis of values above: */ 228 QPixmap pixmapHiDPI(strPrefix + "_hidpi." + strSuffix); 229 /* Add HiDPI pixmap (if any): */ 230 if (!pixmapHiDPI.isNull()) 231 icon.addPixmap(pixmapHiDPI, mode, state); 232 } 233 #endif /* Q_WS_MAC */ 234 } 235 236 237 UIIconPoolGeneral::UIIconPoolGeneral() 238 { 239 /* Prepare OS type icon-name hash: */ 240 m_guestOSTypeIconNames.insert("Other", ":/os_other.png"); 241 m_guestOSTypeIconNames.insert("Other_64", ":/os_other_64.png"); 242 m_guestOSTypeIconNames.insert("DOS", ":/os_dos.png"); 243 m_guestOSTypeIconNames.insert("Netware", ":/os_netware.png"); 244 m_guestOSTypeIconNames.insert("L4", ":/os_l4.png"); 245 m_guestOSTypeIconNames.insert("Windows31", ":/os_win31.png"); 246 m_guestOSTypeIconNames.insert("Windows95", ":/os_win95.png"); 247 m_guestOSTypeIconNames.insert("Windows98", ":/os_win98.png"); 248 m_guestOSTypeIconNames.insert("WindowsMe", ":/os_winme.png"); 249 m_guestOSTypeIconNames.insert("WindowsNT4", ":/os_winnt4.png"); 250 m_guestOSTypeIconNames.insert("Windows2000", ":/os_win2k.png"); 251 m_guestOSTypeIconNames.insert("WindowsXP", ":/os_winxp.png"); 252 m_guestOSTypeIconNames.insert("WindowsXP_64", ":/os_winxp_64.png"); 253 m_guestOSTypeIconNames.insert("Windows2003", ":/os_win2k3.png"); 254 m_guestOSTypeIconNames.insert("Windows2003_64", ":/os_win2k3_64.png"); 255 m_guestOSTypeIconNames.insert("WindowsVista", ":/os_winvista.png"); 256 m_guestOSTypeIconNames.insert("WindowsVista_64", ":/os_winvista_64.png"); 257 m_guestOSTypeIconNames.insert("Windows2008", ":/os_win2k8.png"); 258 m_guestOSTypeIconNames.insert("Windows2008_64", ":/os_win2k8_64.png"); 259 m_guestOSTypeIconNames.insert("Windows7", ":/os_win7.png"); 260 m_guestOSTypeIconNames.insert("Windows7_64", ":/os_win7_64.png"); 261 m_guestOSTypeIconNames.insert("Windows8", ":/os_win8.png"); 262 m_guestOSTypeIconNames.insert("Windows8_64", ":/os_win8_64.png"); 263 m_guestOSTypeIconNames.insert("Windows81", ":/os_win8.png"); 264 m_guestOSTypeIconNames.insert("Windows81_64", ":/os_win8_64.png"); 265 m_guestOSTypeIconNames.insert("Windows2012_64", ":/os_win2k12_64.png"); 266 m_guestOSTypeIconNames.insert("WindowsNT", ":/os_win_other.png"); 267 m_guestOSTypeIconNames.insert("WindowsNT_64", ":/os_win_other.png"); /// @todo os_win_other_64 268 m_guestOSTypeIconNames.insert("OS2Warp3", ":/os_os2warp3.png"); 269 m_guestOSTypeIconNames.insert("OS2Warp4", ":/os_os2warp4.png"); 270 m_guestOSTypeIconNames.insert("OS2Warp45", ":/os_os2warp45.png"); 271 m_guestOSTypeIconNames.insert("OS2eCS", ":/os_os2ecs.png"); 272 m_guestOSTypeIconNames.insert("OS21x", ":/os_os2_other.png"); 273 m_guestOSTypeIconNames.insert("OS2", ":/os_os2_other.png"); 274 m_guestOSTypeIconNames.insert("Linux22", ":/os_linux22.png"); 275 m_guestOSTypeIconNames.insert("Linux24", ":/os_linux24.png"); 276 m_guestOSTypeIconNames.insert("Linux24_64", ":/os_linux24_64.png"); 277 m_guestOSTypeIconNames.insert("Linux26", ":/os_linux26.png"); 278 m_guestOSTypeIconNames.insert("Linux26_64", ":/os_linux26_64.png"); 279 m_guestOSTypeIconNames.insert("ArchLinux", ":/os_archlinux.png"); 280 m_guestOSTypeIconNames.insert("ArchLinux_64", ":/os_archlinux_64.png"); 281 m_guestOSTypeIconNames.insert("Debian", ":/os_debian.png"); 282 m_guestOSTypeIconNames.insert("Debian_64", ":/os_debian_64.png"); 283 m_guestOSTypeIconNames.insert("OpenSUSE", ":/os_opensuse.png"); 284 m_guestOSTypeIconNames.insert("OpenSUSE_64", ":/os_opensuse_64.png"); 285 m_guestOSTypeIconNames.insert("Fedora", ":/os_fedora.png"); 286 m_guestOSTypeIconNames.insert("Fedora_64", ":/os_fedora_64.png"); 287 m_guestOSTypeIconNames.insert("Gentoo", ":/os_gentoo.png"); 288 m_guestOSTypeIconNames.insert("Gentoo_64", ":/os_gentoo_64.png"); 289 m_guestOSTypeIconNames.insert("Mandriva", ":/os_mandriva.png"); 290 m_guestOSTypeIconNames.insert("Mandriva_64", ":/os_mandriva_64.png"); 291 m_guestOSTypeIconNames.insert("RedHat", ":/os_redhat.png"); 292 m_guestOSTypeIconNames.insert("RedHat_64", ":/os_redhat_64.png"); 293 m_guestOSTypeIconNames.insert("Turbolinux", ":/os_turbolinux.png"); 294 m_guestOSTypeIconNames.insert("Turbolinux_64", ":/os_turbolinux_64.png"); 295 m_guestOSTypeIconNames.insert("Ubuntu", ":/os_ubuntu.png"); 296 m_guestOSTypeIconNames.insert("Ubuntu_64", ":/os_ubuntu_64.png"); 297 m_guestOSTypeIconNames.insert("Xandros", ":/os_xandros.png"); 298 m_guestOSTypeIconNames.insert("Xandros_64", ":/os_xandros_64.png"); 299 m_guestOSTypeIconNames.insert("Oracle", ":/os_oracle.png"); 300 m_guestOSTypeIconNames.insert("Oracle_64", ":/os_oracle_64.png"); 301 m_guestOSTypeIconNames.insert("Linux", ":/os_linux_other.png"); 302 m_guestOSTypeIconNames.insert("Linux_64", ":/os_linux_other.png"); /// @todo os_linux_other_64 303 m_guestOSTypeIconNames.insert("FreeBSD", ":/os_freebsd.png"); 304 m_guestOSTypeIconNames.insert("FreeBSD_64", ":/os_freebsd_64.png"); 305 m_guestOSTypeIconNames.insert("OpenBSD", ":/os_openbsd.png"); 306 m_guestOSTypeIconNames.insert("OpenBSD_64", ":/os_openbsd_64.png"); 307 m_guestOSTypeIconNames.insert("NetBSD", ":/os_netbsd.png"); 308 m_guestOSTypeIconNames.insert("NetBSD_64", ":/os_netbsd_64.png"); 309 m_guestOSTypeIconNames.insert("Solaris", ":/os_solaris.png"); 310 m_guestOSTypeIconNames.insert("Solaris_64", ":/os_solaris_64.png"); 311 m_guestOSTypeIconNames.insert("OpenSolaris", ":/os_oraclesolaris.png"); 312 m_guestOSTypeIconNames.insert("OpenSolaris_64", ":/os_oraclesolaris_64.png"); 313 m_guestOSTypeIconNames.insert("Solaris11_64", ":/os_oraclesolaris_64.png"); 314 m_guestOSTypeIconNames.insert("QNX", ":/os_qnx.png"); 315 m_guestOSTypeIconNames.insert("MacOS", ":/os_macosx.png"); 316 m_guestOSTypeIconNames.insert("MacOS_64", ":/os_macosx_64.png"); 317 m_guestOSTypeIconNames.insert("MacOS106", ":/os_macosx.png"); 318 m_guestOSTypeIconNames.insert("MacOS106_64", ":/os_macosx_64.png"); 319 m_guestOSTypeIconNames.insert("MacOS107_64", ":/os_macosx_64.png"); 320 m_guestOSTypeIconNames.insert("MacOS108_64", ":/os_macosx_64.png"); 321 m_guestOSTypeIconNames.insert("MacOS109_64", ":/os_macosx_64.png"); 322 m_guestOSTypeIconNames.insert("JRockitVE", ":/os_jrockitve.png"); 323 } 324 325 QPixmap UIIconPoolGeneral::guestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize /* = 0 */) const 326 { 327 /* Prepare fallback pixmap: */ 328 static QPixmap nullPixmap; 329 330 /* If we do NOT have that 'guest OS type' icon cached already: */ 331 if (!m_guestOSTypeIcons.contains(strOSTypeID)) 332 { 333 /* Compose proper icon if we have that 'guest OS type' known: */ 334 if (m_guestOSTypeIconNames.contains(strOSTypeID)) 335 m_guestOSTypeIcons[strOSTypeID] = iconSet(m_guestOSTypeIconNames[strOSTypeID]); 336 /* Assign fallback icon if we do NOT have that 'guest OS type' known: */ 337 else 338 m_guestOSTypeIcons[strOSTypeID] = iconSet(nullPixmap); 339 } 340 341 /* Retrieve corresponding icon: */ 342 const QIcon &icon = m_guestOSTypeIcons[strOSTypeID]; 343 AssertMsgReturn(!icon.isNull(), 344 ("Undefined icon for type '%s'.", strOSTypeID.toLatin1().constData()), 345 nullPixmap); 346 347 /* Retrieve available sizes for that icon: */ 348 const QList<QSize> availableSizes = icon.availableSizes(); 349 AssertMsgReturn(!availableSizes.isEmpty(), 350 ("Undefined icon for type '%s'.", strOSTypeID.toLatin1().constData()), 351 nullPixmap); 352 353 /* Pass up logical size if necessary: */ 354 if (pLogicalSize) 355 *pLogicalSize = availableSizes.first(); 356 357 /* Return pixmap of first available size: */ 358 return icon.pixmap(availableSizes.first()); 359 } 360 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.h
r50931 r50934 20 20 /* Qt includes: */ 21 21 #include <QIcon> 22 #include <QPixmap> 23 #include <QHash> 22 24 23 /** General icon-pool which provides GUI with: 24 * 1. necessary cached icons and 25 * 2. ways to dynamically open/read/create icons at runtime 26 * depending on current style. */ 25 /** Interface which provides GUI with static API 26 * allowing to dynamically compose icons at runtime. */ 27 27 class UIIconPool 28 28 { … … 75 75 static QIcon defaultIcon(UIDefaultIconType defaultIconType, const QWidget *pWidget = 0); 76 76 77 pr ivate:77 protected: 78 78 79 79 /** Icon-pool constructor. */ … … 81 81 82 82 /** Icon-pool destructor. */ 83 ~UIIconPool() {}; 83 virtual ~UIIconPool() {}; 84 85 private: 86 87 /** Adds resource named @a strName to passed @a icon 88 * for @a mode (QIcon::Normal by default) and @a state (QIcon::Off by default). */ 89 static void addName(QIcon &icon, const QString &strName, 90 QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off); 91 }; 92 93 /** UIIconPool interface extension used as general GUI icon-pool. 94 * Provides GUI with guest OS types pixmap cache. */ 95 class UIIconPoolGeneral : public UIIconPool 96 { 97 public: 98 99 /** General icon-pool constructor. */ 100 UIIconPoolGeneral(); 101 102 /** Returns pixmap corresponding to passed @a strOSTypeID. 103 * In case if non-null @a pLogicalSize pointer provided, it will be updated properly. */ 104 QPixmap guestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize = 0) const; 105 106 private: 107 108 /** Guest OS type icon-names cache. */ 109 QHash<QString, QString> m_guestOSTypeIconNames; 110 /** Guest OS type icons cache. */ 111 mutable QHash<QString, QIcon> m_guestOSTypeIcons; 84 112 }; 85 113 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r50931 r50934 269 269 , m3DAvailable(-1) 270 270 , mSettingsPwSet(false) 271 , m_pIconPool(0) 271 272 { 272 273 /* Assign instance: */ … … 790 791 } 791 792 792 /** 793 * Returns the icon corresponding to the given guest OS type id. 794 */ 795 QPixmap VBoxGlobal::vmGuestOSTypeIcon(const QString &aTypeId) const 796 { 797 static const QPixmap none; 798 QPixmap *p = mOsTypeIcons.value(aTypeId); 799 AssertMsg(p, ("Icon for type '%s' must be defined.", aTypeId.toLatin1().constData())); 800 return p ? *p : none; 793 QPixmap VBoxGlobal::vmGuestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize /* = 0 */) const 794 { 795 /* Prepare fallback pixmap: */ 796 static QPixmap nullPixmap; 797 798 /* Make sure general icon-pool initialized: */ 799 AssertReturn(m_pIconPool, nullPixmap); 800 801 /* Redirect to general icon-pool: */ 802 return m_pIconPool->guestOSTypeIcon(strOSTypeID, pLogicalSize); 801 803 } 802 804 … … 4424 4426 } 4425 4427 4426 /* Fill in OS type icon dictionary. */ 4427 static const char * const s_kOSTypeIcons[][2] = 4428 { 4429 {"Other", ":/os_other.png"}, 4430 {"Other_64", ":/os_other_64.png"}, 4431 {"DOS", ":/os_dos.png"}, 4432 {"Netware", ":/os_netware.png"}, 4433 {"L4", ":/os_l4.png"}, 4434 {"Windows31", ":/os_win31.png"}, 4435 {"Windows95", ":/os_win95.png"}, 4436 {"Windows98", ":/os_win98.png"}, 4437 {"WindowsMe", ":/os_winme.png"}, 4438 {"WindowsNT4", ":/os_winnt4.png"}, 4439 {"Windows2000", ":/os_win2k.png"}, 4440 {"WindowsXP", ":/os_winxp.png"}, 4441 {"WindowsXP_64", ":/os_winxp_64.png"}, 4442 {"Windows2003", ":/os_win2k3.png"}, 4443 {"Windows2003_64", ":/os_win2k3_64.png"}, 4444 {"WindowsVista", ":/os_winvista.png"}, 4445 {"WindowsVista_64", ":/os_winvista_64.png"}, 4446 {"Windows2008", ":/os_win2k8.png"}, 4447 {"Windows2008_64", ":/os_win2k8_64.png"}, 4448 {"Windows7", ":/os_win7.png"}, 4449 {"Windows7_64", ":/os_win7_64.png"}, 4450 {"Windows8", ":/os_win8.png"}, 4451 {"Windows8_64", ":/os_win8_64.png"}, 4452 {"Windows81", ":/os_win8.png"}, 4453 {"Windows81_64", ":/os_win8_64.png"}, 4454 {"Windows2012_64", ":/os_win2k12_64.png"}, 4455 {"WindowsNT", ":/os_win_other.png"}, 4456 {"WindowsNT_64", ":/os_win_other.png"}, /// @todo os_win_other_64.png 4457 {"OS2Warp3", ":/os_os2warp3.png"}, 4458 {"OS2Warp4", ":/os_os2warp4.png"}, 4459 {"OS2Warp45", ":/os_os2warp45.png"}, 4460 {"OS2eCS", ":/os_os2ecs.png"}, 4461 {"OS21x", ":/os_os2_other.png"}, 4462 {"OS2", ":/os_os2_other.png"}, 4463 {"Linux22", ":/os_linux22.png"}, 4464 {"Linux24", ":/os_linux24.png"}, 4465 {"Linux24_64", ":/os_linux24_64.png"}, 4466 {"Linux26", ":/os_linux26.png"}, 4467 {"Linux26_64", ":/os_linux26_64.png"}, 4468 {"ArchLinux", ":/os_archlinux.png"}, 4469 {"ArchLinux_64", ":/os_archlinux_64.png"}, 4470 {"Debian", ":/os_debian.png"}, 4471 {"Debian_64", ":/os_debian_64.png"}, 4472 {"OpenSUSE", ":/os_opensuse.png"}, 4473 {"OpenSUSE_64", ":/os_opensuse_64.png"}, 4474 {"Fedora", ":/os_fedora.png"}, 4475 {"Fedora_64", ":/os_fedora_64.png"}, 4476 {"Gentoo", ":/os_gentoo.png"}, 4477 {"Gentoo_64", ":/os_gentoo_64.png"}, 4478 {"Mandriva", ":/os_mandriva.png"}, 4479 {"Mandriva_64", ":/os_mandriva_64.png"}, 4480 {"RedHat", ":/os_redhat.png"}, 4481 {"RedHat_64", ":/os_redhat_64.png"}, 4482 {"Turbolinux", ":/os_turbolinux.png"}, 4483 {"Turbolinux_64", ":/os_turbolinux_64.png"}, 4484 {"Ubuntu", ":/os_ubuntu.png"}, 4485 {"Ubuntu_64", ":/os_ubuntu_64.png"}, 4486 {"Xandros", ":/os_xandros.png"}, 4487 {"Xandros_64", ":/os_xandros_64.png"}, 4488 {"Oracle", ":/os_oracle.png"}, 4489 {"Oracle_64", ":/os_oracle_64.png"}, 4490 {"Linux", ":/os_linux_other.png"}, 4491 {"Linux_64", ":/os_linux_other.png"}, /// @todo os_linux_other_64.png 4492 {"FreeBSD", ":/os_freebsd.png"}, 4493 {"FreeBSD_64", ":/os_freebsd_64.png"}, 4494 {"OpenBSD", ":/os_openbsd.png"}, 4495 {"OpenBSD_64", ":/os_openbsd_64.png"}, 4496 {"NetBSD", ":/os_netbsd.png"}, 4497 {"NetBSD_64", ":/os_netbsd_64.png"}, 4498 {"Solaris", ":/os_solaris.png"}, 4499 {"Solaris_64", ":/os_solaris_64.png"}, 4500 {"OpenSolaris", ":/os_oraclesolaris.png"}, 4501 {"OpenSolaris_64", ":/os_oraclesolaris_64.png"}, 4502 {"Solaris11_64", ":/os_oraclesolaris_64.png"}, 4503 {"QNX", ":/os_qnx.png"}, 4504 {"MacOS", ":/os_macosx.png"}, 4505 {"MacOS_64", ":/os_macosx_64.png"}, 4506 {"MacOS106", ":/os_macosx.png"}, 4507 {"MacOS106_64", ":/os_macosx_64.png"}, 4508 {"MacOS107_64", ":/os_macosx_64.png"}, 4509 {"MacOS108_64", ":/os_macosx_64.png"}, 4510 {"MacOS109_64", ":/os_macosx_64.png"}, 4511 {"JRockitVE", ":/os_jrockitve.png"}, 4512 }; 4513 for (uint n = 0; n < SIZEOF_ARRAY(s_kOSTypeIcons); ++ n) 4514 { 4515 mOsTypeIcons.insert(s_kOSTypeIcons[n][0], new QPixmap(s_kOSTypeIcons[n][1])); 4516 } 4428 /* Prepare general icon-pool: */ 4429 m_pIconPool = new UIIconPoolGeneral; 4517 4430 4518 4431 /* online/offline snapshot icons */ … … 4881 4794 UIConverter::cleanup(); 4882 4795 4883 /* Ensure mOsTypeIcons is cleaned up: */ 4884 qDeleteAll(mOsTypeIcons); 4796 /* Cleanup general icon-pool: */ 4797 delete m_pIconPool; 4798 m_pIconPool = 0; 4885 4799 4886 4800 /* ensure CGuestOSType objects are no longer used */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r50864 r50934 32 32 /* GUI includes: */ 33 33 #include "UIDefs.h" 34 #include "UIIconPool.h" 34 35 #include "UIMediumDefs.h" 35 36 #include "VBoxGlobalSettings.h" … … 160 161 QList <CGuestOSType> vmGuestOSFamilyList() const; 161 162 QList <CGuestOSType> vmGuestOSTypeList (const QString &aFamilyId) const; 162 QPixmap vmGuestOSTypeIcon (const QString &aTypeId) const; 163 164 /** Returns pixmap corresponding to passed @a strOSTypeID. 165 * In case if non-null @a pLogicalSize pointer provided, it will be updated properly. */ 166 QPixmap vmGuestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize = 0) const; 167 163 168 CGuestOSType vmGuestOSType (const QString &aTypeId, 164 169 const QString &aFamilyId = QString::null) const; … … 514 519 QList <QString> mFamilyIDs; 515 520 QList <QList <CGuestOSType> > mTypes; 516 QHash <QString, QPixmap *> mOsTypeIcons;517 521 518 522 QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon; … … 532 536 char mSettingsPw[256]; 533 537 bool mSettingsPwSet; 538 539 /** General icon-pool. */ 540 UIIconPoolGeneral *m_pIconPool; 534 541 535 542 /* API: Instance stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r49364 r50934 413 413 #endif /* Q_WS_X11 */ 414 414 415 #ifdef Q_WS_MAC 416 /* Enable HiDPI icons. */ 417 qApp->setAttribute(Qt::AA_UseHighDpiPixmaps); 418 #endif /* Q_WS_MAC */ 419 415 420 #ifdef Q_OS_SOLARIS 416 421 /* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp
r50907 r50934 153 153 //////////////////////////////////////////////////////////////////////////////// 154 154 155 Q Icon UIVMItem::osIcon() const156 { 157 return m_fAccessible ? vboxGlobal().vmGuestOSTypeIcon(m_strOSTypeId ) :158 QPixmap(":/os_other.png");155 QPixmap UIVMItem::osPixmap(QSize *pLogicalSize /* = 0 */) const 156 { 157 return m_fAccessible ? vboxGlobal().vmGuestOSTypeIcon(m_strOSTypeId, pLogicalSize) : 158 vboxGlobal().vmGuestOSTypeIcon("Other", pLogicalSize); 159 159 } 160 160 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.h
r50907 r50934 45 45 46 46 QString name() const { return m_strName; } 47 Q Icon osIcon() const;47 QPixmap osPixmap(QSize *pLogicalSize = 0) const; 48 48 QString osTypeId() const { return m_strOSTypeId; } 49 49 QString id() const { return m_strId; } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp
r50932 r50934 216 216 { 217 217 /* Get new pixmap and pixmap-size: */ 218 QIcon icon = osIcon(); 219 QSize iconSize = icon.availableSizes().first(); 220 QPixmap pixmap = icon.pixmap(iconSize); 218 QSize pixmapSize; 219 QPixmap pixmap = osPixmap(&pixmapSize); 221 220 /* Update linked values: */ 222 if (m_pixmapSize != iconSize)223 { 224 m_pixmapSize = iconSize;221 if (m_pixmapSize != pixmapSize) 222 { 223 m_pixmapSize = pixmapSize; 225 224 updateFirstRowMaximumWidth(); 226 225 updateGeometry();
Note:
See TracChangeset
for help on using the changeset viewer.