VirtualBox

Changeset 12841 in vbox


Ignore:
Timestamp:
Sep 30, 2008 11:54:56 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
37211
Message:

Debugger: menus.

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

Legend:

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

    r12840 r12841  
    3535#include <QHBoxLayout>
    3636#include <QVBoxLayout>
     37#include <QKeySequence>
     38#include <QAction>
     39#include <QContextMenuEvent>
    3740
    3841#include <VBox/err.h>
     
    217220     * @returns true if we reset the model and it's necessary to set the root index.
    218221     * @param   a_rPatStr       The selection pattern.
    219      */
    220     virtual bool updateStats(const QString &a_rPatStr) = 0;
     222     *
     223     * @remarks The default implementation is an empty stub.
     224     */
     225    virtual bool updateStatsByPattern(const QString &a_rPatStr);
     226
     227    /**
     228     * Similar to updateStatsByPattern, except that it only works on a sub-tree and
     229     * will not remove anything that's outside that tree.
     230     *
     231     * @param  a_rIndex     The sub-tree root. Invalid index means root.
     232     *
     233     * @todo    Create a default implementation using updateStatsByPattern.
     234     */
     235    virtual void updateStatsByIndex(QModelIndex const &a_rIndex);
     236
     237    /**
     238     * Reset the stats matching the specified pattern.
     239     *
     240     * @param  a_rPatStr    The selection pattern.
     241     *
     242     * @remarks The default implementation is an empty stub.
     243     */
     244    virtual void resetStatsByPattern(QString const &a_rPatStr);
     245
     246    /**
     247     * Reset the stats of a sub-tree.
     248     *
     249     * @param   a_rIndex    The sub-tree root. Invalid index means root.
     250     * @param   a_fSubTree  Whether to reset the sub-tree as well. Default is true.
     251     *
     252     * @remarks The default implementation makes use of resetStatsByPattern
     253     */
     254    virtual void resetStatsByIndex(QModelIndex const &a_rIndex, bool a_fSubTree = true);
    221255
    222256    /**
     
    226260     */
    227261    QModelIndex getRootIndex(void) const;
     262
    228263
    229264protected:
     
    266301
    267302    /**
    268      * Called by updateStats(), makes the necessary preparations.
     303     * Called by updateStatsByPattern(), makes the necessary preparations.
    269304     *
    270305     * @returns Success indicator.
     
    273308
    274309    /**
    275      * Called by updateStats(), finalizes the update.
    276      *
    277      * @return See updateStats().
     310     * Called by updateStatsByPattern(), finalizes the update.
     311     *
     312     * @return See updateStatsByPattern().
    278313     *
    279314     * @param  a_fSuccess   Whether the update was successful or not.
     
    307342    void updateCallbackAdvance(PDBGGUISTATSNODE pNode);
    308343
    309     /** Callback used by updateStats() to feed changes.
     344    /** Callback used by updateStatsByPattern() and updateStatsByIndex() to feed
     345     *  changes.
    310346     * @copydoc FNSTAMR3ENUM */
    311347    static DECLCALLBACK(int) updateCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit,
     
    524560    virtual ~VBoxDbgStatsModelVM();
    525561
    526     virtual bool updateStats(const QString &a_rPatStr);
     562    virtual bool updateStatsByPattern(const QString &a_rPatStr);
     563    virtual void resetStatsByPattern(const QString &a_rPatStr);
    527564
    528565protected:
     
    18391876
    18401877
     1878bool
     1879VBoxDbgStatsModel::updateStatsByPattern(const QString &a_rPatStr)
     1880{
     1881    /* stub */
     1882    NOREF(a_rPatStr);
     1883    return false;
     1884}
     1885
     1886
     1887void
     1888VBoxDbgStatsModel::updateStatsByIndex(QModelIndex const &a_rIndex)
     1889{
     1890    /** @todo implement this based on updateStatsByPattern. */
     1891    NOREF(a_rIndex);
     1892}
     1893
     1894
     1895void
     1896VBoxDbgStatsModel::resetStatsByPattern(QString const &a_rPatStr)
     1897{
     1898    /* stub */
     1899    NOREF(a_rPatStr);
     1900}
     1901
     1902
     1903void
     1904VBoxDbgStatsModel::resetStatsByIndex(QModelIndex const &a_rIndex, bool fSubTree /*= true*/)
     1905{
     1906    PCDBGGUISTATSNODE pNode = nodeFromIndex(a_rIndex);
     1907    if (pNode == m_pRoot || !a_rIndex.isValid())
     1908    {
     1909        if (fSubTree)
     1910        {
     1911            /* everything from the root down. */
     1912            resetStatsByPattern(QString());
     1913        }
     1914    }
     1915    else if (pNode)
     1916    {
     1917        /* the node pattern. */
     1918        char szPat[1024+1024+4];
     1919        int32_t cch = getNodePath(pNode, szPat, 1024);
     1920        AssertReturnVoid(cch >= 0);
     1921
     1922        /* the sub-tree pattern. */
     1923        if (fSubTree && pNode->cChildren)
     1924        {
     1925            char *psz = &szPat[cch];
     1926            *psz++ = '|';
     1927            memcpy(psz, szPat, cch);
     1928            psz += cch;
     1929            *psz++ = '/';
     1930            *psz++ = '*';
     1931            *psz++ = '\0';
     1932        }
     1933
     1934        resetStatsByPattern(szPat);
     1935    }
     1936}
     1937
    18411938
    18421939QModelIndex
     
    18631960{
    18641961    Qt::ItemFlags fFlags = QAbstractItemModel::flags(a_rIndex);
    1865 #if 0
    1866     PDBGGUISTATSNODE pNode = nodeFromIndex(a_rIndex);
    1867     if (pNode)
    1868     {
    1869     }
    1870 #endif
    18711962    return fFlags;
    18721963}
     
    18851976{
    18861977    PDBGGUISTATSNODE pParent = nodeFromIndex(a_rParent);
    1887     return pParent->cChildren;
     1978    return pParent ? pParent->cChildren : 0;
    18881979}
    18891980
     
    19041995    if (!pParent)
    19051996    {
    1906         printf("index: iRow=%d iColumn=%d invalid parent\n", iRow, iColumn);
     1997        Log(("index: iRow=%d iColumn=%d invalid parent\n", iRow, iColumn));
    19071998        return QModelIndex(); /* bug? */
    19081999    }
    19092000    if ((unsigned)iRow >= pParent->cChildren)
    19102001    {
    1911         printf("index: iRow=%d >= cChildren=%u (iColumn=%d)\n", iRow, (unsigned)pParent->cChildren, iColumn);
     2002        Log(("index: iRow=%d >= cChildren=%u (iColumn=%d)\n", iRow, (unsigned)pParent->cChildren, iColumn));
    19122003        return QModelIndex(); /* bug? */
    19132004    }
    19142005    if ((unsigned)iColumn >= DBGGUI_STATS_COLUMNS)
    19152006    {
    1916         printf("index: iColumn=%d (iRow=%d)\n", iColumn, iRow);
     2007        Log(("index: iColumn=%d (iRow=%d)\n", iColumn, iRow));
    19172008        return QModelIndex(); /* bug? */
    19182009    }
    19192010    PDBGGUISTATSNODE pChild = pParent->papChildren[iRow];
    1920 
    1921     //printf("index: iRow=%d iColumn=%d %p %s/%s\n", iRow, iColumn, pChild, pParent->pszName, pChild->pszName);
    19222011    return createIndex(iRow, iColumn, pChild);
    19232012}
     
    19302019    if (!pChild)
    19312020    {
    1932         printf("parent: invalid child\n");
     2021        Log(("parent: invalid child\n"));
    19332022        return QModelIndex(); /* bug */
    19342023    }
    19352024    PDBGGUISTATSNODE pParent = pChild->pParent;
    19362025    if (!pParent)
    1937     {
    1938 //        printf("parent: root\n");
    19392026        return QModelIndex(); /* we're root */
    1940     }
    1941 
    1942 #if 0  /* this triggers qWarning("Can't select indexes from different model or with different parents") in QItemSelection::select(). */
    1943     //printf("parent: iSelf=%d iColumn=%d %p %s(/%s)\n", pParent->iSelf, a_rChild.column(), pParent, pParent->pszName, pChild->pszName);
    1944     return createIndex(pParent->iSelf, a_rChild.column(), pParent);
    1945 #else
    1946     //printf("parent: iSelf=%d iColumn=%d %p %s(/%s)\n", pParent->iSelf, 0, pParent, pParent->pszName, pChild->pszName);
     2027
    19472028    return createIndex(pParent->iSelf, 0, pParent);
    1948 #endif
    19492029}
    19502030
     
    22882368
    22892369bool
    2290 VBoxDbgStatsModelVM::updateStats(const QString &a_rPatStr)
     2370VBoxDbgStatsModelVM::updateStatsByPattern(const QString &a_rPatStr)
    22912371{
    22922372    /** @todo the way we update this stuff is independent of the source (XML, file, STAM), our only
     
    23002380    }
    23012381    return fRc;
     2382}
     2383
     2384
     2385void
     2386VBoxDbgStatsModelVM::resetStatsByPattern(QString const &a_rPatStr)
     2387{
     2388    stamReset(a_rPatStr);
    23022389}
    23032390
     
    26982785
    26992786VBoxDbgStatsView::VBoxDbgStatsView(PVM a_pVM, VBoxDbgStatsModel *a_pModel, VBoxDbgStats *a_pParent/* = NULL*/)
    2700     : QTreeView(a_pParent), VBoxDbgBase(a_pVM), m_pModel(a_pModel), m_pParent(a_pParent),
    2701     m_pLeafMenu(NULL), m_pBranchMenu(NULL), m_pViewMenu(NULL), m_pContextNode(NULL)
     2787    : QTreeView(a_pParent), VBoxDbgBase(a_pVM), m_pModel(a_pModel), m_PatStr(), m_pParent(a_pParent),
     2788    m_pLeafMenu(NULL), m_pBranchMenu(NULL), m_pViewMenu(NULL), m_pCurMenu(NULL), m_CurIndex()
    27022789
    27032790{
     
    27072794    setModel(m_pModel);
    27082795    setRootIndex(m_pModel->getRootIndex());
    2709     //setRootIsDecorated(true);
     2796    setRootIsDecorated(true);
    27102797    setItemsExpandable(true);
    2711     setSortingEnabled(true);
    2712 
    2713     /*
    2714      * We've got three menus to populate and link up.
    2715      */
    2716 #ifdef VBOXDBG_USE_QT4
    2717     /** @todo */
    2718 
    2719 #else  /* QT3 */
    2720     m_pLeafMenu = new QPopupMenu(this);
    2721     m_pLeafMenu->insertItem("Rese&t", eReset);
    2722     m_pLeafMenu->insertItem("&Refresh", eRefresh);
    2723     m_pLeafMenu->insertItem("&Copy", eCopy);
    2724     m_pLeafMenu->insertItem("To &Log", eLog);
    2725     m_pLeafMenu->insertItem("T&o Release Log", eLogRel);
    2726     connect(m_pLeafMenu, SIGNAL(activated(int)), this, SLOT(leafMenuActivated(int)));
    2727 
    2728     m_pBranchMenu = new QPopupMenu(this);
    2729     m_pBranchMenu->insertItem("&Expand Tree", eExpand);
    2730     m_pBranchMenu->insertItem("&Collaps Tree", eCollaps);
    2731     m_pBranchMenu->insertItem("&Refresh", eRefresh);
    2732     m_pBranchMenu->insertItem("Rese&t", eReset);
    2733     m_pBranchMenu->insertItem("&Copy", eCopy);
    2734     m_pBranchMenu->insertItem("To &Log", eLog);
    2735     m_pBranchMenu->insertItem("T&o Release Log", eLogRel);
    2736     connect(m_pBranchMenu, SIGNAL(activated(int)), this, SLOT(branchMenuActivated(int)));
    2737 
    2738     m_pViewMenu = new QPopupMenu(this);
    2739     m_pViewMenu->insertItem("&Expand All", eExpand);
    2740     m_pViewMenu->insertItem("&Collaps All", eCollaps);
    2741     m_pViewMenu->insertItem("&Refresh", eRefresh);
    2742     m_pViewMenu->insertItem("Rese&t", eReset);
    2743     m_pViewMenu->insertItem("&Copy", eCopy);
    2744     m_pViewMenu->insertItem("To &Log", eLog);
    2745     m_pViewMenu->insertItem("T&o Release Log", eLogRel);
    2746     connect(m_pViewMenu, SIGNAL(activated(int)), this, SLOT(viewMenuActivated(int)));
    2747 
    2748     connect(this, SIGNAL(contextMenuRequested(QListViewItem *, const QPoint &, int)), this,
    2749             SLOT(contextMenuReq(QListViewItem *, const QPoint &, int)));
    2750 #endif /* QT3 */
     2798    setSelectionBehavior(SelectRows);
     2799    setSelectionMode(SingleSelection);
     2800    /// @todo sorting setSortingEnabled(true);
     2801
     2802    /*
     2803     * Create and setup the actions.
     2804     */
     2805    m_pExpandAct   = new QAction("Expand Tree", this);
     2806    m_pCollapseAct = new QAction("Collapse Tree", this);
     2807    m_pRefreshAct  = new QAction("&Refresh", this);
     2808    m_pResetAct    = new QAction("Rese&t", this);
     2809    m_pCopyAct     = new QAction("&Copy", this);
     2810    m_pToLogAct    = new QAction("To &Log", this);
     2811    m_pToRelLogAct = new QAction("T&o Release Log", this);
     2812
     2813    m_pCopyAct->setShortcut(QKeySequence::Copy);
     2814    m_pExpandAct->setShortcut(QKeySequence("Ctrl+E"));
     2815    m_pRefreshAct->setShortcut(QKeySequence("Ctrl+R"));
     2816    m_pToLogAct->setShortcut(QKeySequence("Ctrl+L"));
     2817    m_pToRelLogAct->setShortcut(QKeySequence("Alt+L"));
     2818
     2819    connect(m_pExpandAct,   SIGNAL(triggered(bool)), this, SLOT(actExpand()));
     2820    connect(m_pCollapseAct, SIGNAL(triggered(bool)), this, SLOT(actCollapse()));
     2821    connect(m_pRefreshAct,  SIGNAL(triggered(bool)), this, SLOT(actRefresh()));
     2822    connect(m_pResetAct,    SIGNAL(triggered(bool)), this, SLOT(actReset()));
     2823    connect(m_pCopyAct,     SIGNAL(triggered(bool)), this, SLOT(actCopy()));
     2824    connect(m_pToLogAct,    SIGNAL(triggered(bool)), this, SLOT(actToLog()));
     2825    connect(m_pToRelLogAct, SIGNAL(triggered(bool)), this, SLOT(actToRelLog()));
     2826
     2827addAction(m_pExpandAct); /// testing
     2828addAction(m_pCopyAct); /// testing
     2829
     2830
     2831    /*
     2832     * Create the menus and populate them.
     2833     */
     2834    setContextMenuPolicy(Qt::DefaultContextMenu);
     2835
     2836    m_pLeafMenu = new QMenu();
     2837    m_pLeafMenu->addAction(m_pCopyAct);
     2838    m_pLeafMenu->addAction(m_pRefreshAct);
     2839    m_pLeafMenu->addAction(m_pResetAct);
     2840    m_pLeafMenu->addAction(m_pToLogAct);
     2841    m_pLeafMenu->addAction(m_pToRelLogAct);
     2842
     2843    m_pBranchMenu = new QMenu(this);
     2844    m_pBranchMenu->addAction(m_pCopyAct);
     2845    m_pBranchMenu->addAction(m_pRefreshAct);
     2846    m_pBranchMenu->addAction(m_pResetAct);
     2847    m_pBranchMenu->addAction(m_pToLogAct);
     2848    m_pBranchMenu->addAction(m_pToRelLogAct);
     2849    m_pBranchMenu->addSeparator();
     2850    m_pBranchMenu->addAction(m_pExpandAct);
     2851    m_pBranchMenu->addAction(m_pCollapseAct);
     2852
     2853    m_pViewMenu = new QMenu();
     2854    m_pBranchMenu->addAction(m_pCopyAct);
     2855    m_pBranchMenu->addAction(m_pRefreshAct);
     2856    m_pBranchMenu->addAction(m_pResetAct);
     2857    m_pBranchMenu->addAction(m_pToLogAct);
     2858    m_pBranchMenu->addAction(m_pToRelLogAct);
     2859    m_pBranchMenu->addSeparator();
     2860    m_pBranchMenu->addAction(m_pExpandAct);
     2861    m_pBranchMenu->addAction(m_pCollapseAct);
     2862    m_pBranchMenu->addSeparator();
    27512863}
    27522864
     
    27622874
    27632875
    2764 #if 0
    2765 /**
    2766  * Hides all parent branches which doesn't have any visible leafs.
    2767  */
    2768 static void hideParentBranches(VBoxDbgStatsLeafItem *pItem)
    2769 {
    2770 #ifdef VBOXDBG_USE_QT4
    2771     /// @todo
    2772     NOREF(pItem);
    2773 #else
    2774     for (VBoxDbgStatsItem *pParent = pItem->getParent(); pParent; pParent = pParent->getParent())
    2775     {
    2776         QListViewItem *pChild = pParent->firstChild();
    2777         while (pChild && !pChild->isVisible())
    2778             pChild = pChild->nextSibling();
    2779         if (pChild)
    2780             return;
    2781         pParent->setVisible(false);
    2782     }
    2783 #endif
    2784 }
    2785 
    2786 /**
    2787  * Shows all parent branches
    2788  */
    2789 static void showParentBranches(VBoxDbgStatsLeafItem *pItem)
    2790 {
    2791     for (VBoxDbgStatsItem *pParent = pItem->getParent(); pParent; pParent = pParent->getParent())
    2792         pParent->setVisible(true);
    2793 }
    2794 #endif
    2795 
    2796 
    2797 void VBoxDbgStatsView::updateStats(const QString &rPatStr)
    2798 {
    2799     if (m_pModel->updateStats(rPatStr))
     2876void
     2877VBoxDbgStatsView::updateStats(const QString &rPatStr)
     2878{
     2879    m_PatStr = rPatStr;
     2880    if (m_pModel->updateStatsByPattern(rPatStr))
    28002881        setRootIndex(m_pModel->getRootIndex()); /// @todo this is a hack?
    2801 
    2802 #if 0 /* later */
    2803     m_pCur = m_pHead;
    2804     m_PatStr = rPatStr;
    2805     int rc = stamEnum(m_PatStr, updateCallback, this);
    2806     if (VBOX_SUCCESS(rc))
    2807     {
    2808         /* hide what's left */
    2809         for (VBoxDbgStatsLeafItem *pCur = m_pCur; pCur; pCur = pCur->m_pNext)
    2810             if (pCur->isVisible())
    2811             {
    2812                 pCur->setVisible(false);
    2813                 hideParentBranches(pCur);
    2814             }
    2815     }
    2816     m_pCur = NULL;
    2817 #endif
    2818     NOREF(rPatStr);
    2819 }
    2820 
    2821 void VBoxDbgStatsView::resetStats(const QString &rPatStr)
    2822 {
    2823     stamReset(rPatStr);
    2824 }
    2825 
    2826 
    2827 #if 0 /* later */
     2882}
     2883
     2884
     2885void
     2886VBoxDbgStatsView::contextMenuEvent(QContextMenuEvent *a_pEvt)
     2887{
     2888    /*
     2889     * Get the selected item.
     2890     * If it's a mouse event select the item under the cursor (if any).
     2891     */
     2892    QModelIndex Idx;
     2893    if (a_pEvt->reason() == QContextMenuEvent::Mouse)
     2894    {
     2895        Idx = indexAt(a_pEvt->pos());
     2896        if (Idx.isValid())
     2897            setCurrentIndex(Idx);
     2898    }
     2899    else
     2900    {
     2901        QModelIndexList SelIdx = selectedIndexes();
     2902        if (!SelIdx.isEmpty())
     2903            Idx = SelIdx.at(0);
     2904    }
     2905
     2906    /*
     2907     * Popup the corresponding menu.
     2908     */
     2909    QMenu *pMenu;
     2910    if (!Idx.isValid())
     2911        pMenu = m_pViewMenu;
     2912    else if (m_pModel->hasChildren(Idx))
     2913        pMenu = m_pBranchMenu;
     2914    else
     2915        pMenu = m_pLeafMenu;
     2916    if (pMenu)
     2917    {
     2918        m_pRefreshAct->setEnabled(!Idx.isValid() || Idx == m_pModel->getRootIndex());
     2919        m_CurIndex = Idx;
     2920        m_pCurMenu = pMenu;
     2921
     2922        pMenu->exec(a_pEvt->globalPos());
     2923
     2924        m_pCurMenu = NULL;
     2925        m_CurIndex = QModelIndex();
     2926        m_pRefreshAct->setEnabled(true);
     2927    }
     2928    a_pEvt->accept();
     2929}
     2930
     2931
     2932void
     2933VBoxDbgStatsView::actExpand()
     2934{
     2935    QModelIndex Idx = m_pCurMenu ? m_CurIndex : currentIndex();
     2936    if (Idx.isValid())
     2937        expand(Idx);
     2938}
     2939
     2940
     2941void
     2942VBoxDbgStatsView::actCollapse()
     2943{
     2944    QModelIndex Idx = m_pCurMenu ? m_CurIndex : currentIndex();
     2945    if (Idx.isValid())
     2946        collapse(Idx);
     2947}
     2948
     2949
     2950void
     2951VBoxDbgStatsView::actRefresh()
     2952{
     2953    QModelIndex Idx = m_pCurMenu ? m_CurIndex : currentIndex();
     2954    if (!Idx.isValid() || Idx == m_pModel->getRootIndex())
     2955        m_pModel->updateStatsByPattern(m_PatStr);
     2956    else
     2957        m_pModel->updateStatsByIndex(Idx);
     2958}
     2959
     2960
     2961void
     2962VBoxDbgStatsView::actReset()
     2963{
     2964    QModelIndex Idx = m_pCurMenu ? m_CurIndex : currentIndex();
     2965    if (!Idx.isValid() || Idx == m_pModel->getRootIndex())
     2966        m_pModel->resetStatsByPattern(m_PatStr);
     2967    else
     2968        m_pModel->resetStatsByIndex(Idx);
     2969}
     2970
     2971
     2972void
     2973VBoxDbgStatsView::actCopy()
     2974{
     2975    QModelIndex Idx = m_pCurMenu ? m_CurIndex : currentIndex();
     2976    m_pModel->copyTreeToClipboard(Idx);
     2977}
     2978
     2979
     2980void
     2981VBoxDbgStatsView::actToLog()
     2982{
     2983    QModelIndex Idx = m_pCurMenu ? m_CurIndex : currentIndex();
     2984    m_pModel->logTree(Idx, false /* a_fReleaseLog */);
     2985}
     2986
     2987
     2988void
     2989VBoxDbgStatsView::actToRelLog()
     2990{
     2991    QModelIndex Idx = m_pCurMenu ? m_CurIndex : currentIndex();
     2992    m_pModel->logTree(Idx, true /* a_fReleaseLog */);
     2993}
     2994
     2995
     2996
     2997
     2998
     2999
     3000#if 0 /* later? */
    28283001
    28293002static void setOpenTree(QListViewItem *pItem, bool f)
     
    28403013#endif
    28413014}
    2842 
    2843 #ifndef VBOXDBG_USE_QT4
    2844 void VBoxDbgStatsView::expandAll()
    2845 {
    2846     setOpenTree(m_pRoot, true);
    2847 }
    2848 
    2849 void VBoxDbgStatsView::collapsAll()
    2850 {
    2851     setOpenTree(m_pRoot, false);
    2852 }
    2853 #endif /* QT3 */
    28543015
    28553016
     
    32353396    connect(pSB, SIGNAL(valueChanged(int)), this, SLOT(setRefresh(int)));
    32363397
    3237 
    32383398    /*
    32393399     * Create the tree view and setup the layout.
     
    32503410    this->setLayout(pVLayout);
    32513411
    3252 #if 0 //fixme
    3253     /*
    3254      * Perform the first refresh to get a good window size.
    3255      * We do this with sorting disabled because it's horribly slow otherwise.
    3256      */
    3257 //later:    int iColumn = m_pView->sortColumn();
    3258     m_pView->setUpdatesEnabled(false);
    3259     m_pView->setSortingEnabled(false);
    3260     refresh();
    3261 //later:    m_pView->sortItems(iColumn, Qt::AscendingOrder);
    3262  //   QTreeView::expandAll
    3263 #endif
     3412    /*
     3413     * Expand all and resize columns...
     3414     */
    32643415    m_pView->expandAll();
    32653416    for (int i = 0; i <= 8; i++)
    3266     {
    3267         printf("%#x: %d", i, m_pView->columnWidth(i));
    32683417        m_pView->resizeColumnToContents(i);
    3269         printf(" -> %d\n", m_pView->columnWidth(i));
    3270     }
    32713418
    32723419    /*
  • trunk/src/VBox/Debugger/VBoxDbgStatsQt4.h

    r12819 r12841  
    7979
    8080protected slots:
    81 //later:    /** Context menu. */
    82 //later:    void contextMenuReq(QListViewItem *pItem, const QPoint &rPoint, int iColumn);
    83 //later:    /** Leaf context. */
    84 //later:    void leafMenuActivated(int iId);
    85 //later:    /** Branch context. */
    86 //later:    void branchMenuActivated(int iId);
    87 //later:    /** View context. */
    88 //later:    void viewMenuActivated(int iId);
     81    /** @name Action signal slots.
     82     * @{ */
     83    void actExpand();
     84    void actCollapse();
     85    void actRefresh();
     86    void actReset();
     87    void actCopy();
     88    void actToLog();
     89    void actToRelLog();
     90    /** @} */
     91
     92protected:
     93    /**
     94     * Popup context menu.
     95     *
     96     * @param  a_pEvt       The event.
     97     */
     98    virtual void contextMenuEvent(QContextMenuEvent *a_pEvt);
    8999
    90100protected:
     
    98108    /** The parent widget. */
    99109    VBoxDbgStats *m_pParent;
     110
    100111    /** Leaf item menu. */
    101112    QMenu *m_pLeafMenu;
     
    104115    /** View menu. */
    105116    QMenu *m_pViewMenu;
    106     /** The pointer to the node which is the current focus of a context menu. */
    107     PDBGGUISTATSNODE m_pContextNode;
     117
     118    /** The menu that's currently being executed. */
     119    QMenu *m_pCurMenu;
     120    /** The current index relating to the context menu.
     121     * Considered invalid if m_pCurMenu is NULL. */
     122    QModelIndex m_CurIndex;
     123
     124    /** Expand Tree action. */
     125    QAction *m_pExpandAct;
     126    /** Collapse Tree action. */
     127    QAction *m_pCollapseAct;
     128    /** Refresh Tree action. */
     129    QAction *m_pRefreshAct;
     130    /** Reset Tree action. */
     131    QAction *m_pResetAct;
     132    /** Copy (to clipboard) action. */
     133    QAction *m_pCopyAct;
     134    /** To Log action. */
     135    QAction *m_pToLogAct;
     136    /** To Release Log action. */
     137    QAction *m_pToRelLogAct;
     138#if 0
     139    /** Save Tree (to file) action. */
     140    QAction *m_SaveFileAct;
     141    /** Load Tree (from file) action. */
     142    QAction *m_LoadFileAct;
     143    /** Take Snapshot action. */
     144    QAction *m_TakeSnapshotAct;
     145    /** Load Snapshot action. */
     146    QAction *m_LoadSnapshotAct;
     147    /** Diff With Snapshot action. */
     148    QAction *m_DiffSnapshotAct;
     149#endif
    108150};
    109151
  • trunk/src/VBox/Debugger/testcase/tstVBoxDbg.cpp

    r12478 r12841  
    6262        if (RT_SUCCESS(rc))
    6363        {
    64             RTPrintf(TESTCASE ": calling pfnShowCommandLine...\n");
    65             rc = pGuiVT->pfnShowCommandLine(pGui);
    66             if (RT_FAILURE(rc))
     64            if (argc <= 1 || argc == 2)
    6765            {
    68                 RTPrintf(TESTCASE ": error: pfnShowCommandLine failed! rc=%Rrc\n", rc);
    69                 cErrors++;
     66                RTPrintf(TESTCASE ": calling pfnShowCommandLine...\n");
     67                rc = pGuiVT->pfnShowCommandLine(pGui);
     68                if (RT_FAILURE(rc))
     69                {
     70                    RTPrintf(TESTCASE ": error: pfnShowCommandLine failed! rc=%Rrc\n", rc);
     71                    cErrors++;
     72                }
    7073            }
    7174
    72 #if 1
    73             RTPrintf(TESTCASE ": calling pfnShowStatistics...\n");
    74             pGuiVT->pfnShowStatistics(pGui);
    75             if (RT_FAILURE(rc))
     75            if (argc <= 1 || argc == 3)
    7676            {
    77                 RTPrintf(TESTCASE ": error: pfnShowStatistics failed! rc=%Rrc\n", rc);
    78                 cErrors++;
     77                RTPrintf(TESTCASE ": calling pfnShowStatistics...\n");
     78                pGuiVT->pfnShowStatistics(pGui);
     79                if (RT_FAILURE(rc))
     80                {
     81                    RTPrintf(TESTCASE ": error: pfnShowStatistics failed! rc=%Rrc\n", rc);
     82                    cErrors++;
     83                }
    7984            }
    80 #endif
    8185
    82             pGuiVT->pfnAdjustRelativePos(pGui, 64, 64, 128, 64);
     86            pGuiVT->pfnAdjustRelativePos(pGui, 0, 0, 640, 480);
    8387            RTPrintf(TESTCASE ": calling App.exec()...\n");
    8488            App.exec();
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