VirtualBox

Changeset 88741 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 27, 2021 7:48:59 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161. Several changes to handle COM cleanup and extra data saving from UIMachineLogic. not complete.

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  
    313313}
    314314
     315UIGuestProcessControlWidget::~UIGuestProcessControlWidget()
     316{
     317    saveSettings();
     318    cleanupListener();
     319}
     320
    315321void UIGuestProcessControlWidget::retranslateUi()
    316322{
     
    387393                this, &UIGuestProcessControlWidget::sltGuestSessionUnregistered);
    388394    }
    389 
    390     connect(&uiCommon(), &UICommon::sigAskToCommitData,
    391             this, &UIGuestProcessControlWidget::sltSaveSettings);
    392     connect(&uiCommon(), &UICommon::sigAskToDetachCOM,
    393             this, &UIGuestProcessControlWidget::sltCleanupListener);
    394395}
    395396
     
    557558}
    558559
    559 void UIGuestProcessControlWidget::sltSaveSettings()
     560void UIGuestProcessControlWidget::saveSettings()
    560561{
    561562    if (!m_pSplitter)
     
    564565}
    565566
    566 void UIGuestProcessControlWidget::sltCleanupListener()
     567void UIGuestProcessControlWidget::cleanupListener()
    567568{
    568569    /* Unregister everything: */
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.h

    r88721 r88741  
    5555    UIGuestProcessControlWidget(EmbedTo enmEmbedding, const CGuest &comGuest, QWidget *pParent,
    5656                                QString strMachineName = QString(), bool fShowToolbar = false);
     57    ~UIGuestProcessControlWidget();
    5758    /** When true we delete the corresponding tree item as soon as the guest session/process is unregistered. */
    5859    static const bool           m_fDeleteAfterUnregister;
     
    7071    void sltCloseSessionOrProcess();
    7172    void sltShowProperties();
    72     void sltSaveSettings();
    73     void sltCleanupListener();
    7473
    7574private:
     
    8382    void addGuestSession(CGuestSession guestSession);
    8483    void loadSettings();
     84    void cleanupListener();
     85    void saveSettings();
    8586
    8687    CGuest                    m_comGuest;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r88729 r88741  
    866866    , m_pProcessControlDialog(0)
    867867    , m_pSoftKeyboardDialog(0)
     868    , m_pVMInformationDialog(0)
    868869{
    869870}
     
    18221823        return;
    18231824
    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
     1841void UIMachineLogic::sltCloseVMInformationDialog()
     1842{
     1843    delete m_pVMInformationDialog;
     1844    m_pVMInformationDialog = 0;
    18261845}
    18271846
     
    18531872void UIMachineLogic::sltCloseFileManagerDialog()
    18541873{
    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;
    18591878    /* Set the m_pFileManagerDialog to NULL before closing the dialog. or we will have redundant deletes*/
    18601879    m_pFileManagerDialog = 0;
     
    27892808    cleanupDebugger();
    27902809#endif
     2810    sltCloseFileManagerDialog();
     2811    sltCloseVMInformationDialog();
    27912812}
    27922813
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r88729 r88741  
    4141class UIDockIconPreview;
    4242class UISoftKeyboard;
     43class UIVMInformationDialog;
    4344class CSession;
    4445class CMachine;
     
    280281    void sltTakeSnapshot();
    281282    void sltShowInformationDialog();
     283    void sltCloseVMInformationDialog();
    282284    void sltShowFileManagerDialog();
    283285    void sltCloseFileManagerDialog();
     
    443445
    444446    /** 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;
    450452    /* Friend classes: */
    451453    friend class UIMachineWindow;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp

    r88721 r88741  
    5858
    5959
    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 }
    8160
    8261UIVMInformationDialog::UIVMInformationDialog(UIMachineWindow *pMachineWindow)
     
    8564    , m_pMachineWindow(pMachineWindow)
    8665{
    87     /* Initialize instance: */
    88     s_pInstance = this;
    89 
    9066    /* Prepare: */
    9167    prepare();
     
    9470UIVMInformationDialog::~UIVMInformationDialog()
    9571{
    96     /* Deinitialize instance: */
    97     s_pInstance = 0;
     72    saveSettings();
    9873}
    9974
     
    134109}
    135110
    136 void UIVMInformationDialog::sltSaveSettings()
     111void UIVMInformationDialog::saveSettings()
    137112{
    138113    /* Save window geometry: */
     
    151126    /* Load settings: */
    152127    loadSettings();
    153     connect(&uiCommon(), &UICommon::sigAskToCommitData,
    154             this, &UIVMInformationDialog::sltSaveSettings);
    155128}
    156129
    157130void UIVMInformationDialog::prepareThis()
    158131{
    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 
    164132#ifdef VBOX_WS_MAC
    165133    /* No window-icon on Mac OS X, because it acts as proxy icon which isn't necessary here. */
     
    274242        m_pButtonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents);
    275243        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);
    277245        connect(m_pButtonBox->button(QDialogButtonBox::Help), &QPushButton::pressed,
    278246                &(msgCenter()), &UIMessageCenter::sltHandleHelpRequest);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.h

    r88721 r88741  
    4949    Q_OBJECT;
    5050
     51signals:
     52
     53    void sigClose();
     54
    5155public:
    52 
    53     /** Shows (and creates if necessary)
    54       * information-dialog for passed @a pMachineWindow. */
    55     static void invoke(UIMachineWindow *pMachineWindow);
    56 
    57 protected:
    5856
    5957    /** Constructs information dialog for passed @a pMachineWindow. */
     
    6563    virtual bool shouldBeMaximized() const /* override */;
    6664
     65protected:
     66
    6767    /** Handles translation event. */
    6868    void retranslateUi();
     
    7070private slots:
    7171
    72     /** Destroys dialog immediately. */
    73     void suicide() { delete this; }
    7472    /** Handles tab-widget page change. */
    7573    void sltHandlePageChanged(int iIndex);
    76     void sltSaveSettings();
    7774
    7875private:
     
    9289    /** Loads settings. */
    9390    void loadSettings();
    94 
    95     /** @name General variables.
    96      * @{ */
    97     /** Holds the dialog instance. */
    98     static UIVMInformationDialog *s_pInstance;
    99     /** @} */
     91    void saveSettings();
    10092
    10193    /** @name Widget variables.
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