VirtualBox

Ignore:
Timestamp:
Jan 30, 2017 5:54:29 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113158
Message:

Debugger: make font + color scheme setting persistent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/VBoxDbgConsole.cpp

    r64721 r65521  
    4444#include <iprt/string.h>
    4545
     46#include <VBox/com/string.h>
     47#ifdef VBOX_WITH_XPCOM
     48# include <VirtualBox_XPCOM.h>
     49#else
     50# include <VirtualBox.h>
     51#endif
    4652
    4753
     
    5763
    5864
    59 VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, const char *pszName/* = NULL*/)
    60     : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf())
     65VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, IVirtualBox *a_pVirtualBox /* = NULL */,
     66                                           const char *pszName/* = NULL*/)
     67    : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf()), m_pVirtualBox(a_pVirtualBox)
    6168{
    6269    setReadOnly(true);
     
    112119     * Set the defaults (which syncs with the menu item checked state).
    113120     */
    114     setFontCourier();
    115     setColorGreenOnBlack();
     121
     122    if (m_pVirtualBox)
     123    {
     124        com::Bstr strColor;
     125        HRESULT hrc = m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/ColorScheme").raw(), strColor.asOutParam());
     126        if (  SUCCEEDED(hrc)
     127            && strColor.compareUtf8("blackonwhite", com::Bstr::CaseInsensitive) == 0)
     128            setColorBlackOnWhite();
     129        else
     130            setColorGreenOnBlack();
     131        com::Bstr strFont;
     132        hrc = m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/Font").raw(), strFont.asOutParam());
     133        if (  SUCCEEDED(hrc)
     134            && strFont.compareUtf8("monospace", com::Bstr::CaseInsensitive) == 0)
     135            setFontMonospace();
     136        else
     137            setFontCourier();
     138    }
    116139
    117140    NOREF(pszName);
     
    122145{
    123146    Assert(m_hGUIThread == RTThreadNativeSelf());
     147    if (m_pVirtualBox)
     148    {
     149        m_pVirtualBox->Release();
     150        m_pVirtualBox = NULL;
     151    }
    124152}
    125153
     
    155183    if (!m_pGreenOnBlackAction->isChecked())
    156184        m_pGreenOnBlackAction->setChecked(true);
     185   
     186    /* Make this setting persistent */
     187    if (m_pVirtualBox)
     188        m_pVirtualBox->SetExtraData(com::Bstr("DbgConsole/ColorScheme").raw(), com::Bstr("GreenOnBlack").raw());
    157189}
    158190
     
    166198    if (!m_pBlackOnWhiteAction->isChecked())
    167199        m_pBlackOnWhiteAction->setChecked(true);
     200
     201    /* Make this setting persistent */
     202    if (m_pVirtualBox)
     203        m_pVirtualBox->SetExtraData(com::Bstr("DbgConsole/ColorScheme").raw(), com::Bstr("BlackOnWhite").raw());
    168204}
    169205
     
    184220    if (!m_pCourierFontAction->isChecked())
    185221        m_pCourierFontAction->setChecked(true);
     222   
     223    /* Make this setting persistent */
     224    if (m_pVirtualBox)
     225        m_pVirtualBox->SetExtraData(com::Bstr("DbgConsole/Font").raw(), com::Bstr("Courier").raw());
    186226}
    187227
     
    198238    if (!m_pMonospaceFontAction->isChecked())
    199239        m_pMonospaceFontAction->setChecked(true);
     240
     241    /* Make this setting persistent */
     242    if (m_pVirtualBox)
     243        m_pVirtualBox->SetExtraData(com::Bstr("DbgConsole/Font").raw(), com::Bstr("Monospace").raw());
    200244}
    201245
     
    353397
    354398
    355 VBoxDbgConsole::VBoxDbgConsole(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent/* = NULL*/)
     399VBoxDbgConsole::VBoxDbgConsole(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent/* = NULL*/, IVirtualBox *a_pVirtualBox/* = NULL */)
    356400    : VBoxDbgBaseWindow(a_pDbgGui, a_pParent), m_pOutput(NULL), m_pInput(NULL), m_fInputRestoreFocus(false),
    357401    m_pszInputBuf(NULL), m_cbInputBuf(0), m_cbInputBufAlloc(0),
     
    365409     * Create the output text box.
    366410     */
    367     m_pOutput = new VBoxDbgConsoleOutput(this);
     411    m_pOutput = new VBoxDbgConsoleOutput(this, a_pVirtualBox);
    368412
    369413    /* try figure a suitable size */
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