Changeset 2801 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 23, 2007 12:53:00 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r2529 r2801 52 52 VirtualBox_SDKS.linux = LIBSDL 53 53 54 ifeq ($(BUILD_TARGET),darwin) 54 ifeq ($(BUILD_TARGET),darwin) 55 55 # For the launch trick we need different inode numbers. 56 56 VirtualBox_INST = $(INST_BIN)VirtualBox $(INST_BIN)VirtualBoxVM … … 83 83 84 84 # Sources containing local definitions of classes that use the Q_OBJECT macro 85 VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp 85 VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp \ 86 src/VBoxConsoleWnd.cpp 86 87 ifneq ($(BUILD_TARGET),win) 87 88 VirtualBox_QT_MOCSRCS += src/COMDefs.cpp -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r2764 r2801 283 283 QColor erase_color; 284 284 285 bool mIsFirstTimeStarted : 1; 286 285 287 #ifdef VBOX_WITH_DEBUGGER_GUI 286 288 // Debugger GUI -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r2764 r2801 33 33 #include "VBoxSharedFoldersSettings.h" 34 34 #include "VBoxUtils.h" 35 #include "VBoxMediaComboBox.h" 35 36 #include "QIStateIndicator.h" 36 37 #include "QIStatusBar.h" … … 49 50 #include <qdir.h> 50 51 #include <qpushbutton.h> 52 #include <qtoolbutton.h> 51 53 52 54 #include <qeventloop.h> … … 188 190 189 191 QString mTip; 192 }; 193 194 /** 195 * Bootable CD/DVD ISO Selection Dialog class. 196 * Allows user to select temporarily mounted image or host drive 197 * to load the system from. 198 */ 199 class BootDVDDialog : public QDialog 200 { 201 Q_OBJECT 202 203 public: 204 205 BootDVDDialog (QWidget *aParent, CMachine &aMachine) 206 : QDialog (aParent, "BootDVDDialog", true /* modal */) 207 , mMachine (aMachine) 208 , mGrpBox (0) 209 , mRbHost (0), mRbImage (0) 210 , mCbHost (0), mCbImage (0) 211 , mTbVDM (0), mPbOk (0) 212 { 213 /* Setup Dialog's title */ 214 setCaption (tr ("Select Boot Source")); 215 setIcon (QPixmap::fromMimeSource ("select_file_16px.png")); 216 217 /* Setup main group-box */ 218 mGrpBox = new QButtonGroup (this, "mGrpBox"); 219 mGrpBox->setCheckable (true); 220 mGrpBox->setChecked (false); 221 mGrpBox->setColumnLayout (0, Qt::Vertical); 222 mGrpBox->setTitle (tr ("&Mount CD/DVD Drive")); 223 mGrpBox->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed); 224 connect (mGrpBox, SIGNAL (toggled (bool)), this, SLOT (grpBoxToggled (bool))); 225 226 /* Setup group box widgets */ 227 mRbHost = new QRadioButton (tr ("Host CD/DVD &Drive"), mGrpBox, "mRbHost"); 228 connect (mRbHost, SIGNAL (clicked()), this, SLOT (rbClicked())); 229 mCbHost = new QComboBox (mGrpBox, "mCbHost"); 230 CHostDVDDriveCollection coll = vboxGlobal().virtualBox().GetHost().GetDVDDrives(); 231 mHostDVDs.resize (coll.GetCount()); 232 int id = 0; 233 CHostDVDDriveEnumerator en = coll.Enumerate(); 234 while (en.HasMore()) 235 { 236 CHostDVDDrive hostDVD = en.GetNext(); 237 mCbHost->insertItem (hostDVD.GetName(), id); 238 mHostDVDs [id] = hostDVD; 239 ++ id; 240 } 241 242 mRbImage = new QRadioButton (tr ("&ISO Image File"), mGrpBox, "mRbImage"); 243 connect (mRbImage, SIGNAL (clicked()), this, SLOT (rbClicked())); 244 mCbImage = new VBoxMediaComboBox (mGrpBox, "sel", VBoxDefs::CD); 245 if (!vboxGlobal().isMediaEnumerationStarted()) 246 vboxGlobal().startEnumeratingMedia(); 247 else 248 mCbImage->refresh(); 249 mTbVDM = new QToolButton (mGrpBox, "mTbVDM"); 250 mTbVDM->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png", 251 "select_file_dis_16px.png")); 252 mTbVDM->setFocusPolicy (QWidget::TabFocus); 253 connect (mTbVDM, SIGNAL (clicked()), this, SLOT (vdmOpen())); 254 255 /* Setup group box layout */ 256 QGridLayout *grbLayout = new QGridLayout (mGrpBox->layout(), 2, 3, 10, "grbLayout"); 257 grbLayout->addWidget (mRbHost, 0, 0); 258 grbLayout->addWidget (mCbHost, 0, 1); 259 grbLayout->addWidget (mRbImage, 1, 0); 260 grbLayout->addWidget (mCbImage, 1, 1); 261 grbLayout->addWidget (mTbVDM, 1, 2); 262 263 /* Setup dialog buttons */ 264 mPbOk = new QPushButton (tr ("OK"), this, "mPbOk"); 265 QSpacerItem *spacer = new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); 266 QPushButton *pbCancel = new QPushButton (tr ("Cancel"), this, "pbCancel"); 267 connect (mPbOk, SIGNAL (clicked()), this, SLOT (accept())); 268 connect (pbCancel, SIGNAL (clicked()), this, SLOT (reject())); 269 270 /* Setup main layout */ 271 QVBoxLayout *mainLayout = new QVBoxLayout (this, 10, 10, "mainLayout"); 272 mainLayout->addWidget (mGrpBox); 273 QSpacerItem *btSpacer = 274 new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 275 mainLayout->addItem (btSpacer); 276 277 /* Setup buttons layout */ 278 QHBoxLayout *buttonLayout = new QHBoxLayout (mainLayout, 10, "buttonLayout"); 279 buttonLayout->addWidget (mPbOk); 280 buttonLayout->addItem (spacer); 281 buttonLayout->addWidget (pbCancel); 282 } 283 284 private slots: 285 286 void grpBoxToggled (bool aOn) 287 { 288 if (aOn) 289 mRbHost->animateClick(); 290 else 291 { 292 mRbHost->setChecked (false); 293 mRbImage->setChecked (false); 294 validate(); 295 } 296 } 297 298 void rbClicked() 299 { 300 mCbHost->setEnabled (sender() == mRbHost); 301 mCbImage->setEnabled (sender() == mRbImage); 302 mTbVDM->setEnabled (sender() == mRbImage); 303 validate(); 304 } 305 306 void vdmOpen() 307 { 308 VBoxDiskImageManagerDlg vdm (this, "VBoxDiskImageManagerDlg", 309 WType_Dialog | WShowModal); 310 QUuid machineId = mMachine.GetId(); 311 vdm.setup (VBoxDefs::CD, true, &machineId); 312 if (vdm.exec() == VBoxDiskImageManagerDlg::Accepted) 313 mCbImage->setCurrentItem (vdm.getSelectedUuid()); 314 } 315 316 void accept() 317 { 318 if (mGrpBox->isChecked() && mRbHost->isChecked()) 319 { 320 CHostDVDDrive hostDrive = mHostDVDs [mCbHost->currentItem()]; 321 if (!hostDrive.isNull()) 322 { 323 CDVDDrive virtualDrive = mMachine.GetDVDDrive(); 324 virtualDrive.CaptureHostDrive (hostDrive); 325 } 326 } 327 else if (mGrpBox->isChecked() && mRbImage->isChecked()) 328 { 329 CDVDDrive virtualDrive = mMachine.GetDVDDrive(); 330 virtualDrive.MountImage (mCbImage->getId()); 331 } 332 333 QDialog::accept(); 334 } 335 336 private: 337 338 void validate() 339 { 340 bool valid = 341 !mGrpBox->isChecked() || 342 (mGrpBox->isChecked() && mRbHost->isChecked() 343 && !mCbHost->currentText().isEmpty()) || 344 (mGrpBox->isChecked() && mRbImage->isChecked() 345 && !mCbImage->currentText().isEmpty()); 346 mPbOk->setEnabled (valid); 347 } 348 349 CMachine mMachine; 350 QButtonGroup *mGrpBox; 351 QRadioButton *mRbHost, *mRbImage; 352 QComboBox *mCbHost; 353 VBoxMediaComboBox *mCbImage; 354 QToolButton *mTbVDM; 355 QPushButton *mPbOk; 356 QValueVector <CHostDVDDrive> mHostDVDs; 190 357 }; 191 358 … … 225 392 , was_max (false) 226 393 , console_style (0) 394 , mIsFirstTimeStarted (true) 227 395 #ifdef VBOX_WITH_DEBUGGER_GUI 228 396 , dbg_gui (NULL) … … 675 843 static const char *GUI_Fullscreen = "GUI/Fullscreen"; 676 844 static const char *GUI_AutoresizeGuest = "GUI/AutoresizeGuest"; 845 static const char *GUI_FirstRun = "GUI/FirstRun"; 677 846 678 847 /** … … 726 895 if (str != "off") 727 896 vmAutoresizeGuestAction->setOn (true); 897 898 str = cmachine.GetExtraData (GUI_FirstRun); 899 if (str == "no") 900 mIsFirstTimeStarted = false; 728 901 729 902 str = cmachine.GetExtraData (GUI_LastWindowPosition); … … 892 1065 CConsole cconsole = console->console(); 893 1066 1067 if (mIsFirstTimeStarted) 1068 { 1069 BootDVDDialog dlg (this, cmachine); 1070 dlg.exec(); 1071 } 1072 894 1073 /* start the VM */ 895 1074 CProgress progress = cconsole.PowerUp(); … … 993 1172 machine.SetExtraData (GUI_AutoresizeGuest, 994 1173 vmAutoresizeGuestAction->isOn() ? "on" : "off"); 1174 machine.SetExtraData (GUI_FirstRun, "no"); 995 1175 } 996 1176 … … 2717 2897 } 2718 2898 2899 #include "VBoxConsoleWnd.moc"
Note:
See TracChangeset
for help on using the changeset viewer.