Changeset 9089 in vbox for trunk/src/VBox
- Timestamp:
- May 23, 2008 3:20:30 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h
r9072 r9089 347 347 348 348 class VBoxSharedFoldersSettings; 349 class VBoxSFDialog : public Q Dialog349 class VBoxSFDialog : public QIWithRetranslateUI<QDialog> 350 350 { 351 Q_OBJECT 351 Q_OBJECT; 352 352 353 353 public: 354 354 355 355 VBoxSFDialog (QWidget*, CSession&); 356 357 protected: 358 359 void retranslateUi(); 356 360 357 361 protected slots: -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxNewVMWzd.h
r8621 r9089 24 24 #define __VBoxNewVMWzd_h__ 25 25 26 #include <QIAbstractWizard.h> 27 #include <VBoxNewVMWzd.gen.h> 28 #include <COMDefs.h> 29 #include <QIWidgetValidator.h> 26 #include "QIAbstractWizard.h" 27 #include "VBoxNewVMWzd.gen.h" 28 #include "COMDefs.h" 29 #include "QIWidgetValidator.h" 30 #include "QIWithRetranslateUI.h" 30 31 31 class VBoxNewVMWzd : public QIAbstractWizard, public Ui::VBoxNewVMWzd 32 class VBoxNewVMWzd : public QIWithRetranslateUI<QIAbstractWizard>, 33 public Ui::VBoxNewVMWzd 32 34 { 33 35 Q_OBJECT; … … 39 41 40 42 const CMachine& machine() const; 43 44 protected: 45 46 void retranslateUi(); 41 47 42 48 private slots: -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxRegistrationDlg.h
r8648 r9089 24 24 #define __VBoxRegistrationDlg_h__ 25 25 26 #include <QIAbstractWizard.h> 27 #include <VBoxRegistrationDlg.gen.h> 28 #include <COMDefs.h> 29 #include <QIWidgetValidator.h> 26 #include "QIAbstractWizard.h" 27 #include "VBoxRegistrationDlg.gen.h" 28 #include "COMDefs.h" 29 #include "QIWidgetValidator.h" 30 #include "QIWithRetranslateUI.h" 30 31 31 32 /* Qt includes */ … … 34 35 class VBoxNetworkFramework; 35 36 36 class VBoxRegistrationDlg : public QIAbstractWizard, public Ui::VBoxRegistrationDlg 37 class VBoxRegistrationDlg : public QIWithRetranslateUI2<QIAbstractWizard>, 38 public Ui::VBoxRegistrationDlg 37 39 { 38 40 Q_OBJECT; … … 45 47 46 48 static bool hasToBeShown(); 49 50 protected: 51 52 void retranslateUi(); 47 53 48 54 private slots: -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSharedFoldersSettings.h
r8741 r9089 24 24 #define __VBoxSharedFoldersSettings_h__ 25 25 26 #include <VBoxSharedFoldersSettings.gen.h> 26 #include "VBoxSharedFoldersSettings.gen.h" 27 #include "QIWithRetranslateUI.h" 27 28 28 29 /* Qt includes */ … … 46 47 typedef QList<SFolderName> SFoldersNameList; 47 48 48 class VBoxSharedFoldersSettings : public QWidget, public Ui::VBoxSharedFoldersSettings 49 class VBoxSharedFoldersSettings : public QIWithRetranslateUI<QWidget>, 50 public Ui::VBoxSharedFoldersSettings 49 51 { 50 52 Q_OBJECT; … … 63 65 void putBackToMachine(); 64 66 void putBackToConsole(); 67 68 protected: 69 70 void retranslateUi(); 65 71 66 72 private slots: … … 103 109 }; 104 110 105 class VBoxAddSFDialog : public Q Dialog111 class VBoxAddSFDialog : public QIWithRetranslateUI<QDialog> 106 112 { 107 113 Q_OBJECT; … … 131 137 void setWritable (bool aWritable); 132 138 139 protected: 140 141 void retranslateUi(); 142 133 143 private slots: 134 144 … … 140 150 void showEvent (QShowEvent *aEvent); 141 151 142 QIDialogButtonBox *mButtonBox; 143 QLineEdit *mLePath; 144 QLineEdit *mLeName; 145 QCheckBox *mCbPermanent; 146 QCheckBox *mCbReadonly; 147 SFoldersNameList mUsedNames; 152 VBoxAddSFDialog::DialogType mType; 153 QIDialogButtonBox *mButtonBox; 154 QLabel *mLbPath; 155 QLineEdit *mLePath; 156 QToolButton *mTbPath; 157 QLabel *mLbName; 158 QLineEdit *mLeName; 159 QCheckBox *mCbPermanent; 160 QCheckBox *mCbReadonly; 161 SFoldersNameList mUsedNames; 148 162 }; 149 163 -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxTakeSnapshotDlg.h
r8743 r9089 24 24 #define __VBoxTakeSnapshotDlg_h__ 25 25 26 #include <VBoxTakeSnapshotDlg.gen.h> 26 #include "VBoxTakeSnapshotDlg.gen.h" 27 #include "QIWithRetranslateUI.h" 27 28 28 class VBoxTakeSnapshotDlg : public QDialog, public Ui::VBoxTakeSnapshotDlg 29 class VBoxTakeSnapshotDlg : public QIWithRetranslateUI<QDialog>, 30 public Ui::VBoxTakeSnapshotDlg 29 31 { 30 32 Q_OBJECT; … … 33 35 34 36 VBoxTakeSnapshotDlg (QWidget *aParent); 37 38 protected: 39 40 void retranslateUi(); 35 41 36 42 private slots: -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMFirstRunWzd.h
r8641 r9089 24 24 #define __VBoxVMFirstRunWzd_h__ 25 25 26 #include <QIAbstractWizard.h> 27 #include <VBoxVMFirstRunWzd.gen.h> 28 #include <COMDefs.h> 29 #include <QIWidgetValidator.h> 26 #include "QIAbstractWizard.h" 27 #include "VBoxVMFirstRunWzd.gen.h" 28 #include "COMDefs.h" 29 #include "QIWidgetValidator.h" 30 #include "QIWithRetranslateUI.h" 30 31 31 class VBoxVMFirstRunWzd : public QIAbstractWizard, public Ui::VBoxVMFirstRunWzd 32 class VBoxVMFirstRunWzd : public QIWithRetranslateUI<QIAbstractWizard>, 33 public Ui::VBoxVMFirstRunWzd 32 34 { 33 35 Q_OBJECT; … … 36 38 37 39 VBoxVMFirstRunWzd (const CMachine &aMachine, QWidget *aParent = 0); 40 41 protected: 42 43 void retranslateUi(); 38 44 39 45 private slots: -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp
r9072 r9089 3483 3483 3484 3484 VBoxSFDialog::VBoxSFDialog (QWidget *aParent, CSession &aSession) 3485 : Q Dialog(aParent)3485 : QIWithRetranslateUI<QDialog> (aParent) 3486 3486 , mSettings (0) 3487 3487 , mSession (aSession) … … 3489 3489 setModal (true); 3490 3490 /* Setup Dialog's options */ 3491 setWindowTitle (tr ("Shared Folders"));3492 3491 setWindowIcon (QIcon (":/select_file_16px.png")); 3493 3492 setSizeGripEnabled (true); … … 3511 3510 connect (buttonBox, SIGNAL (rejected()), this, SLOT (reject())); 3512 3511 mainLayout->addWidget (buttonBox); 3512 3513 retranslateUi(); 3514 } 3515 3516 void VBoxSFDialog::retranslateUi() 3517 { 3518 setWindowTitle (tr ("Shared Folders")); 3513 3519 } 3514 3520 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxNewHDWzd.cpp
r8621 r9089 21 21 */ 22 22 23 #include <VBoxNewHDWzd.h>24 #include <VBoxGlobal.h>25 #include <VBoxProblemReporter.h>23 #include "VBoxNewHDWzd.h" 24 #include "VBoxGlobal.h" 25 #include "VBoxProblemReporter.h" 26 26 27 27 /* Qt includes */ … … 92 92 93 93 VBoxNewHDWzd::VBoxNewHDWzd (QWidget *aParent) 94 : QI AbstractWizard(aParent)94 : QIWithRetranslateUI<QIAbstractWizard> (aParent) 95 95 { 96 96 /* Apply UI decorations */ 97 setupUi (this);97 Ui::VBoxNewHDWzd::setupUi (this); 98 98 99 99 /* Initialize wizard hdr */ … … 161 161 /* Initialize wizard ftr */ 162 162 initializeWizardFtr(); 163 164 retranslateUi(); 163 165 } 164 166 … … 177 179 } 178 180 179 180 void VBoxNewHDWzd::accept() 181 { 182 /* Try to create the hard disk when the Finish button is pressed. 183 * On failure, the wisard will remain open to give it another try. */ 184 if (createHardDisk()) 185 QIAbstractWizard::accept(); 186 } 187 188 void VBoxNewHDWzd::slSizeValueChanged (int aVal) 189 { 190 if (focusWidget() == mSlSize) 191 { 192 mCurrentSize = sliderToSizeMB (aVal, mSliderScale); 193 mLeSize->setText (vboxGlobal().formatSize (mCurrentSize * _1M)); 194 updateSizeToolTip (mCurrentSize * _1M); 195 } 196 } 197 198 void VBoxNewHDWzd::leSizeTextChanged (const QString &aText) 199 { 200 if (focusWidget() == mLeSize) 201 { 202 mCurrentSize = vboxGlobal().parseSize (aText); 203 updateSizeToolTip (mCurrentSize); 204 mCurrentSize /= _1M; 205 mSlSize->setValue (sizeMBToSlider (mCurrentSize, mSliderScale)); 206 } 207 } 208 209 void VBoxNewHDWzd::tbNameSelectClicked() 210 { 211 /* set the first parent directory that exists as the current */ 212 QFileInfo fld (composeFullFileName (mLeName->text())); 213 do 214 { 215 QString dp = fld.path (); 216 fld = QFileInfo (dp); 217 } 218 while (!fld.exists() && !QDir (fld.absoluteFilePath()).isRoot()); 219 220 if (!fld.exists()) 221 { 222 CVirtualBox vbox = vboxGlobal().virtualBox(); 223 fld = QFileInfo (vbox.GetSystemProperties().GetDefaultVDIFolder()); 224 if (!fld.exists()) 225 fld = vbox.GetHomeFolder(); 226 } 227 228 QString selected = QFileDialog::getSaveFileName ( 229 this, 230 tr ("Select a file for the new hard disk image file"), 231 fld.absoluteFilePath(), 232 tr ("Hard disk images (*.vdi)")); 233 234 if (!selected.isEmpty()) 235 { 236 if (QFileInfo (selected).completeSuffix().isEmpty()) 237 selected += ".vdi"; 238 mLeName->setText (QDir::convertSeparators (selected)); 239 mLeName->selectAll(); 240 mLeName->setFocus(); 241 } 242 } 243 244 void VBoxNewHDWzd::revalidate (QIWidgetValidator *aWval) 245 { 246 /* do individual validations for pages */ 247 bool valid = aWval->isOtherValid(); 248 249 if (aWval == mWvalNameAndSize) 250 valid = mCurrentSize >= MinVDISize && mCurrentSize <= mMaxVDISize; 251 252 aWval->setOtherValid (valid); 253 } 254 255 void VBoxNewHDWzd::enableNext (const QIWidgetValidator *aWval) 256 { 257 nextButton (aWval->widget())->setEnabled (aWval->isValid()); 258 } 259 260 void VBoxNewHDWzd::onPageShow() 261 { 181 void VBoxNewHDWzd::retranslateUi() 182 { 183 /* Translate uic generated strings */ 184 Ui::VBoxNewHDWzd::retranslateUi (this); 185 262 186 QWidget *page = mPageStack->currentWidget(); 263 187 264 if (page == mPageWelcome) 265 nextButton (page)->setFocus(); 266 else if (page == mPageType) 267 mRbDynamicType->isChecked() ? mRbDynamicType->setFocus() : 268 mRbFixedType->setFocus(); 269 else if (page == mPageNameAndSize) 270 mLeName->setFocus(); 271 else if (page == mPageSummary) 188 if (page == mPageSummary) 272 189 { 273 190 QString type = mRbDynamicType->isChecked() ? mRbDynamicType->text() … … 291 208 292 209 mTeSummary->setText (summary); 210 } 211 } 212 213 void VBoxNewHDWzd::accept() 214 { 215 /* Try to create the hard disk when the Finish button is pressed. 216 * On failure, the wisard will remain open to give it another try. */ 217 if (createHardDisk()) 218 QIAbstractWizard::accept(); 219 } 220 221 void VBoxNewHDWzd::slSizeValueChanged (int aVal) 222 { 223 if (focusWidget() == mSlSize) 224 { 225 mCurrentSize = sliderToSizeMB (aVal, mSliderScale); 226 mLeSize->setText (vboxGlobal().formatSize (mCurrentSize * _1M)); 227 updateSizeToolTip (mCurrentSize * _1M); 228 } 229 } 230 231 void VBoxNewHDWzd::leSizeTextChanged (const QString &aText) 232 { 233 if (focusWidget() == mLeSize) 234 { 235 mCurrentSize = vboxGlobal().parseSize (aText); 236 updateSizeToolTip (mCurrentSize); 237 mCurrentSize /= _1M; 238 mSlSize->setValue (sizeMBToSlider (mCurrentSize, mSliderScale)); 239 } 240 } 241 242 void VBoxNewHDWzd::tbNameSelectClicked() 243 { 244 /* set the first parent directory that exists as the current */ 245 QFileInfo fld (composeFullFileName (mLeName->text())); 246 do 247 { 248 QString dp = fld.path (); 249 fld = QFileInfo (dp); 250 } 251 while (!fld.exists() && !QDir (fld.absoluteFilePath()).isRoot()); 252 253 if (!fld.exists()) 254 { 255 CVirtualBox vbox = vboxGlobal().virtualBox(); 256 fld = QFileInfo (vbox.GetSystemProperties().GetDefaultVDIFolder()); 257 if (!fld.exists()) 258 fld = vbox.GetHomeFolder(); 259 } 260 261 QString selected = QFileDialog::getSaveFileName ( 262 this, 263 tr ("Select a file for the new hard disk image file"), 264 fld.absoluteFilePath(), 265 tr ("Hard disk images (*.vdi)")); 266 267 if (!selected.isEmpty()) 268 { 269 if (QFileInfo (selected).completeSuffix().isEmpty()) 270 selected += ".vdi"; 271 mLeName->setText (QDir::convertSeparators (selected)); 272 mLeName->selectAll(); 273 mLeName->setFocus(); 274 } 275 } 276 277 void VBoxNewHDWzd::revalidate (QIWidgetValidator *aWval) 278 { 279 /* do individual validations for pages */ 280 bool valid = aWval->isOtherValid(); 281 282 if (aWval == mWvalNameAndSize) 283 valid = mCurrentSize >= MinVDISize && mCurrentSize <= mMaxVDISize; 284 285 aWval->setOtherValid (valid); 286 } 287 288 void VBoxNewHDWzd::enableNext (const QIWidgetValidator *aWval) 289 { 290 nextButton (aWval->widget())->setEnabled (aWval->isValid()); 291 } 292 293 void VBoxNewHDWzd::onPageShow() 294 { 295 /* Make sure all is properly translated & composed */ 296 retranslateUi(); 297 298 QWidget *page = mPageStack->currentWidget(); 299 300 if (page == mPageWelcome) 301 nextButton (page)->setFocus(); 302 else if (page == mPageType) 303 mRbDynamicType->isChecked() ? mRbDynamicType->setFocus() : 304 mRbFixedType->setFocus(); 305 else if (page == mPageNameAndSize) 306 mLeName->setFocus(); 307 else if (page == mPageSummary) 293 308 mTeSummary->setFocus(); 294 }295 309 296 310 if (page == mPageSummary) -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxNewVMWzd.cpp
r8875 r9089 21 21 */ 22 22 23 #include <VBoxNewVMWzd.h>24 #include <VBoxUtils.h>25 #include <VBoxGlobal.h>26 #include <VBoxProblemReporter.h>27 #include <VBoxNewHDWzd.h>28 #include <VBoxDiskImageManagerDlg.h>23 #include "VBoxNewVMWzd.h" 24 #include "VBoxUtils.h" 25 #include "VBoxGlobal.h" 26 #include "VBoxProblemReporter.h" 27 #include "VBoxNewHDWzd.h" 28 #include "VBoxDiskImageManagerDlg.h" 29 29 30 30 /** … … 50 50 51 51 VBoxNewVMWzd::VBoxNewVMWzd (QWidget *aParent) 52 : QI AbstractWizard(aParent)52 : QIWithRetranslateUI<QIAbstractWizard> (aParent) 53 53 { 54 54 /* Apply UI decorations */ 55 setupUi (this);55 Ui::VBoxNewVMWzd::setupUi (this); 56 56 57 57 /* Initialize wizard hdr */ … … 110 110 mSlRAM->setRange ((MinRAM / mSlRAM->pageStep()) * mSlRAM->pageStep(), 111 111 MaxRAM); 112 mTxRAMMin->setText (tr ("<qt>%1 MB</qt>").arg (MinRAM));113 mTxRAMMax->setText (tr ("<qt>%1 MB</qt>").arg (MaxRAM));114 112 /* Initial RAM value is set in cbOSActivated() 115 113 * limit min/max. size of QLineEdit */ … … 129 127 /* Initialize wizard ftr */ 130 128 initializeWizardFtr(); 129 130 retranslateUi(); 131 131 } 132 132 … … 141 141 } 142 142 143 void VBoxNewVMWzd::retranslateUi() 144 { 145 /* Translate uic generated strings */ 146 Ui::VBoxNewVMWzd::retranslateUi (this); 147 148 CGuestOSType type = vboxGlobal().vmGuestOSType (mCbOS->currentIndex()); 149 150 mTextRAMBest->setText ( 151 tr ("The recommended base memory size is <b>%1</b> MB.") 152 .arg (type.GetRecommendedRAM())); 153 mSlRAM->setValue (type.GetRecommendedRAM()); 154 mTextVDIBest->setText ( 155 tr ("The recommended size of the boot hard disk is <b>%1</b> MB.") 156 .arg (type.GetRecommendedHDD())); 157 158 CSystemProperties sysProps = vboxGlobal().virtualBox().GetSystemProperties(); 159 const uint MinRAM = sysProps.GetMinGuestRAM(); 160 const uint MaxRAM = sysProps.GetMaxGuestRAM(); 161 162 mTxRAMMin->setText (tr ("<qt>%1 MB</qt>").arg (MinRAM)); 163 mTxRAMMax->setText (tr ("<qt>%1 MB</qt>").arg (MaxRAM)); 164 165 QWidget *page = mPageStack->currentWidget(); 166 167 if (page == mPageSummary) 168 { 169 /* compose summary */ 170 QString summary = QString (tr ( 171 "<tr><td><nobr>Name:</nobr></td><td>%1</td></tr>" 172 "<tr><td><nobr>OS Type:</nobr></td><td>%2<</td></tr>" 173 "<tr><td><nobr>Base Memory:</nobr></td><td>%3 MB</td></tr>")) 174 .arg (mLeName->text()) 175 .arg (vboxGlobal().vmGuestOSType (mCbOS->currentIndex()).GetDescription()) 176 .arg (mSlRAM->value()); 177 178 if (mMediaCombo->currentIndex()) 179 summary += QString (tr ( 180 "<tr><td><nobr>Boot Hard Disk:</nobr></td><td>%4</td></tr>")) 181 .arg (mMediaCombo->currentText()); 182 183 mTeSummary->setText ("<table cellspacing=0 cellpadding=2>" + summary + "</table>"); 184 } 185 } 143 186 144 187 void VBoxNewVMWzd::accept() … … 210 253 CGuestOSType type = vboxGlobal().vmGuestOSType (aItem); 211 254 mPmOS->setPixmap (vboxGlobal().vmGuestOSTypeIcon (type.GetId())); 212 mTextRAMBest->setText (213 tr ("The recommended base memory size is <b>%1</b> MB.")214 .arg (type.GetRecommendedRAM()));215 mSlRAM->setValue (type.GetRecommendedRAM());216 mTextVDIBest->setText (217 tr ("The recommended size of the boot hard disk is <b>%1</b> MB.")218 .arg (type.GetRecommendedHDD()));219 255 } 220 256 … … 247 283 void VBoxNewVMWzd::onPageShow() 248 284 { 285 /* Make sure all is properly translated & composed */ 286 retranslateUi(); 287 249 288 QWidget *page = mPageStack->currentWidget(); 250 289 … … 258 297 mMediaCombo->setFocus(); 259 298 else if (page == mPageSummary) 260 {261 /* compose summary */262 QString summary = QString (tr (263 "<tr><td><nobr>Name:</nobr></td><td>%1</td></tr>"264 "<tr><td><nobr>OS Type:</nobr></td><td>%2<</td></tr>"265 "<tr><td><nobr>Base Memory:</nobr></td><td>%3 MB</td></tr>"))266 .arg (mLeName->text())267 .arg (vboxGlobal().vmGuestOSType (mCbOS->currentIndex()).GetDescription())268 .arg (mSlRAM->value());269 270 if (mMediaCombo->currentIndex())271 summary += QString (tr (272 "<tr><td><nobr>Boot Hard Disk:</nobr></td><td>%4</td></tr>"))273 .arg (mMediaCombo->currentText());274 275 mTeSummary->setText ("<table cellspacing=0 cellpadding=2>" + summary + "</table>");276 299 mTeSummary->setFocus(); 277 }278 300 279 301 if (page == mPageSummary) -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxRegistrationDlg.cpp
r8648 r9089 21 21 */ 22 22 23 #include <VBoxRegistrationDlg.h>24 #include <VBoxGlobal.h>25 #include <VBoxProblemReporter.h>26 #include <VBoxNetworkFramework.h>23 #include "VBoxRegistrationDlg.h" 24 #include "VBoxGlobal.h" 25 #include "VBoxProblemReporter.h" 26 #include "VBoxNetworkFramework.h" 27 27 28 28 /* Qt includes */ … … 197 197 QWidget *aParent, 198 198 Qt::WindowFlags aFlags) 199 : QI AbstractWizard(aParent, aFlags)199 : QIWithRetranslateUI2<QIAbstractWizard> (aParent, aFlags) 200 200 , mSelf (aSelf) 201 201 , mWvalReg (0) … … 211 211 212 212 /* Apply UI decorations */ 213 setupUi (this);213 Ui::VBoxRegistrationDlg::setupUi (this); 214 214 215 215 /* Initialize wizard hdr */ … … 261 261 /* Initialize wizard hdr */ 262 262 initializeWizardFtr(); 263 264 retranslateUi(); 263 265 } 264 266 … … 284 286 return !regData.isValid() || 285 287 (!regData.isRegistered() && regData.triesLeft() > 0); 288 } 289 290 void VBoxRegistrationDlg::retranslateUi() 291 { 292 /* Translate uic generated strings */ 293 Ui::VBoxRegistrationDlg::retranslateUi (this); 286 294 } 287 295 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSharedFoldersSettings.cpp
r8783 r9089 173 173 VBoxSharedFoldersSettings::VBoxSharedFoldersSettings (QWidget *aParent, 174 174 int aType) 175 : Q Widget(aParent)175 : QIWithRetranslateUI<QWidget> (aParent) 176 176 , mDialogType (aType) 177 177 , mIsListViewChanged (false) 178 , mTrFull (tr ("Full"))179 , mTrReadOnly (tr ("Read-only"))180 178 { 181 179 /* Apply UI decorations */ 182 setupUi (this);180 Ui::VBoxSharedFoldersSettings::setupUi (this); 183 181 184 182 mTreeView->header()->setMovable (false); … … 225 223 } 226 224 mTreeView->sortItems (0, Qt::Ascending); 225 226 retranslateUi(); 227 227 } 228 228 … … 297 297 } 298 298 299 void VBoxSharedFoldersSettings::retranslateUi() 300 { 301 /* Translate uic generated strings */ 302 Ui::VBoxSharedFoldersSettings::retranslateUi (this); 303 304 mTrFull = tr ("Full"); 305 mTrReadOnly = tr ("Read-only"); 306 } 299 307 300 308 void VBoxSharedFoldersSettings::tbAddPressed() … … 657 665 bool aEnableSelector, 658 666 const SFoldersNameList &aUsedNames) 659 : Q Dialog(aParent)660 , m LePath (0), mLeName (0), mCbPermanent (0), mCbReadonly (0)667 : QIWithRetranslateUI<QDialog> (aParent) 668 , mType(aType), mLePath (0), mLeName (0), mCbPermanent (0), mCbReadonly (0) 661 669 , mUsedNames (aUsedNames) 662 670 { 663 671 setModal (true); 664 672 665 switch (aType) 673 QVBoxLayout *mainLayout = new QVBoxLayout (this); 674 675 /* Setup Input layout */ 676 QGridLayout *inputLayout = new QGridLayout (); 677 mainLayout->addLayout (inputLayout); 678 mLbPath = new QLabel (this); 679 mLePath = new QLineEdit (this); 680 mTbPath = new QToolButton (this); 681 mTbPath->setAutoRaise (true); 682 mLbName = new QLabel (this); 683 mLeName = new QLineEdit (this); 684 mTbPath->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png", 685 ":/select_file_dis_16px.png")); 686 mTbPath->setFocusPolicy (Qt::TabFocus); 687 connect (mLePath, SIGNAL (textChanged (const QString &)), 688 this, SLOT (validate())); 689 connect (mLeName, SIGNAL (textChanged (const QString &)), 690 this, SLOT (validate())); 691 connect (mTbPath, SIGNAL (clicked()), this, SLOT (showFileDialog())); 692 mCbReadonly = new QCheckBox (this); 693 mCbReadonly->setChecked (false); 694 695 inputLayout->addWidget (mLbPath, 0, 0); 696 inputLayout->addWidget (mLePath, 0, 1); 697 inputLayout->addWidget (mTbPath, 0, 2); 698 inputLayout->addWidget (mLbName, 1, 0); 699 inputLayout->addWidget (mLeName, 1, 1, 1, 2); 700 inputLayout->addWidget (mCbReadonly, 2, 0, 1, 3); 701 702 if (aEnableSelector) 703 { 704 mCbPermanent = new QCheckBox (this); 705 mCbPermanent->setChecked (true); 706 inputLayout->addWidget (mCbPermanent, 3, 0, 1, 3); 707 connect (mCbPermanent, SIGNAL (toggled (bool)), 708 this, SLOT (validate())); 709 } 710 711 /* Setup Button layout */ 712 mButtonBox = new QIDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 713 mButtonBox->setCenterButtons (true); 714 connect (mButtonBox, SIGNAL (accepted()), this, SLOT (accept())); 715 connect (mButtonBox, SIGNAL (rejected()), this, SLOT (reject())); 716 mainLayout->addWidget (mButtonBox); 717 718 /* Validate fields */ 719 validate(); 720 721 retranslateUi(); 722 } 723 724 QString VBoxAddSFDialog::getPath() 725 { 726 return mLePath->text(); 727 } 728 QString VBoxAddSFDialog::getName() 729 { 730 return mLeName->text(); 731 } 732 bool VBoxAddSFDialog::getPermanent() 733 { 734 return mCbPermanent ? mCbPermanent->isChecked() : true; 735 } 736 bool VBoxAddSFDialog::getWritable() 737 { 738 return !mCbReadonly->isChecked(); 739 } 740 741 void VBoxAddSFDialog::setPath (const QString &aPath) 742 { 743 mLePath->setText (aPath); 744 } 745 void VBoxAddSFDialog::setName (const QString &aName) 746 { 747 mLeName->setText (aName); 748 } 749 void VBoxAddSFDialog::setPermanent (bool aPermanent) 750 { 751 if (mCbPermanent) 752 { 753 mCbPermanent->setChecked (aPermanent); 754 mCbPermanent->setEnabled (!aPermanent); 755 } 756 } 757 void VBoxAddSFDialog::setWritable (bool aWritable) 758 { 759 mCbReadonly->setChecked (!aWritable); 760 } 761 762 void VBoxAddSFDialog::retranslateUi() 763 { 764 switch (mType) 666 765 { 667 766 case AddDialogType: … … 675 774 } 676 775 677 QVBoxLayout *mainLayout = new QVBoxLayout (this); 678 679 /* Setup Input layout */ 680 QGridLayout *inputLayout = new QGridLayout (); 681 mainLayout->addLayout (inputLayout); 682 QLabel *lbPath = new QLabel (tr ("Folder Path"), this); 683 mLePath = new QLineEdit (this); 684 QToolButton *tbPath = new QToolButton (this); 685 tbPath->setAutoRaise (true); 686 QLabel *lbName = new QLabel (tr ("Folder Name"), this); 687 mLeName = new QLineEdit (this); 688 tbPath->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png", 689 ":/select_file_dis_16px.png")); 690 tbPath->setFocusPolicy (Qt::TabFocus); 691 connect (mLePath, SIGNAL (textChanged (const QString &)), 692 this, SLOT (validate())); 693 connect (mLeName, SIGNAL (textChanged (const QString &)), 694 this, SLOT (validate())); 695 connect (tbPath, SIGNAL (clicked()), this, SLOT (showFileDialog())); 776 mLbPath->setText (tr ("Folder Path")); 696 777 mLePath->setWhatsThis (tr ("Displays the path to an existing folder " 697 778 "on the host PC.")); 779 780 mLbName->setText (tr ("Folder Name")); 698 781 mLeName->setWhatsThis (tr ("Displays the name of the shared folder " 699 782 "(as it will be seen by the guest OS).")); 700 tbPath->setWhatsThis (tr ("Opens the dialog to select a folder.")); 701 mCbReadonly = new QCheckBox (tr ("&Read-only"), this); 702 mCbReadonly->setChecked (false); 783 784 mTbPath->setWhatsThis (tr ("Opens the dialog to select a folder.")); 785 786 mCbReadonly->setText (tr ("&Read-only")); 703 787 mCbReadonly->setWhatsThis (tr ("When checked, the guest OS will not " 704 788 "be able to write to the specified " 705 789 "shared folder.")); 706 790 707 inputLayout->addWidget (lbPath, 0, 0);708 inputLayout->addWidget (mLePath, 0, 1);709 inputLayout->addWidget (tbPath, 0, 2);710 inputLayout->addWidget (lbName, 1, 0);711 inputLayout->addWidget (mLeName, 1, 1, 1, 2);712 inputLayout->addWidget (mCbReadonly, 2, 0, 1, 3);713 714 if (aEnableSelector)715 {716 mCbPermanent = new QCheckBox (tr ("&Make Permanent"), this);717 mCbPermanent->setChecked (true);718 inputLayout->addWidget (mCbPermanent, 3, 0, 1, 3);719 connect (mCbPermanent, SIGNAL (toggled (bool)),720 this, SLOT (validate()));721 }722 723 /* Setup Button layout */724 mButtonBox = new QIDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);725 mButtonBox->setCenterButtons (true);726 connect (mButtonBox, SIGNAL (accepted()), this, SLOT (accept()));727 connect (mButtonBox, SIGNAL (rejected()), this, SLOT (reject()));728 mainLayout->addWidget (mButtonBox);729 730 /* Validate fields */731 validate();732 }733 734 QString VBoxAddSFDialog::getPath()735 {736 return mLePath->text();737 }738 QString VBoxAddSFDialog::getName()739 {740 return mLeName->text();741 }742 bool VBoxAddSFDialog::getPermanent()743 {744 return mCbPermanent ? mCbPermanent->isChecked() : true;745 }746 bool VBoxAddSFDialog::getWritable()747 {748 return !mCbReadonly->isChecked();749 }750 751 void VBoxAddSFDialog::setPath (const QString &aPath)752 {753 mLePath->setText (aPath);754 }755 void VBoxAddSFDialog::setName (const QString &aName)756 {757 mLeName->setText (aName);758 }759 void VBoxAddSFDialog::setPermanent (bool aPermanent)760 {761 791 if (mCbPermanent) 762 { 763 mCbPermanent->setChecked (aPermanent); 764 mCbPermanent->setEnabled (!aPermanent); 765 } 766 } 767 void VBoxAddSFDialog::setWritable (bool aWritable) 768 { 769 mCbReadonly->setChecked (!aWritable); 792 mCbPermanent->setText (tr ("&Make Permanent")); 770 793 } 771 794 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxTakeSnapshotDlg.cpp
r8743 r9089 21 21 */ 22 22 23 #include <VBoxTakeSnapshotDlg.h>24 #include <VBoxProblemReporter.h>25 #include <VBoxUtils.h>23 #include "VBoxTakeSnapshotDlg.h" 24 #include "VBoxProblemReporter.h" 25 #include "VBoxUtils.h" 26 26 27 27 /* Qt includes */ … … 29 29 30 30 VBoxTakeSnapshotDlg::VBoxTakeSnapshotDlg (QWidget *aParent) 31 : Q Dialog(aParent)31 : QIWithRetranslateUI<QDialog> (aParent) 32 32 { 33 33 /* Apply UI decorations */ 34 setupUi (this);34 Ui::VBoxTakeSnapshotDlg::setupUi (this); 35 35 36 36 QIAltKeyFilter *af = new QIAltKeyFilter (this); … … 42 42 connect (mLeName, SIGNAL (textChanged (const QString &)), 43 43 this, SLOT (nameChanged (const QString &))); 44 45 retranslateUi(); 46 } 47 48 void VBoxTakeSnapshotDlg::retranslateUi() 49 { 50 /* Translate uic generated strings */ 51 Ui::VBoxTakeSnapshotDlg::retranslateUi (this); 44 52 } 45 53 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMFirstRunWzd.cpp
r8641 r9089 21 21 */ 22 22 23 #include <VBoxVMFirstRunWzd.h>24 #include <VBoxGlobal.h>25 #include <VBoxDiskImageManagerDlg.h>23 #include "VBoxVMFirstRunWzd.h" 24 #include "VBoxGlobal.h" 25 #include "VBoxDiskImageManagerDlg.h" 26 26 27 27 VBoxVMFirstRunWzd::VBoxVMFirstRunWzd (const CMachine &aMachine, QWidget *aParent) 28 : QI AbstractWizard(aParent)28 : QIWithRetranslateUI<QIAbstractWizard> (aParent) 29 29 , mMachine (aMachine) 30 30 { 31 31 /* Apply UI decorations */ 32 setupUi (this);32 Ui::VBoxVMFirstRunWzd::setupUi (this); 33 33 34 34 /* Initialize wizard hdr */ … … 77 77 /* Initialize wizard ftr */ 78 78 initializeWizardFtr(); 79 } 80 81 void VBoxVMFirstRunWzd::accept() 82 { 83 /* CD/DVD Media selected */ 84 if (mRbCdType->isChecked()) 85 { 86 if (mRbHost->isChecked()) 87 { 88 CHostDVDDrive hostDrive = mHostDVDs [mCbHost->currentIndex()]; 89 if (!hostDrive.isNull()) 90 { 91 CDVDDrive virtualDrive = mMachine.GetDVDDrive(); 92 virtualDrive.CaptureHostDrive (hostDrive); 93 } 94 } 95 else if (mRbImage->isChecked()) 96 { 97 CDVDDrive virtualDrive = mMachine.GetDVDDrive(); 98 virtualDrive.MountImage (mCbImage->getId()); 99 } 100 } 101 /* Floppy Media selected */ 102 else if (mRbFdType->isChecked()) 103 { 104 if (mRbHost->isChecked()) 105 { 106 CHostFloppyDrive hostDrive = mHostFloppys [mCbHost->currentIndex()]; 107 if (!hostDrive.isNull()) 108 { 109 CFloppyDrive virtualDrive = mMachine.GetFloppyDrive(); 110 virtualDrive.CaptureHostDrive (hostDrive); 111 } 112 } 113 else if (mRbImage->isChecked()) 114 { 115 CFloppyDrive virtualDrive = mMachine.GetFloppyDrive(); 116 virtualDrive.MountImage (mCbImage->getId()); 117 } 118 } 119 120 QIAbstractWizard::accept(); 121 } 122 123 void VBoxVMFirstRunWzd::revalidate (QIWidgetValidator *aWval) 124 { 125 /* do individual validations for pages */ 126 QWidget *pg = aWval->widget(); 127 bool valid = aWval->isOtherValid(); 128 129 if (pg == mPageMedia) 130 { 131 valid = (mRbHost->isChecked() && !mCbHost->currentText().isEmpty()) || 132 (mRbImage->isChecked() && !mCbImage->currentText().isEmpty()); 133 } 134 135 aWval->setOtherValid (valid); 136 } 137 138 void VBoxVMFirstRunWzd::mediaTypeChanged() 139 { 140 /* CD/DVD Media type selected */ 141 mCbHost->clear(); 142 if (sender() == mRbCdType) 143 { 144 /* Search for the host dvd-drives */ 145 CHostDVDDriveCollection coll = 146 vboxGlobal().virtualBox().GetHost().GetDVDDrives(); 147 mHostDVDs.resize (coll.GetCount()); 148 int id = 0; 149 CHostDVDDriveEnumerator en = coll.Enumerate(); 150 while (en.HasMore()) 151 { 152 CHostDVDDrive hostDVD = en.GetNext(); 153 QString name = hostDVD.GetName(); 154 QString description = hostDVD.GetDescription(); 155 QString fullName = description.isEmpty() ? 156 name : QString ("%1 (%2)").arg (description, name); 157 mCbHost->insertItem (id, fullName); 158 mHostDVDs [id] = hostDVD; 159 ++ id; 160 } 161 162 /* Switch media images type to CD */ 163 mCbImage->setType (VBoxDefs::CD); 164 } 165 /* Floppy media type selected */ 166 else if (sender() == mRbFdType) 167 { 168 /* Search for the host floppy-drives */ 169 CHostFloppyDriveCollection coll = 170 vboxGlobal().virtualBox().GetHost().GetFloppyDrives(); 171 mHostFloppys.resize (coll.GetCount()); 172 int id = 0; 173 CHostFloppyDriveEnumerator en = coll.Enumerate(); 174 while (en.HasMore()) 175 { 176 CHostFloppyDrive hostFloppy = en.GetNext(); 177 QString name = hostFloppy.GetName(); 178 QString description = hostFloppy.GetDescription(); 179 QString fullName = description.isEmpty() ? 180 name : QString ("%1 (%2)").arg (description, name); 181 mCbHost->insertItem (id, fullName); 182 mHostFloppys [id] = hostFloppy; 183 ++ id; 184 } 185 186 /* Switch media images type to FD */ 187 mCbImage->setType (VBoxDefs::FD); 188 } 189 /* Update media images list */ 190 if (!vboxGlobal().isMediaEnumerationStarted()) 191 vboxGlobal().startEnumeratingMedia(); 192 else 193 mCbImage->refresh(); 194 195 /* Revalidate updated page */ 196 mWvalType->revalidate(); 197 } 198 199 void VBoxVMFirstRunWzd::mediaSourceChanged() 200 { 201 mCbHost->setEnabled (sender() == mRbHost); 202 mCbImage->setEnabled (sender() == mRbImage); 203 mTbVdm->setEnabled (sender() == mRbImage); 204 205 /* Revalidate updated page */ 206 mWvalType->revalidate(); 207 } 208 209 void VBoxVMFirstRunWzd::openVdm() 210 { 211 VBoxDiskImageManagerDlg vdm (this, "VBoxDiskImageManagerDlg", 212 Qt::WType_Dialog | Qt::WShowModal); 213 QUuid machineId = mMachine.GetId(); 214 VBoxDefs::DiskType type = mRbCdType->isChecked() ? VBoxDefs::CD : 215 mRbFdType->isChecked() ? VBoxDefs::FD : VBoxDefs::InvalidType; 216 vdm.setup (type, true, &machineId); 217 if (vdm.exec() == VBoxDiskImageManagerDlg::Accepted) 218 { 219 mCbImage->setCurrentItem (vdm.getSelectedUuid()); 220 221 /* Revalidate updated page */ 222 mWvalType->revalidate(); 223 } 224 } 225 226 void VBoxVMFirstRunWzd::enableNext (const QIWidgetValidator *aWval) 227 { 228 nextButton (aWval->widget())->setEnabled (aWval->isValid()); 229 } 230 231 void VBoxVMFirstRunWzd::onPageShow() 232 { 79 80 retranslateUi(); 81 } 82 83 void VBoxVMFirstRunWzd::retranslateUi() 84 { 85 /* Translate uic generated strings */ 86 Ui::VBoxVMFirstRunWzd::retranslateUi (this); 87 233 88 QWidget *page = mPageStack->currentWidget(); 234 89 235 if (page == mPageWelcome) 236 nextButton (page)->setFocus(); 237 else if (page == mPageMedia) 238 mRbCdType->isChecked() ? mRbCdType->setFocus() : 239 mRbFdType->setFocus(); 240 else if (page == mPageSummary) 90 if (page == mPageSummary) 241 91 { 242 92 /* compose summary */ … … 258 108 259 109 mTeSummary->setText (summary); 110 } 111 } 112 113 void VBoxVMFirstRunWzd::accept() 114 { 115 /* CD/DVD Media selected */ 116 if (mRbCdType->isChecked()) 117 { 118 if (mRbHost->isChecked()) 119 { 120 CHostDVDDrive hostDrive = mHostDVDs [mCbHost->currentIndex()]; 121 if (!hostDrive.isNull()) 122 { 123 CDVDDrive virtualDrive = mMachine.GetDVDDrive(); 124 virtualDrive.CaptureHostDrive (hostDrive); 125 } 126 } 127 else if (mRbImage->isChecked()) 128 { 129 CDVDDrive virtualDrive = mMachine.GetDVDDrive(); 130 virtualDrive.MountImage (mCbImage->getId()); 131 } 132 } 133 /* Floppy Media selected */ 134 else if (mRbFdType->isChecked()) 135 { 136 if (mRbHost->isChecked()) 137 { 138 CHostFloppyDrive hostDrive = mHostFloppys [mCbHost->currentIndex()]; 139 if (!hostDrive.isNull()) 140 { 141 CFloppyDrive virtualDrive = mMachine.GetFloppyDrive(); 142 virtualDrive.CaptureHostDrive (hostDrive); 143 } 144 } 145 else if (mRbImage->isChecked()) 146 { 147 CFloppyDrive virtualDrive = mMachine.GetFloppyDrive(); 148 virtualDrive.MountImage (mCbImage->getId()); 149 } 150 } 151 152 QIAbstractWizard::accept(); 153 } 154 155 void VBoxVMFirstRunWzd::revalidate (QIWidgetValidator *aWval) 156 { 157 /* do individual validations for pages */ 158 QWidget *pg = aWval->widget(); 159 bool valid = aWval->isOtherValid(); 160 161 if (pg == mPageMedia) 162 { 163 valid = (mRbHost->isChecked() && !mCbHost->currentText().isEmpty()) || 164 (mRbImage->isChecked() && !mCbImage->currentText().isEmpty()); 165 } 166 167 aWval->setOtherValid (valid); 168 } 169 170 void VBoxVMFirstRunWzd::mediaTypeChanged() 171 { 172 /* CD/DVD Media type selected */ 173 mCbHost->clear(); 174 if (sender() == mRbCdType) 175 { 176 /* Search for the host dvd-drives */ 177 CHostDVDDriveCollection coll = 178 vboxGlobal().virtualBox().GetHost().GetDVDDrives(); 179 mHostDVDs.resize (coll.GetCount()); 180 int id = 0; 181 CHostDVDDriveEnumerator en = coll.Enumerate(); 182 while (en.HasMore()) 183 { 184 CHostDVDDrive hostDVD = en.GetNext(); 185 QString name = hostDVD.GetName(); 186 QString description = hostDVD.GetDescription(); 187 QString fullName = description.isEmpty() ? 188 name : QString ("%1 (%2)").arg (description, name); 189 mCbHost->insertItem (id, fullName); 190 mHostDVDs [id] = hostDVD; 191 ++ id; 192 } 193 194 /* Switch media images type to CD */ 195 mCbImage->setType (VBoxDefs::CD); 196 } 197 /* Floppy media type selected */ 198 else if (sender() == mRbFdType) 199 { 200 /* Search for the host floppy-drives */ 201 CHostFloppyDriveCollection coll = 202 vboxGlobal().virtualBox().GetHost().GetFloppyDrives(); 203 mHostFloppys.resize (coll.GetCount()); 204 int id = 0; 205 CHostFloppyDriveEnumerator en = coll.Enumerate(); 206 while (en.HasMore()) 207 { 208 CHostFloppyDrive hostFloppy = en.GetNext(); 209 QString name = hostFloppy.GetName(); 210 QString description = hostFloppy.GetDescription(); 211 QString fullName = description.isEmpty() ? 212 name : QString ("%1 (%2)").arg (description, name); 213 mCbHost->insertItem (id, fullName); 214 mHostFloppys [id] = hostFloppy; 215 ++ id; 216 } 217 218 /* Switch media images type to FD */ 219 mCbImage->setType (VBoxDefs::FD); 220 } 221 /* Update media images list */ 222 if (!vboxGlobal().isMediaEnumerationStarted()) 223 vboxGlobal().startEnumeratingMedia(); 224 else 225 mCbImage->refresh(); 226 227 /* Revalidate updated page */ 228 mWvalType->revalidate(); 229 } 230 231 void VBoxVMFirstRunWzd::mediaSourceChanged() 232 { 233 mCbHost->setEnabled (sender() == mRbHost); 234 mCbImage->setEnabled (sender() == mRbImage); 235 mTbVdm->setEnabled (sender() == mRbImage); 236 237 /* Revalidate updated page */ 238 mWvalType->revalidate(); 239 } 240 241 void VBoxVMFirstRunWzd::openVdm() 242 { 243 VBoxDiskImageManagerDlg vdm (this, "VBoxDiskImageManagerDlg", 244 Qt::WType_Dialog | Qt::WShowModal); 245 QUuid machineId = mMachine.GetId(); 246 VBoxDefs::DiskType type = mRbCdType->isChecked() ? VBoxDefs::CD : 247 mRbFdType->isChecked() ? VBoxDefs::FD : VBoxDefs::InvalidType; 248 vdm.setup (type, true, &machineId); 249 if (vdm.exec() == VBoxDiskImageManagerDlg::Accepted) 250 { 251 mCbImage->setCurrentItem (vdm.getSelectedUuid()); 252 253 /* Revalidate updated page */ 254 mWvalType->revalidate(); 255 } 256 } 257 258 void VBoxVMFirstRunWzd::enableNext (const QIWidgetValidator *aWval) 259 { 260 nextButton (aWval->widget())->setEnabled (aWval->isValid()); 261 } 262 263 void VBoxVMFirstRunWzd::onPageShow() 264 { 265 /* Make sure all is properly translated & composed */ 266 retranslateUi(); 267 268 QWidget *page = mPageStack->currentWidget(); 269 270 if (page == mPageWelcome) 271 nextButton (page)->setFocus(); 272 else if (page == mPageMedia) 273 mRbCdType->isChecked() ? mRbCdType->setFocus() : 274 mRbFdType->setFocus(); 275 else if (page == mPageSummary) 260 276 mTeSummary->setFocus(); 261 }262 277 263 278 if (page == mPageSummary)
Note:
See TracChangeset
for help on using the changeset viewer.