VirtualBox

Changeset 88721 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 27, 2021 8:05:03 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161. Session information dialog refactoring.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.cpp

    r88242 r88721  
    800800    connect(this, &UIVMActivityMonitor::customContextMenuRequested,
    801801            this, &UIVMActivityMonitor::sltCreateContextMenu);
    802 }
    803 
    804 UIVMActivityMonitor::~UIVMActivityMonitor()
    805 {
    806     if (!m_comSession.isNull())
    807         m_comSession.UnlockMachine();
     802    connect(&uiCommon(), &UICommon::sigAskToDetachCOM,
     803            this, &UIVMActivityMonitor::sltClearCOMData);
    808804}
    809805
     
    10721068}
    10731069
     1070void UIVMActivityMonitor::sltClearCOMData()
     1071{
     1072    if (!m_comSession.isNull())
     1073        m_comSession.UnlockMachine();
     1074}
     1075
    10741076void UIVMActivityMonitor::prepareMetrics()
    10751077{
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.h

    r88119 r88721  
    125125    UIVMActivityMonitor(EmbedTo enmEmbedding, QWidget *pParent, const CMachine &machine,
    126126                         UIActionPool *pActionPool,bool fShowToolbar = false);
    127     ~UIVMActivityMonitor();
    128127    void setMachine(const CMachine &machine);
    129128
     
    151150    void sltExportMetricsToFile();
    152151    void sltCreateContextMenu(const QPoint &point);
     152    void sltClearCOMData();
    153153
    154154private:
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.cpp

    r87718 r88721  
    313313}
    314314
    315 UIGuestProcessControlWidget::~UIGuestProcessControlWidget()
    316 {
    317     saveSettings();
    318     cleanupListener();
    319 }
    320 
    321315void UIGuestProcessControlWidget::retranslateUi()
    322316{
     
    393387                this, &UIGuestProcessControlWidget::sltGuestSessionUnregistered);
    394388    }
     389
     390    connect(&uiCommon(), &UICommon::sigAskToCommitData,
     391            this, &UIGuestProcessControlWidget::sltSaveSettings);
     392    connect(&uiCommon(), &UICommon::sigAskToDetachCOM,
     393            this, &UIGuestProcessControlWidget::sltCleanupListener);
    395394}
    396395
     
    514513}
    515514
    516 void UIGuestProcessControlWidget::cleanupListener()
    517 {
    518     /* Unregister everything: */
    519     m_pQtListener->getWrapped()->unregisterSources();
    520 
    521     /* Make sure VBoxSVC is available: */
    522     if (!uiCommon().isVBoxSVCAvailable())
    523         return;
    524 
    525     /* Get CProgress event source: */
    526     CEventSource comEventSource = m_comGuest.GetEventSource();
    527     AssertWrapperOk(comEventSource);
    528 
    529     /* Unregister event listener for CProgress event source: */
    530     comEventSource.UnregisterListener(m_comEventListener);
    531 }
    532 
    533 
    534515void UIGuestProcessControlWidget::sltGuestSessionRegistered(CGuestSession guestSession)
    535516{
     
    576557}
    577558
    578 void UIGuestProcessControlWidget::saveSettings()
     559void UIGuestProcessControlWidget::sltSaveSettings()
    579560{
    580561    if (!m_pSplitter)
    581562        return;
    582563    gEDataManager->setGuestControlProcessControlSplitterHints(m_pSplitter->sizes());
     564}
     565
     566void UIGuestProcessControlWidget::sltCleanupListener()
     567{
     568    /* Unregister everything: */
     569    m_pQtListener->getWrapped()->unregisterSources();
     570
     571    /* Make sure VBoxSVC is available: */
     572    if (!uiCommon().isVBoxSVCAvailable())
     573        return;
     574
     575    /* Get CProgress event source: */
     576    CEventSource comEventSource = m_comGuest.GetEventSource();
     577    //AssertWrapperOk(comEventSource);
     578
     579    /* Unregister event listener for CProgress event source: */
     580    comEventSource.UnregisterListener(m_comEventListener);
    583581}
    584582
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.h

    r86233 r88721  
    5555    UIGuestProcessControlWidget(EmbedTo enmEmbedding, const CGuest &comGuest, QWidget *pParent,
    5656                                QString strMachineName = QString(), bool fShowToolbar = false);
    57     ~UIGuestProcessControlWidget();
    5857    /** When true we delete the corresponding tree item as soon as the guest session/process is unregistered. */
    5958    static const bool           m_fDeleteAfterUnregister;
     
    7170    void sltCloseSessionOrProcess();
    7271    void sltShowProperties();
     72    void sltSaveSettings();
     73    void sltCleanupListener();
    7374
    7475private:
     
    8081    void initGuestSessionTree();
    8182    void updateTreeWidget();
    82     void cleanupListener();
    8383    void addGuestSession(CGuestSession guestSession);
    84     void saveSettings();
    8584    void loadSettings();
    8685
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp

    r88071 r88721  
    9494UIVMInformationDialog::~UIVMInformationDialog()
    9595{
    96     /* Cleanup: */
    97     cleanup();
    98 
    9996    /* Deinitialize instance: */
    10097    s_pInstance = 0;
     
    137134}
    138135
     136void UIVMInformationDialog::sltSaveSettings()
     137{
     138    /* Save window geometry: */
     139    {
     140        const QRect geo = currentGeometry();
     141        LogRel2(("GUI: UIVMInformationDialog: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
     142                 geo.x(), geo.y(), geo.width(), geo.height()));
     143        gEDataManager->setSessionInformationDialogGeometry(geo, isCurrentlyMaximized());
     144    }
     145}
     146
    139147void UIVMInformationDialog::prepare()
    140148{
     
    143151    /* Load settings: */
    144152    loadSettings();
     153    connect(&uiCommon(), &UICommon::sigAskToCommitData,
     154            this, &UIVMInformationDialog::sltSaveSettings);
    145155}
    146156
     
    282292    }
    283293}
    284 
    285 void UIVMInformationDialog::saveSettings()
    286 {
    287     /* Save window geometry: */
    288     {
    289         const QRect geo = currentGeometry();
    290         LogRel2(("GUI: UIVMInformationDialog: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
    291                  geo.x(), geo.y(), geo.width(), geo.height()));
    292         gEDataManager->setSessionInformationDialogGeometry(geo, isCurrentlyMaximized());
    293     }
    294 }
    295 
    296 void UIVMInformationDialog::cleanup()
    297 {
    298     /* Save settings: */
    299     saveSettings();
    300 }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.h

    r82968 r88721  
    7474    /** Handles tab-widget page change. */
    7575    void sltHandlePageChanged(int iIndex);
     76    void sltSaveSettings();
    7677
    7778private:
     
    9192    /** Loads settings. */
    9293    void loadSettings();
    93 
    94     /** Saves settings. */
    95     void saveSettings();
    96     /** Cleanups all. */
    97     void cleanup();
    9894
    9995    /** @name General variables.
     
    117113
    118114#endif /* !FEQT_INCLUDED_SRC_runtime_information_UIVMInformationDialog_h */
    119 
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