Changeset 548 in vbox
- Timestamp:
- Feb 2, 2007 1:57:12 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 18165
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r382 r548 245 245 return toString (aHD.GetType()); 246 246 } 247 247 248 248 QString toString (CEnums::DiskControllerType t, LONG d) const; 249 249 … … 321 321 322 322 void startEnumeratingMedia(); 323 bool isInEnumeratingProcess() { return media_enum_thread ? true : false; } 324 325 /** Returns a list of all currently enumerated media (it is empty if the 326 * enumeration has been finished or never been started). */ 327 VBoxMediaList currentMediaList() const { return media_list; } 323 324 /** 325 * Returns a list of all currently registered media. This list is used 326 * to globally track the accessiblity state of all media on a dedicated 327 * thread. This the list is initially empty (before the first enumeration 328 * process is started using #startEnumeratingMedia()). 329 */ 330 const VBoxMediaList ¤tMediaList() const { return media_list; } 331 332 /** Returns true if the media enumeration is in progress. */ 333 bool isMediaEnumerationStarted() const { return media_enum_thread != NULL; } 334 335 void addMedia (const VBoxMedia &); 336 void updateMedia (const VBoxMedia &); 337 void removeMedia (VBoxDefs::DiskType, const QUuid &); 328 338 329 339 /* various helpers */ … … 360 370 361 371 /** 362 * Emitted during the enumeration process started 363 * by #startEnumeratingMedia(). */ 364 void mediaEnumerated (const VBoxMedia &media); 372 * Emitted at the beginning of the enumeration process started 373 * by #startEnumeratingMedia(). 374 */ 375 void mediaEnumStarted(); 376 377 /** 378 * Emitted when a new media item from the list has updated 379 * its accessibility state. 380 */ 381 void mediaEnumerated (const VBoxMedia &aMedia, int aIndex); 365 382 366 383 /** … … 368 385 * by #startEnumeratingMedia(). 369 386 * @note #currentMediaList() will return an empty list 370 * when this signal is emitted, use the argument instead. */ 371 void mediaEnumerated (const VBoxMediaList &list); 387 * when this signal is emitted, use the argument instead. 388 */ 389 void mediaEnumFinished (const VBoxMediaList &aList); 390 391 /** Emitted when a new media is added using #addMedia(). */ 392 void mediaAdded (const VBoxMedia &); 393 394 /** Emitted when the media is updated using #updateMedia(). */ 395 void mediaUpdated (const VBoxMedia &); 396 397 /** Emitted when the media is removed using #removeMedia(). */ 398 void mediaRemoved (VBoxDefs::DiskType, const QUuid &); 372 399 373 400 /* signals emitted when the VirtualBox callback is called by the server -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaComboBox.h
r382 r548 27 27 28 28 #include <qcombobox.h> 29 #include <quuid.h>30 29 31 30 class QListBoxItem; … … 37 36 public: 38 37 39 VBoxMediaComboBox (QWidget *aParent = 0, 40 const char *aName = 0, int aType = 0);38 VBoxMediaComboBox (QWidget *aParent = 0, const char *aName = 0, 39 int aType = 0, bool aUseEmptyItem = false); 41 40 ~VBoxMediaComboBox() {} 42 41 43 42 void refresh(); 44 void appendItem (const QString &, const QUuid &, const QString &);45 void replaceItem (int, const QString &, const QString &);46 void removeLastItem();47 void setReadyForRefresh();48 void setRequiredItem (const QUuid &);49 43 void setUseEmptyItem (bool); 50 44 void setBelongsTo (const QUuid &); 51 45 QUuid getId(); 52 46 QUuid getBelongsTo(); 53 void setCurrentItem (int);47 void setCurrentItem (const QUuid &); 54 48 55 49 protected slots: 56 50 57 void mediaEnumerated (const VBoxMedia &); 58 void listEnumerated (const VBoxMediaList &); 51 void mediaEnumStarted(); 52 void mediaEnumerated (const VBoxMedia &, int); 53 void mediaEnumFinished (const VBoxMediaList &); 54 void mediaAdded (const VBoxMedia &); 55 void mediaUpdated (const VBoxMedia &); 56 void mediaRemoved (VBoxDefs::DiskType, const QUuid &); 59 57 void processOnItem (QListBoxItem *); 60 void updateToolTip(int);58 void processActivated (int); 61 59 62 60 protected: 63 61 64 void loadCleanContent(); 65 int updateMedia (const QString &, const QUuid &, const QString &, 66 VBoxMedia::Status); 62 void updateToolTip (int); 63 void setCurrentItem (int); 64 void processMedia (const VBoxMedia &); 65 void processHdMedia (const VBoxMedia &); 66 void processCdMedia (const VBoxMedia &); 67 void processFdMedia (const VBoxMedia &); 68 void appendItem (const QString &, const QUuid &, 69 const QString &, QPixmap *); 70 void replaceItem (int, const QString &, 71 const QString &, QPixmap *); 72 void updateShortcut (const QString &, const QUuid &, const QString &, 73 VBoxMedia::Status); 67 74 68 75 int mType; … … 72 79 QUuid mRequiredId; 73 80 bool mUseEmptyItem; 74 bool mToBeRefreshed; 81 QPixmap mPmInacc; 82 QPixmap mPmError; 75 83 }; 76 84 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h
r382 r548 91 91 void vmListBoxCurrentChanged (bool aRefreshDetails = true, 92 92 bool aRefreshSnapshots = true); 93 void mediaEnum erated (const VBoxMediaList &list);93 void mediaEnumFinished (const VBoxMediaList &); 94 94 95 95 /* VirtualBox callback events we're interested in */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r382 r548 52 52 53 53 /** Constructs a regular enum event */ 54 VBoxEnumerateMediaEvent (const VBoxMedia & m)54 VBoxEnumerateMediaEvent (const VBoxMedia &aMedia, int aIndex) 55 55 : QEvent ((QEvent::Type) VBoxDefs::EnumerateMediaEventType) 56 , m edia (m), last (false)56 , mMedia (aMedia), mLast (false), mIndex (aIndex) 57 57 {} 58 58 /** Constructs the last enum event */ 59 59 VBoxEnumerateMediaEvent() 60 60 : QEvent ((QEvent::Type) VBoxDefs::EnumerateMediaEventType) 61 , last (true)61 , mLast (true), mIndex (-1) 62 62 {} 63 63 64 64 /** the last enumerated media (not valid when #last is true) */ 65 const VBoxMedia m edia;65 const VBoxMedia mMedia; 66 66 /** whether this is the last event for the given enumeration or not */ 67 const bool last; 67 const bool mLast; 68 /** last enumerated media index (-1 when #last is true) */ 69 const int mIndex; 68 70 }; 69 71 … … 580 582 581 583 CEnums::HardDiskType type = root.GetType(); 582 584 583 585 if (type == CEnums::NormalHardDisk && 584 586 (aHD != root || (aPredict && root.GetChildren().GetCount() != 0))) … … 586 588 else 587 589 details = hardDiskTypeString (root); 588 590 589 591 details += ", " + formatSize (root.GetSize() * _1M); 590 592 591 593 return details; 592 594 } … … 611 613 details += " " + p; 612 614 } 613 ushort r = aDevice.GetRevision(); 615 ushort r = aDevice.GetRevision(); 614 616 if (r != 0) 615 617 details += QString().sprintf (" [%04hX]", r); 616 618 617 return details; 619 return details; 618 620 } 619 621 … … 642 644 .arg (vboxGlobal().toString (hostDev.GetState())); 643 645 } 644 645 return tip; 646 647 return tip; 646 648 } 647 649 … … 1054 1056 * If the enumeration is already in progress, no new thread is started. 1055 1057 * 1056 * @see #currentMediaList() 1058 * @sa #currentMediaList() 1059 * @sa #isMediaEnumerationStarted() 1057 1060 */ 1058 1061 void VBoxGlobal::startEnumeratingMedia() 1059 1062 { 1060 1063 Assert (valid); 1061 if (!valid) 1062 return; 1063 1064 // check if already started but not yet finished 1064 1065 /* check if already started but not yet finished */ 1065 1066 if (media_enum_thread) 1066 1067 return; 1067 1068 1069 /* composes a list of all currently known media */ 1070 media_list.clear(); 1071 { 1072 CHardDiskEnumerator enHD = vbox.GetHardDisks().Enumerate(); 1073 while (enHD.HasMore() && !vboxGlobal_cleanup) 1074 { 1075 CHardDisk hd = enHD.GetNext(); 1076 media_list += VBoxMedia (CUnknown (hd), VBoxDefs::HD, VBoxMedia::Unknown); 1077 } 1078 CDVDImageEnumerator enCD = vbox.GetDVDImages().Enumerate(); 1079 while (enCD.HasMore() && !vboxGlobal_cleanup) 1080 { 1081 CDVDImage cd = enCD.GetNext(); 1082 media_list += VBoxMedia (CUnknown (cd), VBoxDefs::CD, VBoxMedia::Unknown); 1083 } 1084 CFloppyImageEnumerator enFD = vbox.GetFloppyImages().Enumerate(); 1085 while (enFD.HasMore() && !vboxGlobal_cleanup) 1086 { 1087 CFloppyImage fd = enFD.GetNext(); 1088 media_list += VBoxMedia (CUnknown (fd), VBoxDefs::FD, VBoxMedia::Unknown); 1089 } 1090 if (!vboxGlobal_cleanup) 1091 emit mediaEnumStarted(); 1092 } 1093 1094 /* enumeration thread class */ 1068 1095 class Thread : public QThread 1069 1096 { 1070 1097 public: 1071 1098 1099 Thread (VBoxMediaList &aList) : mList (aList) {} 1100 1072 1101 virtual void run() 1073 1102 { 1074 1103 LogFlow (("MediaEnumThread started.\n")); 1075 1076 1104 COMBase::initializeCOM(); 1077 1105 … … 1079 1107 QObject *target = &vboxGlobal(); 1080 1108 1081 CHardDiskEnumerator enHd = vbox.GetHardDisks().Enumerate(); 1082 while (enHd.HasMore() && !vboxGlobal_cleanup) 1109 /* enumerating list */ 1110 int index = 0; 1111 VBoxMediaList::Iterator it; 1112 for (it = mList.begin(); 1113 it != mList.end() && !vboxGlobal_cleanup; 1114 ++ it, ++ index) 1083 1115 { 1084 CHardDisk hd = enHd.GetNext(); 1085 VBoxMedia::Status status = 1086 hd.GetAllAccessible() == TRUE ? VBoxMedia::Ok : 1087 hd.isOk() ? VBoxMedia::Inaccessible : 1088 VBoxMedia::Error; 1089 1090 if (status == VBoxMedia::Inaccessible) 1116 VBoxMedia &media = *it; 1117 switch (media.type) 1091 1118 { 1092 // correct media status if the machine using the hard disk 1093 // is currently running (so the disk is actually accessed by it 1094 // in a normal way) 1095 QUuid machineId = hd.GetMachineId(); 1096 if (!machineId.isNull()) 1119 case VBoxDefs::HD: 1097 1120 { 1098 CMachine machine = vbox.GetMachine (machineId); 1099 if (!machine.isNull() && (machine.GetState() >= CEnums::Running)) 1100 status = VBoxMedia::Ok; 1121 CHardDisk hd = media.disk; 1122 media.status = 1123 hd.GetAllAccessible() == TRUE ? VBoxMedia::Ok : 1124 hd.isOk() ? VBoxMedia::Inaccessible : 1125 VBoxMedia::Error; 1126 if (media.status == VBoxMedia::Inaccessible) 1127 { 1128 QUuid machineId = hd.GetMachineId(); 1129 if (!machineId.isNull()) 1130 { 1131 CMachine machine = vbox.GetMachine (machineId); 1132 if (!machine.isNull() && (machine.GetState() >= CEnums::Running)) 1133 media.status = VBoxMedia::Ok; 1134 } 1135 } 1136 VBoxMedia newMedia (CUnknown(hd), VBoxDefs::HD, media.status); 1137 QApplication::postEvent (target, 1138 new VBoxEnumerateMediaEvent (newMedia, index)); 1139 break; 1140 } 1141 case VBoxDefs::CD: 1142 { 1143 CDVDImage cd = media.disk; 1144 media.status = 1145 cd.GetAccessible() == TRUE ? VBoxMedia::Ok : 1146 cd.isOk() ? VBoxMedia::Inaccessible : 1147 VBoxMedia::Error; 1148 VBoxMedia newMedia (CUnknown(cd), VBoxDefs::CD, media.status); 1149 QApplication::postEvent (target, 1150 new VBoxEnumerateMediaEvent (newMedia, index)); 1151 break; 1152 } 1153 case VBoxDefs::FD: 1154 { 1155 CFloppyImage fd = media.disk; 1156 media.status = 1157 fd.GetAccessible() == TRUE ? VBoxMedia::Ok : 1158 fd.isOk() ? VBoxMedia::Inaccessible : 1159 VBoxMedia::Error; 1160 VBoxMedia newMedia (CUnknown(fd), VBoxDefs::FD, media.status); 1161 QApplication::postEvent (target, 1162 new VBoxEnumerateMediaEvent (newMedia, index)); 1163 break; 1164 } 1165 default: 1166 { 1167 AssertMsgFailed (("Invalid aMedia type\n")); 1168 break; 1101 1169 } 1102 1170 } 1103 1104 VBoxMedia media =1105 VBoxMedia (CUnknown (hd), VBoxDefs::HD, status);1106 1107 QApplication::postEvent (target,1108 new VBoxEnumerateMediaEvent (media));1109 1171 } 1110 1172 1111 CDVDImageEnumerator enDVD = vbox.GetDVDImages().Enumerate(); 1112 while (enDVD.HasMore() && !vboxGlobal_cleanup) 1113 { 1114 CDVDImage dvd = enDVD.GetNext(); 1115 VBoxMedia::Status status = 1116 dvd.GetAccessible() == TRUE ? VBoxMedia::Ok : 1117 dvd.isOk() ? VBoxMedia::Inaccessible : 1118 VBoxMedia::Error; 1119 1120 VBoxMedia media = 1121 VBoxMedia (CUnknown (dvd), VBoxDefs::CD, status); 1122 1123 QApplication::postEvent (target, 1124 new VBoxEnumerateMediaEvent (media)); 1125 } 1126 1127 CFloppyImageEnumerator enFloppy = vbox.GetFloppyImages().Enumerate(); 1128 while (enFloppy.HasMore() && !vboxGlobal_cleanup) 1129 { 1130 CFloppyImage floppy = enFloppy.GetNext(); 1131 VBoxMedia::Status status = 1132 floppy.GetAccessible() == TRUE ? VBoxMedia::Ok : 1133 floppy.isOk() ? VBoxMedia::Inaccessible : 1134 VBoxMedia::Error; 1135 1136 VBoxMedia media = 1137 VBoxMedia (CUnknown (floppy), VBoxDefs::FD, status); 1138 1139 QApplication::postEvent (target, 1140 new VBoxEnumerateMediaEvent (media)); 1141 } 1142 1143 // post the last message to indicate the end of enumeration 1173 /* post the last message to indicate the end of enumeration */ 1144 1174 if (!vboxGlobal_cleanup) 1145 1175 QApplication::postEvent (target, new VBoxEnumerateMediaEvent()); 1146 1176 1147 1177 COMBase::cleanupCOM(); 1148 1149 1178 LogFlow (("MediaEnumThread finished.\n")); 1150 1179 } 1180 1181 private: 1182 1183 VBoxMediaList &mList; 1151 1184 }; 1152 1185 1153 media_enum_thread = new Thread ();1186 media_enum_thread = new Thread (media_list); 1154 1187 media_enum_thread->start(); 1188 } 1189 1190 /** 1191 * Adds a new media to the current media list. 1192 * @note Currently, this method does nothing but emits the mediaAdded() signal. 1193 * Later, it will be used to synchronize the current media list with 1194 * the actial media list on the server after a single media opetartion 1195 * performed from within one of our UIs. 1196 * @sa #currentMediaList() 1197 */ 1198 void VBoxGlobal::addMedia (const VBoxMedia &aMedia) 1199 { 1200 emit mediaAdded (aMedia); 1201 } 1202 1203 /** 1204 * Updates the media in the current media list. 1205 * @note Currently, this method does nothing but emits the mediaUpdated() signal. 1206 * Later, it will be used to synchronize the current media list with 1207 * the actial media list on the server after a single media opetartion 1208 * performed from within one of our UIs. 1209 * @sa #currentMediaList() 1210 */ 1211 void VBoxGlobal::updateMedia (const VBoxMedia &aMedia) 1212 { 1213 emit mediaUpdated (aMedia); 1214 } 1215 1216 /** 1217 * Removes the media from the current media list. 1218 * @note Currently, this method does nothing but emits the mediaRemoved() signal. 1219 * Later, it will be used to synchronize the current media list with 1220 * the actial media list on the server after a single media opetartion 1221 * performed from within one of our UIs. 1222 * @sa #currentMediaList() 1223 */ 1224 void VBoxGlobal::removeMedia (VBoxDefs::DiskType aType, const QUuid &aId) 1225 { 1226 emit mediaRemoved (aType, aId); 1155 1227 } 1156 1228 … … 1357 1429 AssertReturnVoid (aWidget); 1358 1430 AssertReturnVoid (aWidget->isTopLevel()); 1359 1431 1360 1432 QRect deskGeo, parentGeo; 1361 1433 QWidget *w = aRelative; … … 1368 1440 * widgets with parents, what a shame. Use mapToGlobal() to workaround. */ 1369 1441 QPoint d = w->mapToGlobal (QPoint (0, 0)); 1370 d.rx() -= w->geometry().x() - w->x(); 1371 d.ry() -= w->geometry().y() - w->y(); 1442 d.rx() -= w->geometry().x() - w->x(); 1443 d.ry() -= w->geometry().y() - w->y(); 1372 1444 parentGeo.moveTopLeft (d); 1373 1445 } … … 1397 1469 framew = current->frameGeometry().width() - current->width(); 1398 1470 frameh = current->frameGeometry().height() - current->height(); 1399 1471 1400 1472 extraw = QMAX (extraw, framew); 1401 1473 extrah = QMAX (extrah, frameh); … … 1413 1485 } 1414 1486 #endif 1415 1487 1416 1488 /* On non-X11 platforms, the following would be enough instead of the 1417 * above workaround: */ 1489 * above workaround: */ 1418 1490 // QRect geo = frameGeometry(); 1419 1491 QRect geo = QRect (0, 0, aWidget->width() + extraw, … … 1422 1494 geo.moveCenter (QPoint (parentGeo.x() + (parentGeo.width() - 1) / 2, 1423 1495 parentGeo.y() + (parentGeo.height() - 1) / 2)); 1424 1496 1425 1497 /* ensure the widget is within the available desktop area */ 1426 1498 QRect newGeo = normalizeGeometry (geo, deskGeo, aCanResize); 1427 1499 1428 1500 aWidget->move (newGeo.topLeft()); 1429 1501 1430 1502 if (aCanResize && 1431 1503 (geo.width() != newGeo.width() || geo.height() != newGeo.height())) … … 1508 1580 hund = hund * denom / 100; 1509 1581 intg = intg * denom + hund; 1510 return intg; 1582 return intg; 1511 1583 } 1512 1584 else … … 1527 1599 * digit number that is not greater than the result. This guarantees that 1528 1600 * converting the resulting string back to the integer value in bytes 1529 * will not produce a value greater that the initial \a size parameter. 1601 * will not produce a value greater that the initial \a size parameter. 1530 1602 * </li> 1531 1603 * <li>When \a mode is 1, the result is rounded to the smallest two decimal 1532 1604 * digit number that is not less than the result. This guarantees that 1533 1605 * converting the resulting string back to the integer value in bytes 1534 * will not produce a value less that the initial \a size parameter. 1606 * will not produce a value less that the initial \a size parameter. 1535 1607 * </li> 1536 1608 * </ul> … … 1543 1615 QString VBoxGlobal::formatSize (Q_UINT64 aSize, int aMode /* = 0 */) 1544 1616 { 1545 static const char *Suffixes [] = { "B", "KB", "MB", "GB", "TB", "PB", NULL }; 1617 static const char *Suffixes [] = { "B", "KB", "MB", "GB", "TB", "PB", NULL }; 1546 1618 1547 1619 Q_UINT64 denom = 0; … … 1604 1676 { 1605 1677 intg /= 1024; 1606 ++ suffix; 1678 ++ suffix; 1607 1679 } 1608 1680 } … … 1614 1686 number = QString::number (intg); 1615 1687 } 1616 1688 1617 1689 return QString ("%1 %2").arg (number).arg (Suffixes [suffix]); 1618 1690 } … … 1635 1707 QString VBoxGlobal::highlight (const QString &aStr, bool aToolTip /* = false */) 1636 1708 { 1637 QString strFont; 1709 QString strFont; 1638 1710 QString uuidFont; 1639 1711 QString endFont; … … 1644 1716 endFont = "</font>"; 1645 1717 } 1646 1718 1647 1719 QString text = aStr; 1648 1720 … … 1682 1754 VBoxEnumerateMediaEvent *ev = (VBoxEnumerateMediaEvent *) e; 1683 1755 1684 if (!ev-> last)1756 if (!ev->mLast) 1685 1757 { 1686 // gather all media to the list 1687 media_list += ev->media; 1688 1689 if (ev->media.status == VBoxMedia::Error) 1690 vboxProblem().cannotGetMediaAccessibility (ev->media.disk); 1691 1692 emit mediaEnumerated (ev->media); 1758 if (ev->mMedia.status == VBoxMedia::Error) 1759 vboxProblem().cannotGetMediaAccessibility (ev->mMedia.disk); 1760 media_list [ev->mIndex] = ev->mMedia; 1761 emit mediaEnumerated (media_list [ev->mIndex], ev->mIndex); 1693 1762 } 1694 1763 else 1695 1764 { 1696 / / the thread has posted the last message, wait for termination1765 /* the thread has posted the last message, wait for termination */ 1697 1766 media_enum_thread->wait(); 1698 1767 delete media_enum_thread; 1699 1768 media_enum_thread = 0; 1700 1769 1701 // this is the last event, clear the list (create a copy first) 1702 VBoxMediaList list = media_list; 1703 media_list.clear(); 1704 1705 emit mediaEnumerated (list); 1770 emit mediaEnumFinished (media_list); 1706 1771 } 1707 1772 … … 1709 1774 } 1710 1775 1711 / / VirtualBox callback events1776 /* VirtualBox callback events */ 1712 1777 1713 1778 case VBoxDefs::MachineStateChangeEventType: -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp
r382 r548 23 23 #include "VBoxMediaComboBox.h" 24 24 #include "VBoxDiskImageManagerDlg.h" 25 #include "VBoxGlobal.h"26 25 27 26 #include <qfileinfo.h> … … 32 31 #include <qlistbox.h> 33 32 34 VBoxMediaComboBox::VBoxMediaComboBox (QWidget *aParent, const char *aName, int aType) 33 VBoxMediaComboBox::VBoxMediaComboBox (QWidget *aParent, const char *aName, 34 int aType, bool aUseEmptyItem) 35 35 : QComboBox (aParent , aName), 36 mType (aType), mRequiredId (QUuid()), mUseEmptyItem ( false), mToBeRefreshed (false)36 mType (aType), mRequiredId (QUuid()), mUseEmptyItem (aUseEmptyItem) 37 37 { 38 38 setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed); 39 /* Media shortcuts creating */ 40 connect (&vboxGlobal(), SIGNAL (mediaEnumerated (const VBoxMedia &)), 41 this, SLOT (mediaEnumerated (const VBoxMedia &))); 42 connect (&vboxGlobal(), SIGNAL (mediaEnumerated (const VBoxMediaList &)), 43 this, SLOT (listEnumerated (const VBoxMediaList &))); 39 /* setup enumeration handlers */ 40 connect (&vboxGlobal(), SIGNAL (mediaEnumStarted()), 41 this, SLOT (mediaEnumStarted())); 42 connect (&vboxGlobal(), SIGNAL (mediaEnumerated (const VBoxMedia &, int)), 43 this, SLOT (mediaEnumerated (const VBoxMedia &, int))); 44 connect (&vboxGlobal(), SIGNAL (mediaEnumFinished (const VBoxMediaList &)), 45 this, SLOT (mediaEnumFinished (const VBoxMediaList &))); 46 47 /* setup update handlers */ 48 connect (&vboxGlobal(), SIGNAL (mediaAdded (const VBoxMedia &)), 49 this, SLOT (mediaAdded (const VBoxMedia &))); 50 connect (&vboxGlobal(), SIGNAL (mediaUpdated (const VBoxMedia &)), 51 this, SLOT (mediaUpdated (const VBoxMedia &))); 52 connect (&vboxGlobal(), SIGNAL (mediaRemoved (VBoxDefs::DiskType, const QUuid &)), 53 this, SLOT (mediaRemoved (VBoxDefs::DiskType, const QUuid &))); 54 44 55 connect (this, SIGNAL (activated (int)), 45 this, SLOT ( updateToolTip(int)));56 this, SLOT (processActivated (int))); 46 57 connect (listBox(), SIGNAL (onItem (QListBoxItem*)), 47 58 this, SLOT (processOnItem (QListBoxItem*))); 48 } 49 50 void VBoxMediaComboBox::loadCleanContent() 51 { 52 CVirtualBox vbox = vboxGlobal().virtualBox(); 53 54 switch (mType) 55 { 56 /* load hd list */ 59 60 /* cache pixmaps as class members */ 61 QImage img; 62 img = QMessageBox::standardIcon (QMessageBox::Warning).convertToImage(); 63 if (!img.isNull()) 64 { 65 img = img.smoothScale (14, 14); 66 mPmInacc.convertFromImage (img); 67 } 68 img = QMessageBox::standardIcon (QMessageBox::Critical).convertToImage(); 69 if (!img.isNull()) 70 { 71 img = img.smoothScale (14, 14); 72 mPmError.convertFromImage (img); 73 } 74 75 /* media shortcuts creating */ 76 refresh(); 77 } 78 79 void VBoxMediaComboBox::refresh() 80 { 81 /* clearing lists */ 82 clear(), mUuidList.clear(), mTipList.clear(); 83 /* prepend empty item if used */ 84 if (mUseEmptyItem) 85 appendItem (tr ("<no hard disk>"), QUuid(), tr ("No hard disk"), 0); 86 updateToolTip (currentItem()); 87 /* load current media list */ 88 VBoxMediaList list = vboxGlobal().currentMediaList(); 89 VBoxMediaList::const_iterator it; 90 for (it = list.begin(); it != list.end(); ++ it) 91 mediaEnumerated (*it, 0); 92 } 93 94 95 void VBoxMediaComboBox::mediaEnumStarted() 96 { 97 refresh(); 98 } 99 100 void VBoxMediaComboBox::mediaEnumerated (const VBoxMedia &aMedia, int /*aIndex*/) 101 { 102 processMedia (aMedia); 103 } 104 105 void VBoxMediaComboBox::mediaEnumFinished (const VBoxMediaList &/*aList*/) 106 { 107 emit activated (currentItem()); 108 } 109 110 111 void VBoxMediaComboBox::mediaAdded (const VBoxMedia &aMedia) 112 { 113 processMedia (aMedia); 114 } 115 116 void VBoxMediaComboBox::mediaUpdated (const VBoxMedia &aMedia) 117 { 118 processMedia (aMedia); 119 } 120 121 void VBoxMediaComboBox::mediaRemoved (VBoxDefs::DiskType aType, 122 const QUuid &aId) 123 { 124 if (!(aType & mType)) 125 return; 126 127 /* search & remove media */ 128 int index = mUuidList.findIndex (aId); 129 if (index != -1) 130 { 131 removeItem (index); 132 mUuidList.remove (mUuidList.at (index)); 133 mTipList.remove (mTipList.at (index)); 134 updateToolTip (currentItem()); 135 } 136 } 137 138 139 void VBoxMediaComboBox::processMedia (const VBoxMedia &aMedia) 140 { 141 if (!(aMedia.type & mType)) 142 return; 143 144 switch (aMedia.type) 145 { 57 146 case VBoxDefs::HD: 58 { 59 CHardDiskEnumerator en = vbox.GetHardDisks().Enumerate(); 60 while (en.HasMore()) 61 { 62 QUuid mediaId; 63 QString toolTip; 64 CHardDisk hd = en.GetNext(); 65 QString src = hd.GetLocation(); 66 QUuid machineId = hd.GetMachineId(); 67 /* append list only with free hd */ 68 if (machineId.isNull() || machineId == mMachineId) 69 { 70 mediaId = hd.GetId(); 71 toolTip = VBoxDiskImageManagerDlg::composeHdToolTip (hd, VBoxMedia::Unknown); 72 } 73 if (!mediaId.isNull()) updateMedia (src, mediaId, toolTip, VBoxMedia::Unknown); 74 } 147 processHdMedia (aMedia); 75 148 break; 76 }77 /* load cd list */78 149 case VBoxDefs::CD: 79 { 80 CDVDImageEnumerator en = vbox.GetDVDImages().Enumerate(); 81 while (en.HasMore()) 82 { 83 QUuid mediaId; 84 QString toolTip; 85 CDVDImage cd = en.GetNext(); 86 QString src = cd.GetFilePath(); 87 mediaId = cd.GetId(); 88 toolTip = VBoxDiskImageManagerDlg::composeCdToolTip (cd, VBoxMedia::Unknown); 89 updateMedia (src, mediaId, toolTip, VBoxMedia::Unknown); 90 } 150 processCdMedia (aMedia); 91 151 break; 92 }93 /* load fd list */94 152 case VBoxDefs::FD: 95 { 96 CFloppyImageEnumerator en = vbox.GetFloppyImages().Enumerate(); 97 while (en.HasMore()) 98 { 99 QUuid mediaId; 100 QString toolTip; 101 CFloppyImage fd = en.GetNext(); 102 QString src = fd.GetFilePath(); 103 mediaId = fd.GetId(); 104 toolTip = VBoxDiskImageManagerDlg::composeFdToolTip (fd, VBoxMedia::Unknown); 105 updateMedia (src, mediaId, toolTip, VBoxMedia::Unknown); 106 } 153 processFdMedia (aMedia); 107 154 break; 108 }109 155 default: 110 156 AssertFailed(); … … 112 158 } 113 159 114 void VBoxMediaComboBox::mediaEnumerated (const VBoxMedia &aMedia) 115 { 116 if (!mToBeRefreshed) return; 117 if (!(aMedia.type & mType)) 118 return; 119 120 QString src; 121 QUuid mediaId; 160 void VBoxMediaComboBox::processHdMedia (const VBoxMedia &aMedia) 161 { 162 QUuid mediaId; 122 163 QString toolTip; 123 124 switch (aMedia.type) 125 { 126 case VBoxDefs::HD: 127 { 128 CHardDisk hd = aMedia.disk; 129 src = hd.GetLocation(); 130 QUuid machineId = hd.GetMachineId(); 131 /* append list only with free hd */ 132 if (machineId.isNull() || machineId == mMachineId) 133 { 134 mediaId = hd.GetId(); 135 toolTip = VBoxDiskImageManagerDlg::composeHdToolTip (hd, aMedia.status); 136 } 137 break; 138 } 139 case VBoxDefs::CD: 140 { 141 CDVDImage dvd = aMedia.disk; 142 src = dvd.GetFilePath(); 143 mediaId = dvd.GetId(); 144 toolTip = VBoxDiskImageManagerDlg::composeCdToolTip (dvd, aMedia.status); 145 break; 146 } 147 case VBoxDefs::FD: 148 { 149 CFloppyImage floppy = aMedia.disk; 150 src = floppy.GetFilePath(); 151 mediaId = floppy.GetId(); 152 toolTip = VBoxDiskImageManagerDlg::composeFdToolTip (floppy, aMedia.status); 153 break; 154 } 155 default: 156 AssertFailed(); 157 } 158 int updatedMedia = -1; 164 CHardDisk hd = aMedia.disk; 165 QString src = hd.GetLocation(); 166 QUuid machineId = hd.GetMachineId(); 167 /* append list only with free hd */ 168 if (machineId.isNull() || machineId == mMachineId) 169 { 170 mediaId = hd.GetId(); 171 toolTip = VBoxDiskImageManagerDlg::composeHdToolTip (hd, aMedia.status); 172 } 159 173 if (!mediaId.isNull()) 160 updatedMedia = updateMedia (src, mediaId, toolTip, aMedia.status); 161 if (updatedMedia == -1) return; 162 163 /* update warning/error icons */ 164 /// @todo (r=dmik) cache pixmaps as class members 165 QPixmap pixmap; 166 QImage img; 167 if (aMedia.status == VBoxMedia::Inaccessible) 168 img = QMessageBox::standardIcon (QMessageBox::Warning).convertToImage(); 169 else if (aMedia.status == VBoxMedia::Error) 170 img = QMessageBox::standardIcon (QMessageBox::Critical).convertToImage(); 171 if (!img.isNull()) 172 { 173 img = img.smoothScale (14, 14); 174 pixmap.convertFromImage (img); 175 } 176 if (!pixmap.isNull()) 177 changeItem (pixmap, text (updatedMedia), updatedMedia); 178 } 179 180 int VBoxMediaComboBox::updateMedia (const QString &aSrc, 181 const QUuid &aId, 182 const QString &aTip, 183 VBoxMedia::Status /* aStatus */) 184 { 185 /* search & update media */ 174 updateShortcut (src, mediaId, toolTip, aMedia.status); 175 } 176 177 void VBoxMediaComboBox::processCdMedia (const VBoxMedia &aMedia) 178 { 179 CDVDImage dvd = aMedia.disk; 180 QString src = dvd.GetFilePath(); 181 QUuid mediaId = dvd.GetId(); 182 QString toolTip = VBoxDiskImageManagerDlg::composeCdToolTip (dvd, aMedia.status); 183 updateShortcut (src, mediaId, toolTip, aMedia.status); 184 } 185 186 void VBoxMediaComboBox::processFdMedia (const VBoxMedia &aMedia) 187 { 188 CFloppyImage floppy = aMedia.disk; 189 QString src = floppy.GetFilePath(); 190 QUuid mediaId = floppy.GetId(); 191 QString toolTip = VBoxDiskImageManagerDlg::composeFdToolTip (floppy, aMedia.status); 192 updateShortcut (src, mediaId, toolTip, aMedia.status); 193 } 194 195 void VBoxMediaComboBox::updateShortcut (const QString &aSrc, 196 const QUuid &aId, 197 const QString &aTip, 198 VBoxMedia::Status aStatus) 199 { 200 /* compose item's name */ 186 201 QFileInfo fi (aSrc); 187 int index = mUuidList.findIndex (aId);188 202 QString name = QString ("%1 (%2)").arg (fi.fileName()) 189 203 .arg (QDir::convertSeparators (fi.dirPath())); 190 index == -1 ? appendItem (name, aId, aTip) : replaceItem (index, name, aTip); 204 /* update warning/error icons */ 205 QPixmap *pixmap = 0; 206 if (aStatus == VBoxMedia::Inaccessible) 207 pixmap = &mPmInacc; 208 else if (aStatus == VBoxMedia::Error) 209 pixmap = &mPmError; 210 211 /* search media */ 212 int index = mUuidList.findIndex (aId); 213 /* create or update media */ 214 if (index == -1) 215 appendItem (name, aId, aTip, pixmap); 216 else 217 replaceItem (index, name, aTip, pixmap); 218 191 219 if (aId == mRequiredId) 192 220 { 193 221 int activatedItem = index == -1 ? count() - 1 : index; 194 222 setCurrentItem (activatedItem); 195 emit activated (activatedItem); 196 } 197 else 198 updateToolTip (currentItem()); 199 return index == -1 ? count() - 1 : index; 200 } 201 202 void VBoxMediaComboBox::listEnumerated (const VBoxMediaList & /*aList*/) 203 { 204 emit activated (currentItem()); 205 mToBeRefreshed = false; 223 } 224 } 225 226 void VBoxMediaComboBox::processActivated (int aItem) 227 { 228 mRequiredId = QUuid (mUuidList [aItem]); 229 updateToolTip (aItem); 206 230 } 207 231 … … 210 234 /* combobox tooltip attaching */ 211 235 QToolTip::remove (this); 212 QToolTip::add (this, mTipList [aItem]); 236 if (!mTipList.isEmpty()) 237 QToolTip::add (this, mTipList [aItem]); 213 238 } 214 239 … … 221 246 } 222 247 223 void VBoxMediaComboBox::setReadyForRefresh()224 {225 mToBeRefreshed = true;226 /* clearing media combobox */227 clear(), mUuidList.clear(), mTipList.clear();228 /* prepend empty item if used */229 if (mUseEmptyItem)230 appendItem (tr ("<no hard disk>"), QUuid(), tr ("No hard disk"));231 /* load all non-enumerated shortcuts */232 if (!vboxGlobal().isInEnumeratingProcess()) loadCleanContent();233 /* update already enumerated shortcuts */234 VBoxMediaList list = vboxGlobal().currentMediaList();235 for (VBoxMediaList::const_iterator it = list.begin(); it != list.end(); ++ it)236 mediaEnumerated (*it);237 }238 239 void VBoxMediaComboBox::refresh()240 {241 if (mToBeRefreshed) return;242 setReadyForRefresh();243 vboxGlobal().startEnumeratingMedia();244 }245 246 248 QUuid VBoxMediaComboBox::getId() 247 249 { … … 251 253 void VBoxMediaComboBox::appendItem (const QString &aName, 252 254 const QUuid &aId, 253 const QString &aTip) 254 { 255 insertItem (aName); 255 const QString &aTip, 256 QPixmap *aPixmap) 257 { 258 aPixmap ? insertItem (*aPixmap, aName) : insertItem (aName); 256 259 mUuidList << aId; 257 260 mTipList << aTip; 258 261 } 259 262 260 void VBoxMediaComboBox::replaceItem (int aNumber,263 void VBoxMediaComboBox::replaceItem (int aNumber, 261 264 const QString &aName, 262 const QString &aTip) 263 { 264 changeItem (aName, aNumber); 265 const QString &aTip, 266 QPixmap *aPixmap) 267 { 268 aPixmap ? changeItem (*aPixmap, aName, aNumber) : changeItem (aName, aNumber); 265 269 mTipList [aNumber] = aTip; 266 270 } 267 271 268 void VBoxMediaComboBox::removeLastItem() 269 { 270 if (count()) 271 removeItem (count() - 1); 272 mUuidList.pop_back(); 273 mTipList.pop_back(); 274 } 275 276 void VBoxMediaComboBox::setRequiredItem (const QUuid &aId) 272 void VBoxMediaComboBox::setUseEmptyItem (bool aUseEmptyItem) 273 { 274 mUseEmptyItem = aUseEmptyItem; 275 } 276 277 void VBoxMediaComboBox::setBelongsTo (const QUuid &aMachineId) 278 { 279 mMachineId = aMachineId; 280 } 281 282 QUuid VBoxMediaComboBox::getBelongsTo() 283 { 284 return mMachineId; 285 } 286 287 void VBoxMediaComboBox::setCurrentItem (int aIndex) 288 { 289 QComboBox::setCurrentItem (aIndex); 290 emit activated (aIndex); 291 } 292 293 void VBoxMediaComboBox::setCurrentItem (const QUuid &aId) 277 294 { 278 295 mRequiredId = aId; 279 } 280 281 void VBoxMediaComboBox::setUseEmptyItem (bool aUseEmptyItem) 282 { 283 mUseEmptyItem = aUseEmptyItem; 284 } 285 286 void VBoxMediaComboBox::setBelongsTo (const QUuid &aMachineId) 287 { 288 mMachineId = aMachineId; 289 } 290 291 QUuid VBoxMediaComboBox::getBelongsTo() 292 { 293 return mMachineId; 294 } 295 296 void VBoxMediaComboBox::setCurrentItem (int aIndex) 297 { 298 QComboBox::setCurrentItem (aIndex); 299 updateToolTip (aIndex); 300 } 296 int index = mUuidList.findIndex (mRequiredId); 297 if (index != -1) 298 setCurrentItem (index); 299 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r382 r548 415 415 416 416 /* listen to "media enumeration finished" signals */ 417 connect (&vboxGlobal(), SIGNAL (mediaEnum erated (const VBoxMediaList &)),418 this, SLOT (mediaEnum erated (const VBoxMediaList &)));417 connect (&vboxGlobal(), SIGNAL (mediaEnumFinished (const VBoxMediaList &)), 418 this, SLOT (mediaEnumFinished (const VBoxMediaList &))); 419 419 420 420 /* connect VirtualBox callback events */ … … 956 956 } 957 957 958 void VBoxSelectorWnd::mediaEnum erated (const VBoxMediaList &list)958 void VBoxSelectorWnd::mediaEnumFinished (const VBoxMediaList &list) 959 959 { 960 960 /* refresh the current details to pick up hard disk sizes */ … … 992 992 * emumeration started from main() at startup), and then disconnect 993 993 * to avoid annoying the user */ 994 disconnect (&vboxGlobal(), SIGNAL (mediaEnum erated (const VBoxMediaList &)),995 this, SLOT (mediaEnum erated (const VBoxMediaList &)));994 disconnect (&vboxGlobal(), SIGNAL (mediaEnumFinished (const VBoxMediaList &)), 995 this, SLOT (mediaEnumFinished (const VBoxMediaList &))); 996 996 } 997 997 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui
r382 r548 562 562 <variable>QPushButton *defaultButton;</variable> 563 563 <variable access="private">static VBoxDiskImageManagerDlg *mModelessDialog;</variable> 564 <variable access="private">bool mToBeRefreshed;</variable>565 564 <variable access="private">QProgressBar *mProgressBar;</variable> 566 565 <variable access="private">QLabel *mProgressText;</variable> 566 <variable access="private">QUuid hdSelectedId;</variable> 567 <variable access="private">QUuid cdSelectedId;</variable> 568 <variable access="private">QUuid fdSelectedId;</variable> 567 569 </variables> 568 570 <slots> 569 <slot access="protected">mediaEnumerated( const VBoxMedia & media )</slot> 570 <slot access="protected">mediaEnumerated( const VBoxMediaList & )</slot> 571 <slot access="protected">mediaEnumStarted()</slot> 572 <slot access="protected">mediaEnumerated( const VBoxMedia &, int )</slot> 573 <slot access="protected">mediaEnumFinished( const VBoxMediaList & )</slot> 574 <slot access="protected">mediaAdded( const VBoxMedia & )</slot> 575 <slot access="protected">mediaUpdated( const VBoxMedia & )</slot> 576 <slot access="protected">mediaRemoved( VBoxDefs::DiskType, const QUuid & )</slot> 571 577 <slot access="protected">machineStateChanged( const VBoxMachineStateChangeEvent & )</slot> 572 578 <slot>refreshAll()</slot> … … 586 592 <functions> 587 593 <function access="private">init()</function> 588 <function access="private">loadListViews()</function>589 594 <function access="private" returnType="int">result()</function> 590 595 <function access="private">setResult( int )</function> 591 596 <function returnType="int">exec()</function> 592 597 <function access="private">done( int )</function> 593 <function access="private">updateMedia( const VBoxMedia & media )</function> 594 <function access="private" returnType="DiskImageItem*">searchItem( QListView*, QUuid )</function> 598 <function access="private" returnType="DiskImageItem*">searchItem( QListView*, const QUuid & )</function> 595 599 <function specifier="non virtual" access="private" returnType="QString">static getDVDImageUsage( const QUuid & id )</function> 596 600 <function specifier="non virtual" access="private" returnType="QString">static getFloppyImageUsage( const QUuid & id )</function> … … 601 605 <function>setup( int aType, bool aDoSelect, const QUuid *aTargetVMId = NULL, const VBoxMediaList *mediaList = NULL, CMachine machine = 0 )</function> 602 606 <function access="private" returnType="QListView*">getCurrentListView()</function> 607 <function access="private" returnType="QListView*">getListView( VBoxDefs::DiskType )</function> 603 608 <function returnType="bool">eventFilter( QObject *, QEvent * )</function> 604 609 <function access="private">addDroppedImages( QStringList* )</function> 605 <function access="private" returnType="DiskImageItem*">addImageToList( QString aSource, VBoxDefs::DiskType aDiskType )</function> 606 <function access="private" returnType="DiskImageItem*">createImageNode( QListView *aList, DiskImageItem *aRoot, QString aName, QString aLabel1 = QString::null, QString aLabel2 = QString::null, QString aLabel3 = QString::null, QString aLabel4 = QString::null, QString aLabel5 = QString::null, QString aLabel6 = QString::null, QString aLabel7 = QString::null )</function> 607 <function access="private" returnType="DiskImageItem*">createHdItem( QListView*, DiskImageItem*, CHardDisk &, VBoxMedia::Status )</function> 608 <function access="private" returnType="DiskImageItem*">createCdItem( QListView*, DiskImageItem*, CDVDImage &, VBoxMedia::Status )</function> 609 <function access="private" returnType="DiskImageItem*">createFdItem( QListView*, DiskImageItem*, CFloppyImage &, VBoxMedia::Status )</function> 610 <function access="private">createHdChildren( DiskImageItem*, CHardDisk &, VBoxMedia::Status )</function> 610 <function access="private">addImageToList( QString aSource, VBoxDefs::DiskType aDiskType )</function> 611 <function access="private" returnType="DiskImageItem*">createImageNode( QListView *aList, DiskImageItem *aRoot )</function> 612 <function access="private">updateHdItem( DiskImageItem*, const VBoxMedia & )</function> 613 <function access="private">updateCdItem( DiskImageItem*, const VBoxMedia & )</function> 614 <function access="private">updateFdItem( DiskImageItem*, const VBoxMedia & )</function> 615 <function access="private" returnType="DiskImageItem*">createHdItem( QListView*, DiskImageItem*, const VBoxMedia & )</function> 616 <function access="private" returnType="DiskImageItem*">createCdItem( QListView*, DiskImageItem*, const VBoxMedia & )</function> 617 <function access="private" returnType="DiskImageItem*">createFdItem( QListView*, DiskImageItem*, const VBoxMedia & )</function> 618 <function access="private">createHdChildren( DiskImageItem*, const VBoxMedia & )</function> 611 619 <function access="protected">showEvent( QShowEvent * )</function> 612 620 <function access="protected">resizeEvent( QResizeEvent* )</function> … … 620 628 <function specifier="non virtual" returnType="QString">static composeCdToolTip( CDVDImage &, VBoxMedia::Status = VBoxMedia::Ok )</function> 621 629 <function specifier="non virtual" returnType="QString">static composeFdToolTip( CFloppyImage &, VBoxMedia::Status = VBoxMedia::Ok )</function> 622 <function access="protected">prepareToRefresh( )</function>630 <function access="protected">prepareToRefresh( int aTotal = 0 )</function> 623 631 </functions> 624 632 <layoutdefaults spacing="10" margin="10"/> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui.h
r382 r548 35 35 public: 36 36 37 DiskImageItem (DiskImageItem *parent, QString aLabel1, 38 QString aLabel2 = QString::null, 39 QString aLabel3 = QString::null, 40 QString aLabel4 = QString::null, 41 QString aLabel5 = QString::null, 42 QString aLabel6 = QString::null, 43 QString aLabel7 = QString::null, 44 QString aLabel8 = QString::null) : 45 QListViewItem (parent, aLabel1, aLabel2, aLabel3, aLabel4, aLabel5, 46 aLabel6, aLabel7, aLabel8), 47 mName (aLabel1), mStatus (VBoxMedia::Unknown) {} 48 49 DiskImageItem (QListView *parent, QString aLabel1, 50 QString aLabel2 = QString::null, 51 QString aLabel3 = QString::null, 52 QString aLabel4 = QString::null, 53 QString aLabel5 = QString::null, 54 QString aLabel6 = QString::null, 55 QString aLabel7 = QString::null, 56 QString aLabel8 = QString::null) : 57 QListViewItem (parent, aLabel1, aLabel2, aLabel3, aLabel4, aLabel5, 58 aLabel6, aLabel7, aLabel8), 59 mName (aLabel1), mStatus (VBoxMedia::Unknown) {} 37 DiskImageItem (DiskImageItem *parent) : 38 QListViewItem (parent), mStatus (VBoxMedia::Unknown) {} 39 40 DiskImageItem (QListView *parent) : 41 QListViewItem (parent), mStatus (VBoxMedia::Unknown) {} 60 42 61 43 QString getName() { return mName; } … … 179 161 /// @todo refreshAll() may be slow, so it may be better to analyze 180 162 // event details and update only what is changed */ 181 //connect (&vboxGlobal(), SIGNAL (machineDataChanged (const VBoxMachineDataChangeEvent &)),182 //mModelessDialog, SLOT (refreshAll()));163 connect (&vboxGlobal(), SIGNAL (machineDataChanged (const VBoxMachineDataChangeEvent &)), 164 mModelessDialog, SLOT (refreshAll())); 183 165 connect (&vboxGlobal(), SIGNAL (machineRegistered (const VBoxMachineRegisteredEvent &)), 184 166 mModelessDialog, SLOT (refreshAll())); 185 167 connect (&vboxGlobal(), SIGNAL (snapshotChanged (const VBoxSnapshotEvent &)), 186 168 mModelessDialog, SLOT (refreshAll())); 187 188 /* listen also to the machine state change because hard disks of running189 * VMs are inaccessible by the current design */190 connect (&vboxGlobal(), SIGNAL (machineStateChanged (const VBoxMachineStateChangeEvent &)),191 mModelessDialog, SLOT (machineStateChanged (const VBoxMachineStateChangeEvent &)));192 169 } 193 170 … … 203 180 polished = false; 204 181 205 mToBeRefreshed = false;206 182 mInLoop = false; 207 183 … … 415 391 mProgressBar->setMaximumWidth (100); 416 392 buttonLayout->insertWidget (3, mProgressBar); 417 418 if (!vboxGlobal().isInEnumeratingProcess()) loadListViews();419 }420 421 422 void VBoxDiskImageManagerDlg::loadListViews()423 {424 /* load hd list */425 CHardDiskEnumerator hdEnum = vbox.GetHardDisks().Enumerate();426 while (hdEnum.HasMore())427 {428 CHardDisk hd = hdEnum.GetNext();429 DiskImageItem *item = createHdItem (hdsView, 0, hd, VBoxMedia::Unknown);430 createHdChildren (item, hd, VBoxMedia::Unknown);431 }432 433 /* load cd list */434 CDVDImageEnumerator cdEnum = vbox.GetDVDImages().Enumerate();435 while (cdEnum.HasMore())436 {437 CDVDImage cd = cdEnum.GetNext();438 DiskImageItem *item = createCdItem (cdsView, 0, cd, VBoxMedia::Unknown);439 NOREF(item);440 }441 442 /* load fd list */443 CFloppyImageEnumerator fdEnum = vbox.GetFloppyImages().Enumerate();444 while (fdEnum.HasMore())445 {446 CFloppyImage fd = fdEnum.GetNext();447 DiskImageItem *item = createFdItem (fdsView, 0, fd, VBoxMedia::Unknown);448 NOREF(item);449 }450 393 } 451 394 … … 621 564 } 622 565 566 QListView* VBoxDiskImageManagerDlg::getListView (VBoxDefs::DiskType aType) 567 { 568 switch (aType) 569 { 570 case VBoxDefs::HD: 571 return hdsView; 572 case VBoxDefs::CD: 573 return cdsView; 574 case VBoxDefs::FD: 575 return fdsView; 576 default: 577 return 0; 578 } 579 } 580 623 581 624 582 bool VBoxDiskImageManagerDlg::eventFilter (QObject *aObject, QEvent *aEvent) … … 697 655 QListView *currentList = getCurrentListView(); 698 656 699 DiskImageItem *item = 0;700 657 for (QStringList::Iterator it = (*aDroppedList).begin(); 701 658 it != (*aDroppedList).end(); ++it) … … 716 673 } 717 674 // If media type has been determined - attach this device 718 if (type) item =addImageToList (*it, type);675 if (type) addImageToList (*it, type); 719 676 } 720 677 delete aDroppedList; 721 setCurrentItem (currentList, item); 722 } 723 724 725 DiskImageItem* VBoxDiskImageManagerDlg::addImageToList (QString aSource,VBoxDefs::DiskType aDiskType)678 } 679 680 681 void VBoxDiskImageManagerDlg::addImageToList (QString aSource, 682 VBoxDefs::DiskType aDiskType) 726 683 { 727 684 if (aSource.isEmpty()) 728 return 0; 729 730 DiskImageItem *item = 0; 685 return; 686 731 687 QUuid uuid; 688 VBoxMedia media; 732 689 switch (aDiskType) 733 690 { … … 737 694 if (vbox.isOk()) 738 695 { 739 CHardDisk h ardDisk= CUnknown (vdi);740 vbox.RegisterHardDisk (h ardDisk);696 CHardDisk hd = CUnknown (vdi); 697 vbox.RegisterHardDisk (hd); 741 698 if (vbox.isOk()) 742 699 { 743 VBoxMedia::Status status = hardDisk.GetAccessible() ? 744 VBoxMedia::Ok : VBoxMedia::Inaccessible; 745 item = createHdItem (hdsView, 0, hardDisk, status); 746 /* synchronize modeless dialog if present */ 747 if (mModelessDialog && mModelessDialog != this) 748 mModelessDialog->createHdItem (mModelessDialog->hdsView, 749 0, hardDisk, status); 700 VBoxMedia::Status status = 701 hd.GetAccessible() ? VBoxMedia::Ok : 702 hd.isOk() ? VBoxMedia::Inaccessible : 703 VBoxMedia::Error; 704 media = VBoxMedia (CUnknown (hd), VBoxDefs::HD, status); 750 705 } 751 706 } … … 754 709 case VBoxDefs::CD: 755 710 { 756 CDVDImage dvdImage= vbox.OpenDVDImage (aSource, uuid);711 CDVDImage cd = vbox.OpenDVDImage (aSource, uuid); 757 712 if (vbox.isOk()) 758 713 { 759 vbox.RegisterDVDImage ( dvdImage);714 vbox.RegisterDVDImage (cd); 760 715 if (vbox.isOk()) 761 716 { 762 VBoxMedia::Status status = dvdImage.GetAccessible() ? 763 VBoxMedia::Ok : VBoxMedia::Inaccessible; 764 item = createCdItem (cdsView, 0, dvdImage, status); 765 /* synchronize modeless dialog if present */ 766 if (mModelessDialog && mModelessDialog != this) 767 mModelessDialog->createCdItem (mModelessDialog->cdsView, 768 0, dvdImage, status); 717 VBoxMedia::Status status = 718 cd.GetAccessible() ? VBoxMedia::Ok : 719 cd.isOk() ? VBoxMedia::Inaccessible : 720 VBoxMedia::Error; 721 media = VBoxMedia (CUnknown (cd), VBoxDefs::CD, status); 769 722 } 770 723 } … … 773 726 case VBoxDefs::FD: 774 727 { 775 CFloppyImage f loppyImage= vbox.OpenFloppyImage (aSource, uuid);728 CFloppyImage fd = vbox.OpenFloppyImage (aSource, uuid); 776 729 if (vbox.isOk()) 777 730 { 778 vbox.RegisterFloppyImage (f loppyImage);731 vbox.RegisterFloppyImage (fd); 779 732 if (vbox.isOk()) 780 733 { 781 VBoxMedia::Status status = floppyImage.GetAccessible() ? 782 VBoxMedia::Ok : VBoxMedia::Inaccessible; 783 item = createFdItem (fdsView, 0, floppyImage, status); 784 /* synchronize modeless dialog if present */ 785 if (mModelessDialog && mModelessDialog != this) 786 mModelessDialog->createFdItem (mModelessDialog->fdsView, 787 0, floppyImage, status); 734 VBoxMedia::Status status = 735 fd.GetAccessible() ? VBoxMedia::Ok : 736 fd.isOk() ? VBoxMedia::Inaccessible : 737 VBoxMedia::Error; 738 media = VBoxMedia (CUnknown (fd), VBoxDefs::FD, status); 788 739 } 789 740 } … … 791 742 } 792 743 default: 793 { 794 Assert(0); 795 } 796 } 797 return item; 744 AssertMsgFailed (("Invalid aDiskType type\n")); 745 } 746 if (media.type != VBoxDefs::InvalidType) 747 vboxGlobal().addMedia (media); 798 748 } 799 749 800 750 801 751 DiskImageItem* VBoxDiskImageManagerDlg::createImageNode (QListView *aList, 802 DiskImageItem *aRoot, 803 QString aName, 804 QString aLabel2, 805 QString aLabel3, 806 QString aLabel4, 807 QString aLabel5, 808 QString aLabel6, 809 QString aLabel7, 810 QString aLabel8) 752 DiskImageItem *aRoot) 811 753 { 812 754 DiskImageItem *item = 0; 813 755 814 756 if (aList) 815 item = new DiskImageItem (aList, aName, 816 aLabel2, aLabel3, aLabel4, aLabel5, aLabel6, aLabel7, aLabel8); 757 item = new DiskImageItem (aList); 817 758 else if (aRoot) 818 item = new DiskImageItem (aRoot, aName, 819 aLabel2, aLabel3, aLabel4, aLabel5, aLabel6, aLabel7, aLabel8); 759 item = new DiskImageItem (aRoot); 820 760 else 821 Assert (0);761 Assert (0); 822 762 823 763 return item; … … 1101 1041 1102 1042 1103 DiskImageItem* VBoxDiskImageManagerDlg::createHdItem (QListView *aList, 1104 DiskImageItem *aRoot, 1105 CHardDisk &aHd, 1106 VBoxMedia::Status aStatus) 1107 { 1108 DiskImageItem *item = 0; 1109 1110 QUuid uuid = aHd.GetId(); 1111 QString src = aHd.GetLocation(); 1112 QUuid machineId = aHd.GetMachineId(); 1113 1043 void VBoxDiskImageManagerDlg::updateHdItem (DiskImageItem *aItem, 1044 const VBoxMedia &aMedia) 1045 { 1046 CHardDisk hd = aMedia.disk; 1047 VBoxMedia::Status status = aMedia.status; 1048 1049 QUuid uuid = hd.GetId(); 1050 QString src = hd.GetLocation(); 1051 QUuid machineId = hd.GetMachineId(); 1114 1052 QString usage; 1115 1053 if (!machineId.isNull()) 1116 1054 usage = vbox.GetMachine (machineId).GetName(); 1117 QString storageType = vboxGlobal().toString ( aHd.GetStorageType());1118 QString hardDiskType = vboxGlobal().hardDiskTypeString ( aHd);1119 QString virtualSize = aStatus == VBoxMedia::Ok ?1120 vboxGlobal().formatSize ((ULONG64) aHd.GetSize() * _1M) : QString ("--");1121 QString actualSize = aStatus == VBoxMedia::Ok ?1122 vboxGlobal().formatSize ( aHd.GetActualSize()) : QString ("--");1055 QString storageType = vboxGlobal().toString (hd.GetStorageType()); 1056 QString hardDiskType = vboxGlobal().hardDiskTypeString (hd); 1057 QString virtualSize = status == VBoxMedia::Ok ? 1058 vboxGlobal().formatSize ((ULONG64)hd.GetSize() * _1M) : QString ("--"); 1059 QString actualSize = status == VBoxMedia::Ok ? 1060 vboxGlobal().formatSize (hd.GetActualSize()) : QString ("--"); 1123 1061 QString snapshotName; 1124 if (!machineId.isNull() && ! aHd.GetSnapshotId().isNull())1062 if (!machineId.isNull() && !hd.GetSnapshotId().isNull()) 1125 1063 { 1126 1064 CSnapshot snapshot = vbox.GetMachine (machineId). 1127 GetSnapshot ( aHd.GetSnapshotId());1065 GetSnapshot (hd.GetSnapshotId()); 1128 1066 if (!snapshot.isNull()) 1129 1067 snapshotName = QString ("%1").arg (snapshot.GetName()); … … 1131 1069 QFileInfo fi (src); 1132 1070 1133 item = createImageNode (aList, aRoot, 1134 fi.fileName(), 1135 virtualSize, 1136 actualSize); 1137 item->setPath (aHd.GetStorageType() == CEnums::ISCSIHardDisk ? src : 1071 aItem->setText (0, fi.fileName()); 1072 aItem->setText (1, virtualSize); 1073 aItem->setText (2, actualSize); 1074 aItem->setPath (hd.GetStorageType() == CEnums::ISCSIHardDisk ? src : 1138 1075 QDir::convertSeparators (fi.absFilePath())); 1139 item->setUsage (usage); 1140 item->setSnapshotName (snapshotName); 1141 item->setDiskType (hardDiskType); 1142 item->setStorageType (storageType); 1143 item->setVirtualSize (virtualSize); 1144 item->setActualSize (actualSize); 1145 item->setUuid (uuid); 1146 item->setMachineId (machineId); 1147 item->setToolTip (composeHdToolTip (aHd, aStatus)); 1148 item->setStatus (aStatus); 1149 1076 aItem->setUsage (usage); 1077 aItem->setSnapshotName (snapshotName); 1078 aItem->setDiskType (hardDiskType); 1079 aItem->setStorageType (storageType); 1080 aItem->setVirtualSize (virtualSize); 1081 aItem->setActualSize (actualSize); 1082 aItem->setUuid (uuid); 1083 aItem->setMachineId (machineId); 1084 aItem->setToolTip (composeHdToolTip (hd, status)); 1085 aItem->setStatus (status); 1086 1087 if (aMedia.status == VBoxMedia::Inaccessible) 1088 aItem->setPixmap (0, pxInaccessible); 1089 else if (aMedia.status == VBoxMedia::Error) 1090 aItem->setPixmap (0, pxErroneous); 1091 } 1092 1093 void VBoxDiskImageManagerDlg::updateCdItem (DiskImageItem *aItem, 1094 const VBoxMedia &aMedia) 1095 { 1096 CDVDImage cd = aMedia.disk; 1097 VBoxMedia::Status status = aMedia.status; 1098 1099 QUuid uuid = cd.GetId(); 1100 QString src = cd.GetFilePath(); 1101 QString usage = getDVDImageUsage (uuid); 1102 QString size = status == VBoxMedia::Ok ? 1103 vboxGlobal().formatSize (cd.GetSize()) : QString ("--"); 1104 QFileInfo fi (src); 1105 1106 aItem->setText (0, fi.fileName()); 1107 aItem->setText (1, size); 1108 aItem->setPath (QDir::convertSeparators (fi.absFilePath ())); 1109 aItem->setUsage (usage); 1110 aItem->setActualSize (size); 1111 aItem->setUuid (uuid); 1112 aItem->setToolTip (composeCdToolTip (cd, status)); 1113 aItem->setStatus (status); 1114 1115 if (aMedia.status == VBoxMedia::Inaccessible) 1116 aItem->setPixmap (0, pxInaccessible); 1117 else if (aMedia.status == VBoxMedia::Error) 1118 aItem->setPixmap (0, pxErroneous); 1119 } 1120 1121 void VBoxDiskImageManagerDlg::updateFdItem (DiskImageItem *aItem, 1122 const VBoxMedia &aMedia) 1123 { 1124 CFloppyImage fd = aMedia.disk; 1125 VBoxMedia::Status status = aMedia.status; 1126 1127 QUuid uuid = fd.GetId(); 1128 QString src = fd.GetFilePath(); 1129 QString usage = getFloppyImageUsage (uuid); 1130 QString size = status == VBoxMedia::Ok ? 1131 vboxGlobal().formatSize (fd.GetSize()) : QString ("--"); 1132 QFileInfo fi (src); 1133 1134 aItem->setText (0, fi.fileName()); 1135 aItem->setText (1, size); 1136 aItem->setPath (QDir::convertSeparators (fi.absFilePath ())); 1137 aItem->setUsage (usage); 1138 aItem->setActualSize (size); 1139 aItem->setUuid (uuid); 1140 aItem->setToolTip (composeFdToolTip (fd, status)); 1141 aItem->setStatus (status); 1142 1143 if (aMedia.status == VBoxMedia::Inaccessible) 1144 aItem->setPixmap (0, pxInaccessible); 1145 else if (aMedia.status == VBoxMedia::Error) 1146 aItem->setPixmap (0, pxErroneous); 1147 } 1148 1149 1150 DiskImageItem* VBoxDiskImageManagerDlg::createHdItem (QListView *aList, 1151 DiskImageItem *aRoot, 1152 const VBoxMedia &aMedia) 1153 { 1154 DiskImageItem *item = createImageNode (aList, aRoot); 1155 updateHdItem (item, aMedia); 1156 createHdChildren (item, aMedia); 1150 1157 return item; 1151 1158 } 1152 1159 1153 1154 DiskImageItem* VBoxDiskImageManagerDlg::createCdItem (QListView *aList, 1155 DiskImageItem *aRoot, 1156 CDVDImage &aCd, 1157 VBoxMedia::Status aStatus) 1158 { 1159 DiskImageItem *item = 0; 1160 1161 QUuid uuid = aCd.GetId(); 1162 QString src = aCd.GetFilePath(); 1163 QString usage = getDVDImageUsage (uuid); 1164 1165 QString size = aStatus == VBoxMedia::Ok ? 1166 vboxGlobal().formatSize (aCd.GetSize()) : QString ("--"); 1167 QFileInfo fi (src); 1168 1169 item = createImageNode (aList, aRoot, 1170 fi.fileName(), 1171 size); 1172 item->setPath (QDir::convertSeparators (fi.absFilePath ())); 1173 item->setUsage (usage); 1174 item->setActualSize (size); 1175 item->setUuid (uuid); 1176 item->setToolTip (composeCdToolTip (aCd, aStatus)); 1177 item->setStatus (aStatus); 1178 1160 DiskImageItem* VBoxDiskImageManagerDlg::createCdItem (QListView *aList, 1161 DiskImageItem *aRoot, 1162 const VBoxMedia &aMedia) 1163 { 1164 DiskImageItem *item = createImageNode (aList, aRoot); 1165 updateCdItem (item, aMedia); 1179 1166 return item; 1180 1167 } 1181 1168 1182 1183 DiskImageItem* VBoxDiskImageManagerDlg::createFdItem (QListView *aList, 1184 DiskImageItem *aRoot, 1185 CFloppyImage &aFd, 1186 VBoxMedia::Status aStatus) 1187 { 1188 DiskImageItem *item = 0; 1189 1190 QUuid uuid = aFd.GetId(); 1191 QString src = aFd.GetFilePath(); 1192 QString usage = getFloppyImageUsage (uuid); 1193 1194 QString size = aStatus == VBoxMedia::Ok ? 1195 vboxGlobal().formatSize (aFd.GetSize()) : QString ("--"); 1196 QFileInfo fi (src); 1197 1198 item = createImageNode (aList, aRoot, 1199 fi.fileName(), 1200 size); 1201 item->setPath (QDir::convertSeparators (fi.absFilePath ())); 1202 item->setUsage (usage); 1203 item->setActualSize (size); 1204 item->setUuid (uuid); 1205 item->setToolTip (composeFdToolTip (aFd, aStatus)); 1206 item->setStatus (aStatus); 1207 1169 DiskImageItem* VBoxDiskImageManagerDlg::createFdItem (QListView *aList, 1170 DiskImageItem *aRoot, 1171 const VBoxMedia &aMedia) 1172 { 1173 DiskImageItem *item = createImageNode (aList, aRoot); 1174 updateFdItem (item, aMedia); 1208 1175 return item; 1209 1176 } 1210 1177 1211 1212 void VBoxDiskImageManagerDlg::createHdChildren (DiskImageItem *aRoot, 1213 CHardDisk &aHd, 1214 VBoxMedia::Status aStatus) 1215 { 1216 CHardDiskEnumerator enumerator = aHd.GetChildren().Enumerate(); 1178 void VBoxDiskImageManagerDlg::createHdChildren (DiskImageItem *aRoot, 1179 const VBoxMedia &aMedia) 1180 { 1181 CHardDisk hd = aMedia.disk; 1182 CHardDiskEnumerator enumerator = hd.GetChildren().Enumerate(); 1217 1183 while (enumerator.HasMore()) 1218 1184 { 1219 1185 CHardDisk subHd = enumerator.GetNext(); 1220 DiskImageItem *subItem = createHdItem (0, aRoot, subHd, aStatus); 1221 createHdChildren (subItem, subHd, aStatus); 1222 } 1223 } 1224 1225 1226 DiskImageItem* VBoxDiskImageManagerDlg::searchItem (QListView *aList, QUuid aId) 1186 VBoxMedia::Status status = 1187 subHd.GetAccessible() == TRUE ? VBoxMedia::Ok : 1188 subHd.isOk() ? VBoxMedia::Inaccessible : 1189 VBoxMedia::Error; 1190 const VBoxMedia media (CUnknown (subHd), VBoxDefs::HD, status); 1191 createHdItem (0, aRoot, media); 1192 } 1193 } 1194 1195 1196 DiskImageItem* VBoxDiskImageManagerDlg::searchItem (QListView *aList, 1197 const QUuid &aId) 1227 1198 { 1228 1199 DiskImageItem *item = 0, *iterator = 0; … … 1239 1210 1240 1211 1241 void VBoxDiskImageManagerDlg::updateMedia (const VBoxMedia &aMedia)1242 {1243 /* ignore non-updated aMedia */1244 if (!(type & aMedia.type))1245 return;1246 1247 /* search for updated listview item */1248 DiskImageItem *item = 0;1249 switch (aMedia.type)1250 {1251 case VBoxDefs::HD:1252 {1253 CHardDisk hd = aMedia.disk;1254 item = searchItem (hdsView, hd.GetId());1255 delete item;1256 item = createHdItem (hdsView, 0, hd, aMedia.status);1257 createHdChildren (item, hd, aMedia.status);1258 break;1259 }1260 case VBoxDefs::CD:1261 {1262 CDVDImage cd = aMedia.disk;1263 item = searchItem (cdsView, cd.GetId());1264 delete item;1265 item = createCdItem (cdsView, 0, cd, aMedia.status);1266 break;1267 }1268 case VBoxDefs::FD:1269 {1270 CFloppyImage fd = aMedia.disk;1271 item = searchItem (fdsView, fd.GetId());1272 delete item;1273 item = createFdItem (fdsView, 0, fd, aMedia.status);1274 break;1275 }1276 default:1277 {1278 AssertMsgFailed (("Invalid aMedia type\n"));1279 break;1280 }1281 }1282 1283 if (aMedia.status == VBoxMedia::Inaccessible)1284 item->setPixmap (0, pxInaccessible);1285 else if (aMedia.status == VBoxMedia::Error)1286 item->setPixmap (0, pxErroneous);1287 1288 mProgressBar->setProgress (mProgressBar->progress() + 1);1289 }1290 1291 1292 1212 void VBoxDiskImageManagerDlg::setup (int aType, bool aDoSelect, 1293 1213 const QUuid *aTargetVMId, … … 1311 1231 buttonCancel->setShown (false); 1312 1232 1233 /* listen to "media enumeration started" signals */ 1234 connect (&vboxGlobal(), SIGNAL (mediaEnumStarted()), 1235 this, SLOT (mediaEnumStarted())); 1313 1236 /* listen to "media enumeration" signals */ 1314 connect (&vboxGlobal(), SIGNAL (mediaEnumerated (const VBoxMedia & )),1315 this, SLOT (mediaEnumerated (const VBoxMedia & )));1237 connect (&vboxGlobal(), SIGNAL (mediaEnumerated (const VBoxMedia &, int)), 1238 this, SLOT (mediaEnumerated (const VBoxMedia &, int))); 1316 1239 /* listen to "media enumeration finished" signals */ 1317 connect (&vboxGlobal(), SIGNAL (mediaEnumerated (const VBoxMediaList &)), 1318 this, SLOT (mediaEnumerated (const VBoxMediaList &))); 1240 connect (&vboxGlobal(), SIGNAL (mediaEnumFinished (const VBoxMediaList &)), 1241 this, SLOT (mediaEnumFinished (const VBoxMediaList &))); 1242 1243 /* listen to "media add" signals */ 1244 connect (&vboxGlobal(), SIGNAL (mediaAdded (const VBoxMedia &)), 1245 this, SLOT (mediaAdded (const VBoxMedia &))); 1246 /* listen to "media update" signals */ 1247 connect (&vboxGlobal(), SIGNAL (mediaUpdated (const VBoxMedia &)), 1248 this, SLOT (mediaUpdated (const VBoxMedia &))); 1249 /* listen to "media remove" signals */ 1250 connect (&vboxGlobal(), SIGNAL (mediaRemoved (VBoxDefs::DiskType, const QUuid &)), 1251 this, SLOT (mediaRemoved (VBoxDefs::DiskType, const QUuid &))); 1319 1252 1320 1253 /* insert already enumerated media */ 1321 VBoxMediaList list; 1254 VBoxMediaList list = mediaList ? 1255 *mediaList : vboxGlobal().currentMediaList(); 1256 prepareToRefresh (list.size()); 1257 VBoxMediaList::const_iterator it; 1258 int index = 0; 1259 for (it = list.begin(); it != list.end(); ++ it) 1260 { 1261 mediaAdded (*it); 1262 if ((*it).status != VBoxMedia::Unknown) 1263 mProgressBar->setProgress (index ++); 1264 } 1265 /* select first child */ 1266 setCurrentItem (hdsView, hdsView->firstChild()); 1267 setCurrentItem (cdsView, cdsView->firstChild()); 1268 setCurrentItem (fdsView, fdsView->firstChild()); 1269 1322 1270 if (mediaList) 1323 list = *mediaList; 1271 { 1272 mediaEnumFinished (list); 1273 } 1324 1274 else 1325 list = vboxGlobal().currentMediaList(); 1326 1327 VBoxMediaList::const_iterator it; 1328 prepareToRefresh(); 1329 for (it = list.begin(); it != list.end(); ++ it) 1330 updateMedia (*it); 1331 1332 if (mediaList) 1333 { 1334 mediaEnumerated (*mediaList); 1335 } 1336 else 1337 { 1338 /* only start enumerating media if we haven't been supplied with a list 1275 { 1276 /* only start enumerating media if we haven't been supplied a list 1339 1277 * (it's ok if the enumeration has been already started, nothing will 1340 1278 * happen) */ … … 1344 1282 1345 1283 1346 void VBoxDiskImageManagerDlg::mediaEnumerated (const VBoxMedia &aMedia) 1347 { 1348 if (!mToBeRefreshed) return; 1349 updateMedia (aMedia); 1284 void VBoxDiskImageManagerDlg::mediaEnumStarted() 1285 { 1286 VBoxMediaList list = vboxGlobal().currentMediaList(); 1287 prepareToRefresh (list.size()); 1288 /* clearing lists */ 1289 hdsView->clear(), cdsView->clear(), fdsView->clear(); 1290 /* load current media list */ 1291 VBoxMediaList::const_iterator it; 1292 for (it = list.begin(); it != list.end(); ++ it) 1293 mediaAdded (*it); 1294 /* select first child */ 1295 if (!hdsView->isSelected (hdsView->currentItem())) 1296 setCurrentItem (hdsView, hdsView->firstChild()); 1297 if (!cdsView->isSelected (cdsView->currentItem())) 1298 setCurrentItem (cdsView, cdsView->firstChild()); 1299 if (!fdsView->isSelected (fdsView->currentItem())) 1300 setCurrentItem (fdsView, fdsView->firstChild()); 1301 1350 1302 processCurrentChanged(); 1351 1303 } 1352 1304 1353 1354 void VBoxDiskImageManagerDlg::mediaEnumerated (const VBoxMediaList & /*aList*/) 1355 { 1356 if (!mToBeRefreshed) return; 1357 1305 void VBoxDiskImageManagerDlg::mediaEnumerated (const VBoxMedia &aMedia, 1306 int aIndex) 1307 { 1308 mediaUpdated (aMedia); 1309 if (aMedia.status != VBoxMedia::Unknown) 1310 mProgressBar->setProgress (aIndex); 1311 } 1312 1313 void VBoxDiskImageManagerDlg::mediaEnumFinished (const VBoxMediaList &/* aList */) 1314 { 1358 1315 mProgressBar->setHidden (true); 1359 1316 mProgressText->setHidden (true); … … 1362 1319 unsetCursor(); 1363 1320 1364 mToBeRefreshed = false; 1321 processCurrentChanged(); 1322 } 1323 1324 1325 void VBoxDiskImageManagerDlg::mediaAdded (const VBoxMedia &aMedia) 1326 { 1327 /* ignore non-interesting aMedia */ 1328 if (!(type & aMedia.type)) 1329 return; 1330 1331 DiskImageItem *item = 0; 1332 switch (aMedia.type) 1333 { 1334 case VBoxDefs::HD: 1335 item = createHdItem (hdsView, 0, aMedia); 1336 if (item->getUuid() == hdSelectedId) 1337 setCurrentItem (hdsView, item); 1338 break; 1339 case VBoxDefs::CD: 1340 item = createCdItem (cdsView, 0, aMedia); 1341 if (item->getUuid() == cdSelectedId) 1342 setCurrentItem (cdsView, item); 1343 break; 1344 case VBoxDefs::FD: 1345 item = createFdItem (fdsView, 0, aMedia); 1346 if (item->getUuid() == fdSelectedId) 1347 setCurrentItem (fdsView, item); 1348 break; 1349 default: 1350 AssertMsgFailed (("Invalid aMedia type\n")); 1351 } 1352 if (!item) 1353 return; 1354 if (!vboxGlobal().isMediaEnumerationStarted()) 1355 setCurrentItem (getListView (aMedia.type), item); 1356 } 1357 1358 void VBoxDiskImageManagerDlg::mediaUpdated (const VBoxMedia &aMedia) 1359 { 1360 /* ignore non-interesting aMedia */ 1361 if (!(type & aMedia.type)) 1362 return; 1363 1364 DiskImageItem *item = 0; 1365 switch (aMedia.type) 1366 { 1367 case VBoxDefs::HD: 1368 { 1369 CHardDisk hd = aMedia.disk; 1370 item = searchItem (hdsView, hd.GetId()); 1371 if (item) 1372 updateHdItem (item, aMedia); 1373 break; 1374 } 1375 case VBoxDefs::CD: 1376 { 1377 CDVDImage cd = aMedia.disk; 1378 item = searchItem (cdsView, cd.GetId()); 1379 if (item) 1380 updateCdItem (item, aMedia); 1381 break; 1382 } 1383 case VBoxDefs::FD: 1384 { 1385 CFloppyImage fd = aMedia.disk; 1386 item = searchItem (fdsView, fd.GetId()); 1387 if (item) 1388 updateFdItem (item, aMedia); 1389 break; 1390 } 1391 default: 1392 AssertMsgFailed (("Invalid aMedia type\n")); 1393 } 1394 if (!item) 1395 return; 1396 if (!vboxGlobal().isMediaEnumerationStarted()) 1397 setCurrentItem (getListView (aMedia.type), item); 1398 } 1399 1400 void VBoxDiskImageManagerDlg::mediaRemoved (VBoxDefs::DiskType aType, 1401 const QUuid &aId) 1402 { 1403 QListView *listView = getListView (aType); 1404 DiskImageItem *item = searchItem (listView, aId); 1405 delete item; 1406 setCurrentItem (listView, listView->currentItem()); 1365 1407 } 1366 1408 … … 1389 1431 1390 1432 1391 void VBoxDiskImageManagerDlg::prepareToRefresh() 1392 { 1393 if (mToBeRefreshed) return; 1394 mToBeRefreshed = true; 1395 1433 void VBoxDiskImageManagerDlg::prepareToRefresh (int aTotal) 1434 { 1396 1435 /* info panel clearing */ 1397 1436 hdsPane1->clear(); … … 1404 1443 if (mProgressBar) 1405 1444 { 1406 int totalSteps = 0; 1407 if (type & VBoxDefs::HD) 1408 totalSteps += vbox.GetHardDisks().GetCount(); 1409 if (type & VBoxDefs::CD) 1410 totalSteps += vbox.GetDVDImages().GetCount(); 1411 if (type & VBoxDefs::FD) 1412 totalSteps += vbox.GetFloppyImages().GetCount(); 1413 mProgressBar->setProgress (0, totalSteps); 1445 mProgressBar->setProgress (0, aTotal); 1414 1446 mProgressBar->setHidden (false); 1415 1447 mProgressText->setHidden (false); … … 1423 1455 void VBoxDiskImageManagerDlg::refreshAll() 1424 1456 { 1425 if (mToBeRefreshed) return;1426 prepareToRefresh();1427 /* lists clearing */1428 hdsView->clear(), cdsView->clear(), fdsView->clear();1429 /* load all lists */1430 loadListViews();1431 1457 /* start enumerating media */ 1432 1458 vboxGlobal().startEnumeratingMedia(); … … 1494 1520 1495 1521 1496 void VBoxDiskImageManagerDlg::setCurrentItem (QListView *aListView, QListViewItem *aItem) 1497 { 1498 aListView->setFocus(); 1499 if (aItem) 1500 { 1501 aListView->setCurrentItem (aItem); 1502 aListView->setSelected (aListView->currentItem(), true); 1503 /* it is strange repeat but it works */ 1504 aListView->adjustColumn (1); 1505 aListView->adjustColumn (2); 1506 aListView->adjustColumn (1); 1507 } 1508 processCurrentChanged (aListView->currentItem()); 1522 void VBoxDiskImageManagerDlg::setCurrentItem (QListView *aListView, 1523 QListViewItem *aItem) 1524 { 1525 if (!aItem) 1526 return; 1527 1528 aListView->setCurrentItem (aItem); 1529 aListView->setSelected (aListView->currentItem(), true); 1530 /* it is strange repeat but it works */ 1531 aListView->adjustColumn (1); 1532 aListView->adjustColumn (2); 1533 aListView->adjustColumn (1); 1509 1534 } 1510 1535 … … 1514 1539 QListView *currentList = getCurrentListView(); 1515 1540 currentList->setFocus(); 1516 1517 QListViewItem *itemToSelect =1518 !currentList->isSelected (currentList->currentItem()) ?1519 currentList->firstChild() : currentList->currentItem();1520 setCurrentItem (currentList, itemToSelect);1521 1541 1522 1542 /* tab stop setup */ … … 1538 1558 setTabOrder (buttonHelp, buttonOk); 1539 1559 setTabOrder (buttonOk, twImages); 1560 1561 processCurrentChanged (currentList->currentItem()); 1540 1562 } 1541 1563 … … 1545 1567 static_cast<DiskImageItem*> (aItem) : 0; 1546 1568 1547 bool modifyEnabled = item && item->getUsage().isNull() && 1569 bool notInEnum = !vboxGlobal().isMediaEnumerationStarted(); 1570 bool modifyEnabled = notInEnum && 1571 item && item->getUsage().isNull() && 1548 1572 !item->firstChild() && !item->getPath().isNull(); 1549 1573 bool releaseEnabled = item && !item->getUsage().isNull() && … … 1551 1575 !item->parent() && !item->firstChild() && 1552 1576 item->getSnapshotName().isNull(); 1553 bool newEnabled = getCurrentListView() == hdsView ? true : false; 1577 bool newEnabled = notInEnum && 1578 getCurrentListView() == hdsView ? true : false; 1579 bool addEnabled = notInEnum; 1554 1580 1555 1581 // imEditAction->setEnabled (modifyEnabled); … … 1557 1583 imReleaseAction->setEnabled (releaseEnabled); 1558 1584 imNewAction->setEnabled (newEnabled); 1585 imAddAction->setEnabled (addEnabled); 1559 1586 1560 1587 // itemMenu->setItemVisible (itemMenu->idAt(0), modifyEnabled); … … 1574 1601 if (item) 1575 1602 { 1576 if ( getCurrentListView() == hdsView)1603 if (item->listView() == hdsView) 1577 1604 { 1578 1605 hdsPane1->setText (item->getInformation (item->getPath(), true, "end")); … … 1581 1608 hdsPane4->setText (item->getInformation (item->getUsage())); 1582 1609 hdsPane5->setText (item->getInformation (item->getSnapshotName())); 1583 } 1584 else if (getCurrentListView() == cdsView) 1610 hdSelectedId = item->getUuid(); 1611 } 1612 else if (item->listView() == cdsView) 1585 1613 { 1586 1614 cdsPane1->setText (item->getInformation (item->getPath(), true, "end")); 1587 1615 cdsPane2->setText (item->getInformation (item->getUsage())); 1588 } 1589 else if (getCurrentListView() == fdsView) 1616 cdSelectedId = item->getUuid(); 1617 } 1618 else if (item->listView() == fdsView) 1590 1619 { 1591 1620 fdsPane1->setText (item->getInformation (item->getPath(), true, "end")); 1592 1621 fdsPane2->setText (item->getInformation (item->getUsage())); 1622 fdSelectedId = item->getUuid(); 1593 1623 } 1594 1624 } … … 1603 1633 currentList->setSelected (currentList->currentItem(), true); 1604 1634 } 1605 processCurrentChanged();1606 1635 } 1607 1636 … … 1616 1645 { 1617 1646 CHardDisk hd = dlg.hardDisk(); 1618 VBoxMedia::Status status = hd.GetAccessible() ? 1619 VBoxMedia::Ok : VBoxMedia::Inaccessible; 1620 DiskImageItem *createdItem = createHdItem (hdsView, 0, hd, status); 1621 setCurrentItem (hdsView, createdItem); 1622 /* synchronize modeless dialog if present */ 1623 if (mModelessDialog && mModelessDialog != this) 1624 mModelessDialog->createHdItem (mModelessDialog->hdsView, 1625 0, hd, status); 1647 VBoxMedia::Status status = 1648 hd.GetAccessible() ? VBoxMedia::Ok : 1649 hd.isOk() ? VBoxMedia::Inaccessible : 1650 VBoxMedia::Error; 1651 VBoxMedia media (CUnknown (hd), VBoxDefs::HD, status); 1652 vboxGlobal().addMedia (media); 1626 1653 } 1627 1654 } … … 1669 1696 title); 1670 1697 1671 DiskImageItem *createdItem = addImageToList (src, type); 1672 setCurrentItem (currentList, createdItem); 1673 1698 addImageToList (src, type); 1674 1699 if (!vbox.isOk()) 1675 {1676 1700 vboxProblem().cannotRegisterMedia (this, vbox, type, src); 1677 }1678 1701 } 1679 1702 … … 1686 1709 static_cast<DiskImageItem*> (currentList->currentItem()) : 0; 1687 1710 AssertMsg (item, ("Current item must not be null")); 1688 QString removedItemName = item->getName();1689 1711 1690 1712 QString src = item->getPath().stripWhiteSpace(); … … 1730 1752 } 1731 1753 1732 if (!vbox.isOk()) 1733 { 1754 if (vbox.isOk()) 1755 vboxGlobal().removeMedia (type, uuid); 1756 else 1734 1757 vboxProblem().cannotUnregisterMedia (this, vbox, type, src); 1735 }1736 else1737 {1738 delete item;1739 setCurrentItem (currentList, currentList->currentItem());1740 /* synchronize modeless dialog if present */1741 if (mModelessDialog && mModelessDialog != this)1742 {1743 DiskImageItem *itemToRemove = 0;1744 QListView *modelessView = 0;1745 if (currentList == hdsView)1746 modelessView = mModelessDialog->hdsView;1747 else if (currentList == cdsView)1748 modelessView = mModelessDialog->cdsView;1749 else if (currentList == fdsView)1750 modelessView = mModelessDialog->fdsView;1751 itemToRemove = static_cast<DiskImageItem*>1752 (modelessView->findItem (removedItemName, 0));1753 delete itemToRemove;1754 if (modelessView->currentItem())1755 modelessView->setSelected (modelessView->currentItem(), true);1756 mModelessDialog->processCurrentChanged();1757 }1758 }1759 1758 } 1760 1759 … … 1767 1766 static_cast<DiskImageItem*> (currentList->currentItem()) : 0; 1768 1767 AssertMsg (item, ("Current item must not be null")); 1769 QString releasedItemName = item->getName();1770 QString usageAfterRelease;1771 1768 1772 1769 QUuid itemId = QUuid (item->getUuid()); 1773 1770 AssertMsg (!itemId.isNull(), ("Current item must have uuid")); 1774 1771 1772 VBoxMedia media; 1775 1773 QUuid machineId; 1776 1774 /* if it is a hard disk sub-item: */ … … 1782 1780 { 1783 1781 releaseDisk (machineId, itemId, VBoxDefs::HD); 1784 1785 /* re-request current usage */ 1786 machineId = vbox.GetHardDisk (itemId).GetMachineId(); 1787 usageAfterRelease = machineId.isNull() ? QString::null : 1788 vbox.GetMachine (machineId).GetName(); 1789 item->setUsage (usageAfterRelease); 1782 CHardDisk hd = vboxGlobal().virtualBox().GetHardDisk (itemId); 1783 media = VBoxMedia (CUnknown (hd), VBoxDefs::HD, item->getStatus()); 1790 1784 } 1791 1785 } … … 1804 1798 releaseDisk (QUuid (*it), itemId, VBoxDefs::CD); 1805 1799 1806 /* re-request current usage */ 1807 usageAfterRelease = getDVDImageUsage (itemId); 1808 item->setUsage (usageAfterRelease); 1800 CDVDImage cd = vboxGlobal().virtualBox().GetDVDImage (itemId); 1801 media = VBoxMedia (CUnknown (cd), VBoxDefs::CD, item->getStatus()); 1809 1802 } 1810 1803 } … … 1823 1816 releaseDisk (QUuid (*it), itemId, VBoxDefs::FD); 1824 1817 1825 /* re-request current usage */ 1826 usageAfterRelease = getFloppyImageUsage (itemId); 1827 item->setUsage (usageAfterRelease); 1828 } 1829 } 1830 processCurrentChanged (item); 1831 1832 /* processing modeless dialog */ 1833 if (mModelessDialog && mModelessDialog != this) 1834 { 1835 DiskImageItem *itemToRelease = 0; 1836 QListView *modelessView = 0; 1837 if (currentList == hdsView) 1838 modelessView = mModelessDialog->hdsView; 1839 else if (currentList == cdsView) 1840 modelessView = mModelessDialog->cdsView; 1841 else if (currentList == fdsView) 1842 modelessView = mModelessDialog->fdsView; 1843 itemToRelease = static_cast<DiskImageItem*> 1844 (modelessView->findItem (releasedItemName, 0)); 1845 itemToRelease->setUsage (usageAfterRelease); 1846 mModelessDialog->processCurrentChanged(); 1847 } 1818 CFloppyImage fd = vboxGlobal().virtualBox().GetFloppyImage (itemId); 1819 media = VBoxMedia (CUnknown (fd), VBoxDefs::FD, item->getStatus()); 1820 } 1821 } 1822 if (media.type != VBoxDefs::InvalidType) 1823 vboxGlobal().updateMedia (media); 1848 1824 } 1849 1825 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui.h
r382 r548 99 99 100 100 /* HDD Images page */ 101 mediaCombo = new VBoxMediaComboBox (grbHDA, "mediaCombo", VBoxDefs::HD); 102 mediaCombo->setUseEmptyItem (true); 103 mediaCombo->refresh(); 101 mediaCombo = new VBoxMediaComboBox (grbHDA, "mediaCombo", VBoxDefs::HD, true); 104 102 grbHDALayout->addMultiCellWidget (mediaCombo, 0, 0, 0, 2); 105 103 setTabOrder (mediaCombo, pbNewHD); … … 107 105 connect (mediaCombo, SIGNAL (activated (int)), 108 106 this, SLOT (currentMediaChanged (int))); 107 vboxGlobal().startEnumeratingMedia(); 109 108 110 109 /// @todo (dmik) remove? … … 339 338 if (!chd.isNull()) 340 339 { 340 QUuid hdId = chd.GetId(); 341 341 CVirtualBox vbox = vboxGlobal().virtualBox(); 342 342 vbox.UnregisterHardDisk (chd.GetId()); … … 355 355 } 356 356 chd.detach(); 357 mediaCombo->removeLastItem();357 vboxGlobal().removeMedia (VBoxDefs::HD, hdId); 358 358 } 359 359 } … … 368 368 VBoxDiskImageManagerDlg dlg (this, "VBoxDiskImageManagerDlg", WType_Dialog | WShowModal); 369 369 dlg.setup (VBoxDefs::HD, true); 370 if (dlg.exec() == VBoxDiskImageManagerDlg::Accepted) 371 { 372 /* fetch uuid and name/path */ 373 if (dlg.getSelectedUuid() != uuidHD) 374 { 375 ensureNewHardDiskDeleted(); 376 uuidHD = dlg.getSelectedUuid(); 377 } 378 /* refresh media combobox */ 379 mediaCombo->setRequiredItem (uuidHD); 380 mediaCombo->refresh(); 381 mediaCombo->setFocus(); 382 /* revailidate */ 383 wvalHDD->revalidate(); 384 } 370 QUuid newId = dlg.exec() == VBoxDiskImageManagerDlg::Accepted ? 371 dlg.getSelectedUuid() : mediaCombo->getId(); 372 373 if (uuidHD != newId) 374 { 375 ensureNewHardDiskDeleted(); 376 uuidHD = newId; 377 mediaCombo->setCurrentItem (uuidHD); 378 } 379 mediaCombo->setFocus(); 380 /* revailidate */ 381 wvalHDD->revalidate(); 385 382 } 386 383 … … 401 398 uuidHD = chd.GetId(); 402 399 /* update media combobox */ 403 QFileInfo fi (chd.GetLocation()); 404 mediaCombo->appendItem (QString ("%1 (%2)") 405 .arg (fi.fileName()) 406 .arg (QDir::convertSeparators (fi.dirPath())), 407 uuidHD, VBoxDiskImageManagerDlg::composeHdToolTip (chd)); 408 mediaCombo->setCurrentItem (mediaCombo->count() - 1); 400 VBoxMedia::Status status = 401 chd.GetAccessible() == TRUE ? VBoxMedia::Ok : 402 chd.isOk() ? VBoxMedia::Inaccessible : 403 VBoxMedia::Error; 404 VBoxMedia media (CUnknown (chd), VBoxDefs::HD, status); 405 vboxGlobal().addMedia (media); 406 mediaCombo->setCurrentItem (uuidHD); 409 407 mediaCombo->setFocus(); 410 408 /* revailidate */ -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r441 r548 658 658 { 659 659 /* setup necessary combobox item */ 660 cbHDA->setRequiredItem (uuidHDA); 661 cbHDB->setRequiredItem (uuidHDB); 662 cbHDD->setRequiredItem (uuidHDD); 663 cbISODVD->setRequiredItem (uuidISODVD); 664 cbISOFloppy->setRequiredItem (uuidISOFloppy); 665 /* request for refresh every combo-box */ 666 cbHDA->setReadyForRefresh(); 667 cbHDB->setReadyForRefresh(); 668 cbHDD->setReadyForRefresh(); 669 cbISODVD->setReadyForRefresh(); 670 cbISOFloppy->setReadyForRefresh(); 671 /* starting media-enumerating process */ 672 vboxGlobal().startEnumeratingMedia(); 660 cbHDA->setCurrentItem (uuidHDA); 661 cbHDB->setCurrentItem (uuidHDB); 662 cbHDD->setCurrentItem (uuidHDD); 663 cbISODVD->setCurrentItem (uuidISODVD); 664 cbISOFloppy->setCurrentItem (uuidISOFloppy); 665 /* check if the enumeration process has been started yet */ 666 if (!vboxGlobal().isMediaEnumerationStarted()) 667 vboxGlobal().startEnumeratingMedia(); 668 else 669 { 670 cbHDA->refresh(); 671 cbHDB->refresh(); 672 cbHDD->refresh(); 673 cbISODVD->refresh(); 674 cbISOFloppy->refresh(); 675 } 673 676 } 674 677 … … 677 680 { 678 681 uuidHDA = grbHDA->isChecked() ? cbHDA->getId() : QUuid(); 679 cbHDA->setRequiredItem (uuidHDA);680 682 txHDA->setText (getHdInfo (grbHDA, uuidHDA)); 681 683 /* revailidate */ … … 687 689 { 688 690 uuidHDB = grbHDB->isChecked() ? cbHDB->getId() : QUuid(); 689 cbHDB->setRequiredItem (uuidHDB);690 691 txHDB->setText (getHdInfo (grbHDB, uuidHDB)); 691 692 /* revailidate */ … … 697 698 { 698 699 uuidHDD = grbHDD->isChecked() ? cbHDD->getId() : QUuid(); 699 cbHDD->setRequiredItem (uuidHDD);700 700 txHDD->setText (getHdInfo (grbHDD, uuidHDD)); 701 701 /* revailidate */ … … 707 707 { 708 708 uuidISODVD = bgDVD->isChecked() ? cbISODVD->getId() : QUuid(); 709 cbISODVD->setRequiredItem (uuidISODVD);710 709 /* revailidate */ 711 710 wvalDVD->revalidate(); … … 716 715 { 717 716 uuidISOFloppy = bgFloppy->isChecked() ? cbISOFloppy->getId() : QUuid(); 718 cbISOFloppy->setRequiredItem (uuidISOFloppy);719 717 /* revailidate */ 720 718 wvalFloppy->revalidate(); … … 1288 1286 1289 1287 /* request for media shortcuts update */ 1290 cbHDA->setBelongsTo (machine.GetId());1291 cbHDB->setBelongsTo (machine.GetId());1292 cbHDD->setBelongsTo (machine.GetId());1288 cbHDA->setBelongsTo (machine.GetId()); 1289 cbHDB->setBelongsTo (machine.GetId()); 1290 cbHDD->setBelongsTo (machine.GetId()); 1293 1291 updateShortcuts(); 1294 1292 … … 1541 1539 QUuid machineId = cmachine.GetId(); 1542 1540 dlg.setup (type, true, &machineId, (const VBoxMediaList*)0, cmachine); 1543 if (dlg.exec() == VBoxDiskImageManagerDlg::Accepted)1544 *id = dlg.getSelectedUuid();1545 updateShortcuts();1541 *id = dlg.exec() == VBoxDiskImageManagerDlg::Accepted ? 1542 dlg.getSelectedUuid() : cbb->getId(); 1543 cbb->setCurrentItem (*id); 1546 1544 cbb->setFocus(); 1545 1546 /* revalidate pages with custom validation */ 1547 wvalHDD->revalidate(); 1548 wvalDVD->revalidate(); 1549 wvalFloppy->revalidate(); 1547 1550 } 1548 1551
Note:
See TracChangeset
for help on using the changeset viewer.