diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,12 +22,6 @@ enable_testing() -message("TODO: reenable KGraphViewer support") -#find_package(KGraphViewer 2.1) -#macro_log_feature(KGRAPHVIEWER_FOUND "KGraphViewer" "KPart to view callgraph dot files." -# "http://extragear.kde.org/apps/kgraphviewer/" FALSE "" -# "Required for detailed snapshot analysis. From KDE SDK Extragear package, KGraphViewer 2.1 or higher is required.") - find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets @@ -48,6 +42,13 @@ find_package(KChart "2.6.0" REQUIRED) +find_package(KGraphViewerPart 2.3.90) +set_package_properties(KGraphViewerPart PROPERTIES + DESCRIPTION "KPart to view callgraph dot files" + PURPOSE "Required for detailed snapshot analysis" + URL "https://www.kde.org/applications/graphics/kgraphviewer/" + TYPE RECOMMENDED) + include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -13,13 +13,13 @@ allocatorstab.cpp ) -if(KGRAPHVIEWER_FOUND) +if(KGraphViewerPart_FOUND) include_directories( - ${KGRAPHVIEWER_INCLUDE_DIRECTORIES} + ${KGraphViewerPart_INCLUDE_DIRS} ) add_definitions(-DHAVE_KGRAPHVIEWER) list(APPEND massif-visualizer_SRCS callgraphtab.cpp) -endif(KGRAPHVIEWER_FOUND) +endif() kconfig_add_kcfg_files(massif-visualizer_SRCS massif-visualizer-settings.kcfgc) diff --git a/app/callgraphtab.h b/app/callgraphtab.h --- a/app/callgraphtab.h +++ b/app/callgraphtab.h @@ -27,7 +27,7 @@ #include -class KAction; +class QAction; namespace KGraphViewer { class KGraphViewerInterface; @@ -76,9 +76,9 @@ Massif::ModelItem m_lastDotItem; Massif::ModelItem m_nextDotItem; - KAction* m_zoomIn; - KAction* m_zoomOut; - KAction* m_focusExpensive; + QAction* m_zoomIn; + QAction* m_zoomOut; + QAction* m_focusExpensive; }; #endif // CALLGRAPHTAB_H diff --git a/app/callgraphtab.cpp b/app/callgraphtab.cpp --- a/app/callgraphtab.cpp +++ b/app/callgraphtab.cpp @@ -26,12 +26,12 @@ #include "massifdata/filedata.h" #include +#include +#include -#include -#include +#include #include #include -#include #include #include @@ -48,7 +48,7 @@ , m_zoomOut(0) , m_focusExpensive(0) { - setXMLFile("callgraphtabui.rc", true); + setXMLFile(QStringLiteral("callgraphtabui.rc"), true); setupActions(); Q_ASSERT(m_graphViewer); @@ -83,12 +83,12 @@ void CallGraphTab::setupActions() { m_zoomIn = KStandardAction::zoomIn(this, SLOT(zoomIn()), actionCollection()); - actionCollection()->addAction("zoomIn", m_zoomIn); + actionCollection()->addAction(QStringLiteral("zoomIn"), m_zoomIn); m_zoomOut = KStandardAction::zoomOut(this, SLOT(zoomOut()), actionCollection()); - actionCollection()->addAction("zoomOut", m_zoomOut); - m_focusExpensive = new KAction(KIcon("flag-red"), i18n("Focus most expensive node"), actionCollection()); + actionCollection()->addAction(QStringLiteral("zoomOut"), m_zoomOut); + m_focusExpensive = new QAction(QIcon::fromTheme(QStringLiteral("flag-red")), i18n("Focus most expensive node"), actionCollection()); connect(m_focusExpensive, SIGNAL(triggered()), this, SLOT(focusExpensiveGraphNode())); - actionCollection()->addAction("focusExpensive", m_focusExpensive); + actionCollection()->addAction(QStringLiteral("focusExpensive"), m_focusExpensive); } void CallGraphTab::settingsChanged() @@ -119,9 +119,9 @@ Q_ASSERT(m_graphViewer); - kDebug() << "new dot graph requested" << item; + qDebug() << "new dot graph requested" << item; if (m_dotGenerator) { - kDebug() << "existing generator is running:" << m_dotGenerator->isRunning(); + qDebug() << "existing generator is running:" << m_dotGenerator->isRunning(); if (m_dotGenerator->isRunning()) { disconnect(m_dotGenerator.data(), 0, this, 0); connect(m_dotGenerator.data(), SIGNAL(finished()), @@ -157,7 +157,7 @@ if (!m_dotGenerator || !m_graphViewerPart || !isVisible()) { return; } - kDebug() << "show dot graph in output file" << m_dotGenerator->outputFile(); + qDebug() << "show dot graph in output file" << m_dotGenerator->outputFile(); const auto url = QUrl::fromLocalFile(m_dotGenerator->outputFile()); if (url.isValid() && m_graphViewerPart->url() != url) { m_graphViewerPart->openUrl(url); diff --git a/app/documentwidget.cpp b/app/documentwidget.cpp --- a/app/documentwidget.cpp +++ b/app/documentwidget.cpp @@ -193,9 +193,9 @@ i18n("Memory Chart")); #ifdef HAVE_KGRAPHVIEWER - static KPluginFactory *factory = KPluginLoader("kgraphviewerpart").factory(); + static KPluginFactory *factory = KPluginLoader(QStringLiteral("kgraphviewerpart")).factory(); if (factory) { - KParts::ReadOnlyPart* part = factory->create("kgraphviewerpart", this); + KParts::ReadOnlyPart* part = factory->create(QString(), this); if (part) { m_tabs->addTab(new CallGraphTab(m_data, part, this, this), QIcon::fromTheme(QStringLiteral("kgraphviewer")), i18n("Callgraph")); diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include @@ -92,9 +92,9 @@ // NOTE: just check if kgraphviewer is available at runtime. // The former logic has been moved to DocumentWidget constructor. #ifdef HAVE_KGRAPHVIEWER - KPluginFactory *factory = KPluginLoader("kgraphviewerpart").factory(); + KPluginFactory *factory = KPluginLoader(QStringLiteral("kgraphviewerpart")).factory(); if (factory) { - KParts::ReadOnlyPart* readOnlyPart = factory->create("kgraphviewerpart", this); + KParts::ReadOnlyPart* readOnlyPart = factory->create(QString(), this); if (readOnlyPart) { readOnlyPart->widget()->hide(); haveGraphViewer = true; diff --git a/cmake/FindKGraphViewer.cmake b/cmake/FindKGraphViewer.cmake deleted file mode 100644 --- a/cmake/FindKGraphViewer.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# -# Find the KGraphViewer library and sets various variables accordingly -# -# Example usage of this module: -# find_package(KGraphViewer 2.1 REQUIRED) -# -# The version number and REQUIRED flag are optional. You can set CMAKE_PREFIX_PATH -# variable to help it find the required files and directories -# -# this will set the following variables: -# KGRAPHVIEWER_LIBRARIES - KGraphViewer library -# KGRAPHVIEWER_FOUND - Whether KGraphViewer was found -# KGRAPHVIEWER_INCLUDE_DIRECTORIES - Include directories for the KGraphViewer library -# -# Copyright 2010 Milian Wolff -# Redistribution and use is allowed according to the terms of the BSD license. - -find_path( KGRAPHVIEWER_INCLUDE_DIRECTORIES - NAMES kgraphviewer_interface.h - HINTS - ${KGRAPHVIEWER_INCLUDE_DIRS} - /usr/local/include - /usr/include - PATH_SUFFIXES kgraphviewer - ) - -find_library( KGRAPHVIEWER_LIBRARIES - NAMES kgraphviewer - HINTS - ${KGRAPHVIEWER_LIBRARY_DIRS} - /usr/local/lib64 - /usr/lib64 - /usr/local/lib - /usr/lib - ) - -include(FindPackageHandleStandardArgs) - -# handle the QUIETLY and REQUIRED arguments and set KGRAPHVIEWER_FOUND to TRUE if -# all listed variables are TRUE -find_package_handle_standard_args(KGRAPHVIEWER DEFAULT_MSG KGRAPHVIEWER_LIBRARIES KGRAPHVIEWER_INCLUDE_DIRECTORIES) \ No newline at end of file