Changeset 88741 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 27, 2021 7:48:59 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.cpp
r88722 r88741 313 313 } 314 314 315 UIGuestProcessControlWidget::~UIGuestProcessControlWidget() 316 { 317 saveSettings(); 318 cleanupListener(); 319 } 320 315 321 void UIGuestProcessControlWidget::retranslateUi() 316 322 { … … 387 393 this, &UIGuestProcessControlWidget::sltGuestSessionUnregistered); 388 394 } 389 390 connect(&uiCommon(), &UICommon::sigAskToCommitData,391 this, &UIGuestProcessControlWidget::sltSaveSettings);392 connect(&uiCommon(), &UICommon::sigAskToDetachCOM,393 this, &UIGuestProcessControlWidget::sltCleanupListener);394 395 } 395 396 … … 557 558 } 558 559 559 void UIGuestProcessControlWidget::s ltSaveSettings()560 void UIGuestProcessControlWidget::saveSettings() 560 561 { 561 562 if (!m_pSplitter) … … 564 565 } 565 566 566 void UIGuestProcessControlWidget:: sltCleanupListener()567 void UIGuestProcessControlWidget::cleanupListener() 567 568 { 568 569 /* Unregister everything: */ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.h
r88721 r88741 55 55 UIGuestProcessControlWidget(EmbedTo enmEmbedding, const CGuest &comGuest, QWidget *pParent, 56 56 QString strMachineName = QString(), bool fShowToolbar = false); 57 ~UIGuestProcessControlWidget(); 57 58 /** When true we delete the corresponding tree item as soon as the guest session/process is unregistered. */ 58 59 static const bool m_fDeleteAfterUnregister; … … 70 71 void sltCloseSessionOrProcess(); 71 72 void sltShowProperties(); 72 void sltSaveSettings();73 void sltCleanupListener();74 73 75 74 private: … … 83 82 void addGuestSession(CGuestSession guestSession); 84 83 void loadSettings(); 84 void cleanupListener(); 85 void saveSettings(); 85 86 86 87 CGuest m_comGuest; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r88729 r88741 866 866 , m_pProcessControlDialog(0) 867 867 , m_pSoftKeyboardDialog(0) 868 , m_pVMInformationDialog(0) 868 869 { 869 870 } … … 1822 1823 return; 1823 1824 1824 /* Invoke VM information dialog: */ 1825 UIVMInformationDialog::invoke(activeMachineWindow()); 1825 if (m_pVMInformationDialog) 1826 return; 1827 1828 m_pVMInformationDialog = new UIVMInformationDialog(activeMachineWindow()); 1829 1830 if (m_pVMInformationDialog) 1831 { 1832 m_pVMInformationDialog->show(); 1833 m_pVMInformationDialog->raise(); 1834 m_pVMInformationDialog->setWindowState(m_pVMInformationDialog->windowState() & ~Qt::WindowMinimized); 1835 m_pVMInformationDialog->activateWindow(); 1836 connect(m_pVMInformationDialog, &UIVMInformationDialog::sigClose, 1837 this, &UIMachineLogic::sltCloseVMInformationDialog); 1838 } 1839 } 1840 1841 void UIMachineLogic::sltCloseVMInformationDialog() 1842 { 1843 delete m_pVMInformationDialog; 1844 m_pVMInformationDialog = 0; 1826 1845 } 1827 1846 … … 1853 1872 void UIMachineLogic::sltCloseFileManagerDialog() 1854 1873 { 1855 QIManagerDialog* pDialog = qobject_cast<QIManagerDialog*>(sender());1856 if (m_pFileManagerDialog != pDialog || !pDialog)1857 return; 1858 1874 if (!m_pFileManagerDialog) 1875 return; 1876 1877 QIManagerDialog* pDialog = m_pFileManagerDialog; 1859 1878 /* Set the m_pFileManagerDialog to NULL before closing the dialog. or we will have redundant deletes*/ 1860 1879 m_pFileManagerDialog = 0; … … 2789 2808 cleanupDebugger(); 2790 2809 #endif 2810 sltCloseFileManagerDialog(); 2811 sltCloseVMInformationDialog(); 2791 2812 } 2792 2813 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r88729 r88741 41 41 class UIDockIconPreview; 42 42 class UISoftKeyboard; 43 class UIVMInformationDialog; 43 44 class CSession; 44 45 class CMachine; … … 280 281 void sltTakeSnapshot(); 281 282 void sltShowInformationDialog(); 283 void sltCloseVMInformationDialog(); 282 284 void sltShowFileManagerDialog(); 283 285 void sltCloseFileManagerDialog(); … … 443 445 444 446 /** Holds the log viewer dialog instance. */ 445 QIManagerDialog *m_pLogViewerDialog;446 QIManagerDialog *m_pFileManagerDialog;447 QIManagerDialog *m_pProcessControlDialog;448 UISoftKeyboard *m_pSoftKeyboardDialog;449 447 QIManagerDialog *m_pLogViewerDialog; 448 QIManagerDialog *m_pFileManagerDialog; 449 QIManagerDialog *m_pProcessControlDialog; 450 UISoftKeyboard *m_pSoftKeyboardDialog; 451 UIVMInformationDialog *m_pVMInformationDialog; 450 452 /* Friend classes: */ 451 453 friend class UIMachineWindow; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp
r88721 r88741 58 58 59 59 60 /* static */61 UIVMInformationDialog *UIVMInformationDialog::s_pInstance = 0;62 63 void UIVMInformationDialog::invoke(UIMachineWindow *pMachineWindow)64 {65 /* Make sure dialog instance exists: */66 if (!s_pInstance)67 {68 /* Create new dialog instance if it doesn't exists yet: */69 new UIVMInformationDialog(pMachineWindow);70 }71 72 /* Show dialog: */73 s_pInstance->show();74 /* Raise it: */75 s_pInstance->raise();76 /* De-miniaturize if necessary: */77 s_pInstance->setWindowState(s_pInstance->windowState() & ~Qt::WindowMinimized);78 /* And activate finally: */79 s_pInstance->activateWindow();80 }81 60 82 61 UIVMInformationDialog::UIVMInformationDialog(UIMachineWindow *pMachineWindow) … … 85 64 , m_pMachineWindow(pMachineWindow) 86 65 { 87 /* Initialize instance: */88 s_pInstance = this;89 90 66 /* Prepare: */ 91 67 prepare(); … … 94 70 UIVMInformationDialog::~UIVMInformationDialog() 95 71 { 96 /* Deinitialize instance: */ 97 s_pInstance = 0; 72 saveSettings(); 98 73 } 99 74 … … 134 109 } 135 110 136 void UIVMInformationDialog::s ltSaveSettings()111 void UIVMInformationDialog::saveSettings() 137 112 { 138 113 /* Save window geometry: */ … … 151 126 /* Load settings: */ 152 127 loadSettings(); 153 connect(&uiCommon(), &UICommon::sigAskToCommitData,154 this, &UIVMInformationDialog::sltSaveSettings);155 128 } 156 129 157 130 void UIVMInformationDialog::prepareThis() 158 131 { 159 /* Delete dialog on close: */160 setAttribute(Qt::WA_DeleteOnClose);161 /* Delete dialog on machine-window destruction: */162 connect(m_pMachineWindow, &UIMachineWindow::destroyed, this, &UIVMInformationDialog::suicide);163 164 132 #ifdef VBOX_WS_MAC 165 133 /* No window-icon on Mac OS X, because it acts as proxy icon which isn't necessary here. */ … … 274 242 m_pButtonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents); 275 243 uiCommon().setHelpKeyword(m_pButtonBox->button(QDialogButtonBox::Help), "vm-session-information"); 276 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UIVMInformationDialog:: close);244 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UIVMInformationDialog::sigClose); 277 245 connect(m_pButtonBox->button(QDialogButtonBox::Help), &QPushButton::pressed, 278 246 &(msgCenter()), &UIMessageCenter::sltHandleHelpRequest); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.h
r88721 r88741 49 49 Q_OBJECT; 50 50 51 signals: 52 53 void sigClose(); 54 51 55 public: 52 53 /** Shows (and creates if necessary)54 * information-dialog for passed @a pMachineWindow. */55 static void invoke(UIMachineWindow *pMachineWindow);56 57 protected:58 56 59 57 /** Constructs information dialog for passed @a pMachineWindow. */ … … 65 63 virtual bool shouldBeMaximized() const /* override */; 66 64 65 protected: 66 67 67 /** Handles translation event. */ 68 68 void retranslateUi(); … … 70 70 private slots: 71 71 72 /** Destroys dialog immediately. */73 void suicide() { delete this; }74 72 /** Handles tab-widget page change. */ 75 73 void sltHandlePageChanged(int iIndex); 76 void sltSaveSettings();77 74 78 75 private: … … 92 89 /** Loads settings. */ 93 90 void loadSettings(); 94 95 /** @name General variables. 96 * @{ */ 97 /** Holds the dialog instance. */ 98 static UIVMInformationDialog *s_pInstance; 99 /** @} */ 91 void saveSettings(); 100 92 101 93 /** @name Widget variables.
Note:
See TracChangeset
for help on using the changeset viewer.