[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdesdk/kcachegrind/kcachegrind
From: Josef Weidendorfer <Josef.Weidendorfer () gmx ! de>
Date: 2007-07-06 22:54:15
Message-ID: 1183762455.131464.1155.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 684570 by weidendo:
kcachegrind: Replace a few Q3PopupMenu with QMenu
M +1 -1 callview.cpp
M +1 -1 coverageview.cpp
M +2 -2 functionselection.cpp
M +1 -1 instrview.cpp
M +1 -1 sourceview.cpp
M +45 -30 toplevel.cpp
M +6 -8 toplevel.h
M +3 -3 traceitemview.cpp
M +3 -5 traceitemview.h
--- trunk/KDE/kdesdk/kcachegrind/kcachegrind/callview.cpp #684569:684570
@@ -132,7 +132,7 @@
}
if ((col == 0) || (col == 1)) {
- addCostMenu(&popup);
+ addEventTypeMenu(&popup);
popup.insertSeparator();
}
addGoMenu(&popup);
--- trunk/KDE/kdesdk/kcachegrind/kcachegrind/coverageview.cpp #684569:684570
@@ -168,7 +168,7 @@
}
if ((c == 0) || (!_showCallers && c == 1)) {
- addCostMenu(&popup, false);
+ addEventTypeMenu(&popup, false);
popup.insertSeparator();
}
addGoMenu(&popup);
--- trunk/KDE/kdesdk/kcachegrind/kcachegrind/functionselection.cpp #684569:684570
@@ -179,7 +179,7 @@
}
if ((c == 0) || (c == 1)) {
- addCostMenu(&popup,false);
+ addEventTypeMenu(&popup,false);
popup.insertSeparator();
}
addGroupMenu(&popup);
@@ -206,7 +206,7 @@
}
#endif
if (c == 0) {
- addCostMenu(&popup,false);
+ addEventTypeMenu(&popup,false);
popup.insertSeparator();
}
addGroupMenu(&popup);
--- trunk/KDE/kdesdk/kcachegrind/kcachegrind/instrview.cpp #684569:684570
@@ -198,7 +198,7 @@
}
if ((c == 1) || (c == 2)) {
- addCostMenu(&popup);
+ addEventTypeMenu(&popup);
popup.insertSeparator();
}
addGoMenu(&popup);
--- trunk/KDE/kdesdk/kcachegrind/kcachegrind/sourceview.cpp #684569:684570
@@ -122,7 +122,7 @@
}
if ((c == 1) || (c == 2)) {
- addCostMenu(&popup);
+ addEventTypeMenu(&popup);
popup.addSeparator();
}
addGoMenu(&popup);
--- trunk/KDE/kdesdk/kcachegrind/kcachegrind/toplevel.cpp #684569:684570
@@ -1579,20 +1579,25 @@
updateStatusBar();
}
-void TopLevel::addCostMenu(Q3PopupMenu* popup, bool withCost2)
+void TopLevel::addEventTypeMenu(QMenu* popup, bool withCost2)
{
if (_data) {
- Q3PopupMenu *popup1 = new Q3PopupMenu(popup);
- Q3PopupMenu *popup2 = 0;
- popup1->setCheckable(true);
+ QMenu *popup1, *popup2 = 0;
+ QAction* action;
+ popup1 = popup->addMenu(i18n("Primary Event Type"));
+ connect(popup1, SIGNAL(triggered(QAction*)),
+ this, SLOT(setEventType(QAction*)));
+
if (withCost2) {
- popup2 = new Q3PopupMenu(popup);
- popup2->setCheckable(true);
+ popup2 = popup->addMenu(i18n("Secondary Event Type"));
+ connect(popup2, SIGNAL(triggered(QAction*)),
+ this, SLOT(setEventType2(QAction*)));
if (_eventType2) {
- popup2->insertItem(i18n("Hide"),199);
- popup2->insertSeparator();
+ action = popup2->addAction(i18n("Hide"));
+ action->setData(199);
+ popup2->addSeparator();
}
}
@@ -1600,40 +1605,49 @@
TraceEventType* ct;
for (int i=0;i<m->realCount();i++) {
ct = m->realType(i);
- popup1->insertItem(ct->longName(), 100+i);
- if (_eventType == ct) popup1->setItemChecked(100+i,true);
+
+ action = popup1->addAction(ct->longName());
+ action->setCheckable(true);
+ action->setData(100+i);
+ if (_eventType == ct) action->setChecked(true);
+
if (popup2) {
- popup2->insertItem(ct->longName(), 100+i);
- if (_eventType2 == ct) popup2->setItemChecked(100+i,true);
+ action = popup2->addAction(ct->longName());
+ action->setCheckable(true);
+ action->setData(100+i);
+ if (_eventType2 == ct) action->setChecked(true);
}
}
+
for (int i=0;i<m->derivedCount();i++) {
ct = m->derivedType(i);
- popup1->insertItem(ct->longName(), 200+i);
- if (_eventType == ct) popup1->setItemChecked(200+i,true);
+
+ action = popup1->addAction(ct->longName());
+ action->setCheckable(true);
+ action->setData(200+i);
+ if (_eventType == ct) action->setChecked(true);
+
if (popup2) {
- popup2->insertItem(ct->longName(), 200+i);
- if (_eventType2 == ct) popup2->setItemChecked(200+i,true);
+ action = popup2->addAction(ct->longName());
+ action->setCheckable(true);
+ action->setData(200+i);
+ if (_eventType2 == ct) action->setChecked(true);
}
}
- popup->insertItem(i18n("Primary Event Type"), popup1);
- connect(popup1,SIGNAL(activated(int)),this,SLOT(setEventType(int)));
- if (popup2) {
- popup->insertItem(i18n("Secondary Event Type"), popup2);
- connect(popup2,SIGNAL(activated(int)),this,SLOT(setEventType2(int)));
- }
}
+
if (_showPercentage)
- popup->insertItem(i18n("Show Absolute Cost"),
+ popup->addAction(i18n("Show Absolute Cost"),
this, SLOT(setAbsoluteCost()));
else
- popup->insertItem(i18n("Show Relative Cost"),
+ popup->addAction(i18n("Show Relative Cost"),
this, SLOT(setRelativeCost()));
}
-bool TopLevel::setEventType(int id)
+bool TopLevel::setEventType(QAction* action)
{
if (!_data) return false;
+ int id = action->data().toInt(0);
TraceEventTypeMapping* m = _data->mapping();
TraceEventType* ct=0;
@@ -1643,9 +1657,10 @@
return ct ? setEventType(ct) : false;
}
-bool TopLevel::setEventType2(int id)
+bool TopLevel::setEventType2(QAction* action)
{
if (!_data) return false;
+ int id = action->data().toInt(0);
TraceEventTypeMapping* m = _data->mapping();
TraceEventType* ct=0;
@@ -1655,11 +1670,11 @@
return setEventType2(ct);
}
-void TopLevel::addGoMenu(Q3PopupMenu* popup)
+void TopLevel::addGoMenu(QMenu* popup)
{
- popup->insertItem(i18n("Go Back"), this, SLOT(goBack()));
- popup->insertItem(i18n("Go Forward"), this, SLOT(goForward()));
- popup->insertItem(i18n("Go Up"), this, SLOT(goUp()));
+ popup->addAction(i18n("Go Back"), this, SLOT(goBack()));
+ popup->addAction(i18n("Go Forward"), this, SLOT(goForward()));
+ popup->addAction(i18n("Go Up"), this, SLOT(goUp()));
}
void TopLevel::goBack()
--- trunk/KDE/kdesdk/kcachegrind/kcachegrind/toplevel.h #684569:684570
@@ -24,22 +24,20 @@
#define TOPLEVEL_H
#include <qdatetime.h>
-//Added by qt3to4:
#include <QLabel>
-#include <Q3PopupMenu>
+#include <Q3DockWindow>
#include <kxmlguiwindow.h>
#include "traceitemview.h"
#include "tracedata.h"
-#include <Q3DockWindow>
class MultiView;
class QLineEdit;
class QDockWidget;
class QLabel;
class QProgressBar;
-class Q3PopupMenu;
+class QMenu;
class KUrl;
class KSelectAction;
@@ -84,8 +82,8 @@
bool showCycles() const { return _showCycles; }
/* convenience functions for often used context menu items */
- void addCostMenu(Q3PopupMenu*,bool);
- void addGoMenu(Q3PopupMenu*);
+ void addEventTypeMenu(QMenu*,bool);
+ void addGoMenu(QMenu*);
public slots:
void newTrace();
@@ -153,8 +151,8 @@
bool setEventType2(TraceEventType*);
bool setEventType(QString);
bool setEventType2(QString);
- bool setEventType(int);
- bool setEventType2(int);
+ bool setEventType(QAction*);
+ bool setEventType2(QAction*);
bool setGroupType(TraceItem::CostType);
bool setGroupType(QString);
bool setGroup(TraceCostItem*);
--- trunk/KDE/kdesdk/kcachegrind/kcachegrind/traceitemview.cpp #684569:684570
@@ -436,12 +436,12 @@
if (_topLevel) _topLevel->setDirectionDelayed(d);
}
-void TraceItemView::addCostMenu(Q3PopupMenu* p, bool withCost2)
+void TraceItemView::addEventTypeMenu(QMenu* p, bool withCost2)
{
- if (_topLevel) _topLevel->addCostMenu(p, withCost2);
+ if (_topLevel) _topLevel->addEventTypeMenu(p, withCost2);
}
-void TraceItemView::addGoMenu(Q3PopupMenu* p)
+void TraceItemView::addGoMenu(QMenu* p)
{
if (_topLevel) _topLevel->addGoMenu(p);
}
--- trunk/KDE/kdesdk/kcachegrind/kcachegrind/traceitemview.h #684569:684570
@@ -24,11 +24,9 @@
#define TRACEITEMVIEW_H
#include "tracedata.h"
-//Added by qt3to4:
-#include <Q3PopupMenu>
class QWidget;
-class Q3PopupMenu;
+class QMenu;
class KConfig;
class KConfigGroup;
@@ -162,8 +160,8 @@
virtual TraceItem* canShow(TraceItem* i) { return i; }
/* convenience functions for often used context menu items */
- void addCostMenu(Q3PopupMenu*,bool withCost2 = true);
- void addGoMenu(Q3PopupMenu*);
+ void addEventTypeMenu(QMenu*,bool withCost2 = true);
+ void addGoMenu(QMenu*);
protected:
// helpers to call selected()/activated() of parentView
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic