Changeset 36357 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 23, 2011 9:36:05 AM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r35940 r36357 5 5 6 6 # 7 # Copyright (C) 2006-201 0Oracle Corporation7 # Copyright (C) 2006-2011 Oracle Corporation 8 8 # 9 9 # This file is part of VirtualBox Open Source Edition (OSE), as … … 393 393 src/runtime/UIIndicatorsPool.cpp \ 394 394 src/runtime/UIMachine.cpp \ 395 src/runtime/UIMachineLogic.cpp \396 395 src/runtime/UIMachineMenuBar.cpp 397 396 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
r35897 r36357 6 6 7 7 /* 8 * Copyright (C) 2006-20 09Oracle Corporation8 * Copyright (C) 2006-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 99 99 }; 100 100 101 /** Settings dialog types: */ 102 enum SettingsDialogType 103 { 104 SettingsDialogType_Wrong, 105 SettingsDialogType_Offline, 106 SettingsDialogType_Runtime 107 }; 108 101 109 static const char* GUI_LastWindowPosition; 102 110 static const char* GUI_LastNormalWindowPosition; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.cpp
r36083 r36357 223 223 }; 224 224 225 class ShowSettingsDialogAction : public UISimpleAction 226 { 227 Q_OBJECT; 228 229 public: 230 231 ShowSettingsDialogAction(QObject *pParent) 232 : UISimpleAction(pParent, 233 ":/settings_16px.png", ":/settings_dis_16px.png") 234 { 235 retranslateUi(); 236 } 237 238 protected: 239 240 void retranslateUi() 241 { 242 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Settings..."), gMS->shortcut(UIMachineShortcuts::SettingsDialogShortcut))); 243 setStatusTip(QApplication::translate("UIActionsPool", "Manage the virtual machine settings")); 244 } 245 }; 246 225 247 class PerformTakeSnapshotAction : public UISimpleAction 226 248 { … … 262 284 void retranslateUi() 263 285 { 264 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "Session I&nformation "), gMS->shortcut(UIMachineShortcuts::InformationDialogShortcut)));286 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "Session I&nformation..."), gMS->shortcut(UIMachineShortcuts::InformationDialogShortcut))); 265 287 setStatusTip(QApplication::translate("UIActionsPool", "Show Session Information Dialog")); 266 288 } … … 1114 1136 { 1115 1137 /* "Machine" menu actions: */ 1138 m_actionsPool[UIActionIndex_Simple_SettingsDialog] = new ShowSettingsDialogAction(this); 1116 1139 m_actionsPool[UIActionIndex_Simple_TakeSnapshot] = new PerformTakeSnapshotAction(this); 1117 1140 m_actionsPool[UIActionIndex_Simple_InformationDialog] = new ShowInformationDialogAction(this); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.h
r36355 r36357 52 52 /* "Machine" menu actions: */ 53 53 UIActionIndex_Menu_Machine, 54 UIActionIndex_Simple_SettingsDialog, 54 55 UIActionIndex_Simple_TakeSnapshot, 55 56 UIActionIndex_Simple_InformationDialog, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r35133 r36357 7 7 8 8 /* 9 * Copyright (C) 2010 Oracle Corporation9 * Copyright (C) 2010-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 38 38 #include "VBoxTakeSnapshotDlg.h" 39 39 #include "VBoxVMInformationDlg.h" 40 #include "UIMachineSettingsNetwork.h" 41 #include "UIMachineSettingsSF.h" 40 #include "UISettingsDialogSpecific.h" 42 41 #ifdef Q_WS_MAC 43 42 # include "DockIconPreview.h" … … 102 101 }; 103 102 Q_DECLARE_METATYPE(USBTarget); 104 105 class UINetworkAdaptersDialog : public QIWithRetranslateUI<QDialog>106 {107 Q_OBJECT;108 109 public:110 111 UINetworkAdaptersDialog(QWidget *pParent, CSession &session)112 : QIWithRetranslateUI<QDialog>(pParent)113 , m_pSettings(0)114 , m_session(session)115 {116 /* Setup Dialog's options */117 setModal(true);118 setWindowIcon(QIcon(":/nw_16px.png"));119 setSizeGripEnabled(true);120 121 /* Setup main dialog's layout */122 QVBoxLayout *pMainLayout = new QVBoxLayout(this);123 VBoxGlobal::setLayoutMargin(pMainLayout, 10);124 pMainLayout->setSpacing(10);125 126 /* Setup settings layout */127 m_pSettings = new UIMachineSettingsNetworkPage(true);128 m_pSettings->setOrderAfter(this);129 VBoxGlobal::setLayoutMargin(m_pSettings->layout(), 0);130 m_pSettings->loadDirectlyFrom(m_session.GetMachine());131 pMainLayout->addWidget(m_pSettings);132 133 /* Setup button's layout */134 QIDialogButtonBox *pButtonBox = new QIDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);135 136 connect(pButtonBox, SIGNAL(helpRequested()), &vboxProblem(), SLOT(showHelpHelpDialog()));137 connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));138 connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));139 pMainLayout->addWidget(pButtonBox);140 141 retranslateUi();142 }143 144 protected:145 146 void retranslateUi()147 {148 setWindowTitle(QApplication::translate("VBoxNetworkDialog", "Network Adapters"));149 }150 151 protected slots:152 153 virtual void accept()154 {155 CMachine machine = m_session.GetMachine();156 m_pSettings->saveDirectlyTo(machine);157 machine.SaveSettings();158 if (!machine.isOk())159 vboxProblem().cannotSaveMachineSettings(machine);160 QDialog::accept();161 }162 163 protected:164 165 void showEvent(QShowEvent *pEvent)166 {167 resize(450, 300);168 VBoxGlobal::centerWidget(this, parentWidget());169 setMinimumWidth(400);170 QDialog::showEvent(pEvent);171 }172 173 private:174 175 UIMachineSettingsNetworkPage *m_pSettings;176 CSession &m_session;177 };178 179 class UISharedFoldersDialog : public QIWithRetranslateUI<QDialog>180 {181 Q_OBJECT;182 183 public:184 185 UISharedFoldersDialog(QWidget *pParent, CSession &session)186 : QIWithRetranslateUI<QDialog>(pParent)187 , m_pSettings(0)188 , m_session(session)189 {190 /* Setup Dialog's options */191 setModal(true);192 setWindowIcon(QIcon(":/select_file_16px.png"));193 setSizeGripEnabled(true);194 195 /* Setup main dialog's layout */196 QVBoxLayout *pMainLayout = new QVBoxLayout(this);197 VBoxGlobal::setLayoutMargin(pMainLayout, 10);198 pMainLayout->setSpacing(10);199 200 /* Setup settings layout */201 m_pSettings = new UIMachineSettingsSF;202 VBoxGlobal::setLayoutMargin(m_pSettings->layout(), 0);203 m_pSettings->loadDirectlyFrom(m_session.GetConsole());204 pMainLayout->addWidget(m_pSettings);205 206 /* Setup button's layout */207 QIDialogButtonBox *pButtonBox = new QIDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);208 209 connect(pButtonBox, SIGNAL(helpRequested()), &vboxProblem(), SLOT(showHelpHelpDialog()));210 connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));211 connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));212 pMainLayout->addWidget(pButtonBox);213 214 retranslateUi();215 }216 217 protected:218 219 void retranslateUi()220 {221 setWindowTitle(QApplication::translate("VBoxSFDialog", "Shared Folders"));222 }223 224 protected slots:225 226 virtual void accept()227 {228 CMachine machine = m_session.GetMachine();229 CConsole console = m_session.GetConsole();230 m_pSettings->saveDirectlyTo(console);231 machine.SaveSettings();232 if (!machine.isOk())233 vboxProblem().cannotSaveMachineSettings(machine);234 QDialog::accept();235 }236 237 protected:238 239 void showEvent (QShowEvent *aEvent)240 {241 resize(450, 300);242 VBoxGlobal::centerWidget(this, parentWidget());243 setMinimumWidth(400);244 QDialog::showEvent(aEvent);245 }246 247 private:248 249 UIMachineSettingsSF *m_pSettings;250 CSession &m_session;251 };252 103 253 104 UIMachineLogic* UIMachineLogic::create(QObject *pParent, … … 474 325 { 475 326 /* "Machine" actions connections: */ 476 connect(actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize), SIGNAL(toggled(bool)), 477 this, SLOT(sltToggleGuestAutoresize(bool))); 478 connect(actionsPool()->action(UIActionIndex_Simple_AdjustWindow), SIGNAL(triggered()), 479 this, SLOT(sltAdjustWindow())); 327 connect(actionsPool()->action(UIActionIndex_Simple_SettingsDialog), SIGNAL(triggered()), 328 this, SLOT(sltOpenVMSettingsDialog())); 329 connect(actionsPool()->action(UIActionIndex_Simple_TakeSnapshot), SIGNAL(triggered()), 330 this, SLOT(sltTakeSnapshot())); 331 connect(actionsPool()->action(UIActionIndex_Simple_InformationDialog), SIGNAL(triggered()), 332 this, SLOT(sltShowInformationDialog())); 480 333 connect(actionsPool()->action(UIActionIndex_Toggle_MouseIntegration), SIGNAL(toggled(bool)), 481 334 this, SLOT(sltToggleMouseIntegration(bool))); … … 486 339 this, SLOT(sltTypeCABS())); 487 340 #endif 488 connect(actionsPool()->action(UIActionIndex_Simple_TakeSnapshot), SIGNAL(triggered()),489 this, SLOT(sltTakeSnapshot()));490 connect(actionsPool()->action(UIActionIndex_Simple_InformationDialog), SIGNAL(triggered()),491 this, SLOT(sltShowInformationDialog()));492 341 connect(actionsPool()->action(UIActionIndex_Toggle_Pause), SIGNAL(toggled(bool)), 493 342 this, SLOT(sltPause(bool))); … … 498 347 connect(actionsPool()->action(UIActionIndex_Simple_Close), SIGNAL(triggered()), 499 348 this, SLOT(sltClose())); 349 350 /* "View" actions connections: */ 351 connect(actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize), SIGNAL(toggled(bool)), 352 this, SLOT(sltToggleGuestAutoresize(bool))); 353 connect(actionsPool()->action(UIActionIndex_Simple_AdjustWindow), SIGNAL(triggered()), 354 this, SLOT(sltAdjustWindow())); 500 355 501 356 /* "Devices" actions connections: */ … … 550 405 551 406 /* Move actions into running actions group: */ 552 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_Fullscreen));553 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_Seamless));554 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_Scale));555 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize));556 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Simple_AdjustWindow));557 407 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Simple_TypeCAD)); 558 408 #ifdef Q_WS_X11 … … 561 411 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Simple_Reset)); 562 412 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Simple_Shutdown)); 413 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_Fullscreen)); 414 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_Seamless)); 415 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_Scale)); 416 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)); 417 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Simple_AdjustWindow)); 563 418 564 419 /* Move actions into running-n-paused actions group: */ 420 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Simple_SettingsDialog)); 421 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Simple_TakeSnapshot)); 422 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Simple_InformationDialog)); 565 423 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Menu_MouseIntegration)); 566 424 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Toggle_MouseIntegration)); 567 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Simple_TakeSnapshot));568 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Simple_InformationDialog));569 425 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Toggle_Pause)); 570 426 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Menu_OpticalDevices)); … … 1088 944 /* Propose to close default machine window: */ 1089 945 defaultMachineWindow()->sltTryClose(); 946 } 947 948 void UIMachineLogic::sltOpenVMSettingsDialog(const QString &strCategory /* = QString() */) 949 { 950 /* Do not process if window(s) missed! */ 951 if (!isMachineWindowsCreated()) 952 return; 953 954 /* Open shared session: */ 955 CSession sharedSession = vboxGlobal().openSession(session().GetMachine().GetId(), true); 956 if (sharedSession.isNull()) 957 return; 958 959 /* Get machine: */ 960 CMachine sharedMachine = sharedSession.GetMachine(); 961 if (sharedMachine.isNull()) 962 return; 963 964 /* Prepare VM settings dialog: */ 965 UISettingsDialog *pDlg = new UISettingsDialogMachine(defaultMachineWindow()->machineWindow(), 966 VBoxDefs::SettingsDialogType_Runtime, 967 sharedMachine, session().GetConsole(), 968 strCategory, QString()); 969 pDlg->getFrom(); 970 971 /* Show VM settings dialog: */ 972 if (pDlg->exec() == QDialog::Accepted) 973 { 974 /* If dialog was accepted => save changed settings: */ 975 pDlg->putBackTo(); 976 sharedMachine.SaveSettings(); 977 /* If settings were failed to be saved => show the error: */ 978 if (!sharedMachine.isOk()) 979 vboxProblem().cannotSaveMachineSettings(sharedMachine); 980 } 981 982 /* Delete VM settings dialog: */ 983 delete pDlg; 984 985 /* Unlock machine: */ 986 sharedSession.UnlockMachine(); 987 } 988 989 void UIMachineLogic::sltOpenNetworkAdaptersDialog() 990 { 991 /* Open VM settings : Network page: */ 992 sltOpenVMSettingsDialog("#network"); 993 } 994 995 void UIMachineLogic::sltOpenSharedFoldersDialog() 996 { 997 /* Do not process if additions are not loaded! */ 998 if (!uisession()->isGuestAdditionsActive()) 999 vboxProblem().remindAboutGuestAdditionsAreNotActive(defaultMachineWindow()->machineWindow()); 1000 1001 /* Open VM settings : Shared folders page: */ 1002 sltOpenVMSettingsDialog("#sfolders"); 1090 1003 } 1091 1004 … … 1514 1427 } 1515 1428 1516 void UIMachineLogic::sltOpenNetworkAdaptersDialog()1517 {1518 /* Do not process if window(s) missed! */1519 if (!isMachineWindowsCreated())1520 return;1521 1522 /* Show network settings dialog: */1523 UINetworkAdaptersDialog dlg(defaultMachineWindow()->machineWindow(), session());1524 dlg.exec();1525 }1526 1527 void UIMachineLogic::sltOpenSharedFoldersDialog()1528 {1529 /* Do not process if window(s) missed! */1530 if (!isMachineWindowsCreated())1531 return;1532 1533 /* Show shared folders settings dialog: */1534 UISharedFoldersDialog dlg(defaultMachineWindow()->machineWindow(), session());1535 if (!uisession()->isGuestAdditionsActive())1536 vboxProblem().remindAboutGuestAdditionsAreNotActive(defaultMachineWindow()->machineWindow());1537 dlg.exec();1538 }1539 1540 1429 void UIMachineLogic::sltSwitchVrde(bool fOn) 1541 1430 { … … 1779 1668 #endif 1780 1669 1781 #include "UIMachineLogic.moc"1782 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r34961 r36357 6 6 7 7 /* 8 * Copyright (C) 2010 Oracle Corporation8 * Copyright (C) 2010-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 169 169 170 170 /* "Device" menu functionality */ 171 void sltOpenVMSettingsDialog(const QString &strCategory = QString()); 172 void sltOpenNetworkAdaptersDialog(); 173 void sltOpenSharedFoldersDialog(); 171 174 void sltPrepareStorageMenu(); 172 175 void sltMountStorageMedium(); … … 174 177 void sltPrepareUSBMenu(); 175 178 void sltAttachUSBDevice(); 176 void sltOpenNetworkAdaptersDialog();177 void sltOpenSharedFoldersDialog();178 179 void sltSwitchVrde(bool fOn); 179 180 void sltInstallGuestAdditions(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r36083 r36357 190 190 191 191 /* Machine submenu: */ 192 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_SettingsDialog)); 192 193 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TakeSnapshot)); 193 194 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InformationDialog)); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineShortcuts.cpp
r36356 r36357 26 26 { 27 27 /* Defaults */ 28 m_Shortcuts[TakeSnapshotShortcut] = UIKeySequence("TakeSnapshot", "S"); 28 m_Shortcuts[SettingsDialogShortcut] = UIKeySequence("SettingsDialog", "S"); 29 m_Shortcuts[TakeSnapshotShortcut] = UIKeySequence("TakeSnapshot", "T"); 29 30 m_Shortcuts[InformationDialogShortcut] = UIKeySequence("InformationDialog", "N"); 30 31 m_Shortcuts[MouseIntegrationShortcut] = UIKeySequence("MouseIntegration" , "I"); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineShortcuts.h
r36356 r36357 28 28 enum MachineShortcutType 29 29 { 30 SettingsDialogShortcut, 30 31 TakeSnapshotShortcut, 31 32 InformationDialogShortcut, -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
r35761 r36357 982 982 { 983 983 m_machine = machine; 984 if (m_machine.isNull()) 985 m_fChangeable = false; 986 else 987 { 988 KMachineState state = m_machine.GetState(); 989 bool running = m_machine.GetSessionState() != KSessionState_Unlocked; 990 m_fChangeable = !running && state != KMachineState_Saved; 991 } 984 m_fChangeable = m_machine.isNull() ? false : m_machine.GetState() != KMachineState_Stuck; 992 985 993 986 sltUpdateGeneral(); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
r36323 r36357 595 595 CSystemProperties props = vboxGlobal().virtualBox().GetSystemProperties(); 596 596 597 UISettingsDialog *dlg = new UISettingsDialogGlobal(this );597 UISettingsDialog *dlg = new UISettingsDialogGlobal(this, VBoxDefs::SettingsDialogType_Offline); 598 598 dlg->getFrom(); 599 599 … … 720 720 } 721 721 722 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 723 mVMModel->itemById(aUuid); 724 725 AssertMsgReturnVoid(item, ("Item must be always selected here")); 726 727 // open a direct session to modify VM settings 728 QString id = item->id(); 729 CSession session = vboxGlobal().openSession(id); 730 if (session.isNull()) 731 return; 732 733 CMachine m = session.GetMachine(); 734 AssertMsgReturn(!m.isNull(), ("Machine must not be null"), (void) 0); 735 736 /* Don't show the inaccessible warning if the user open the vm settings. */ 722 UIVMItem *pItem = aUuid.isNull() ? mVMListView->selectedItem() : mVMModel->itemById(aUuid); 723 AssertMsgReturnVoid(pItem, ("Item must be always selected here")); 724 725 bool fMachineOffline = pItem->sessionState() == KSessionState_Unlocked; 726 VBoxDefs::SettingsDialogType dialogType = fMachineOffline ? VBoxDefs::SettingsDialogType_Offline : VBoxDefs::SettingsDialogType_Runtime; 727 728 CSession session = vboxGlobal().openSession(pItem->id(), !fMachineOffline /* connect to existing? */); 729 AssertMsgReturn(!session.isNull(), ("Session must not be null"), (void)0); 730 CMachine machine = session.GetMachine(); 731 AssertMsgReturn(!machine.isNull(), ("Machine must not be null"), (void)0); 732 CConsole console = fMachineOffline ? CConsole() : session.GetConsole(); 733 734 /* Don't show the inaccessible warning if the user open the vm settings: */ 737 735 mDoneInaccessibleWarningOnce = true; 738 736 739 UISettingsDialog *dlg = new UISettingsDialogMachine(this, m, strCategory, strControl); 740 dlg->getFrom(); 741 742 if (dlg->exec() == QDialog::Accepted) 743 { 744 QString oldName = m.GetName(); 745 dlg->putBackTo(); 746 747 m.SaveSettings(); 748 if (!m.isOk()) 749 vboxProblem().cannotSaveMachineSettings(m); 750 751 /* To check use the result in future 737 UISettingsDialog *pDlg = new UISettingsDialogMachine(this, dialogType, machine, console, strCategory, strControl); 738 pDlg->getFrom(); 739 740 if (pDlg->exec() == QDialog::Accepted) 741 { 742 pDlg->putBackTo(); 743 744 machine.SaveSettings(); 745 if (!machine.isOk()) 746 vboxProblem().cannotSaveMachineSettings(machine); 747 748 /* To check use the result in future: 752 749 * vboxProblem().cannotApplyMachineSettings(m, res); */ 753 750 } 754 751 755 delete dlg;752 delete pDlg; 756 753 757 754 mVMListView->setFocus(); … … 1328 1325 KMachineState state = item->machineState(); 1329 1326 bool running = item->sessionState() != KSessionState_Unlocked; 1330 bool modifyEnabled = !running && state != KMachineState_Saved;1327 bool modifyEnabled = state != KMachineState_Stuck; 1331 1328 1332 1329 if ( aRefreshDetails -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r36323 r36357 42 42 43 43 /* Settings Dialog Constructor: */ 44 UISettingsDialog::UISettingsDialog(QWidget *pParent )44 UISettingsDialog::UISettingsDialog(QWidget *pParent, VBoxDefs::SettingsDialogType dialogType) 45 45 /* Parent class: */ 46 46 : QIWithRetranslateUI<QIMainDialog>(pParent) … … 49 49 , m_pStack(0) 50 50 /* Common variables: */ 51 , m_dialogType(dialogType) 51 52 , m_fPolished(false) 52 53 /* Loading stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r36323 r36357 24 24 #include "QIWithRetranslateUI.h" 25 25 #include "UISettingsDialog.gen.h" 26 #include "VBoxDefs.h" 26 27 27 28 /* Forward declarations */ … … 41 42 42 43 /* Settings Dialog Constructor/Destructor: */ 43 UISettingsDialog(QWidget *pParent );44 UISettingsDialog(QWidget *pParent, VBoxDefs::SettingsDialogType dialogType); 44 45 ~UISettingsDialog(); 45 46 … … 64 65 virtual void retranslateUi(); 65 66 67 /* Dialog type: */ 68 VBoxDefs::SettingsDialogType dialogType() { return m_dialogType; } 66 69 /* Dialog title: */ 67 70 virtual QString title() const = 0; … … 107 110 108 111 /* Global Flags: */ 112 VBoxDefs::SettingsDialogType m_dialogType; 109 113 bool m_fPolished; 110 114 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r36323 r36357 288 288 UISettingsSerializer* UISettingsSerializer::m_pInstance = 0; 289 289 290 UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent )291 : UISettingsDialog(pParent )290 UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent, VBoxDefs::SettingsDialogType type) 291 : UISettingsDialog(pParent, type) 292 292 { 293 293 /* Window icon: */ … … 371 371 } 372 372 if (pSettingsPage) 373 { 374 pSettingsPage->setDialogType(dialogType()); 373 375 pSettingsPage->setId(iPageIndex); 376 } 374 377 } 375 378 } … … 504 507 } 505 508 506 UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, 507 const CMachine &machine, 508 const QString &strCategory, 509 const QString &strControl) 510 : UISettingsDialog(pParent) 509 UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, VBoxDefs::SettingsDialogType type, 510 const CMachine &machine, const CConsole &console, 511 const QString &strCategory, const QString &strControl) 512 : UISettingsDialog(pParent, type) 511 513 , m_machine(machine) 514 , m_console(console) 512 515 , m_fAllowResetFirstRunFlag(false) 513 516 , m_fResetFirstRunFlag(false) … … 633 636 } 634 637 if (pSettingsPage) 638 { 639 pSettingsPage->setDialogType(dialogType()); 635 640 pSettingsPage->setId(iPageIndex); 641 } 636 642 } 637 643 } … … 678 684 /* Prepare machine data: */ 679 685 qRegisterMetaType<UISettingsDataMachine>(); 680 UISettingsDataMachine data(m_machine );686 UISettingsDataMachine data(m_machine, m_console); 681 687 /* Create machine settings loader, 682 688 * it will load machine settings & delete itself in the appropriate time: */ … … 698 704 /* Prepare machine data: */ 699 705 qRegisterMetaType<UISettingsDataMachine>(); 700 UISettingsDataMachine data(m_machine );706 UISettingsDataMachine data(m_machine, m_console); 701 707 /* Create machine settings saver, 702 708 * it will save machine settings & delete itself in the appropriate time: */ … … 711 717 /* Get updated machine: */ 712 718 m_machine = pMachineSettingsSaver->data().value<UISettingsDataMachine>().m_machine; 719 m_console = pMachineSettingsSaver->data().value<UISettingsDataMachine>().m_console; 713 720 /* If machine is ok => perform final operations: */ 714 721 if (m_machine.isOk()) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
r36323 r36357 43 43 }; 44 44 45 UISettingsDialogGlobal(QWidget *pParent );45 UISettingsDialogGlobal(QWidget *pParent, VBoxDefs::SettingsDialogType type); 46 46 47 47 protected: … … 82 82 }; 83 83 84 UISettingsDialogMachine(QWidget *pParent, const CMachine &machine, 84 UISettingsDialogMachine(QWidget *pParent, VBoxDefs::SettingsDialogType type, 85 const CMachine &machine, const CConsole &console, 85 86 const QString &strCategory, const QString &strControl); 86 87 … … 108 109 109 110 CMachine m_machine; 111 CConsole m_console; 110 112 bool m_fAllowResetFirstRunFlag; 111 113 bool m_fResetFirstRunFlag; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp
r36324 r36357 24 24 UISettingsPage::UISettingsPage(UISettingsPageType pageType) 25 25 : m_pageType(pageType) 26 , m_dialogType(VBoxDefs::SettingsDialogType_Wrong) 26 27 , m_cId(-1) 28 , m_fPolished(false) 27 29 , m_fProcessed(false) 28 30 , m_fFailed(false) 29 31 , m_pFirstWidget(0) 30 32 { 33 } 34 35 void UISettingsPage::showEvent(QShowEvent *pEvent) 36 { 37 /* Polish page if necessary: */ 38 if (!m_fPolished) 39 { 40 m_fPolished = true; 41 polishPage(); 42 } 43 /* Call for base-class: */ 44 QIWithRetranslateUI<QWidget>::showEvent(pEvent); 31 45 } 32 46 … … 56 70 } 57 71 58 /* Fetch data to m_machine : */72 /* Fetch data to m_machine & m_console: */ 59 73 void UISettingsPageMachine::fetchData(const QVariant &data) 60 74 { 61 75 m_machine = data.value<UISettingsDataMachine>().m_machine; 76 m_console = data.value<UISettingsDataMachine>().m_console; 62 77 } 63 78 64 /* Upload m_machine to data: */79 /* Upload m_machine & m_console to data: */ 65 80 void UISettingsPageMachine::uploadData(QVariant &data) const 66 81 { 67 data = QVariant::fromValue(UISettingsDataMachine(m_machine ));82 data = QVariant::fromValue(UISettingsDataMachine(m_machine, m_console)); 68 83 } 69 84 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
r36324 r36357 27 27 #include "QIWithRetranslateUI.h" 28 28 #include "COMDefs.h" 29 #include "VBoxDefs.h" 29 30 #include "VBoxGlobalSettings.h" 30 31 31 32 /* Forward declarations */ 32 33 class QIWidgetValidator; 34 class QShowEvent; 33 35 34 36 /* Settings page types: */ … … 54 56 { 55 57 UISettingsDataMachine() {} 56 UISettingsDataMachine(const CMachine &machine )57 : m_machine(machine) {}58 UISettingsDataMachine(const CMachine &machine, const CConsole &console) 59 : m_machine(machine), m_console(console) {} 58 60 CMachine m_machine; 61 CConsole m_console; 59 62 }; 60 63 Q_DECLARE_METATYPE(UISettingsDataMachine); … … 92 95 UISettingsPageType pageType() const { return m_pageType; } 93 96 97 /* Settings dialog type stuff: */ 98 VBoxDefs::SettingsDialogType dialogType() const { return m_dialogType; } 99 virtual void setDialogType(VBoxDefs::SettingsDialogType dialogType) { m_dialogType = dialogType; } 100 94 101 /* Page 'ID' stuff: */ 95 102 int id() const { return m_cId; } … … 109 116 UISettingsPage(UISettingsPageType type); 110 117 118 /* Show event: */ 119 void showEvent(QShowEvent *pEvent); 120 121 /* Virtual function to polish page content: */ 122 virtual void polishPage() {} 123 111 124 private: 112 125 113 126 /* Private variables: */ 114 127 UISettingsPageType m_pageType; 128 VBoxDefs::SettingsDialogType m_dialogType; 115 129 int m_cId; 130 bool m_fPolished; 116 131 bool m_fProcessed; 117 132 bool m_fFailed; … … 158 173 /* Machine data source: */ 159 174 CMachine m_machine; 175 CConsole m_console; 160 176 }; 161 177 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r33882 r36357 7 7 8 8 /* 9 * Copyright (C) 2006-201 0Oracle Corporation9 * Copyright (C) 2006-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 73 73 UISettingsPageMachine::fetchData(data); 74 74 75 /* Gather corresponding values from internal variables: */ 76 CAudioAdapter audio = m_machine.GetAudioAdapter(); 77 audio.SetEnabled(m_cache.m_fAudioEnabled); 78 audio.SetAudioDriver(m_cache.m_audioDriverType); 79 audio.SetAudioController(m_cache.m_audioControllerType); 75 /* Save settings depending on dialog type: */ 76 switch (dialogType()) 77 { 78 /* Here come the properties which could be changed only in offline state: */ 79 case VBoxDefs::SettingsDialogType_Offline: 80 { 81 CAudioAdapter audio = m_machine.GetAudioAdapter(); 82 audio.SetEnabled(m_cache.m_fAudioEnabled); 83 audio.SetAudioDriver(m_cache.m_audioDriverType); 84 audio.SetAudioController(m_cache.m_audioControllerType); 85 break; 86 } 87 /* Here come the properties which could be changed at runtime too: */ 88 case VBoxDefs::SettingsDialogType_Runtime: 89 break; 90 default: 91 break; 92 } 80 93 81 94 /* Upload machine to data: */ … … 150 163 } 151 164 165 void UIMachineSettingsAudio::polishPage() 166 { 167 /* Polish page depending on dialog type: */ 168 switch (dialogType()) 169 { 170 case VBoxDefs::SettingsDialogType_Offline: 171 break; 172 case VBoxDefs::SettingsDialogType_Runtime: 173 mGbAudio->setEnabled(false); 174 mLbAudioDriver->setEnabled(false); 175 mCbAudioDriver->setEnabled(false); 176 mLbAudioController->setEnabled(false); 177 mCbAudioController->setEnabled(false); 178 break; 179 default: 180 break; 181 } 182 } 183 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h
r33882 r36357 6 6 7 7 /* 8 * Copyright (C) 2006-201 0Oracle Corporation8 * Copyright (C) 2006-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 66 66 void prepareComboboxes(); 67 67 68 void polishPage(); 69 68 70 /* Cache: */ 69 71 UISettingsCacheMachineAudio m_cache; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r34860 r36357 7 7 8 8 /* 9 * Copyright (C) 2008-201 0Oracle Corporation9 * Copyright (C) 2008-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 232 232 UISettingsPageMachine::fetchData(data); 233 233 234 /* Gather corresponding values from internal variables: */ 235 m_machine.SetVRAMSize(m_cache.m_iCurrentVRAM); 236 m_machine.SetMonitorCount(m_cache.m_cMonitorCount); 237 m_machine.SetAccelerate3DEnabled(m_cache.m_f3dAccelerationEnabled); 238 #ifdef VBOX_WITH_VIDEOHWACCEL 239 m_machine.SetAccelerate2DVideoEnabled(m_cache.m_f2dAccelerationEnabled); 240 #endif 241 CVRDEServer vrdeServer = m_machine.GetVRDEServer(); 242 if (!vrdeServer.isNull()) 243 { 244 vrdeServer.SetEnabled(m_cache.m_fVRDEServerEnabled); 245 vrdeServer.SetVRDEProperty("TCP/Ports", m_cache.m_strVRDEPort); 246 vrdeServer.SetAuthType(m_cache.m_iVRDEAuthType); 247 vrdeServer.SetAuthTimeout(m_cache.m_uVRDETimeout); 248 vrdeServer.SetAllowMultiConnection(m_cache.m_fMultipleConnectionsAllowed); 234 /* Save settings depending on dialog type: */ 235 switch (dialogType()) 236 { 237 /* Here come the properties which could be changed only in offline state: */ 238 case VBoxDefs::SettingsDialogType_Offline: 239 { 240 /* Video tab: */ 241 m_machine.SetVRAMSize(m_cache.m_iCurrentVRAM); 242 m_machine.SetMonitorCount(m_cache.m_cMonitorCount); 243 m_machine.SetAccelerate3DEnabled(m_cache.m_f3dAccelerationEnabled); 244 #ifdef VBOX_WITH_VIDEOHWACCEL 245 m_machine.SetAccelerate2DVideoEnabled(m_cache.m_f2dAccelerationEnabled); 246 #endif /* VBOX_WITH_VIDEOHWACCEL */ 247 /* After that come the properties which could be changed at runtime too: */ 248 } 249 /* Here come the properties which could be changed at runtime too: */ 250 case VBoxDefs::SettingsDialogType_Runtime: 251 { 252 /* VRDE tab: */ 253 CVRDEServer vrdeServer = m_machine.GetVRDEServer(); 254 if (!vrdeServer.isNull()) 255 { 256 vrdeServer.SetEnabled(m_cache.m_fVRDEServerEnabled); 257 vrdeServer.SetVRDEProperty("TCP/Ports", m_cache.m_strVRDEPort); 258 vrdeServer.SetAuthType(m_cache.m_iVRDEAuthType); 259 vrdeServer.SetAuthTimeout(m_cache.m_uVRDETimeout); 260 vrdeServer.SetAllowMultiConnection(m_cache.m_fMultipleConnectionsAllowed); 261 } 262 break; 263 } 264 default: 265 break; 249 266 } 250 267 … … 417 434 } 418 435 436 void UIMachineSettingsDisplay::polishPage() 437 { 438 /* Polish page depending on dialog type: */ 439 switch (dialogType()) 440 { 441 case VBoxDefs::SettingsDialogType_Offline: 442 break; 443 case VBoxDefs::SettingsDialogType_Runtime: 444 /* Video tab: */ 445 mLbMemory->setEnabled(false); 446 mLbMemoryMin->setEnabled(false); 447 mLbMemoryMax->setEnabled(false); 448 mLbMemoryUnit->setEnabled(false); 449 mSlMemory->setEnabled(false); 450 mLeMemory->setEnabled(false); 451 mLbMonitors->setEnabled(false); 452 mLbMonitorsMin->setEnabled(false); 453 mLbMonitorsMax->setEnabled(false); 454 mLbMonitorsUnit->setEnabled(false); 455 mSlMonitors->setEnabled(false); 456 mLeMonitors->setEnabled(false); 457 mLbOptions->setEnabled(false); 458 mCb3D->setEnabled(false); 459 #ifdef VBOX_WITH_VIDEOHWACCEL 460 mCb2DVideo->setEnabled(false); 461 #endif /* VBOX_WITH_VIDEOHWACCEL */ 462 break; 463 default: 464 break; 465 } 466 } 467 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r33882 r36357 6 6 7 7 /* 8 * Copyright (C) 2008-201 0Oracle Corporation8 * Copyright (C) 2008-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 91 91 void checkVRAMRequirements(); 92 92 93 void polishPage(); 94 93 95 QIWidgetValidator *mValidator; 94 96 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r36229 r36357 7 7 8 8 /* 9 * Copyright (C) 2006-201 0Oracle Corporation9 * Copyright (C) 2006-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 136 136 UISettingsPageMachine::fetchData(data); 137 137 138 /* Gather corresponding values from internal variables: */ 139 m_machine.SetOSTypeId(m_cache.m_strGuestOsTypeId); 140 m_machine.SetExtraData(VBoxDefs::GUI_SaveMountedAtRuntime, m_cache.m_fSaveMountedAtRuntime ? "yes" : "no"); 141 m_machine.SetExtraData(VBoxDefs::GUI_ShowMiniToolBar, m_cache.m_fShowMiniToolBar ? "yes" : "no"); 142 m_machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAlignment, m_cache.m_fMiniToolBarAtTop ? "top" : "bottom"); 143 m_machine.SetSnapshotFolder(m_cache.m_strSnapshotsFolder); 144 m_machine.SetClipboardMode(m_cache.m_clipboardMode); 145 m_machine.SetDescription(m_cache.m_strDescription); 146 /* Must be last as otherwise its VM rename magic can collide with other 147 * settings in the config, especially with the snapshot folder. */ 148 m_machine.SetName(m_cache.m_strName); 138 /* Save settings depending on dialog type: */ 139 switch (dialogType()) 140 { 141 /* Here come the properties which could be changed only in offline state: */ 142 case VBoxDefs::SettingsDialogType_Offline: 143 { 144 /* Basic tab: */ 145 m_machine.SetOSTypeId(m_cache.m_strGuestOsTypeId); 146 /* Advanced tab: */ 147 m_machine.SetSnapshotFolder(m_cache.m_strSnapshotsFolder); 148 m_machine.SetClipboardMode(m_cache.m_clipboardMode); 149 m_machine.SetExtraData(VBoxDefs::GUI_SaveMountedAtRuntime, m_cache.m_fSaveMountedAtRuntime ? "yes" : "no"); 150 m_machine.SetExtraData(VBoxDefs::GUI_ShowMiniToolBar, m_cache.m_fShowMiniToolBar ? "yes" : "no"); 151 m_machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAlignment, m_cache.m_fMiniToolBarAtTop ? "top" : "bottom"); 152 /* Description tab: */ 153 m_machine.SetDescription(m_cache.m_strDescription); 154 /* VM name must be last as otherwise its VM rename magic can collide with other settings in the config, 155 * especially with the snapshot folder: */ 156 m_machine.SetName(m_cache.m_strName); 157 break; 158 } 159 /* Here come the properties which could be changed at runtime too: */ 160 case VBoxDefs::SettingsDialogType_Runtime: 161 { 162 /* Advanced tab: */ 163 m_machine.SetClipboardMode(m_cache.m_clipboardMode); 164 m_machine.SetExtraData(VBoxDefs::GUI_SaveMountedAtRuntime, m_cache.m_fSaveMountedAtRuntime ? "yes" : "no"); 165 m_machine.SetExtraData(VBoxDefs::GUI_ShowMiniToolBar, m_cache.m_fShowMiniToolBar ? "yes" : "no"); 166 m_machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAlignment, m_cache.m_fMiniToolBarAtTop ? "top" : "bottom"); 167 /* Description tab: */ 168 m_machine.SetDescription(m_cache.m_strDescription); 169 break; 170 } 171 default: 172 break; 173 } 149 174 150 175 /* Upload machine to data: */ … … 194 219 } 195 220 221 void UIMachineSettingsGeneral::polishPage() 222 { 223 /* Polish page depending on dialog type: */ 224 switch (dialogType()) 225 { 226 case VBoxDefs::SettingsDialogType_Offline: 227 break; 228 case VBoxDefs::SettingsDialogType_Runtime: 229 /* Basic tab: */ 230 mLbName->setEnabled(false); 231 mLeName->setEnabled(false); 232 mOSTypeSelector->setEnabled(false); 233 /* Advanced tab: */ 234 mLbSnapshot->setEnabled(false); 235 mPsSnapshot->setEnabled(false); 236 break; 237 default: 238 break; 239 } 240 } 241 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r35476 r36357 6 6 7 7 /* 8 * Copyright (C) 2006-201 0Oracle Corporation8 * Copyright (C) 2006-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 82 82 private: 83 83 84 void polishPage(); 85 84 86 QIWidgetValidator *mValidator; 85 87 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r36324 r36357 43 43 , m_iSlot(-1) 44 44 , m_fPolished(false) 45 , m_fDisableStaticControls(fDisableStaticControls)46 45 { 47 46 /* Apply UI decorations: */ … … 62 61 } 63 62 63 void UIMachineSettingsNetwork::polishTab() 64 { 65 /* Polish tab depending on dialog type: */ 66 switch (m_pParent->dialogType()) 67 { 68 case VBoxDefs::SettingsDialogType_Offline: 69 sltToggleAdvanced(); 70 break; 71 case VBoxDefs::SettingsDialogType_Runtime: 72 mCbEnableAdapter->setEnabled(false); 73 m_pAdapterTypeLabel->setEnabled(false); 74 m_pAdapterTypeCombo->setEnabled(false); 75 m_pMACLabel->setEnabled(false); 76 m_pMACEditor->setEnabled(false); 77 m_pMACButton->setEnabled(false); 78 m_pAdvancedArrow->animateClick(); 79 break; 80 default: 81 break; 82 } 83 } 84 64 85 void UIMachineSettingsNetwork::fetchAdapterData(const UINetworkAdapterData &data) 65 86 { … … 166 187 m_pValidator = pValidator; 167 188 168 if (!m_fDisableStaticControls) 169 connect(mCbEnableAdapter, SIGNAL(toggled(bool)), m_pValidator, SLOT(revalidate())); 189 connect(mCbEnableAdapter, SIGNAL(toggled(bool)), m_pValidator, SLOT(revalidate())); 170 190 connect(m_pAttachmentTypeCombo, SIGNAL(activated(const QString&)), this, SLOT(sltUpdateAttachmentAlternative())); 171 191 connect(m_pAdapterNameCombo, SIGNAL(activated(const QString&)), this, SLOT(sltUpdateAlternativeName())); 172 192 connect(m_pAdapterNameCombo, SIGNAL(editTextChanged(const QString&)), this, SLOT(sltUpdateAlternativeName())); 173 193 174 if (!m_fDisableStaticControls) 175 m_pValidator->revalidate(); 194 m_pValidator->revalidate(); 176 195 } 177 196 … … 271 290 void UIMachineSettingsNetwork::showEvent(QShowEvent *pEvent) 272 291 { 292 /* Polish page if necessary: */ 273 293 if (!m_fPolished) 274 294 { 275 295 m_fPolished = true; 276 277 296 /* Give the minimum size hint to the first layout column: */ 278 297 m_pNetworkChildGridLayout->setColumnMinimumWidth (0, m_pAttachmentTypeLabel->width()); 279 280 if (m_fDisableStaticControls) 281 { 282 /* Disable controls for dynamically displayed page: */ 283 mCbEnableAdapter->setEnabled(false); 284 m_pAdapterTypeCombo->setEnabled(false); 285 m_pPromiscuousModeCombo->setEnabled(false); 286 m_pMACEditor->setEnabled(false); 287 m_pMACButton->setEnabled(false); 288 m_pAdapterTypeLabel->setEnabled(false); 289 m_pPromiscuousModeLabel->setEnabled(false); 290 m_pMACLabel->setEnabled(false); 291 m_pAdvancedArrow->animateClick(); 292 } 293 else 294 { 295 /* Hide advanced items initially: */ 296 sltToggleAdvanced(); 297 } 298 } 298 } 299 /* Call for base-class: */ 299 300 QWidget::showEvent(pEvent); 300 301 } … … 318 319 319 320 /* Update alternative-name combo-box availability: */ 321 m_pAdapterNameLabel->setEnabled(attachmentType() != KNetworkAttachmentType_Null && 322 attachmentType() != KNetworkAttachmentType_NAT); 320 323 m_pAdapterNameCombo->setEnabled(attachmentType() != KNetworkAttachmentType_Null && 321 324 attachmentType() != KNetworkAttachmentType_NAT); 325 m_pPromiscuousModeLabel->setEnabled(attachmentType() != KNetworkAttachmentType_Null && 326 attachmentType() != KNetworkAttachmentType_NAT); 322 327 m_pPromiscuousModeCombo->setEnabled(attachmentType() != KNetworkAttachmentType_Null && 323 328 attachmentType() != KNetworkAttachmentType_NAT); … … 616 621 617 622 /* UIMachineSettingsNetworkPage Stuff */ 618 UIMachineSettingsNetworkPage::UIMachineSettingsNetworkPage( bool fDisableStaticControls)623 UIMachineSettingsNetworkPage::UIMachineSettingsNetworkPage() 619 624 : m_pValidator(0) 620 625 , m_pTwAdapters(0) 621 , m_fDisableStaticControls(fDisableStaticControls)622 626 { 623 627 /* Setup main layout: */ … … 635 639 { 636 640 /* Creating adapter's page: */ 637 UIMachineSettingsNetwork *pPage = new UIMachineSettingsNetwork(this , m_fDisableStaticControls);641 UIMachineSettingsNetwork *pPage = new UIMachineSettingsNetwork(this); 638 642 /* Attach adapter's page to Tab Widget: */ 639 643 m_pTwAdapters->addTab(pPage, pPage->pageTitle()); 640 644 } 641 }642 643 void UIMachineSettingsNetworkPage::loadDirectlyFrom(const CMachine &machine)644 {645 qRegisterMetaType<UISettingsDataMachine>();646 UISettingsDataMachine data(machine);647 QVariant wrapper = QVariant::fromValue(data);648 loadToCacheFrom(wrapper);649 getFromCache();650 }651 652 void UIMachineSettingsNetworkPage::saveDirectlyTo(CMachine &machine)653 {654 qRegisterMetaType<UISettingsDataMachine>();655 UISettingsDataMachine data(machine);656 QVariant wrapper = QVariant::fromValue(data);657 putToCache();658 saveFromCacheTo(wrapper);659 645 } 660 646 … … 836 822 pPage->fetchAdapterData(m_cache.m_items[iSlot]); 837 823 838 /* Disable tab page of disabled adapter if it is being configured dynamically: */839 if (m_fDisableStaticControls && !m_cache.m_items[iSlot].m_fAdapterEnabled)840 m_pTwAdapters->setTabEnabled(iSlot, false);841 842 824 /* Setup page validation: */ 843 825 pPage->setValidator(m_pValidator); … … 885 867 const UINetworkAdapterData &data = m_cache.m_items[iSlot]; 886 868 887 /* Save main options: */ 888 adapter.SetEnabled(data.m_fAdapterEnabled); 889 switch (data.m_attachmentType) 890 { 891 case KNetworkAttachmentType_Null: 892 adapter.Detach(); 893 break; 894 case KNetworkAttachmentType_NAT: 895 adapter.AttachToNAT(); 896 break; 897 case KNetworkAttachmentType_Bridged: 898 adapter.SetHostInterface(data.m_strBridgedAdapterName); 899 adapter.AttachToBridgedInterface(); 900 break; 901 case KNetworkAttachmentType_Internal: 902 adapter.SetInternalNetwork(data.m_strInternalNetworkName); 903 adapter.AttachToInternalNetwork(); 904 break; 905 case KNetworkAttachmentType_HostOnly: 906 adapter.SetHostInterface(data.m_strHostInterfaceName); 907 adapter.AttachToHostOnlyInterface(); 908 break; 869 /* Save settings depending on dialog type: */ 870 switch (dialogType()) 871 { 872 /* Here come the properties which could be changed only in offline state: */ 873 case VBoxDefs::SettingsDialogType_Offline: 874 { 875 /* Basic attributes: */ 876 adapter.SetEnabled(data.m_fAdapterEnabled); 877 adapter.SetAdapterType(data.m_adapterType); 878 adapter.SetMACAddress(data.m_strMACAddress); 879 /* After that come the properties which could be changed at runtime too: */ 880 } 881 /* Here come the properties which could be changed at runtime too: */ 882 case VBoxDefs::SettingsDialogType_Runtime: 883 { 884 /* Attachment type: */ 885 switch (data.m_attachmentType) 886 { 887 case KNetworkAttachmentType_Null: 888 adapter.Detach(); 889 break; 890 case KNetworkAttachmentType_NAT: 891 adapter.AttachToNAT(); 892 break; 893 case KNetworkAttachmentType_Bridged: 894 adapter.SetHostInterface(data.m_strBridgedAdapterName); 895 adapter.AttachToBridgedInterface(); 896 break; 897 case KNetworkAttachmentType_Internal: 898 adapter.SetInternalNetwork(data.m_strInternalNetworkName); 899 adapter.AttachToInternalNetwork(); 900 break; 901 case KNetworkAttachmentType_HostOnly: 902 adapter.SetHostInterface(data.m_strHostInterfaceName); 903 adapter.AttachToHostOnlyInterface(); 904 break; 909 905 #ifdef VBOX_WITH_VDE 910 case KNetworkAttachmentType_VDE:911 adapter.SetVDENetwork(data.m_strVDENetworkName);912 adapter.AttachToVDE();913 break;906 case KNetworkAttachmentType_VDE: 907 adapter.SetVDENetwork(data.m_strVDENetworkName); 908 adapter.AttachToVDE(); 909 break; 914 910 #endif /* VBOX_WITH_VDE */ 911 default: 912 break; 913 } 914 /* Advanced attributes: */ 915 adapter.SetPromiscModePolicy(data.m_promiscuousMode); 916 /* Cable connected flag: */ 917 adapter.SetCableConnected(data.m_fCableConnected); 918 /* Redirect options: */ 919 QVector<QString> oldRedirects = adapter.GetNatDriver().GetRedirects(); 920 for (int i = 0; i < oldRedirects.size(); ++i) 921 adapter.GetNatDriver().RemoveRedirect(oldRedirects[i].section(',', 0, 0)); 922 UIPortForwardingDataList newRedirects = data.m_redirects; 923 for (int i = 0; i < newRedirects.size(); ++i) 924 { 925 UIPortForwardingData newRedirect = newRedirects[i]; 926 adapter.GetNatDriver().AddRedirect(newRedirect.name, newRedirect.protocol, 927 newRedirect.hostIp, newRedirect.hostPort.value(), 928 newRedirect.guestIp, newRedirect.guestPort.value()); 929 } 930 break; 931 } 915 932 default: 916 933 break; 917 }918 919 /* Save advanced options: */920 adapter.SetAdapterType(data.m_adapterType);921 adapter.SetPromiscModePolicy(data.m_promiscuousMode);922 adapter.SetMACAddress(data.m_strMACAddress);923 adapter.SetCableConnected(data.m_fCableConnected);924 925 /* Save redirect options: */926 QVector<QString> oldRedirects = adapter.GetNatDriver().GetRedirects();927 for (int i = 0; i < oldRedirects.size(); ++i)928 adapter.GetNatDriver().RemoveRedirect(oldRedirects[i].section(',', 0, 0));929 UIPortForwardingDataList newRedirects = data.m_redirects;930 for (int i = 0; i < newRedirects.size(); ++i)931 {932 UIPortForwardingData newRedirect = newRedirects[i];933 adapter.GetNatDriver().AddRedirect(newRedirect.name, newRedirect.protocol,934 newRedirect.hostIp, newRedirect.hostPort.value(),935 newRedirect.guestIp, newRedirect.guestPort.value());936 934 } 937 935 } … … 985 983 } 986 984 } 985 986 void UIMachineSettingsNetworkPage::polishPage() 987 { 988 /* Get the count of network adapter tabs: */ 989 int iCount = qMin(m_pTwAdapters->count(), m_cache.m_items.size()); 990 for (int iSlot = 0; iSlot < iCount; ++iSlot) 991 { 992 /* Polish iterated tab depending on dialog type: */ 993 switch (dialogType()) 994 { 995 case VBoxDefs::SettingsDialogType_Offline: 996 break; 997 case VBoxDefs::SettingsDialogType_Runtime: 998 { 999 if (!m_cache.m_items[iSlot].m_fAdapterEnabled) 1000 m_pTwAdapters->setTabEnabled(iSlot, false); 1001 break; 1002 } 1003 default: 1004 break; 1005 } 1006 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iSlot)); 1007 Assert(pTab); 1008 pTab->polishTab(); 1009 } 1010 } 1011 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r36104 r36357 67 67 UIMachineSettingsNetwork(UIMachineSettingsNetworkPage *pParent, bool fDisableStaticControls = false); 68 68 69 void polishTab(); 70 69 71 void fetchAdapterData(const UINetworkAdapterData &data); 70 72 void uploadAdapterData(UINetworkAdapterData &data); … … 111 113 112 114 bool m_fPolished; 113 bool m_fDisableStaticControls;114 115 UIPortForwardingDataList m_portForwardingRules; 115 116 }; … … 122 123 public: 123 124 124 UIMachineSettingsNetworkPage(bool fDisableStaticControls = false); 125 126 void loadDirectlyFrom(const CMachine &machine); 127 void saveDirectlyTo(CMachine &machine); 125 UIMachineSettingsNetworkPage(); 128 126 129 127 QStringList brgList(bool aRefresh = false); … … 159 157 private: 160 158 159 void polishPage(); 160 161 161 QIWidgetValidator *m_pValidator; 162 162 QITabWidget *m_pTwAdapters; … … 166 166 QStringList m_hoiList; 167 167 168 bool m_fDisableStaticControls;169 170 168 /* Cache: */ 171 169 UISettingsCacheMachineNetwork m_cache; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
r36324 r36357 26 26 27 27 /* UIMachineSettingsParallel stuff */ 28 UIMachineSettingsParallel::UIMachineSettingsParallel( )28 UIMachineSettingsParallel::UIMachineSettingsParallel(UIMachineSettingsParallelPage *pParent) 29 29 : QIWithRetranslateUI<QWidget> (0) 30 , m_pParent(pParent) 30 31 , mValidator(0) 31 32 , m_iSlot(-1) … … 56 57 /* Applying language settings */ 57 58 retranslateUi(); 59 } 60 61 void UIMachineSettingsParallel::polishTab() 62 { 63 /* Polish tab depending on dialog type: */ 64 switch (m_pParent->dialogType()) 65 { 66 case VBoxDefs::SettingsDialogType_Offline: 67 break; 68 case VBoxDefs::SettingsDialogType_Runtime: 69 mGbParallel->setEnabled(false); 70 mLbNumber->setEnabled(false); 71 mCbNumber->setEnabled(false); 72 mLbIRQ->setEnabled(false); 73 mLeIRQ->setEnabled(false); 74 mLbIOPort->setEnabled(false); 75 mLeIOPort->setEnabled(false); 76 mLbPath->setEnabled(false); 77 mLePath->setEnabled(false); 78 break; 79 default: 80 break; 81 } 58 82 } 59 83 … … 204 228 { 205 229 /* Creating port's page: */ 206 UIMachineSettingsParallel *pPage = new UIMachineSettingsParallel ;230 UIMachineSettingsParallel *pPage = new UIMachineSettingsParallel(this); 207 231 208 232 /* Loading port's data into page: */ … … 248 272 UISettingsPageMachine::fetchData(data); 249 273 250 /* Gather corresponding values from internal variables: */ 251 for (int iSlot = 0; iSlot < m_cache.m_items.size(); ++iSlot) 252 { 253 /* Get adapter: */ 254 CParallelPort port = m_machine.GetParallelPort(iSlot); 255 256 /* Get cached data for this slot: */ 257 const UIParallelPortData &data = m_cache.m_items[iSlot]; 258 259 /* Save options: */ 260 port.SetIRQ(data.m_uIRQ); 261 port.SetIOBase(data.m_uIOBase); 262 port.SetPath(data.m_strPath); 263 port.SetEnabled(data.m_fPortEnabled); 274 /* Save settings depending on dialog type: */ 275 switch (dialogType()) 276 { 277 /* Here come the properties which could be changed only in offline state: */ 278 case VBoxDefs::SettingsDialogType_Offline: 279 { 280 /* Gather corresponding values from internal variables: */ 281 for (int iSlot = 0; iSlot < m_cache.m_items.size(); ++iSlot) 282 { 283 /* Get adapter: */ 284 CParallelPort port = m_machine.GetParallelPort(iSlot); 285 286 /* Get cached data for this slot: */ 287 const UIParallelPortData &data = m_cache.m_items[iSlot]; 288 289 /* Save options: */ 290 port.SetIRQ(data.m_uIRQ); 291 port.SetIOBase(data.m_uIOBase); 292 port.SetPath(data.m_strPath); 293 port.SetEnabled(data.m_fPortEnabled); 294 } 295 break; 296 } 297 /* Here come the properties which could be changed at runtime too: */ 298 case VBoxDefs::SettingsDialogType_Runtime: 299 break; 300 default: 301 break; 264 302 } 265 303 … … 332 370 } 333 371 372 void UIMachineSettingsParallelPage::polishPage() 373 { 374 /* Get the count of parallel port tabs: */ 375 for (int iTabIndex = 0; iTabIndex < mTabWidget->count(); ++iTabIndex) 376 { 377 /* Polish iterated tab depending on dialog type: */ 378 switch (dialogType()) 379 { 380 case VBoxDefs::SettingsDialogType_Offline: 381 break; 382 case VBoxDefs::SettingsDialogType_Runtime: 383 { 384 if (!m_cache.m_items[iTabIndex].m_fPortEnabled) 385 mTabWidget->setTabEnabled(iTabIndex, false); 386 break; 387 } 388 default: 389 break; 390 } 391 UIMachineSettingsParallel *pTab = qobject_cast<UIMachineSettingsParallel*>(mTabWidget->widget(iTabIndex)); 392 Assert(pTab); 393 pTab->polishTab(); 394 } 395 } 396 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h
r33882 r36357 6 6 7 7 /* 8 * Copyright (C) 2006-201 0Oracle Corporation8 * Copyright (C) 2006-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 #include "COMDefs.h" 25 25 26 /* Forward declarations */ 27 class UIMachineSettingsParallelPage; 26 28 class QITabWidget; 27 29 … … 48 50 public: 49 51 50 UIMachineSettingsParallel(); 52 UIMachineSettingsParallel(UIMachineSettingsParallelPage *pParent); 53 54 void polishTab(); 51 55 52 56 void fetchPortData(const UIParallelPortData &data); … … 71 75 private: 72 76 77 UIMachineSettingsParallelPage *m_pParent; 73 78 QIWidgetValidator *mValidator; 74 79 int m_iSlot; … … 107 112 private: 108 113 114 void polishPage(); 115 109 116 QIWidgetValidator *mValidator; 110 117 QITabWidget *mTabWidget; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r35475 r36357 7 7 8 8 /* 9 * Copyright (C) 2008-201 0Oracle Corporation9 * Copyright (C) 2008-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 166 166 167 167 UIMachineSettingsSF::UIMachineSettingsSF() 168 : m_type( WrongType)168 : m_type(MachineType) 169 169 , mNewAction(0), mEdtAction(0), mDelAction(0) 170 170 , mIsListViewChanged(false) … … 212 212 } 213 213 214 void UIMachineSettingsSF::loadDirectlyFrom(const CConsole &console)215 {216 loadToCacheFromMachine(console.GetMachine());217 loadToCacheFromConsole(console);218 getFromCache();219 }220 221 void UIMachineSettingsSF::saveDirectlyTo(CConsole &console)222 {223 putToCache();224 saveFromCacheToConsole(console);225 CMachine machine = console.GetMachine();226 saveFromCacheToMachine(machine);227 }228 229 214 void UIMachineSettingsSF::resizeEvent (QResizeEvent *aEvent) 230 215 { … … 241 226 242 227 /* Fill internal variables with corresponding values: */ 243 loadToCacheFromMachine(m_machine); 228 if (!m_machine.isNull()) 229 loadToCacheFromMachine(); 230 if (!m_console.isNull()) 231 loadToCacheFromConsole(); 244 232 245 233 /* Upload machine to data: */ … … 247 235 } 248 236 249 void UIMachineSettingsSF::loadToCacheFromMachine(const CMachine &machine) 250 { 251 /* Update dialog type: */ 252 if (m_type == WrongType) 253 m_type = MachineType; 237 void UIMachineSettingsSF::loadToCacheFromMachine() 238 { 254 239 /* Load machine items into internal cache: */ 255 loadToCacheFromVector(machine.GetSharedFolders(), MachineType); 256 } 257 258 void UIMachineSettingsSF::loadToCacheFromConsole(const CConsole &console) 259 { 260 /* Update dialog type: */ 261 if (m_type == WrongType || m_type == MachineType) 262 m_type = ConsoleType; 240 loadToCacheFromVector(m_machine.GetSharedFolders(), MachineType); 241 } 242 243 void UIMachineSettingsSF::loadToCacheFromConsole() 244 { 263 245 /* Load console items into internal cache: */ 264 loadToCacheFromVector( console.GetSharedFolders(), ConsoleType);246 loadToCacheFromVector(m_console.GetSharedFolders(), ConsoleType); 265 247 } 266 248 … … 324 306 SFTreeViewItem *pFolderTypeRoot = static_cast<SFTreeViewItem*>(pMainRootItem->child(iFodlersTypeIndex)); 325 307 UISharedFolderType type = (UISharedFolderType)pFolderTypeRoot->text(1).toInt(); 326 AssertMsg(type != WrongType, ("Incorrent folders type!"));327 308 /* Iterate other all the folder items: */ 328 309 for (int iFoldersIndex = 0; iFoldersIndex < pFolderTypeRoot->childCount(); ++iFoldersIndex) … … 348 329 349 330 /* Gather corresponding values from internal variables: */ 350 saveFromCacheToMachine(m_machine); 331 if (!m_machine.isNull()) 332 saveFromCacheToMachine(); 333 if (!m_console.isNull()) 334 saveFromCacheToConsole(); 351 335 352 336 /* Upload machine to data: */ … … 354 338 } 355 339 356 void UIMachineSettingsSF::saveFromCacheToMachine( CMachine &machine)340 void UIMachineSettingsSF::saveFromCacheToMachine() 357 341 { 358 342 /* Check if items were NOT changed: */ … … 361 345 362 346 /* Delete all machine folders first: */ 363 const CSharedFolderVector &folders = m achine.GetSharedFolders();347 const CSharedFolderVector &folders = m_machine.GetSharedFolders(); 364 348 for (int iFolderIndex = 0; iFolderIndex < folders.size() && !failed(); ++iFolderIndex) 365 349 { … … 367 351 QString strFolderName = folder.GetName(); 368 352 QString strFolderPath = folder.GetHostPath(); 369 m achine.RemoveSharedFolder(strFolderName);370 if (!m achine.isOk())353 m_machine.RemoveSharedFolder(strFolderName); 354 if (!m_machine.isOk()) 371 355 { 372 356 /* Mark the page as failed: */ 373 357 setFailed(true); 374 358 /* Show error message: */ 375 vboxProblem().cannotRemoveSharedFolder(m achine, strFolderName, strFolderPath);359 vboxProblem().cannotRemoveSharedFolder(m_machine, strFolderName, strFolderPath); 376 360 } 377 361 } … … 383 367 if (data.m_type == MachineType) 384 368 { 385 m achine.CreateSharedFolder(data.m_strName, data.m_strHostPath, data.m_fWritable, data.m_fAutoMount);386 if (!m achine.isOk())369 m_machine.CreateSharedFolder(data.m_strName, data.m_strHostPath, data.m_fWritable, data.m_fAutoMount); 370 if (!m_machine.isOk()) 387 371 { 388 372 /* Mark the page as failed: */ 389 373 setFailed(true); 390 374 /* Show error message: */ 391 vboxProblem().cannotCreateSharedFolder(m achine, data.m_strName, data.m_strHostPath);375 vboxProblem().cannotCreateSharedFolder(m_machine, data.m_strName, data.m_strHostPath); 392 376 } 393 377 } … … 395 379 } 396 380 397 void UIMachineSettingsSF::saveFromCacheToConsole( CConsole &console)381 void UIMachineSettingsSF::saveFromCacheToConsole() 398 382 { 399 383 /* Check if items were NOT changed: */ … … 402 386 403 387 /* Delete all console folders first: */ 404 const CSharedFolderVector &folders = console.GetSharedFolders();388 const CSharedFolderVector &folders = m_console.GetSharedFolders(); 405 389 for (int iFolderIndex = 0; iFolderIndex < folders.size() && !failed(); ++iFolderIndex) 406 390 { … … 408 392 QString strFolderName = folder.GetName(); 409 393 QString strFolderPath = folder.GetHostPath(); 410 console.RemoveSharedFolder(strFolderName);411 if (! console.isOk())394 m_console.RemoveSharedFolder(strFolderName); 395 if (!m_console.isOk()) 412 396 { 413 397 /* Mark the page as failed: */ 414 398 setFailed(true); 415 399 /* Show error message: */ 416 vboxProblem().cannotRemoveSharedFolder( console, strFolderName, strFolderPath);400 vboxProblem().cannotRemoveSharedFolder(m_console, strFolderName, strFolderPath); 417 401 } 418 402 } … … 424 408 if (data.m_type == ConsoleType) 425 409 { 426 console.CreateSharedFolder(data.m_strName, data.m_strHostPath, data.m_fWritable, data.m_fAutoMount);427 if (! console.isOk())410 m_console.CreateSharedFolder(data.m_strName, data.m_strHostPath, data.m_fWritable, data.m_fAutoMount); 411 if (!m_console.isOk()) 428 412 { 429 413 /* Mark the page as failed: */ 430 414 setFailed(true); 431 415 /* Show error message: */ 432 vboxProblem().cannotCreateSharedFolder( console, data.m_strName, data.m_strHostPath);416 vboxProblem().cannotCreateSharedFolder(m_console, data.m_strName, data.m_strHostPath); 433 417 } 434 418 } … … 717 701 } 718 702 703 void UIMachineSettingsSF::setDialogType(VBoxDefs::SettingsDialogType settingsDialogType) 704 { 705 UISettingsPageMachine::setDialogType(settingsDialogType); 706 m_type = dialogType() == VBoxDefs::SettingsDialogType_Runtime ? ConsoleType : MachineType; 707 } 708 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h
r33882 r36357 6 6 7 7 /* 8 * Copyright (C) 2008-201 0Oracle Corporation8 * Copyright (C) 2008-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 27 27 class SFTreeViewItem; 28 28 29 enum UISharedFolderType 30 { 31 WrongType = 0x00, 32 MachineType = 0x01, 33 ConsoleType = 0x02 34 }; 29 enum UISharedFolderType { MachineType, ConsoleType }; 35 30 typedef QPair <QString, UISharedFolderType> SFolderName; 36 31 typedef QList <SFolderName> SFoldersNameList; … … 62 57 UIMachineSettingsSF(); 63 58 64 void loadDirectlyFrom(const CConsole &console);65 void saveDirectlyTo(CConsole &console);66 67 59 protected: 68 60 … … 70 62 * this task COULD be performed in other than GUI thread: */ 71 63 void loadToCacheFrom(QVariant &data); 72 void loadToCacheFromMachine( const CMachine &machine);73 void loadToCacheFromConsole( const CConsole &console);64 void loadToCacheFromMachine(); 65 void loadToCacheFromConsole(); 74 66 void loadToCacheFromVector(const CSharedFolderVector &vector, UISharedFolderType type); 75 67 /* Load data to corresponding widgets from cache, … … 83 75 * this task COULD be performed in other than GUI thread: */ 84 76 void saveFromCacheTo(QVariant &data); 85 void saveFromCacheToMachine( CMachine &machine);86 void saveFromCacheToConsole( CConsole &console);77 void saveFromCacheToMachine(); 78 void saveFromCacheToConsole(); 87 79 88 80 void setOrderAfter (QWidget *aWidget); … … 112 104 SFoldersNameList usedList (bool aIncludeSelected); 113 105 106 void setDialogType(VBoxDefs::SettingsDialogType settingsDialogType); 107 114 108 UISharedFolderType m_type; 115 109 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r36324 r36357 26 26 27 27 /* UIMachineSettingsSerial stuff */ 28 UIMachineSettingsSerial::UIMachineSettingsSerial( )28 UIMachineSettingsSerial::UIMachineSettingsSerial(UIMachineSettingsSerialPage *pParent) 29 29 : QIWithRetranslateUI<QWidget> (0) 30 , m_pParent(pParent) 30 31 , mValidator(0) 31 32 , m_iSlot(-1) … … 63 64 /* Applying language settings */ 64 65 retranslateUi(); 66 } 67 68 void UIMachineSettingsSerial::polishTab() 69 { 70 /* Polish tab depending on dialog type: */ 71 switch (m_pParent->dialogType()) 72 { 73 case VBoxDefs::SettingsDialogType_Offline: 74 break; 75 case VBoxDefs::SettingsDialogType_Runtime: 76 mGbSerial->setEnabled(false); 77 mLbNumber->setEnabled(false); 78 mCbNumber->setEnabled(false); 79 mLbIRQ->setEnabled(false); 80 mLeIRQ->setEnabled(false); 81 mLbIOPort->setEnabled(false); 82 mLeIOPort->setEnabled(false); 83 mLbMode->setEnabled(false); 84 mCbMode->setEnabled(false); 85 mCbPipe->setEnabled(false); 86 mLbPath->setEnabled(false); 87 mLePath->setEnabled(false); 88 break; 89 default: 90 break; 91 } 65 92 } 66 93 … … 195 222 { 196 223 /* Creating port's page: */ 197 UIMachineSettingsSerial *pPage = new UIMachineSettingsSerial ;224 UIMachineSettingsSerial *pPage = new UIMachineSettingsSerial(this); 198 225 199 226 /* Attach port's page to Tab Widget: */ … … 294 321 UISettingsPageMachine::fetchData(data); 295 322 296 /* Gather corresponding values from internal variables: */ 297 for (int iSlot = 0; iSlot < m_cache.m_items.size(); ++iSlot) 298 { 299 /* Get adapter: */ 300 CSerialPort port = m_machine.GetSerialPort(iSlot); 301 302 /* Get cached data for this slot: */ 303 const UISerialPortData &data = m_cache.m_items[iSlot]; 304 305 /* Save options: */ 306 port.SetEnabled(data.m_fPortEnabled); 307 port.SetIRQ(data.m_uIRQ); 308 port.SetIOBase(data.m_uIOBase); 309 port.SetServer(data.m_fServer); 310 port.SetPath(data.m_strPath); 311 /* This *must* be last. The host mode will be changed to disconnected if 312 * some of the necessary settings above will not meet the requirements for 313 * the selected mode. */ 314 port.SetHostMode(data.m_hostMode); 323 /* Save settings depending on dialog type: */ 324 switch (dialogType()) 325 { 326 /* Here come the properties which could be changed only in offline state: */ 327 case VBoxDefs::SettingsDialogType_Offline: 328 { 329 /* Gather corresponding values from internal variables: */ 330 for (int iSlot = 0; iSlot < m_cache.m_items.size(); ++iSlot) 331 { 332 /* Get adapter: */ 333 CSerialPort port = m_machine.GetSerialPort(iSlot); 334 335 /* Get cached data for this slot: */ 336 const UISerialPortData &data = m_cache.m_items[iSlot]; 337 338 /* Save options: */ 339 port.SetEnabled(data.m_fPortEnabled); 340 port.SetIRQ(data.m_uIRQ); 341 port.SetIOBase(data.m_uIOBase); 342 port.SetServer(data.m_fServer); 343 port.SetPath(data.m_strPath); 344 /* This *must* be last. The host mode will be changed to disconnected if 345 * some of the necessary settings above will not meet the requirements for 346 * the selected mode. */ 347 port.SetHostMode(data.m_hostMode); 348 } 349 break; 350 } 351 /* Here come the properties which could be changed at runtime too: */ 352 case VBoxDefs::SettingsDialogType_Runtime: 353 break; 354 default: 355 break; 315 356 } 316 357 … … 393 434 } 394 435 436 void UIMachineSettingsSerialPage::polishPage() 437 { 438 /* Get the count of serial port tabs: */ 439 for (int iTabIndex = 0; iTabIndex < mTabWidget->count(); ++iTabIndex) 440 { 441 /* Polish iterated tab depending on dialog type: */ 442 switch (dialogType()) 443 { 444 case VBoxDefs::SettingsDialogType_Offline: 445 break; 446 case VBoxDefs::SettingsDialogType_Runtime: 447 { 448 if (!m_cache.m_items[iTabIndex].m_fPortEnabled) 449 mTabWidget->setTabEnabled(iTabIndex, false); 450 break; 451 } 452 default: 453 break; 454 } 455 UIMachineSettingsSerial *pTab = qobject_cast<UIMachineSettingsSerial*>(mTabWidget->widget(iTabIndex)); 456 Assert(pTab); 457 pTab->polishTab(); 458 } 459 } 460 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h
r33882 r36357 6 6 7 7 /* 8 * Copyright (C) 2006-201 0Oracle Corporation8 * Copyright (C) 2006-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 #include "COMDefs.h" 25 25 26 /* Forward declarations */ 27 class UIMachineSettingsSerialPage; 26 28 class QITabWidget; 27 29 … … 51 53 public: 52 54 53 UIMachineSettingsSerial(); 55 UIMachineSettingsSerial(UIMachineSettingsSerialPage *pParent); 56 57 void polishTab(); 54 58 55 59 void fetchPortData(const UISerialPortData &data); … … 75 79 private: 76 80 81 UIMachineSettingsSerialPage *m_pParent; 77 82 QIWidgetValidator *mValidator; 78 83 int m_iSlot; … … 111 116 private: 112 117 118 void polishPage(); 119 113 120 QIWidgetValidator *mValidator; 114 121 QITabWidget *mTabWidget; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r35475 r36357 7 7 8 8 /* 9 * Copyright (C) 2006-201 0Oracle Corporation9 * Copyright (C) 2006-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 766 766 , mToolTipType (DefaultToolTip) 767 767 , m_chipsetType(KChipsetType_PIIX3) 768 , m_dialogType(VBoxDefs::SettingsDialogType_Wrong) 768 769 { 769 770 } … … 935 936 case R_IsMoreIDEControllersPossible: 936 937 { 937 return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_IDE) < 938 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (chipsetType(), KStorageBus_IDE); 938 return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) && 939 (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_IDE) < 940 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_IDE)); 939 941 } 940 942 case R_IsMoreSATAControllersPossible: 941 943 { 942 return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_SATA) < 943 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (chipsetType(), KStorageBus_SATA); 944 return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) && 945 (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SATA) < 946 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SATA)); 944 947 } 945 948 case R_IsMoreSCSIControllersPossible: 946 949 { 947 return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_SCSI) < 948 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (chipsetType(), KStorageBus_SCSI); 950 return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) && 951 (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SCSI) < 952 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SCSI)); 949 953 } 950 954 case R_IsMoreFloppyControllersPossible: 951 955 { 952 return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_Floppy) < 953 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (chipsetType(), KStorageBus_Floppy); 956 return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) && 957 (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_Floppy) < 958 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_Floppy)); 954 959 } 955 960 case R_IsMoreSASControllersPossible: 956 961 { 957 return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_SAS) < 958 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (chipsetType(), KStorageBus_SAS); 962 return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) && 963 (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SAS) < 964 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SAS)); 959 965 } 960 966 case R_IsMoreAttachmentsPossible: … … 966 972 ControllerItem *ctr = static_cast <ControllerItem*> (item); 967 973 CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties(); 968 return (uint) rowCount (aIndex) < sp.GetMaxPortCountForStorageBus (ctr->ctrBusType()) * 969 sp.GetMaxDevicesPerPortForStorageBus (ctr->ctrBusType()); 974 return (m_dialogType == VBoxDefs::SettingsDialogType_Offline) && 975 ((uint)rowCount(aIndex) < sp.GetMaxPortCountForStorageBus(ctr->ctrBusType()) * 976 sp.GetMaxDevicesPerPortForStorageBus(ctr->ctrBusType())); 970 977 } 971 978 } … … 1411 1418 { 1412 1419 m_chipsetType = type; 1420 } 1421 1422 void StorageModel::setDialogType(VBoxDefs::SettingsDialogType dialogType) 1423 { 1424 m_dialogType = dialogType; 1413 1425 } 1414 1426 … … 1885 1897 UISettingsPageMachine::fetchData(data); 1886 1898 1887 /* Remove currently present controllers & attachments */ 1888 const CStorageControllerVector &controllers = m_machine.GetStorageControllers(); 1889 for (int iControllerIndex = 0; iControllerIndex < controllers.size(); ++iControllerIndex) 1890 { 1891 const CStorageController &controller = controllers[iControllerIndex]; 1892 QString strControllerName(controller.GetName()); 1893 const CMediumAttachmentVector &attachments = m_machine.GetMediumAttachmentsOfController(strControllerName); 1894 for (int iAttachmentIndex = 0; iAttachmentIndex < attachments.size(); ++iAttachmentIndex) 1895 { 1896 const CMediumAttachment &attachment = attachments[iAttachmentIndex]; 1897 m_machine.DetachDevice(strControllerName, attachment.GetPort(), attachment.GetDevice()); 1898 } 1899 m_machine.RemoveStorageController(strControllerName); 1900 } 1901 /* Save created controllers: */ 1902 for (int iControllerIndex = 0; iControllerIndex < m_cache.m_items.size() && !failed(); ++iControllerIndex) 1903 { 1904 const UIStorageControllerData &controllerData = m_cache.m_items[iControllerIndex]; 1905 CStorageController controller = m_machine.AddStorageController(controllerData.m_strControllerName, controllerData.m_controllerBus); 1906 controller.SetControllerType(controllerData.m_controllerType); 1907 controller.SetUseHostIOCache(controllerData.m_fUseHostIOCache); 1908 int cMaxUsedPort = -1; 1909 /* Save created attachments: */ 1910 for (int iAttachmentIndex = 0; iAttachmentIndex < controllerData.m_items.size() && !failed(); ++iAttachmentIndex) 1911 { 1912 const UIStorageAttachmentData &attachmentData = controllerData.m_items[iAttachmentIndex]; 1913 VBoxMedium vboxMedium = vboxGlobal().findMedium(attachmentData.m_strAttachmentMediumId); 1914 CMedium comMedium = vboxMedium.medium(); 1915 m_machine.AttachDevice(controllerData.m_strControllerName, 1916 attachmentData.m_iAttachmentPort, attachmentData.m_iAttachmentDevice, 1917 attachmentData.m_attachmentType, comMedium); 1918 if (m_machine.isOk()) 1899 /* Save settings depending on dialog type: */ 1900 switch (dialogType()) 1901 { 1902 /* Here come the properties which could be changed only in offline state: */ 1903 case VBoxDefs::SettingsDialogType_Offline: 1904 { 1905 /* Remove currently present controllers & attachments */ 1906 const CStorageControllerVector &controllers = m_machine.GetStorageControllers(); 1907 for (int iControllerIndex = 0; iControllerIndex < controllers.size(); ++iControllerIndex) 1919 1908 { 1920 if (attachmentData.m_attachmentType == KDeviceType_DVD) 1921 m_machine.PassthroughDevice(controllerData.m_strControllerName, 1922 attachmentData.m_iAttachmentPort, attachmentData.m_iAttachmentDevice, 1923 attachmentData.m_fAttachmentPassthrough); 1924 cMaxUsedPort = attachmentData.m_iAttachmentPort > cMaxUsedPort ? attachmentData.m_iAttachmentPort : cMaxUsedPort; 1909 /* Get iterated controller: */ 1910 const CStorageController &controller = controllers[iControllerIndex]; 1911 QString strControllerName(controller.GetName()); 1912 const CMediumAttachmentVector &attachments = m_machine.GetMediumAttachmentsOfController(strControllerName); 1913 /* Remove all the attachments first: */ 1914 for (int iAttachmentIndex = 0; iAttachmentIndex < attachments.size(); ++iAttachmentIndex) 1915 { 1916 /* Get iterated attachment: */ 1917 const CMediumAttachment &attachment = attachments[iAttachmentIndex]; 1918 m_machine.DetachDevice(strControllerName, attachment.GetPort(), attachment.GetDevice()); 1919 } 1920 /* Remove the controller itself finally: */ 1921 m_machine.RemoveStorageController(strControllerName); 1925 1922 } 1926 else 1923 /* Save created controllers: */ 1924 for (int iControllerIndex = 0; iControllerIndex < m_cache.m_items.size() && !failed(); ++iControllerIndex) 1927 1925 { 1928 /* Mark the page as failed: */ 1929 setFailed(true); 1930 /* Show error message: */ 1931 vboxProblem().cannotAttachDevice(m_machine, VBoxDefs::MediumType_HardDisk, vboxMedium.location(), 1932 StorageSlot(controllerData.m_controllerBus, 1933 attachmentData.m_iAttachmentPort, 1934 attachmentData.m_iAttachmentDevice), this); 1926 /* Get iterated controller's data: */ 1927 const UIStorageControllerData &controllerData = m_cache.m_items[iControllerIndex]; 1928 CStorageController controller = m_machine.AddStorageController(controllerData.m_strControllerName, controllerData.m_controllerBus); 1929 controller.SetControllerType(controllerData.m_controllerType); 1930 controller.SetUseHostIOCache(controllerData.m_fUseHostIOCache); 1931 int cMaxUsedPort = -1; 1932 /* Save created attachments: */ 1933 for (int iAttachmentIndex = 0; iAttachmentIndex < controllerData.m_items.size() && !failed(); ++iAttachmentIndex) 1934 { 1935 /* Get iterated attachment: */ 1936 const UIStorageAttachmentData &attachmentData = controllerData.m_items[iAttachmentIndex]; 1937 /* Search for newly assigned medium in GUI cache: */ 1938 VBoxMedium vboxMedium = vboxGlobal().findMedium(attachmentData.m_strAttachmentMediumId); 1939 /* Get corresponding COM-wrapped medium object: */ 1940 CMedium comMedium = vboxMedium.medium(); 1941 /* Add corresponding attachment: */ 1942 m_machine.AttachDevice(controllerData.m_strControllerName, 1943 attachmentData.m_iAttachmentPort, attachmentData.m_iAttachmentDevice, 1944 attachmentData.m_attachmentType, comMedium); 1945 if (m_machine.isOk()) 1946 { 1947 if (attachmentData.m_attachmentType == KDeviceType_DVD) 1948 m_machine.PassthroughDevice(controllerData.m_strControllerName, 1949 attachmentData.m_iAttachmentPort, attachmentData.m_iAttachmentDevice, 1950 attachmentData.m_fAttachmentPassthrough); 1951 cMaxUsedPort = attachmentData.m_iAttachmentPort > cMaxUsedPort ? attachmentData.m_iAttachmentPort : cMaxUsedPort; 1952 } 1953 else 1954 { 1955 /* Mark the page as failed: */ 1956 setFailed(true); 1957 /* Show error message: */ 1958 vboxProblem().cannotAttachDevice(m_machine, 1959 vboxGlobal().mediumTypeToLocal(attachmentData.m_attachmentType), 1960 vboxMedium.location(), 1961 StorageSlot(controllerData.m_controllerBus, 1962 attachmentData.m_iAttachmentPort, 1963 attachmentData.m_iAttachmentDevice), 1964 this); 1965 } 1966 } 1967 if (!failed() && controllerData.m_controllerBus == KStorageBus_SATA) 1968 { 1969 ULONG uSataPortsCount = cMaxUsedPort + 1; 1970 uSataPortsCount = qMax(uSataPortsCount, controller.GetMinPortCount()); 1971 uSataPortsCount = qMin(uSataPortsCount, controller.GetMaxPortCount()); 1972 controller.SetPortCount(uSataPortsCount); 1973 } 1935 1974 } 1936 } 1937 if (!failed() && controllerData.m_controllerBus == KStorageBus_SATA) 1938 { 1939 ULONG uSataPortsCount = cMaxUsedPort + 1; 1940 uSataPortsCount = qMax(uSataPortsCount, controller.GetMinPortCount()); 1941 uSataPortsCount = qMin(uSataPortsCount, controller.GetMaxPortCount()); 1942 controller.SetPortCount(uSataPortsCount); 1943 } 1975 break; 1976 } 1977 /* Here come the properties which could be changed at runtime too: */ 1978 case VBoxDefs::SettingsDialogType_Runtime: 1979 { 1980 /* Iterate all the controllers and update changed CD/DVD and floppy attachments: */ 1981 for (int iControllerIndex = 0; iControllerIndex < m_cache.m_items.size() && !failed(); ++iControllerIndex) 1982 { 1983 /* Get iterated controller: */ 1984 const UIStorageControllerData &controllerData = m_cache.m_items[iControllerIndex]; 1985 CStorageController controller = m_machine.GetStorageControllerByName(controllerData.m_strControllerName); 1986 AssertMsg(!controller.isNull(), ("Corresponding storage controller must be present!\n")); 1987 /* Save changed attachments: */ 1988 for (int iAttachmentIndex = 0; iAttachmentIndex < controllerData.m_items.size() && !failed(); ++iAttachmentIndex) 1989 { 1990 /* Get iterated attachment: */ 1991 const UIStorageAttachmentData &attachmentData = controllerData.m_items[iAttachmentIndex]; 1992 /* Update only DVD and floppy attachments: */ 1993 if (attachmentData.m_attachmentType != KDeviceType_DVD && 1994 attachmentData.m_attachmentType != KDeviceType_Floppy) 1995 continue; 1996 /* Search for newly assigned medium in GUI cache: */ 1997 VBoxMedium vboxMedium = vboxGlobal().findMedium(attachmentData.m_strAttachmentMediumId); 1998 /* Get corresponding COM-wrapped medium object: */ 1999 CMedium comMedium = vboxMedium.medium(); 2000 /* Update corresponding medium: */ 2001 m_machine.MountMedium(controllerData.m_strControllerName, 2002 attachmentData.m_iAttachmentPort, attachmentData.m_iAttachmentDevice, 2003 comMedium, true /* may the force be with you */); 2004 if (!m_machine.isOk()) 2005 { 2006 /* Mark the page as failed: */ 2007 setFailed(true); 2008 /* Show error message: */ 2009 vboxProblem().cannotAttachDevice(m_machine, 2010 vboxGlobal().mediumTypeToLocal(attachmentData.m_attachmentType), 2011 vboxMedium.location(), 2012 StorageSlot(controllerData.m_controllerBus, 2013 attachmentData.m_iAttachmentPort, 2014 attachmentData.m_iAttachmentDevice), 2015 this); 2016 } 2017 } 2018 } 2019 break; 2020 } 2021 default: 2022 break; 1944 2023 } 1945 2024 … … 2301 2380 m_pMediumIdHolder->setType(vboxGlobal().mediumTypeToLocal(device)); 2302 2381 m_pMediumIdHolder->setId(mStorageModel->data(index, StorageModel::R_AttMediumId).toString()); 2382 mLbMedium->setEnabled(dialogType() == VBoxDefs::SettingsDialogType_Offline || device != KDeviceType_HardDisk); 2383 mTbOpen->setEnabled(dialogType() == VBoxDefs::SettingsDialogType_Offline || device != KDeviceType_HardDisk); 2303 2384 2304 2385 /* Getting Passthrough state */ … … 2521 2602 mAddFDAttAction->setEnabled (isController && isAttachmentsPossible); 2522 2603 2523 mDelCtrAction->setEnabled ( isController);2524 mDelAttAction->setEnabled ( isAttachment);2604 mDelCtrAction->setEnabled (dialogType() == VBoxDefs::SettingsDialogType_Offline && isController); 2605 mDelAttAction->setEnabled (dialogType() == VBoxDefs::SettingsDialogType_Offline && isAttachment); 2525 2606 } 2526 2607 … … 2985 3066 } 2986 3067 3068 void UIMachineSettingsStorage::setDialogType(VBoxDefs::SettingsDialogType settingsDialogType) 3069 { 3070 UISettingsPageMachine::setDialogType(settingsDialogType); 3071 mStorageModel->setDialogType(dialogType()); 3072 } 3073 3074 void UIMachineSettingsStorage::polishPage() 3075 { 3076 /* Polish page depending on dialog type: */ 3077 switch (dialogType()) 3078 { 3079 case VBoxDefs::SettingsDialogType_Offline: 3080 break; 3081 case VBoxDefs::SettingsDialogType_Runtime: 3082 /* Controller stuff: */ 3083 mLbName->setEnabled(false); 3084 mLeName->setEnabled(false); 3085 mLbType->setEnabled(false); 3086 mCbType->setEnabled(false); 3087 mCbIoCache->setEnabled(false); 3088 /* Attachment stuff: */ 3089 mCbSlot->setEnabled(false); 3090 mCbPassthrough->setEnabled(false); 3091 break; 3092 default: 3093 break; 3094 } 3095 } 3096 2987 3097 #include "UIMachineSettingsStorage.moc" 2988 3098 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r34961 r36357 6 6 7 7 /* 8 * Copyright (C) 2006-201 0Oracle Corporation8 * Copyright (C) 2006-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 503 503 void setChipsetType(KChipsetType type); 504 504 505 void setDialogType(VBoxDefs::SettingsDialogType dialogType); 506 505 507 QMap<KStorageBus, int> currentControllerTypes() const; 506 508 QMap<KStorageBus, int> maximumControllerTypes() const; … … 521 523 522 524 KChipsetType m_chipsetType; 525 VBoxDefs::SettingsDialogType m_dialogType; 523 526 }; 524 527 Q_DECLARE_METATYPE (StorageModel::ToolTipType); … … 669 672 void addChooseHostDriveActions(QMenu *pOpenMediumMenu); 670 673 void addRecentMediumActions(QMenu *pOpenMediumMenu, VBoxDefs::MediumType recentMediumType); 674 675 void setDialogType(VBoxDefs::SettingsDialogType settingsDialogType); 676 void polishPage(); 671 677 672 678 QIWidgetValidator *mValidator; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r34063 r36357 7 7 8 8 /* 9 * Copyright (C) 2008-201 0Oracle Corporation9 * Copyright (C) 2008-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 286 286 UISettingsPageMachine::fetchData(data); 287 287 288 /* Gather corresponding values from internal variables: */ 289 int iBootIndex = 0; 290 /* Save boot-items of current VM: */ 291 for (int i = 0; i < m_cache.m_bootItems.size(); ++i) 292 { 293 if (m_cache.m_bootItems[i].m_fEnabled) 294 m_machine.SetBootOrder(++iBootIndex, m_cache.m_bootItems[i].m_type); 295 } 296 /* Save other unique boot-items: */ 297 for (int i = 0; i < m_cache.m_bootItems.size(); ++i) 298 { 299 if (!m_cache.m_bootItems[i].m_fEnabled) 300 m_machine.SetBootOrder(++iBootIndex, KDeviceType_Null); 301 } 302 m_machine.GetBIOSSettings().SetIOAPICEnabled(m_cache.m_fIoApicEnabled); 303 m_machine.SetFirmwareType(m_cache.m_fEFIEnabled ? KFirmwareType_EFI : KFirmwareType_BIOS); 304 m_machine.SetRTCUseUTC(m_cache.m_fUTCEnabled); 305 m_machine.SetPointingHidType(m_cache.m_fUseAbsHID ? KPointingHidType_USBTablet : KPointingHidType_PS2Mouse); 306 m_machine.SetCPUProperty(KCPUPropertyType_PAE, m_cache.m_fPAEEnabled); 307 m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, m_cache.m_fHwVirtExEnabled); 308 m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, m_cache.m_fNestedPagingEnabled); 309 m_machine.SetMemorySize(m_cache.m_iRAMSize); 310 m_machine.SetCPUCount(m_cache.m_cCPUCount); 311 m_machine.SetChipsetType(m_cache.m_chipsetType); 288 /* Save settings depending on dialog type: */ 289 switch (dialogType()) 290 { 291 /* Here come the properties which could be changed only in offline state: */ 292 case VBoxDefs::SettingsDialogType_Offline: 293 { 294 /* Motherboard tab: */ 295 m_machine.SetMemorySize(m_cache.m_iRAMSize); 296 int iBootIndex = 0; 297 /* Save boot-items of current VM: */ 298 for (int i = 0; i < m_cache.m_bootItems.size(); ++i) 299 { 300 if (m_cache.m_bootItems[i].m_fEnabled) 301 m_machine.SetBootOrder(++iBootIndex, m_cache.m_bootItems[i].m_type); 302 } 303 /* Save other unique boot-items: */ 304 for (int i = 0; i < m_cache.m_bootItems.size(); ++i) 305 { 306 if (!m_cache.m_bootItems[i].m_fEnabled) 307 m_machine.SetBootOrder(++iBootIndex, KDeviceType_Null); 308 } 309 m_machine.SetChipsetType(m_cache.m_chipsetType); 310 m_machine.GetBIOSSettings().SetIOAPICEnabled(m_cache.m_fIoApicEnabled); 311 m_machine.SetFirmwareType(m_cache.m_fEFIEnabled ? KFirmwareType_EFI : KFirmwareType_BIOS); 312 m_machine.SetRTCUseUTC(m_cache.m_fUTCEnabled); 313 m_machine.SetPointingHidType(m_cache.m_fUseAbsHID ? KPointingHidType_USBTablet : KPointingHidType_PS2Mouse); 314 /* Processor tab: */ 315 m_machine.SetCPUCount(m_cache.m_cCPUCount); 316 m_machine.SetCPUProperty(KCPUPropertyType_PAE, m_cache.m_fPAEEnabled); 317 /* Acceleration tab: */ 318 m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, m_cache.m_fHwVirtExEnabled); 319 m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, m_cache.m_fNestedPagingEnabled); 320 break; 321 } 322 /* Here come the properties which could be changed at runtime too: */ 323 case VBoxDefs::SettingsDialogType_Runtime: 324 break; 325 default: 326 break; 327 } 312 328 313 329 /* Upload machine to data: */ … … 532 548 } 533 549 550 void UIMachineSettingsSystem::polishPage() 551 { 552 /* Polish page depending on dialog type: */ 553 switch (dialogType()) 554 { 555 case VBoxDefs::SettingsDialogType_Offline: 556 break; 557 case VBoxDefs::SettingsDialogType_Runtime: 558 /* Motherboard tab: */ 559 mLbMemory->setEnabled(false); 560 mLbMemoryMin->setEnabled(false); 561 mLbMemoryMax->setEnabled(false); 562 mLbMemoryUnit->setEnabled(false); 563 mSlMemory->setEnabled(false); 564 mLeMemory->setEnabled(false); 565 mLbBootOrder->setEnabled(false); 566 mTwBootOrder->setEnabled(false); 567 mTbBootItemUp->setEnabled(false); 568 mTbBootItemDown->setEnabled(false); 569 mLbChipset->setEnabled(false); 570 mCbChipset->setEnabled(false); 571 mLbMotherboardExtended->setEnabled(false); 572 mCbApic->setEnabled(false); 573 mCbEFI->setEnabled(false); 574 mCbTCUseUTC->setEnabled(false); 575 mCbUseAbsHID->setEnabled(false); 576 /* Processor tab: */ 577 mLbCPU->setEnabled(false); 578 mLbCPUMin->setEnabled(false); 579 mLbCPUMax->setEnabled(false); 580 mSlCPU->setEnabled(false); 581 mLeCPU->setEnabled(false); 582 mLbProcessorExtended->setEnabled(false); 583 mCbPae->setEnabled(false); 584 /* Acceleration tab: */ 585 mLbVirt->setEnabled(false); 586 mCbVirt->setEnabled(false); 587 mCbNestedPaging->setEnabled(false); 588 break; 589 default: 590 break; 591 } 592 } 593 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r34063 r36357 6 6 7 7 /* 8 * Copyright (C) 2008-201 0Oracle Corporation8 * Copyright (C) 2008-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 107 107 void adjustBootOrderTWSize(); 108 108 109 void polishPage(); 110 109 111 QIWidgetValidator *mValidator; 110 112 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r36324 r36357 106 106 this, SLOT (usbAdapterToggled (bool))); 107 107 connect (mTwFilters, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)), 108 this, SLOT (currentChanged (QTreeWidgetItem* , QTreeWidgetItem*)));108 this, SLOT (currentChanged (QTreeWidgetItem*))); 109 109 connect (mTwFilters, SIGNAL (customContextMenuRequested (const QPoint &)), 110 110 this, SLOT (showContextMenu (const QPoint &))); … … 296 296 fetchData(data); 297 297 298 /* Depending on page type: */298 /* Save settings depending on page type: */ 299 299 switch (pageType()) 300 300 { 301 /* Here come the global USB properties: */ 301 302 case UISettingsPageType_Global: 302 303 { 303 /* Gather corresponding values from internal variables: */304 if (mUSBFilterListModified)304 /* Save settings depending on dialog type: */ 305 switch (dialogType()) 305 306 { 306 /* Get host: */ 307 CHost host = vboxGlobal().virtualBox().GetHost(); 308 /* First, remove all old filters: */ 309 for (ulong count = host.GetUSBDeviceFilters().size(); count; --count) 310 host.RemoveUSBDeviceFilter(0); 311 /* Then add all new filters: */ 312 for (int iFilterIndex = 0; iFilterIndex < m_cache.m_items.size(); ++iFilterIndex) 307 /* Here come the properties which could be changed only in offline state: */ 308 case VBoxDefs::SettingsDialogType_Offline: 309 /* Here come the properties which could be changed at runtime too: */ 310 case VBoxDefs::SettingsDialogType_Runtime: 313 311 { 314 UIUSBFilterData data = m_cache.m_items[iFilterIndex]; 315 CHostUSBDeviceFilter hostFilter = host.CreateUSBDeviceFilter(data.m_strName); 316 hostFilter.SetActive(data.m_fActive); 317 hostFilter.SetVendorId(data.m_strVendorId); 318 hostFilter.SetProductId(data.m_strProductId); 319 hostFilter.SetRevision(data.m_strRevision); 320 hostFilter.SetManufacturer(data.m_strManufacturer); 321 hostFilter.SetProduct(data.m_strProduct); 322 hostFilter.SetSerialNumber(data.m_strSerialNumber); 323 hostFilter.SetPort(data.m_strPort); 324 hostFilter.SetRemote(data.m_strRemote); 325 hostFilter.SetAction(data.m_action); 326 host.InsertUSBDeviceFilter(host.GetUSBDeviceFilters().size(), hostFilter); 312 /* Gather corresponding values from internal variables: */ 313 if (mUSBFilterListModified) 314 { 315 /* Get host: */ 316 CHost host = vboxGlobal().virtualBox().GetHost(); 317 /* First, remove all old filters: */ 318 for (ulong count = host.GetUSBDeviceFilters().size(); count; --count) 319 host.RemoveUSBDeviceFilter(0); 320 /* Then add all new filters: */ 321 for (int iFilterIndex = 0; iFilterIndex < m_cache.m_items.size(); ++iFilterIndex) 322 { 323 UIUSBFilterData data = m_cache.m_items[iFilterIndex]; 324 CHostUSBDeviceFilter hostFilter = host.CreateUSBDeviceFilter(data.m_strName); 325 hostFilter.SetActive(data.m_fActive); 326 hostFilter.SetVendorId(data.m_strVendorId); 327 hostFilter.SetProductId(data.m_strProductId); 328 hostFilter.SetRevision(data.m_strRevision); 329 hostFilter.SetManufacturer(data.m_strManufacturer); 330 hostFilter.SetProduct(data.m_strProduct); 331 hostFilter.SetSerialNumber(data.m_strSerialNumber); 332 hostFilter.SetPort(data.m_strPort); 333 hostFilter.SetRemote(data.m_strRemote); 334 hostFilter.SetAction(data.m_action); 335 host.InsertUSBDeviceFilter(host.GetUSBDeviceFilters().size(), hostFilter); 336 } 337 } 338 break; 327 339 } 340 default: 341 break; 328 342 } 329 343 break; 330 344 } 345 /* Here come VM USB properties: */ 331 346 case UISettingsPageType_Machine: 332 347 { … … 338 353 if (!ctl.isNull()) 339 354 { 340 ctl.SetEnabled(m_cache.m_fUSBEnabled); 341 ctl.SetEnabledEhci(m_cache.m_fEHCIEnabled); 342 if (mUSBFilterListModified) 355 /* Save settings depending on dialog type: */ 356 switch (dialogType()) 343 357 { 344 /* First, remove all old filters: */ 345 for (ulong count = ctl.GetDeviceFilters().size(); count; --count) 346 ctl.RemoveDeviceFilter(0); 347 /* Then add all new filters: */ 348 for (int iFilterIndex = 0; iFilterIndex < m_cache.m_items.size(); ++iFilterIndex) 358 /* Here come the properties which could be changed only in offline state: */ 359 case VBoxDefs::SettingsDialogType_Offline: 349 360 { 350 const UIUSBFilterData &data = m_cache.m_items[iFilterIndex]; 351 CUSBDeviceFilter filter = ctl.CreateDeviceFilter(data.m_strName); 352 filter.SetActive(data.m_fActive); 353 filter.SetVendorId(data.m_strVendorId); 354 filter.SetProductId(data.m_strProductId); 355 filter.SetRevision(data.m_strRevision); 356 filter.SetManufacturer(data.m_strManufacturer); 357 filter.SetProduct(data.m_strProduct); 358 filter.SetSerialNumber(data.m_strSerialNumber); 359 filter.SetPort(data.m_strPort); 360 filter.SetRemote(data.m_strRemote); 361 ctl.InsertDeviceFilter(~0, filter); 361 ctl.SetEnabled(m_cache.m_fUSBEnabled); 362 ctl.SetEnabledEhci(m_cache.m_fEHCIEnabled); 363 /* And after that come the properties which could be changed at runtime too: */ 362 364 } 365 /* Here come the properties which could be changed at runtime too: */ 366 case VBoxDefs::SettingsDialogType_Runtime: 367 { 368 if (mUSBFilterListModified) 369 { 370 /* First, remove all old filters: */ 371 for (ulong count = ctl.GetDeviceFilters().size(); count; --count) 372 ctl.RemoveDeviceFilter(0); 373 /* Then add all new filters: */ 374 for (int iFilterIndex = 0; iFilterIndex < m_cache.m_items.size(); ++iFilterIndex) 375 { 376 const UIUSBFilterData &data = m_cache.m_items[iFilterIndex]; 377 CUSBDeviceFilter filter = ctl.CreateDeviceFilter(data.m_strName); 378 filter.SetActive(data.m_fActive); 379 filter.SetVendorId(data.m_strVendorId); 380 filter.SetProductId(data.m_strProductId); 381 filter.SetRevision(data.m_strRevision); 382 filter.SetManufacturer(data.m_strManufacturer); 383 filter.SetProduct(data.m_strProduct); 384 filter.SetSerialNumber(data.m_strSerialNumber); 385 filter.SetPort(data.m_strPort); 386 filter.SetRemote(data.m_strRemote); 387 ctl.InsertDeviceFilter(~0, filter); 388 } 389 } 390 break; 391 } 392 default: 393 break; 363 394 } 364 395 } … … 431 462 } 432 463 433 void UIMachineSettingsUSB::currentChanged (QTreeWidgetItem *aItem, 434 QTreeWidgetItem *) 435 { 436 /* Make sure only the current item if present => selected */ 437 if (mTwFilters->selectedItems().count() != 1 || 438 mTwFilters->selectedItems() [0] != aItem) 439 { 440 QList<QTreeWidgetItem*> list = mTwFilters->selectedItems(); 441 for (int i = 0; i < list.size(); ++ i) 442 list [i]->setSelected (false); 443 if (aItem) 444 aItem->setSelected (true); 445 } 446 447 /* Enable/disable operational buttons */ 448 mEdtAction->setEnabled (aItem); 449 mDelAction->setEnabled (aItem); 450 mMupAction->setEnabled (aItem && mTwFilters->itemAbove (aItem)); 451 mMdnAction->setEnabled (aItem && mTwFilters->itemBelow (aItem)); 464 void UIMachineSettingsUSB::currentChanged(QTreeWidgetItem *aItem) 465 { 466 if (mTwFilters->isEnabled()) 467 { 468 /* Make sure only the current item selected (if present): */ 469 if (mTwFilters->selectedItems().count() != 1 || mTwFilters->selectedItems()[0] != aItem) 470 { 471 QList<QTreeWidgetItem*> list = mTwFilters->selectedItems(); 472 for (int i = 0; i < list.size(); ++i) 473 list[i]->setSelected(false); 474 if (aItem) 475 aItem->setSelected(true); 476 } 477 } 478 else 479 mTwFilters->setCurrentItem(0); 480 481 /* Update corresponding action states: */ 482 mEdtAction->setEnabled(aItem); 483 mDelAction->setEnabled(aItem); 484 mMupAction->setEnabled(aItem && mTwFilters->itemAbove(aItem)); 485 mMdnAction->setEnabled(aItem && mTwFilters->itemBelow(aItem)); 452 486 } 453 487 … … 721 755 } 722 756 723 /* Fetch data to m_properties & m_settings or m_machine : */757 /* Fetch data to m_properties & m_settings or m_machine & m_console: */ 724 758 void UIMachineSettingsUSB::fetchData(const QVariant &data) 725 759 { … … 735 769 { 736 770 m_machine = data.value<UISettingsDataMachine>().m_machine; 737 break; 738 } 739 default: 740 break; 741 } 742 } 743 744 /* Upload m_properties & m_settings or m_machine to data: */ 771 m_console = data.value<UISettingsDataMachine>().m_console; 772 break; 773 } 774 default: 775 break; 776 } 777 } 778 779 /* Upload m_properties & m_settings or m_machine & m_console to data: */ 745 780 void UIMachineSettingsUSB::uploadData(QVariant &data) const 746 781 { … … 754 789 case UISettingsPageType_Machine: 755 790 { 756 data = QVariant::fromValue(UISettingsDataMachine(m_machine ));791 data = QVariant::fromValue(UISettingsDataMachine(m_machine, m_console)); 757 792 break; 758 793 } … … 805 840 } 806 841 842 void UIMachineSettingsUSB::polishPage() 843 { 844 /* Polish page depending on dialog type: */ 845 switch (dialogType()) 846 { 847 case VBoxDefs::SettingsDialogType_Offline: 848 break; 849 case VBoxDefs::SettingsDialogType_Runtime: 850 mGbUSB->setEnabled(false); 851 mCbUSB2->setEnabled(false); 852 break; 853 default: 854 break; 855 } 856 } 857 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
r33882 r36357 6 6 7 7 /* 8 * Copyright (C) 2006-201 0Oracle Corporation8 * Copyright (C) 2006-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 99 99 100 100 void usbAdapterToggled (bool aOn); 101 void currentChanged (QTreeWidgetItem *aItem = 0, 102 QTreeWidgetItem *aPrev = 0); 101 void currentChanged (QTreeWidgetItem *aItem = 0); 103 102 104 103 void newClicked(); … … 126 125 static QString toolTipFor(const UIUSBFilterData &data); 127 126 127 void polishPage(); 128 128 129 /* Global data source: */ 129 130 CSystemProperties m_properties; … … 132 133 /* Machine data source: */ 133 134 CMachine m_machine; 135 CConsole m_console; 134 136 135 137 /* Other variables: */
Note:
See TracChangeset
for help on using the changeset viewer.