Changeset 23562 in vbox
- Timestamp:
- Oct 5, 2009 1:55:22 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 53210
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r23223 r23562 30 30 #include "VBoxProblemReporter.h" 31 31 #include "VBoxHelpActions.h" 32 #include "VBoxVMSettingsNetwork.h"33 32 34 33 /* Qt includes */ … … 64 63 65 64 class VBoxMiniToolBar; 66 67 class VBoxVMSettingsNetworkPage;68 65 69 66 /* We want to make the first action highlighted but not … … 409 406 }; 410 407 411 412 class VBoxVMSettingsSF; 413 class VBoxSFDialog : public QIWithRetranslateUI<QDialog> 408 class VBoxSettingsPage; 409 class VBoxNetworkDialog : public QIWithRetranslateUI <QDialog> 414 410 { 415 411 Q_OBJECT; … … 417 413 public: 418 414 419 VBox SFDialog (QWidget*, CSession&);415 VBoxNetworkDialog (QWidget *aParent, CSession &aSession); 420 416 421 417 protected: … … 429 425 protected: 430 426 431 void showEvent (QShowEvent*); 427 void showEvent (QShowEvent *aEvent); 428 429 private: 430 431 VBoxSettingsPage *mSettings; 432 CSession &mSession; 433 }; 434 435 class VBoxVMSettingsSF; 436 class VBoxSFDialog : public QIWithRetranslateUI <QDialog> 437 { 438 Q_OBJECT; 439 440 public: 441 442 VBoxSFDialog (QWidget *aParent, CSession &aSession); 443 444 protected: 445 446 void retranslateUi(); 447 448 protected slots: 449 450 virtual void accept(); 451 452 protected: 453 454 void showEvent (QShowEvent *aEvent); 432 455 433 456 private: … … 437 460 }; 438 461 439 440 class VBoxVMSettingsNetworkDialogPage : public VBoxVMSettingsNetworkPage441 {442 Q_OBJECT;443 444 public:445 446 VBoxVMSettingsNetworkDialogPage() : VBoxVMSettingsNetworkPage(true) {}447 448 void getFrom (const CMachine &aMachine) { VBoxVMSettingsNetworkPage::getFrom(aMachine); }449 void putBackTo() { VBoxVMSettingsNetworkPage::putBackTo(); }450 451 };452 453 class VBoxNetworkDialog : public QIWithRetranslateUI<QDialog>454 {455 Q_OBJECT;456 457 public:458 459 VBoxNetworkDialog (QWidget*, CSession&);460 461 protected:462 463 void retranslateUi();464 465 protected slots:466 467 virtual void accept();468 469 protected:470 471 void showEvent (QShowEvent*);472 473 private:474 475 VBoxVMSettingsNetworkDialogPage *mSettings;476 CSession &mSession;477 };478 479 480 462 #endif // __VBoxConsoleWnd_h__ -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetwork.h
r23054 r23562 88 88 public: 89 89 90 VBoxVMSettingsNetworkPage (bool aDisableStaticControls = false);90 VBoxVMSettingsNetworkPage (bool aDisableStaticControls = false); 91 91 92 92 QStringList brgList (bool aRefresh = false); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r23516 r23562 32 32 #include "VBoxTakeSnapshotDlg.h" 33 33 #include "VBoxVMFirstRunWzd.h" 34 #include "VBoxVMSettingsNetwork.h" 34 35 #include "VBoxVMSettingsSF.h" 35 36 #include "VBoxVMInformationDlg.h" … … 3800 3801 #endif /* VBOX_WITH_DEBUGGER_GUI */ 3801 3802 3803 VBoxNetworkDialog::VBoxNetworkDialog (QWidget *aParent, CSession &aSession) 3804 : QIWithRetranslateUI <QDialog> (aParent) 3805 , mSettings (0) 3806 , mSession (aSession) 3807 { 3808 setModal (true); 3809 /* Setup Dialog's options */ 3810 setWindowIcon (QIcon (":/nw_16px.png")); 3811 setSizeGripEnabled (true); 3812 3813 /* Setup main dialog's layout */ 3814 QVBoxLayout *mainLayout = new QVBoxLayout (this); 3815 VBoxGlobal::setLayoutMargin (mainLayout, 10); 3816 mainLayout->setSpacing (10); 3817 3818 /* Setup settings layout */ 3819 mSettings = new VBoxVMSettingsNetworkPage (true); 3820 mSettings->setOrderAfter (this); 3821 VBoxGlobal::setLayoutMargin (mSettings->layout(), 0); 3822 mSettings->getFrom (aSession.GetMachine()); 3823 mainLayout->addWidget (mSettings); 3824 3825 /* Setup button's layout */ 3826 QIDialogButtonBox *buttonBox = new QIDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help); 3827 3828 connect (buttonBox, SIGNAL (helpRequested()), &vboxProblem(), SLOT (showHelpHelpDialog())); 3829 connect (buttonBox, SIGNAL (accepted()), this, SLOT (accept())); 3830 connect (buttonBox, SIGNAL (rejected()), this, SLOT (reject())); 3831 mainLayout->addWidget (buttonBox); 3832 3833 retranslateUi(); 3834 } 3835 3836 void VBoxNetworkDialog::retranslateUi() 3837 { 3838 setWindowTitle (tr ("Network Adapters")); 3839 } 3840 3841 void VBoxNetworkDialog::accept() 3842 { 3843 mSettings->putBackTo(); 3844 CMachine machine = mSession.GetMachine(); 3845 machine.SaveSettings(); 3846 if (!machine.isOk()) 3847 vboxProblem().cannotSaveMachineSettings (machine); 3848 QDialog::accept(); 3849 } 3850 3851 void VBoxNetworkDialog::showEvent (QShowEvent *aEvent) 3852 { 3853 resize (450, 300); 3854 VBoxGlobal::centerWidget (this, parentWidget()); 3855 setMinimumWidth (400); 3856 QDialog::showEvent (aEvent); 3857 } 3858 3802 3859 VBoxSFDialog::VBoxSFDialog (QWidget *aParent, CSession &aSession) 3803 : QIWithRetranslateUI <QDialog> (aParent)3860 : QIWithRetranslateUI <QDialog> (aParent) 3804 3861 , mSettings (0) 3805 3862 , mSession (aSession) … … 3857 3914 } 3858 3915 3859 3860 VBoxNetworkDialog::VBoxNetworkDialog (QWidget *aParent, CSession &aSession)3861 : QIWithRetranslateUI<QDialog> (aParent)3862 , mSettings (0)3863 , mSession (aSession)3864 {3865 setModal (true);3866 /* Setup Dialog's options */3867 setWindowIcon (QIcon (":/nw_16px.png"));3868 setSizeGripEnabled (true);3869 3870 /* Setup main dialog's layout */3871 QVBoxLayout *mainLayout = new QVBoxLayout (this);3872 VBoxGlobal::setLayoutMargin (mainLayout, 10);3873 mainLayout->setSpacing (10);3874 3875 /* Setup settings layout */3876 mSettings = new VBoxVMSettingsNetworkDialogPage();3877 mSettings->setOrderAfter (this);3878 VBoxGlobal::setLayoutMargin (mSettings->layout(), 0);3879 mSettings->getFrom (aSession.GetMachine());3880 mainLayout->addWidget (mSettings);3881 3882 /* Setup button's layout */3883 QIDialogButtonBox *buttonBox = new QIDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);3884 3885 connect (buttonBox, SIGNAL (helpRequested()), &vboxProblem(), SLOT (showHelpHelpDialog()));3886 connect (buttonBox, SIGNAL (accepted()), this, SLOT (accept()));3887 connect (buttonBox, SIGNAL (rejected()), this, SLOT (reject()));3888 mainLayout->addWidget (buttonBox);3889 3890 retranslateUi();3891 }3892 3893 void VBoxNetworkDialog::retranslateUi()3894 {3895 setWindowTitle (tr ("Network Adapters"));3896 }3897 3898 void VBoxNetworkDialog::accept()3899 {3900 mSettings->putBackTo();3901 CMachine machine = mSession.GetMachine();3902 machine.SaveSettings();3903 if (!machine.isOk())3904 vboxProblem().cannotSaveMachineSettings (machine);3905 QDialog::accept();3906 }3907 3908 void VBoxNetworkDialog::showEvent (QShowEvent *aEvent)3909 {3910 resize (450, 300);3911 VBoxGlobal::centerWidget (this, parentWidget());3912 setMinimumWidth (400);3913 QDialog::showEvent (aEvent);3914 }3915 3916 3917 3916 #include "VBoxConsoleWnd.moc"
Note:
See TracChangeset
for help on using the changeset viewer.