VirtualBox

Changeset 12180 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 6, 2008 6:31:18 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
36146
Message:

Debugger GUI: Qt4 port in progress.

Location:
trunk/src/VBox/Debugger
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/Makefile.kmk

    r12175 r12180  
    8181
    8282#
    83 # Debugger GUI component.
     83# Debugger GUI component (Qt3).
    8484#
     85VBoxDbg3_TEMPLATE = VBOXQTGUI
    8586USES += qt3
    86 VBoxDbg3_TEMPLATE = VBOXQTGUI
    8787VBoxDbg3_USES = qt3
    8888VBoxDbg3_QTTOOL = QT3
     
    107107
    108108#
    109 # The VBoxDbg3 testcase.
     109# Debugger GUI component (Qt4).
     110#
     111DLLS += VBoxDbg
     112VBoxDbg_TEMPLATE = VBOXQT4GUI
     113VBoxDbg_DEFS = IN_DBG_R3 VBOXDBG_USE_QT4
     114VBoxDbg_INCS = .
     115VBoxDbg_QT_MODULES = Core Gui
     116VBoxDbg_QT_MOCHDRS = \
     117        VBoxDbgGui.h \
     118        VBoxDbgConsole.h
     119#       VBoxDbgStats.h
     120VBoxDbg_SOURCES = \
     121        VBoxDbg.cpp \
     122        VBoxDbgGui.cpp \
     123        VBoxDbgBase.cpp \
     124        VBoxDbgConsole.cpp
     125#       VBoxDbgStats.cpp
     126VBoxDbg_LIBS = \
     127        $(LIB_VMM)
     128VBoxDbg_LDFLAGS.darwin = \
     129        -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxDbg.dylib
     130
     131
     132#
     133# The VBoxDbg testcase (Qt3).
    110134#
    111135tstVBoxDbg3_TEMPLATE     = VBOXQTGUIEXE
     
    118142ifeq ($(KBUILD_TARGET),win)
    119143tstVBoxDbg3_LIBS        += \
    120         $(PATH_LIB)/VBoxDbg3.lib
     144        $(PATH_LIB)/VBoxDbg.lib
    121145else
    122146tstVBoxDbg3_LIBS        += \
    123         $(PATH_BIN)/VBoxDbg3$(VBOX_SUFF_DLL)
     147        $(PATH_BIN)/VBoxDbg$(VBOX_SUFF_DLL)
     148endif
     149
     150#
     151# The VBoxDbg testcase (Qt4).
     152#
     153#PROGRAMS += tstVBoxDbg
     154tstVBoxDbg_TEMPLATE     = VBOXQTGUI4EXE
     155tstVBoxDbg_USES         = qt4
     156tstVBoxDbg_QTTOOL       = QT4
     157tstVBoxDbg_QT_MODULES   = Core Gui
     158tstVBoxDbg_SOURCES      = testcase/tstVBoxDbg.cpp
     159tstVBoxDbg_LIBS         = \
     160        $(LIB_VMM) \
     161        $(LIB_RUNTIME)
     162ifeq ($(KBUILD_TARGET),win)
     163tstVBoxDbg_LIBS        += \
     164        $(PATH_LIB)/VBoxDbg.lib
     165else
     166tstVBoxDbg_LIBS        += \
     167        $(PATH_BIN)/VBoxDbg$(VBOX_SUFF_DLL)
    124168endif
    125169
  • trunk/src/VBox/Debugger/VBoxDbgConsole.cpp

    r9268 r12180  
    2626#include "VBoxDbgConsole.h"
    2727
    28 #include <qlabel.h>
    29 #include <qapplication.h>
    30 #include <qfont.h>
    31 #include <qtextview.h>
    32 #include <qlineedit.h>
     28#ifdef VBOXDBG_USE_QT4
     29# include <QLabel>
     30# include <QApplication>
     31# include <QFont>
     32# include <QLineEdit>
     33# include <QHBoxLayout>
     34#else
     35# include <qlabel.h>
     36# include <qapplication.h>
     37# include <qfont.h>
     38# include <qtextview.h>
     39# include <qlineedit.h>
     40#endif
    3341
    3442#include <VBox/dbg.h>
     
    5866
    5967VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, const char *pszName/* = NULL*/)
    60     : QTextEdit(pParent, pszName), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf())
     68#ifdef VBOXDBG_USE_QT4
     69    : QTextEdit(pParent),
     70#else
     71    : QTextEdit(pParent, pszName),
     72#endif
     73      m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf())
    6174{
    6275    setReadOnly(true);
    6376    setUndoRedoEnabled(false);
    6477    setOverwriteMode(true);
     78#ifdef VBOXDBG_USE_QT4
     79    setPlainText("");
     80#else
    6581    setTextFormat(PlainText);   /* minimal HTML: setTextFormat(LogText); */
     82#endif
    6683
    6784#ifdef Q_WS_MAC
     
    7693
    7794    /* green on black */
     95#ifdef VBOXDBG_USE_QT4
     96    QPalette Pal(palette());
     97    Pal.setColor(QPalette::Active, QPalette::Base, QColor(Qt::black));
     98    setPalette(Pal);
     99    setTextColor(QColor(qRgb(0, 0xe0, 0)));
     100#else
    78101    setPaper(QBrush(Qt::black));
    79102    setColor(QColor(qRgb(0, 0xe0, 0)));
     103#endif
     104    NOREF(pszName);
    80105}
    81106
     
    99124    while (iPos < cch)
    100125    {
     126#ifdef VBOXDBG_USE_QT4
     127        int iPosNL = rStr.indexOf('\n', iPos);
     128#else
    101129        int iPosNL = rStr.find('\n', iPos);
     130#endif
    102131        int iPosEnd = iPosNL >= 0 ? iPosNL : cch;
    103132        if ((unsigned)iPosNL != iPos)
     
    107136                append(Str);
    108137            else
     138#ifdef VBOXDBG_USE_QT4
     139                insertPlainText(Str);
     140#else
    109141                insertAt(Str, m_uCurLine, m_uCurPos);
     142#endif
    110143            if (iPosNL >= 0)
    111144            {
     
    140173
    141174VBoxDbgConsoleInput::VBoxDbgConsoleInput(QWidget *pParent/* = NULL*/, const char *pszName/* = NULL*/)
    142     : QComboBox(true, pParent, pszName), m_iBlankItem(0), m_hGUIThread(RTThreadNativeSelf())
    143 {
     175#ifdef VBOXDBG_USE_QT4
     176    : QComboBox(pParent),
     177#else
     178    : QComboBox(true, pParent, pszName),
     179#endif
     180      m_iBlankItem(0), m_hGUIThread(RTThreadNativeSelf())
     181{
     182#ifdef VBOXDBG_USE_QT4
     183    insertItem(m_iBlankItem, "");
     184    setEditable(true);
     185    setInsertPolicy(NoInsert);
     186#else
    144187    insertItem("", m_iBlankItem);
    145188    setInsertionPolicy(NoInsertion);
     189#endif
    146190    setMaxCount(50);
    147191    const QLineEdit *pEdit = lineEdit();
    148192    if (pEdit)
    149193        connect(pEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
     194
     195    NOREF(pszName);
    150196}
    151197
     
    171217
    172218    /* update the history and clear the entry field */
     219#ifdef VBOXDBG_USE_QT4
     220    if (itemText(m_iBlankItem - 1) != Str)
     221    {
     222        setItemText(m_iBlankItem, Str);
     223        removeItem(m_iBlankItem - maxCount() - 1);
     224        insertItem(++m_iBlankItem, "");
     225    }
     226
     227    clearEditText();
     228    setCurrentIndex(m_iBlankItem);
     229#else
    173230    if (text(m_iBlankItem - 1) != Str)
    174231    {
     
    180237    clearEdit();
    181238    setCurrentItem(m_iBlankItem);
     239#endif
    182240}
    183241
     
    203261    m_pTimer(NULL), m_fUpdatePending(false), m_Thread(NIL_RTTHREAD), m_EventSem(NIL_RTSEMEVENT), m_fTerminate(false)
    204262{
     263#ifdef VBOXDBG_USE_QT4
     264    setWindowTitle("VBoxDbg - Console");
     265#else
    205266    setCaption("VBoxDbg - Console");
     267#endif
    206268
    207269    NOREF(pszName);
     
    214276
    215277    /* try figure a suitable size */
    216     QLabel *pLabel = new QLabel(NULL, "11111111111111111111111111111111111111111111111111111111111111111111111111111112222222222", this);
     278#ifdef VBOXDBG_USE_QT4
     279    QLabel *pLabel = new QLabel(      "11111111111111111111111111111111111111111111111111111111111111111111111111111112222222222", this);
     280#else
     281    QLabel *pLabel = new QLabel(NULL, "11111111111111111111111111111111111111111111111111111111111111111111111111111112222222222", this); /// @todo
     282#endif
    217283    pLabel->setFont(m_pOutput->font());
    218284    QSize Size = pLabel->sizeHint();
     
    225291     * Create the input combo box (with a label).
    226292     */
     293#ifdef VBOXDBG_USE_QT4
     294    QHBoxLayout *pLayout = new QHBoxLayout();
     295    //pLayout->setSizeConstraint(QLayout::SetMaximumSize);
     296
     297    pLabel = new QLabel(" Command ");
     298    pLayout->addWidget(pLabel);
     299    pLabel->setMaximumSize(pLabel->sizeHint());
     300    pLabel->setAlignment(Qt::AlignCenter);
     301
     302    m_pInput = new VBoxDbgConsoleInput(NULL);
     303    pLayout->addWidget(m_pInput);
     304    m_pInput->setDuplicatesEnabled(false);
     305    connect(m_pInput, SIGNAL(commandSubmitted(const QString &)), this, SLOT(commandSubmitted(const QString &)));
     306
     307# if 0//def Q_WS_MAC
     308    pLabel = new QLabel("  ");
     309    pLayout->addWidget(pLabel);
     310    pLabel->setMaximumSize(20, m_pInput->sizeHint().height() + 6);
     311    pLabel->setMinimumSize(20, m_pInput->sizeHint().height() + 6);
     312# endif
     313
     314    QWidget *pHBox = new QWidget(this);
     315    pHBox->setLayout(pLayout);
     316
     317#else  /* QT3 */
    227318    QHBox *pHBox = new QHBox(this);
    228319
     
    235326    connect(m_pInput, SIGNAL(commandSubmitted(const QString &)), this, SLOT(commandSubmitted(const QString &)));
    236327
    237 #ifdef Q_WS_MAC
    238     pLabel = new QLabel(NULL, "  ", pHBox);
     328# ifdef Q_WS_MAC
     329    pLabel = new QLabel(NULL, "  ", pHBox); /// @todo
    239330    pLabel->setMaximumSize(20, m_pInput->sizeHint().height() + 6);
    240331    pLabel->setMinimumSize(20, m_pInput->sizeHint().height() + 6);
    241 #endif
     332# endif
     333#endif /* QT3 */
     334
     335#ifdef VBOXDBG_USE_QT4
     336    /*
     337     * Vertical layout box on the whole widget.
     338     */
     339    QVBoxLayout *pVLayout = new QVBoxLayout;
     340    pVLayout->setSpacing(5);
     341    pVLayout->setContentsMargins(0, 0, 0, 0);
     342    pVLayout->addWidget(m_pOutput);
     343    pVLayout->addWidget(pHBox);
     344    setLayout(pVLayout);
     345#endif
    242346
    243347    /*
     
    317421    RTSemEventSignal(m_EventSem);
    318422
     423#ifdef VBOXDBG_USE_QT4
     424    QByteArray Utf8Array = rCommand.toUtf8();
     425    const char *psz = Utf8Array.constData();
     426#else                               
    319427    const char *psz = rCommand;//.utf8();
     428#endif
    320429    size_t cb = strlen(psz);
    321430
     
    344453
    345454    m_pOutput->appendText(rCommand + "\n");
     455#ifdef VBOXDBG_USE_QT4
     456    m_pOutput->ensureCursorVisible();
     457#else
    346458    m_pOutput->scrollToBottom();
     459#endif
    347460
    348461    m_fInputRestoreFocus = m_pInput->hasFocus();    /* dirty focus hack */
     
    551664                {
    552665                    m_fUpdatePending = true;
     666#ifdef VBOXDBG_USE_QT4
     667                    m_pTimer->setSingleShot(true);
     668                    m_pTimer->start(10);
     669#else
    553670                    m_pTimer->start(10, true /* single shot */);
     671#endif
    554672                }
    555673                break;
     
    578696    }
    579697
     698#ifdef VBOXDBG_USE_QT4
     699    return QWidget::event(pGenEvent);
     700#else
    580701    return QVBox::event(pGenEvent);
    581 }
    582 
     702#endif
     703}
     704
  • trunk/src/VBox/Debugger/VBoxDbgConsole.h

    r9269 r12180  
    2525#include "VBoxDbgBase.h"
    2626
    27 #include <qtextedit.h>
    28 #include <qcombobox.h>
    29 #include <qvbox.h>
    30 #include <qtimer.h>
     27#ifdef VBOXDBG_USE_QT4
     28# include <QTextEdit>
     29# include <QComboBox>
     30# include <QTimer>
     31# include <QEvent>
     32#else
     33# include <qtextedit.h>
     34# include <qcombobox.h>
     35# include <qvbox.h>
     36# include <qtimer.h>
     37#endif
    3138
    3239#include <iprt/critsect.h>
     
    129136 * The Debugger Console.
    130137 */
    131 class VBoxDbgConsole : public QVBox, public VBoxDbgBase
     138class VBoxDbgConsole :
     139#ifdef VBOXDBG_USE_QT4
     140    public QWidget,
     141#else
     142    public QVBox,
     143#endif
     144    public VBoxDbgBase
    132145{
    133146    Q_OBJECT
  • trunk/src/VBox/Debugger/VBoxDbgGui.cpp

    r9269 r12180  
    2727
    2828#include "VBoxDbgGui.h"
    29 #include <qdesktopwidget.h>
    30 #include <qapplication.h>
     29#ifdef VBOXDBG_USE_QT4
     30# include <QDesktopWidget>
     31# include <QApplication>
     32#else
     33# include <qdesktopwidget.h>
     34# include <qapplication.h>
     35#endif
    3136
    3237
     
    8893{
    8994
     95#ifndef VBOXDBG_USE_QT4
    9096    if (m_pDbgStats)
    9197    {
     
    9399        m_pDbgStats = NULL;
    94100    }
     101#endif
    95102
    96103    if (m_pDbgConsole)
     
    130137int VBoxDbgGui::showStatistics()
    131138{
     139#ifndef VBOXDBG_USE_QT4
    132140    if (!m_pDbgStats)
    133141    {
     
    137145    }
    138146    m_pDbgStats->show();
     147#endif
    139148    return VINF_SUCCESS;
    140149}
     
    142151void VBoxDbgGui::repositionStatistics(bool fResize/* = true*/)
    143152{
     153#ifndef VBOXDBG_USE_QT4
    144154    if (m_pDbgStats)
    145155    {
     
    150160            resizeWidget(m_pDbgStats, m_cxDesktop - m_cx - m_x + m_xDesktop, m_cyDesktop - m_y + m_yDesktop);
    151161    }
     162#endif
    152163}
    153164
  • trunk/src/VBox/Debugger/VBoxDbgGui.h

    r9269 r12180  
    4242class VBoxDbgGui : public QObject
    4343{
    44     Q_OBJECT
     44    Q_OBJECT;
    4545
    4646public:
  • trunk/src/VBox/Debugger/VBoxDbgStats.h

    r9269 r12180  
    2626#include "VBoxDbgBase.h"
    2727
    28 #include <qlistview.h>
    29 #include <qvbox.h>
    30 #include <qtimer.h>
    31 #include <qcombobox.h>
    32 #include <qpopupmenu.h>
     28#ifdef VBOXDBG_USE_QT4
     29# include <QTreeWidget>
     30# include <QTimer>
     31# include <QComboBox>
     32# include <QMenu>
     33  typedef QMenu QPopupMenu;
     34  typedef QTreeWidget QListView;
     35  typedef QTreeWidgetItem QListViewItem;
     36#else
     37# include <qlistview.h>
     38# include <qvbox.h>
     39# include <qtimer.h>
     40# include <qcombobox.h>
     41# include <qpopupmenu.h>
     42#endif
    3343
    3444class VBoxDbgStats;
     
    108118    virtual QString key(int iColumn, bool fAscending) const
    109119    {
     120#ifdef VBOXDBG_USE_QT4
     121        /** @todo */ NOREF(iColumn); NOREF(fAscending);
     122        return "";
     123#else
    110124        return QListViewItem::key(iColumn, fAscending);
     125#endif
    111126    }
    112127
     
    238253class VBoxDbgStatsView : public QListView, public VBoxDbgBase
    239254{
    240     Q_OBJECT
     255    Q_OBJECT;
    241256
    242257public:
     258#ifdef VBOXDBG_USE_QT4
     259    /** @todo */
     260#else
    243261    /**
    244262     * Creates a VM statistics list view widget.
     
    250268     */
    251269    VBoxDbgStatsView(PVM pVM, VBoxDbgStats *pParent = NULL, const char *pszName = NULL, WFlags f = 0);
     270#endif
    252271
    253272    /** Destructor. */
     
    354373 * spinbutton, and the tree view with the statistics.
    355374 */
    356 class VBoxDbgStats : public QVBox, public VBoxDbgBase
     375class VBoxDbgStats :
     376#ifdef VBOXDBG_USE_QT4
     377    public QWidget,
     378#else
     379    public QVBox,
     380#endif
     381    public VBoxDbgBase
    357382{
    358     Q_OBJECT
     383    Q_OBJECT;
    359384
    360385public:
     386#ifdef VBOXDBG_USE_QT4
     387    /**
     388     * Creates a VM statistics list view widget.
     389     *
     390     * @param   pVM             The VM this is hooked up to.
     391     * @param   pszPat          Initial selection pattern. NULL means everything. (See STAM for details.)
     392     * @param   uRefreshRate    The refresh rate. 0 means not to refresh and is the default.
     393     * @param   pParent         Parent widget.
     394     */
     395    VBoxDbgStats(PVM pVM, const char *pszPat = NULL, unsigned uRefreshRate= 0, QWidget *pParent = NULL);
     396#else
    361397    /**
    362398     * Creates a VM statistics list view widget.
     
    370406     */
    371407    VBoxDbgStats(PVM pVM, const char *pszPat = NULL, unsigned uRefreshRate= 0, QWidget *pParent = NULL, const char *pszName = NULL, WFlags f = 0);
     408#endif
    372409
    373410    /** Destructor. */
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