VirtualBox

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


Ignore:
Timestamp:
Mar 2, 2010 4:02:37 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: new core: Check for sufficient memory; Fix for older Qt versions.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r26952 r26955  
    289289    }
    290290    else
    291         /* Discard the temporary create new state: */
     291        /* Discard the temporary created new state: */
    292292        delete pNewVisualState;
    293293}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r26954 r26955  
    5858bool UIMachineLogicFullscreen::checkAvailability()
    5959{
     60    /* Temporary get a machine object */
     61    const CMachine &machine = uisession()->session().GetMachine();
     62    const CConsole &console = uisession()->session().GetConsole();
     63
     64#if (QT_VERSION >= 0x040600)
     65    int cHostScreens = QApplication::desktop()->screenCount();
     66#else /* (QT_VERSION >= 0x040600) */
    6067    int cHostScreens = QApplication::desktop()->numScreens();
    61     int cGuestScreens = uisession()->session().GetMachine().GetMonitorCount();
     68#endif /* !(QT_VERSION >= 0x040600) */
     69
     70    int cGuestScreens = machine.GetMonitorCount();
    6271    /* Check that there are enough physical screens are connected */
    6372    if (cHostScreens < cGuestScreens)
    6473    {
    6574        vboxProblem().cannotEnterFullscreenMode();
    66         setPreventAutoStart(true);
    6775        return false;
    6876    }
     77
     78    // TODO_NEW_CORE: this is how it looked in the old version
     79    // bool VBoxConsoleView::isAutoresizeGuestActive() { return mGuestSupportsGraphics && mAutoresizeGuest; }
     80//    if (uisession()->session().GetConsole().isAutoresizeGuestActive())
     81    if (uisession()->isGuestAdditionsActive())
     82    {
     83        ULONG64 availBits = machine.GetVRAMSize() /* VRAM */
     84                          * _1M /* MB to bytes */
     85                          * 8; /* to bits */
     86        ULONG guestBpp = console.GetDisplay().GetBitsPerPixel();
     87        ULONG64 usedBits = 0;
     88        for (int i = 0; i < cGuestScreens; ++i)
     89        {
     90            // TODO_NEW_CORE: really take the screen geometry into account the
     91            // different fb will be displayed. */
     92            QRect screen = QApplication::desktop()->screenGeometry(i);
     93            usedBits += screen.width() /* display width */
     94                      * screen.height() /* display height */
     95                      * guestBpp
     96                      + _1M * 8; /* current cache per screen - may be changed in future */
     97        }
     98        usedBits += 4096 * 8; /* adapter info */
     99
     100        if (availBits < usedBits)
     101        {
     102//            int result = vboxProblem().cannotEnterFullscreenMode(screen.width(), screen.height(), guestBpp,
     103//                                                                 (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);
     104            int result = vboxProblem().cannotEnterFullscreenMode(0, 0, guestBpp,
     105                                                                 (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);
     106            if (result == QIMessageBox::Cancel)
     107                return false;
     108        }
     109    }
     110
    69111
    70112    return true;
     
    136178}
    137179
    138 void UIMachineLogicFullscreen::prepareRequiredFeatures()
    139 {
    140     // TODO_NEW_CORE
    141 //    if (session().GetConsole().isAutoresizeGuestActive())
    142 //    {
    143 //        ULONG64 availBits = session().GetMachine().GetVRAMSize() /* VRAM */
    144 //            * _1M /* MB to bytes */
    145 //            * 8; /* to bits */
    146 //        for (ulong uScreenId = 0; uScreenId < uMonitorCount; ++ uScreenId)
    147 //        {
    148 //            QRect screen = QApplication::desktop()->screenGeometry(this);
    149 //            ULONG guestBpp = mConsole->console().GetDisplay().GetBitsPerPixel();
    150 //            ULONG64 usedBits = (screen.width() /* display width */
    151 //                                * screen.height() /* display height */
    152 //                                * guestBpp
    153 //                                + _1M * 8) /* current cache per screen - may be changed in future */
    154 //                * session().GetMachine().GetMonitorCount() /**< @todo fix assumption that all screens have same resolution */
    155 //                + 4096 * 8; /* adapter info */
    156 //        }
    157 //
    158 //        if (availBits < usedBits)
    159 //        {
    160 //            int result = vboxProblem().cannotEnterFullscreenMode(
    161 //                                                                 screen.width(), screen.height(), guestBpp,
    162 //                                                                 (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);
    163 //            if (result == QIMessageBox::Cancel)
    164 //                sltClose();
    165 //        }
    166 //    }
    167 //
    168     UIMachineLogic::prepareRequiredFeatures();
    169 }
    170 
    171180void UIMachineLogicFullscreen::prepareMachineWindows()
    172181{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

    r26950 r26955  
    5757    void prepareActionConnections();
    5858    void prepareMachineWindows();
    59     void prepareRequiredFeatures();
    6059
    6160    /* Cleanup helpers: */
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