All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kernel-shark: Do not include trace-cmd.h in KsAdvFilteringDialog.cpp
@ 2021-07-27 13:42 Yordan Karadzhov (VMware)
  2021-07-27 13:42 ` [PATCH 2/2] kernel-shark: Fix warnings from deprecated Qt APIs Yordan Karadzhov (VMware)
  0 siblings, 1 reply; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-07-27 13:42 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov (VMware)

This header is not needed.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/KsAdvFilteringDialog.cpp | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/KsAdvFilteringDialog.cpp b/src/KsAdvFilteringDialog.cpp
index f01467d..20412a7 100644
--- a/src/KsAdvFilteringDialog.cpp
+++ b/src/KsAdvFilteringDialog.cpp
@@ -9,9 +9,6 @@
  *  @brief   GUI Dialog for Advanced filtering settings.
  */
 
-// trace-cmd
-#include <trace-cmd.h>
-
 // KernelShark
 #include "libkshark.h"
 #include "libkshark-tepdata.h"
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] kernel-shark: Fix warnings from deprecated Qt APIs
  2021-07-27 13:42 [PATCH 1/2] kernel-shark: Do not include trace-cmd.h in KsAdvFilteringDialog.cpp Yordan Karadzhov (VMware)
@ 2021-07-27 13:42 ` Yordan Karadzhov (VMware)
  0 siblings, 0 replies; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-07-27 13:42 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov (VMware)

Couple of APIs used by KernelShark have been marked as deprecated
in the recent version of Qt. Fix all compilation warnings caused
by the usage of these deprecated APIs.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 CMakeLists.txt      |  6 ++++++
 build/deff.h.cmake  |  1 +
 src/KsGLWidget.cpp  | 12 ++++++++++--
 src/KsUtils.cpp     |  6 +++---
 src/KsUtils.hpp     | 10 ++++++++++
 src/kernelshark.cpp |  2 +-
 6 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 67dfb81..c2c0983 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,6 +83,12 @@ if (Qt5Widgets_FOUND)
 
     endif()
 
+    if(Qt5Widgets_VERSION VERSION_LESS "5.15")
+
+        set(QT_VERSION_LESS_5_15 TRUE)
+
+    endif()
+
 endif (Qt5Widgets_FOUND)
 
 find_package (Boost COMPONENTS unit_test_framework)
diff --git a/build/deff.h.cmake b/build/deff.h.cmake
index 06cbf16..82379df 100644
--- a/build/deff.h.cmake
+++ b/build/deff.h.cmake
@@ -31,6 +31,7 @@
 
 /** Qt - old version detected. */
 #cmakedefine QT_VERSION_LESS_5_11
+#cmakedefine QT_VERSION_LESS_5_15
 
 /** Location of the KernelShark tests. */
 #cmakedefine KS_TEST_DIR "@KS_TEST_DIR@"
diff --git a/src/KsGLWidget.cpp b/src/KsGLWidget.cpp
index 8aab7b3..3b2e0d4 100644
--- a/src/KsGLWidget.cpp
+++ b/src/KsGLWidget.cpp
@@ -345,10 +345,18 @@ void KsGLWidget::wheelEvent(QWheelEvent * event)
 		 * Use the position of the mouse as a focus point for the
 		 * zoom.
 		 */
-		zoomFocus = event->pos().x() - _bin0Offset();
+#ifdef QT_VERSION_LESS_5_15
+
+	zoomFocus = event->pos().x() - _bin0Offset();
+
+#else
+
+	zoomFocus = event->position().x() - _bin0Offset();
+
+#endif // QT_VERSION_LESS_5_15
 	}
 
-	if (event->delta() > 0) {
+	if (event->angleDelta().y() > 0) {
 		_model.zoomIn(.05, zoomFocus);
 	} else {
 		_model.zoomOut(.05, zoomFocus);
diff --git a/src/KsUtils.cpp b/src/KsUtils.cpp
index 3db8951..364c25d 100644
--- a/src/KsUtils.cpp
+++ b/src/KsUtils.cpp
@@ -486,7 +486,7 @@ QString getSaveFile(QWidget *parent,
  */
 QStringList splitArguments(QString cmd)
 {
-	QString::SplitBehavior opt = QString::SkipEmptyParts;
+	auto opt = KS_SPLIT_SkipEmptyParts;
 	int i, progress = 0, size;
 	QStringList argv;
 	QChar quote = 0;
@@ -527,7 +527,7 @@ QStringList splitArguments(QString cmd)
  */
 QVector<int> parseIdList(QString v_str)
 {
-	QStringList list = v_str.split(",", QString::SkipEmptyParts);
+	QStringList list = v_str.split(",", KS_SPLIT_SkipEmptyParts);
 	QVector<int> v;
 
 	for (auto item: list) {
@@ -553,7 +553,7 @@ QVector<int> parseIdList(QString v_str)
  */
 QMap<int, QVector<int>> parseTaskList(QString v_str)
 {
-	QStringList taskList = v_str.split(",", QString::SkipEmptyParts);
+	QStringList taskList = v_str.split(",", KS_SPLIT_SkipEmptyParts);
 	QVector<int> streamIds, allPids;
 	kshark_context *kshark_ctx(nullptr);
 	QMap<int, QVector<int>> ret;
diff --git a/src/KsUtils.hpp b/src/KsUtils.hpp
index cf209bc..1a97d9e 100644
--- a/src/KsUtils.hpp
+++ b/src/KsUtils.hpp
@@ -86,6 +86,16 @@ typedef std::chrono::high_resolution_clock::time_point  hd_time;
 std::chrono::duration_cast<std::chrono::duration<double>>( \
 std::chrono::high_resolution_clock::now() - t0).count()
 
+#ifdef QT_VERSION_LESS_5_15
+
+	#define KS_SPLIT_SkipEmptyParts QString::SkipEmptyParts
+
+#else
+
+	#define KS_SPLIT_SkipEmptyParts Qt::SkipEmptyParts
+
+#endif // QT_VERSION_LESS_5_15
+
 //! @endcond
 
 namespace KsUtils {
diff --git a/src/kernelshark.cpp b/src/kernelshark.cpp
index 8ed4948..92bc1f1 100644
--- a/src/kernelshark.cpp
+++ b/src/kernelshark.cpp
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
 			break;
 
 		case 'a':
-			appInputFiles << QString(optarg).split(" ", QString::SkipEmptyParts);
+			appInputFiles << QString(optarg).split(" ", KS_SPLIT_SkipEmptyParts);
 			break;
 
 		case 'p':
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-27 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 13:42 [PATCH 1/2] kernel-shark: Do not include trace-cmd.h in KsAdvFilteringDialog.cpp Yordan Karadzhov (VMware)
2021-07-27 13:42 ` [PATCH 2/2] kernel-shark: Fix warnings from deprecated Qt APIs Yordan Karadzhov (VMware)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.