VirtualBox

Changeset 102571 in vbox for trunk


Ignore:
Timestamp:
Dec 11, 2023 3:07:59 PM (10 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10570: UIMachineLogic: A bit of rework for File Manager, Log Viewer and Guest Session Control dialog prepare/cleanup procedures; That is required after migration to Qt6 because close-event handling is changed a lot; It is also involves a change in QIManagerDialog interface as no delayed dialog deleting is suitable for our case anymore.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIManagerDialog.cpp

    r99946 r102571  
    5757void QIManagerDialogFactory::cleanup(QIManagerDialog *&pDialog)
    5858{
    59     pDialog->cleanup();
    60     pDialog->deleteLater();
    61     pDialog = 0;
     59    if (pDialog)
     60    {
     61        pDialog->cleanup();
     62        delete pDialog;
     63        pDialog = 0;
     64    }
    6265}
    6366
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r102556 r102571  
    16771677void UIMachineLogic::sltShowFileManagerDialog()
    16781678{
    1679     if (!activeMachineWindow())
    1680         return;
    1681 
    1682     /* Create a file manager only if we don't have one already: */
    1683     if (m_pFileManagerDialog)
    1684     {
    1685         m_pFileManagerDialog->activateWindow();
    1686         m_pFileManagerDialog->raise();
    1687         return;
    1688     }
    1689 
    1690     QIManagerDialog *pFileManagerDialog;
    1691     UIFileManagerDialogFactory dialogFactory(actionPool(), uiCommon().managedVMUuid(), uimachine()->machineName());
    1692     dialogFactory.prepare(pFileManagerDialog, activeMachineWindow());
    1693     if (pFileManagerDialog)
    1694     {
    1695         m_pFileManagerDialog = pFileManagerDialog;
    1696 
    1697         /* Show instance: */
    1698         pFileManagerDialog->show();
    1699         pFileManagerDialog->setWindowState(pFileManagerDialog->windowState() & ~Qt::WindowMinimized);
    1700         pFileManagerDialog->activateWindow();
    1701         pFileManagerDialog->raise();
    1702         connect(pFileManagerDialog, &QIManagerDialog::sigClose,
     1679    /* Do not process if window(s) missed! */
     1680    if (   !isMachineWindowsCreated()
     1681        || !activeMachineWindow())
     1682        return;
     1683
     1684    /* Create instance if not yet created: */
     1685    if (!m_pFileManagerDialog)
     1686    {
     1687        UIFileManagerDialogFactory(actionPool(), uiCommon().managedVMUuid(), uimachine()->machineName())
     1688            .prepare(m_pFileManagerDialog, activeMachineWindow());
     1689        connect(m_pFileManagerDialog, &QIManagerDialog::sigClose,
    17031690                this, &UIMachineLogic::sltCloseFileManagerDialog);
    17041691    }
     1692
     1693    /* Expose instance: */
     1694    UIDesktopWidgetWatchdog::restoreWidget(m_pFileManagerDialog);
    17051695}
    17061696
    17071697void UIMachineLogic::sltCloseFileManagerDialog()
    17081698{
    1709     if (!m_pFileManagerDialog)
    1710         return;
    1711 
    1712     QIManagerDialog* pDialog = m_pFileManagerDialog;
    1713     /* Set the m_pFileManagerDialog to NULL before closing the dialog. or we will have redundant deletes*/
    1714     m_pFileManagerDialog = 0;
    1715     pDialog->close();
    1716     UIFileManagerDialogFactory().cleanup(pDialog);
     1699    UIFileManagerDialogFactory().cleanup(m_pFileManagerDialog);
    17171700}
    17181701
    17191702void UIMachineLogic::sltShowLogDialog()
    17201703{
    1721     if (!activeMachineWindow())
    1722         return;
    1723 
    1724     /* Create a logviewer only if we don't have one already */
    1725     if (m_pLogViewerDialog)
    1726         return;
    1727 
    1728     QIManagerDialog *pLogViewerDialog;
    1729     UIVMLogViewerDialogFactory dialogFactory(actionPool(), uiCommon().managedVMUuid(), uimachine()->machineName());
    1730     dialogFactory.prepare(pLogViewerDialog, activeMachineWindow());
    1731     if (pLogViewerDialog)
    1732     {
    1733         m_pLogViewerDialog = pLogViewerDialog;
    1734 
    1735         /* Show instance: */
    1736         pLogViewerDialog->show();
    1737         pLogViewerDialog->setWindowState(pLogViewerDialog->windowState() & ~Qt::WindowMinimized);
    1738         pLogViewerDialog->activateWindow();
    1739         connect(pLogViewerDialog, &QIManagerDialog::sigClose,
     1704    /* Do not process if window(s) missed! */
     1705    if (   !isMachineWindowsCreated()
     1706        || !activeMachineWindow())
     1707        return;
     1708
     1709    /* Create instance if not yet created: */
     1710    if (!m_pLogViewerDialog)
     1711    {
     1712        UIVMLogViewerDialogFactory(actionPool(), uiCommon().managedVMUuid(), uimachine()->machineName())
     1713            .prepare(m_pLogViewerDialog, activeMachineWindow());
     1714        connect(m_pLogViewerDialog, &QIManagerDialog::sigClose,
    17401715                this, &UIMachineLogic::sltCloseLogDialog);
    17411716    }
     1717
     1718    /* Expose instance: */
     1719    UIDesktopWidgetWatchdog::restoreWidget(m_pLogViewerDialog);
    17421720}
    17431721
    17441722void UIMachineLogic::sltCloseLogDialog()
    17451723{
    1746     if (!m_pLogViewerDialog)
    1747         return;
    1748 
    1749     QIManagerDialog* pDialog = m_pLogViewerDialog;
    1750     /* Set the m_pLogViewerDialog to NULL before closing the dialog. or we will have redundant deletes*/
    1751     m_pLogViewerDialog = 0;
    1752     pDialog->close();
    1753     UIVMLogViewerDialogFactory().cleanup(pDialog);
     1724    UIVMLogViewerDialogFactory().cleanup(m_pLogViewerDialog);
    17541725}
    17551726
     
    20322003{
    20332004    /* Do not process if window(s) missed! */
    2034     if (!isMachineWindowsCreated())
     2005    if (   !isMachineWindowsCreated()
     2006        || !activeMachineWindow())
    20352007        return;
    20362008
     
    24152387void UIMachineLogic::sltShowGuestControlConsoleDialog()
    24162388{
    2417     if (!activeMachineWindow())
    2418         return;
    2419 
    2420     /* Create the dialog only if we don't have one already */
    2421     if (m_pProcessControlDialog)
    2422         return;
    2423 
    2424     QIManagerDialog *pProcessControlDialog;
    2425     UIGuestProcessControlDialogFactory dialogFactory;
    2426     dialogFactory.prepare(pProcessControlDialog, activeMachineWindow());
    2427     if (pProcessControlDialog)
    2428     {
    2429         m_pProcessControlDialog = pProcessControlDialog;
    2430 
    2431         /* Show instance: */
    2432         pProcessControlDialog->show();
    2433         pProcessControlDialog->setWindowState(pProcessControlDialog->windowState() & ~Qt::WindowMinimized);
    2434         pProcessControlDialog->activateWindow();
    2435         connect(pProcessControlDialog, &QIManagerDialog::sigClose,
     2389    /* Do not process if window(s) missed! */
     2390    if (   !isMachineWindowsCreated()
     2391        || !activeMachineWindow())
     2392        return;
     2393
     2394    /* Create instance if not yet created: */
     2395    if (!m_pProcessControlDialog)
     2396    {
     2397        UIGuestProcessControlDialogFactory().prepare(m_pProcessControlDialog, activeMachineWindow());
     2398        connect(m_pProcessControlDialog, &QIManagerDialog::sigClose,
    24362399                this, &UIMachineLogic::sltCloseGuestControlConsoleDialog);
    24372400    }
     2401
     2402    /* Expose instance: */
     2403    UIDesktopWidgetWatchdog::restoreWidget(m_pProcessControlDialog);
    24382404}
    24392405
    24402406void UIMachineLogic::sltCloseGuestControlConsoleDialog()
    24412407{
    2442     if (!m_pProcessControlDialog)
    2443         return;
    2444 
    2445     QIManagerDialog* pDialog = m_pProcessControlDialog;
    2446     /* Set the m_pLogViewerDialog to NULL before closing the dialog. or we will have redundant deletes*/
    2447     m_pProcessControlDialog = 0;
    2448     pDialog->close();
    2449     UIGuestProcessControlDialogFactory().cleanup(pDialog);
     2408    UIGuestProcessControlDialogFactory().cleanup(m_pProcessControlDialog);
    24502409}
    24512410#endif /* VBOX_WITH_DEBUGGER_GUI */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette