Changeset 9245 in vbox for trunk/src/VBox/Frontends/VirtualBox4
- Timestamp:
- May 30, 2008 11:57:42 AM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk
r9234 r9245 444 444 include/QIListView.h \ 445 445 include/QITreeWidget.h \ 446 include/QIMainDialog.h \ 446 447 include/VBoxGlobalSettings.h \ 447 448 include/VBoxUtils.h \ … … 528 529 src/QIListView.cpp \ 529 530 src/QITreeWidget.cpp \ 531 src/QIMainDialog.cpp \ 530 532 src/QILineEdit.cpp \ 531 533 src/VBoxDefs.cpp \ -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDiskImageManagerDlg.h
r9214 r9245 25 25 26 26 #include "VBoxDiskImageManagerDlg.gen.h" 27 #include "QIMainDialog.h" 27 28 #include "QIWithRetranslateUI.h" 28 29 #include "COMDefs.h" … … 30 31 #include "VBoxMediaComboBox.h" 31 32 32 /* Qt includes */33 #include <QPointer>34 35 33 class DiskImageItem; 36 34 class VBoxToolBar; 37 35 class InfoPaneLabel; 38 36 39 class VBoxDiskImageManagerDlg : public QIWithRetranslateUI2<Q MainWindow>,37 class VBoxDiskImageManagerDlg : public QIWithRetranslateUI2<QIMainDialog>, 40 38 public Ui::VBoxDiskImageManagerDlg 41 39 { … … 48 46 public: 49 47 50 enum ResultCode { Rejected,51 Accepted };52 53 48 VBoxDiskImageManagerDlg (QWidget *aParent = NULL, Qt::WindowFlags aFlags = Qt::Dialog); 54 49 … … 56 51 57 52 static void showModeless (bool aRefresh = true); 58 int exec();59 int result() const;60 53 61 54 QUuid selectedUuid() const; … … 69 62 70 63 void refreshAll(); 71 virtual void setVisible (bool aVisible);72 64 73 65 protected: … … 101 93 void processDoubleClick (QTreeWidgetItem *aItem, int aColumn); 102 94 void processRightClick (const QPoint &aPos, QTreeWidgetItem *aItem, int aColumn); 103 104 void accept();105 void reject();106 void done (int aRescode);107 108 void setResult (int aRescode);109 95 110 96 private: … … 152 138 /* Window status */ 153 139 bool mDoSelect; 154 int mRescode;155 140 static VBoxDiskImageManagerDlg *mModelessDialog; 156 QPointer<QEventLoop> mEventLoop;157 141 158 142 /* Type if we are in the select modus */ -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxUtils.h
r8733 r9245 269 269 } 270 270 271 /* Proxy icon creation */ 272 QPixmap darwinCreateDragPixmap (const QPixmap& aPixmap, const QString &aText); 273 271 274 /* Special routines for the dock handling */ 272 275 CGImageRef darwinCreateDockBadge (const char *aSource); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp
r9214 r9245 2533 2533 dlg.setup (VBoxDefs::FD, true, &id); 2534 2534 2535 if (dlg.exec() == VBoxDiskImageManagerDlg::Accepted)2535 if (dlg.exec() == QDialog::Accepted) 2536 2536 { 2537 2537 CFloppyDrive drv = csession.GetMachine().GetFloppyDrive(); … … 2577 2577 dlg.setup (VBoxDefs::CD, true, &id); 2578 2578 2579 if (dlg.exec() == VBoxDiskImageManagerDlg::Accepted)2579 if (dlg.exec() == QDialog::Accepted) 2580 2580 { 2581 2581 CDVDDrive drv = csession.GetMachine().GetDVDDrive(); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDiskImageManagerDlg.cpp
r9217 r9245 209 209 210 210 VBoxDiskImageManagerDlg::VBoxDiskImageManagerDlg (QWidget *aParent /* = NULL */, Qt::WindowFlags aFlags /* = 0 */) 211 : QIWithRetranslateUI2<QMainWindow> (aParent, aFlags) 212 , mRescode (Rejected) 211 : QIWithRetranslateUI2<QIMainDialog> (aParent, aFlags) 213 212 , mType (VBoxDefs::InvalidType) 214 213 { … … 523 522 } 524 523 525 int VBoxDiskImageManagerDlg::exec()526 {527 AssertMsg (!mEventLoop, ("exec is called recursively!\n"));528 529 /* Reset the result code */530 setResult (Rejected);531 bool deleteOnClose = testAttribute(Qt::WA_DeleteOnClose);532 setAttribute(Qt::WA_DeleteOnClose, false);533 /* Create a local event loop */534 mEventLoop = new QEventLoop();535 /* Show the window */536 show();537 /* A guard to ourself for the case we destroy ourself. */538 QPointer<VBoxDiskImageManagerDlg> guard = this;539 /* Start the event loop. This blocks. */540 mEventLoop->exec();541 /* Delete the event loop */542 delete mEventLoop;543 /* Are we valid anymore? */544 if (guard.isNull())545 return Rejected;546 int res = result();547 if (deleteOnClose)548 delete this;549 /* Return the final result */550 return res;551 }552 553 524 QUuid VBoxDiskImageManagerDlg::selectedUuid() const 554 525 { … … 796 767 /* Start enumerating media */ 797 768 vboxGlobal().startEnumeratingMedia(); 798 }799 800 void VBoxDiskImageManagerDlg::setVisible (bool aVisible)801 {802 QMainWindow::setVisible (aVisible);803 /* Exit from the event loop if there is any and we are changing our state804 * from visible to invisible. */805 if(mEventLoop && !aVisible)806 mEventLoop->exit();807 769 } 808 770 … … 1407 1369 } 1408 1370 1409 void VBoxDiskImageManagerDlg::accept()1410 {1411 done (Accepted);1412 }1413 1414 void VBoxDiskImageManagerDlg::reject()1415 {1416 done (Rejected);1417 }1418 1419 void VBoxDiskImageManagerDlg::done (int aResult)1420 {1421 /* Set the final result */1422 setResult (aResult);1423 /* Hide this window */1424 hide();1425 /* And close the window */1426 close();1427 }1428 1429 int VBoxDiskImageManagerDlg::result() const1430 {1431 return mRescode;1432 }1433 1434 void VBoxDiskImageManagerDlg::setResult (int aRescode)1435 {1436 mRescode = aRescode;1437 }1438 1439 1371 QTreeWidget* VBoxDiskImageManagerDlg::treeWidget (VBoxDefs::DiskType aType) const 1440 1372 { … … 1552 1484 return; 1553 1485 } 1486 1487 /* Set the file for the proxy icon */ 1488 setFileForProxyIcon (item->path()); 1554 1489 1555 1490 /* Ensures current item visible every time we are switching page */ -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxNewVMWzd.cpp
r9214 r9245 197 197 VBoxDiskImageManagerDlg dlg (this); 198 198 dlg.setup (VBoxDefs::HD, true); 199 QUuid newId = dlg.exec() == VBoxDiskImageManagerDlg::Accepted ?199 QUuid newId = dlg.exec() == QDialog::Accepted ? 200 200 dlg.selectedUuid() : mMediaCombo->getId(); 201 201 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMFirstRunWzd.cpp
r9214 r9245 246 246 mRbFdType->isChecked() ? VBoxDefs::FD : VBoxDefs::InvalidType; 247 247 vdm.setup (type, true, &machineId); 248 if (vdm.exec() == VBoxDiskImageManagerDlg::Accepted)248 if (vdm.exec() == QDialog::Accepted) 249 249 { 250 250 mCbImage->setCurrentItem (vdm.selectedUuid()); -
trunk/src/VBox/Frontends/VirtualBox4/src/darwin/VBoxUtils-darwin.cpp
r8733 r9245 32 32 #include <QPixmap> 33 33 #include <QPainter> 34 #include <QApplication> 34 35 35 36 /** … … 95 96 Assert (!qpm.isNull()); 96 97 return ::darwinToCGImageRef (&qpm); 98 } 99 100 /* Proxy icon creation */ 101 QPixmap darwinCreateDragPixmap (const QPixmap& aPixmap, const QString &aText) 102 { 103 QFontMetrics fm (qApp->font()); 104 QRect tbRect = fm.boundingRect (aText); 105 const int h = qMax (aPixmap.height(), tbRect.height()); 106 const int m = 2; 107 QPixmap dragPixmap (aPixmap.width() + tbRect.width() + m, h); 108 dragPixmap.fill (Qt::transparent); 109 QPainter painter (&dragPixmap); 110 painter.drawPixmap (0, qAbs (h - aPixmap.height()) / 2.0, aPixmap); 111 painter.drawText (aPixmap.width() + m, qAbs (h - aPixmap.height()) / 2.0 + aPixmap.height(), aText); 112 painter.end(); 113 return dragPixmap; 97 114 } 98 115
Note:
See TracChangeset
for help on using the changeset viewer.