Changeset 23953 in vbox
- Timestamp:
- Oct 21, 2009 8:53:51 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaManagerDlg.h
r23223 r23953 6 6 7 7 /* 8 * Copyright (C) 2006-200 8Sun Microsystems, Inc.8 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 #define __VBoxMediaManagerDlg_h__ 25 25 26 /* Local includes */ 26 27 #include "VBoxMediaManagerDlg.gen.h" 28 #include "COMDefs.h" 27 29 #include "QIMainDialog.h" 28 30 #include "QIWithRetranslateUI.h" 29 #include "COMDefs.h"30 31 #include "VBoxDefs.h" 31 32 #include "VBoxMediaComboBox.h" 32 33 34 /* Local forwards */ 33 35 class MediaItem; 36 class VBoxProgressBar; 34 37 class VBoxToolBar; 35 class VBoxProgressBar;36 38 37 39 class VBoxMediaManagerDlg : public QIWithRetranslateUI2<QIMainDialog>, … … 153 155 QMenu *mActionsContextMenu; 154 156 QMenu *mActionsMenu; 155 VBoxToolBar *m ActionsToolBar;157 VBoxToolBar *mToolBar; 156 158 QAction *mNewAction; 157 159 QAction *mAddAction; 158 QAction *mEditAction;159 160 QAction *mRemoveAction; 160 161 QAction *mReleaseAction; … … 168 169 bool mFloppyImagesInaccessible; 169 170 QString mHDSelectedId; 170 QString m DVDSelectedId;171 QString mF loppySelectedId;171 QString mCDSelectedId; 172 QString mFDSelectedId; 172 173 }; 173 174 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r23880 r23953 6 6 7 7 /* 8 * Copyright (C) 2006-200 8Sun Microsystems, Inc.8 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 */ 22 22 23 /* VBox includes */ 24 #include "VBoxGlobal.h" 25 #include "VBoxMediaManagerDlg.h" 26 #include "VBoxNewHDWzd.h" 27 #include "VBoxProblemReporter.h" 28 #include "VBoxToolBar.h" 29 #include "QIFileDialog.h" 30 #include "QILabel.h" 31 32 /* Qt includes */ 23 /* Global includes */ 33 24 #include <QCloseEvent> 34 25 #include <QDir> … … 43 34 #include <QUrl> 44 35 36 /* Local includes */ 37 #include "VBoxGlobal.h" 38 #include "VBoxMediaManagerDlg.h" 39 #include "VBoxNewHDWzd.h" 40 #include "VBoxProblemReporter.h" 41 #include "VBoxToolBar.h" 42 #include "QIFileDialog.h" 43 #include "QILabel.h" 44 45 45 class AddVDMUrlsEvent: public QEvent 46 46 { … … 63 63 public: 64 64 65 MediaItem (MediaItem *aParent, const VBoxMedium &aMedium, 66 const VBoxMediaManagerDlg *aManager) 65 MediaItem (MediaItem *aParent, const VBoxMedium &aMedium, const VBoxMediaManagerDlg *aManager) 67 66 : QTreeWidgetItem (aParent, QITreeWidget::BasicItemType) 68 67 , mMedium (aMedium) … … 70 69 { refresh(); } 71 70 72 73 MediaItem (QTreeWidget *aParent, const VBoxMedium &aMedium, 74 const VBoxMediaManagerDlg *aManager) 71 MediaItem (QTreeWidget *aParent, const VBoxMedium &aMedium, const VBoxMediaManagerDlg *aManager) 75 72 : QTreeWidgetItem (aParent, QITreeWidget::BasicItemType) 76 73 , mMedium (aMedium) … … 78 75 { refresh(); } 79 76 80 const VBoxMedium &medium() const { return mMedium; } 77 void refreshAll() 78 { 79 mMedium.refresh(); 80 refresh(); 81 } 81 82 82 83 void setMedium (const VBoxMedium &aMedium) … … 86 87 } 87 88 88 void refreshAll();89 const VBoxMedium& medium() const { return mMedium; } 89 90 90 91 VBoxDefs::MediumType type() const { return mMedium.type(); } … … 93 94 94 95 QString id() const { return mMedium.id(); } 96 95 97 QString location() const { return mMedium.location (!mManager->showDiffs()); } 96 98 97 QString hardDiskFormat() const 98 { return mMedium.hardDiskFormat (!mManager->showDiffs()); } 99 QString hardDiskType() const 100 { return mMedium.hardDiskType (!mManager->showDiffs()); } 99 QString hardDiskFormat() const { return mMedium.hardDiskFormat (!mManager->showDiffs()); } 100 QString hardDiskType() const { return mMedium.hardDiskType (!mManager->showDiffs()); } 101 101 102 102 QString usage() const { return mMedium.usage (!mManager->showDiffs()); } 103 103 104 QString toolTip() const 105 { 106 return mMedium.toolTip (!mManager->showDiffs(), 107 mManager->inAttachMode()); 108 } 104 QString toolTip() const { return mMedium.toolTip (!mManager->showDiffs(), mManager->inAttachMode()); } 109 105 110 106 bool isUsed() const { return mMedium.isUsed(); } … … 116 112 ULONG64 thisValue = vboxGlobal().parseSize ( text (column)); 117 113 ULONG64 thatValue = vboxGlobal().parseSize (aOther.text (column)); 118 if (thisValue && thatValue) 119 return thisValue < thatValue; 120 else 121 return QTreeWidgetItem::operator< (aOther); 122 } 123 124 // void paintCell (QPainter *aPainter, const QColorGroup &aColorGroup, 125 // int aColumn, int aWidth, int aSlign) 126 // { 127 // QColorGroup cGroup (aColorGroup); 128 // if (mStatus == KMediumState_NotCreated) 129 // cGroup.setColor (QColorGroup::Text, cGroup.mid()); 130 // Q3ListViewItem::paintCell (aPainter, cGroup, aColumn, aWidth, aSlign); 131 // } 132 protected: 133 134 void refresh(); 114 return thisValue && thatValue ? thisValue < thatValue : QTreeWidgetItem::operator< (aOther); 115 } 135 116 136 117 private: 137 118 138 /* Private member vars */ 119 void refresh() 120 { 121 /* Fill in columns */ 122 setIcon (0, mMedium.icon (!mManager->showDiffs(), mManager->inAttachMode())); 123 /* Set the text */ 124 setText (0, mMedium.name (!mManager->showDiffs())); 125 setText (1, mMedium.logicalSize (!mManager->showDiffs())); 126 setText (2, mMedium.size (!mManager->showDiffs())); 127 /* All columns get the same tooltip */ 128 QString tt = mMedium.toolTip (!mManager->showDiffs()); 129 for (int i = 0; i < treeWidget()->columnCount(); ++ i) 130 setToolTip (i, tt); 131 } 132 139 133 VBoxMedium mMedium; 140 134 const VBoxMediaManagerDlg *mManager; 141 135 }; 142 136 143 /**144 * Refreshes the underlying medium (see VBoxMedium::refresh()) and then145 * refreshes this item's columns based on the new values.146 */147 void MediaItem::refreshAll()148 {149 mMedium.refresh();150 refresh();151 }152 153 /**154 * Refreshes the item representation according to the associated medium.155 *156 * Note that the underlying medium itself is not refreshed.157 */158 void MediaItem::refresh()159 {160 /* Fill in columns */161 setIcon (0, mMedium.icon (!mManager->showDiffs(),162 mManager->inAttachMode()));163 /* Set the text */164 setText (0, mMedium.name (!mManager->showDiffs()));165 setText (1, mMedium.logicalSize (!mManager->showDiffs()));166 setText (2, mMedium.size (!mManager->showDiffs()));167 /* All columns get the same tooltip */168 QString tt = mMedium.toolTip (!mManager->showDiffs());169 for (int i = 0; i < treeWidget()->columnCount(); ++i)170 setToolTip (i, tt);171 }172 173 174 /**175 * Iterator for MediaItem.176 */177 137 class MediaItemIterator : public QTreeWidgetItemIterator 178 138 { … … 194 154 } 195 155 }; 196 197 156 198 157 class VBoxProgressBar: public QWidget … … 223 182 private: 224 183 225 /* Private member vars */226 184 QLabel *mText; 227 185 QProgressBar *mProgressBar; … … 231 189 VBoxMediaManagerDlg* VBoxMediaManagerDlg::mModelessDialog = 0; 232 190 233 VBoxMediaManagerDlg::VBoxMediaManagerDlg (QWidget *aParent /* = 0 */, 234 Qt::WindowFlags aFlags /* = Qt::Dialog */) 191 VBoxMediaManagerDlg::VBoxMediaManagerDlg (QWidget *aParent /* = 0 */, Qt::WindowFlags aFlags /* = Qt::Dialog */) 235 192 : QIWithRetranslateUI2 <QIMainDialog> (aParent, aFlags) 236 193 , mType (VBoxDefs::MediumType_Invalid) … … 256 213 mFloppyImageIcon = VBoxGlobal::iconSet (":/fd_16px.png", ":/fd_disabled_16px.png"); 257 214 258 /* Setup tab widget icons */ 259 mTwImages->setTabIcon (HDTab, mHardDiskIcon); 260 mTwImages->setTabIcon (CDTab, mDVDImageIcon); 261 mTwImages->setTabIcon (FDTab, mFloppyImageIcon); 262 263 connect (mTwImages, SIGNAL (currentChanged (int)), 264 this, SLOT (processCurrentChanged (int))); 265 266 /* Setup the tree view widgets */ 267 mHardDiskView->sortItems (0, Qt::AscendingOrder); 268 mHardDiskView->header()->setResizeMode (0, QHeaderView::Fixed); 269 mHardDiskView->header()->setResizeMode (1, QHeaderView::ResizeToContents); 270 mHardDiskView->header()->setResizeMode (2, QHeaderView::ResizeToContents); 271 mHardDiskView->header()->setStretchLastSection (false); 272 mHardDiskView->setSortingEnabled (true); 273 mHardDiskView->setSupportedDropActions (Qt::LinkAction); 274 mHardDiskView->installEventFilter (this); 275 connect (mHardDiskView, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), 215 /* Setup tab-widget icons */ 216 mTabWidget->setTabIcon (HDTab, mHardDiskIcon); 217 mTabWidget->setTabIcon (CDTab, mDVDImageIcon); 218 mTabWidget->setTabIcon (FDTab, mFloppyImageIcon); 219 220 connect (mTabWidget, SIGNAL (currentChanged (int)), this, SLOT (processCurrentChanged (int))); 221 222 /* Setup the tree-widgets */ 223 mTwHD->sortItems (0, Qt::AscendingOrder); 224 mTwHD->header()->setResizeMode (0, QHeaderView::Fixed); 225 mTwHD->header()->setResizeMode (1, QHeaderView::ResizeToContents); 226 mTwHD->header()->setResizeMode (2, QHeaderView::ResizeToContents); 227 mTwHD->header()->setStretchLastSection (false); 228 mTwHD->setSortingEnabled (true); 229 mTwHD->setSupportedDropActions (Qt::LinkAction); 230 mTwHD->installEventFilter (this); 231 connect (mTwHD, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), 276 232 this, SLOT (processCurrentChanged (QTreeWidgetItem *, QTreeWidgetItem *))); 277 connect (m HardDiskView, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)),233 connect (mTwHD, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)), 278 234 this, SLOT (processDoubleClick (QTreeWidgetItem *, int))); 279 connect (m HardDiskView, SIGNAL (customContextMenuRequested (const QPoint &)),235 connect (mTwHD, SIGNAL (customContextMenuRequested (const QPoint &)), 280 236 this, SLOT (showContextMenu (const QPoint &))); 281 connect (m HardDiskView, SIGNAL (resized (const QSize&, const QSize&)),237 connect (mTwHD, SIGNAL (resized (const QSize &, const QSize &)), 282 238 this, SLOT (makeRequestForAdjustTable())); 283 connect (m HardDiskView->header(), SIGNAL (sectionResized (int, int, int)),239 connect (mTwHD->header(), SIGNAL (sectionResized (int, int, int)), 284 240 this, SLOT (makeRequestForAdjustTable())); 285 241 286 m DVDView->sortItems (0, Qt::AscendingOrder);287 m DVDView->header()->setResizeMode (0, QHeaderView::Fixed);288 m DVDView->header()->setResizeMode (1, QHeaderView::ResizeToContents);289 m DVDView->header()->setStretchLastSection (false);290 m DVDView->setSortingEnabled (true);291 m DVDView->setSupportedDropActions (Qt::LinkAction);292 m DVDView->installEventFilter (this);293 connect (m DVDView, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)),242 mTwCD->sortItems (0, Qt::AscendingOrder); 243 mTwCD->header()->setResizeMode (0, QHeaderView::Fixed); 244 mTwCD->header()->setResizeMode (1, QHeaderView::ResizeToContents); 245 mTwCD->header()->setStretchLastSection (false); 246 mTwCD->setSortingEnabled (true); 247 mTwCD->setSupportedDropActions (Qt::LinkAction); 248 mTwCD->installEventFilter (this); 249 connect (mTwCD, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), 294 250 this, SLOT (processCurrentChanged (QTreeWidgetItem *, QTreeWidgetItem *))); 295 connect (m DVDView, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)),251 connect (mTwCD, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)), 296 252 this, SLOT (processDoubleClick (QTreeWidgetItem *, int))); 297 connect (m DVDView, SIGNAL (customContextMenuRequested (const QPoint &)),253 connect (mTwCD, SIGNAL (customContextMenuRequested (const QPoint &)), 298 254 this, SLOT (showContextMenu (const QPoint &))); 299 connect (m DVDView, SIGNAL (resized (const QSize&, const QSize&)),255 connect (mTwCD, SIGNAL (resized (const QSize&, const QSize&)), 300 256 this, SLOT (makeRequestForAdjustTable())); 301 connect (m DVDView->header(), SIGNAL (sectionResized (int, int, int)),257 connect (mTwCD->header(), SIGNAL (sectionResized (int, int, int)), 302 258 this, SLOT (makeRequestForAdjustTable())); 303 259 304 m FloppyView->sortItems (0, Qt::AscendingOrder);305 m FloppyView->header()->setResizeMode (0, QHeaderView::Fixed);306 m FloppyView->header()->setResizeMode (1, QHeaderView::ResizeToContents);307 m FloppyView->header()->setStretchLastSection (false);308 m FloppyView->setSortingEnabled (true);309 m FloppyView->setSupportedDropActions (Qt::LinkAction);310 m FloppyView->installEventFilter (this);311 connect (m FloppyView, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)),260 mTwFD->sortItems (0, Qt::AscendingOrder); 261 mTwFD->header()->setResizeMode (0, QHeaderView::Fixed); 262 mTwFD->header()->setResizeMode (1, QHeaderView::ResizeToContents); 263 mTwFD->header()->setStretchLastSection (false); 264 mTwFD->setSortingEnabled (true); 265 mTwFD->setSupportedDropActions (Qt::LinkAction); 266 mTwFD->installEventFilter (this); 267 connect (mTwFD, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), 312 268 this, SLOT (processCurrentChanged (QTreeWidgetItem *, QTreeWidgetItem *))); 313 connect (m FloppyView, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)),269 connect (mTwFD, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)), 314 270 this, SLOT (processDoubleClick (QTreeWidgetItem *, int))); 315 connect (m FloppyView, SIGNAL (customContextMenuRequested (const QPoint &)),271 connect (mTwFD, SIGNAL (customContextMenuRequested (const QPoint &)), 316 272 this, SLOT (showContextMenu (const QPoint &))); 317 connect (m FloppyView, SIGNAL (resized (const QSize&, const QSize&)),273 connect (mTwFD, SIGNAL (resized (const QSize&, const QSize&)), 318 274 this, SLOT (makeRequestForAdjustTable())); 319 connect (m FloppyView->header(), SIGNAL (sectionResized (int, int, int)),275 connect (mTwFD->header(), SIGNAL (sectionResized (int, int, int)), 320 276 this, SLOT (makeRequestForAdjustTable())); 321 277 … … 325 281 mNewAction = new QAction (this); 326 282 mAddAction = new QAction (this); 327 // mEditAction = new QAction (this);328 283 mRemoveAction = new QAction (this); 329 284 mReleaseAction = new QAction (this); 330 285 mRefreshAction = new QAction (this); 331 286 332 connect (mNewAction, SIGNAL (triggered()), 333 this, SLOT (doNewMedium())); 334 connect (mAddAction, SIGNAL (triggered()), 335 this, SLOT (doAddMedium())); 336 // connect (mEditAction, SIGNAL (triggered()), 337 // this, SLOT (editImage())); 338 connect (mRemoveAction, SIGNAL (triggered()), 339 this, SLOT (doRemoveMedium())); 340 connect (mReleaseAction, SIGNAL (triggered()), 341 this, SLOT (doReleaseMedium())); 342 connect (mRefreshAction, SIGNAL (triggered()), 343 this, SLOT (refreshAll())); 287 connect (mNewAction, SIGNAL (triggered()), this, SLOT (doNewMedium())); 288 connect (mAddAction, SIGNAL (triggered()), this, SLOT (doAddMedium())); 289 connect (mRemoveAction, SIGNAL (triggered()), this, SLOT (doRemoveMedium())); 290 connect (mReleaseAction, SIGNAL (triggered()), this, SLOT (doReleaseMedium())); 291 connect (mRefreshAction, SIGNAL (triggered()), this, SLOT (refreshAll())); 344 292 345 293 mNewAction->setIcon (VBoxGlobal::iconSetFull ( … … 351 299 ":/hd_add_22px.png", ":/hd_add_16px.png", 352 300 ":/hd_add_disabled_22px.png", ":/hd_add_disabled_16px.png")); 353 // mEditAction->setIcon (VBoxGlobal::iconSet (":/guesttools_16px.png", ":/guesttools_disabled_16px.png"));354 301 mRemoveAction->setIcon (VBoxGlobal::iconSetFull ( 355 302 QSize (22, 22), QSize (16, 16), … … 365 312 ":/refresh_disabled_22px.png", ":/refresh_disabled_16px.png")); 366 313 367 // mActionsContextMenu->addAction (mEditAction);368 314 mActionsContextMenu->addAction (mRemoveAction); 369 315 mActionsContextMenu->addAction (mReleaseAction); 370 316 371 317 /* Toolbar composing */ 372 mActionsToolBar = new VBoxToolBar (this); 373 mActionsToolBar->setIconSize (QSize (22, 22)); 374 mActionsToolBar->setToolButtonStyle (Qt::ToolButtonTextUnderIcon); 375 mActionsToolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred); 376 377 /* Really messy what the uic produce here: a vbox layout in an hbox layout */ 378 QHBoxLayout *centralLayout = qobject_cast <QHBoxLayout*> (centralWidget()->layout()); 379 Assert (VALID_PTR (centralLayout)); 380 QVBoxLayout *mainLayout = static_cast <QVBoxLayout*> (centralLayout->itemAt(0)); 381 Assert (VALID_PTR (mainLayout)); 318 mToolBar = new VBoxToolBar (this); 319 mToolBar->setIconSize (QSize (22, 22)); 320 mToolBar->setToolButtonStyle (Qt::ToolButtonTextUnderIcon); 321 mToolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Preferred); 322 323 QVBoxLayout *mainLayout = qobject_cast <QVBoxLayout*> (centralWidget()->layout()); 324 Assert (mainLayout); 382 325 #if MAC_LEOPARD_STYLE 383 326 /* Enable unified toolbars on Mac OS X. Available on Qt >= 4.3 */ 384 addToolBar (m ActionsToolBar);385 m ActionsToolBar->setMacToolbar();327 addToolBar (mToolBar); 328 mToolBar->setMacToolbar(); 386 329 /* No spacing/margin on the mac */ 387 VBoxGlobal::setLayoutMargin ( centralLayout, 0);330 VBoxGlobal::setLayoutMargin (mainLayout, 0); 388 331 mainLayout->insertSpacing (0, 10); 389 VBoxGlobal::setLayoutMargin (mainLayout, 0);390 332 #else /* MAC_LEOPARD_STYLE */ 391 333 /* Add the toolbar */ 392 mainLayout->insertWidget (0, m ActionsToolBar);334 mainLayout->insertWidget (0, mToolBar); 393 335 /* Set spacing/margin like in the selector window */ 394 centralLayout->setSpacing (0);395 VBoxGlobal::setLayoutMargin (centralLayout, 0);396 336 mainLayout->setSpacing (5); 397 337 VBoxGlobal::setLayoutMargin (mainLayout, 5); 398 338 #endif /* MAC_LEOPARD_STYLE */ 399 339 400 mActionsToolBar->addAction (mNewAction); 401 mActionsToolBar->addAction (mAddAction); 402 mActionsToolBar->addSeparator(); 403 // mActionsToolBar->addAction (mEditAction); 404 mActionsToolBar->addAction (mRemoveAction); 405 mActionsToolBar->addAction (mReleaseAction); 406 mActionsToolBar->addSeparator(); 407 mActionsToolBar->addAction (mRefreshAction); 340 mToolBar->addAction (mNewAction); 341 mToolBar->addAction (mAddAction); 342 mToolBar->addSeparator(); 343 mToolBar->addAction (mRemoveAction); 344 mToolBar->addAction (mReleaseAction); 345 mToolBar->addSeparator(); 346 mToolBar->addAction (mRefreshAction); 408 347 409 348 /* Menu bar */ … … 412 351 mActionsMenu->addAction (mAddAction); 413 352 mActionsMenu->addSeparator(); 414 // mActionsMenu->addAction (mEditAction);415 353 mActionsMenu->addAction (mRemoveAction); 416 354 mActionsMenu->addAction (mReleaseAction); … … 434 372 435 373 /* Connects for the button box */ 436 connect (mButtonBox, SIGNAL (accepted()), 437 this, SLOT (accept())); 438 connect (mButtonBox, SIGNAL (rejected()), 439 this, SLOT (reject())); 440 connect (mButtonBox, SIGNAL (helpRequested()), 441 &vboxProblem(), SLOT (showHelpHelpDialog())); 374 connect (mButtonBox, SIGNAL (accepted()), this, SLOT (accept())); 375 connect (mButtonBox, SIGNAL (rejected()), this, SLOT (reject())); 376 connect (mButtonBox, SIGNAL (helpRequested()), &vboxProblem(), SLOT (showHelpHelpDialog())); 442 377 } 443 378 444 379 VBoxMediaManagerDlg::~VBoxMediaManagerDlg() 445 380 { 446 delete m ActionsToolBar;381 delete mToolBar; 447 382 } 448 383 … … 480 415 { 481 416 case VBoxDefs::MediumType_HardDisk: mHDSelectedId = aSelectId; break; 482 case VBoxDefs::MediumType_DVD: m DVDSelectedId = aSelectId; break;483 case VBoxDefs::MediumType_Floppy: mF loppySelectedId = aSelectId; break;417 case VBoxDefs::MediumType_DVD: mCDSelectedId = aSelectId; break; 418 case VBoxDefs::MediumType_Floppy: mFDSelectedId = aSelectId; break; 484 419 case VBoxDefs::MediumType_All: break; 485 420 default: … … 487 422 } 488 423 489 mT wImages->setTabEnabled (HDTab,490 aType == VBoxDefs::MediumType_All ||491 aType == VBoxDefs::MediumType_HardDisk);492 mT wImages->setTabEnabled (CDTab,493 aType == VBoxDefs::MediumType_All ||494 aType == VBoxDefs::MediumType_DVD);495 mT wImages->setTabEnabled (FDTab,496 aType == VBoxDefs::MediumType_All ||497 aType == VBoxDefs::MediumType_Floppy);424 mTabWidget->setTabEnabled (HDTab, 425 aType == VBoxDefs::MediumType_All || 426 aType == VBoxDefs::MediumType_HardDisk); 427 mTabWidget->setTabEnabled (CDTab, 428 aType == VBoxDefs::MediumType_All || 429 aType == VBoxDefs::MediumType_DVD); 430 mTabWidget->setTabEnabled (FDTab, 431 aType == VBoxDefs::MediumType_All || 432 aType == VBoxDefs::MediumType_Floppy); 498 433 499 434 mDoSelect = aDoSelect; … … 543 478 544 479 /* For a newly opened dialog, select the first item */ 545 if (m HardDiskView->selectedItems().isEmpty())546 if (QTreeWidgetItem *item = m HardDiskView->topLevelItem (0))547 setCurrentItem (m HardDiskView, item);548 if (m DVDView->selectedItems().isEmpty())549 if (QTreeWidgetItem *item = m DVDView->topLevelItem (0))550 setCurrentItem (m DVDView, item);551 if (m FloppyView->selectedItems().isEmpty())552 if (QTreeWidgetItem *item = m FloppyView->topLevelItem (0))553 setCurrentItem (m FloppyView, item);480 if (mTwHD->selectedItems().isEmpty()) 481 if (QTreeWidgetItem *item = mTwHD->topLevelItem (0)) 482 setCurrentItem (mTwHD, item); 483 if (mTwCD->selectedItems().isEmpty()) 484 if (QTreeWidgetItem *item = mTwCD->topLevelItem (0)) 485 setCurrentItem (mTwCD, item); 486 if (mTwFD->selectedItems().isEmpty()) 487 if (QTreeWidgetItem *item = mTwFD->topLevelItem (0)) 488 setCurrentItem (mTwFD, item); 554 489 555 490 /* Applying language settings */ … … 560 495 561 496 /* static */ 562 void VBoxMediaManagerDlg::showModeless (QWidget *aCenterWidget /* = 0 */, 563 bool aRefresh /* = true */) 497 void VBoxMediaManagerDlg::showModeless (QWidget *aCenterWidget /* = 0 */, bool aRefresh /* = true */) 564 498 { 565 499 if (!mModelessDialog) … … 569 503 connect (vboxGlobal().mainWindow(), SIGNAL (closing()), mModelessDialog, SLOT (close())); 570 504 mModelessDialog->setAttribute (Qt::WA_DeleteOnClose); 571 mModelessDialog->setup (VBoxDefs::MediumType_All, 572 false /* aDoSelect */, aRefresh); 505 mModelessDialog->setup (VBoxDefs::MediumType_All, false /* aDoSelect */, aRefresh); 573 506 574 507 /* listen to events that may change the media status and refresh … … 585 518 586 519 mModelessDialog->show(); 587 mModelessDialog->setWindowState (mModelessDialog->windowState() & 588 ~Qt::WindowMinimized); 520 mModelessDialog->setWindowState (mModelessDialog->windowState() & ~Qt::WindowMinimized); 589 521 mModelessDialog->activateWindow(); 590 522 } … … 629 561 mNewAction->setText (tr ("&New...")); 630 562 mAddAction->setText (tr ("&Add...")); 631 // mEditAction->setText (tr ("&Edit..."));632 563 mRemoveAction->setText (tr ("R&emove")); 633 564 mReleaseAction->setText (tr ("Re&lease")); … … 636 567 mNewAction->setShortcut (QKeySequence (QKeySequence::New)); 637 568 mAddAction->setShortcut (QKeySequence ("Ins")); 638 // mEditAction->setShortcut (QKeySequence ("Ctrl+E"));639 569 mRemoveAction->setShortcut (QKeySequence (QKeySequence::Delete)); 640 570 mReleaseAction->setShortcut (QKeySequence ("Ctrl+L")); … … 643 573 mNewAction->setStatusTip (tr ("Create a new virtual hard disk")); 644 574 mAddAction->setStatusTip (tr ("Add an existing medium")); 645 // mEditAction->setStatusTip (tr ("Edit the properties of the selected medium"));646 575 mRemoveAction->setStatusTip (tr ("Remove the selected medium")); 647 576 mReleaseAction->setStatusTip (tr ("Release the selected medium by detaching it from the machines")); … … 652 581 mAddAction->setToolTip (mAddAction->text().remove ('&') + 653 582 QString (" (%1)").arg (mAddAction->shortcut().toString())); 654 // mEditAction->setToolTip (mEditAction->text().remove ('&') +655 // QString (" (%1)").arg (mEditAction->shortcut().toString()));656 583 mRemoveAction->setToolTip (mRemoveAction->text().remove ('&') + 657 584 QString (" (%1)").arg (mRemoveAction->shortcut().toString())); … … 673 600 mProgressBar->setText (tr ("Checking accessibility")); 674 601 #ifdef Q_WS_MAC 675 /* Make sure that the widgets aren't jumping around while the progress bar 676 * get visible. */ 602 /* Make sure that the widgets aren't jumping around while the progress bar get visible. */ 677 603 mProgressBar->adjustSize(); 678 604 int h = mProgressBar->height(); … … 683 609 mButtonBox->button (QDialogButtonBox::Ok)->setText (tr ("&Select")); 684 610 685 if (m HardDiskView->model()->rowCount() || mDVDView->model()->rowCount() || mFloppyView->model()->rowCount())611 if (mTwHD->model()->rowCount() || mTwCD->model()->rowCount() || mTwFD->model()->rowCount()) 686 612 refreshAll(); 687 613 } … … 696 622 { 697 623 /* Check for interesting objects */ 698 if (!(aObject == mHardDiskView || 699 aObject == mDVDView || 700 aObject == mFloppyView)) 624 if (!(aObject == mTwHD || aObject == mTwCD || aObject == mTwFD)) 701 625 return QIMainDialog::eventFilter (aObject, aEvent); 702 626 … … 763 687 if (aMedium.parent() && !mSessionMachineId.isNull()) 764 688 { 765 /* in !mShowDiffs mode, we ignore all diffs except ones that are689 /* In !mShowDiffs mode, we ignore all diffs except ones that are 766 690 * directly attached to the related VM in the current state */ 767 691 if (!aMedium.isAttachedInCurStateTo (mSessionMachineId)) … … 771 695 * we want to replace it with this diff to avoid duplicates in 772 696 * !mShowDiffs mode. */ 773 MediaItem *item = searchItem (m HardDiskView, aMedium.root().id());697 MediaItem *item = searchItem (mTwHD, aMedium.root().id()); 774 698 AssertReturnVoid (item); 775 699 … … 779 703 if (item->id() == mHDSelectedId) 780 704 { 781 setCurrentItem (m HardDiskView, item);705 setCurrentItem (mTwHD, item); 782 706 mHDSelectedId = QString::null; 783 707 } … … 794 718 case VBoxDefs::MediumType_HardDisk: 795 719 { 796 item = createHardDiskItem (m HardDiskView, aMedium);720 item = createHardDiskItem (mTwHD, aMedium); 797 721 AssertReturnVoid (item); 798 722 … … 800 724 * new tree-widget items, so initialize the header adjustment 801 725 * by calling resizeSections() slot... */ 802 QTimer::singleShot (0, m HardDiskView->header(), SLOT (resizeSections()));726 QTimer::singleShot (0, mTwHD->header(), SLOT (resizeSections())); 803 727 804 728 if (item->id() == mHDSelectedId) 805 729 { 806 setCurrentItem (m HardDiskView, item);730 setCurrentItem (mTwHD, item); 807 731 mHDSelectedId = QString::null; 808 732 } … … 811 735 case VBoxDefs::MediumType_DVD: 812 736 { 813 item = new MediaItem (m DVDView, aMedium, this);737 item = new MediaItem (mTwCD, aMedium, this); 814 738 AssertReturnVoid (item); 815 739 … … 817 741 * new tree-widget items, so initialize the header adjustment 818 742 * by calling resizeSections() slot... */ 819 QTimer::singleShot (0, m DVDView->header(), SLOT (resizeSections()));820 821 if (item->id() == m DVDSelectedId)743 QTimer::singleShot (0, mTwCD->header(), SLOT (resizeSections())); 744 745 if (item->id() == mCDSelectedId) 822 746 { 823 setCurrentItem (m DVDView, item);824 m DVDSelectedId = QString::null;747 setCurrentItem (mTwCD, item); 748 mCDSelectedId = QString::null; 825 749 } 826 750 break; … … 828 752 case VBoxDefs::MediumType_Floppy: 829 753 { 830 item = new MediaItem (m FloppyView, aMedium, this);754 item = new MediaItem (mTwFD, aMedium, this); 831 755 AssertReturnVoid (item); 832 756 … … 834 758 * new tree-widget items, so initialize the header adjustment 835 759 * by calling resizeSections() slot... */ 836 QTimer::singleShot (0, m FloppyView->header(), SLOT (resizeSections()));837 838 if (item->id() == mF loppySelectedId)760 QTimer::singleShot (0, mTwFD->header(), SLOT (resizeSections())); 761 762 if (item->id() == mFDSelectedId) 839 763 { 840 setCurrentItem (m FloppyView, item);841 mF loppySelectedId = QString::null;764 setCurrentItem (mTwFD, item); 765 mFDSelectedId = QString::null; 842 766 } 843 767 break; … … 876 800 case VBoxDefs::MediumType_HardDisk: 877 801 { 878 item = searchItem (m HardDiskView, aMedium.id());802 item = searchItem (mTwHD, aMedium.id()); 879 803 break; 880 804 } 881 805 case VBoxDefs::MediumType_DVD: 882 806 { 883 item = searchItem (m DVDView, aMedium.id());807 item = searchItem (mTwCD, aMedium.id()); 884 808 break; 885 809 } 886 810 case VBoxDefs::MediumType_Floppy: 887 811 { 888 item = searchItem (m FloppyView, aMedium.id());812 item = searchItem (mTwFD, aMedium.id()); 889 813 break; 890 814 } … … 908 832 } 909 833 910 void VBoxMediaManagerDlg::mediumRemoved (VBoxDefs::MediumType aType, 911 const QString &aId) 834 void VBoxMediaManagerDlg::mediumRemoved (VBoxDefs::MediumType aType, const QString &aId) 912 835 { 913 836 /* Ignore non-interesting aMedium */ … … 947 870 948 871 /* Load default tab icons */ 949 mT wImages->setTabIcon (HDTab, mHardDiskIcon);950 mT wImages->setTabIcon (CDTab, mDVDImageIcon);951 mT wImages->setTabIcon (FDTab, mFloppyImageIcon);872 mTabWidget->setTabIcon (HDTab, mHardDiskIcon); 873 mTabWidget->setTabIcon (CDTab, mDVDImageIcon); 874 mTabWidget->setTabIcon (FDTab, mFloppyImageIcon); 952 875 953 876 /* Load current media list */ … … 960 883 /* Select the first item to be the current one if the previous saved item 961 884 * was not selected yet. */ 962 if (!m HardDiskView->currentItem())963 if (QTreeWidgetItem *item = m HardDiskView->topLevelItem (0))964 setCurrentItem (m HardDiskView, item);965 if (!m DVDView->currentItem())966 if (QTreeWidgetItem *item = m DVDView->topLevelItem (0))967 setCurrentItem (m DVDView, item);968 if (!m FloppyView->currentItem())969 if (QTreeWidgetItem *item = m FloppyView->topLevelItem (0))970 setCurrentItem (m FloppyView, item);885 if (!mTwHD->currentItem()) 886 if (QTreeWidgetItem *item = mTwHD->topLevelItem (0)) 887 setCurrentItem (mTwHD, item); 888 if (!mTwCD->currentItem()) 889 if (QTreeWidgetItem *item = mTwCD->topLevelItem (0)) 890 setCurrentItem (mTwCD, item); 891 if (!mTwFD->currentItem()) 892 if (QTreeWidgetItem *item = mTwFD->topLevelItem (0)) 893 setCurrentItem (mTwFD, item); 971 894 972 895 processCurrentChanged(); … … 1000 923 CMedium hd = dlg.hardDisk(); 1001 924 /* Select the newly created hard disk */ 1002 MediaItem *item = searchItem (m HardDiskView, hd.GetId());925 MediaItem *item = searchItem (mTwHD, hd.GetId()); 1003 926 AssertReturnVoid (item); 1004 m HardDiskView->setCurrentItem (item);927 mTwHD->setCurrentItem (item); 1005 928 } 1006 929 } … … 1031 954 case VBoxDefs::MediumType_HardDisk: 1032 955 { 1033 /// @todo NEWMEDIA use CSystemProperties::GetHardDIskFormats to detect1034 /// possible hard disk extensions1035 956 QList < QPair <QString, QString> > filterList = vboxGlobal().HDDBackends(); 1036 957 QStringList backends; … … 1054 975 case VBoxDefs::MediumType_DVD: 1055 976 { 1056 filter = tr ("CD/DVD-ROM images (*.iso);;" 1057 "All files (*)"); 977 filter = tr ("CD/DVD-ROM images (*.iso);;All files (*)"); 1058 978 title = tr ("Select a CD/DVD-ROM disk image file"); 1059 979 break; … … 1061 981 case VBoxDefs::MediumType_Floppy: 1062 982 { 1063 filter = tr ("Floppy images (*.img);;" 1064 "All files (*)"); 983 filter = tr ("Floppy images (*.img);;All files (*)"); 1065 984 title = tr ("Select a floppy disk image file"); 1066 985 break; … … 1102 1021 { 1103 1022 bool deleteStorage = false; 1104 1105 /// @todo NEWMEDIA use CHardDiskFormat to find out if the format1106 /// supports storage deletion1107 1023 1108 1024 /* We don't want to try to delete inaccessible storage as it will … … 1129 1045 if (hardDisk.isOk()) 1130 1046 { 1131 vboxProblem().showModalProgressDialog (progress, windowTitle(), 1132 parentWidget()); 1047 vboxProblem().showModalProgressDialog (progress, windowTitle(), parentWidget()); 1133 1048 if (progress.isOk() && progress.GetResultCode() == S_OK) 1134 1049 success = true; … … 1138 1053 vboxGlobal().removeMedium (VBoxDefs::MediumType_HardDisk, id); 1139 1054 else 1140 vboxProblem().cannotDeleteHardDiskStorage (this, hardDisk, 1141 progress); 1055 vboxProblem().cannotDeleteHardDiskStorage (this, hardDisk, progress); 1142 1056 1143 1057 /* We don't want to close the hard disk because it was … … 1190 1104 1191 1105 const QList <QString> &machineIds = item->medium().curStateMachineIds(); 1192 for (QList <QString>::const_iterator it = machineIds.begin(); 1193 it != machineIds.end(); ++ it) 1106 for (QList <QString>::const_iterator it = machineIds.begin(); it != machineIds.end(); ++ it) 1194 1107 { 1195 1108 CMachine m = mVBox.GetMachine (*it); … … 1217 1130 return; 1218 1131 1219 for (QList <QString>::const_iterator it = machineIds.begin(); 1220 it != machineIds.end(); ++ it) 1132 for (QList <QString>::const_iterator it = machineIds.begin(); it != machineIds.end(); ++ it) 1221 1133 { 1222 1134 if (!releaseMediumFrom (item->medium(), *it)) … … 1231 1143 } 1232 1144 1233 bool VBoxMediaManagerDlg::releaseMediumFrom (const VBoxMedium &aMedium, 1234 const QString &aMachineId) 1145 bool VBoxMediaManagerDlg::releaseMediumFrom (const VBoxMedium &aMedium, const QString &aMachineId) 1235 1146 { 1236 1147 CSession session; … … 1347 1258 { 1348 1259 case VBoxDefs::MediumType_HardDisk: 1349 tree = m HardDiskView;1260 tree = mTwHD; 1350 1261 break; 1351 1262 case VBoxDefs::MediumType_DVD: 1352 tree = m DVDView;1263 tree = mTwCD; 1353 1264 break; 1354 1265 case VBoxDefs::MediumType_Floppy: 1355 tree = m FloppyView;1266 tree = mTwFD; 1356 1267 break; 1357 1268 default: … … 1365 1276 { 1366 1277 VBoxDefs::MediumType type = VBoxDefs::MediumType_Invalid; 1367 switch (mT wImages->currentIndex())1278 switch (mTabWidget->currentIndex()) 1368 1279 { 1369 1280 case HDTab: … … 1377 1288 break; 1378 1289 default: 1379 AssertMsgFailed (("Page type %d unknown!\n", mT wImages->currentIndex()));1290 AssertMsgFailed (("Page type %d unknown!\n", mTabWidget->currentIndex())); 1380 1291 break; 1381 1292 } … … 1406 1317 } 1407 1318 1408 void VBoxMediaManagerDlg::setCurrentItem (QTreeWidget *aTree, 1409 QTreeWidgetItem *aItem) 1319 void VBoxMediaManagerDlg::setCurrentItem (QTreeWidget *aTree, QTreeWidgetItem *aItem) 1410 1320 { 1411 1321 if (aTree && aItem) … … 1418 1328 } 1419 1329 1420 void VBoxMediaManagerDlg::processCurrentChanged (int /* index = -1 */)1330 void VBoxMediaManagerDlg::processCurrentChanged (int /* aIndex = -1 */) 1421 1331 { 1422 1332 QTreeWidget *tree = currentTreeWidget(); … … 1451 1361 bool newEnabled = currentTreeWidgetType() == VBoxDefs::MediumType_HardDisk; 1452 1362 bool addEnabled = true; 1453 // bool editEnabled = notInEnum && item && checkMediumFor (item, Action_Edit);1454 1363 bool removeEnabled = notInEnum && item && checkMediumFor (item, Action_Remove); 1455 1364 bool releaseEnabled = item && checkMediumFor (item, Action_Release); … … 1457 1366 mNewAction->setEnabled (newEnabled); 1458 1367 mAddAction->setEnabled (addEnabled); 1459 // mEditAction->setEnabled (editEnabled);1460 1368 mRemoveAction->setEnabled (removeEnabled); 1461 1369 mReleaseAction->setEnabled (releaseEnabled); … … 1473 1381 formatPaneText (item->usage()); 1474 1382 1475 if (item->treeWidget() == m HardDiskView)1476 { 1477 m HdsPane1->setText (formatPaneText (item->location(), true, "end"));1478 m HdsPane2->setText (formatPaneText (QString ("%1 (%2)").arg (item->hardDiskType())1479 1480 m HdsPane3->setText (usage);1481 } 1482 else if (item->treeWidget() == m DVDView)1483 { 1484 m CdsPane1->setText (formatPaneText (item->location(), true, "end"));1485 m CdsPane2->setText (usage);1486 } 1487 else if (item->treeWidget() == m FloppyView)1488 { 1489 m FdsPane1->setText (formatPaneText (item->location(), true, "end"));1490 m FdsPane2->setText (usage);1383 if (item->treeWidget() == mTwHD) 1384 { 1385 mIpHD1->setText (formatPaneText (item->location(), true, "end")); 1386 mIpHD2->setText (formatPaneText (QString ("%1 (%2)").arg (item->hardDiskType()) 1387 .arg (item->hardDiskFormat()), false)); 1388 mIpHD3->setText (usage); 1389 } 1390 else if (item->treeWidget() == mTwCD) 1391 { 1392 mIpCD1->setText (formatPaneText (item->location(), true, "end")); 1393 mIpCD2->setText (usage); 1394 } 1395 else if (item->treeWidget() == mTwFD) 1396 { 1397 mIpFD1->setText (formatPaneText (item->location(), true, "end")); 1398 mIpFD2->setText (usage); 1491 1399 } 1492 1400 } … … 1494 1402 clearInfoPanes(); 1495 1403 1496 mH dsContainer->setEnabled (item);1497 mC dsContainer->setEnabled (item);1498 mF dsContainer->setEnabled (item);1404 mHDContainer->setEnabled (item); 1405 mCDContainer->setEnabled (item); 1406 mFDContainer->setEnabled (item); 1499 1407 } 1500 1408 … … 1521 1429 void VBoxMediaManagerDlg::machineStateChanged (const VBoxMachineStateChangeEvent &aEvent) 1522 1430 { 1523 /// @todo (r=dmik) IVirtualBoxCallback::OnMachineStateChange1524 // must also expose the old state! In this case we won't need to cache1525 // the state value in every class in GUI that uses this signal.1526 1527 1431 switch (aEvent.state) 1528 1432 { … … 1553 1457 /* Get all the tree widgets */ 1554 1458 QList <QITreeWidget*> widgetList; 1555 widgetList << m HardDiskView;1556 widgetList << m DVDView;1557 widgetList << m FloppyView;1459 widgetList << mTwHD; 1460 widgetList << mTwCD; 1461 widgetList << mTwFD; 1558 1462 1559 1463 /* Calculate deduction for every header */ … … 1576 1480 } 1577 1481 1578 void VBoxMediaManagerDlg::addMediumToList (const QString &aLocation, 1579 VBoxDefs::MediumType aType) 1482 void VBoxMediaManagerDlg::addMediumToList (const QString &aLocation, VBoxDefs::MediumType aType) 1580 1483 { 1581 1484 AssertReturnVoid (!aLocation.isEmpty()); … … 1588 1491 case VBoxDefs::MediumType_HardDisk: 1589 1492 { 1590 CMedium hd = mVBox.OpenHardDisk (aLocation, KAccessMode_ReadWrite, false, "", false, "");1493 CMedium hd = mVBox.OpenHardDisk (aLocation, KAccessMode_ReadWrite, false, "", false, ""); 1591 1494 if (mVBox.isOk()) 1592 { 1593 medium = VBoxMedium (CMedium (hd), 1594 VBoxDefs::MediumType_HardDisk, 1595 KMediumState_Created); 1596 } 1495 medium = VBoxMedium (CMedium (hd), VBoxDefs::MediumType_HardDisk, KMediumState_Created); 1597 1496 break; 1598 1497 } … … 1601 1500 CMedium image = mVBox.OpenDVDImage (aLocation, uuid); 1602 1501 if (mVBox.isOk()) 1603 { 1604 medium = VBoxMedium (CMedium (image), 1605 VBoxDefs::MediumType_DVD, 1606 KMediumState_Created); 1607 } 1502 medium = VBoxMedium (CMedium (image), VBoxDefs::MediumType_DVD, KMediumState_Created); 1608 1503 break; 1609 1504 } … … 1612 1507 CMedium image = mVBox.OpenFloppyImage (aLocation, uuid); 1613 1508 if (mVBox.isOk()) 1614 { 1615 medium = VBoxMedium (CMedium (image), 1616 VBoxDefs::MediumType_Floppy, 1617 KMediumState_Created); 1618 } 1509 medium = VBoxMedium (CMedium (image), VBoxDefs::MediumType_Floppy, KMediumState_Created); 1619 1510 break; 1620 1511 } … … 1629 1520 } 1630 1521 1631 MediaItem* VBoxMediaManagerDlg::createHardDiskItem (QTreeWidget *aTree, 1632 const VBoxMedium &aMedium) const 1522 MediaItem* VBoxMediaManagerDlg::createHardDiskItem (QTreeWidget *aTree, const VBoxMedium &aMedium) const 1633 1523 { 1634 1524 AssertReturn (!aMedium.medium().isNull(), 0); … … 1687 1577 { 1688 1578 /* Does it change the overall state? */ 1689 if (*inaccessible || 1690 aItem->state() != KMediumState_Inaccessible) 1579 if (*inaccessible || aItem->state() != KMediumState_Inaccessible) 1691 1580 break; /* no */ 1692 1581 1693 1582 *inaccessible = true; 1694 1583 1695 mT wImages->setTabIcon (tab, vboxGlobal().warningIcon());1584 mTabWidget->setTabIcon (tab, vboxGlobal().warningIcon()); 1696 1585 1697 1586 break; … … 1728 1617 for (; *it; ++ it) 1729 1618 { 1730 if (*it != aItem && 1731 (*it)->state() == KMediumState_Inaccessible) 1619 if (*it != aItem && (*it)->state() == KMediumState_Inaccessible) 1732 1620 { 1733 1621 *inaccessible = true; … … 1738 1626 1739 1627 if (*inaccessible) 1740 mT wImages->setTabIcon (tab, vboxGlobal().warningIcon());1628 mTabWidget->setTabIcon (tab, vboxGlobal().warningIcon()); 1741 1629 else 1742 mTwImages->setTabIcon (tab, *icon); 1743 1744 break; 1745 } 1746 } 1747 } 1748 1749 MediaItem* VBoxMediaManagerDlg::searchItem (QTreeWidget *aTree, 1750 const QString &aId) const 1630 mTabWidget->setTabIcon (tab, *icon); 1631 1632 break; 1633 } 1634 } 1635 } 1636 1637 MediaItem* VBoxMediaManagerDlg::searchItem (QTreeWidget *aTree, const QString &aId) const 1751 1638 { 1752 1639 if (aId.isNull()) … … 1872 1759 void VBoxMediaManagerDlg::clearInfoPanes() 1873 1760 { 1874 m HdsPane1->clear(); mHdsPane2->clear(); mHdsPane3->clear();1875 m CdsPane1->clear(); mCdsPane2->clear();1876 m FdsPane1->clear(); mFdsPane2->clear();1761 mIpHD1->clear(); mIpHD2->clear(); mIpHD3->clear(); 1762 mIpCD1->clear(); mIpCD2->clear(); 1763 mIpFD1->clear(); mIpFD2->clear(); 1877 1764 } 1878 1765 … … 1896 1783 MediaItem *mi; 1897 1784 1898 mi = toMediaItem (m HardDiskView->currentItem());1785 mi = toMediaItem (mTwHD->currentItem()); 1899 1786 if (mHDSelectedId.isNull()) 1900 1787 mHDSelectedId = mi ? mi->id() : QString::null; 1901 1788 1902 mi = toMediaItem (m DVDView->currentItem());1903 if (m DVDSelectedId.isNull())1904 m DVDSelectedId = mi ? mi->id() : QString::null;1905 1906 mi = toMediaItem (m FloppyView->currentItem());1907 if (mF loppySelectedId.isNull())1908 mF loppySelectedId = mi ? mi->id() : QString::null;1789 mi = toMediaItem (mTwCD->currentItem()); 1790 if (mCDSelectedId.isNull()) 1791 mCDSelectedId = mi ? mi->id() : QString::null; 1792 1793 mi = toMediaItem (mTwFD->currentItem()); 1794 if (mFDSelectedId.isNull()) 1795 mFDSelectedId = mi ? mi->id() : QString::null; 1909 1796 1910 1797 /* Finally, clear all the lists... … … 1916 1803 * is null and at least one element have to be selected (by policy). 1917 1804 * So just blocking any signals outgoing from the list during clearing. */ 1918 m HardDiskView->blockSignals (true);1919 m HardDiskView->clear();1920 m HardDiskView->blockSignals (false);1921 m DVDView->clear();1922 m FloppyView->clear();1805 mTwHD->blockSignals (true); 1806 mTwHD->clear(); 1807 mTwHD->blockSignals (false); 1808 mTwCD->clear(); 1809 mTwFD->clear(); 1923 1810 } 1924 1811 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxMediaManagerDlg.ui
r23333 r23953 3 3 VBox frontends: Qt4 GUI ("VirtualBox"): 4 4 5 Copyright (C) 200 8Sun Microsystems, Inc.5 Copyright (C) 2006-2009 Sun Microsystems, Inc. 6 6 7 7 This file is part of VirtualBox Open Source Edition (OSE), as … … 29 29 <property name="minimumSize" > 30 30 <size> 31 <width>28 3</width>31 <width>280</width> 32 32 <height>190</height> 33 33 </size> … … 37 37 </property> 38 38 <widget class="QWidget" name="mCentralWidget" > 39 <layout class="Q HBoxLayout" >39 <layout class="QVBoxLayout" > 40 40 <item> 41 <layout class="QVBoxLayout" > 42 <item> 43 <widget class="QTabWidget" name="mTwImages" > 44 <property name="sizePolicy" > 45 <sizepolicy vsizetype="Expanding" hsizetype="Preferred" > 46 <horstretch>0</horstretch> 47 <verstretch>0</verstretch> 48 </sizepolicy> 49 </property> 50 <property name="currentIndex" > 51 <number>0</number> 52 </property> 53 <widget class="QWidget" name="mTbHD" > 54 <attribute name="title" > 55 <string>Hard &Disks</string> 56 </attribute> 57 <layout class="QVBoxLayout" > 58 <item> 59 <widget class="QITreeWidget" name="mHardDiskView" > 60 <property name="contextMenuPolicy" > 61 <enum>Qt::CustomContextMenu</enum> 62 </property> 63 <property name="acceptDrops" > 64 <bool>true</bool> 65 </property> 66 <property name="horizontalScrollBarPolicy" > 67 <enum>Qt::ScrollBarAlwaysOff</enum> 68 </property> 69 <property name="alternatingRowColors" > 70 <bool>true</bool> 71 </property> 72 <property name="allColumnsShowFocus" > 73 <bool>true</bool> 74 </property> 75 <column> 76 <property name="text" > 77 <string>Name</string> 78 </property> 79 </column> 80 <column> 81 <property name="text" > 82 <string>Virtual Size</string> 83 </property> 84 </column> 85 <column> 86 <property name="text" > 87 <string>Actual Size</string> 88 </property> 89 </column> 90 </widget> 91 </item> 92 <item> 93 <widget class="QFrame" name="mHdsContainer" > 94 <property name="frameShape" > 95 <enum>QFrame::Box</enum> 96 </property> 97 <property name="frameShadow" > 98 <enum>QFrame::Sunken</enum> 99 </property> 100 <layout class="QGridLayout" > 101 <property name="verticalSpacing" > 102 <number>0</number> 103 </property> 104 <property name="margin" > 105 <number>5</number> 106 </property> 107 <item row="0" column="0" > 108 <widget class="QLabel" name="mLbHD1" > 109 <property name="text" > 110 <string>Location</string> 111 </property> 112 </widget> 113 </item> 114 <item row="0" column="1" > 115 <widget class="QILabel" name="mHdsPane1" > 116 <property name="sizePolicy" > 117 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 118 <horstretch>0</horstretch> 119 <verstretch>0</verstretch> 120 </sizepolicy> 121 </property> 122 </widget> 123 </item> 124 <item row="1" column="0" > 125 <widget class="QLabel" name="mLbHD2" > 126 <property name="text" > 127 <string>Type (Format)</string> 128 </property> 129 </widget> 130 </item> 131 <item row="1" column="1" > 132 <widget class="QILabel" name="mHdsPane2" > 133 <property name="sizePolicy" > 134 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 135 <horstretch>0</horstretch> 136 <verstretch>0</verstretch> 137 </sizepolicy> 138 </property> 139 </widget> 140 </item> 141 <item row="2" column="0" > 142 <widget class="QLabel" name="mLbHD3" > 143 <property name="text" > 144 <string>Attached to</string> 145 </property> 146 </widget> 147 </item> 148 <item row="2" column="1" > 149 <widget class="QILabel" name="mHdsPane3" > 150 <property name="sizePolicy" > 151 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 152 <horstretch>0</horstretch> 153 <verstretch>0</verstretch> 154 </sizepolicy> 155 </property> 156 </widget> 157 </item> 158 </layout> 159 </widget> 160 </item> 161 </layout> 162 </widget> 163 <widget class="QWidget" name="mTbCD" > 164 <attribute name="title" > 165 <string>&CD/DVD Images</string> 166 </attribute> 167 <layout class="QVBoxLayout" > 168 <item> 169 <widget class="QITreeWidget" name="mDVDView" > 170 <property name="contextMenuPolicy" > 171 <enum>Qt::CustomContextMenu</enum> 172 </property> 173 <property name="acceptDrops" > 174 <bool>true</bool> 175 </property> 176 <property name="horizontalScrollBarPolicy" > 177 <enum>Qt::ScrollBarAlwaysOff</enum> 178 </property> 179 <property name="alternatingRowColors" > 180 <bool>true</bool> 181 </property> 182 <property name="allColumnsShowFocus" > 183 <bool>true</bool> 184 </property> 185 <column> 186 <property name="text" > 187 <string>Name</string> 188 </property> 189 </column> 190 <column> 191 <property name="text" > 192 <string>Size</string> 193 </property> 194 </column> 195 </widget> 196 </item> 197 <item> 198 <widget class="QFrame" name="mCdsContainer" > 199 <property name="frameShape" > 200 <enum>QFrame::Box</enum> 201 </property> 202 <property name="frameShadow" > 203 <enum>QFrame::Sunken</enum> 204 </property> 205 <layout class="QGridLayout" > 206 <property name="verticalSpacing" > 207 <number>0</number> 208 </property> 209 <property name="margin" > 210 <number>5</number> 211 </property> 212 <item row="0" column="0" > 213 <widget class="QLabel" name="mLbCD1" > 214 <property name="text" > 215 <string>Location</string> 216 </property> 217 </widget> 218 </item> 219 <item row="0" column="1" > 220 <widget class="QILabel" name="mCdsPane1" > 221 <property name="sizePolicy" > 222 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 223 <horstretch>0</horstretch> 224 <verstretch>0</verstretch> 225 </sizepolicy> 226 </property> 227 </widget> 228 </item> 229 <item row="1" column="0" > 230 <widget class="QLabel" name="mLbCD2" > 231 <property name="text" > 232 <string>Attached to</string> 233 </property> 234 </widget> 235 </item> 236 <item row="1" column="1" > 237 <widget class="QILabel" name="mCdsPane2" > 238 <property name="sizePolicy" > 239 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 240 <horstretch>0</horstretch> 241 <verstretch>0</verstretch> 242 </sizepolicy> 243 </property> 244 </widget> 245 </item> 246 </layout> 247 </widget> 248 </item> 249 </layout> 250 </widget> 251 <widget class="QWidget" name="mTbFD" > 252 <attribute name="title" > 253 <string>&Floppy Images</string> 254 </attribute> 255 <layout class="QVBoxLayout" > 256 <item> 257 <widget class="QITreeWidget" name="mFloppyView" > 258 <property name="contextMenuPolicy" > 259 <enum>Qt::CustomContextMenu</enum> 260 </property> 261 <property name="acceptDrops" > 262 <bool>true</bool> 263 </property> 264 <property name="horizontalScrollBarPolicy" > 265 <enum>Qt::ScrollBarAlwaysOff</enum> 266 </property> 267 <property name="alternatingRowColors" > 268 <bool>true</bool> 269 </property> 270 <property name="allColumnsShowFocus" > 271 <bool>true</bool> 272 </property> 273 <column> 274 <property name="text" > 275 <string>Name</string> 276 </property> 277 </column> 278 <column> 279 <property name="text" > 280 <string>Size</string> 281 </property> 282 </column> 283 </widget> 284 </item> 285 <item> 286 <widget class="QFrame" name="mFdsContainer" > 287 <property name="frameShape" > 288 <enum>QFrame::Box</enum> 289 </property> 290 <property name="frameShadow" > 291 <enum>QFrame::Sunken</enum> 292 </property> 293 <layout class="QGridLayout" > 294 <property name="horizontalSpacing" > 295 <number>6</number> 296 </property> 297 <property name="verticalSpacing" > 298 <number>0</number> 299 </property> 300 <property name="margin" > 301 <number>5</number> 302 </property> 303 <item row="0" column="0" > 304 <widget class="QLabel" name="mLbFD1" > 305 <property name="text" > 306 <string>Location</string> 307 </property> 308 </widget> 309 </item> 310 <item row="0" column="1" > 311 <widget class="QILabel" name="mFdsPane1" > 312 <property name="sizePolicy" > 313 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 314 <horstretch>0</horstretch> 315 <verstretch>0</verstretch> 316 </sizepolicy> 317 </property> 318 </widget> 319 </item> 320 <item row="1" column="0" > 321 <widget class="QLabel" name="mLbFD2" > 322 <property name="text" > 323 <string>Attached to</string> 324 </property> 325 </widget> 326 </item> 327 <item row="1" column="1" > 328 <widget class="QILabel" name="mFdsPane2" > 329 <property name="sizePolicy" > 330 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 331 <horstretch>0</horstretch> 332 <verstretch>0</verstretch> 333 </sizepolicy> 334 </property> 335 </widget> 336 </item> 337 </layout> 338 </widget> 339 </item> 340 </layout> 341 </widget> 342 </widget> 343 </item> 344 <item> 345 <widget class="QIDialogButtonBox" name="mButtonBox" > 346 <property name="standardButtons" > 347 <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set> 348 </property> 349 </widget> 350 </item> 351 </layout> 41 <widget class="QTabWidget" name="mTabWidget" > 42 <property name="sizePolicy" > 43 <sizepolicy vsizetype="Expanding" hsizetype="Preferred" > 44 <horstretch>0</horstretch> 45 <verstretch>0</verstretch> 46 </sizepolicy> 47 </property> 48 <widget class="QWidget" name="mTabHD" > 49 <attribute name="title" > 50 <string>Hard &Disks</string> 51 </attribute> 52 <layout class="QVBoxLayout" > 53 <item> 54 <widget class="QITreeWidget" name="mTwHD" > 55 <property name="contextMenuPolicy" > 56 <enum>Qt::CustomContextMenu</enum> 57 </property> 58 <property name="acceptDrops" > 59 <bool>true</bool> 60 </property> 61 <property name="horizontalScrollBarPolicy" > 62 <enum>Qt::ScrollBarAlwaysOff</enum> 63 </property> 64 <property name="alternatingRowColors" > 65 <bool>true</bool> 66 </property> 67 <property name="allColumnsShowFocus" > 68 <bool>true</bool> 69 </property> 70 <column> 71 <property name="text" > 72 <string>Name</string> 73 </property> 74 </column> 75 <column> 76 <property name="text" > 77 <string>Virtual Size</string> 78 </property> 79 </column> 80 <column> 81 <property name="text" > 82 <string>Actual Size</string> 83 </property> 84 </column> 85 </widget> 86 </item> 87 <item> 88 <widget class="QFrame" name="mHDContainer" > 89 <property name="frameShape" > 90 <enum>QFrame::Box</enum> 91 </property> 92 <property name="frameShadow" > 93 <enum>QFrame::Sunken</enum> 94 </property> 95 <layout class="QGridLayout" > 96 <property name="verticalSpacing" > 97 <number>0</number> 98 </property> 99 <property name="margin" > 100 <number>5</number> 101 </property> 102 <item row="0" column="0" > 103 <widget class="QLabel" name="mLbHD1" > 104 <property name="text" > 105 <string>Location</string> 106 </property> 107 </widget> 108 </item> 109 <item row="0" column="1" > 110 <widget class="QILabel" name="mIpHD1" > 111 <property name="sizePolicy" > 112 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 113 <horstretch>0</horstretch> 114 <verstretch>0</verstretch> 115 </sizepolicy> 116 </property> 117 </widget> 118 </item> 119 <item row="1" column="0" > 120 <widget class="QLabel" name="mLbHD2" > 121 <property name="text" > 122 <string>Type (Format)</string> 123 </property> 124 </widget> 125 </item> 126 <item row="1" column="1" > 127 <widget class="QILabel" name="mIpHD2" > 128 <property name="sizePolicy" > 129 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 130 <horstretch>0</horstretch> 131 <verstretch>0</verstretch> 132 </sizepolicy> 133 </property> 134 </widget> 135 </item> 136 <item row="2" column="0" > 137 <widget class="QLabel" name="mLbHD3" > 138 <property name="text" > 139 <string>Attached to</string> 140 </property> 141 </widget> 142 </item> 143 <item row="2" column="1" > 144 <widget class="QILabel" name="mIpHD3" > 145 <property name="sizePolicy" > 146 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 147 <horstretch>0</horstretch> 148 <verstretch>0</verstretch> 149 </sizepolicy> 150 </property> 151 </widget> 152 </item> 153 </layout> 154 </widget> 155 </item> 156 </layout> 157 </widget> 158 <widget class="QWidget" name="mTabCD" > 159 <attribute name="title" > 160 <string>&CD/DVD Images</string> 161 </attribute> 162 <layout class="QVBoxLayout" > 163 <item> 164 <widget class="QITreeWidget" name="mTwCD" > 165 <property name="contextMenuPolicy" > 166 <enum>Qt::CustomContextMenu</enum> 167 </property> 168 <property name="acceptDrops" > 169 <bool>true</bool> 170 </property> 171 <property name="horizontalScrollBarPolicy" > 172 <enum>Qt::ScrollBarAlwaysOff</enum> 173 </property> 174 <property name="alternatingRowColors" > 175 <bool>true</bool> 176 </property> 177 <property name="allColumnsShowFocus" > 178 <bool>true</bool> 179 </property> 180 <column> 181 <property name="text" > 182 <string>Name</string> 183 </property> 184 </column> 185 <column> 186 <property name="text" > 187 <string>Size</string> 188 </property> 189 </column> 190 </widget> 191 </item> 192 <item> 193 <widget class="QFrame" name="mCDContainer" > 194 <property name="frameShape" > 195 <enum>QFrame::Box</enum> 196 </property> 197 <property name="frameShadow" > 198 <enum>QFrame::Sunken</enum> 199 </property> 200 <layout class="QGridLayout" > 201 <property name="verticalSpacing" > 202 <number>0</number> 203 </property> 204 <property name="margin" > 205 <number>5</number> 206 </property> 207 <item row="0" column="0" > 208 <widget class="QLabel" name="mLbCD1" > 209 <property name="text" > 210 <string>Location</string> 211 </property> 212 </widget> 213 </item> 214 <item row="0" column="1" > 215 <widget class="QILabel" name="mIpCD1" > 216 <property name="sizePolicy" > 217 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 218 <horstretch>0</horstretch> 219 <verstretch>0</verstretch> 220 </sizepolicy> 221 </property> 222 </widget> 223 </item> 224 <item row="1" column="0" > 225 <widget class="QLabel" name="mLbCD2" > 226 <property name="text" > 227 <string>Attached to</string> 228 </property> 229 </widget> 230 </item> 231 <item row="1" column="1" > 232 <widget class="QILabel" name="mIpCD2" > 233 <property name="sizePolicy" > 234 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 235 <horstretch>0</horstretch> 236 <verstretch>0</verstretch> 237 </sizepolicy> 238 </property> 239 </widget> 240 </item> 241 </layout> 242 </widget> 243 </item> 244 </layout> 245 </widget> 246 <widget class="QWidget" name="mTabFD" > 247 <attribute name="title" > 248 <string>&Floppy Images</string> 249 </attribute> 250 <layout class="QVBoxLayout" > 251 <item> 252 <widget class="QITreeWidget" name="mTwFD" > 253 <property name="contextMenuPolicy" > 254 <enum>Qt::CustomContextMenu</enum> 255 </property> 256 <property name="acceptDrops" > 257 <bool>true</bool> 258 </property> 259 <property name="horizontalScrollBarPolicy" > 260 <enum>Qt::ScrollBarAlwaysOff</enum> 261 </property> 262 <property name="alternatingRowColors" > 263 <bool>true</bool> 264 </property> 265 <property name="allColumnsShowFocus" > 266 <bool>true</bool> 267 </property> 268 <column> 269 <property name="text" > 270 <string>Name</string> 271 </property> 272 </column> 273 <column> 274 <property name="text" > 275 <string>Size</string> 276 </property> 277 </column> 278 </widget> 279 </item> 280 <item> 281 <widget class="QFrame" name="mFDContainer" > 282 <property name="frameShape" > 283 <enum>QFrame::Box</enum> 284 </property> 285 <property name="frameShadow" > 286 <enum>QFrame::Sunken</enum> 287 </property> 288 <layout class="QGridLayout" > 289 <property name="horizontalSpacing" > 290 <number>6</number> 291 </property> 292 <property name="verticalSpacing" > 293 <number>0</number> 294 </property> 295 <property name="margin" > 296 <number>5</number> 297 </property> 298 <item row="0" column="0" > 299 <widget class="QLabel" name="mLbFD1" > 300 <property name="text" > 301 <string>Location</string> 302 </property> 303 </widget> 304 </item> 305 <item row="0" column="1" > 306 <widget class="QILabel" name="mIpFD1" > 307 <property name="sizePolicy" > 308 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 309 <horstretch>0</horstretch> 310 <verstretch>0</verstretch> 311 </sizepolicy> 312 </property> 313 </widget> 314 </item> 315 <item row="1" column="0" > 316 <widget class="QLabel" name="mLbFD2" > 317 <property name="text" > 318 <string>Attached to</string> 319 </property> 320 </widget> 321 </item> 322 <item row="1" column="1" > 323 <widget class="QILabel" name="mIpFD2" > 324 <property name="sizePolicy" > 325 <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > 326 <horstretch>0</horstretch> 327 <verstretch>0</verstretch> 328 </sizepolicy> 329 </property> 330 </widget> 331 </item> 332 </layout> 333 </widget> 334 </item> 335 </layout> 336 </widget> 337 </widget> 338 </item> 339 <item> 340 <widget class="QIDialogButtonBox" name="mButtonBox" > 341 <property name="standardButtons" > 342 <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set> 343 </property> 344 </widget> 352 345 </item> 353 346 </layout>
Note:
See TracChangeset
for help on using the changeset viewer.