From: Zack Rusin Date: Sun, 3 Apr 2011 18:30:19 +0000 (-0400) Subject: Allow setting of the filter options. X-Git-Tag: 2.0_alpha^2~1150^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e17455750b302f1cb0750c501ab7593a8846d34e;p=tools%2Fapitrace.git Allow setting of the filter options. --- diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index 14e9e96..7917104 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -7,6 +7,7 @@ set(qapitrace_SRCS loaderthread.cpp mainwindow.cpp main.cpp + settingsdialog.cpp ) qt4_automoc(${qapitrace_SRCS}) @@ -14,7 +15,8 @@ qt4_automoc(${qapitrace_SRCS}) qt4_add_resources(qapitrace_SRCS qapitrace.qrc) set(qapitrace_UIS - ui/mainwindow.ui) + ui/mainwindow.ui + ui/settings.ui) QT4_WRAP_UI(qapitrace_UIS_H ${qapitrace_UIS}) diff --git a/gui/apitracefilter.cpp b/gui/apitracefilter.cpp index c467a8c..fdee2bb 100644 --- a/gui/apitracefilter.cpp +++ b/gui/apitracefilter.cpp @@ -6,7 +6,9 @@ #include ApiTraceFilter::ApiTraceFilter(QObject *parent) - : QSortFilterProxyModel() + : QSortFilterProxyModel(), + m_filters(ExtensionsFilter | ResolutionsFilter | + ErrorsQueryFilter | ExtraStateFilter) { } @@ -33,16 +35,31 @@ bool ApiTraceFilter::filterAcceptsRow(int sourceRow, return function.contains(m_text); } - //XXX make it configurable - if (function.contains(QLatin1String("glXGetProcAddress"))) - return false; - if (function.contains(QLatin1String("wglGetProcAddress"))) - return false; + if (m_filters & ResolutionsFilter) { + if (function.contains(QLatin1String("glXGetProcAddress"))) + return false; + if (function.contains(QLatin1String("wglGetProcAddress"))) + return false; + } - QString fullText = call->filterText(); - if (function.contains(QLatin1String("glGetString")) && - fullText.contains(QLatin1String("GL_EXTENSIONS"))) - return false; + if (m_filters & ExtensionsFilter) { + QString fullText = call->filterText(); + if (function.contains(QLatin1String("glGetString")) && + fullText.contains(QLatin1String("GL_EXTENSIONS"))) + return false; + if (function.contains(QLatin1String("glXGetClientString"))) + return false; + } + + if (m_filters & ErrorsQueryFilter) { + if (function.contains(QLatin1String("glGetError"))) + return false; + } + + if (m_filters & ExtraStateFilter) { + if (function.contains(QLatin1String("glXGetCurrentDisplay"))) + return false; + } return true; } @@ -56,4 +73,17 @@ void ApiTraceFilter::setFilterString(const QString &text) } } +ApiTraceFilter::FilterOptions ApiTraceFilter::filterOptions() const +{ + return m_filters; +} + +void ApiTraceFilter::setFilterOptions(ApiTraceFilter::FilterOptions opts) +{ + if (opts != m_filters) { + m_filters = opts; + invalidate(); + } +} + #include "apitracefilter.moc" diff --git a/gui/apitracefilter.h b/gui/apitracefilter.h index f2ad91b..fa59397 100644 --- a/gui/apitracefilter.h +++ b/gui/apitracefilter.h @@ -6,16 +6,28 @@ class ApiTraceFilter : public QSortFilterProxyModel { Q_OBJECT - +public: + enum FilterOption { + NullFilter = 0, + ExtensionsFilter = 1 << 0, + ResolutionsFilter = 1 << 1, + ErrorsQueryFilter = 1 << 2, + ExtraStateFilter = 1 << 3, + }; + Q_DECLARE_FLAGS(FilterOptions, FilterOption) public: ApiTraceFilter(QObject *parent = 0); + FilterOptions filterOptions() const; + void setFilterOptions(FilterOptions opts); + void setFilterString(const QString &text); protected: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; private: QString m_text; + FilterOptions m_filters; }; #endif diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 93add0e..0a3349b 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -5,6 +5,7 @@ #include "apicalldelegate.h" #include "apitracemodel.h" #include "apitracefilter.h" +#include "settingsdialog.h" #include @@ -70,6 +71,8 @@ MainWindow::MainWindow() this, SLOT(replayStop())); connect(m_ui.actionLookupState, SIGNAL(triggered()), this, SLOT(lookupState())); + connect(m_ui.actionOptions, SIGNAL(triggered()), + this, SLOT(showSettings())); connect(m_ui.callView, SIGNAL(activated(const QModelIndex &)), this, SLOT(callItemSelected(const QModelIndex &))); @@ -358,4 +361,14 @@ void MainWindow::fillStateForFrame() m_ui.stateDock->show(); } +void MainWindow::showSettings() +{ + SettingsDialog dialog; + dialog.setFilterOptions(m_proxyModel->filterOptions()); + + if (dialog.exec() == QDialog::Accepted) { + m_proxyModel->setFilterOptions(dialog.filterOptions()); + } +} + #include "mainwindow.moc" diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 0f8e215..e66bd93 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -41,6 +41,7 @@ private slots: void startedLoadingTrace(); void finishedLoadingTrace(); void lookupState(); + void showSettings(); private: void newTraceFile(const QString &fileName); diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp new file mode 100644 index 0000000..eab63dd --- /dev/null +++ b/gui/settingsdialog.cpp @@ -0,0 +1,37 @@ +#include "settingsdialog.h" + +SettingsDialog::SettingsDialog(QWidget *parent) + : QDialog(parent) +{ + setupUi(this); +} + +void SettingsDialog::accept() +{ + m_filterOptions = ApiTraceFilter::NullFilter; + if (extensionsBox->isChecked()) + m_filterOptions |= ApiTraceFilter::ExtensionsFilter; + if (functionsBox->isChecked()) + m_filterOptions |= ApiTraceFilter::ResolutionsFilter; + if (errorsBox->isChecked()) + m_filterOptions |= ApiTraceFilter::ErrorsQueryFilter; + if (statesBox->isChecked()) + m_filterOptions |= ApiTraceFilter::ExtraStateFilter; + QDialog::accept(); +} + +void SettingsDialog::setFilterOptions(ApiTraceFilter::FilterOptions opts) +{ + m_filterOptions = opts; + extensionsBox->setChecked(m_filterOptions & ApiTraceFilter::ExtensionsFilter); + functionsBox->setChecked(m_filterOptions & ApiTraceFilter::ResolutionsFilter); + errorsBox->setChecked(m_filterOptions & ApiTraceFilter::ErrorsQueryFilter); + statesBox->setChecked(m_filterOptions & ApiTraceFilter::ExtraStateFilter); +} + +ApiTraceFilter::FilterOptions SettingsDialog::filterOptions() const +{ + return m_filterOptions; +} + +#include "settingsdialog.moc" diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h new file mode 100644 index 0000000..6c82b40 --- /dev/null +++ b/gui/settingsdialog.h @@ -0,0 +1,23 @@ +#ifndef SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include "apitracefilter.h" +#include "ui_settings.h" +#include + + +class SettingsDialog : public QDialog, public Ui_Settings +{ + Q_OBJECT +public: + SettingsDialog(QWidget *parent = 0); + void accept(); + + void setFilterOptions(ApiTraceFilter::FilterOptions opts); + ApiTraceFilter::FilterOptions filterOptions() const; + +private: + ApiTraceFilter::FilterOptions m_filterOptions; +}; + +#endif diff --git a/gui/ui/mainwindow.ui b/gui/ui/mainwindow.ui index d4bea82..76e0e8b 100644 --- a/gui/ui/mainwindow.ui +++ b/gui/ui/mainwindow.ui @@ -54,6 +54,8 @@ + + @@ -224,6 +226,11 @@ Lookup State + + + Options + + diff --git a/gui/ui/settings.ui b/gui/ui/settings.ui new file mode 100644 index 0000000..1e84070 --- /dev/null +++ b/gui/ui/settings.ui @@ -0,0 +1,101 @@ + + + Settings + + + + 0 + 0 + 316 + 128 + + + + QApiTrace Settings + + + + + + Filtered Events + + + + + + Extension queries + + + + + + + Function resolution + + + + + + + Error queries + + + + + + + Extra state queries + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + Settings + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Settings + reject() + + + 316 + 260 + + + 286 + 274 + + + + +