VirtualBox

Ignore:
Timestamp:
Jun 19, 2014 2:07:14 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
94434
Message:

FE/Qt: 6660: Advanced extra-data management framework: Integrate GUI_Dbg_Enabled, GUI_Dbg_AutoShow.

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

Legend:

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

    r51665 r51666  
    510510}
    511511
     512#ifdef VBOX_WITH_DEBUGGER_GUI
     513QString UIExtraDataManager::debugFlagValue(const QString &strDebugFlagKey) const
     514{
     515    return extraDataString(strDebugFlagKey).toLower().trimmed();
     516}
     517#endif /* VBOX_WITH_DEBUGGER_GUI */
     518
    512519QRect UIExtraDataManager::machineWindowGeometry(UIVisualStateType visualStateType, ulong uScreenIndex, const QString &strId) const
    513520{
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r51665 r51666  
    173173    /** Defines selector-window preview update @a interval. */
    174174    void setSelectorWindowPreviewUpdateInterval(PreviewUpdateIntervalType interval);
     175
     176#ifdef VBOX_WITH_DEBUGGER_GUI
     177    /** Returns debug flag value for passed @a strDebugFlagKey. */
     178    QString debugFlagValue(const QString &strDebugFlagKey) const;
     179#endif /* VBOX_WITH_DEBUGGER_GUI */
    175180
    176181    /** Returns geometry for machine-window with @a uScreenIndex in @a visualStateType. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r51579 r51666  
    38493849#ifdef VBOX_WITH_DEBUGGER_GUI
    38503850
    3851 bool VBoxGlobal::isDebuggerEnabled(CMachine &aMachine)
    3852 {
    3853     return isDebuggerWorker(&mDbgEnabled, aMachine, GUI_Dbg_Enabled);
    3854 }
    3855 
    3856 bool VBoxGlobal::isDebuggerAutoShowEnabled(CMachine &aMachine)
    3857 {
    3858     return isDebuggerWorker(&mDbgAutoShow, aMachine, GUI_Dbg_AutoShow);
    3859 }
    3860 
    3861 bool VBoxGlobal::isDebuggerAutoShowCommandLineEnabled(CMachine &aMachine)
    3862 {
    3863     return isDebuggerWorker(&mDbgAutoShowCommandLine, aMachine, GUI_Dbg_AutoShow);
    3864 }
    3865 
    3866 bool VBoxGlobal::isDebuggerAutoShowStatisticsEnabled(CMachine &aMachine)
    3867 {
    3868     return isDebuggerWorker(&mDbgAutoShowStatistics, aMachine, GUI_Dbg_AutoShow);
     3851bool VBoxGlobal::isDebuggerEnabled() const
     3852{
     3853    return isDebuggerWorker(&m_fDbgEnabled, GUI_Dbg_Enabled);
     3854}
     3855
     3856bool VBoxGlobal::isDebuggerAutoShowEnabled() const
     3857{
     3858    return isDebuggerWorker(&m_fDbgAutoShow, GUI_Dbg_AutoShow);
     3859}
     3860
     3861bool VBoxGlobal::isDebuggerAutoShowCommandLineEnabled() const
     3862{
     3863    return isDebuggerWorker(&m_fDbgAutoShowCommandLine, GUI_Dbg_AutoShow);
     3864}
     3865
     3866bool VBoxGlobal::isDebuggerAutoShowStatisticsEnabled() const
     3867{
     3868    return isDebuggerWorker(&m_fDbgAutoShowStatistics, GUI_Dbg_AutoShow);
    38693869}
    38703870
     
    40254025#ifdef VBOX_WITH_DEBUGGER_GUI
    40264026# ifdef VBOX_WITH_DEBUGGER_GUI_MENU
    4027     initDebuggerVar(&mDbgEnabled, "VBOX_GUI_DBG_ENABLED", GUI_Dbg_Enabled, true);
     4027    initDebuggerVar(&m_fDbgEnabled, "VBOX_GUI_DBG_ENABLED", GUI_Dbg_Enabled, true);
    40284028# else
    4029     initDebuggerVar(&mDbgEnabled, "VBOX_GUI_DBG_ENABLED", GUI_Dbg_Enabled, false);
     4029    initDebuggerVar(&m_fDbgEnabled, "VBOX_GUI_DBG_ENABLED", GUI_Dbg_Enabled, false);
    40304030# endif
    4031     initDebuggerVar(&mDbgAutoShow, "VBOX_GUI_DBG_AUTO_SHOW", GUI_Dbg_AutoShow, false);
    4032     mDbgAutoShowCommandLine = mDbgAutoShowStatistics = mDbgAutoShow;
     4031    initDebuggerVar(&m_fDbgAutoShow, "VBOX_GUI_DBG_AUTO_SHOW", GUI_Dbg_AutoShow, false);
     4032    m_fDbgAutoShowCommandLine = m_fDbgAutoShowStatistics = m_fDbgAutoShow;
    40334033    mStartPaused = false;
    40344034#endif
     
    41474147#ifdef VBOX_WITH_DEBUGGER_GUI
    41484148        else if (!::strcmp(arg, "-dbg") || !::strcmp (arg, "--dbg"))
    4149             setDebuggerVar(&mDbgEnabled, true);
     4149            setDebuggerVar(&m_fDbgEnabled, true);
    41504150        else if (!::strcmp( arg, "-debug") || !::strcmp (arg, "--debug"))
    41514151        {
    4152             setDebuggerVar(&mDbgEnabled, true);
    4153             setDebuggerVar(&mDbgAutoShow, true);
    4154             setDebuggerVar(&mDbgAutoShowCommandLine, true);
    4155             setDebuggerVar(&mDbgAutoShowStatistics, true);
     4152            setDebuggerVar(&m_fDbgEnabled, true);
     4153            setDebuggerVar(&m_fDbgAutoShow, true);
     4154            setDebuggerVar(&m_fDbgAutoShowCommandLine, true);
     4155            setDebuggerVar(&m_fDbgAutoShowStatistics, true);
    41564156            mStartPaused = true;
    41574157        }
    41584158        else if (!::strcmp(arg, "--debug-command-line"))
    41594159        {
    4160             setDebuggerVar(&mDbgEnabled, true);
    4161             setDebuggerVar(&mDbgAutoShow, true);
    4162             setDebuggerVar(&mDbgAutoShowCommandLine, true);
     4160            setDebuggerVar(&m_fDbgEnabled, true);
     4161            setDebuggerVar(&m_fDbgAutoShow, true);
     4162            setDebuggerVar(&m_fDbgAutoShowCommandLine, true);
    41634163            mStartPaused = true;
    41644164        }
    41654165        else if (!::strcmp(arg, "--debug-statistics"))
    41664166        {
    4167             setDebuggerVar(&mDbgEnabled, true);
    4168             setDebuggerVar(&mDbgAutoShow, true);
    4169             setDebuggerVar(&mDbgAutoShowStatistics, true);
     4167            setDebuggerVar(&m_fDbgEnabled, true);
     4168            setDebuggerVar(&m_fDbgAutoShow, true);
     4169            setDebuggerVar(&m_fDbgAutoShowStatistics, true);
    41704170            mStartPaused = true;
    41714171        }
    41724172        else if (!::strcmp(arg, "-no-debug") || !::strcmp(arg, "--no-debug"))
    41734173        {
    4174             setDebuggerVar(&mDbgEnabled, false);
    4175             setDebuggerVar(&mDbgAutoShow, false);
    4176             setDebuggerVar(&mDbgAutoShowCommandLine, false);
    4177             setDebuggerVar(&mDbgAutoShowStatistics, false);
     4174            setDebuggerVar(&m_fDbgEnabled, false);
     4175            setDebuggerVar(&m_fDbgAutoShow, false);
     4176            setDebuggerVar(&m_fDbgAutoShowCommandLine, false);
     4177            setDebuggerVar(&m_fDbgAutoShowStatistics, false);
    41784178        }
    41794179        /* Not quite debug options, but they're only useful with the debugger bits. */
     
    42414241    /* setup the debugger gui. */
    42424242    if (RTEnvExist("VBOX_GUI_NO_DEBUGGER"))
    4243         mDbgEnabled = mDbgAutoShow =  mDbgAutoShowCommandLine = mDbgAutoShowStatistics = false;
    4244     if (mDbgEnabled)
     4243        m_fDbgEnabled = m_fDbgAutoShow =  m_fDbgAutoShowCommandLine = m_fDbgAutoShowStatistics = false;
     4244    if (m_fDbgEnabled)
    42454245    {
    42464246        RTERRINFOSTATIC ErrInfo;
    42474247        RTErrInfoInitStatic(&ErrInfo);
    4248         int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &mhVBoxDbg, RTLDRLOAD_FLAGS_LOCAL, &ErrInfo.Core);
     4248        int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &m_hVBoxDbg, RTLDRLOAD_FLAGS_LOCAL, &ErrInfo.Core);
    42494249        if (RT_FAILURE(vrc))
    42504250        {
    4251             mhVBoxDbg = NIL_RTLDRMOD;
    4252             mDbgAutoShow =  mDbgAutoShowCommandLine = mDbgAutoShowStatistics = false;
     4251            m_hVBoxDbg = NIL_RTLDRMOD;
     4252            m_fDbgAutoShow =  m_fDbgAutoShowCommandLine = m_fDbgAutoShowStatistics = false;
    42534253            LogRel(("Failed to load VBoxDbg, rc=%Rrc - %s\n", vrc, ErrInfo.Core.pszMsg));
    42544254        }
     
    44704470 * @returns true / false.
    44714471 * @param   piDbgCfgVar         The debugger config variable to consult.
    4472  * @param   rMachine            Reference to the machine object.
    44734472 * @param   pszExtraDataName    The extra data name relating to this variable.
    44744473 */
    4475 bool VBoxGlobal::isDebuggerWorker(int *piDbgCfgVar, CMachine &rMachine, const char *pszExtraDataName)
    4476 {
    4477     if (!(*piDbgCfgVar & VBOXGLOBAL_DBG_CFG_VAR_DONE) && !rMachine.isNull())
    4478     {
    4479         QString str = mVBox.GetExtraData(pszExtraDataName).toLower().trimmed();
     4474bool VBoxGlobal::isDebuggerWorker(int *piDbgCfgVar, const char *pszExtraDataName) const
     4475{
     4476    if (!(*piDbgCfgVar & VBOXGLOBAL_DBG_CFG_VAR_DONE))
     4477    {
     4478        const QString str = gEDataManager->debugFlagValue(pszExtraDataName);
    44804479        if (str.contains("veto"))
    44814480            *piDbgCfgVar = VBOXGLOBAL_DBG_CFG_VAR_DONE | VBOXGLOBAL_DBG_CFG_VAR_FALSE;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r51579 r51666  
    140140
    141141#ifdef VBOX_WITH_DEBUGGER_GUI
    142     bool isDebuggerEnabled(CMachine &aMachine);
    143     bool isDebuggerAutoShowEnabled(CMachine &aMachine);
    144     bool isDebuggerAutoShowCommandLineEnabled(CMachine &aMachine);
    145     bool isDebuggerAutoShowStatisticsEnabled(CMachine &aMachine);
    146     RTLDRMOD getDebuggerModule() const { return mhVBoxDbg; }
     142    bool isDebuggerEnabled() const;
     143    bool isDebuggerAutoShowEnabled() const;
     144    bool isDebuggerAutoShowCommandLineEnabled() const;
     145    bool isDebuggerAutoShowStatisticsEnabled() const;
     146
     147    RTLDRMOD getDebuggerModule() const { return m_hVBoxDbg; }
    147148
    148149    bool isStartPausedEnabled() const { return mStartPaused; }
    149 #else
    150     bool isDebuggerAutoShowEnabled(CMachine & /*aMachine*/) const { return false; }
    151     bool isDebuggerAutoShowCommandLineEnabled(CMachine & /*aMachine*/) const { return false; }
    152     bool isDebuggerAutoShowStatisticsEnabled(CMachine & /*aMachine*/) const { return false; }
    153 
    154     bool isStartPausedEnabled() const { return false; }
    155 #endif
     150#endif /* VBOX_WITH_DEBUGGER_GUI */
    156151
    157152    /* VBox enum to/from string/icon/color convertors */
     
    407402    void initDebuggerVar(int *piDbgCfgVar, const char *pszEnvVar, const char *pszExtraDataName, bool fDefault = false);
    408403    void setDebuggerVar(int *piDbgCfgVar, bool fState);
    409     bool isDebuggerWorker(int *piDbgCfgVar, CMachine &rMachine, const char *pszExtraDataName);
     404    bool isDebuggerWorker(int *piDbgCfgVar, const char *pszExtraDataName) const;
    410405#endif
    411406
     
    451446#ifdef VBOX_WITH_DEBUGGER_GUI
    452447    /** Whether the debugger should be accessible or not.
    453      * Use --dbg, the env.var. VBOX_GUI_DBG_ENABLED, --debug or the env.var.
    454      * VBOX_GUI_DBG_AUTO_SHOW to enable. */
    455     int mDbgEnabled;
     448     * Use --dbg, the env.var. VBOX_GUI_DBG_ENABLED,
     449     *     --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */
     450    mutable int m_fDbgEnabled;
    456451    /** Whether to show the debugger automatically with the console.
    457452     * Use --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */
    458     int mDbgAutoShow;
    459     /** Whether to show the command line window when mDbgAutoShow is set. */
    460     int mDbgAutoShowCommandLine;
    461     /** Whether to show the statistics window when mDbgAutoShow is set. */
    462     int mDbgAutoShowStatistics;
     453    mutable int m_fDbgAutoShow;
     454    /** Whether to show the command line window when m_fDbgAutoShow is set. */
     455    mutable int m_fDbgAutoShowCommandLine;
     456    /** Whether to show the statistics window when m_fDbgAutoShow is set. */
     457    mutable int m_fDbgAutoShowStatistics;
    463458    /** VBoxDbg module handle. */
    464     RTLDRMOD mhVBoxDbg;
     459    RTLDRMOD m_hVBoxDbg;
    465460
    466461    /** Whether to start the VM in paused state or not. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r51596 r51666  
    10471047void UIMachineLogic::prepareDebugger()
    10481048{
    1049     CMachine machine = uisession()->session().GetMachine();
    1050     if (!machine.isNull() && vboxGlobal().isDebuggerAutoShowEnabled(machine))
    1051     {
    1052         /* console in upper left corner of the desktop. */
    1053 //        QRect rct (0, 0, 0, 0);
    1054 //        QDesktopWidget *desktop = QApplication::desktop();
    1055 //        if (desktop)
    1056 //            rct = desktop->availableGeometry(pos());
    1057 //        move (QPoint (rct.x(), rct.y()));
    1058 
    1059         if (vboxGlobal().isDebuggerAutoShowStatisticsEnabled(machine))
     1049    if (vboxGlobal().isDebuggerAutoShowEnabled())
     1050    {
     1051        if (vboxGlobal().isDebuggerAutoShowStatisticsEnabled())
    10601052            sltShowDebugStatistics();
    1061         if (vboxGlobal().isDebuggerAutoShowCommandLineEnabled(machine))
     1053        if (vboxGlobal().isDebuggerAutoShowCommandLineEnabled())
    10621054            sltShowDebugCommandLine();
    10631055
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp

    r51565 r51666  
    177177    if (fOptions & RuntimeMenuType_Debug)
    178178    {
    179         CMachine machine = m_pSession->session().GetMachine();
    180         if (vboxGlobal().isDebuggerEnabled(machine))
     179        if (vboxGlobal().isDebuggerEnabled())
    181180        {
    182181            QMenu *pMenuDebug = gActionPool->action(UIActionIndexRuntime_Menu_Debug)->menu();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r51592 r51666  
    565565    if (m_sizeHintOverride.isValid())
    566566        return m_sizeHintOverride;
    567 #ifdef VBOX_WITH_DEBUGGER
     567#ifdef VBOX_WITH_DEBUGGER_GUI
    568568    // TODO: Fix all DEBUGGER stuff!
    569569    /* HACK ALERT! Really ugly workaround for the resizing to 9x1 done by DevVGA if provoked before power on. */
    570570    QSize fb(m_pFrameBuffer->width(), m_pFrameBuffer->height());
    571571    if (fb.width() < 16 || fb.height() < 16)
    572     {
    573         CMachine machine = uisession()->session().GetMachine();
    574         if (   vboxGlobal().isStartPausedEnabled()
    575             || vboxGlobal().isDebuggerAutoShowEnabled(machine))
    576         fb = QSize(640, 480);
    577     }
     572        if (vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled())
     573            fb = QSize(640, 480);
    578574    return QSize(fb.width() + frameWidth() * 2, fb.height() + frameWidth() * 2);
    579 #else /* VBOX_WITH_DEBUGGER */
     575#else /* !VBOX_WITH_DEBUGGER_GUI */
    580576    return QSize(m_pFrameBuffer->width() + frameWidth() * 2, m_pFrameBuffer->height() + frameWidth() * 2);
    581 #endif /* !VBOX_WITH_DEBUGGER */
     577#endif /* !VBOX_WITH_DEBUGGER_GUI */
    582578}
    583579
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r51593 r51666  
    257257
    258258    /* Power UP machine: */
    259     CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled(machine) ?
     259#ifdef VBOX_WITH_DEBUGGER_GUI
     260    CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled() ?
    260261                         console.PowerUpPaused() : console.PowerUp();
     262#else /* !VBOX_WITH_DEBUGGER_GUI */
     263    CProgress progress = console.PowerUp();
     264#endif /* !VBOX_WITH_DEBUGGER_GUI */
    261265
    262266    /* Check for immediate failure: */
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