Skip to contentSkip to conversation

Cosmetic modifications in KsQuickContextMenu

PATCH Applied Yordan Karadzhov 2 participants 7 messages Jan 10, 2019

lore
Share & tools
lore
#0 lore raw

cover Cosmetic modifications in KsQuickContextMenu

All modifications to the KsQuickContextMenu done in this series of patches have been sent already, but as a single patch ([PATCH v2 2/6]) The original patch was divided in order to provide a clean sequence of distinct changes.

Yordan Karadzhov (5):
kernel-shark-qt: Remove _deselectAction from KsQuickContextMenu
kernel-shark-qt: Remove the "Apply to" checkboxes from
KsQuickContextMenu
kernel-shark-qt: Rearrange the KsQuickContextMenu menu
kernel-shark-qt: Add "clear all filters" action to KsQuickContextMenu
kernel-shark-qt: Add section separator in KsQuickContextMenu

 kernel-shark-qt/src/KsQuickContextMenu.cpp | 63 +++++++---------------
 kernel-shark-qt/src/KsQuickContextMenu.hpp |  4 +-
 2 files changed, 23 insertions(+), 44 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/5 kernel-shark-qt: Remove _deselectAction from KsQuickContextMenu

The action used to deselect the active marker gets inherited from KsQuickMarkerMenu. This makes the declaration of an identical data member in class KsQuickContextMenu ambiguous.

---
 kernel-shark-qt/src/KsQuickContextMenu.cpp | 3 +--
 kernel-shark-qt/src/KsQuickContextMenu.hpp | 2 --
 2 files changed, 1 insertion(+), 4 deletions(-)
kernel-shark-qt/src/KsQuickContextMenu.cpp +1 -2
index 6c9c9ef..b41adb9 100644
@@ -61,8 +61,7 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
   _addCPUPlotAction(this),
   _addTaskPlotAction(this),
   _removeCPUPlotAction(this),
-  _removeTaskPlotAction(this),
-  _deselectAction(this)
+  _removeTaskPlotAction(this)
 {
 	typedef void (KsQuickContextMenu::*mfp)();
 	QString taskName, parentName, descr;
kernel-shark-qt/src/KsQuickContextMenu.hpp +0 -2
index f5a2a78..670d010 100644
@@ -104,8 +104,6 @@ private:
 	QAction _removeCPUPlotAction;
 
 	QAction _removeTaskPlotAction;
-
-	QAction _deselectAction;
 };
 
 /**
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/5 kernel-shark-qt: Remove the "Apply to" checkboxes from KsQuickContextMenu

In reply to Yordan Karadzhov

"Apply to list/graph" checkboxes are available in the "Filter" top menu. Having the same checkboxes in the Context menu is a potential source of confusion for the user.

---
 kernel-shark-qt/src/KsQuickContextMenu.cpp | 30 ----------------------
 1 file changed, 30 deletions(-)
kernel-shark-qt/src/KsQuickContextMenu.cpp +0 -30
index b41adb9..4f922a2 100644
@@ -88,36 +88,6 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 
 	addSection("Pointer menu");
 
-	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 = "Hide task [";
 	descr += taskName;
 	descr += "-";
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/5 kernel-shark-qt: Rearrange the KsQuickContextMenu menu

In reply to Yordan Karadzhov

Swaps the position of the Show / Hide actions in the menu. This is done because we expect the "Show" actions to be used more often.

---
 kernel-shark-qt/src/KsQuickContextMenu.cpp | 26 ++++++++++++----------
 1 file changed, 14 insertions(+), 12 deletions(-)
kernel-shark-qt/src/KsQuickContextMenu.cpp +14 -12
index 4f922a2..7ab5a5f 100644
@@ -88,13 +88,6 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 
 	addSection("Pointer menu");
 
-	descr = "Hide task [";
-	descr += taskName;
-	descr += "-";
-	descr += QString("%1").arg(pid);
-	descr += "]";
-	lamAddAction(&_hideTaskAction, &KsQuickContextMenu::_hideTask);
-
 	descr = "Show task [";
 	descr += taskName;
 	descr += "-";
@@ -102,23 +95,32 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 	descr += "] only";
 	lamAddAction(&_showTaskAction, &KsQuickContextMenu::_showTask);
 
-	descr = "Hide event [";
-	descr += kshark_get_event_name_easy(_data->rows()[_row]);
+	descr = "Hide task [";
+	descr += taskName;
+	descr += "-";
+	descr += QString("%1").arg(pid);
 	descr += "]";
-	lamAddAction(&_hideEventAction, &KsQuickContextMenu::_hideEvent);
+	lamAddAction(&_hideTaskAction, &KsQuickContextMenu::_hideTask);
 
 	descr = "Show event [";
 	descr += kshark_get_event_name_easy(_data->rows()[_row]);
 	descr += "] only";
 	lamAddAction(&_showEventAction, &KsQuickContextMenu::_showEvent);
 
-	descr = QString("Hide CPU [%1]").arg(_data->rows()[_row]->cpu);
-	lamAddAction(&_hideCPUAction, &KsQuickContextMenu::_hideCPU);
+	descr = "Hide event [";
+	descr += kshark_get_event_name_easy(_data->rows()[_row]);
+	descr += "]";
+	lamAddAction(&_hideEventAction, &KsQuickContextMenu::_hideEvent);
 
 	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 = "Add [";
 		descr += taskName;
 		descr += "-";
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/5 kernel-shark-qt: Add "clear all filters" action to KsQuickContextMenu

In reply to Yordan Karadzhov

A quick access to this action can save time and be very useful.

---
 kernel-shark-qt/src/KsQuickContextMenu.cpp | 6 +++++-
 kernel-shark-qt/src/KsQuickContextMenu.hpp | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)
kernel-shark-qt/src/KsQuickContextMenu.cpp +5 -1
index 7ab5a5f..231ca38 100644
@@ -61,7 +61,8 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
   _addCPUPlotAction(this),
   _addTaskPlotAction(this),
   _removeCPUPlotAction(this),
-  _removeTaskPlotAction(this)
+  _removeTaskPlotAction(this),
+  _clearAllFilters(this)
 {
 	typedef void (KsQuickContextMenu::*mfp)();
 	QString taskName, parentName, descr;
@@ -120,6 +121,9 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 	descr = QString("Hide CPU [%1]").arg(_data->rows()[_row]->cpu);
 	lamAddAction(&_hideCPUAction, &KsQuickContextMenu::_hideCPU);
 
+	descr = "Clear all filters";
+	lamAddAction(&_clearAllFilters, &KsQuickContextMenu::_clearFilters);
+
 	if (parentName == "KsTraceViewer") {
 		descr = "Add [";
 		descr += taskName;
kernel-shark-qt/src/KsQuickContextMenu.hpp +4 -0
index 670d010..df8a65b 100644
@@ -85,6 +85,8 @@ private:
 
 	QVector<int> _getFilterVector(tracecmd_filter_id *filter, int newId);
 
+	void _clearFilters() {_data->clearAllFilters();}
+
 	KsDataStore	*_data;
 
 	size_t		_row;
@@ -104,6 +106,8 @@ private:
 	QAction _removeCPUPlotAction;
 
 	QAction _removeTaskPlotAction;
+
+	QAction _clearAllFilters;
 };
 
 /**
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/5 kernel-shark-qt: Add section separator in KsQuickContextMenu

In reply to Yordan Karadzhov

Adding a separator between the filter-related and the plot-related actions in the menu helps the user to get orientation.

---
 kernel-shark-qt/src/KsQuickContextMenu.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel-shark-qt/src/KsQuickContextMenu.cpp +3 -1
index 231ca38..728ecbd 100644
@@ -87,7 +87,7 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 
 	parentName = parent->metaObject()->className();
 
-	addSection("Pointer menu");
+	addSection("Pointer filter menu");
 
 	descr = "Show task [";
 	descr += taskName;
@@ -124,6 +124,8 @@ KsQuickContextMenu::KsQuickContextMenu(KsDataStore *data, size_t row,
 	descr = "Clear all filters";
 	lamAddAction(&_clearAllFilters, &KsQuickContextMenu::_clearFilters);
 
+	addSection("Pointer plot menu");
+
 	if (parentName == "KsTraceViewer") {
 		descr = "Add [";
 		descr += taskName;
Signature · 1 line
2.17.1
#6 lore raw
In reply to Yordan Karadzhov
Quoted 13 lines · On Thu, 10 Jan 2019 15:44:14 +0200 Yordan Karadzhov <[email protected]>…

All modifications to the KsQuickContextMenu done in this series of patches have been sent already, but as a single patch ([PATCH v2 2/6]) The original patch was divided in order to provide a clean sequence of distinct changes.

Yordan Karadzhov (5):
kernel-shark-qt: Remove _deselectAction from KsQuickContextMenu
kernel-shark-qt: Remove the "Apply to" checkboxes from
KsQuickContextMenu
kernel-shark-qt: Rearrange the KsQuickContextMenu menu
kernel-shark-qt: Add "clear all filters" action to KsQuickContextMenu
kernel-shark-qt: Add section separator in KsQuickContextMenu

Quoted 4 lines
 kernel-shark-qt/src/KsQuickContextMenu.cpp | 63 +++++++---------------
 kernel-shark-qt/src/KsQuickContextMenu.hpp |  4 +-
 2 files changed, 23 insertions(+), 44 deletions(-)

Applied. Thanks a lot Yordan!

-- Steve