summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHrvoje Senjan <hrvoje.senjan@gmail.com>2014-11-05 20:12:39 (GMT)
committerHrvoje Senjan <hrvoje.senjan@gmail.com>2014-11-05 20:12:39 (GMT)
commit9cab49e26dbd64ce60d32086f23561aee3b11953 (patch)
tree9da4181bd7ee32ee0b912379a2d98b83201ff9ad
parent23dc37c7d4e5448b3e37f8f5b0fcfe2a7765beac (diff)
Initial port to Frameworks
tested the part in KF5 based konqueror, local files open fine
-rw-r--r--CMakeLists.txt27
-rw-r--r--svgpart.cpp19
-rw-r--r--svgpart.h4
3 files changed, 32 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e9dcc2..9382eff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,20 +1,31 @@
project(svgpart)
-find_package(KDE4 REQUIRED)
-include(KDE4Defaults)
-include(MacroLibrary)
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+set(QT_MIN_VERSION "5.2.0")
-add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
-include_directories(${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
+find_package(ECM 1.0.0 REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
+
+include(KDEInstallDirs)
+include(KDECMakeSettings)
+include(KDECompilerSettings)
+include(FeatureSummary)
+
+find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets Svg)
+find_package(KF5 REQUIRED COMPONENTS CoreAddons Parts XmlGui)
+
+add_definitions(-DTRANSLATION_DOMAIN="svgpart")
set(svgpart_SRCS
svgpart.cpp
)
-kde4_add_plugin(svgpart ${svgpart_SRCS})
+add_library(svgpart MODULE ${svgpart_SRCS})
-target_link_libraries(svgpart ${KDE4_KPARTS_LIBS})
+target_link_libraries(svgpart Qt5::Widgets Qt5::Svg KF5::CoreAddons KF5::Parts KF5::XmlGui)
install(TARGETS svgpart DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES svgpart.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-install(FILES svgpart.rc DESTINATION ${DATA_INSTALL_DIR}/svgpart)
+install(FILES svgpart.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/svgpart)
+
+feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/svgpart.cpp b/svgpart.cpp
index 0edbec3..dc066b7 100644
--- a/svgpart.cpp
+++ b/svgpart.cpp
@@ -16,7 +16,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include "svgpart.moc"
// Qt
#include <QGraphicsScene>
@@ -26,24 +25,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// KDE
#include <kaboutdata.h>
+#include <klocalizedstring.h>
#include <kactioncollection.h>
-#include <kgenericfactory.h>
#include <kstandardaction.h>
+#include <kpluginfactory.h>
// Local
+#include "svgpart.h"
static KAboutData createAboutData()
{
- KAboutData aboutData( "svgpart", 0, ki18n("SVG Part"),
- "1.0", ki18n("A KPart to display SVG images"),
- KAboutData::License_GPL,
- ki18n("Copyright 2007, Aurélien Gâteau <aurelien.gateau@free.fr>"));
+ KAboutData aboutData( QStringLiteral("svgpart"), i18n("SVG Part"),
+ "1.0", i18n("A KPart to display SVG images"),
+ KAboutLicense::KAboutLicense::GPL,
+ i18n("Copyright 2007, Aurélien Gâteau <aurelien.gateau@free.fr>"));
return aboutData;
}
//Factory Code
K_PLUGIN_FACTORY( SvgPartFactory, registerPlugin< SvgPart >(); )
-K_EXPORT_PLUGIN( SvgPartFactory( createAboutData() ) )
SvgPart::SvgPart(QWidget* parentWidget, QObject* parent, const QVariantList&)
@@ -60,7 +60,8 @@ SvgPart::SvgPart(QWidget* parentWidget, QObject* parent, const QVariantList&)
KStandardAction::actualSize(this, SLOT(zoomActualSize()), actionCollection());
KStandardAction::zoomIn(this, SLOT(zoomIn()), actionCollection());
KStandardAction::zoomOut(this, SLOT(zoomOut()), actionCollection());
- setXMLFile("svgpart/svgpart.rc");
+ setComponentName(QLatin1Literal("svgpart"), i18n("SVG Part"));
+ setXMLFile("svgpart.rc");
}
@@ -107,3 +108,5 @@ void SvgPart::setZoom(qreal value) {
matrix.scale(value, value);
mView->setMatrix(matrix);
}
+
+#include "svgpart.moc" \ No newline at end of file
diff --git a/svgpart.h b/svgpart.h
index cb2a1e2..ae80994 100644
--- a/svgpart.h
+++ b/svgpart.h
@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define SVGPART_H
// KDE
-#include <kparts/part.h>
+#include <kparts/readonlypart.h>
class QGraphicsScene;
@@ -36,7 +36,7 @@ public:
virtual bool closeUrl();
protected:
- virtual bool openFile();
+ virtual bool openFile() Q_DECL_OVERRIDE;
private Q_SLOTS:
void zoomActualSize();