Skip to content

Commit

Permalink
Port the KJob tracker plug-in to also build with KDE Frameworks 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
vkrause committed Apr 5, 2014
1 parent e7dca90 commit 0e71195
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
41 changes: 29 additions & 12 deletions plugins/kjobtracker/CMakeLists.txt
@@ -1,19 +1,28 @@
if(NOT Qt5Core_FOUND)
if(Qt5Core_FOUND)
find_package(KF5CoreAddons)
set_package_properties(KF5CoreAddons PROPERTIES
TYPE OPTIONAL
DESCRIPTION "KDE KCoreAddons Framework"
URL "http://www.kde.org/"
PURPOSE "Required for the KJob tracker plug-in."
)
else()
# ugly workaround for FindKDE4Internal messing with the install rpath (https://github.com/KDAB/GammaRay/issues/36)
set(_old_CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH})
find_package(KDE4)
set(CMAKE_INSTALL_RPATH ${_old_CMAKE_INSTALL_RPATH})

set_package_properties(KDE4 PROPERTIES
TYPE OPTIONAL
DESCRIPTION "KDE libraries"
URL "http://www.kde.org/"
PURPOSE "Required for the KJob tracker plug-in."
)
endif()

set_package_properties(KDE4 PROPERTIES
TYPE OPTIONAL
DESCRIPTION "KDE libraries"
URL "http://www.kde.org/"
PURPOSE "Required for the KJob tracker plug-in."
)

# probe part
if(KDE4_FOUND AND NOT Qt5Core_FOUND)
if(KDE4_FOUND OR KF5CoreAddons_FOUND)
include_directories(${KDE4_INCLUDES})
add_definitions(${KDE4_DEFINITIONS})

Expand All @@ -27,10 +36,18 @@ if(KDE4_FOUND AND NOT Qt5Core_FOUND)
${gammaray_kjob_plugin_srcs}
)

target_link_libraries(gammaray_kjobtracker_plugin
${KDE4_KDECORE_LIBS}
gammaray_core
)
if (KDE4_FOUND)
target_link_libraries(gammaray_kjobtracker_plugin
${KDE4_KDECORE_LIBS}
gammaray_core
)
else()
target_link_libraries(gammaray_kjobtracker_plugin
gammaray_core
KF5::CoreAddons
Qt5::Gui
)
endif()
endif()

# ui part
Expand Down
2 changes: 1 addition & 1 deletion plugins/kjobtracker/kjobmodel.cpp
Expand Up @@ -68,7 +68,7 @@ QVariant KJobModel::data(const QModelIndex &index, int role) const
case KJobInfo::Deleted:
return QApplication::palette().brush(QPalette::Disabled, QPalette::Foreground);
case KJobInfo::Error:
return Qt::red;
return QVariant::fromValue<QColor>(Qt::red);
case KJobInfo::Killed:
return QApplication::palette().link();
default:
Expand Down
2 changes: 2 additions & 0 deletions plugins/kjobtracker/kjobtracker.cpp
Expand Up @@ -46,4 +46,6 @@ KJobTracker::~KJobTracker()
{
}

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
Q_EXPORT_PLUGIN(KJobTrackerFactory)
#endif
1 change: 1 addition & 0 deletions plugins/kjobtracker/kjobtracker.h
Expand Up @@ -48,6 +48,7 @@ class KJobTrackerFactory : public QObject, public StandardToolFactory<KJob, KJob
{
Q_OBJECT
Q_INTERFACES(GammaRay::ToolFactory)
Q_PLUGIN_METADATA(IID "com.kdab.gammaray.KJobTracker")

public:
explicit KJobTrackerFactory(QObject *parent = 0) : QObject(parent)
Expand Down

0 comments on commit 0e71195

Please sign in to comment.