Changeset 5281 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 12, 2007 8:24:28 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/ui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui
r5247 r5281 597 597 <function access="private" returnType="DiskImageItem*">searchItem( QListView*, const QUuid & )</function> 598 598 <function access="private" returnType="DiskImageItem*">searchItem( QListView*, VBoxMedia::Status )</function> 599 <function specifier="static" access="private" returnType="QString">getDVDImageUsage( const QUuid & id)</function>600 <function specifier="static" access="private" returnType="QString">getFloppyImageUsage( const QUuid & id)</function>601 <function specifier="static" access="private"> sourceSnapshotsCD( const QUuid & aImageId, const CSnapshot & aSnapshot, QString & aUsage )</function>602 <function specifier="static" access="private"> sourceSnapshotsFD( const QUuid & aImageId, const CSnapshot & aSnapshot, QString & aUsage )</function>599 <function specifier="static" access="private" returnType="QString">getDVDImageUsage( const QUuid & aId, QString & aSnapshotUsage )</function> 600 <function specifier="static" access="private" returnType="QString">getFloppyImageUsage( const QUuid & aId, QString & aSnapshotUsage )</function> 601 <function specifier="static" access="private">getDVDImageSnapshotUsage( const QUuid & aImageId, const CSnapshot & aSnapshot, QString & aUsage )</function> 602 <function specifier="static" access="private">getFloppyImageSnapshotUsage( const QUuid & aImageId, const CSnapshot & aSnapshot, QString & aUsage )</function> 603 603 <function access="private" returnType="bool">checkImage( DiskImageItem* item )</function> 604 604 <function access="private">releaseDisk( QUuid machineId, QUuid itemId, VBoxDefs::DiskType diskType )</function> … … 627 627 <function access="protected">setCurrentItem( QListView*, QListViewItem* )</function> 628 628 <function specifier="static"> showModeless( bool aRefresh = true )</function> 629 <function specifier="static" returnType="QString">composeHdToolTip( CHardDisk &, VBoxMedia::Status = VBoxMedia::Ok )</function>630 <function specifier="static" returnType="QString">composeCdToolTip( CDVDImage &, VBoxMedia::Status = VBoxMedia::Ok )</function>631 <function specifier="static" returnType="QString">composeFdToolTip( CFloppyImage &, VBoxMedia::Status = VBoxMedia::Ok )</function>629 <function specifier="static" returnType="QString">composeHdToolTip( CHardDisk &, VBoxMedia::Status = VBoxMedia::Ok, DiskImageItem *aItem = NULL )</function> 630 <function specifier="static" returnType="QString">composeCdToolTip( CDVDImage &, VBoxMedia::Status = VBoxMedia::Ok, DiskImageItem *aItem = NULL )</function> 631 <function specifier="static" returnType="QString">composeFdToolTip( CFloppyImage &, VBoxMedia::Status = VBoxMedia::Ok, DiskImageItem *aItem = NULL )</function> 632 632 <function access="protected">clearInfoPanes()</function> 633 633 <function access="protected">prepareToRefresh( int aTotal = 0 )</function> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui.h
r5247 r5281 40 40 41 41 void setMedia (const VBoxMedia &aMedia) { mMedia = aMedia; } 42 VBoxMedia &getMedia() { return mMedia; } 43 44 QString getName() { return mName; } 42 const VBoxMedia &getMedia() const { return mMedia; } 45 43 46 44 void setPath (QString aPath) { mPath = aPath; } 47 const QString &getPath() { return mPath; }45 const QString &getPath() const { return mPath; } 48 46 49 47 void setUsage (QString aUsage) { mUsage = aUsage; } 50 const QString &getUsage() { return mUsage; } 48 const QString &getUsage() const { return mUsage; } 49 50 void setSnapshotUsage (QString aSnapshotUsage) { mSnapshotUsage = aSnapshotUsage; } 51 const QString &getSnapshotUsage() const { return mSnapshotUsage; } 52 53 QString getTotalUsage() const 54 { 55 /* should correlate with VBoxDiskImageManagerDlg::compose[Cd/Fd]Tooltip */ 56 return mSnapshotUsage.isNull() ? mUsage : 57 QString ("%1 (%2)").arg (mUsage, mSnapshotUsage); 58 } 51 59 52 60 void setSnapshotName (QString aSnapshotName) { mSnapshotName = aSnapshotName; } 53 const QString &getSnapshotName() { return mSnapshotName; }61 const QString &getSnapshotName() const { return mSnapshotName; } 54 62 55 63 void setDiskType (QString aDiskType) { mDiskType = aDiskType; } 56 const QString &getDiskType() { return mDiskType; }64 const QString &getDiskType() const { return mDiskType; } 57 65 58 66 void setStorageType (QString aStorageType) { mStorageType = aStorageType; } 59 const QString &getStorageType() { return mStorageType; }67 const QString &getStorageType() const { return mStorageType; } 60 68 61 69 void setVirtualSize (QString aVirtualSize) { mVirtualSize = aVirtualSize; } 62 const QString &getVirtualSize() { return mVirtualSize; }70 const QString &getVirtualSize() const { return mVirtualSize; } 63 71 64 72 void setActualSize (QString aActualSize) { mActualSize = aActualSize; } 65 const QString &getActualSize() { return mActualSize; } 66 73 const QString &getActualSize() const { return mActualSize; } 67 74 68 75 void setUuid (QUuid aUuid) { mUuid = aUuid; } 69 const QString &getUuid() { return mUuid; }76 const QString &getUuid() const { return mUuid; } 70 77 71 78 void setMachineId (QString aMachineId) { mMachineId = aMachineId; } 72 const QString &getMachineId() { return mMachineId; } 73 79 const QString &getMachineId() const { return mMachineId; } 74 80 75 81 void setStatus (VBoxMedia::Status aStatus) { mStatus = aStatus; } 76 VBoxMedia::Status getStatus() { return mStatus; } 77 82 VBoxMedia::Status getStatus() const { return mStatus; } 78 83 79 84 void setToolTip (QString aToolTip) { mToolTip = aToolTip; } 80 const QString &getToolTip() { return mToolTip; }85 const QString &getToolTip() const { return mToolTip; } 81 86 82 87 QString getInformation (const QString &aInfo, bool aCompact = true, … … 133 138 QString mPath; 134 139 QString mUsage; 140 QString mSnapshotUsage; 135 141 QString mSnapshotName; 136 142 QString mDiskType; … … 857 863 858 864 859 QString VBoxDiskImageManagerDlg::getDVDImageUsage (const QUuid &aId) 865 QString VBoxDiskImageManagerDlg::getDVDImageUsage (const QUuid &aId, 866 QString &aSnapshotUsage) 860 867 { 861 868 CVirtualBox vbox = vboxGlobal().virtualBox(); … … 877 884 usage += machine.GetName(); 878 885 879 QString snapshots; 880 sourceSnapshotsCD (aId, machine.GetSnapshot (QUuid()), snapshots); 881 if (!snapshots.isEmpty()) 882 usage += QString (" (%1)").arg (snapshots); 886 getDVDImageSnapshotUsage (aId, machine.GetSnapshot (QUuid()), 887 aSnapshotUsage); 883 888 } 884 889 … … 897 902 usage += machine.GetName() + "]"; 898 903 899 QString snapshots; 900 sourceSnapshotsCD (aId, machine.GetSnapshot (QUuid()), snapshots); 901 if (!snapshots.isEmpty()) 902 usage += QString (" (%1)").arg (snapshots); 904 getDVDImageSnapshotUsage (aId, machine.GetSnapshot (QUuid()), 905 aSnapshotUsage); 903 906 } 904 907 } … … 907 910 } 908 911 909 QString VBoxDiskImageManagerDlg::getFloppyImageUsage (const QUuid &aId) 912 QString VBoxDiskImageManagerDlg::getFloppyImageUsage (const QUuid &aId, 913 QString &aSnapshotUsage) 910 914 { 911 915 CVirtualBox vbox = vboxGlobal().virtualBox(); … … 927 931 usage += machine.GetName(); 928 932 929 QString snapshots; 930 sourceSnapshotsFD (aId, machine.GetSnapshot (QUuid()), snapshots); 931 if (!snapshots.isEmpty()) 932 usage += QString (" (%1)").arg (snapshots); 933 getFloppyImageSnapshotUsage (aId, machine.GetSnapshot (QUuid()), 934 aSnapshotUsage); 933 935 } 934 936 … … 947 949 usage += machine.GetName() + "]"; 948 950 949 QString snapshots; 950 sourceSnapshotsFD (aId, machine.GetSnapshot (QUuid()), snapshots); 951 if (!snapshots.isEmpty()) 952 usage += QString (" (%1)").arg (snapshots); 951 getFloppyImageSnapshotUsage (aId, machine.GetSnapshot (QUuid()), 952 aSnapshotUsage); 953 953 } 954 954 } … … 958 958 959 959 960 void VBoxDiskImageManagerDlg:: sourceSnapshotsCD(const QUuid &aImageId,961 const CSnapshot &aSnapshot,962 QString &aUsage)960 void VBoxDiskImageManagerDlg::getDVDImageSnapshotUsage (const QUuid &aImageId, 961 const CSnapshot &aSnapshot, 962 QString &aUsage) 963 963 { 964 964 if (aSnapshot.isNull()) … … 975 975 CSnapshotEnumerator en = aSnapshot.GetChildren().Enumerate(); 976 976 while (en.HasMore()) 977 sourceSnapshotsCD(aImageId, en.GetNext(), aUsage);978 } 979 980 void VBoxDiskImageManagerDlg:: sourceSnapshotsFD(const QUuid &aImageId,981 const CSnapshot &aSnapshot,982 QString &aUsage)977 getDVDImageSnapshotUsage (aImageId, en.GetNext(), aUsage); 978 } 979 980 void VBoxDiskImageManagerDlg::getFloppyImageSnapshotUsage (const QUuid &aImageId, 981 const CSnapshot &aSnapshot, 982 QString &aUsage) 983 983 { 984 984 if (aSnapshot.isNull()) … … 995 995 CSnapshotEnumerator en = aSnapshot.GetChildren().Enumerate(); 996 996 while (en.HasMore()) 997 sourceSnapshotsFD(aImageId, en.GetNext(), aUsage);997 getFloppyImageSnapshotUsage (aImageId, en.GetNext(), aUsage); 998 998 } 999 999 1000 1000 1001 1001 QString VBoxDiskImageManagerDlg::composeHdToolTip (CHardDisk &aHd, 1002 VBoxMedia::Status aStatus) 1002 VBoxMedia::Status aStatus, 1003 DiskImageItem *aItem) 1003 1004 { 1004 1005 CVirtualBox vbox = vboxGlobal().virtualBox(); 1005 QUuid machineId = aHd.GetMachineId(); 1006 1007 QString src = aHd.GetLocation(); 1008 QFileInfo fi (src); 1009 QString location = aHd.GetStorageType() == CEnums::ISCSIHardDisk ? src : 1010 QDir::convertSeparators (fi.absFilePath()); 1011 1012 QString storageType = vboxGlobal().toString (aHd.GetStorageType()); 1013 QString hardDiskType = vboxGlobal().hardDiskTypeString (aHd); 1006 QUuid machineId = aItem ? aItem->getMachineId() : aHd.GetMachineId(); 1007 1008 QString src = aItem ? aItem->getPath() : aHd.GetLocation(); 1009 QString location = aItem || aHd.GetStorageType() == CEnums::ISCSIHardDisk ? src : 1010 QDir::convertSeparators (QFileInfo (src).absFilePath()); 1011 1012 QString storageType = aItem ? aItem->getStorageType() : 1013 vboxGlobal().toString (aHd.GetStorageType()); 1014 QString hardDiskType = aItem ? aItem->getDiskType() : 1015 vboxGlobal().hardDiskTypeString (aHd); 1014 1016 1015 1017 QString usage; 1016 if (!machineId.isNull()) 1018 if (aItem) 1019 usage = aItem->getUsage(); 1020 else if (!machineId.isNull()) 1017 1021 usage = vbox.GetMachine (machineId).GetName(); 1018 1022 1023 QUuid snapshotId = aItem ? aItem->getUuid() : aHd.GetSnapshotId(); 1019 1024 QString snapshotName; 1020 if (!machineId.isNull() && !aHd.GetSnapshotId().isNull()) 1025 if (aItem) 1026 snapshotName = aItem->getSnapshotName(); 1027 else if (!machineId.isNull() && !snapshotId.isNull()) 1021 1028 { 1022 1029 CSnapshot snapshot = vbox.GetMachine (machineId). … … 1078 1085 1079 1086 QString VBoxDiskImageManagerDlg::composeCdToolTip (CDVDImage &aCd, 1080 VBoxMedia::Status aStatus) 1081 { 1082 QString src = aCd.GetFilePath(); 1083 QFileInfo fi (src); 1084 QString location = QDir::convertSeparators (fi.absFilePath ()); 1085 QUuid uuid = aCd.GetId(); 1086 QString usage = getDVDImageUsage (uuid); 1087 VBoxMedia::Status aStatus, 1088 DiskImageItem *aItem) 1089 { 1090 QString location = aItem ? aItem->getPath() : 1091 QDir::convertSeparators (QFileInfo (aCd.GetFilePath()).absFilePath()); 1092 QUuid uuid = aItem ? aItem->getUuid() : aCd.GetId(); 1093 QString usage; 1094 if (aItem) 1095 usage = aItem->getTotalUsage(); 1096 else 1097 { 1098 QString snapshotUsage; 1099 usage = getDVDImageUsage (uuid, snapshotUsage); 1100 /* should correlate with DiskImageItem::getTotalUsage() */ 1101 if (!snapshotUsage.isNull()) 1102 usage = QString ("%1 (%2)").arg (usage, snapshotUsage); 1103 } 1087 1104 1088 1105 /* compose tool-tip information */ … … 1134 1151 1135 1152 QString VBoxDiskImageManagerDlg::composeFdToolTip (CFloppyImage &aFd, 1136 VBoxMedia::Status aStatus) 1137 { 1138 QString src = aFd.GetFilePath(); 1139 QFileInfo fi (src); 1140 QString location = QDir::convertSeparators (fi.absFilePath ()); 1141 QUuid uuid = aFd.GetId(); 1142 QString usage = getFloppyImageUsage (uuid); 1143 1144 /* compose tool-tip information */ 1153 VBoxMedia::Status aStatus, 1154 DiskImageItem *aItem) 1155 { 1156 QString location = aItem ? aItem->getPath() : 1157 QDir::convertSeparators (QFileInfo (aFd.GetFilePath()).absFilePath()); 1158 QUuid uuid = aItem ? aItem->getUuid() : aFd.GetId(); 1159 QString usage; 1160 if (aItem) 1161 usage = aItem->getTotalUsage(); 1162 else 1163 { 1164 QString snapshotUsage; 1165 usage = getFloppyImageUsage (uuid, snapshotUsage); 1166 /* should correlate with DiskImageItem::getTotalUsage() */ 1167 if (!snapshotUsage.isNull()) 1168 usage = QString ("%1 (%2)").arg (usage, snapshotUsage); 1169 } 1170 1145 1171 /* compose tool-tip information */ 1146 1172 QString tip; … … 1194 1220 const VBoxMedia &aMedia) 1195 1221 { 1196 if (!aItem) return; 1222 if (!aItem) 1223 return; 1224 1197 1225 CHardDisk hd = aMedia.disk; 1198 1226 VBoxMedia::Status status = aMedia.status; … … 1224 1252 aItem->setText (2, actualSize); 1225 1253 aItem->setPath (hd.GetStorageType() == CEnums::ISCSIHardDisk ? src : 1226 QDir::convertSeparators (fi.absFilePath()));1254 QDir::convertSeparators (fi.absFilePath())); 1227 1255 aItem->setUsage (usage); 1228 1256 aItem->setSnapshotName (snapshotName); … … 1233 1261 aItem->setUuid (uuid); 1234 1262 aItem->setMachineId (machineId); 1235 aItem->setToolTip (composeHdToolTip (hd, status ));1263 aItem->setToolTip (composeHdToolTip (hd, status, aItem)); 1236 1264 aItem->setStatus (status); 1237 1265 … … 1242 1270 const VBoxMedia &aMedia) 1243 1271 { 1244 if (!aItem) return; 1272 if (!aItem) 1273 return; 1274 1245 1275 CDVDImage cd = aMedia.disk; 1246 1276 VBoxMedia::Status status = aMedia.status; … … 1248 1278 QUuid uuid = cd.GetId(); 1249 1279 QString src = cd.GetFilePath(); 1250 QString usage = getDVDImageUsage (uuid); 1280 QString snapshotUsage; 1281 QString usage = getDVDImageUsage (uuid, snapshotUsage); 1251 1282 QString size = status == VBoxMedia::Ok ? 1252 1283 vboxGlobal().formatSize (cd.GetSize()) : QString ("--"); … … 1257 1288 aItem->setPath (QDir::convertSeparators (fi.absFilePath ())); 1258 1289 aItem->setUsage (usage); 1290 aItem->setSnapshotUsage (snapshotUsage); 1259 1291 aItem->setActualSize (size); 1260 1292 aItem->setUuid (uuid); 1261 aItem->setToolTip (composeCdToolTip (cd, status ));1293 aItem->setToolTip (composeCdToolTip (cd, status, aItem)); 1262 1294 aItem->setStatus (status); 1263 1295 … … 1268 1300 const VBoxMedia &aMedia) 1269 1301 { 1270 if (!aItem) return; 1302 if (!aItem) 1303 return; 1304 1271 1305 CFloppyImage fd = aMedia.disk; 1272 1306 VBoxMedia::Status status = aMedia.status; … … 1274 1308 QUuid uuid = fd.GetId(); 1275 1309 QString src = fd.GetFilePath(); 1276 QString usage = getFloppyImageUsage (uuid); 1310 QString snapshotUsage; 1311 QString usage = getFloppyImageUsage (uuid, snapshotUsage); 1277 1312 QString size = status == VBoxMedia::Ok ? 1278 1313 vboxGlobal().formatSize (fd.GetSize()) : QString ("--"); … … 1283 1318 aItem->setPath (QDir::convertSeparators (fi.absFilePath ())); 1284 1319 aItem->setUsage (usage); 1320 aItem->setSnapshotUsage (snapshotUsage); 1285 1321 aItem->setActualSize (size); 1286 1322 aItem->setUuid (uuid); 1287 aItem->setToolTip (composeFdToolTip (fd, status ));1323 aItem->setToolTip (composeFdToolTip (fd, status, aItem)); 1288 1324 aItem->setStatus (status); 1289 1325 … … 1718 1754 else if (parentList == cdsView) 1719 1755 { 1720 QString usage = getDVDImageUsage (itemId);1721 1756 /* check if there is temporary usage: */ 1722 1757 QStringList tempMachines = … … 1737 1772 else if (parentList == fdsView) 1738 1773 { 1739 QString usage = getFloppyImageUsage(itemId);1740 1774 /* check if there is temporary usage: */ 1741 1775 QStringList tempMachines = … … 1810 1844 !item->firstChild() && !item->getPath().isNull(); 1811 1845 bool releaseEnabled = item && !item->getUsage().isNull() && 1812 item->getUsage().find (QRegExp ("\\([\\s\\S]+\\)")) == -1&&1813 checkImage (item) &&1814 !item->parent() && !item->firstChild() &&1815 item->getSnapshotName().isNull();1846 item->getSnapshotUsage().isNull() && 1847 checkImage (item) && 1848 !item->parent() && !item->firstChild() && 1849 item->getSnapshotName().isNull(); 1816 1850 bool newEnabled = notInEnum && 1817 1851 getCurrentListView() == hdsView ? true : false; … … 1851 1885 { 1852 1886 cdsPane1->setText (item->getInformation (item->getPath(), true, "end")); 1853 cdsPane2->setText (item->getInformation (item->get Usage()));1887 cdsPane2->setText (item->getInformation (item->getTotalUsage())); 1854 1888 } 1855 1889 else if (item->listView() == fdsView) 1856 1890 { 1857 1891 fdsPane1->setText (item->getInformation (item->getPath(), true, "end")); 1858 fdsPane2->setText (item->getInformation (item->get Usage()));1892 fdsPane2->setText (item->getInformation (item->getTotalUsage())); 1859 1893 } 1860 1894 } … … 2041 2075 else if (currentList == cdsView) 2042 2076 { 2043 QString usage = getDVDImageUsage (itemId); 2044 /* only permamently mounted .iso could be released */ 2077 QString usage = item->getTotalUsage(); 2045 2078 if (vboxProblem().confirmReleaseImage (this, usage)) 2046 2079 { … … 2059 2092 else if (currentList == fdsView) 2060 2093 { 2061 QString usage = getFloppyImageUsage (itemId); 2062 /* only permamently mounted .img could be released */ 2094 QString usage = item->getTotalUsage(); 2063 2095 if (vboxProblem().confirmReleaseImage (this, usage)) 2064 2096 {
Note:
See TracChangeset
for help on using the changeset viewer.