- Timestamp:
- Oct 17, 2014 1:56:38 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r52937 r53086 1262 1262 switch (machineCloseAction) 1263 1263 { 1264 case MachineCloseAction_Detach: strResult = "Detach"; break; 1264 1265 case MachineCloseAction_SaveState: strResult = "SaveState"; break; 1265 1266 case MachineCloseAction_Shutdown: strResult = "Shutdown"; break; … … 1281 1282 * to search through the keys using 'case-insensitive' rule: */ 1282 1283 QStringList keys; QList<MachineCloseAction> values; 1284 keys << "Detach"; values << MachineCloseAction_Detach; 1283 1285 keys << "SaveState"; values << MachineCloseAction_SaveState; 1284 1286 keys << "Shutdown"; values << MachineCloseAction_Shutdown; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r52937 r53086 565 565 { 566 566 MachineCloseAction_Invalid = 0, 567 MachineCloseAction_SaveState = RT_BIT(0), 568 MachineCloseAction_Shutdown = RT_BIT(1), 569 MachineCloseAction_PowerOff = RT_BIT(2), 570 MachineCloseAction_PowerOff_RestoringSnapshot = RT_BIT(3), 567 MachineCloseAction_Detach = RT_BIT(0), 568 MachineCloseAction_SaveState = RT_BIT(1), 569 MachineCloseAction_Shutdown = RT_BIT(2), 570 MachineCloseAction_PowerOff = RT_BIT(3), 571 MachineCloseAction_PowerOff_RestoringSnapshot = RT_BIT(4), 571 572 MachineCloseAction_All = 0xFF 572 573 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
r52937 r53086 2139 2139 /* Recache close related action restrictions: */ 2140 2140 MachineCloseAction restrictedCloseActions = gEDataManager->restrictedMachineCloseActions(strMachineID); 2141 bool fAllCloseActionsRestricted = (restrictedCloseActions & MachineCloseAction_SaveState) 2141 bool fAllCloseActionsRestricted = (!vboxGlobal().isSeparateProcess() || (restrictedCloseActions & MachineCloseAction_Detach)) 2142 && (restrictedCloseActions & MachineCloseAction_SaveState) 2142 2143 && (restrictedCloseActions & MachineCloseAction_Shutdown) 2143 2144 && (restrictedCloseActions & MachineCloseAction_PowerOff); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r53068 r53086 314 314 switch (defaultCloseAction) 315 315 { 316 /* If VM is stuck, and the default close-action is ' save-state' or 'shutdown',316 /* If VM is stuck, and the default close-action is 'detach', 'save-state' or 'shutdown', 317 317 * we should ask the user about what to do: */ 318 case MachineCloseAction_Detach: 318 319 case MachineCloseAction_SaveState: 319 320 case MachineCloseAction_Shutdown: … … 355 356 if (!fWasPaused && uisession()->isPaused() && 356 357 (closeAction == MachineCloseAction_Invalid || 358 closeAction == MachineCloseAction_Detach || 357 359 closeAction == MachineCloseAction_Shutdown)) 358 360 { … … 376 378 switch (closeAction) 377 379 { 380 case MachineCloseAction_Detach: 381 { 382 /* Just close Runtime UI: */ 383 uisession()->closeRuntimeUI(); 384 break; 385 } 378 386 case MachineCloseAction_SaveState: 379 387 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r53084 r53086 1348 1348 m_defaultCloseAction = gEDataManager->defaultMachineCloseAction(strMachineID); 1349 1349 m_restrictedCloseActions = gEDataManager->restrictedMachineCloseActions(strMachineID); 1350 m_fAllCloseActionsRestricted = (m_restrictedCloseActions & MachineCloseAction_SaveState) 1350 m_fAllCloseActionsRestricted = (!vboxGlobal().isSeparateProcess() || (m_restrictedCloseActions & MachineCloseAction_Detach)) 1351 && (m_restrictedCloseActions & MachineCloseAction_SaveState) 1351 1352 && (m_restrictedCloseActions & MachineCloseAction_Shutdown) 1352 1353 && (m_restrictedCloseActions & MachineCloseAction_PowerOff); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp
r52730 r53086 49 49 bool fIsACPIEnabled, MachineCloseAction restictedCloseActions) 50 50 : QIWithRetranslateUI<QIDialog>(pParent) 51 , m_pIcon(0), m_pLabel(0) 52 , m_pDetachIcon(0), m_pDetachRadio(0) 53 , m_pSaveIcon(0), m_pSaveRadio(0) 54 , m_pShutdownIcon(0), m_pShutdownRadio(0) 55 , m_pPowerOffIcon(0), m_pPowerOffRadio(0), m_pDiscardCheckBox(0) 51 56 , m_machine(machine) 52 57 , m_restictedCloseActions(restictedCloseActions) … … 74 79 { 75 80 /* Calculate result: */ 76 if (m_pSaveRadio->isChecked()) 81 if (m_pDetachRadio->isChecked()) 82 setResult(MachineCloseAction_Detach); 83 else if (m_pSaveRadio->isChecked()) 77 84 setResult(MachineCloseAction_SaveState); 78 85 else if (m_pShutdownRadio->isChecked()) … … 106 113 /* Assign new pixmap: */ 107 114 m_pIcon->setPixmap(pixmap); 115 } 116 117 void UIVMCloseDialog::setDetachButtonEnabled(bool fEnabled) 118 { 119 m_pDetachIcon->setEnabled(fEnabled); 120 m_pDetachRadio->setEnabled(fEnabled); 121 } 122 123 void UIVMCloseDialog::setDetachButtonVisible(bool fVisible) 124 { 125 m_pDetachIcon->setVisible(fVisible); 126 m_pDetachRadio->setVisible(fVisible); 108 127 } 109 128 … … 181 200 QGridLayout *pChoiceLayout = new QGridLayout; 182 201 { 202 /* Prepare 'detach' icon: */ 203 m_pDetachIcon = new QLabel(this); 204 { 205 /* Configure icon: */ 206 m_pDetachIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 207 m_pDetachIcon->setPixmap(QPixmap(":/vm_create_shortcut_16px.png")); 208 } 209 /* Prepare 'detach' radio-button: */ 210 m_pDetachRadio = new QRadioButton(this); 211 { 212 /* Configure button: */ 213 m_pDetachRadio->installEventFilter(this); 214 connect(m_pDetachRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability())); 215 } 183 216 /* Prepare 'save' icon: */ 184 217 m_pSaveIcon = new QLabel(this); … … 232 265 #endif /* !Q_WS_MAC */ 233 266 pChoiceLayout->setContentsMargins(0, 0, 0, 0); 234 pChoiceLayout->addWidget(m_pSaveIcon, 0, 0); 235 pChoiceLayout->addWidget(m_pSaveRadio, 0, 1); 236 pChoiceLayout->addWidget(m_pShutdownIcon, 1, 0); 237 pChoiceLayout->addWidget(m_pShutdownRadio, 1, 1); 238 pChoiceLayout->addWidget(m_pPowerOffIcon, 2, 0); 239 pChoiceLayout->addWidget(m_pPowerOffRadio, 2, 1); 240 pChoiceLayout->addWidget(m_pDiscardCheckBox, 3, 1); 267 pChoiceLayout->addWidget(m_pDetachIcon, 0, 0); 268 pChoiceLayout->addWidget(m_pDetachRadio, 0, 1); 269 pChoiceLayout->addWidget(m_pSaveIcon, 1, 0); 270 pChoiceLayout->addWidget(m_pSaveRadio, 1, 1); 271 pChoiceLayout->addWidget(m_pShutdownIcon, 2, 0); 272 pChoiceLayout->addWidget(m_pShutdownRadio, 2, 1); 273 pChoiceLayout->addWidget(m_pPowerOffIcon, 3, 0); 274 pChoiceLayout->addWidget(m_pPowerOffRadio, 3, 1); 275 pChoiceLayout->addWidget(m_pDiscardCheckBox, 4, 1); 241 276 } 242 277 /* Configure layout: */ … … 286 321 287 322 /* Check which close-actions are resticted: */ 323 bool fIsDetachAllowed = vboxGlobal().isSeparateProcess() && !(m_restictedCloseActions & MachineCloseAction_Detach); 288 324 bool fIsStateSavingAllowed = !(m_restictedCloseActions & MachineCloseAction_SaveState); 289 325 bool fIsACPIShutdownAllowed = !(m_restictedCloseActions & MachineCloseAction_Shutdown); … … 291 327 bool fIsPowerOffAndRestoreAllowed = fIsPowerOffAllowed && !(m_restictedCloseActions & MachineCloseAction_PowerOff_RestoringSnapshot); 292 328 329 /* Make 'Detach' button visible/hidden depending on restriction: */ 330 setDetachButtonVisible(fIsDetachAllowed); 331 /* Make 'Detach' button enabled/disabled depending on machine-state: */ 332 setDetachButtonEnabled(machineState != KMachineState_Stuck); 333 293 334 /* Make 'Save state' button visible/hidden depending on restriction: */ 294 335 setSaveButtonVisible(fIsStateSavingAllowed); 295 336 /* Make 'Save state' button enabled/disabled depending on machine-state: */ 296 337 setSaveButtonEnabled(machineState != KMachineState_Stuck); 297 /* Make 'Shutdown button' visible/hidden depending on restriction: */ 338 339 /* Make 'Shutdown' button visible/hidden depending on restriction: */ 298 340 setShutdownButtonVisible(fIsACPIShutdownAllowed); 341 /* Make 'Shutdown' button enabled/disabled depending on console and machine-state: */ 299 342 setShutdownButtonEnabled(m_fIsACPIEnabled && machineState != KMachineState_Stuck); 343 300 344 /* Make 'Power off' button visible/hidden depending on restriction: */ 301 345 setPowerOffButtonVisible(fIsPowerOffAllowed); … … 310 354 /* If choosing 'last choice' is possible: */ 311 355 m_lastCloseAction = gEDataManager->lastMachineCloseAction(vboxGlobal().managedVMUuid()); 312 if (m_lastCloseAction == MachineCloseAction_SaveState && fIsStateSavingAllowed) 356 if (m_lastCloseAction == MachineCloseAction_Detach && fIsDetachAllowed) 357 { 358 pRadioButtonToChoose = m_pDetachRadio; 359 } 360 else if (m_lastCloseAction == MachineCloseAction_SaveState && fIsStateSavingAllowed) 313 361 { 314 362 pRadioButtonToChoose = m_pSaveRadio; … … 330 378 else 331 379 { 332 if (fIsStateSavingAllowed) 380 if (fIsDetachAllowed) 381 pRadioButtonToChoose = m_pDetachRadio; 382 else if (fIsStateSavingAllowed) 333 383 pRadioButtonToChoose = m_pSaveRadio; 334 384 else if (fIsACPIShutdownAllowed && m_fIsACPIEnabled) … … 358 408 359 409 /* Translate radio-buttons: */ 410 m_pDetachRadio->setText(tr("&Continue running in the background")); 411 m_pDetachRadio->setWhatsThis(tr("<p>Close the virtual machine windows but keep the virtual machine running.</p>" 412 "<p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p>")); 360 413 m_pSaveRadio->setText(tr("&Save the machine state")); 361 414 m_pSaveRadio->setWhatsThis(tr("<p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p>" -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h
r52727 r53086 56 56 void setPixmap(const QPixmap &pixmap); 57 57 58 /* API: Detach-button stuff: */ 59 void setDetachButtonEnabled(bool fEnabled); 60 void setDetachButtonVisible(bool fVisible); 58 61 /* API: Save-button stuff: */ 59 62 void setSaveButtonEnabled(bool fEnabled); … … 84 87 QLabel *m_pIcon; 85 88 QLabel *m_pLabel; 89 QLabel *m_pDetachIcon; 90 QRadioButton *m_pDetachRadio; 86 91 QLabel *m_pSaveIcon; 87 92 QRadioButton *m_pSaveRadio;
Note:
See TracChangeset
for help on using the changeset viewer.