VirtualBox

Changeset 65521 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 30, 2017 5:54:29 PM (8 years ago)
Author:
vboxsync
Message:

Debugger: make font + color scheme setting persistent

Location:
trunk/src/VBox/Debugger
Files:
3 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 */
  • trunk/src/VBox/Debugger/VBoxDbgConsole.h

    r65066 r65521  
    3030#include <iprt/thread.h>
    3131
     32class IVirtualBox;
    3233
    3334class VBoxDbgConsoleOutput : public QTextEdit
     
    4243     * @param   pszName     Widget name.
    4344     */
    44     VBoxDbgConsoleOutput(QWidget *pParent = NULL, const char *pszName = NULL);
     45    VBoxDbgConsoleOutput(QWidget *pParent = NULL, IVirtualBox *pVirtualBox = NULL, const char *pszName = NULL);
    4546
    4647    /**
     
    9091    /** The current color scheme (foreground on background). */
    9192    VBoxDbgConsoleColor m_enmColorScheme;
     93    /** The IVirtualBox object */
     94    IVirtualBox *m_pVirtualBox;
    9295
    9396private slots:
     
    180183     * @param   a_pParent       Parent Widget.
    181184     */
    182     VBoxDbgConsole(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent = NULL);
     185    VBoxDbgConsole(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent = NULL, IVirtualBox *a_pVirtualBox = NULL);
    183186
    184187    /**
  • trunk/src/VBox/Debugger/VBoxDbgGui.cpp

    r62480 r65521  
    196196    if (!m_pDbgConsole)
    197197    {
    198         m_pDbgConsole = new VBoxDbgConsole(this, m_pParent);
     198        IVirtualBox *pVirtualBox = NULL;
     199        m_pMachine->COMGETTER(Parent)(&pVirtualBox);
     200        m_pDbgConsole = new VBoxDbgConsole(this, m_pParent, pVirtualBox);
    199201        connect(m_pDbgConsole, SIGNAL(destroyed(QObject *)), this, SLOT(notifyChildDestroyed(QObject *)));
    200202        repositionConsole();
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