儲存庫 vbox 的更動 18397
- 時間撮記:
- 2009-3-27 下午02:11:10 (16 年 以前)
- 位置:
- trunk/src/VBox/Frontends/VirtualBox
- 檔案:
-
- 修改 4 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFilePathSelectorWidget.h
r17714 r18397 24 24 #define __VBoxFilePathSelectorWidget_h__ 25 25 26 /* VBox includes */ 26 27 #include "QIWithRetranslateUI.h" 27 28 … … 29 30 #include <QComboBox> 30 31 32 /* VBox forward declarations */ 33 class QILabel; 34 35 /* Qt forward declarations */ 31 36 class QFileIconProvider; 32 37 class QAction; 38 class QPushButton; 39 40 //////////////////////////////////////////////////////////////////////////////// 41 // VBoxFilePathSelectorWidget 33 42 34 43 class VBoxFilePathSelectorWidget: public QIWithRetranslateUI<QComboBox> … … 121 130 }; 122 131 132 //////////////////////////////////////////////////////////////////////////////// 133 // VBoxEmptyFileSelector 134 135 class VBoxEmptyFileSelector: public QIWithRetranslateUI<QWidget> 136 { 137 Q_OBJECT; 138 139 public: 140 VBoxEmptyFileSelector (QWidget *aParent = NULL); 141 142 void setPath (const QString& aPath); 143 QString path() const; 144 145 bool isModified () const { return mIsModified; } 146 void resetModified () { mIsModified = false; } 147 148 void setFileDialogTitle (const QString& aTitle); 149 QString fileDialogTitle() const; 150 151 void setFileFilters (const QString& aFilters); 152 QString fileFilters() const; 153 154 void setHomeDir (const QString& aDir); 155 QString homeDir() const; 156 157 signals: 158 void pathChanged (QString); 159 160 protected: 161 void retranslateUi(); 162 163 private slots: 164 void choose(); 165 166 private: 167 /* Private member vars */ 168 QILabel *mLabel; 169 QPushButton *mSelectButton; 170 QString mFileDialogTitle; 171 QString mFileFilters; 172 QString mHomeDir; 173 bool mIsModified; 174 QString mPath; 175 }; 176 123 177 #endif /* __VBoxFilePathSelectorWidget_h__ */ 124 178 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFilePathSelectorWidget.cpp
r17715 r18397 23 23 #include "VBoxFilePathSelectorWidget.h" 24 24 #include "VBoxGlobal.h" 25 #include "QILabel.h" 25 26 26 27 /* Qt includes */ … … 32 33 #include <QLineEdit> 33 34 #include <QTimer> 35 #include <QPushButton> 36 37 //////////////////////////////////////////////////////////////////////////////// 38 // VBoxFilePathSelectorWidget 34 39 35 40 enum … … 388 393 case Mode_File_Save: 389 394 { 390 path = VBoxGlobal::getSaveFileName (initDir, mFileFilters, parentWidget(), mFileDialogTitle); 395 path = VBoxGlobal::getSaveFileName (initDir, mFileFilters, parentWidget(), mFileDialogTitle); 391 396 if (!path.isEmpty() && QFileInfo (path).suffix().isEmpty()) 392 397 path = QString ("%1.%2").arg (path).arg (mDefaultSaveExt); … … 551 556 } 552 557 558 //////////////////////////////////////////////////////////////////////////////// 559 // VBoxEmptyFileSelector 560 561 VBoxEmptyFileSelector::VBoxEmptyFileSelector (QWidget *aParent /* = NULL */) 562 : QIWithRetranslateUI<QWidget> (aParent) 563 , mHomeDir (QDir::current().absolutePath()) 564 , mIsModified (false) 565 { 566 QHBoxLayout *mainLayout = new QHBoxLayout (this); 567 mainLayout->setMargin (0); 568 569 mSelectButton = new QPushButton (this); 570 mainLayout->addWidget (mSelectButton); 571 572 mLabel = new QILabel (this); 573 mLabel->setWordWrap (true); 574 mainLayout->addWidget (mLabel, 2); 575 576 connect (mSelectButton, SIGNAL (clicked()), 577 this, SLOT (choose())); 578 579 retranslateUi(); 580 } 581 582 void VBoxEmptyFileSelector::setPath (const QString& aPath) 583 { 584 mLabel->setText (QString ("<compact elipsis=\"start\">%1</compact>").arg (aPath)); 585 mPath = aPath; 586 } 587 588 QString VBoxEmptyFileSelector::path() const 589 { 590 return mPath; 591 } 592 593 void VBoxEmptyFileSelector::setFileDialogTitle (const QString& aTitle) 594 { 595 mFileDialogTitle = aTitle; 596 } 597 598 QString VBoxEmptyFileSelector::fileDialogTitle() const 599 { 600 return mFileDialogTitle; 601 } 602 603 void VBoxEmptyFileSelector::setFileFilters (const QString& aFilters) 604 { 605 mFileFilters = aFilters; 606 } 607 608 QString VBoxEmptyFileSelector::fileFilters() const 609 { 610 return mFileFilters; 611 } 612 613 void VBoxEmptyFileSelector::setHomeDir (const QString& aDir) 614 { 615 mHomeDir = aDir; 616 } 617 618 QString VBoxEmptyFileSelector::homeDir() const 619 { 620 return mHomeDir; 621 } 622 623 void VBoxEmptyFileSelector::retranslateUi() 624 { 625 mSelectButton->setText (tr ("&Choose...")); 626 } 627 628 void VBoxEmptyFileSelector::choose() 629 { 630 QString path = mPath; 631 632 /* Preparing initial directory. */ 633 QString initDir = path.isNull() ? mHomeDir : 634 VBoxGlobal::getFirstExistingDir (path); 635 if (initDir.isNull()) 636 initDir = mHomeDir; 637 638 path = VBoxGlobal::getOpenFileName (initDir, mFileFilters, parentWidget(), mFileDialogTitle); 639 if (!path.isEmpty()) 640 { 641 setPath (path); 642 mIsModified = true; 643 emit pathChanged (path); 644 } 645 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWzd.cpp
r18392 r18397 125 125 126 126 /* Configure the file selector */ 127 mFileSelector->setMode (VBoxFilePathSelectorWidget::Mode_File_Open);128 mFileSelector->setResetEnabled (false);129 127 mFileSelector->setFileDialogTitle (tr ("Select an appliance to import")); 130 128 mFileSelector->setFileFilters (tr ("Open Virtualization Format (%1)").arg ("*.ovf")); 131 129 mFileSelector->setHomeDir (vboxGlobal().documentsPath()); 132 #ifdef Q_WS_MAC133 /* Editable boxes are uncommon on the Mac */134 mFileSelector->setEditable (false);135 #endif /* Q_WS_MAC */136 130 137 131 /* Validator for the file selector page */ -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxImportApplianceWzd.ui
r18390 r18397 24 24 <x>0</x> 25 25 <y>0</y> 26 <width>5 50</width>27 <height> 380</height>26 <width>547</width> 27 <height>430</height> 28 28 </rect> 29 29 </property> … … 38 38 <widget class="QStackedWidget" name="mPageStack"> 39 39 <property name="currentIndex"> 40 <number> 1</number>40 <number>0</number> 41 41 </property> 42 42 <widget class="QWidget" name="mFileSelectPage"> … … 116 116 </widget> 117 117 </item> 118 <item row="1" column="1"> 119 <widget class="VBoxEmptyFileSelector" name="mFileSelector" native="true"/> 120 </item> 118 121 <item row="2" column="1"> 119 122 <spacer name="spacer"> … … 123 126 <property name="sizeHint" stdset="0"> 124 127 <size> 125 <width>408</width> 126 <height>258</height> 127 </size> 128 </property> 129 </spacer> 130 </item> 131 <item row="1" column="1"> 132 <widget class="VBoxFilePathSelectorWidget" name="mFileSelector"/> 128 <width>406</width> 129 <height>68</height> 130 </size> 131 </property> 132 </spacer> 133 133 </item> 134 134 </layout> … … 378 378 </customwidget> 379 379 <customwidget> 380 <class>VBoxFilePathSelectorWidget</class>381 <extends>QComboBox</extends>382 <header>VBoxFilePathSelectorWidget.h</header>383 </customwidget>384 <customwidget>385 380 <class>VBoxImportApplianceWgt</class> 386 381 <extends>QWidget</extends> 387 382 <header>VBoxImportApplianceWgt.h</header> 383 <container>1</container> 384 </customwidget> 385 <customwidget> 386 <class>VBoxEmptyFileSelector</class> 387 <extends>QWidget</extends> 388 <header>VBoxFilePathSelectorWidget.h</header> 388 389 <container>1</container> 389 390 </customwidget>
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器