Changeset 9296 in vbox
- Timestamp:
- Jun 2, 2008 12:58:24 PM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 4 edited
-
include/QIDialogButtonBox.h (modified) (2 diffs)
-
include/VBoxDiskImageManagerDlg.h (modified) (2 diffs)
-
src/QIDialogButtonBox.cpp (modified) (2 diffs)
-
src/VBoxDiskImageManagerDlg.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/QIDialogButtonBox.h
r9056 r9296 29 29 #include <QDialogButtonBox> 30 30 31 class QBoxLayout; 32 31 33 class QIDialogButtonBox: public QIWithRetranslateUI<QDialogButtonBox> 32 34 { … … 41 43 void setStandardButtons (StandardButtons aButtons); 42 44 45 void addExtraWidget (QWidget *aWidget); 46 void addExtraLayout (QLayout *aLayout); 47 43 48 protected: 49 50 QBoxLayout *boxLayout() const; 51 int findEmptySpace (QBoxLayout *aLayout) const; 44 52 45 53 void retranslateUi(); -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDiskImageManagerDlg.h
r9257 r9296 34 34 class VBoxToolBar; 35 35 class InfoPaneLabel; 36 class VBoxProgressBar; 36 37 37 38 class VBoxDiskImageManagerDlg : public QIWithRetranslateUI2<QIMainDialog>, … … 138 139 bool mDoSelect; 139 140 static VBoxDiskImageManagerDlg *mModelessDialog; 141 VBoxProgressBar *mProgressBar; 140 142 141 143 /* Type if we are in the select modus */ -
trunk/src/VBox/Frontends/VirtualBox4/src/QIDialogButtonBox.cpp
r9056 r9296 23 23 #include "QIDialogButtonBox.h" 24 24 25 #include <iprt/assert.h> 26 25 27 /* Qt includes */ 26 28 #include <QPushButton> 27 29 #include <QEvent> 30 #include <QBoxLayout> 28 31 29 32 QIDialogButtonBox::QIDialogButtonBox (StandardButtons aButtons, Qt::Orientation aOrientation, QWidget *aParent) … … 56 59 } 57 60 61 void QIDialogButtonBox::addExtraWidget (QWidget* aWidget) 62 { 63 QBoxLayout *layout = boxLayout(); 64 int index = findEmptySpace (layout); 65 layout->insertWidget (index + 1, aWidget); 66 layout->insertStretch(index + 2); 67 } 68 69 void QIDialogButtonBox::addExtraLayout (QLayout* aLayout) 70 { 71 QBoxLayout *layout = boxLayout(); 72 int index = findEmptySpace (layout); 73 layout->insertLayout (index + 1, aLayout); 74 layout->insertStretch(index + 2); 75 } 76 77 QBoxLayout *QIDialogButtonBox::boxLayout() const 78 { 79 QBoxLayout *boxlayout = qobject_cast<QBoxLayout*> (layout()); 80 AssertMsg (VALID_PTR (boxlayout), ("Layout of the QDialogButtonBox isn't a box layout.")); 81 return boxlayout; 82 } 83 84 int QIDialogButtonBox::findEmptySpace (QBoxLayout *aLayout) const 85 { 86 /* Search for the first occurrence of QSpacerItem and return the index. 87 * Please note that this is Qt internal, so it may change at any time. */ 88 int i=0; 89 for (; i < aLayout->count(); ++i) 90 { 91 QLayoutItem *item = aLayout->itemAt(i); 92 if (QSpacerItem *sitem = item->spacerItem()) 93 break; 94 } 95 return i; 96 } 97 58 98 void QIDialogButtonBox::retranslateUi() 59 99 { -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDiskImageManagerDlg.cpp
r9287 r9296 35 35 #include <QPushButton> 36 36 #include <QUrl> 37 #include <QProgressBar> 37 38 38 39 class AddVDMUrlsEvent: public QEvent … … 204 205 /* Private member vars */ 205 206 QLabel *mLabel; 207 }; 208 209 class VBoxProgressBar: public QWidget 210 { 211 public: 212 213 VBoxProgressBar (QWidget *aParent) 214 : QWidget (aParent) 215 { 216 QHBoxLayout *layout = new QHBoxLayout (this); 217 VBoxGlobal::setLayoutMargin (layout, 0); 218 mText = new QLabel (); 219 layout->addWidget (mText); 220 mProgressBar = new QProgressBar; 221 /* The text is provided by our own label */ 222 mProgressBar->setTextVisible (false); 223 layout->addWidget (mProgressBar); 224 } 225 226 public slots: 227 228 void setText (const QString& aText) { mText->setText (aText); } 229 void setValue (int aValue) { mProgressBar->setValue (aValue); } 230 void setMinimum (int aValue) { mProgressBar->setMinimum (aValue); } 231 void setMaximum (int aValue) { mProgressBar->setMaximum (aValue); } 232 void setRange (int aMin, int aMax) { mProgressBar->setRange (aMin, aMax); } 233 234 QLabel *label() const { return mText; } 235 QProgressBar *progressBar() const { return mProgressBar; } 236 237 private: 238 239 /* Private member vars */ 240 QLabel *mText; 241 QProgressBar *mProgressBar; 206 242 }; 207 243 … … 388 424 createInfoString (mFdsPane2, mFdsContainer, 1, 0); 389 425 390 /* enumeration progressbar creation */ 391 // mProgressText = new QLabel (centralWidget()); 392 // mProgressText->setHidden (true); 393 #warning port me 394 // buttonLayout->insertWidget (2, mProgressText); 395 // mProgressBar = new Q3ProgressBar (centralWidget()); 396 // mProgressBar->setHidden (true); 397 // mProgressBar->setFrameShadow (Q3Frame::Sunken); 398 // mProgressBar->setFrameShape (Q3Frame::Panel); 399 // mProgressBar->setPercentageVisible (false); 400 // mProgressBar->setMaximumWidth (100); 401 #warning port me 402 // buttonLayout->insertWidget (3, mProgressBar); 426 /* Enumeration progressbar creation */ 427 mProgressBar = new VBoxProgressBar (this); 428 /* Add to the dialog button box */ 429 mButtonBox->addExtraWidget (mProgressBar); 430 /* Default is invisible */ 431 mProgressBar->setVisible (false); 403 432 404 433 /* Connects for the button box */ … … 473 502 { 474 503 mediaAdded (*it); 475 // if ((*it).status != VBoxMedia::Unknown) 476 // mProgressBar->setProgress (++ index); 504 if ((*it).status != VBoxMedia::Unknown) 505 { 506 mProgressBar->setValue (++ index); 507 qApp->processEvents(); 508 } 477 509 } 478 510 … … 807 839 mFdsPane2->label()->setText (QString ("<nobr>%1:</nobr>").arg (tr ("Attached to"))); 808 840 809 // mProgressText->setText (tr ("Checking accessibility")); 810 // 841 mProgressBar->setText (tr ("Checking accessibility")); 842 #ifdef Q_WS_MAC 843 /* Make sure that the widgets aren't jumping around while the progress bar 844 * get visible. */ 845 mProgressBar->adjustSize(); 846 int h = mProgressBar->height(); 847 mButtonBox->setMinimumHeight (h + 12); 848 #endif 849 811 850 if (mHdsTree->model()->rowCount() || mCdsTree->model()->rowCount() || mFdsTree->model()->rowCount()) 812 851 refreshAll(); … … 1034 1073 mediaUpdated (aMedia); 1035 1074 Assert (aMedia.status != VBoxMedia::Unknown); 1036 // if (aMedia.status != VBoxMedia::Unknown) 1037 // mProgressBar->setProgress (aIndex + 1); 1075 if (aMedia.status != VBoxMedia::Unknown) 1076 { 1077 mProgressBar->setValue (aIndex + 1); 1078 qApp->processEvents(); 1079 } 1038 1080 } 1039 1081 1040 1082 void VBoxDiskImageManagerDlg::mediaEnumFinished (const VBoxMediaList &/* aList */) 1041 1083 { 1042 // mProgressBar->setHidden (true); 1043 // mProgressText->setHidden (true); 1084 mProgressBar->setVisible (false); 1044 1085 1045 1086 mRefreshAction->setEnabled (true); … … 1923 1964 1924 1965 /* Prepare progressbar */ 1925 //if (mProgressBar)1926 //{1927 // mProgressBar->setProgress (0,aTotal);1928 // mProgressBar->setHidden (false);1929 // mProgressText->setHidden (false);1930 //}1966 if (mProgressBar) 1967 { 1968 mProgressBar->setMaximum (aTotal); 1969 mProgressBar->setValue (0); 1970 mProgressBar->setVisible (true); 1971 } 1931 1972 1932 1973 mRefreshAction->setEnabled (false);
Note:
See TracChangeset
for help on using the changeset viewer.

