Commit 0488145b authored by Aurélien Gâteau's avatar Aurélien Gâteau
Browse files

Imported first version of svgpart, a KPart to display SVG images.

svn path=/trunk/playground/graphics/svgpart/; revision=737255
parents
project(svgpart)
find_package(KDE4 REQUIRED)
find_package(Strigi REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
add_definitions (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
set(svgpart_SRCS
svgpart.cpp
)
kde4_add_plugin(svgpart ${svgpart_SRCS})
target_link_libraries(svgpart ${KDE4_KPARTS_LIBS})
install(TARGETS svgpart DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES svgpart.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES svgpart.rc DESTINATION ${DATA_INSTALL_DIR}/svgpart)
/*
Copyright 2007 Aurélien Gâteau
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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 <QSvgWidget>
// KDE
#include <kparts/genericfactory.h>
// Local
//Factory Code
typedef KParts::GenericFactory<SvgPart> SvgPartFactory;
K_EXPORT_COMPONENT_FACTORY( svgpart /*library name*/, SvgPartFactory )
SvgPart::SvgPart(QWidget* parentWidget, QObject* parent, const QStringList&)
: KParts::ReadOnlyPart(parent)
{
mSvgWidget = new QSvgWidget(parentWidget);
setWidget(mSvgWidget);
setXMLFile("svgpart/svgpart.rc");
}
bool SvgPart::openFile() {
mSvgWidget->load(localFilePath());
return true;
}
KAboutData* SvgPart::createAboutData() {
KAboutData* aboutData = new KAboutData( "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>"));
return aboutData;
}
[Desktop Entry]
Encoding=UTF-8
Type=Service
Name=Svg Part
MimeType=image/svg+xml;
ServiceTypes=KParts/ReadOnlyPart
X-KDE-Library=svgpart
InitialPreference=12
Icon=svg
/*
Copyright 2007 Aurélien Gâteau
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SVGPART_H
#define SVGPART_H
// KDE
#include <kparts/part.h>
class KAboutData;
class QSvgWidget;
class SvgPart : public KParts::ReadOnlyPart {
Q_OBJECT
public:
SvgPart(QWidget* parentWidget, QObject* parent, const QStringList&);
static KAboutData* createAboutData();
protected:
virtual bool openFile();
private:
QSvgWidget* mSvgWidget;
};
#endif /* SVGPART_H */
<!DOCTYPE kpartgui>
<kpartgui name="SvgPart" version="1">
<!--
<MenuBar>
<Menu name="view"><Text>&amp;View</Text>
<Action name="view_actual_size"/>
<Action name="view_zoom_to_fit"/>
<Action name="view_zoom_in"/>
<Action name="view_zoom_out"/>
</Menu>
</MenuBar>
<ToolBar name="mainToolBar"><text>Main Toolbar</text>
<Action name="view_actual_size"/>
<Action name="view_zoom_to_fit"/>
<Action name="view_zoom_in"/>
<Action name="view_zoom_out"/>
</ToolBar>
-->
</kpartgui>
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