Changeset 45316 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 3, 2013 5:40:32 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45315 r45316 1191 1191 } 1192 1192 1193 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /* = 0 */) 1194 { 1195 message( 1196 pParent ? pParent : mainWindowShown(), 1197 MessageType_Error, 1198 tr("Failed to create a new virtual machine."), 1199 formatErrorInfo(vbox) 1200 ); 1201 } 1202 1203 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, 1204 const CMachine &machine, 1205 QWidget *pParent /* = 0 */) 1206 { 1207 message( 1208 pParent ? pParent : mainWindowShown(), 1209 MessageType_Error, 1210 tr("Failed to create a new virtual machine <b>%1</b>.") 1211 .arg(machine.GetName()), 1212 formatErrorInfo(vbox) 1213 ); 1214 } 1215 1216 void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox, 1217 const CMachine &machine, 1218 QWidget *pParent) 1219 { 1220 message(pParent ? pParent : mainWindowShown(), 1221 MessageType_Error, 1193 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /*= 0*/) 1194 { 1195 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1196 tr("Failed to create a new virtual machine."), 1197 formatErrorInfo(vbox)); 1198 } 1199 1200 void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent /*= 0*/) 1201 { 1202 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1222 1203 tr("Failed to register the virtual machine <b>%1</b>.") 1223 .arg(machine.GetName()),1204 .arg(strMachineName), 1224 1205 formatErrorInfo(vbox)); 1225 1206 } 1226 1207 1227 void UIMessageCenter::cannotCreateClone(const CMachine &machine, 1228 QWidget *pParent /* = 0 */) 1229 { 1230 message(1231 pParent ? pParent : mainWindowShown(),1232 1233 tr("Failed to clone the virtual machine <b>%1</b>.")1234 .arg(machine.GetName()),1235 formatErrorInfo(machine)1236 ); 1237 } 1238 1239 void UIMessageCenter::cannotCreateClone(const CMachine &machine, 1240 const CProgress &progress,1241 QWidget *pParent /* = 0 */)1242 { 1243 AssertWrapperOk(progress);1244 1245 message(pParent ? pParent : mainWindowShown(), 1246 MessageType_Error, 1247 tr("Failed to clone the virtual machine <b>%1</b>.") 1248 .arg(machine.GetName()),1249 formatErrorInfo(progress.GetErrorInfo())1250 );1251 } 1252 1253 void UIMessageCenter::cannotOverwriteHardDiskStorage(QWidget *pParent, 1254 const QString &strLocation) 1255 { 1256 message(pParent, MessageType_Info, 1257 tr("<p>The hard disk storage unit at location <b>%1</b> already " 1258 "exists. You cannot create a new virtual hard disk that uses this "1259 "location because it can be already used by another virtual hard "1260 "disk.</p>"1261 "<p>Please specify a different location.</p>")1262 .arg(strLocation)); 1263 } 1264 1265 void UIMessageCenter::cannotCreateHardDiskStorage(QWidget *pParent, 1266 const CVirtualBox &vbox,1267 const QString &strLocation,1268 const CMedium &medium,1269 const CProgress &progress)1270 { 1271 message(pParent, MessageType_Error, 1272 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")1273 .arg(strLocation), 1274 !vbox.isOk() ? formatErrorInfo(vbox) :1275 !medium.isOk() ? formatErrorInfo(medium) :1276 !progress.isOk() ? formatErrorInfo(progress) :1277 formatErrorInfo(progress.GetErrorInfo()));1208 void UIMessageCenter::cannotCreateClone(const CMachine &machine, QWidget *pParent /*= 0*/) 1209 { 1210 /* Preserve error-info: */ 1211 QString strErrorInfo = formatErrorInfo(machine); 1212 /* Show the message: */ 1213 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1214 tr("Failed to clone the virtual machine <b>%1</b>.") 1215 .arg(machine.GetName()), 1216 strErrorInfo); 1217 } 1218 1219 void UIMessageCenter::cannotCreateClone(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0 */) 1220 { 1221 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1222 tr("Failed to clone the virtual machine <b>%1</b>.") 1223 .arg(strMachineName), 1224 !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo())); 1225 } 1226 1227 void UIMessageCenter::cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent /*= 0*/) 1228 { 1229 message(pParent ? pParent : mainWindowShown(), MessageType_Info, 1230 tr("<p>The hard disk storage unit at location <b>%1</b> already exists. " 1231 "You cannot create a new virtual hard disk that uses this location " 1232 "because it can be already used by another virtual hard disk.</p>" 1233 "<p>Please specify a different location.</p>") 1234 .arg(strLocation)); 1235 } 1236 1237 void UIMessageCenter::cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation, QWidget *pParent /*= 0*/) 1238 { 1239 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1240 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1241 .arg(strLocation), 1242 formatErrorInfo(vbox)); 1243 } 1244 1245 void UIMessageCenter::cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /*= 0*/) 1246 { 1247 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1248 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1249 .arg(strLocation), 1250 formatErrorInfo(medium)); 1251 } 1252 1253 void UIMessageCenter::cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /*= 0*/) 1254 { 1255 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1256 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1257 .arg(strLocation), 1258 !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo())); 1278 1259 } 1279 1260 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45315 r45316 269 269 /* API: Wizards warnings: */ 270 270 void cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent = 0); 271 void cannotCreateMachine(const CVirtualBox &vbox, const CMachine &machine, QWidget *pParent = 0); 272 void cannotRegisterMachine(const CVirtualBox &vbox, const CMachine &machine, QWidget *pParent); 271 void cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent = 0); 273 272 void cannotCreateClone(const CMachine &machine, QWidget *pParent = 0); 274 void cannotCreateClone(const CMachine &machine, const CProgress &progress, QWidget *pParent = 0); 275 void cannotOverwriteHardDiskStorage(QWidget *pParent, const QString &strLocation); 276 void cannotCreateHardDiskStorage(QWidget *pParent, const CVirtualBox &vbox, const QString &strLocation, 277 const CMedium &medium, const CProgress &progress); 273 void cannotCreateClone(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0); 274 void cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0); 275 void cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation,QWidget *pParent = 0); 276 void cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0); 277 void cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent = 0); 278 278 void warnAboutCannotRemoveMachineFolder(QWidget *pParent, const QString &strFolderName); 279 279 void warnAboutCannotRewriteMachineFolder(QWidget *pParent, const QString &strFolderName); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp
r45193 r45316 62 62 CVirtualBox vbox = vboxGlobal().virtualBox(); 63 63 64 /* Create new virtual -disk: */64 /* Create new virtual hard-disk: */ 65 65 CMedium virtualDisk = vbox.CreateHardDisk(mediumFormat.GetName(), strMediumPath); 66 CProgress progress;67 66 if (!vbox.isOk()) 68 67 { 69 msgCenter().cannotCreateHardDiskStorage( this, vbox, strMediumPath, virtualDisk, progress);68 msgCenter().cannotCreateHardDiskStorage(vbox, strMediumPath, this); 70 69 return false; 71 70 } 72 71 73 QVector<KMediumVariant> l_variants(sizeof(uVariant)*8);74 75 for (int i = 0; i < l_variants.size(); ++i)72 /* Compose medium-variant: */ 73 QVector<KMediumVariant> variants(sizeof(qulonglong)*8); 74 for (int i = 0; i < variants.size(); ++i) 76 75 { 77 76 qulonglong temp = uVariant; 78 77 temp &= 1<<i; 79 l_variants[i] = (KMediumVariant)temp;78 variants[i] = (KMediumVariant)temp; 80 79 } 81 80 82 81 /* Copy existing virtual-disk to the new virtual-disk: */ 83 progress = sourceVirtualDisk.CloneTo(virtualDisk, l_variants, CMedium());84 if (! virtualDisk.isOk())82 CProgress progress = sourceVirtualDisk.CloneTo(virtualDisk, variants, CMedium()); 83 if (!sourceVirtualDisk.isOk()) 85 84 { 86 msgCenter().cannotCreateHardDiskStorage( this, vbox, strMediumPath, virtualDisk, progress);85 msgCenter().cannotCreateHardDiskStorage(sourceVirtualDisk, strMediumPath, this); 87 86 return false; 88 87 } … … 94 93 if (!progress.isOk() || progress.GetResultCode() != 0) 95 94 { 96 msgCenter().cannotCreateHardDiskStorage( this, vbox, strMediumPath, virtualDisk, progress);95 msgCenter().cannotCreateHardDiskStorage(progress, strMediumPath, this); 97 96 return false; 98 97 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp
r45233 r45316 234 234 fResult = !QFileInfo(strMediumPath).exists(); 235 235 if (!fResult) 236 msgCenter().cannotOverwriteHardDiskStorage( this, strMediumPath);236 msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 237 237 238 238 if (fResult) -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp
r45233 r45316 263 263 fResult = !QFileInfo(strMediumPath).exists(); 264 264 if (!fResult) 265 msgCenter().cannotOverwriteHardDiskStorage( this, strMediumPath);265 msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 266 266 267 267 /* Try to copy virtual-disk: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp
r45193 r45316 142 142 if (!progress.isOk() || progress.GetResultCode() != 0) 143 143 { 144 msgCenter().cannotCreateClone( srcMachine, progress, this);144 msgCenter().cannotCreateClone(progress, srcMachine.GetName(), this); 145 145 return false; 146 146 } … … 150 150 if (!vbox.isOk()) 151 151 { 152 msgCenter().cannotRegisterMachine(vbox, cloneMachine , this);152 msgCenter().cannotRegisterMachine(vbox, cloneMachine.GetName(), this); 153 153 return false; 154 154 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp
r45193 r45316 62 62 AssertReturn(uSize > 0, false); 63 63 64 /* Get vbox object: */64 /* Get VBox object: */ 65 65 CVirtualBox vbox = vboxGlobal().virtualBox(); 66 66 67 /* Create new virtual disk: */67 /* Create new virtual hard-disk: */ 68 68 CMedium virtualDisk = vbox.CreateHardDisk(mediumFormat.GetName(), strMediumPath); 69 CProgress progress;70 69 if (!vbox.isOk()) 71 70 { 72 msgCenter().cannotCreateHardDiskStorage( this, vbox, strMediumPath, virtualDisk, progress);71 msgCenter().cannotCreateHardDiskStorage(vbox, strMediumPath, this); 73 72 return false; 74 73 } 75 74 76 QVector<KMediumVariant> l_variants(sizeof(qulonglong)*8);77 78 for (int i = 0; i < l_variants.size(); ++i)75 /* Compose medium-variant: */ 76 QVector<KMediumVariant> variants(sizeof(qulonglong)*8); 77 for (int i = 0; i < variants.size(); ++i) 79 78 { 80 79 qulonglong temp = uVariant; 81 80 temp &= 1<<i; 82 l_variants[i] = (KMediumVariant)temp;81 variants[i] = (KMediumVariant)temp; 83 82 } 84 83 85 /* Create base storage for the new hard disk: */ 86 progress = virtualDisk.CreateBaseStorage(uSize, l_variants); 87 84 /* Create base storage for the new virtual-disk: */ 85 CProgress progress = virtualDisk.CreateBaseStorage(uSize, variants); 88 86 if (!virtualDisk.isOk()) 89 87 { 90 msgCenter().cannotCreateHardDiskStorage( this, vbox, strMediumPath, virtualDisk, progress);88 msgCenter().cannotCreateHardDiskStorage(virtualDisk, strMediumPath, this); 91 89 return false; 92 90 } … … 98 96 if (!progress.isOk() || progress.GetResultCode() != 0) 99 97 { 100 msgCenter().cannotCreateHardDiskStorage( this, vbox, strMediumPath, virtualDisk, progress);98 msgCenter().cannotCreateHardDiskStorage(progress, strMediumPath, this); 101 99 return false; 102 100 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp
r45233 r45316 398 398 fResult = !QFileInfo(strMediumPath).exists(); 399 399 if (!fResult) 400 msgCenter().cannotOverwriteHardDiskStorage( this, strMediumPath);400 msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 401 401 402 402 if (fResult) -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
r45233 r45316 277 277 fResult = !QFileInfo(strMediumPath).exists(); 278 278 if (!fResult) 279 msgCenter().cannotOverwriteHardDiskStorage( this, strMediumPath);279 msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this); 280 280 281 281 /* Try to create virtual-disk: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r45068 r45316 190 190 if (!vbox.isOk()) 191 191 { 192 msgCenter().cannot CreateMachine(vbox, m_machine, this);192 msgCenter().cannotRegisterMachine(vbox, m_machine.GetName(), this); 193 193 return false; 194 194 }
Note:
See TracChangeset
for help on using the changeset viewer.