VirtualBox

Changeset 62988 in vbox


Ignore:
Timestamp:
Aug 4, 2016 1:48:34 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
109597
Message:

FE/Qt: bugref:8422: Desktop-widget watchdog rework (part 03): Another refactoring.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp

    r62987 r62988  
    144144//    printf("UIDesktopWidgetWatchdog::sltUpdateHostScreenConfiguration(%d)\n", cHostScreenCount);
    145145
     146    /* Update host-screen configuration: */
     147    updateHostScreenConfiguration(cHostScreenCount);
     148}
     149
     150void UIDesktopWidgetWatchdog::sltRecalculateHostScreenAvailableGeometry(int iHostScreenIndex)
     151{
     152//    printf("UIDesktopWidgetWatchdog::sltRecalculateHostScreenAvailableGeometry(%d)\n", iHostScreenIndex);
     153
     154    /* Recalculate host-screen available-geometry: */
     155    recalculateHostScreenAvailableGeometry(iHostScreenIndex);
     156}
     157
     158void UIDesktopWidgetWatchdog::sltHandleHostScreenAvailableGeometryCalculated(int iHostScreenIndex, QRect availableGeometry)
     159{
     160//    printf("UIDesktopWidgetWatchdog::sltHandleHostScreenAvailableGeometryCalculated(%d): %dx%d x %dx%d\n",
     161//           iHostScreenIndex, availableGeometry.x(), availableGeometry.y(), availableGeometry.width(), availableGeometry.height());
     162
     163    /* Apply received data: */
     164    m_availableGeometryData[iHostScreenIndex] = availableGeometry;
     165    /* Forget finished worker: */
     166    AssertPtrReturnVoid(m_availableGeometryWorkers.value(iHostScreenIndex));
     167    m_availableGeometryWorkers.value(iHostScreenIndex)->disconnect();
     168    m_availableGeometryWorkers.value(iHostScreenIndex)->deleteLater();
     169    m_availableGeometryWorkers[iHostScreenIndex] = 0;
     170}
     171
     172void UIDesktopWidgetWatchdog::prepare()
     173{
     174    /* Prepare connections: */
     175    connect(m_pDesktopWidget, SIGNAL(screenCountChanged(int)), this, SLOT(sltUpdateHostScreenConfiguration(int)));
     176    connect(m_pDesktopWidget, SIGNAL(resized(int)), this, SLOT(sltRecalculateHostScreenAvailableGeometry(int)));
     177
     178    /* Update host-screen configuration: */
     179    updateHostScreenConfiguration();
     180}
     181
     182void UIDesktopWidgetWatchdog::cleanup()
     183{
     184    /* Cleanup connections: */
     185    disconnect(m_pDesktopWidget, SIGNAL(screenCountChanged(int)), this, SLOT(sltUpdateHostScreenConfiguration(int)));
     186    disconnect(m_pDesktopWidget, SIGNAL(resized(int)), this, SLOT(sltRecalculateHostScreenAvailableGeometry(int)));
     187
     188    /* Cleanup existing workers finally: */
     189    cleanupExistingWorkers();
     190}
     191
     192void UIDesktopWidgetWatchdog::updateHostScreenConfiguration(int cHostScreenCount /* = -1 */)
     193{
    146194    /* Acquire new host-screen count: */
    147195    m_cHostScreenCount = cHostScreenCount != -1 ? cHostScreenCount : m_pDesktopWidget->screenCount();
     
    156204    /* Calculate host-screen available-geometry for each particular host-screen: */
    157205    for (int iHostScreenIndex = 0; iHostScreenIndex < m_cHostScreenCount; ++iHostScreenIndex)
    158         sltRecalculateHostScreenAvailableGeometry(iHostScreenIndex);
    159 }
    160 
    161 void UIDesktopWidgetWatchdog::sltRecalculateHostScreenAvailableGeometry(int iHostScreenIndex)
    162 {
    163 //    printf("UIDesktopWidgetWatchdog::sltRecalculateHostScreenAvailableGeometry(%d)\n", iHostScreenIndex);
    164 
     206        recalculateHostScreenAvailableGeometry(iHostScreenIndex);
     207}
     208
     209void UIDesktopWidgetWatchdog::recalculateHostScreenAvailableGeometry(int iHostScreenIndex)
     210{
    165211    /* Make sure index is valid: */
    166212    if (iHostScreenIndex < 0 || iHostScreenIndex >= m_cHostScreenCount)
     
    193239}
    194240
    195 void UIDesktopWidgetWatchdog::sltHandleHostScreenAvailableGeometryCalculated(int iHostScreenIndex, QRect availableGeometry)
    196 {
    197 //    printf("UIDesktopWidgetWatchdog::sltHandleHostScreenAvailableGeometryCalculated(%d): %dx%d x %dx%d\n",
    198 //           iHostScreenIndex, availableGeometry.x(), availableGeometry.y(), availableGeometry.width(), availableGeometry.height());
    199 
    200     /* Apply received data: */
    201     m_availableGeometryData[iHostScreenIndex] = availableGeometry;
    202     /* Forget finished worker: */
    203     AssertPtrReturnVoid(m_availableGeometryWorkers.value(iHostScreenIndex));
    204     m_availableGeometryWorkers.value(iHostScreenIndex)->disconnect();
    205     m_availableGeometryWorkers.value(iHostScreenIndex)->deleteLater();
    206     m_availableGeometryWorkers[iHostScreenIndex] = 0;
    207 }
    208 
    209 void UIDesktopWidgetWatchdog::prepare()
    210 {
    211     /* Prepare connections: */
    212     connect(m_pDesktopWidget, SIGNAL(screenCountChanged(int)), this, SLOT(sltUpdateHostScreenConfiguration(int)));
    213     connect(m_pDesktopWidget, SIGNAL(resized(int)), this, SLOT(sltRecalculateHostScreenAvailableGeometry(int)));
    214 
    215     /* Update host-screen configuration: */
    216     sltUpdateHostScreenConfiguration();
    217 }
    218 
    219 void UIDesktopWidgetWatchdog::cleanup()
    220 {
    221     /* Cleanup connections: */
    222     disconnect(m_pDesktopWidget, SIGNAL(screenCountChanged(int)), this, SLOT(sltUpdateHostScreenConfiguration(int)));
    223     disconnect(m_pDesktopWidget, SIGNAL(resized(int)), this, SLOT(sltRecalculateHostScreenAvailableGeometry(int)));
    224 
    225     /* Cleanup existing workers finally: */
    226     cleanupExistingWorkers();
    227 }
    228 
    229241void UIDesktopWidgetWatchdog::cleanupExistingWorkers()
    230242{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h

    r62987 r62988  
    5050private slots:
    5151
    52     /** Updates host-screen configuration according to new @a cHostScreenCount.
    53       * @note cHostScreenCount can be equal to -1 which means we have to acquire it ourselves. */
    54     void sltUpdateHostScreenConfiguration(int cHostScreenCount = -1);
     52    /** Updates host-screen configuration according to new @a cHostScreenCount. */
     53    void sltUpdateHostScreenConfiguration(int cHostScreenCount);
    5554
    5655    /** Recalculates available-geometry for the host-screen with @a iHostScreenIndex. */
     
    6665    /** Cleanup routine. */
    6766    void cleanup();
     67
     68    /** Updates host-screen configuration according to new @a cHostScreenCount.
     69      * @note cHostScreenCount can be equal to -1 which means we have to acquire it ourselves. */
     70    void updateHostScreenConfiguration(int cHostScreenCount = -1);
     71
     72    /** Recalculates available-geometry for the host-screen with @a iHostScreenIndex. */
     73    void recalculateHostScreenAvailableGeometry(int iHostScreenIndex);
    6874
    6975    /** Cleanups existing workers. */
Note: See TracChangeset for help on using the changeset viewer.

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