Commit 9cab49e2 authored by Hrvoje Senjan's avatar Hrvoje Senjan
Browse files

Initial port to Frameworks

tested the part in KF5 based konqueror, local files open fine
parent 23dc37c7
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)
......@@ -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
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment