Changeset 45315 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 3, 2013 5:30:17 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45314 r45315 917 917 918 918 void UIMessageCenter::cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, 919 QWidget *pParent /*= 0*/) 919 QWidget *pParent /*= 0*/) const 920 920 { 921 921 message(pParent ? pParent : mainWindowShown(), MessageType_Error, … … 925 925 } 926 926 927 bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, const QString &strUsage, QWidget *pParent /*= 0*/) 927 bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, const QString &strUsage, QWidget *pParent /*= 0*/) const 928 928 { 929 929 /* Prepare the message: */ … … 958 958 } 959 959 960 bool UIMessageCenter::confirmMediumRemoval(const UIMedium &medium, QWidget *pParent /*= 0*/) 960 bool UIMessageCenter::confirmMediumRemoval(const UIMedium &medium, QWidget *pParent /*= 0*/) const 961 961 { 962 962 /* Prepare the message: */ … … 1008 1008 } 1009 1009 1010 int UIMessageCenter::confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent /*= 0*/) 1010 int UIMessageCenter::confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent /*= 0*/) const 1011 1011 { 1012 1012 return message(pParent ? pParent : mainWindowShown(), MessageType_Question, … … 1029 1029 } 1030 1030 1031 void UIMessageCenter::cannotDeleteHardDiskStorage(const CMedium &medium, const CProgress &progress, QWidget *pParent /*= 0*/) 1032 { 1033 /* Preserve error-info: */ 1034 QString strErrorInfo = !medium.isOk() ? formatErrorInfo(medium) : 1035 !progress.isOk() ? formatErrorInfo(progress) : 1036 formatErrorInfo(progress.GetErrorInfo()); 1037 /* Show the message: */ 1031 void UIMessageCenter::cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /*= 0*/) const 1032 { 1038 1033 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1039 1034 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.") 1040 .arg(medium.GetLocation()), 1041 strErrorInfo); 1042 } 1043 1044 void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /*= 0*/) 1035 .arg(strLocation), 1036 formatErrorInfo(medium)); 1037 } 1038 1039 void UIMessageCenter::cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /*= 0*/) const 1040 { 1041 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1042 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.") 1043 .arg(strLocation), 1044 !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo())); 1045 } 1046 1047 void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /*= 0*/) const 1045 1048 { 1046 1049 /* Preserve error-info: */ … … 1075 1078 } 1076 1079 1077 int UIMessageCenter::cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent /*= 0*/) 1080 int UIMessageCenter::cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent /*= 0*/) const 1078 1081 { 1079 1082 /* Preserve error-info: */ … … 1130 1133 } 1131 1134 1132 void UIMessageCenter::cannotOpenMedium(const CVirtualBox &vbox, UIMediumType type, const QString &strLocation, QWidget *pParent /*= 0*/) 1135 void UIMessageCenter::cannotOpenMedium(const CVirtualBox &vbox, UIMediumType type, const QString &strLocation, QWidget *pParent /*= 0*/) const 1133 1136 { 1134 1137 /* Prepare the message: */ … … 1159 1162 } 1160 1163 1161 void UIMessageCenter::cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent /*= 0*/) 1164 void UIMessageCenter::cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent /*= 0*/) const 1162 1165 { 1163 1166 /* Prepare the message: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45314 r45315 256 256 257 257 /* API: Virtual Medium Manager warnings: */ 258 void cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, QWidget *pParent = 0); 259 bool confirmMediumRelease(const UIMedium &medium, const QString &strUsage, QWidget *pParent = 0); 260 bool confirmMediumRemoval(const UIMedium &medium, QWidget *pParent = 0); 261 int confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0); 262 void cannotDeleteHardDiskStorage(const CMedium &medium, const CProgress &progress, QWidget *pParent = 0); 263 void cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0); 264 int cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent = 0); 265 void cannotOpenMedium(const CVirtualBox &vbox, UIMediumType type, const QString &strLocation, QWidget *pParent = 0); 266 void cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent = 0); 258 void cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, QWidget *pParent = 0) const; 259 bool confirmMediumRelease(const UIMedium &medium, const QString &strUsage, QWidget *pParent = 0) const; 260 bool confirmMediumRemoval(const UIMedium &medium, QWidget *pParent = 0) const; 261 int confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0) const; 262 void cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0) const; 263 void cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent = 0) const; 264 void cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0) const; 265 int cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent = 0) const; 266 void cannotOpenMedium(const CVirtualBox &vbox, UIMediumType type, const QString &strLocation, QWidget *pParent = 0) const; 267 void cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent = 0) const; 267 268 268 269 /* API: Wizards warnings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r45296 r45315 1168 1168 if (deleteStorage) 1169 1169 { 1170 /* Remember virtual-disk attributes: */ 1171 QString strLocation = hardDisk.GetLocation(); 1172 /* Prepare delete storage progress: */ 1170 1173 CProgress progress = hardDisk.DeleteStorage(); 1171 1174 if (hardDisk.isOk()) 1172 1175 { 1176 /* Show delete storage progress: */ 1173 1177 msgCenter().showModalProgressDialog(progress, windowTitle(), ":/progress_media_delete_90px.png", this); 1174 if (! (progress.isOk() && progress.GetResultCode() == S_OK))1178 if (!progress.isOk() || progress.GetResultCode() != 0) 1175 1179 { 1176 msgCenter().cannotDeleteHardDiskStorage( hardDisk, progress, this);1180 msgCenter().cannotDeleteHardDiskStorage(progress, strLocation, this); 1177 1181 return; 1178 1182 } 1183 } 1184 else 1185 { 1186 msgCenter().cannotDeleteHardDiskStorage(hardDisk, strLocation, this); 1187 return; 1179 1188 } 1180 1189 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp
r45292 r45315 98 98 void UIWizardNewVMPage3::ensureNewVirtualDiskDeleted() 99 99 { 100 /* Make sure virtual-disk exists: */100 /* Make sure virtual-disk valid: */ 101 101 if (m_virtualDisk.isNull()) 102 102 return; 103 103 104 /* Remember virtual-disk ID: */104 /* Remember virtual-disk attributes: */ 105 105 QString strId = m_virtualDisk.GetId(); 106 107 /* 1st step: start delete-storage progress: */106 QString strLocation = m_virtualDisk.GetLocation(); 107 /* Prepare delete storage progress: */ 108 108 CProgress progress = m_virtualDisk.DeleteStorage(); 109 /* Get initial state: */ 110 bool fSuccess = m_virtualDisk.isOk(); 111 112 /* 2nd step: show delete-storage progress: */ 113 if (fSuccess) 114 { 109 if (m_virtualDisk.isOk()) 110 { 111 /* Show delete storage progress: */ 115 112 msgCenter().showModalProgressDialog(progress, thisImp()->windowTitle(), ":/progress_media_delete_90px.png", thisImp()); 116 fSuccess = progress.isOk() && progress.GetResultCode() == S_OK; 117 } 118 119 /* 3rd step: notify GUI about virtual-disk was deleted or show error if any: */ 120 if (fSuccess) 121 vboxGlobal().removeMedium(UIMediumType_HardDisk, strId); 113 if (!progress.isOk() || progress.GetResultCode() != 0) 114 msgCenter().cannotDeleteHardDiskStorage(progress, strLocation, thisImp()); 115 } 122 116 else 123 msgCenter().cannotDeleteHardDiskStorage(m_virtualDisk, progress, thisImp()); 124 125 /* Detach virtual-disk finally: */ 117 msgCenter().cannotDeleteHardDiskStorage(m_virtualDisk, strLocation, thisImp()); 118 119 /* Remove virtual-disk from GUI anyway: */ 120 vboxGlobal().removeMedium(UIMediumType_HardDisk, strId); 121 122 /* Detach virtual-disk anyway: */ 126 123 m_virtualDisk.detach(); 127 124 }
Note:
See TracChangeset
for help on using the changeset viewer.