VirtualBox

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


Ignore:
Timestamp:
May 26, 2014 4:45:43 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Removing UIExtraDataDefs.h dependency from VBoxGlobal.h; removing RenderMode CLI logic, it's obsolete; extending RenderMode extra-data logic.

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

Legend:

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

    r47086 r51401  
    3131# include "VBoxAboutDlg.h"
    3232# include "VBoxGlobal.h"
     33# include "UIConverter.h"
     34# include "UIExtraDataManager.h"
    3335#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3436
     
    105107    QString strAboutText =  tr("VirtualBox Graphical User Interface");
    106108#ifdef DEBUG
    107     QString strRenderingInfo(" (%1)");
    108     QString strRenderingMode("QImage");
    109 # ifdef VBOX_GUI_USE_QUARTZ2D
    110     if (vboxGlobal().vmRenderMode() == Quartz2DMode)
    111         strRenderingMode = "Quartz2D";
    112 # endif /* VBOX_GUI_USE_QUARTZ2D */
    113     strAboutText += strRenderingInfo.arg(strRenderingMode);
     109    strAboutText += QString(" (%1)").arg(gpConverter->toString(gEDataManager->renderMode(vboxGlobal().managedVMUuid())));
    114110#endif /* DEBUG */
    115111#ifdef VBOX_BLEEDING_EDGE
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp

    r49940 r51401  
    3232#include "UIMessageCenter.h"
    3333#include "UIPopupCenter.h"
     34#include "UIExtraDataDefs.h"
    3435#include "VBoxGlobal.h"
    3536
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h

    r51214 r51401  
    7272#endif /* VBOX_WITH_DEBUGGER_GUI */
    7373template<> bool canConvert<RuntimeMenuHelpActionType>();
     74template<> bool canConvert<RenderMode>();
    7475template<> bool canConvert<UIVisualStateType>();
    7576template<> bool canConvert<DetailsElementType>();
     
    128129template<> QString toInternalString(const RuntimeMenuHelpActionType &runtimeMenuHelpActionType);
    129130template<> RuntimeMenuHelpActionType fromInternalString<RuntimeMenuHelpActionType>(const QString &strRuntimeMenuHelpActionType);
     131template<> QString toInternalString(const RenderMode &renderMode);
     132template<> RenderMode fromInternalString<RenderMode>(const QString &strRenderMode);
    130133template<> QString toInternalString(const UIVisualStateType &visualStateType);
    131134template<> UIVisualStateType fromInternalString<UIVisualStateType>(const QString &strVisualStateType);
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r51398 r51401  
    4444#endif /* VBOX_WITH_DEBUGGER_GUI */
    4545template<> bool canConvert<RuntimeMenuHelpActionType>() { return true; }
     46template<> bool canConvert<RenderMode>() { return true; }
    4647template<> bool canConvert<UIVisualStateType>() { return true; }
    4748template<> bool canConvert<DetailsElementType>() { return true; }
     
    675676}
    676677
     678/* QString <= RenderMode: */
     679template<> QString toInternalString(const RenderMode &renderMode)
     680{
     681    QString strResult;
     682    switch (renderMode)
     683    {
     684        case RenderMode_QImage:   strResult = "QImage"; break;
     685#ifdef VBOX_GUI_USE_QUARTZ2D
     686        case RenderMode_Quartz2D: strResult = "Quartz2D"; break;
     687#endif /* VBOX_GUI_USE_QUARTZ2D */
     688        default:
     689        {
     690            AssertMsgFailed(("No text for render-mode=%d", renderMode));
     691            break;
     692        }
     693    }
     694    return strResult;
     695}
     696
     697/* RenderMode <= QString: */
     698template<> RenderMode fromInternalString<RenderMode>(const QString &strRenderMode)
     699{
     700    /* Here we have some fancy stuff allowing us
     701     * to search through the keys using 'case-insensitive' rule: */
     702    QStringList keys;   QList<RenderMode> values;
     703    keys << "QImage";   values << RenderMode_QImage;
     704#ifdef VBOX_GUI_USE_QUARTZ2D
     705    keys << "Quartz2D"; values << RenderMode_Quartz2D;
     706#endif /* VBOX_GUI_USE_QUARTZ2D */
     707    /* Invalid mode for unknown words: */
     708    if (!keys.contains(strRenderMode, Qt::CaseInsensitive))
     709        return RenderMode_Invalid;
     710    /* Corresponding mode for known words: */
     711    return values.at(keys.indexOf(QRegExp(strRenderMode, Qt::CaseInsensitive)));
     712}
     713
    677714/* QString <= UIVisualStateType: */
    678715template<> QString toInternalString(const UIVisualStateType &visualStateType)
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r51398 r51401  
    345345enum RenderMode
    346346{
    347       InvalidRenderMode
    348     , QImageMode
     347    RenderMode_Invalid,
     348    RenderMode_QImage,
    349349#ifdef VBOX_GUI_USE_QUARTZ2D
    350     , Quartz2DMode
     350    RenderMode_Quartz2D
    351351#endif /* VBOX_GUI_USE_QUARTZ2D */
    352352};
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r51363 r51401  
    303303}
    304304
     305RenderMode UIExtraDataManager::renderMode(const QString &strId) const
     306{
     307    RenderMode rm = gpConverter->fromInternalString<RenderMode>(extraDataString(GUI_RenderMode, strId));
     308    printf("RenderMode=%d\n", (int)rm);
     309    return rm;
     310}
     311
    305312bool UIExtraDataManager::isFirstRun(const QString &strId) const
    306313{
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r51363 r51401  
    130130    /** Defines @a mode (basic/expert) for wizard of @a type. */
    131131    void setModeForWizard(WizardType type, WizardMode mode);
     132
     133    /** Returns render-mode for machine with passed @a strId. */
     134    RenderMode renderMode(const QString &strId) const;
    132135
    133136    /** Returns whether this machine started for the first time. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r51322 r51401  
    178178// VBoxGlobal
    179179////////////////////////////////////////////////////////////////////////////////
    180 
    181 /** @internal
    182  *
    183  *  Determines the rendering mode from the argument. Sets the appropriate
    184  *  default rendering mode if the argument is NULL.
    185  */
    186 static RenderMode vboxGetRenderMode (const char *aModeStr)
    187 {
    188     RenderMode mode = InvalidRenderMode;
    189 
    190 #ifdef VBOX_GUI_USE_QIMAGE
    191     mode = QImageMode;
    192 #else /* !VBOX_GUI_USE_QIMAGE */
    193 # error "Cannot determine the default render mode!"
    194 #endif /* !VBOX_GUI_USE_QIMAGE */
    195 
    196     if (aModeStr)
    197     {
    198         if (0) ;
    199 #ifdef VBOX_GUI_USE_QIMAGE
    200         else if (::strcmp(aModeStr, "image") == 0)
    201             mode = QImageMode;
    202 #endif /* VBOX_GUI_USE_QIMAGE */
    203 #ifdef VBOX_GUI_USE_QUARTZ2D
    204         else if (::strcmp(aModeStr, "quartz2d") == 0)
    205             mode = Quartz2DMode;
    206 #endif /* VBOX_GUI_USE_QUARTZ2D */
    207     }
    208 
    209     return mode;
    210 }
    211180
    212181/* static */
     
    40554024    bool bForceFullscreen = false;
    40564025
    4057     vm_render_mode_str = RTStrDup (virtualBox()
    4058             .GetExtraData (GUI_RenderMode).toAscii().constData());
    4059 
    40604026#ifdef Q_WS_X11
    40614027    mIsKWinManaged = X11IsWindowManagerKWin();
     
    41124078        {
    41134079            ++i;
    4114         }
    4115         else if (!::strcmp (arg, "-rmode") || !::strcmp (arg, "--rmode"))
    4116         {
    4117             if (++i < argc)
    4118                 vm_render_mode_str = qApp->argv() [i];
    41194080        }
    41204081        else if (!::strcmp (arg, "--settingspw"))
     
    42844245    }
    42854246
    4286     vm_render_mode = vboxGetRenderMode (vm_render_mode_str);
    4287 
    42884247#ifdef VBOX_WITH_DEBUGGER_GUI
    42894248    /* setup the debugger gui. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r51187 r51401  
    3333#include "UIDefs.h"
    3434#include "UIMediumDefs.h"
    35 #include "UIExtraDataDefs.h"
    3635#include "VBoxGlobalSettings.h"
    3736
     
    127126    QList<QUrl> &argUrlList() { return m_ArgUrlList; }
    128127
    129     RenderMode vmRenderMode() const { return vm_render_mode; }
    130     const char *vmRenderModeStr() const { return vm_render_mode_str; }
    131128    bool isKWinManaged() const { return mIsKWinManaged; }
    132129
     
    438435    mutable QReadWriteLock m_mediumEnumeratorDtorRwLock;
    439436
    440     RenderMode vm_render_mode;
    441     const char * vm_render_mode_str;
    442437    bool mIsKWinManaged;
    443438
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r51398 r51401  
    2020/* Local includes: */
    2121#include "UIActionPoolRuntime.h"
     22#include "UIExtraDataDefs.h"
    2223#include "UIShortcutPool.h"
    2324#include "VBoxGlobal.h"
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r51149 r51401  
    4949#include "UIMachineViewSeamless.h"
    5050#include "UIMachineViewScale.h"
     51#include "UIExtraDataManager.h"
    5152
    5253#ifdef VBOX_WITH_DRAG_AND_DROP
     
    410411{
    411412    /* Prepare frame-buffer depending on render-mode: */
    412     switch (vboxGlobal().vmRenderMode())
     413    RenderMode rm = gEDataManager->renderMode(vboxGlobal().managedVMUuid());
     414    switch (rm)
    413415    {
    414416#ifdef VBOX_GUI_USE_QIMAGE
    415         case QImageMode:
     417        case RenderMode_QImage:
    416418        {
    417419            UIFrameBuffer *pFrameBuffer = uisession()->frameBuffer(screenId());
     
    448450
    449451#ifdef VBOX_GUI_USE_QUARTZ2D
    450         case Quartz2DMode:
     452        case RenderMode_Quartz2D:
    451453        {
    452454            /* Indicate that we are doing all drawing stuff ourself: */
     
    484486
    485487        default:
    486             AssertReleaseMsgFailed(("Render mode must be valid: %d\n", vboxGlobal().vmRenderMode()));
    487             LogRel(("Invalid render mode: %d\n", vboxGlobal().vmRenderMode()));
     488            AssertReleaseMsgFailed(("Render mode must be valid: %d\n", rm));
     489            LogRel(("Invalid render mode: %d\n", rm));
    488490            qApp->exit(1);
    489491            break;
     
    904906    {
    905907# ifdef VBOX_GUI_USE_QUARTZ2D
    906         if (vboxGlobal().vmRenderMode() == Quartz2DMode)
     908        if (gEDataManager->renderMode(vboxGlobal().managedVMUuid()) == RenderMode_Quartz2D)
    907909        {
    908910            /* If the render mode is Quartz2D we could use the CGImageRef
     
    10781080
    10791081#ifdef VBOX_GUI_USE_QUARTZ2D
    1080     if (vboxGlobal().vmRenderMode() == Quartz2DMode && m_pFrameBuffer)
     1082    if (gEDataManager->renderMode(vboxGlobal().managedVMUuid()) == RenderMode_Quartz2D && m_pFrameBuffer)
    10811083    {
    10821084        m_pFrameBuffer->paintEvent(pPaintEvent);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp

    r51390 r51401  
    2020/* Local includes: */
    2121#include "UIActionPoolSelector.h"
     22#include "UIExtraDataDefs.h"
    2223#include "UIShortcutPool.h"
    2324#include "UIDefs.h"
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp

    r50924 r51401  
    2727#include "UIGMachinePreview.h"
    2828#include "UIVirtualBoxEventHandler.h"
     29#include "UIExtraDataDefs.h"
    2930#include "UIImageTools.h"
    3031#include "VBoxGlobal.h"
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp

    r50553 r51401  
    2727/* GUI includes: */
    2828#include "UIHostComboEditor.h"
     29#include "UIExtraDataDefs.h"
     30#include "UIIconPool.h"
     31#include "QIToolButton.h"
    2932#include "VBoxGlobal.h"
    30 #include "QIToolButton.h"
    31 #include "UIIconPool.h"
    3233
    3334#ifdef Q_WS_WIN
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