Changeset 45198 in vbox for trunk/src/VBox
- Timestamp:
- Mar 27, 2013 9:02:56 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 84556
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r44528 r45198 292 292 void UISettingsDialog::setDialogType(SettingsDialogType settingsDialogType) 293 293 { 294 /* Remember new dialog-type: */ 294 295 m_dialogType = settingsDialogType; 295 for (int iWidgetNumber = 0; iWidgetNumber < m_pStack->count(); ++iWidgetNumber) 296 {297 UISettingsPage *pPage = static_cast<UISettingsPage*>(m_pStack->widget(iWidgetNumber));296 297 /* Propagate it to settings-page(s): */ 298 foreach (UISettingsPage *pPage, m_pSelector->settingPages()) 298 299 pPage->setDialogType(dialogType()); 299 }300 300 } 301 301 … … 350 350 int iParentId /* = -1 */) 351 351 { 352 QWidget *pPage = m_pSelector->addItem(strBigIcon, strBigIconDisabled, 353 strSmallIcon, strSmallIconDisabled, 354 cId, strLink, pSettingsPage, iParentId); 355 if (pPage) 356 { 357 #ifdef Q_WS_MAC 358 /* On OSX we add a stretch to the vertical end to make sure the page is 359 * always top aligned. */ 360 QWidget *pW = new QWidget(); 361 pW->setContentsMargins(0, 0, 0, 0); 362 QVBoxLayout *pBox = new QVBoxLayout(pW); 363 VBoxGlobal::setLayoutMargin(pBox, 0); 364 pBox->addWidget(pPage); 365 pBox->addStretch(0); 366 m_pages[cId] = m_pStack->addWidget(pW); 367 #else /* Q_WS_MAC */ 352 /* Add new selector item: */ 353 if (QWidget *pPage = m_pSelector->addItem(strBigIcon, strBigIconDisabled, 354 strSmallIcon, strSmallIconDisabled, 355 cId, strLink, pSettingsPage, iParentId)) 356 { 357 /* Add stack-widget page if created: */ 368 358 m_pages[cId] = m_pStack->addWidget(pPage); 369 #endif /* !Q_WS_MAC */ 370 /* Update process bar: */ 359 /* Update process-bar: */ 371 360 m_pProcessBar->setMinimum(0); 372 361 m_pProcessBar->setMaximum(m_pStack->count()); 373 362 } 363 /* Assign validator if necessary: */ 374 364 if (pSettingsPage) 375 365 assignValidator(pSettingsPage); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r44528 r45198 575 575 m_machine = vboxGlobal().virtualBox().FindMachine(m_strMachineId); 576 576 AssertMsg(!m_machine.isNull(), ("Can't find corresponding machine!\n")); 577 /* Assign current dialog type: */ 578 setDialogType(determineSettingsDialogType(m_machine.GetSessionState(), m_machine.GetState())); 577 m_sessionState = m_machine.GetSessionState(); 578 m_machineState = m_machine.GetState(); 579 /* Recalculate current dialog-type: */ 580 updateDialogType(); 579 581 580 582 /* Creating settings pages: */ … … 991 993 992 994 /* Make sure settings dialog will be updated on machine state/data changes: */ 995 connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), 996 this, SLOT(sltSessionStateChanged(QString, KSessionState))); 993 997 connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), 994 998 this, SLOT(sltMachineStateChanged(QString, KMachineState))); … … 1012 1016 } 1013 1017 1014 void UISettingsDialogMachine::slt MachineStateChanged(QString strMachineId, KMachineState machineState)1018 void UISettingsDialogMachine::sltSessionStateChanged(QString strMachineId, KSessionState sessionState) 1015 1019 { 1016 1020 /* Ignore if thats NOT our VM: */ … … 1019 1023 1020 1024 /* Ignore if state was NOT actually changed: */ 1025 if (m_sessionState == sessionState) 1026 return; 1027 1028 /* Update current session state: */ 1029 m_sessionState = sessionState; 1030 1031 /* Update dialog-type if necessary: */ 1032 updateDialogType(); 1033 } 1034 1035 void UISettingsDialogMachine::sltMachineStateChanged(QString strMachineId, KMachineState machineState) 1036 { 1037 /* Ignore if thats NOT our VM: */ 1038 if (strMachineId != m_strMachineId) 1039 return; 1040 1041 /* Ignore if state was NOT actually changed: */ 1021 1042 if (m_machineState == machineState) 1022 1043 return; … … 1025 1046 m_machineState = machineState; 1026 1047 1027 /* Get new dialog type: */ 1028 SettingsDialogType newDialogType = determineSettingsDialogType(m_machine.GetSessionState(), m_machineState); 1029 1030 /* Ignore if dialog type was NOT actually changed: */ 1031 if (dialogType() == newDialogType) 1032 return; 1033 1034 /* Should we show a warning about leaving 'offline' state? */ 1035 bool fShouldWe = dialogType() == SettingsDialogType_Offline; 1036 1037 /* Update current dialog type: */ 1038 setDialogType(newDialogType); 1039 1040 /* Show a warning about leaving 'offline' state if we should: */ 1041 if (isSettingsChanged() && fShouldWe) 1042 msgCenter().warnAboutStateChange(this); 1048 /* Update dialog-type if necessary: */ 1049 updateDialogType(); 1043 1050 } 1044 1051 … … 1130 1137 { 1131 1138 bool fIsSettingsChanged = false; 1132 for (int iWidgetNumber = 0; iWidgetNumber < m_pStack->count() && !fIsSettingsChanged; ++iWidgetNumber) 1133 { 1134 UISettingsPage *pPage = static_cast<UISettingsPage*>(m_pStack->widget(iWidgetNumber)); 1139 foreach (UISettingsPage *pPage, m_pSelector->settingPages()) 1140 { 1135 1141 pPage->putToCache(); 1136 if ( pPage->changed())1142 if (!fIsSettingsChanged && pPage->changed()) 1137 1143 fIsSettingsChanged = true; 1138 1144 } … … 1140 1146 } 1141 1147 1148 void UISettingsDialogMachine::updateDialogType() 1149 { 1150 /* Get new dialog type: */ 1151 SettingsDialogType newDialogType = determineSettingsDialogType(m_sessionState, m_machineState); 1152 1153 /* Ignore if dialog type was NOT actually changed: */ 1154 if (dialogType() == newDialogType) 1155 return; 1156 1157 /* Should we show a warning about leaving 'offline' state? */ 1158 bool fShouldWe = dialogType() == SettingsDialogType_Offline; 1159 1160 /* Update current dialog type: */ 1161 setDialogType(newDialogType); 1162 1163 /* Show a warning about leaving 'offline' state if we should: */ 1164 if (isSettingsChanged() && fShouldWe) 1165 msgCenter().warnAboutStateChange(this); 1166 } 1167 1142 1168 # include "UISettingsDialogSpecific.moc" 1143 1169 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
r44528 r45198 109 109 void sltMarkLoaded(); 110 110 void sltMarkSaved(); 111 void sltSessionStateChanged(QString strMachineId, KSessionState sessionState); 111 112 void sltMachineStateChanged(QString strMachineId, KMachineState machineState); 112 113 void sltMachineDataChanged(QString strMachineId); … … 120 121 bool isPageAvailable(int iPageId); 121 122 bool isSettingsChanged(); 123 void updateDialogType(); 122 124 123 125 QString m_strMachineId; 126 KSessionState m_sessionState; 124 127 KMachineState m_machineState; 125 128
Note:
See TracChangeset
for help on using the changeset viewer.