diff mbox series

[2/4] kernel-shark-qt: Cosmetic modifications in KsQuickContextMenu

Message ID 20190104195726.24264-2-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Headers show
Series [1/4] kernel-shark-qt: Rearrange the "Filter" top menu | expand

Commit Message

Yordan Karadzhov Jan. 4, 2019, 7:57 p.m. UTC
This patch does the following minor modifications in
KsQuickContextMenu:
1. Removes the "Apply to list/graph" check-boxes.
2. Swaps the position of the Show / Hide actions
3. Adds "clear all filters" action.

The code that adds the check-boxes is commented out, because we may
change our opinion in the future.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/KsQuickContextMenu.cpp | 94 ++++++++++++----------
 kernel-shark-qt/src/KsQuickContextMenu.hpp |  4 +-
 2 files changed, 54 insertions(+), 44 deletions(-)

Comments

Steven Rostedt Jan. 4, 2019, 9:31 p.m. UTC | #1
On Fri, 4 Jan 2019 19:57:52 +0000
Yordan Karadzhov <ykaradzhov@vmware.com> wrote:

> This patch does the following minor modifications in

FYI, it is looked down to say "This patch" or "This commit" as people
know what it is. I've seen maintainers get really annoyed by it. I
don't care as much, but I'd like to keep the same requirements as
upstream Linux kernel.


> KsQuickContextMenu:
> 1. Removes the "Apply to list/graph" check-boxes.
> 2. Swaps the position of the Show / Hide actions
> 3. Adds "clear all filters" action.

These should each be a separate patch (one patch that does one thing).

> 
> The code that adds the check-boxes is commented out, because we may
> change our opinion in the future.

Again, lets refrain from commenting out code, and just delete it. git
history will archive it for us ;-)

-- Steve

> 
> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
> ---
>  kernel-shark-qt/src/KsQuickContextMenu.cpp | 94 ++++++++++++----------
>  kernel-shark-qt/src/KsQuickContextMenu.hpp |  4 +-
>  2 files changed, 54 insertions(+), 44 deletions(-)
> 
> diff --git a/kernel-shark-qt/src/KsQuickContextMenu.cpp b/kernel-shark-qt/src/KsQuickContextMenu.cpp
> index 6c9c9ef..3d190f3 100644
> --- a/kernel-shark-qt/src/KsQuickContextMenu.cpp
> +++ b/kernel-shark-qt/src/KsQuickContextMenu.cpp
> @@ -62,7 +62,7 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
>    _addTaskPlotAction(this),
>    _removeCPUPlotAction(this),
>    _removeTaskPlotAction(this),
> -  _deselectAction(this)
> +  _clearAllFilters(this)
>  {
>  	typedef void (KsQuickContextMenu::*mfp)();
>  	QString taskName, parentName, descr;
> @@ -87,37 +87,45 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
>  
>  	parentName = parent->metaObject()->className();
>
diff mbox series

Patch

diff --git a/kernel-shark-qt/src/KsQuickContextMenu.cpp b/kernel-shark-qt/src/KsQuickContextMenu.cpp
index 6c9c9ef..3d190f3 100644
--- a/kernel-shark-qt/src/KsQuickContextMenu.cpp
+++ b/kernel-shark-qt/src/KsQuickContextMenu.cpp
@@ -62,7 +62,7 @@  KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
   _addTaskPlotAction(this),
   _removeCPUPlotAction(this),
   _removeTaskPlotAction(this),
-  _deselectAction(this)
+  _clearAllFilters(this)
 {
 	typedef void (KsQuickContextMenu::*mfp)();
 	QString taskName, parentName, descr;
@@ -87,37 +87,45 @@  KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 
 	parentName = parent->metaObject()->className();
 
-	addSection("Pointer menu");
+	addSection("Pointer filter menu");
+
+// 	if (parentName == "KsTraceViewer" &&
+// 	    list = dynamic_cast<KsTraceViewer *>(parent))) {
+// 		_graphSyncCBox =
+// 			KsUtils::addCheckBoxToMenu(this, "Apply filters to Graph");
+//
+// 		connect(_graphSyncCBox,	&QCheckBox::stateChanged,
+// 					&KsUtils::graphFilterSync);
+//
+// 		/*
+// 		 * By defauls the filters will be append to the List (Table)
+// 		 * only.
+// 		 */
+// 		KsUtils::listFilterSync(true);
+// 		KsUtils::graphFilterSync(false);
+// 		_graphSyncCBox->setChecked(false);
+// 	}
+
+// 	if (parentName == "KsTraceGraph" &&
+// 	    (graphs = dynamic_cast<KsTraceGraph *>(parent))) {
+// 		_listSyncCBox =
+// 			KsUtils::addCheckBoxToMenu(this, "Apply filters to List");
+//
+// 		connect(_listSyncCBox,	&QCheckBox::stateChanged,
+// 					&KsUtils::listFilterSync);
+//
+// 		/* By defauls the filters will be append to the Graph only. */
+// 		KsUtils::graphFilterSync(true);
+// 		KsUtils::listFilterSync(false);
+// 		_listSyncCBox->setChecked(false);
+// 	}
 
-	if (parentName == "KsTraceViewer") {
-		_graphSyncCBox =
-			KsUtils::addCheckBoxToMenu(this, "Apply filters to Graph");
-
-		connect(_graphSyncCBox,	&QCheckBox::stateChanged,
-					&KsUtils::graphFilterSync);
-
-		/*
-		 * By defauls the filters will be append to the List (Table)
-		 * only.
-		 */
-		KsUtils::listFilterSync(true);
-		KsUtils::graphFilterSync(false);
-		_graphSyncCBox->setChecked(false);
-	}
-
-	if (parentName == "KsTraceGraph" &&
-	    (graphs = dynamic_cast<KsTraceGraph *>(parent))) {
-		_listSyncCBox =
-			KsUtils::addCheckBoxToMenu(this, "Apply filters to List");
-
-		connect(_listSyncCBox,	&QCheckBox::stateChanged,
-					&KsUtils::listFilterSync);
-
-		/* By defauls the filters will be append to the Graph only. */
-		KsUtils::graphFilterSync(true);
-		KsUtils::listFilterSync(false);
-		_listSyncCBox->setChecked(false);
-	}
+	descr = "Show task [";
+	descr += taskName;
+	descr += "-";
+	descr += QString("%1").arg(pid);
+	descr += "] only";
+	lamAddAction(&_showTaskAction, &KsQuickContextMenu::_showTask);
 
 	descr = "Hide task [";
 	descr += taskName;
@@ -126,30 +134,30 @@  KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 	descr += "]";
 	lamAddAction(&_hideTaskAction, &KsQuickContextMenu::_hideTask);
 
-	descr = "Show task [";
-	descr += taskName;
-	descr += "-";
-	descr += QString("%1").arg(pid);
+	descr = "Show event [";
+	descr += kshark_get_event_name_easy(_data->rows()[_row]);
 	descr += "] only";
-	lamAddAction(&_showTaskAction, &KsQuickContextMenu::_showTask);
+	lamAddAction(&_showEventAction, &KsQuickContextMenu::_showEvent);
 
 	descr = "Hide event [";
 	descr += kshark_get_event_name_easy(_data->rows()[_row]);
 	descr += "]";
 	lamAddAction(&_hideEventAction, &KsQuickContextMenu::_hideEvent);
 
-	descr = "Show event [";
-	descr += kshark_get_event_name_easy(_data->rows()[_row]);
-	descr += "] only";
-	lamAddAction(&_showEventAction, &KsQuickContextMenu::_showEvent);
+	if (parentName == "KsTraceViewer") {
+		descr = QString("Show CPU [%1] only").arg(cpu);
+		lamAddAction(&_showCPUAction, &KsQuickContextMenu::_showCPU);
+	}
 
 	descr = QString("Hide CPU [%1]").arg(_data->rows()[_row]->cpu);
 	lamAddAction(&_hideCPUAction, &KsQuickContextMenu::_hideCPU);
 
-	if (parentName == "KsTraceViewer") {
-		descr = QString("Show CPU [%1] only").arg(cpu);
-		lamAddAction(&_showCPUAction, &KsQuickContextMenu::_showCPU);
+	descr = "Clear all filters";
+	lamAddAction(&_clearAllFilters, &KsQuickContextMenu::_clearFilters);
 
+	addSection("Pointer plot menu");
+
+	if (parentName == "KsTraceViewer") {
 		descr = "Add [";
 		descr += taskName;
 		descr += "-";
diff --git a/kernel-shark-qt/src/KsQuickContextMenu.hpp b/kernel-shark-qt/src/KsQuickContextMenu.hpp
index f5a2a78..df8a65b 100644
--- a/kernel-shark-qt/src/KsQuickContextMenu.hpp
+++ b/kernel-shark-qt/src/KsQuickContextMenu.hpp
@@ -85,6 +85,8 @@  private:
 
 	QVector<int> _getFilterVector(tracecmd_filter_id *filter, int newId);
 
+	void _clearFilters() {_data->clearAllFilters();}
+
 	KsDataStore	*_data;
 
 	size_t		_row;
@@ -105,7 +107,7 @@  private:
 
 	QAction _removeTaskPlotAction;
 
-	QAction _deselectAction;
+	QAction _clearAllFilters;
 };
 
 /**