VirtualBox

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


Ignore:
Timestamp:
May 14, 2021 2:59:39 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161. saving log viewer dialog's geometry in a delayed fashion

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.cpp

    r89041 r89049  
    1919#include <QApplication>
    2020#include <QMenu>
    21 #include <QSplitter>
    2221#include <QVBoxLayout>
    2322
     
    296295    , m_comGuest(comGuest)
    297296    , m_pMainLayout(0)
    298     , m_pSplitter(0)
    299297    , m_pTreeWidget(0)
    300298    , m_enmEmbedding(enmEmbedding)
     
    309307    prepareToolBar();
    310308    initGuestSessionTree();
    311     loadSettings();
    312309    retranslateUi();
    313310}
     
    338335    /* Configure layout: */
    339336    m_pMainLayout->setSpacing(0);
    340 
    341     m_pSplitter = new QSplitter;
    342 
    343     if (!m_pSplitter)
    344         return;
    345 
    346     m_pSplitter->setOrientation(Qt::Vertical);
    347 
    348     m_pMainLayout->addWidget(m_pSplitter);
    349 
    350 
    351337    m_pTreeWidget = new UIGuestControlTreeWidget;
    352338
    353339    if (m_pTreeWidget)
    354340    {
    355         m_pSplitter->addWidget(m_pTreeWidget);
     341        m_pMainLayout->addWidget(m_pTreeWidget);
    356342        m_pTreeWidget->setColumnCount(3);
    357343    }
    358 
    359     m_pSplitter->setStretchFactor(0, 2);
    360     m_pSplitter->setStretchFactor(1, 1);
    361 
    362344    updateTreeWidget();
    363345}
     
    392374                this, &UIGuestProcessControlWidget::sltGuestSessionUnregistered);
    393375    }
    394     connect(&uiCommon(), &UICommon::sigAskToCommitData,
    395             this, &UIGuestProcessControlWidget::sltSaveSettings);
    396376}
    397377
     
    559539}
    560540
    561 void UIGuestProcessControlWidget::sltSaveSettings()
    562 {
    563     if (!m_pSplitter)
    564         return;
    565     gEDataManager->setGuestControlProcessControlSplitterHints(m_pSplitter->sizes());
    566 }
    567 
    568541void UIGuestProcessControlWidget::sltCleanupListener()
    569542{
     
    583556}
    584557
    585 void UIGuestProcessControlWidget::loadSettings()
    586 {
    587     if (!m_pSplitter)
    588         return;
    589     QList<int> splitterHints = gEDataManager->guestControlProcessControlSplitterHints();
    590     if (splitterHints.size() != 2)
    591         return;
    592     if (splitterHints[0] != 0 && splitterHints[1] != 0)
    593         m_pSplitter->setSizes(splitterHints);
    594 }
    595 
    596558#include "UIGuestProcessControlWidget.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.h

    r88874 r89049  
    7171    void sltCloseSessionOrProcess();
    7272    void sltShowProperties();
    73     void sltSaveSettings();
    7473    void sltCleanupListener();
    7574
     
    8382    void updateTreeWidget();
    8483    void addGuestSession(CGuestSession guestSession);
    85     void loadSettings();
    8684
    8785    CGuest                    m_comGuest;
    8886    QVBoxLayout              *m_pMainLayout;
    89     QSplitter                *m_pSplitter;
    9087    UIGuestControlTreeWidget *m_pTreeWidget;
    9188    const EmbedTo             m_enmEmbedding;
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.cpp

    r88903 r89049  
    6565    , m_pActionPool(pActionPool)
    6666    , m_comMachine(comMachine)
     67    , m_iGeometrySaveTimerId(-1)
    6768{
    6869}
     
    9495}
    9596
    96 void UIVMLogViewerDialog::resizeEvent(QResizeEvent *pEvent)
    97 {
    98     QIWithRetranslateUI<QIManagerDialog>::resizeEvent(pEvent);
    99     saveDialogGeometry();
    100 }
    101 
    102 void UIVMLogViewerDialog::moveEvent(QMoveEvent *pEvent)
    103 {
    104     QIWithRetranslateUI<QIManagerDialog>::moveEvent(pEvent);
    105     saveDialogGeometry();
     97bool UIVMLogViewerDialog::event(QEvent *pEvent)
     98{
     99    switch (pEvent->type())
     100    {
     101        case QEvent::Resize:
     102        case QEvent::Move:
     103        {
     104            if (m_iGeometrySaveTimerId != -1)
     105                killTimer(m_iGeometrySaveTimerId);
     106            m_iGeometrySaveTimerId = startTimer(300);
     107            break;
     108        }
     109        case QEvent::Timer:
     110        {
     111            QTimerEvent *pTimerEvent = static_cast<QTimerEvent*>(pEvent);
     112            if (pTimerEvent->timerId() == m_iGeometrySaveTimerId)
     113            {
     114                killTimer(m_iGeometrySaveTimerId);
     115                m_iGeometrySaveTimerId = -1;
     116                saveDialogGeometry();
     117            }
     118            break;
     119        }
     120        default:
     121            break;
     122    }
     123    return QIWithRetranslateUI<QIManagerDialog>::event(pEvent);
    106124}
    107125
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.h

    r88903 r89049  
    8686        /** Handles translation event. */
    8787        virtual void retranslateUi() /* override */;
    88         virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
    89         virtual void moveEvent(QMoveEvent *pEvent) /* override */;
     88        virtual bool event(QEvent *pEvent) /* override */;
    9089    /** @} */
    9190
     
    123122    /** Holds the machine reference. */
    124123    CMachine      m_comMachine;
     124    int m_iGeometrySaveTimerId;
    125125};
    126126
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.h

    r89046 r89049  
    9494    /** @name Widget variables.
    9595     * @{ */
    96     /** Holds the dialog tab-widget instance. */
    97     QITabWidget                  *m_pTabWidget;
    98     /** Holds the map of dialog tab instances. */
    99     QMap<int, QWidget*>           m_tabs;
    100     /** Holds the dialog button-box instance. */
    101     QIDialogButtonBox            *m_pButtonBox;
    102     /** Holds the machine-window reference. */
    103     UIMachineWindow              *m_pMachineWindow;
     96       /** Holds the dialog tab-widget instance. */
     97       QITabWidget                  *m_pTabWidget;
     98       /** Holds the map of dialog tab instances. */
     99       QMap<int, QWidget*>           m_tabs;
     100       /** Holds the dialog button-box instance. */
     101       QIDialogButtonBox            *m_pButtonBox;
     102       /** Holds the machine-window reference. */
     103       UIMachineWindow              *m_pMachineWindow;
    104104    /** @} */
    105105    bool m_fCloseEmitted;
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