From: Maynard J. <may...@us...> - 2011-02-25 18:02:14
|
Maynard Johnson wrote: > Maynard Johnson wrote: >> The attached patch was submitted by Gert Wollny via an oprofile bugzilla >> (https://sourceforge.net/tracker/?func=detail&atid=116191&aid=3090939&group_id=16191). >> The patch makes changes to oprofile gui files to use qt3Support to facilitate >> building with either qt3 or qt4. The configure script now has a new option: >> --enable-gui=[qt3|qt4|yes|no]. If not given or set to yes, the gui build >> defaults to qt3, which is the same as what it has done in the past. >> >> I would like those in the community who build and use the oprofile gui to >> review/test/comment on this patch. > Having gotten no responses to this RFC, positive or negative, I'm assuming there are no objections. Therefore, I will commit this change to the oprofile git repo. This patch has been committed, with the addition of updating doc/oprofile.xml to reflect the change in Qt versions that are required for the GUI. -Maynard > > -Maynard >> >> Thanks. >> -Maynard >> >> Signed-off-by: Gert Wollny <gw....@gm...> >> Acked-by: Maynard Johnson <may...@us...> >> >> ------------------------------------------------------------ >> >> diff -paurN oprofile/ChangeLog op-with-qt3q4/ChangeLog >> --- oprofile/ChangeLog 2011-01-17 10:53:14.000000000 -0600 >> +++ op-with-qt3q4/ChangeLog 2011-01-18 18:12:46.000000000 -0600 >> @@ -1,3 +1,12 @@ >> +2011-01-18 Gert Wollny <gw....@gm...> >> + >> + * configure.in: >> + * gui/Makefile.am: >> + * gui/oprof_start.cpp: >> + * gui/oprof_start.h: >> + * gui/ui/Makefile.am: Add support for building the GUI with >> + QT4[Qt3Support] as alterative to QT3, see bug #3090939. >> + >> 2011-01-17 Will Deacon <wil...@ar...> >> >> * events/arm/armv7-ca9/events: Add missing TLB event >> diff -paurN oprofile/configure.in op-with-qt3q4/configure.in >> --- oprofile/configure.in 2009-12-07 17:47:56.000000000 -0600 >> +++ op-with-qt3q4/configure.in 2011-01-18 18:24:15.000000000 -0600 >> @@ -18,6 +18,7 @@ AM_CONFIG_HEADER(config.h) >> AC_CHECK_DECLS([basename], [], [], [[#include <libgen.h>]]) >> AC_PROG_RANLIB >> AC_PROG_LIBTOOL >> +PKG_PROG_PKG_CONFIG >> >> dnl for the man page >> DATE="`date '+%a %d %B %Y'`" >> @@ -131,7 +132,61 @@ ORIG_X_SAVE_LIBS="$LIBS" >> LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS" >> X_LIBS="$LIBS" >> AC_SUBST(X_LIBS) >> -QT_DO_IT_ALL >> + >> +AC_ARG_ENABLE(gui,[ --enable-gui compile with gui component (qt3|qt4|yes|no), >> + if not given or set to yes, gui defaults to qt3],, enable_gui=qt3) >> + >> +if test "x$enable_gui" = "xqt3" || test "x$enable_gui" = "xyes"; then >> + QT_VERSION=3 >> + QT_DO_IT_ALL >> + QT_LIBS="$QT_LIB $QT_LDFLAGS" >> + QT_CFLAGS="$QT_INCLUDES" >> +fi >> + >> +if test "x$enable_gui" = "xqt4"; then >> + QT_VERSION=4 >> + PKG_CHECK_MODULES(QT, Qt3Support QtGui QtCore ,,[ >> + echo "You requested QT4 but its build files are not available. Exiting now." >> + exit >> + ]) >> + MOC=$(pkg-config --variable=moc_location QtCore) >> + UIC=$(pkg-config --variable=uic_location QtCore)3 >> + QT_VERSION=$(pkg-config --modversion QtCore) >> + >> +dnl following are some sanity tests and workarounds for buggy QtCore.pc files >> + if test "x$MOC" = "x"; then >> + echo "WARNING: Your QtCore.pc file is buggy, it doesn't provide the variable >> 'moc_location'" >> + echo "WARNING: I will try to find it in your PATH ..." >> + AC_CHECK_PROG(MOC, moc, moc) >> + if test "x$MOC" = "x"; then >> + echo "WARNING: You can fix this by adding the location of moc to your path." >> + echo "WARNING: Exiting now." >> + exit >> + fi >> + fi >> + >> + if test "x$UIC" = "x3"; then >> + echo "WARNING: Your QtCore.pc file is buggy, it doesn't provide the variable >> 'uic_location'" >> + echo "WARNING: I will try to find it in your PATH ..." >> + AC_CHECK_PROG(UIChelp, uic3, uic3) >> + if test "x$UIChelp" = "x"; then >> + echo "WARNING: You can fix this by adding the location of uic3 to your path." >> + echo "WARNING: Exiting now." >> + exit >> + else >> + UIC="$UIChelp" >> + fi >> + fi >> + >> + flags_has_qt3support=$(echo $QT_CFLAGS | grep QT3_SUPPORT) >> + if test "x$flags_has_qt3support" = "x" ; then >> + echo "WARNING: Your Qt3Support package is buggy; it dosn't include the >> 'QT3_SUPPORT' flag" >> + echo "WARNING: adding it manually" >> + QT_CFLAGS="$QT_CFLAGS -DQT3_SUPPORT" >> + fi >> +fi >> +AM_CONDITIONAL(have_qt, test -n "$QT_LIBS") >> + >> LIBS="$ORIG_X_SAVE_LIBS" >> >> dnl enable pch for c++ >> @@ -155,7 +210,6 @@ AC_SUBST(POPT_LIBS) >> >> # do NOT put tests here, they will fail in the case X is not installed ! >> >> -AM_CONDITIONAL(have_qt, test -n "$QT_LIB") >> >> AX_CFLAGS_OPTION(OP_CFLAGS,[-W]) >> AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-W]) >> @@ -274,8 +328,14 @@ AC_OUTPUT(Makefile \ >> >> AX_COPY_IF_CHANGE(doc/xsl/catalog-1.xml, doc/xsl/catalog.xml) >> >> -if test -z "$QT_LIB"; then >> - echo "Warning: a working Qt not found; no GUI will be built" >> +if test "x$enable_gui" = "xno" ; then >> + echo "No GUI will be built as it was explicitly disabled." >> +else >> + if test -z "$QT_LIBS"; then >> + echo "Warning: QT version $QT_VERSION was requested but not found. No GUI >> will be built." >> + else >> + echo "Building GUI with QT $QT_VERSION" >> + fi >> fi >> >> if ! test "x$enable_account_check" = "xyes"; then >> diff -paurN oprofile/gui/Makefile.am op-with-qt3q4/gui/Makefile.am >> --- oprofile/gui/Makefile.am 2003-11-06 13:45:54.000000000 -0600 >> +++ op-with-qt3q4/gui/Makefile.am 2011-01-18 18:12:14.000000000 -0600 >> @@ -14,7 +14,7 @@ EXTRA_DIST = $(dist_sources) >> if have_qt >> >> AM_CPPFLAGS = \ >> - @QT_INCLUDES@ \ >> + @QT_CFLAGS@ \ >> -I ${top_srcdir}/libop \ >> -I ${top_srcdir}/libutil++ \ >> -I ${top_srcdir}/libutil >> @@ -30,8 +30,7 @@ oprof_start_LDADD = \ >> ../libop/libop.a \ >> ../libutil/libutil.a \ >> ui/liboprof_start.a \ >> - @QT_LDFLAGS@ \ >> - @QT_LIB@ \ >> + @QT_LIBS@ \ >> @X_LIBS@ >> >> oprof_start.moc.cpp: ${top_srcdir}/gui/oprof_start.h >> diff -paurN oprofile/gui/oprof_start.cpp op-with-qt3q4/gui/oprof_start.cpp >> --- oprofile/gui/oprof_start.cpp 2009-06-05 10:26:38.000000000 -0500 >> +++ op-with-qt3q4/gui/oprof_start.cpp 2011-01-18 18:12:14.000000000 -0600 >> @@ -20,21 +20,37 @@ >> #include <fstream> >> #include <algorithm> >> >> +#if QT3_SUPPORT >> +#include <Qt/qlineedit.h> >> +#include <Qt/qcheckbox.h> >> +#include <Qt/qtabwidget.h> >> +#include <Qt/qmessagebox.h> >> +#include <Qt/qvalidator.h> >> +#include <Qt/qlabel.h> >> +#include <Qt/qpushbutton.h> >> +#include <Qt/q3listview.h> >> +#include <Qt/q3combobox.h> >> +#include <Qt/q3listbox.h> >> +#include <Qt/q3filedialog.h> >> +#include <Qt/q3buttongroup.h> >> +#include <Qt/q3header.h> >> +#else >> #include <qlineedit.h> >> -#include <qlistview.h> >> -#include <qcombobox.h> >> -#include <qlistbox.h> >> -#include <qfiledialog.h> >> -#include <qbuttongroup.h> >> #include <qcheckbox.h> >> #include <qtabwidget.h> >> #include <qmessagebox.h> >> #include <qvalidator.h> >> #include <qlabel.h> >> #include <qpushbutton.h> >> +#include <qlistview.h> >> +#include <qcombobox.h> >> +#include <qlistbox.h> >> +#include <qfiledialog.h> >> +#include <qbuttongroup.h> >> #include <qheader.h> >> +#define Q3ListView QListView >> +#endif >> >> -#include "config.h" >> #include "oprof_start.h" >> #include "op_config.h" >> #include "op_config_24.h" >> @@ -268,10 +284,10 @@ void oprof_start::fill_events() >> namespace { >> >> /// find the first item with the given text in column 0 or return NULL >> -QListViewItem * findItem(QListView * view, char const * name) >> +Q3ListViewItem * findItem(Q3ListView * view, char const * name) >> { >> // Qt 2.3.1 does not have QListView::findItem() >> - QListViewItem * item = view->firstChild(); >> + Q3ListViewItem * item = view->firstChild(); >> >> while (item && strcmp(item->text(0).latin1(), name)) >> item = item->nextSibling(); >> @@ -292,7 +308,7 @@ void oprof_start::setup_default_event() >> event_cfgs[descr.name].user_ring_count = 1; >> event_cfgs[descr.name].os_ring_count = 1; >> >> - QListViewItem * item = findItem(events_list, descr.name); >> + Q3ListViewItem * item = findItem(events_list, descr.name); >> if (item) >> item->setSelected(true); >> } >> @@ -349,7 +365,7 @@ void oprof_start::read_set_events() >> event_cfgs[ev_name].os_ring_count = 1; >> } >> >> - QListViewItem * item = findItem(events_list, ev_name.c_str()); >> + Q3ListViewItem * item = findItem(events_list, ev_name.c_str()); >> if (item) >> item->setSelected(true); >> } >> @@ -436,7 +452,7 @@ void oprof_start::fill_events_listbox() >> >> for (vector<op_event_descr>::reverse_iterator cit = v_events.rbegin(); >> cit != v_events.rend(); ++cit) { >> - new QListViewItem(events_list, cit->name.c_str()); >> + new Q3ListViewItem(events_list, cit->name.c_str()); >> } >> >> setUpdatesEnabled(true); >> @@ -467,7 +483,7 @@ void oprof_start::display_event(op_event >> } >> >> >> -bool oprof_start::is_selectable_event(QListViewItem * item) >> +bool oprof_start::is_selectable_event(Q3ListViewItem * item) >> { >> if (item->isSelected()) >> return true; >> @@ -486,7 +502,7 @@ bool oprof_start::is_selectable_event(QL >> >> void oprof_start::draw_event_list() >> { >> - QListViewItem * cur; >> + Q3ListViewItem * cur; >> for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) { >> if (is_selectable_event(cur)) >> cur->setPixmap(0, *green_pixmap); >> @@ -500,7 +516,7 @@ bool oprof_start::alloc_selected_events( >> { >> vector<op_event const *> events; >> >> - set<QListViewItem *>::const_iterator it; >> + set<Q3ListViewItem *>::const_iterator it; >> for (it = selected_events.begin(); it != selected_events.end(); ++it) >> events.push_back(find_event_by_name((*it)->text(0).latin1(),0,0)); >> >> @@ -520,24 +536,24 @@ void oprof_start::event_selected() >> // (de)selected item so we record a set of selected items and diff >> // it in the appropriate way with the previous list of selected items. >> >> - set<QListViewItem *> current_selection; >> - QListViewItem * cur; >> + set<Q3ListViewItem *> current_selection; >> + Q3ListViewItem * cur; >> for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) { >> if (cur->isSelected()) >> current_selection.insert(cur); >> } >> >> // First remove the deselected item. >> - vector<QListViewItem *> new_deselected; >> + vector<Q3ListViewItem *> new_deselected; >> set_difference(selected_events.begin(), selected_events.end(), >> current_selection.begin(), current_selection.end(), >> back_inserter(new_deselected)); >> - vector<QListViewItem *>::const_iterator it; >> + vector<Q3ListViewItem *>::const_iterator it; >> for (it = new_deselected.begin(); it != new_deselected.end(); ++it) >> selected_events.erase(*it); >> >> // Now try to add the newly selected item if enough HW resource exists >> - vector<QListViewItem *> new_selected; >> + vector<Q3ListViewItem *> new_selected; >> set_difference(current_selection.begin(), current_selection.end(), >> selected_events.begin(), selected_events.end(), >> back_inserter(new_selected)); >> @@ -558,7 +574,7 @@ void oprof_start::event_selected() >> } >> >> >> -void oprof_start::event_over(QListViewItem * item) >> +void oprof_start::event_over(Q3ListViewItem * item) >> { >> op_event_descr const & descr = locate_event(item->text(0).latin1()); >> >> @@ -566,10 +582,10 @@ void oprof_start::event_over(QListViewIt >> if (!is_selectable_event(item)) { >> help_str += " conflicts with:"; >> >> - set<QListViewItem *>::const_iterator it; >> + set<Q3ListViewItem *>::const_iterator it; >> for (it = selected_events.begin(); >> it != selected_events.end(); ) { >> - QListViewItem * temp = *it; >> + Q3ListViewItem * temp = *it; >> selected_events.erase(it++); >> if (is_selectable_event(item)) { >> help_str += " "; >> @@ -844,7 +860,7 @@ void oprof_start::on_start_profiler() >> >> bool one_enable = false; >> >> - QListViewItem * cur; >> + Q3ListViewItem * cur; >> for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) { >> if (!cur->isSelected()) >> continue; >> @@ -946,7 +962,7 @@ bool oprof_start::save_config() >> vector<string> tmpargs; >> tmpargs.push_back("--setup"); >> >> - QListViewItem * cur; >> + Q3ListViewItem * cur; >> for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) { >> if (!cur->isSelected()) >> continue; >> diff -paurN oprofile/gui/oprof_start.h op-with-qt3q4/gui/oprof_start.h >> --- oprofile/gui/oprof_start.h 2005-08-14 06:17:35.000000000 -0500 >> +++ op-with-qt3q4/gui/oprof_start.h 2011-01-18 18:12:14.000000000 -0600 >> @@ -16,11 +16,17 @@ >> #include <map> >> #include <set> >> >> +#include "config.h" >> + >> #include "ui/oprof_start.base.h" >> #include "oprof_start_config.h" >> >> #include "op_events.h" >> >> +#ifndef QT3_SUPPORT >> +#define Q3ListViewItem QListViewItem >> +#endif >> + >> class QIntValidator; >> class QListViewItem; >> class QTimerEvent; >> @@ -62,7 +68,7 @@ protected slots: >> /// events selection change >> void event_selected(); >> /// the mouse is over an event >> - void event_over(QListViewItem *); >> + void event_over(Q3ListViewItem *); >> /// state of separate_kernel_cb changed >> void on_separate_kernel_cb_changed(int); >> /// reset sample files >> @@ -121,7 +127,7 @@ private: >> void draw_event_list(); >> >> /// return true if item is selectable or already selected >> - bool is_selectable_event(QListViewItem * item); >> + bool is_selectable_event(Q3ListViewItem * item); >> >> /// try to alloc counters for the selected_events >> bool alloc_selected_events() const; >> @@ -139,8 +145,8 @@ private: >> /// The currently selected events. We must track this because >> /// with multiple selection listbox QT doesn't allow to know >> /// what is the last selected item. events_selected() update it >> - std::set<QListViewItem *> selected_events; >> - QListViewItem * current_event; >> + std::set<Q3ListViewItem *> selected_events; >> + Q3ListViewItem * current_event; >> >> /// current config >> config_setting config; >> diff -paurN oprofile/gui/ui/Makefile.am op-with-qt3q4/gui/ui/Makefile.am >> --- oprofile/gui/ui/Makefile.am 2003-05-21 14:36:16.000000000 -0500 >> +++ op-with-qt3q4/gui/ui/Makefile.am 2011-01-18 18:12:14.000000000 -0600 >> @@ -2,7 +2,7 @@ EXTRA_DIST = oprof_start.base.ui >> >> if have_qt >> >> -AM_CPPFLAGS = @QT_INCLUDES@ >> +AM_CPPFLAGS = @QT_CFLAGS@ >> >> AM_CXXFLAGS = @OP_CXXFLAGS@ >> >> >> >> ------------------------------------------------------------------------------ >> Protect Your Site and Customers from Malware Attacks >> Learn about various malware tactics and how to avoid them. Understand >> malware threats, the impact they can have on your business, and how you >> can protect your company and customers by using code signing. >> http://p.sf.net/sfu/oracle-sfdevnl >> _______________________________________________ >> oprofile-list mailing list >> opr...@li... >> https://lists.sourceforge.net/lists/listinfo/oprofile-list > |