Changeset 48278 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 4, 2013 5:15:43 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp
r48272 r48278 28 28 #include "UIMedium.h" 29 29 #include "VBoxGlobal.h" 30 #include "UIConverter.h" 30 31 #include "UIMessageCenter.h" 31 #include "UIConverter.h"32 32 33 33 /* COM includes: */ … … 39 39 QString UIMedium::m_sstrTable = QString("<table>%1</table>"); 40 40 QString UIMedium::m_sstrRow = QString("<tr><td>%1</td></tr>"); 41 42 UIMedium::UIMedium() 43 : m_type(UIMediumType_Invalid) 44 , m_state(KMediumState_NotCreated) 45 , m_pParent(0) 46 { 47 refresh(); 48 // printf("UIMedium: New NULL medium created.\n"); 49 } 50 51 UIMedium::UIMedium(const CMedium &medium, UIMediumType type, UIMedium *pParent /*= 0*/) 52 : m_medium(medium) 53 , m_type(type) 54 , m_state(KMediumState_NotCreated) 55 , m_pParent(pParent) 56 { 57 refresh(); 58 // printf("UIMedium: New medium with ID={%s} created.\n", id().toAscii().constData()); 59 } 60 61 UIMedium::UIMedium(const CMedium &medium, UIMediumType type, KMediumState state) 62 : m_medium(medium) 63 , m_type(type) 64 , m_state(state) 65 , m_pParent(0) 66 { 67 refresh(); 68 // printf("UIMedium: New medium with ID={%s} created (with known state).\n", id().toAscii().constData()); 69 } 70 71 UIMedium::UIMedium(const UIMedium &other) 72 { 73 *this = other; 74 } 41 75 42 76 UIMedium& UIMedium::operator=(const UIMedium &other) … … 132 166 m_fHostDrive = false; 133 167 134 /* Detect basic parameters */ 135 m_strId = m_medium.isNull() ? QUuid().toString().remove ('{').remove ('}') : m_medium.GetId(); 168 /* Detect basic parameters... */ 169 170 m_strId = m_medium.isNull() ? nullID() : m_medium.GetId(); 136 171 137 172 m_fHostDrive = m_medium.isNull() ? false : m_medium.GetHostDrive(); … … 252 287 QString strSnapshots; 253 288 254 QVector <QString> snapIds = m_medium.GetSnapshotIds(strMachineID); 255 for (QVector <QString>::ConstIterator jt = snapIds.begin(); jt != snapIds.end(); ++jt) 289 foreach (const QString &strSnapshotID, m_medium.GetSnapshotIds(strMachineID)) 256 290 { 257 if ( *jt== strMachineID)291 if (strSnapshotID == strMachineID) 258 292 { 259 293 /* The medium is attached to the machine in the current 260 294 * state, we don't distinguish this for now by always 261 295 * giving the VM name in front of snapshot names. */ 262 m_curStateMachineIds.push_back( *jt);296 m_curStateMachineIds.push_back(strSnapshotID); 263 297 continue; 264 298 } 265 299 266 CSnapshot snapshot = machine.FindSnapshot( *jt);300 CSnapshot snapshot = machine.FindSnapshot(strSnapshotID); 267 301 if (!snapshot.isNull()) // can be NULL while takeSnaphot is in progress 268 302 { -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h
r48272 r48278 83 83 public: 84 84 85 /** 86 * Creates a null medium descriptor which is not associated with any medium. 87 * The state field is set to KMediumState_NotCreated. 88 */ 89 UIMedium() 90 : m_type(UIMediumType_Invalid) 91 , m_state(KMediumState_NotCreated) 92 , m_pParent(0) { refresh(); } 93 94 /** 95 * Creates a media descriptor associated with the given medium. 96 * 97 * The state field remain KMediumState_NotCreated until #blockAndQueryState() 98 * is called. All precomposed strings are filled up by implicitly calling 99 * #refresh(), see the #refresh() details for more info. 100 * 101 * One of the hardDisk, dvdImage, or floppyImage members is assigned from 102 * medium according to type. @a pParent must be always NULL for non-hard 103 * disk media. 104 */ 105 UIMedium(const CMedium &medium, UIMediumType type, UIMedium *pParent = 0) 106 : m_medium(medium) 107 , m_type(type) 108 , m_state(KMediumState_NotCreated) 109 , m_pParent(pParent) { refresh(); } 110 111 /** 112 * Similar to the other non-null constructor but sets the media state to 113 * @a state. Suitable when the media state is known such as right after 114 * creation. 115 */ 116 UIMedium(const CMedium &medium, UIMediumType type, KMediumState state) 117 : m_medium(medium) 118 , m_type(type) 119 , m_state(state) 120 , m_pParent(0) { refresh(); } 121 85 /* Default (NULL) constructor: 86 * Creates NULL uimedium which is not associated with any medium. */ 87 UIMedium(); 88 89 /* Lazy wrapping constructor: 90 * Creates a uimedium associated with the given medium. */ 91 UIMedium(const CMedium &medium, UIMediumType type, UIMedium *pParent = 0); 92 93 /* Wrapping constructor with known medium state: 94 * Similar to previous one but sets the uimedium state to passed one. 95 * Suitable when the medium-state is known such as right after medium creation. */ 96 UIMedium(const CMedium &medium, UIMediumType type, KMediumState state); 97 98 /* Copy-constructor: */ 99 UIMedium(const UIMedium &other); 100 101 /* API: Operator=: */ 122 102 UIMedium& operator=(const UIMedium &other); 123 103
Note:
See TracChangeset
for help on using the changeset viewer.