VirtualBox

Changeset 88519 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 15, 2021 10:20:22 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161: A bit of rework for VirtualBox Manager; Saving geometry instantly on change to avoid doing that on app shutdown.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r88471 r88519  
    467467    , m_fFirstMediumEnumerationHandled(false)
    468468    , m_pActionPool(0)
     469    , m_iGeometrySaveTimerId(-1)
    469470{
    470471    s_pInstance = this;
     
    537538            emit sigWindowRemapped();
    538539            break;
     540        }
     541        /* Handle move/resize geometry changes: */
     542        case QEvent::Move:
     543        case QEvent::Resize:
     544        {
     545            if (m_iGeometrySaveTimerId != -1)
     546                killTimer(m_iGeometrySaveTimerId);
     547            m_iGeometrySaveTimerId = startTimer(300);
     548            break;
     549        }
     550        /* Handle timer event started above: */
     551        case QEvent::Timer:
     552        {
     553            QTimerEvent *pTimerEvent = static_cast<QTimerEvent*>(pEvent);
     554            if (pTimerEvent->timerId() == m_iGeometrySaveTimerId)
     555            {
     556                killTimer(m_iGeometrySaveTimerId);
     557                m_iGeometrySaveTimerId = -1;
     558                const QRect geo = currentGeometry();
     559                LogRel2(("GUI: UIVirtualBoxManager: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
     560                         geo.x(), geo.y(), geo.width(), geo.height()));
     561                gEDataManager->setSelectorWindowGeometry(geo, isCurrentlyMaximized());
     562            }
    539563        }
    540564        default:
     
    22542278#endif
    22552279
    2256     /* Medium enumeration connections: */
     2280    /* UICommon connections: */
    22572281    connect(&uiCommon(), &UICommon::sigMediumEnumerationFinished,
    22582282            this, &UIVirtualBoxManager::sltHandleMediumEnumerationFinish);
     
    24702494}
    24712495
    2472 void UIVirtualBoxManager::saveSettings()
    2473 {
    2474     /* Save window geometry: */
    2475     {
    2476         const QRect geo = currentGeometry();
    2477         LogRel2(("GUI: UIVirtualBoxManager: Saving geometry as: Origin=%dx%d, Size=%dx%d\n",
    2478                  geo.x(), geo.y(), geo.width(), geo.height()));
    2479         gEDataManager->setSelectorWindowGeometry(geo, isCurrentlyMaximized());
    2480     }
    2481 }
    2482 
    24832496void UIVirtualBoxManager::cleanupConnections()
    24842497{
     
    25172530    sltCloseManagerWindow(UIToolType_Cloud);
    25182531    sltCloseManagerWindow(UIToolType_CloudConsole);
    2519 
    2520     /* Save settings: */
    2521     saveSettings();
    25222532
    25232533    /* Cleanup: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r88071 r88519  
    321321        void loadSettings();
    322322
    323         /** Saves settings. */
    324         void saveSettings();
    325323        /** Cleanups connections. */
    326324        void cleanupConnections();
     
    458456    /** Holds the central-widget instance. */
    459457    UIVirtualBoxManagerWidget *m_pWidget;
     458
     459    /** Holds the geometry save timer ID. */
     460    int  m_iGeometrySaveTimerId;
    460461};
    461462
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