Changeset 23585 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 6, 2009 3:56:51 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxMedium.h
r23223 r23585 186 186 VBoxMedium &root() const; 187 187 188 QString toolTip (bool aNoDiffs = false, bool aCheckRO = false ) const;188 QString toolTip (bool aNoDiffs = false, bool aCheckRO = false, bool aNullAllowed = false) const; 189 189 QPixmap icon (bool aNoDiffs = false, bool aCheckRO = false) const; 190 190 191 191 /** Shortcut to <tt>#toolTip (aNoDiffs, true)</tt>. */ 192 QString toolTipCheckRO (bool aNoDiffs = false ) const { return toolTip (aNoDiffs, true); }192 QString toolTipCheckRO (bool aNoDiffs = false, bool aNullAllowed = false) const { return toolTip (aNoDiffs, true, aNullAllowed); } 193 193 194 194 /** Shortcut to <tt>#icon (aNoDiffs, true)</tt>. */ -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
r23223 r23585 250 250 const CMedium &aHD, 251 251 const CProgress &aProgress); 252 void cannotAttachHardDisk (QWidget *aParent, const CMachine &aMachine, 253 const QString &aLocation, KStorageBus aBus, 254 LONG aChannel, LONG aDevice); 255 void cannotDetachHardDisk (QWidget *aParent, const CMachine &aMachine, 256 const QString &aLocation, KStorageBus aBus, 257 LONG aChannel, LONG aDevice); 258 259 void cannotMountMedium (QWidget *aParent, const CMachine &aMachine, 260 const VBoxMedium &aMedium, const COMResult &aResult); 261 void cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine, 262 const VBoxMedium &aMedium, const COMResult &aResult); 252 void cannotAttachDevice (QWidget *aParent, const CMachine &aMachine, 253 VBoxDefs::MediumType aType, const QString &aLocation, 254 KStorageBus aBus, LONG aChannel, LONG aDevice); 255 void cannotDetachDevice (QWidget *aParent, const CMachine &aMachine, 256 VBoxDefs::MediumType aType, const QString &aLocation, 257 KStorageBus aBus, LONG aChannel, LONG aDevice); 258 259 void cannotMountMedium (QWidget *aParent, const CMachine &aMachine, const VBoxMedium &aMedium); 260 void cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine, const VBoxMedium &aMedium); 263 261 void cannotOpenMedium (QWidget *aParent, const CVirtualBox &aVBox, 264 262 VBoxDefs::MediumType aType, const QString &aLocation); … … 358 356 const QString &errorMsg) const; 359 357 360 static QString toAccusative (VBoxDefs::MediumType aType); 358 static QString mediumToAccusative (VBoxDefs::MediumType aType, bool aIsHostDrive = false); 359 static QString deviceToAccusative (VBoxDefs::MediumType aType); 361 360 362 361 static QString formatRC (HRESULT aRC); -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMFirstRunWzd.h
r23223 r23585 6 6 7 7 /* 8 * Copyright (C) 200 6-2008Sun Microsystems, Inc.8 * Copyright (C) 2008-2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 #define __VBoxVMFirstRunWzd_h__ 25 25 26 /* Local includes */ 26 27 #include "QIAbstractWizard.h" 27 28 #include "VBoxVMFirstRunWzd.gen.h" 28 29 #include "COMDefs.h" 29 #include "QIWidgetValidator.h"30 30 #include "QIWithRetranslateUI.h" 31 31 32 class VBoxVMFirstRunWzd : public QIWithRetranslateUI<QIAbstractWizard>, 32 /* Local forwardes */ 33 class QIWidgetValidator; 34 35 class VBoxVMFirstRunWzd : public QIWithRetranslateUI <QIAbstractWizard>, 33 36 public Ui::VBoxVMFirstRunWzd 34 37 { … … 46 49 47 50 void accept(); 48 void revalidate (QIWidgetValidator *a Wval);51 void revalidate (QIWidgetValidator *aValidator); 49 52 void mediaTypeChanged(); 50 void mediaSourceChanged();51 53 void openMediaManager(); 52 void enableNext (const QIWidgetValidator *a Wval);54 void enableNext (const QIWidgetValidator *aValidator); 53 55 void onPageShow(); 54 56 55 57 private: 56 58 57 QIWidgetValidator *mWvalType; 58 CMachine mMachine; 59 QVector <CMedium> mHostDVDs; 60 QVector <CMedium> mHostFloppys; 59 QIWidgetValidator *mValidator; 60 CMachine mMachine; 61 61 }; 62 62 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp
r23238 r23585 295 295 296 296 mMedia.append (Medium (aMedium.id(), aMedium.location(), 297 aMedium.toolTipCheckRO (!mShowDiffs )));297 aMedium.toolTipCheckRO (!mShowDiffs, mShowNullItem && mType != VBoxDefs::MediumType_HardDisk))); 298 298 299 299 insertItem (count(), aMedium.iconCheckRO (!mShowDiffs), … … 307 307 mMedia [aIndex].id = aMedium.id(); 308 308 mMedia [aIndex].location = aMedium.location(); 309 mMedia [aIndex].toolTip = aMedium.toolTipCheckRO (!mShowDiffs );309 mMedia [aIndex].toolTip = aMedium.toolTipCheckRO (!mShowDiffs, mShowNullItem && mType != VBoxDefs::MediumType_HardDisk); 310 310 311 311 setItemText (aIndex, aMedium.details (!mShowDiffs)); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r23282 r23585 1271 1271 CStorageController ctl = machine.GetStorageControllerByName(hda.GetController()); 1272 1272 1273 vboxProblem().cannotDetach HardDisk (1274 this, machine, aMedium.location(), ctl.GetBus(),1275 hda.GetPort(), hda.GetDevice());1273 vboxProblem().cannotDetachDevice (this, machine, 1274 VBoxDefs::MediumType_HardDisk, aMedium.location(), 1275 ctl.GetBus(), hda.GetPort(), hda.GetDevice()); 1276 1276 success = false; 1277 1277 break; … … 1286 1286 if (!machine.isOk()) 1287 1287 { 1288 vboxProblem().cannotUnmountMedium (this, machine, aMedium, 1289 COMResult (machine)); 1288 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1290 1289 success = false; 1291 1290 } … … 1297 1296 if (!machine.isOk()) 1298 1297 { 1299 vboxProblem().cannotUnmountMedium (this, machine, aMedium, 1300 COMResult (machine)); 1298 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1301 1299 success = false; 1302 1300 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMedium.cpp
r23238 r23585 79 79 mIsHostDrive = mMedium.isNull() ? false : mMedium.GetHostDrive(); 80 80 81 mName = mMedium.isNull() ? VBoxGlobal::tr (" Not Set", "medium") :81 mName = mMedium.isNull() ? VBoxGlobal::tr ("Empty", "medium") : 82 82 !mIsHostDrive ? mMedium.GetName() : 83 83 VBoxGlobal::tr ("Host Drive '%1'", "medium").arg (QDir::toNativeSeparators (mMedium.GetLocation())); … … 195 195 196 196 /* Compose the tooltip */ 197 if (mMedium.isNull()) 198 { 199 mToolTip = VBoxGlobal::tr ("<nobr><b>No Medium Available</b></nobr><br>" 200 "Use the Virtual Media Manager to add medium of the corresponding type."); 201 } 202 else 197 if (!mMedium.isNull()) 203 198 { 204 199 mToolTip = QString ("<nobr><b>%1</b></nobr>").arg (mIsHostDrive ? mName : mLocation); … … 274 269 * accordingly. 275 270 */ 276 QString VBoxMedium::toolTip (bool aNoDiffs /*= false*/, bool aCheckRO /*= false*/) const 277 { 278 unconst (this)->checkNoDiffs (aNoDiffs); 279 280 QString tip = aNoDiffs ? mNoDiffs.toolTip : mToolTip; 281 282 if (aCheckRO && mIsReadOnly) 283 tip += VBoxGlobal::tr ( 284 "<hr><img src=%1/> Attaching this hard disk will " 285 "be performed indirectly using a newly created " 286 "differencing hard disk.", "medium").arg (":/new_16px.png"); 271 QString VBoxMedium::toolTip (bool aNoDiffs /*= false*/, bool aCheckRO /*= false*/, bool aNullAllowed /*= false*/) const 272 { 273 QString tip; 274 275 if (mMedium.isNull()) 276 { 277 tip = aNullAllowed ? VBoxGlobal::tr ("<nobr><b>Not Set</b></nobr><br>" 278 "Required virtual image or host-drive could be mounted at runtime.") : 279 VBoxGlobal::tr ("<nobr><b>Not Available</b></nobr><br>" 280 "Use the Virtual Media Manager to add image of the corresponding type."); 281 } 282 else 283 { 284 unconst (this)->checkNoDiffs (aNoDiffs); 285 286 tip = aNoDiffs ? mNoDiffs.toolTip : mToolTip; 287 288 if (aCheckRO && mIsReadOnly) 289 tip += VBoxGlobal::tr ("<hr><img src=%1/> Attaching this hard disk will " 290 "be performed indirectly using a newly created " 291 "differencing hard disk.", "medium").arg (":/new_16px.png"); 292 } 287 293 288 294 return tip; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxNewVMWzd.cpp
r23249 r23585 352 352 } 353 353 354 /* Create default storage controllers */ 355 QString ideCtrName ("IDE Controller"); 356 QString floppyCtrName ("Floppy Controller"); 357 KStorageBus ideBus = KStorageBus_IDE; 358 KStorageBus floppyBus = KStorageBus_Floppy; 359 mMachine.AddStorageController (ideCtrName, ideBus); 360 mMachine.AddStorageController (floppyCtrName, floppyBus); 361 354 362 /* Register the VM prior to attaching hard disks */ 355 363 vbox.RegisterMachine (mMachine); … … 360 368 } 361 369 362 /* Boot hard disk (IDE Primary Master) */ 363 if (mGbHDA->isChecked()) 370 /* Attach default devices */ 364 371 { 365 372 bool success = false; … … 369 376 { 370 377 CMachine m = session.GetMachine(); 371 m.AttachDevice ("IDE Controller", 0, 0, KDeviceType_HardDisk, mHDCombo->id()); 378 379 /* Boot hard disk (IDE Primary Master) */ 380 if (mGbHDA->isChecked()) 381 { 382 m.AttachDevice (ideCtrName, 0, 0, KDeviceType_HardDisk, mHDCombo->id()); 383 if (!m.isOk()) 384 vboxProblem().cannotAttachDevice (this, m, VBoxDefs::MediumType_HardDisk, mHDCombo->location(), ideBus, 0, 0); 385 } 386 387 /* Attach empty CD/DVD ROM Device */ 388 m.AttachDevice (ideCtrName, 1, 0, KDeviceType_DVD, QString()); 389 if (!m.isOk()) 390 vboxProblem().cannotAttachDevice (this, m, VBoxDefs::MediumType_DVD, QString(), ideBus, 1, 0); 391 392 /* Attach empty Floppy Device */ 393 m.AttachDevice (floppyCtrName, 0, 0, KDeviceType_Floppy, QString()); 394 if (!m.isOk()) 395 vboxProblem().cannotAttachDevice (this, m, VBoxDefs::MediumType_Floppy, QString(), floppyBus, 0, 0); 396 372 397 if (m.isOk()) 373 398 { … … 378 403 vboxProblem().cannotSaveMachineSettings (m, this); 379 404 } 380 else 381 vboxProblem().cannotAttachHardDisk (this, m, 382 mHDCombo->location(), 383 KStorageBus_IDE, 0, 0); 405 384 406 session.Close(); 385 407 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r23438 r23585 993 993 "<p>This will detach it from the " 994 994 "following virtual machine(s): <b>%3</b>.</p>") 995 .arg ( toAccusative (aMedium.type()))995 .arg (mediumToAccusative (aMedium.type())) 996 996 .arg (aMedium.location()) 997 997 .arg (aUsage), … … 1008 1008 tr ("<p>Are you sure you want to remove the %1 " 1009 1009 "<nobr><b>%2</b></nobr> from the list of known media?</p>") 1010 .arg ( toAccusative (aMedium.type()))1010 .arg (mediumToAccusative (aMedium.type())) 1011 1011 .arg (aMedium.location()); 1012 1012 … … 1153 1153 } 1154 1154 1155 void VBoxProblemReporter::cannotAttachHardDisk ( 1156 QWidget *aParent, const CMachine &aMachine, const QString &aLocation, 1157 KStorageBus aBus, LONG aChannel, LONG aDevice) 1158 { 1155 void VBoxProblemReporter::cannotAttachDevice (QWidget *aParent, const CMachine &aMachine, 1156 VBoxDefs::MediumType aType, const QString &aLocation, 1157 KStorageBus aBus, LONG aChannel, LONG aDevice) 1158 { 1159 QString what (deviceToAccusative (aType)); 1160 if (!aLocation.isNull()) 1161 what += QString (" (<nobr><b>%1</b></nobr>)").arg (aLocation); 1162 1159 1163 message (aParent, Error, 1160 tr ("Failed to attach the hard disk <nobr><b>%1</b></nobr> " 1161 "to the slot <i>%2</i> of the machine <b>%3</b>.") 1162 .arg (aLocation) 1163 .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice))) 1164 .arg (CMachine (aMachine).GetName()), 1165 formatErrorInfo (aMachine)); 1166 } 1167 1168 void VBoxProblemReporter::cannotDetachHardDisk ( 1169 QWidget *aParent, const CMachine &aMachine, const QString &aLocation, 1170 KStorageBus aBus, LONG aChannel, LONG aDevice) 1171 { 1164 tr ("Failed to attach the %1 to the slot <i>%2</i> of the machine <b>%3</b>.") 1165 .arg (what) 1166 .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice))) 1167 .arg (CMachine (aMachine).GetName()), 1168 formatErrorInfo (aMachine)); 1169 } 1170 1171 void VBoxProblemReporter::cannotDetachDevice (QWidget *aParent, const CMachine &aMachine, 1172 VBoxDefs::MediumType aType, const QString &aLocation, 1173 KStorageBus aBus, LONG aChannel, LONG aDevice) 1174 { 1175 QString what (deviceToAccusative (aType)); 1176 if (!aLocation.isNull()) 1177 what += QString (" (<nobr><b>%1</b></nobr>)").arg (aLocation); 1178 1172 1179 message (aParent, Error, 1173 tr ("Failed to detach the hard disk <nobr><b>%1</b></nobr> " 1174 "from the slot <i>%2</i> of the machine <b>%3</b>.") 1175 .arg (aLocation) 1176 .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice))) 1177 .arg (CMachine (aMachine).GetName()), 1178 formatErrorInfo (aMachine)); 1179 } 1180 1181 void VBoxProblemReporter:: 1182 cannotMountMedium (QWidget *aParent, const CMachine &aMachine, 1183 const VBoxMedium &aMedium, const COMResult &aResult) 1180 tr ("Failed to detach the $1 from the slot <i>%2</i> of the machine <b>%3</b>.") 1181 .arg (what) 1182 .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice))) 1183 .arg (CMachine (aMachine).GetName()), 1184 formatErrorInfo (aMachine)); 1185 } 1186 1187 void VBoxProblemReporter::cannotMountMedium (QWidget *aParent, const CMachine &aMachine, 1188 const VBoxMedium &aMedium) 1184 1189 { 1185 1190 /** @todo (translation-related): the gender of "the" in translations 1186 1191 * will depend on the gender of aMedium.type(). */ 1187 1192 message (aParent, Error, 1188 tr ("Failed to mount the %1 <nobr><b>%2</b></nobr> " 1189 "to the machine <b>%3</b>.") 1190 .arg (toAccusative (aMedium.type())) 1191 .arg (aMedium.location()) 1192 .arg (CMachine (aMachine).GetName()), 1193 formatErrorInfo (aResult)); 1194 } 1195 1196 void VBoxProblemReporter:: 1197 cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine, 1198 const VBoxMedium &aMedium, const COMResult &aResult) 1193 tr ("Failed to mount the %1 <nobr><b>%2</b></nobr> " 1194 "to the machine <b>%3</b>.") 1195 .arg (mediumToAccusative (aMedium.type(), aMedium.isHostDrive())) 1196 .arg (aMedium.isHostDrive() ? aMedium.name() : aMedium.location()) 1197 .arg (CMachine (aMachine).GetName()), 1198 formatErrorInfo (aMachine)); 1199 } 1200 1201 void VBoxProblemReporter::cannotUnmountMedium (QWidget *aParent, const CMachine &aMachine, 1202 const VBoxMedium &aMedium) 1199 1203 { 1200 1204 /** @todo (translation-related): the gender of "the" in translations 1201 1205 * will depend on the gender of aMedium.type(). */ 1202 1206 message (aParent, Error, 1203 tr ("Failed to unmount the %1 <nobr><b>%2</b></nobr> "1204 "from the machine <b>%3</b>.")1205 .arg (toAccusative (aMedium.type()))1206 .arg (aMedium.location())1207 .arg (CMachine (aMachine).GetName()),1208 formatErrorInfo (aResult));1207 tr ("Failed to unmount the %1 <nobr><b>%2</b></nobr> " 1208 "from the machine <b>%3</b>.") 1209 .arg (mediumToAccusative (aMedium.type(), aMedium.isHostDrive())) 1210 .arg (aMedium.isHostDrive() ? aMedium.name() : aMedium.location()) 1211 .arg (CMachine (aMachine).GetName()), 1212 formatErrorInfo (aMachine)); 1209 1213 } 1210 1214 … … 1217 1221 message (aParent, Error, 1218 1222 tr ("Failed to open the %1 <nobr><b>%2</b></nobr>.") 1219 .arg ( toAccusative (aType))1223 .arg (mediumToAccusative (aType)) 1220 1224 .arg (aLocation), 1221 1225 formatErrorInfo (aVBox)); … … 1229 1233 message (aParent, Error, 1230 1234 tr ("Failed to close the %1 <nobr><b>%2</b></nobr>.") 1231 .arg ( toAccusative (aMedium.type()))1235 .arg (mediumToAccusative (aMedium.type())) 1232 1236 .arg (aMedium.location()), 1233 1237 formatErrorInfo (aResult)); … … 2187 2191 2188 2192 /* static */ 2189 QString VBoxProblemReporter:: toAccusative (VBoxDefs::MediumType aType)2193 QString VBoxProblemReporter::mediumToAccusative (VBoxDefs::MediumType aType, bool aIsHostDrive /* = false */) 2190 2194 { 2191 2195 QString type = 2192 2196 aType == VBoxDefs::MediumType_HardDisk ? 2193 tr ("hard disk", "failed to close ...") : 2197 tr ("hard disk", "failed to mount ...") : 2198 aType == VBoxDefs::MediumType_DVD && aIsHostDrive ? 2199 tr ("CD/DVD", "failed to mount ... host-drive") : 2200 aType == VBoxDefs::MediumType_DVD && !aIsHostDrive ? 2201 tr ("CD/DVD image", "failed to mount ...") : 2202 aType == VBoxDefs::MediumType_Floppy && aIsHostDrive ? 2203 tr ("floppy", "failed to mount ... host-drive") : 2204 aType == VBoxDefs::MediumType_Floppy && !aIsHostDrive ? 2205 tr ("floppy image", "failed to mount ...") : 2206 QString::null; 2207 2208 Assert (!type.isNull()); 2209 return type; 2210 } 2211 2212 /* static */ 2213 QString VBoxProblemReporter::deviceToAccusative (VBoxDefs::MediumType aType) 2214 { 2215 QString type = 2216 aType == VBoxDefs::MediumType_HardDisk ? 2217 tr ("hard disk", "failed to attach ...") : 2194 2218 aType == VBoxDefs::MediumType_DVD ? 2195 tr ("CD/DVD image", "failed to close...") :2219 tr ("CD/DVD device", "failed to attach ...") : 2196 2220 aType == VBoxDefs::MediumType_Floppy ? 2197 tr ("floppy image", "failed to close ...") :2221 tr ("floppy device", "failed to close ...") : 2198 2222 QString::null; 2199 2223 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r23285 r23585 917 917 { 918 918 CStorageController ctl = machine.GetStorageControllerByName(ctlName); 919 vboxProblem().cannotDetach HardDisk (this, machine,919 vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk, 920 920 vboxGlobal().getMedium (CMedium (hda.GetMedium())).location(), 921 921 ctl.GetBus(), hda.GetPort(), hda.GetDevice()); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp
r23249 r23585 6 6 7 7 /* 8 * Copyright (C) 200 6-2009 Sun Microsystems, Inc.8 * Copyright (C) 2008-2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 */ 22 22 23 /* Local includes */ 23 24 #include "VBoxVMFirstRunWzd.h" 24 25 #include "VBoxGlobal.h" 26 #include "VBoxProblemReporter.h" 25 27 #include "VBoxMediaManagerDlg.h" 28 #include "QIWidgetValidator.h" 26 29 27 30 VBoxVMFirstRunWzd::VBoxVMFirstRunWzd (const CMachine &aMachine, QWidget *aParent) 28 : QIWithRetranslateUI<QIAbstractWizard> (aParent) 31 : QIWithRetranslateUI <QIAbstractWizard> (aParent) 32 , mValidator (0) 29 33 , mMachine (aMachine) 30 34 { … … 36 40 37 41 /* Hide unnecessary text labels */ 38 CMediumAttachmentVector vec = mMachine.GetMediumAttachments(); 39 if (vec.size() != 0) 40 { 41 mTextWelcome2->setHidden (true); 42 mTextType2->setHidden (true); 43 mTextSource2->setHidden (true); 44 mTextSummaryHdr2->setHidden (true); 45 mTextSummaryFtr2->setHidden (true); 46 } 47 else 48 { 49 mTextWelcome1->setHidden (true); 50 mTextType1->setHidden (true); 51 mTextSource1->setHidden (true); 52 mTextSummaryHdr1->setHidden (true); 53 mTextSummaryFtr1->setHidden (true); 54 } 42 CMediumAttachment hda = mMachine.GetMediumAttachment ("IDE Controller", 0, 0); 43 mTextWelcome1->setHidden (hda.isNull()); 44 mTextType1->setHidden (hda.isNull()); 45 mTextSource1->setHidden (hda.isNull()); 46 mTextSummaryHdr1->setHidden (hda.isNull()); 47 mTextSummaryFtr1->setHidden (hda.isNull()); 48 mTextWelcome2->setHidden (!hda.isNull()); 49 mTextType2->setHidden (!hda.isNull()); 50 mTextSource2->setHidden (!hda.isNull()); 51 mTextSummaryHdr2->setHidden (!hda.isNull()); 52 mTextSummaryFtr2->setHidden (!hda.isNull()); 55 53 56 54 /* Media page */ 57 mCbImage->setMachineId (mMachine.GetId()); 58 mTbVmm->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png", 59 ":/select_file_dis_16px.png")); 60 mWvalType = new QIWidgetValidator (mPageMedia, this); 61 connect (mWvalType, SIGNAL (validityChanged (const QIWidgetValidator *)), 55 mCbMedia->setMachineId (mMachine.GetId()); 56 mTbVmm->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png", ":/select_file_dis_16px.png")); 57 mValidator = new QIWidgetValidator (mPageMedia, this); 58 connect (mValidator, SIGNAL (validityChanged (const QIWidgetValidator *)), 62 59 this, SLOT (enableNext (const QIWidgetValidator *))); 63 connect (m WvalType, SIGNAL (isValidRequested (QIWidgetValidator *)),60 connect (mValidator, SIGNAL (isValidRequested (QIWidgetValidator *)), 64 61 this, SLOT (revalidate (QIWidgetValidator *))); 65 62 connect (mRbCdType, SIGNAL (clicked()), this, SLOT (mediaTypeChanged())); 66 63 connect (mRbFdType, SIGNAL (clicked()), this, SLOT (mediaTypeChanged())); 67 connect (mRbHost, SIGNAL (clicked()), this, SLOT (mediaSourceChanged()));68 connect (mRbImage, SIGNAL (clicked()), this, SLOT (mediaSourceChanged()));69 64 connect (mTbVmm, SIGNAL (clicked()), this, SLOT (openMediaManager())); 70 65 mRbCdType->animateClick(); 71 mRbHost->animateClick();72 66 73 /* Summary page */ 74 /* Update the next button state for pages with validation 75 * (validityChanged() connected to enableNext() will do the job) */ 76 mWvalType->revalidate(); 67 /* Revalidate updated page */ 68 mValidator->revalidate(); 77 69 78 70 /* Initialize wizard ftr */ … … 91 83 if (page == mPageSummary) 92 84 { 93 /* compose summary */ 94 QString type = 95 mRbCdType->isChecked() ? tr ("CD/DVD-ROM Device") : 96 mRbFdType->isChecked() ? tr ("Floppy Device") : 97 QString::null; 98 QString source = 99 mRbHost->isChecked() ? tr ("Host Drive %1").arg (mCbHost->currentText()) : 100 mRbImage->isChecked() ? mCbImage->currentText() : QString::null; 101 QString summary = QString ( 102 "<table>" 103 "<tr><td>%1: </td><td>%2</td></tr>" 104 "<tr><td>%3: </td><td>%4</td></tr>" 105 "</table>" 106 ) 107 .arg (tr ("Type", "summary"), type) 108 .arg (tr ("Source", "summary"), source); 109 85 /* Compose Summary */ 86 QString type = mRbCdType->isChecked() ? tr ("CD/DVD-ROM Device") : tr ("Floppy Device"); 87 QString source = mCbMedia->currentText(); 88 QString summary = QString ("<table>" 89 "<tr><td>%1: </td><td>%2</td></tr>" 90 "<tr><td>%3: </td><td>%4</td></tr>" 91 "</table>") 92 .arg (tr ("Type", "summary"), type) 93 .arg (tr ("Source", "summary"), source); 110 94 mTeSummary->setText (summary); 111 95 } … … 114 98 void VBoxVMFirstRunWzd::accept() 115 99 { 116 /* CD/DVD Media selected */ 117 if (mRbCdType->isChecked()) 118 { 119 if (mRbHost->isChecked()) 120 { 121 CMedium hostDrive = mHostDVDs [mCbHost->currentIndex()]; 122 if (!hostDrive.isNull()) 123 mMachine.MountMedium ("IDE Controller", 1, 0, hostDrive.GetId()); 124 } 125 else if (mRbImage->isChecked()) 126 mMachine.MountMedium ("IDE Controller", 1, 0, mCbImage->id()); 127 } 128 /* Floppy Media selected */ 129 else if (mRbFdType->isChecked()) 130 { 131 if (mRbHost->isChecked()) 132 { 133 CMedium hostDrive = mHostFloppys [mCbHost->currentIndex()]; 134 if (!hostDrive.isNull()) 135 mMachine.MountMedium ("IDE Controller", 1, 0, hostDrive.GetId()); 136 } 137 else if (mRbImage->isChecked()) 138 mMachine.MountMedium ("IDE Controller", 1, 0, mCbImage->id()); 139 } 140 141 QIAbstractWizard::accept(); 100 /* Composing default controller name */ 101 QString ctrName (mRbCdType->isChecked() ? "IDE Controller" : "Floppy Controller"); 102 LONG ctrPort = mRbCdType->isChecked() ? 1 : 0; 103 LONG ctrDevice = 0; 104 /* Default should present */ 105 CStorageController ctr = mMachine.GetStorageControllerByName (ctrName); 106 Assert (!ctr.isNull()); 107 /* Mount medium to the predefined port/device */ 108 mMachine.MountMedium (ctrName, ctrPort, ctrDevice, mCbMedia->id()); 109 if (mMachine.isOk()) 110 QIAbstractWizard::accept(); 111 else 112 vboxProblem().cannotMountMedium (this, mMachine, vboxGlobal().findMedium (mCbMedia->id())); 142 113 } 143 114 144 void VBoxVMFirstRunWzd::revalidate (QIWidgetValidator *a Wval)115 void VBoxVMFirstRunWzd::revalidate (QIWidgetValidator *aValidator) 145 116 { 146 /* do individual validations for pages */147 QWidget *pg = a Wval->widget();148 bool valid = a Wval->isOtherValid();117 /* Do individual validations for pages */ 118 QWidget *pg = aValidator->widget(); 119 bool valid = aValidator->isOtherValid(); 149 120 121 /* Allow to go to Summary only if non-null medium selected */ 150 122 if (pg == mPageMedia) 151 { 152 valid = (mRbHost->isChecked() && !mCbHost->currentText().isEmpty()) || 153 (mRbImage->isChecked() && !mCbImage->currentText().isEmpty()); 154 } 123 valid = !vboxGlobal().findMedium (mCbMedia->id()).isNull(); 155 124 156 a Wval->setOtherValid (valid);125 aValidator->setOtherValid (valid); 157 126 } 158 127 159 128 void VBoxVMFirstRunWzd::mediaTypeChanged() 160 129 { 161 /* CD/DVD Media type selected */ 162 mCbHost->clear(); 130 /* CD/DVD media type selected */ 163 131 if (sender() == mRbCdType) 164 132 { 165 /* Search for the host dvd-drives */ 166 CMediumVector coll = 167 vboxGlobal().virtualBox().GetHost().GetDVDDrives(); 168 mHostDVDs.resize (coll.size()); 169 170 for (int id = 0; id < coll.size(); ++id) 171 { 172 CMedium hostDVD = coll[id]; 173 QString name = hostDVD.GetName(); 174 QString description = hostDVD.GetDescription(); 175 QString fullName = description.isEmpty() ? 176 name : QString ("%1 (%2)").arg (description, name); 177 mCbHost->insertItem (id, fullName); 178 mHostDVDs [id] = hostDVD; 179 } 180 181 /* Switch media images type to DVD */ 182 mCbImage->setType (VBoxDefs::MediumType_DVD); 133 /* Switch media combo-box type to CD/DVD */ 134 mCbMedia->setType (VBoxDefs::MediumType_DVD); 183 135 } 184 136 /* Floppy media type selected */ 185 137 else if (sender() == mRbFdType) 186 138 { 187 /* Search for the host floppy-drives */ 188 CMediumVector coll = 189 vboxGlobal().virtualBox().GetHost().GetFloppyDrives(); 190 mHostFloppys.resize (coll.size()); 191 192 for (int id = 0; id < coll.size(); ++id) 193 { 194 CMedium hostFloppy = coll[id]; 195 QString name = hostFloppy.GetName(); 196 QString description = hostFloppy.GetDescription(); 197 QString fullName = description.isEmpty() ? 198 name : QString ("%1 (%2)").arg (description, name); 199 mCbHost->insertItem (id, fullName); 200 mHostFloppys [id] = hostFloppy; 201 } 202 203 /* Switch media images type to FD */ 204 mCbImage->setType (VBoxDefs::MediumType_Floppy); 139 /* Switch media combo-box type to Floppy */ 140 mCbMedia->setType (VBoxDefs::MediumType_Floppy); 205 141 } 206 142 207 /* Repopulate the media list*/208 mCb Image->repopulate();143 /* Update the media combo-box */ 144 mCbMedia->repopulate(); 209 145 210 146 /* Revalidate updated page */ 211 mWvalType->revalidate(); 212 } 213 214 void VBoxVMFirstRunWzd::mediaSourceChanged() 215 { 216 mCbHost->setEnabled (sender() == mRbHost); 217 mCbImage->setEnabled (sender() == mRbImage); 218 mTbVmm->setEnabled (sender() == mRbImage); 219 220 /* Revalidate updated page */ 221 mWvalType->revalidate(); 147 mValidator->revalidate(); 222 148 } 223 149 224 150 void VBoxVMFirstRunWzd::openMediaManager() 225 151 { 226 VBoxDefs::MediumType type = 227 mRbCdType->isChecked() ? VBoxDefs::MediumType_DVD : 228 mRbFdType->isChecked() ? VBoxDefs::MediumType_Floppy : 229 VBoxDefs::MediumType_Invalid; 152 /* Create & open VMM */ 153 VBoxMediaManagerDlg dlg (this); 154 dlg.setup (mCbMedia->type(), true /* aDoSelect */); 155 if (dlg.exec() == QDialog::Accepted) 156 mCbMedia->setCurrentItem (dlg.selectedId()); 230 157 231 AssertReturnVoid (type != VBoxDefs::MediumType_Invalid); 232 233 VBoxMediaManagerDlg dlg (this); 234 dlg.setup (type, true /* aDoSelect */); 235 if (dlg.exec() == QDialog::Accepted) 236 { 237 mCbImage->setCurrentItem (dlg.selectedId()); 238 239 /* Revalidate updated page */ 240 mWvalType->revalidate(); 241 } 158 /* Revalidate updated page */ 159 mValidator->revalidate(); 242 160 } 243 161 244 void VBoxVMFirstRunWzd::enableNext (const QIWidgetValidator *a Wval)162 void VBoxVMFirstRunWzd::enableNext (const QIWidgetValidator *aValidator) 245 163 { 246 nextButton (a Wval->widget())->setEnabled (aWval->isValid());164 nextButton (aValidator->widget())->setEnabled (aValidator->isValid()); 247 165 } 248 166 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp
r23581 r23585 778 778 /* Cache medium information */ 779 779 mAttName = medium.name (!mAttIsShowDiffs); 780 mAttTip = medium.toolTipCheckRO (!mAttIsShowDiffs );780 mAttTip = medium.toolTipCheckRO (!mAttIsShowDiffs, mAttDeviceType != KDeviceType_HardDisk); 781 781 mAttPixmap = medium.iconCheckRO (!mAttIsShowDiffs); 782 782 mAttIsHostDrive = medium.isHostDrive(); -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMFirstRunWzd.ui
r23333 r23585 3 3 VBox frontends: Qt4 GUI ("VirtualBox"): 4 4 5 Copyright (C) 2008 Sun Microsystems, Inc.5 Copyright (C) 2008-2009 Sun Microsystems, Inc. 6 6 7 7 This file is part of VirtualBox Open Source Edition (OSE), as … … 439 439 <string>Media Source</string> 440 440 </property> 441 <layout class="Q VBoxLayout" >441 <layout class="QHBoxLayout" > 442 442 <property name="topMargin" > 443 443 <number>4</number> 444 444 </property> 445 445 <item> 446 <layout class="QHBoxLayout" > 447 <item> 448 <widget class="QRadioButton" name="mRbHost" > 449 <property name="text" > 450 <string>&Host Drive</string> 451 </property> 452 </widget> 453 </item> 454 <item> 455 <widget class="QComboBox" name="mCbHost" > 456 <property name="sizeAdjustPolicy" > 457 <enum>QComboBox::AdjustToContentsOnFirstShow</enum> 458 </property> 459 </widget> 460 </item> 461 <item> 462 <spacer> 463 <property name="orientation" > 464 <enum>Qt::Horizontal</enum> 465 </property> 466 <property name="sizeHint" > 467 <size> 468 <width>40</width> 469 <height>5</height> 470 </size> 471 </property> 472 </spacer> 473 </item> 474 </layout> 446 <widget class="VBoxMediaComboBox" name="mCbMedia" /> 475 447 </item> 476 448 <item> 477 <widget class="Q RadioButton" name="mRbImage" >478 <property name=" text" >479 < string>&Image File</string>449 <widget class="QToolButton" name="mTbVmm" > 450 <property name="icon" > 451 <iconset resource="../VirtualBox1.qrc" >:/select_file_16px.png</iconset> 480 452 </property> 481 453 </widget> 482 </item>483 <item>484 <layout class="QHBoxLayout" >485 <item>486 <widget class="VBoxMediaComboBox" name="mCbImage" />487 </item>488 <item>489 <widget class="QToolButton" name="mTbVmm" >490 <property name="icon" >491 <iconset resource="../VirtualBox1.qrc" >:/select_file_16px.png</iconset>492 </property>493 </widget>494 </item>495 </layout>496 454 </item> 497 455 </layout> … … 721 679 </property> 722 680 <property name="text" > 723 <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> 724 p, li { white-space: pre-wrap; } 725 </style></head><body style=" font-family:'Arial'; font-size:9pt; font-weight:400; font-style:normal;"> 726 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If the above is correct, press the <span style=" font-weight:600;">Finish</span> button. Once you press it, the selected media will be temporarily mounted on the virtual machine and the machine will start execution.</p> 727 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.</p> 728 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Depending on the type of the setup program, you may need to manually unmount (eject) the media after the setup program reboots the virtual machine, to prevent the installation process from starting again. You can do this by selecting the corresponding <span style=" font-weight:600;">Unmount...</span> action in the <span style=" font-weight:600;">Devices</span> menu<span style=" font-weight:600;">.</span></p></body></html></string> 681 <string><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be temporarily mounted on the virtual machine and the machine will start execution.</p><p>Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.</p><p>Depending on the type of the setup program, you may need to manually unmount (eject) the media after the setup program reboots the virtual machine, to prevent the installation process from starting again. You can do this by selecting the corresponding <b>Unmount...</b> action in the <b>Devices</b> menu.</p></string> 729 682 </property> 730 683 <property name="alignment" >
Note:
See TracChangeset
for help on using the changeset viewer.