Changeset 51579 in vbox
- Timestamp:
- Jun 9, 2014 1:01:49 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 94275
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.h
r51531 r51579 43 43 } 44 44 45 /* Q Pixmap<= template class: */46 template<class T> Q Pixmap toPixmap(const T &data) const45 /* QIcon <= template class: */ 46 template<class T> QIcon toIcon(const T &data) const 47 47 { 48 48 if (canConvert<T>()) 49 return ::to Pixmap(data);50 Assert(0); return Q Pixmap();49 return ::toIcon(data); 50 Assert(0); return QIcon(); 51 51 } 52 52 /* QPixmap <= template class: */ -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r51531 r51579 23 23 #include <QString> 24 24 #include <QColor> 25 #include <QIcon> 25 26 #include <QPixmap> 26 27 … … 37 38 template<class X> QColor toColor(const X & /* xobject */) { Assert(0); return QColor(); } 38 39 39 /* Converts passed 'Object X' to QPixmap. 40 * This function returns null QPixmap for any object type until re-determined for specific one. */ 41 template<class X> QPixmap toPixmap(const X & /* xobject */) { Assert(0); return QPixmap(); } 40 /* Converts passed 'Object X' to QIcon. 41 * This function returns null QIcon for any object type until re-determined for specific one. */ 42 template<class X> QIcon toIcon(const X & /* xobject */) { Assert(0); return QIcon(); } 43 42 44 /* Converts passed 'Object X' to QPixmap. 43 45 * This function returns null QPixmap for any object type until re-determined for specific one. */ … … 165 167 /* Declare COM conversion specializations: */ 166 168 template<> QColor toColor(const KMachineState &state); 167 template<> Q Pixmap toPixmap(const KMachineState &state);169 template<> QIcon toIcon(const KMachineState &state); 168 170 template<> QString toString(const KMachineState &state); 169 171 template<> QString toString(const KSessionState &state); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp
r51476 r51579 24 24 /* GUI includes: */ 25 25 #include "UIConverterBackend.h" 26 #include "UIIconPool.h" 26 27 27 28 /* COM includes: */ … … 87 88 } 88 89 89 /* Q Pixmap<= KMachineState: */90 template<> Q Pixmap toPixmap(const KMachineState &state)90 /* QIcon <= KMachineState: */ 91 template<> QIcon toIcon(const KMachineState &state) 91 92 { 92 93 switch (state) 93 94 { 94 case KMachineState_PoweredOff: return QPixmap(":/state_powered_off_16px.png");95 case KMachineState_Saved: return QPixmap(":/state_saved_16px.png");96 case KMachineState_Aborted: return QPixmap(":/state_aborted_16px.png");97 case KMachineState_Teleported: return QPixmap(":/state_saved_16px.png");98 case KMachineState_Running: return QPixmap(":/state_running_16px.png");99 case KMachineState_Paused: return QPixmap(":/state_paused_16px.png");100 case KMachineState_Stuck: return QPixmap(":/state_stuck_16px.png");101 case KMachineState_Teleporting: return QPixmap(":/state_running_16px.png");102 case KMachineState_LiveSnapshotting: return QPixmap(":/state_running_16px.png");103 case KMachineState_Starting: return QPixmap(":/state_running_16px.png");104 case KMachineState_Stopping: return QPixmap(":/state_running_16px.png");105 case KMachineState_Saving: return QPixmap(":/state_saving_16px.png");106 case KMachineState_Restoring: return QPixmap(":/state_restoring_16px.png");107 case KMachineState_TeleportingPausedVM: return QPixmap(":/state_saving_16px.png");108 case KMachineState_TeleportingIn: return QPixmap(":/state_restoring_16px.png");95 case KMachineState_PoweredOff: return UIIconPool::iconSet(":/state_powered_off_16px.png"); 96 case KMachineState_Saved: return UIIconPool::iconSet(":/state_saved_16px.png"); 97 case KMachineState_Aborted: return UIIconPool::iconSet(":/state_aborted_16px.png"); 98 case KMachineState_Teleported: return UIIconPool::iconSet(":/state_saved_16px.png"); 99 case KMachineState_Running: return UIIconPool::iconSet(":/state_running_16px.png"); 100 case KMachineState_Paused: return UIIconPool::iconSet(":/state_paused_16px.png"); 101 case KMachineState_Stuck: return UIIconPool::iconSet(":/state_stuck_16px.png"); 102 case KMachineState_Teleporting: return UIIconPool::iconSet(":/state_running_16px.png"); 103 case KMachineState_LiveSnapshotting: return UIIconPool::iconSet(":/state_running_16px.png"); 104 case KMachineState_Starting: return UIIconPool::iconSet(":/state_running_16px.png"); 105 case KMachineState_Stopping: return UIIconPool::iconSet(":/state_running_16px.png"); 106 case KMachineState_Saving: return UIIconPool::iconSet(":/state_saving_16px.png"); 107 case KMachineState_Restoring: return UIIconPool::iconSet(":/state_restoring_16px.png"); 108 case KMachineState_TeleportingPausedVM: return UIIconPool::iconSet(":/state_saving_16px.png"); 109 case KMachineState_TeleportingIn: return UIIconPool::iconSet(":/state_restoring_16px.png"); 109 110 // case KMachineState_FaultTolerantSyncing: 110 case KMachineState_DeletingSnapshotOnline: return QPixmap(":/state_discarding_16px.png");111 case KMachineState_DeletingSnapshotPaused: return QPixmap(":/state_discarding_16px.png");112 case KMachineState_RestoringSnapshot: return QPixmap(":/state_discarding_16px.png");113 case KMachineState_DeletingSnapshot: return QPixmap(":/state_discarding_16px.png");114 case KMachineState_SettingUp: return QPixmap(":/vm_settings_16px.png"); // TODO: Change icon!111 case KMachineState_DeletingSnapshotOnline: return UIIconPool::iconSet(":/state_discarding_16px.png"); 112 case KMachineState_DeletingSnapshotPaused: return UIIconPool::iconSet(":/state_discarding_16px.png"); 113 case KMachineState_RestoringSnapshot: return UIIconPool::iconSet(":/state_discarding_16px.png"); 114 case KMachineState_DeletingSnapshot: return UIIconPool::iconSet(":/state_discarding_16px.png"); 115 case KMachineState_SettingUp: return UIIconPool::iconSet(":/vm_settings_16px.png"); // TODO: Change icon! 115 116 // case KMachineState_FirstOnline: 116 117 // case KMachineState_LastOnline: 117 118 // case KMachineState_FirstTransient: 118 119 // case KMachineState_LastTransient: 119 default: AssertMsgFailed(("No pixmapfor %d", state)); break;120 } 121 return Q Pixmap();120 default: AssertMsgFailed(("No icon for %d", state)); break; 121 } 122 return QIcon(); 122 123 } 123 124 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r51565 r51579 4013 4013 m_pIconPool = new UIIconPoolGeneral; 4014 4014 4015 /* online/offline snapshot icons */4016 mOfflineSnapshotIcon = QPixmap (":/snapshot_offline_16px.png");4017 mOnlineSnapshotIcon = QPixmap (":/snapshot_online_16px.png");4018 4019 4015 qApp->installEventFilter (this); 4020 4016 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r51401 r51579 213 213 QString toLPTPortName (ulong aIRQ, ulong aIOBase) const; 214 214 bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const; 215 216 QPixmap snapshotIcon (bool online) const217 {218 return online ? mOnlineSnapshotIcon : mOfflineSnapshotIcon;219 }220 215 221 216 static bool hasAllowedExtension(const QString &strExt, const QStringList &extList) … … 485 480 QList <QList <CGuestOSType> > mTypes; 486 481 487 QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;488 489 482 QString mDiskTypes_Differencing; 490 483 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp
r51054 r51579 168 168 QIcon UIVMItem::machineStateIcon() const 169 169 { 170 return m_fAccessible ? gpConverter->to Pixmap(m_machineState) :171 QPixmap(":/state_aborted_16px.png");170 return m_fAccessible ? gpConverter->toIcon(m_machineState) : 171 gpConverter->toIcon(KMachineState_Aborted); 172 172 } 173 173 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
r51267 r51579 59 59 60 60 /* Normal snapshot item (child of tree-widget) */ 61 SnapshotWgtItem ( QTreeWidget *aTreeWidget, const CSnapshot &aSnapshot)61 SnapshotWgtItem (VBoxSnapshotsWgt *pSnapshotWidget, QTreeWidget *aTreeWidget, const CSnapshot &aSnapshot) 62 62 : QTreeWidgetItem (aTreeWidget, ItemType) 63 , m_pSnapshotWidget(pSnapshotWidget) 63 64 , mIsCurrentState (false) 64 65 , mSnapshot (aSnapshot) … … 67 68 68 69 /* Normal snapshot item (child of tree-widget-item) */ 69 SnapshotWgtItem ( QTreeWidgetItem *aRootItem, const CSnapshot &aSnapshot)70 SnapshotWgtItem (VBoxSnapshotsWgt *pSnapshotWidget, QTreeWidgetItem *aRootItem, const CSnapshot &aSnapshot) 70 71 : QTreeWidgetItem (aRootItem, ItemType) 72 , m_pSnapshotWidget(pSnapshotWidget) 71 73 , mIsCurrentState (false) 72 74 , mSnapshot (aSnapshot) … … 75 77 76 78 /* Current state item (child of tree-widget) */ 77 SnapshotWgtItem ( QTreeWidget *aTreeWidget, const CMachine &aMachine)79 SnapshotWgtItem (VBoxSnapshotsWgt *pSnapshotWidget, QTreeWidget *aTreeWidget, const CMachine &aMachine) 78 80 : QTreeWidgetItem (aTreeWidget, ItemType) 81 , m_pSnapshotWidget(pSnapshotWidget) 79 82 , mIsCurrentState (true) 80 83 , mMachine (aMachine) … … 84 87 85 88 /* Current state item (child of tree-widget-item) */ 86 SnapshotWgtItem ( QTreeWidgetItem *aRootItem, const CMachine &aMachine)89 SnapshotWgtItem (VBoxSnapshotsWgt *pSnapshotWidget, QTreeWidgetItem *aRootItem, const CMachine &aMachine) 87 90 : QTreeWidgetItem (aRootItem, ItemType) 91 , m_pSnapshotWidget(pSnapshotWidget) 88 92 , mIsCurrentState (true) 89 93 , mMachine (aMachine) … … 171 175 setText (0, mSnapshot.GetName()); 172 176 mOnline = mSnapshot.GetOnline(); 173 setIcon (0, vboxGlobal().snapshotIcon(mOnline));177 setIcon(0, m_pSnapshotWidget->snapshotItemIcon(mOnline)); 174 178 mDesc = mSnapshot.GetDescription(); 175 179 mTimestamp.setTime_t (mSnapshot.GetTimeStamp() / 1000); … … 193 197 return; 194 198 195 setIcon (0, gpConverter->toPixmap(aState));199 setIcon(0, gpConverter->toIcon(aState)); 196 200 mMachineState = aState; 197 201 mTimestamp.setTime_t (mMachine.GetLastStateChange() / 1000); … … 291 295 setToolTip (0, toolTip); 292 296 } 297 298 /** Holds pointer to snapshot-widget 'this' item belongs to. */ 299 QPointer<VBoxSnapshotsWgt> m_pSnapshotWidget; 293 300 294 301 bool mIsCurrentState; … … 361 368 connect (mTreeWidget, SIGNAL (destroyed (QObject *)), treeWidgetStyle, SLOT (deleteLater())); 362 369 // #endif 370 371 /* Cache pixmaps: */ 372 m_offlineSnapshotIcon = UIIconPool::iconSet(":/snapshot_offline_16px.png"); 373 m_onlineSnapshotIcon = UIIconPool::iconSet(":/snapshot_online_16px.png"); 363 374 364 375 /* ToolBar creation */ … … 953 964 954 965 /* Add the "current state" item */ 955 SnapshotWgtItem *csi = new SnapshotWgtItem (mCurSnapshotItem, mMachine);966 SnapshotWgtItem *csi = new SnapshotWgtItem(this, mCurSnapshotItem, mMachine); 956 967 csi->setBold (true); 957 968 csi->recache(); … … 972 983 973 984 /* Add the "current state" item */ 974 SnapshotWgtItem *csi = new SnapshotWgtItem (mTreeWidget, mMachine);985 SnapshotWgtItem *csi = new SnapshotWgtItem(this, mTreeWidget, mMachine); 975 986 csi->setBold (true); 976 987 csi->recache(); … … 1010 1021 void VBoxSnapshotsWgt::populateSnapshots (const CSnapshot &aSnapshot, QTreeWidgetItem *aItem) 1011 1022 { 1012 SnapshotWgtItem *item = aItem ? new SnapshotWgtItem (aItem, aSnapshot) :1013 new SnapshotWgtItem (mTreeWidget, aSnapshot);1023 SnapshotWgtItem *item = aItem ? new SnapshotWgtItem(this, aItem, aSnapshot) : 1024 new SnapshotWgtItem(this, mTreeWidget, aSnapshot); 1014 1025 item->recache(); 1015 1026 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.h
r47222 r51579 22 22 /* Qt includes: */ 23 23 #include <QTimer> 24 #include <QIcon> 24 25 25 26 /* GUI includes: */ … … 53 54 54 55 void setMachine (const CMachine &aMachine); 56 57 /** Returns cached snapshot-item icon depending on @a fOnline flag. */ 58 const QIcon& snapshotItemIcon(bool fOnline) { return !fOnline ? m_offlineSnapshotIcon : m_onlineSnapshotIcon; } 55 59 56 60 protected: … … 112 116 113 117 bool m_fShapshotOperationsAllowed; 118 119 /** Pointer to cached snapshot-item pixmap for 'offline' state. */ 120 QIcon m_offlineSnapshotIcon; 121 /** Pointer to cached snapshot-item pixmap for 'online' state. */ 122 QIcon m_onlineSnapshotIcon; 114 123 }; 115 124 116 125 #endif // __VBoxSnapshotsWgt_h__ 117 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp
r50934 r51579 235 235 { 236 236 /* Get new state-pixmap and state-pixmap size: */ 237 QIcon stateIcon = machineStateIcon();238 QSize stateIconSize = stateIcon.availableSizes().first();239 QPixmap statePixmap = stateIcon.pixmap(stateIconSize);237 const QIcon stateIcon = machineStateIcon(); 238 const QSize statePixmapSize = stateIcon.availableSizes().first(); 239 const QPixmap statePixmap = stateIcon.pixmap(statePixmapSize); 240 240 /* Update linked values: */ 241 if (m_statePixmapSize != state IconSize)242 { 243 m_statePixmapSize = state IconSize;241 if (m_statePixmapSize != statePixmapSize) 242 { 243 m_statePixmapSize = statePixmapSize; 244 244 updateGeometry(); 245 245 }
Note:
See TracChangeset
for help on using the changeset viewer.