VirtualBox

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


Ignore:
Timestamp:
Mar 12, 2010 2:09:30 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
58723
Message:

FE/Qt4: New running VM core: some code cleanup, moving some code into more appropriate place.

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

Legend:

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

    r27300 r27311  
    361361    }
    362362    else
     363    {
    363364        /* Discard the temporary created new state: */
    364365        delete pNewVisualState;
     366
     367        /* If there is no state currently created => we have to exit: */
     368        if (!m_pVisualState)
     369            deleteLater();
     370    }
    365371}
    366372
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r27310 r27311  
    363363}
    364364
     365bool UIMachineLogic::checkAvailability()
     366{
     367    /* Get current console: */
     368    CConsole console = session().GetConsole();
     369
     370    /* Check if the required virtualization features are active: */
     371    bool fIs64BitsGuest = vboxGlobal().virtualBox().GetGuestOSType(console.GetGuest().GetOSTypeId()).GetIs64Bit();
     372    bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType(console.GetGuest().GetOSTypeId()).GetRecommendedVirtEx();
     373    AssertMsg(!fIs64BitsGuest || fRecommendVirtEx, ("Virtualization support missed for 64bit guest!\n"));
     374    bool fIsVirtEnabled = console.GetDebugger().GetHWVirtExEnabled();
     375    if (fRecommendVirtEx && !fIsVirtEnabled)
     376    {
     377        bool fShouldWeClose;
     378
     379        bool fVTxAMDVSupported = vboxGlobal().virtualBox().GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx);
     380
     381        if (fIs64BitsGuest)
     382            fShouldWeClose = vboxProblem().warnAboutVirtNotEnabled64BitsGuest(fVTxAMDVSupported);
     383        else
     384            fShouldWeClose = vboxProblem().warnAboutVirtNotEnabledGuestRequired(fVTxAMDVSupported);
     385
     386        return !fShouldWeClose;
     387    }
     388
     389    /* True to confirm success: */
     390    return true;
     391}
     392
    365393UIMachineWindow* UIMachineLogic::mainMachineWindow()
    366394{
     
    423451    , m_pRunningOrPausedActions(0)
    424452    , m_fIsWindowsCreated(false)
    425     , m_fIsPreventAutoStart(false)
    426453    , m_fIsPreventAutoClose(false)
    427454#ifdef Q_WS_MAC
     
    702729void UIMachineLogic::prepareRequiredFeatures()
    703730{
    704     /* Get current console: */
    705     CConsole console = session().GetConsole();
    706 
    707     /* Check if the required virtualization features are ready: */
    708     if (!isPreventAutoStart())
    709     {
    710         bool fIs64BitsGuest = vboxGlobal().virtualBox().GetGuestOSType(console.GetGuest().GetOSTypeId()).GetIs64Bit();
    711         bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType(console.GetGuest().GetOSTypeId()).GetRecommendedVirtEx();
    712         AssertMsg(!fIs64BitsGuest || fRecommendVirtEx, ("Virtualization support missed for 64bit guest!\n"));
    713         bool fIsVirtEnabled = console.GetDebugger().GetHWVirtExEnabled();
    714         if (fRecommendVirtEx && !fIsVirtEnabled)
    715         {
    716             bool fShouldWeClose;
    717 
    718             bool fVTxAMDVSupported = vboxGlobal().virtualBox().GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx);
    719 
    720             if (fIs64BitsGuest)
    721                 fShouldWeClose = vboxProblem().warnAboutVirtNotEnabled64BitsGuest(fVTxAMDVSupported);
    722             else
    723                 fShouldWeClose = vboxProblem().warnAboutVirtNotEnabledGuestRequired(fVTxAMDVSupported);
    724 
    725             if (fShouldWeClose == true)
    726                 setPreventAutoStart(true);
    727         }
    728     }
    729 
    730731#ifdef Q_WS_MAC
    731732# ifdef VBOX_WITH_ICHAT_THEATER
    732733    /* Init shared AV manager: */
    733     if (!isPreventAutoStart())
    734         initSharedAVManager();
     734    initSharedAVManager();
    735735# endif
    736736#endif
    737 
    738     /* Close request in case of features are not ready and user wish to close: */
    739     if (isPreventAutoStart())
    740         QTimer::singleShot(0, uisession(), SLOT(sltCloseVirtualSession()));
    741737}
    742738
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r27310 r27311  
    5959                                  UIVisualStateType visualStateType);
    6060
    61     /* Check if this mode is available */
    62     virtual bool checkAvailability() { return true; }
    63 
    64     /* Do the real initialization of the object */
    65     virtual void initialize() {}
     61    /* Check if this mode is available: */
     62    virtual bool checkAvailability();
     63
     64    /* Do the real initialization of the object: */
     65    virtual void initialize() = 0;
    6666
    6767    /* Main getters/setters: */
     
    7474
    7575    /* Maintenance getters/setters: */
    76     bool isPreventAutoStart() const { return m_fIsPreventAutoStart; }
    7776    bool isPreventAutoClose() const { return m_fIsPreventAutoClose; }
    78     void setPreventAutoStart(bool fIsPreventAutoStart) { m_fIsPreventAutoStart = fIsPreventAutoStart; }
    7977    void setPreventAutoClose(bool fIsPreventAutoClose) { m_fIsPreventAutoClose = fIsPreventAutoClose; }
    8078
     
    196194
    197195    bool m_fIsWindowsCreated : 1;
    198     bool m_fIsPreventAutoStart : 1;
    199196    bool m_fIsPreventAutoClose : 1;
    200197
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r27310 r27311  
    5959bool UIMachineLogicFullscreen::checkAvailability()
    6060{
     61    /* Base class availability: */
     62    if (!UIMachineLogic::checkAvailability())
     63        return false;
     64
    6165    /* Temporary get a machine object: */
    6266    const CMachine &machine = uisession()->session().GetMachine();
     
    126130void UIMachineLogicFullscreen::initialize()
    127131{
    128     /* Check the status of required features: */
     132    /* Prepare required features: */
    129133    prepareRequiredFeatures();
    130134
    131     /* If required features are ready: */
    132     if (!isPreventAutoStart())
    133     {
    134 #ifdef Q_WS_MAC
    135         /* Prepare common connections: */
    136         prepareCommonConnections();
    137 #endif /* Q_WS_MAC */
    138 
    139         /* Prepare console connections: */
    140         prepareSessionConnections();
    141 
    142         /* Prepare action connections: */
    143         prepareActionConnections();
    144 
    145         /* Prepare action groups: */
    146         prepareActionGroups();
    147 
    148         /* Prepare machine window: */
    149         prepareMachineWindows();
    150 
    151 #ifdef Q_WS_MAC
    152         /* Prepare dock: */
    153         prepareDock();
    154 #endif /* Q_WS_MAC */
    155 
    156         /* Power up machine: */
    157         uisession()->powerUp();
    158 
    159         /* Initialization: */
    160         sltMachineStateChanged();
    161         sltAdditionsStateChanged();
    162         sltMouseCapabilityChanged();
    163 
    164         /* Retranslate logic part: */
    165         retranslateUi();
    166     }
     135#ifdef Q_WS_MAC
     136    /* Prepare common connections: */
     137    prepareCommonConnections();
     138#endif /* Q_WS_MAC */
     139
     140    /* Prepare console connections: */
     141    prepareSessionConnections();
     142
     143    /* Prepare action connections: */
     144    prepareActionConnections();
     145
     146    /* Prepare action groups: */
     147    prepareActionGroups();
     148
     149    /* Prepare machine window: */
     150    prepareMachineWindows();
     151
     152#ifdef Q_WS_MAC
     153    /* Prepare dock: */
     154    prepareDock();
     155#endif /* Q_WS_MAC */
     156
     157    /* Power up machine: */
     158    uisession()->powerUp();
     159
     160    /* Initialization: */
     161    sltMachineStateChanged();
     162    sltAdditionsStateChanged();
     163    sltMouseCapabilityChanged();
     164
     165    /* Retranslate logic part: */
     166    retranslateUi();
    167167}
    168168
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r27310 r27311  
    5151void UIMachineLogicNormal::initialize()
    5252{
    53     /* Check the status of required features: */
     53    /* Prepare required features: */
    5454    prepareRequiredFeatures();
    5555
    56     /* If required features are ready: */
    57     if (!isPreventAutoStart())
    58     {
    59         /* Prepare session connections: */
    60         prepareSessionConnections();
     56    /* Prepare session connections: */
     57    prepareSessionConnections();
    6158
    62         /* Prepare action connections: */
    63         prepareActionConnections();
     59    /* Prepare action connections: */
     60    prepareActionConnections();
    6461
    65         /* Prepare action groups: */
    66         prepareActionGroups();
     62    /* Prepare action groups: */
     63    prepareActionGroups();
    6764
    68         /* Prepare normal machine window: */
    69         prepareMachineWindows();
     65    /* Prepare normal machine window: */
     66    prepareMachineWindows();
    7067
    7168#ifdef Q_WS_MAC
    72         /* Prepare dock: */
    73         prepareDock();
     69    /* Prepare dock: */
     70    prepareDock();
    7471#endif /* Q_WS_MAC */
    7572
    76         /* Power up machine: */
    77         uisession()->powerUp();
     73    /* Power up machine: */
     74    uisession()->powerUp();
    7875
    79         /* Initialization: */
    80         sltMachineStateChanged();
    81         sltAdditionsStateChanged();
    82         sltMouseCapabilityChanged();
     76    /* Initialization: */
     77    sltMachineStateChanged();
     78    sltAdditionsStateChanged();
     79    sltMouseCapabilityChanged();
    8380
    84         /* Retranslate logic part: */
    85         retranslateUi();
    86     }
     81    /* Retranslate logic part: */
     82    retranslateUi();
    8783}
    8884
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r27310 r27311  
    5353bool UIMachineLogicSeamless::checkAvailability()
    5454{
     55    /* Base class availability: */
     56    if (!UIMachineLogic::checkAvailability())
     57        return false;
     58
    5559    /* Temporary get a machine object: */
    5660    const CMachine &machine = uisession()->session().GetMachine();
     
    119123void UIMachineLogicSeamless::initialize()
    120124{
    121     /* Check the status of required features: */
     125    /* Prepare required features: */
    122126    prepareRequiredFeatures();
    123127
    124     /* If required features are ready: */
    125     if (!isPreventAutoStart())
    126     {
    127         /* Prepare console connections: */
    128         prepareSessionConnections();
    129 
    130         /* Prepare action connections: */
    131         prepareActionConnections();
    132 
    133         /* Prepare action groups: */
    134         prepareActionGroups();
    135 
    136         /* Prepare normal machine window: */
    137         prepareMachineWindows();
     128    /* Prepare console connections: */
     129    prepareSessionConnections();
     130
     131    /* Prepare action connections: */
     132    prepareActionConnections();
     133
     134    /* Prepare action groups: */
     135    prepareActionGroups();
     136
     137    /* Prepare normal machine window: */
     138    prepareMachineWindows();
    138139
    139140#ifdef Q_WS_MAC
    140         /* Prepare dock: */
    141         prepareDock();
     141    /* Prepare dock: */
     142    prepareDock();
    142143#endif /* Q_WS_MAC */
    143144
    144         /* Power up machine: */
    145         uisession()->powerUp();
    146 
    147         /* Initialization: */
    148         sltMachineStateChanged();
    149         sltAdditionsStateChanged();
    150         sltMouseCapabilityChanged();
    151 
    152         /* Retranslate logic part: */
    153         retranslateUi();
    154     }
     145    /* Power up machine: */
     146    uisession()->powerUp();
     147
     148    /* Initialization: */
     149    sltMachineStateChanged();
     150    sltAdditionsStateChanged();
     151    sltMouseCapabilityChanged();
     152
     153    /* Retranslate logic part: */
     154    retranslateUi();
    155155}
    156156
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