diff mbox series

[3/3] kernel-shark: Don't try to update the markers if no data is loaded

Message ID 20190715132042.5154-4-y.karadz@gmail.com (mailing list archive)
State Superseded
Headers show
Series Fixes needed befor KS 1.0 | expand

Commit Message

Yordan Karadzhov July 15, 2019, 1:20 p.m. UTC
This change aims to avoid showing the labels of the time axis (zeros)
when no data is loaded.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsMainWindow.cpp | 18 ++++++++++++------
 kernel-shark/src/KsMainWindow.hpp |  2 ++
 2 files changed, 14 insertions(+), 6 deletions(-)

Comments

Steven Rostedt July 17, 2019, 7:30 p.m. UTC | #1
On Mon, 15 Jul 2019 16:20:42 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> This change aims to avoid showing the labels of the time axis (zeros)
> when no data is loaded.

What is this actually fixing? I don't see a difference with adding this
patch and without it.

-- Steve

> 
> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
>
Yordan Karadzhov July 18, 2019, 1:51 p.m. UTC | #2
On 17.07.19 г. 22:30 ч., Steven Rostedt wrote:
> On Mon, 15 Jul 2019 16:20:42 +0300
> "Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:
> 
>> This change aims to avoid showing the labels of the time axis (zeros)
>> when no data is loaded.
> 
> What is this actually fixing? I don't see a difference with adding this
> patch and without it.
> 

Before applying the patch, try to open the GUI without a .dat file. Then 
try to change the marker by pressing one of the marker's buttons. This 
will try to update the labels of the time axis. But because no data is 
loaded and nothing is plotted you will see only zeros at the place where 
the time axis is supposed to be plotted.

Thanks!
Yordan


> -- Steve
> 
>>
>> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
>>
diff mbox series

Patch

diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
index 8826cf5..c8d9d25 100644
--- a/kernel-shark/src/KsMainWindow.cpp
+++ b/kernel-shark/src/KsMainWindow.cpp
@@ -1210,12 +1210,20 @@  void KsMainWindow::_splitterMoved(int pos, int index)
 	_session.saveSplitterSize(_splitter);
 }
 
+void KsMainWindow::_updateMarkData()
+{
+	if (_data.size() < 1)
+		return;
+
+	_mState.updateLabels();
+	_graph.glPtr()->model()->update();
+}
+
 void KsMainWindow::_deselectActive()
 {
 	_view.clearSelection();
 	_mState.activeMarker().remove();
-	_mState.updateLabels();
-	_graph.glPtr()->model()->update();
+	_updateMarkData();
 }
 
 void KsMainWindow::_deselectA()
@@ -1226,8 +1234,7 @@  void KsMainWindow::_deselectA()
 		_view.passiveMarkerSelectRow(KS_NO_ROW_SELECTED);
 
 	_mState.markerA().remove();
-	_mState.updateLabels();
-	_graph.glPtr()->model()->update();
+	_updateMarkData();
 }
 
 void KsMainWindow::_deselectB()
@@ -1238,6 +1245,5 @@  void KsMainWindow::_deselectB()
 		_view.passiveMarkerSelectRow(KS_NO_ROW_SELECTED);
 
 	_mState.markerB().remove();
-	_mState.updateLabels();
-	_graph.glPtr()->model()->update();
+	_updateMarkData();
 }
diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp
index 62e66a0..7e2e839 100644
--- a/kernel-shark/src/KsMainWindow.hpp
+++ b/kernel-shark/src/KsMainWindow.hpp
@@ -232,6 +232,8 @@  private:
 	void _error(const QString &text, const QString &errCode,
 		    bool resize, bool unloadPlugins);
 
+	void _updateMarkData();
+
 	void _deselectActive();
 
 	void _deselectA();