VirtualBox

Changeset 27028 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 4, 2010 1:56:17 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: New running VM core: some cleanup & merge.

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

Legend:

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

    r26950 r27028  
    10271027}
    10281028
     1029int VBoxProblemReporter::cannotEnterSeamlessMode()
     1030{
     1031    return message(mainMachineWindowShown(), Error,
     1032             tr ("<p>Can not switch the guest display to seamless mode. You "
     1033                 "have more virtual screens configured than physical screens are "
     1034                 "attached to your host.</p><p>Please either lower the virtual "
     1035                 "screens in your VM configuration or attach additional screens "
     1036                 "to your host.</p>"),
     1037             0, /* aAutoConfirmId */
     1038             QIMessageBox::Ok | QIMessageBox::Default);
     1039}
     1040
    10291041bool VBoxProblemReporter::confirmMachineDeletion (const CMachine &machine)
    10301042{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h

    r26950 r27028  
    228228
    229229    int cannotEnterFullscreenMode();
     230    int cannotEnterSeamlessMode();
    230231
    231232    bool confirmMachineDeletion (const CMachine &machine);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r27015 r27028  
    2323
    2424/* Global includes */
    25 #include <QMenu>
    2625#include <QDesktopWidget>
    2726
     
    3534#include "UIMachineLogicFullscreen.h"
    3635#include "UIMachineWindow.h"
    37 #include "UIMachineView.h"
    3836
    3937#include "VBoxUtils.h"
     
    5351{
    5452    /* Cleanup machine window: */
    55     cleanupMachineWindow();
     53    cleanupMachineWindows();
    5654
    5755    /* Cleanup action related stuff */
     
    8987        ULONG guestBpp = console.GetDisplay().GetBitsPerPixel();
    9088        ULONG64 usedBits = 0;
    91         for (int i = 0; i < cGuestScreens; ++i)
     89        for (int i = 0; i < cGuestScreens; ++ i)
    9290        {
    9391            // TODO_NEW_CORE: really take the screen geometry into account the
     
    153151}
    154152
    155 void UIMachineLogicFullscreen::sltPrepareNetworkAdaptersMenu()
    156 {
    157     QMenu *menu = qobject_cast<QMenu*>(sender());
    158     AssertMsg(menu, ("This slot should be called only on Network Adapters menu show!\n"));
    159     menu->clear();
    160     menu->addAction(actionsPool()->action(UIActionIndex_Simple_NetworkAdaptersDialog));
    161 }
    162 
    163 void UIMachineLogicFullscreen::sltPrepareSharedFoldersMenu()
    164 {
    165     QMenu *menu = qobject_cast<QMenu*>(sender());
    166     AssertMsg(menu, ("This slot should be called only on Shared Folders menu show!\n"));
    167     menu->clear();
    168     menu->addAction(actionsPool()->action(UIActionIndex_Simple_SharedFoldersDialog));
    169 }
    170 
    171 void UIMachineLogicFullscreen::sltPrepareMouseIntegrationMenu()
    172 {
    173     QMenu *menu = qobject_cast<QMenu*>(sender());
    174     AssertMsg(menu, ("This slot should be called only on Mouse Integration Menu show!\n"));
    175     menu->clear();
    176     menu->addAction(actionsPool()->action(UIActionIndex_Toggle_MouseIntegration));
    177 }
    178 
    179153void UIMachineLogicFullscreen::prepareActionGroups()
    180154{
     155    /* Base class action groups: */
    181156    UIMachineLogic::prepareActionGroups();
    182157
    183158    /* Adjust window isn't allowed in fullscreen */
    184159    actionsPool()->action(UIActionIndex_Simple_AdjustWindow)->setEnabled(false);
    185 }
    186 
    187 void UIMachineLogicFullscreen::prepareActionConnections()
    188 {
    189     /* Base class connections: */
    190     UIMachineLogic::prepareActionConnections();
    191 
    192     /* This class connections: */
    193     connect(actionsPool()->action(UIActionIndex_Menu_NetworkAdapters)->menu(), SIGNAL(aboutToShow()),
    194             this, SLOT(sltPrepareNetworkAdaptersMenu()));
    195     connect(actionsPool()->action(UIActionIndex_Menu_SharedFolders)->menu(), SIGNAL(aboutToShow()),
    196             this, SLOT(sltPrepareSharedFoldersMenu()));
    197     connect(actionsPool()->action(UIActionIndex_Menu_MouseIntegration)->menu(), SIGNAL(aboutToShow()),
    198             this, SLOT(sltPrepareMouseIntegrationMenu()));
    199160}
    200161
     
    218179#endif /* Q_WS_MAC */
    219180
     181#if 0 // TODO: Add seamless multi-monitor support!
    220182    /* Create machine window(s): */
    221183    for (ulong uScreenId = 0; uScreenId < uMonitorCount; ++ uScreenId)
     
    224186    for (ulong uScreenId = uMonitorCount; uScreenId > 0; -- uScreenId)
    225187        machineWindows()[uScreenId - 1]->machineWindow()->raise();
     188#else
     189    /* Create primary machine window: */
     190    addMachineWindow(UIMachineWindow::create(this, visualStateType(), 0 /* primary only */));
     191#endif
    226192
    227193    /* Notify others about machine window(s) created: */
     
    310276}
    311277
    312 void UIMachineLogicFullscreen::cleanupMachineWindow()
     278void UIMachineLogicFullscreen::cleanupMachineWindows()
    313279{
    314280    /* Do not cleanup machine window if it is not present: */
     
    316282        return;
    317283
    318     /* Cleanup machine window: */
     284#if 0 // TODO: Add seamless multi-monitor support!
     285    /* Cleanup normal machine window: */
    319286    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    320287        UIMachineWindow::destroy(pMachineWindow);
     288#else
     289    /* Create machine window(s): */
     290    UIMachineWindow::destroy(machineWindows()[0] /* primary only */);
     291#endif
    321292
    322293#ifdef Q_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

    r27015 r27028  
    4545    void initialize();
    4646
    47 private slots:
    48 
    49     /* Windowed mode funtionality: */
    50     void sltPrepareNetworkAdaptersMenu();
    51     void sltPrepareSharedFoldersMenu();
    52     void sltPrepareMouseIntegrationMenu();
    53 
    5447private:
    5548
    5649    /* Prepare helpers: */
    5750    void prepareActionGroups();
    58     void prepareActionConnections();
    5951    void prepareMachineWindows();
    6052
    6153    /* Cleanup helpers: */
    62     void cleanupMachineWindow();
    63     void cleanupActionConnections() {}
     54    void cleanupMachineWindows();
    6455    void cleanupActionGroups();
    6556
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r27012 r27028  
    2222 */
    2323
     24/* Global includes */
     25#include <QDesktopWidget>
     26
    2427/* Local includes */
    2528#include "COMDefs.h"
     
    2831
    2932#include "UISession.h"
     33#include "UIActionsPool.h"
    3034#include "UIMachineLogicSeamless.h"
    3135#include "UIMachineWindow.h"
     
    4246    /* Cleanup normal machine window: */
    4347    cleanupMachineWindows();
     48}
     49
     50bool UIMachineLogicSeamless::checkAvailability()
     51{
     52    /* Temporary get a machine object */
     53    const CMachine &machine = uisession()->session().GetMachine();
     54    const CConsole &console = uisession()->session().GetConsole();
     55
     56#if (QT_VERSION >= 0x040600)
     57    int cHostScreens = QApplication::desktop()->screenCount();
     58#else /* (QT_VERSION >= 0x040600) */
     59    int cHostScreens = QApplication::desktop()->numScreens();
     60#endif /* !(QT_VERSION >= 0x040600) */
     61
     62    int cGuestScreens = machine.GetMonitorCount();
     63    /* Check that there are enough physical screens are connected */
     64    if (cHostScreens < cGuestScreens)
     65    {
     66        vboxProblem().cannotEnterSeamlessMode();
     67        return false;
     68    }
     69
     70    // TODO_NEW_CORE: this is how it looked in the old version
     71    // bool VBoxConsoleView::isAutoresizeGuestActive() { return mGuestSupportsGraphics && mAutoresizeGuest; }
     72//    if (uisession()->session().GetConsole().isAutoresizeGuestActive())
     73    if (uisession()->isGuestAdditionsActive())
     74    {
     75        ULONG64 availBits = machine.GetVRAMSize() /* VRAM */
     76                          * _1M /* MB to bytes */
     77                          * 8; /* to bits */
     78        ULONG guestBpp = console.GetDisplay().GetBitsPerPixel();
     79        ULONG64 usedBits = 0;
     80        for (int i = 0; i < cGuestScreens; ++ i)
     81        {
     82            // TODO_NEW_CORE: really take the screen geometry into account the
     83            // different fb will be displayed. */
     84            QRect screen = QApplication::desktop()->availableGeometry(i);
     85            usedBits += screen.width() /* display width */
     86                      * screen.height() /* display height */
     87                      * guestBpp
     88                      + _1M * 8; /* current cache per screen - may be changed in future */
     89        }
     90        usedBits += 4096 * 8; /* adapter info */
     91
     92        if (availBits < usedBits)
     93        {
     94//          vboxProblem().cannotEnterSeamlessMode(screen.width(), screen.height(), guestBpp,
     95//                                                (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);
     96            vboxProblem().cannotEnterSeamlessMode(0, 0, guestBpp,
     97                                                  (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);
     98            return false;
     99        }
     100    }
     101
     102    return true;
    44103}
    45104
     
    69128        sltMouseCapabilityChanged();
    70129    }
     130}
     131
     132void UIMachineLogicSeamless::prepareActionGroups()
     133{
     134    /* Base class action groups: */
     135    UIMachineLogic::prepareActionGroups();
     136
     137    /* Adjust window isn't allowed in seamless */
     138    actionsPool()->action(UIActionIndex_Simple_AdjustWindow)->setEnabled(false);
    71139}
    72140
     
    203271}
    204272
     273void UIMachineLogicSeamless::cleanupActionGroups()
     274{
     275    /* Reenable adjust window */
     276    actionsPool()->action(UIActionIndex_Simple_AdjustWindow)->setEnabled(true);
     277}
     278
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h

    r27012 r27028  
    4242    virtual ~UIMachineLogicSeamless();
    4343
     44    bool checkAvailability();
    4445    void initialize();
    4546
     
    4748
    4849    /* Prepare helpers: */
     50    void prepareActionGroups();
    4951    void prepareMachineWindows();
    5052
    5153    /* Cleanup helpers: */
    5254    void cleanupMachineWindows();
     55    void cleanupActionGroups();
    5356
    5457    /* Friend classes: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h

    r27012 r27028  
    3333protected:
    3434
    35     /* Normal machine view constructor/destructor: */
     35    /* Seamless machine view constructor/destructor: */
    3636    UIMachineViewSeamless(  UIMachineWindow *pMachineWindow
    3737                          , VBoxDefs::RenderMode renderMode
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