diff --git a/libpala-example/CMakeLists.txt b/libpala-example/CMakeLists.txt deleted file mode 100644 index 45b527021e5585118ae1b837a35572f5818f52f5..0000000000000000000000000000000000000000 --- a/libpala-example/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -project(myslicer) -find_package(KDE4 REQUIRED) -find_package(LibPala REQUIRED) - -include(KDE4Defaults) -include_directories(${KDE4_INCLUDES} ${pala_INCLUDE_DIRS}) - -kde4_add_plugin(myslicer myslicer.cpp) -target_link_libraries(myslicer pala ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS}) - -install(TARGETS myslicer DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES myslicer.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/libpala-example/README b/libpala-example/README deleted file mode 100644 index bd562f1f0f863bca2f2e179ecf9d21da67b9ab21..0000000000000000000000000000000000000000 --- a/libpala-example/README +++ /dev/null @@ -1,3 +0,0 @@ -This is an example of how to write an external slicer plugin for libpala. For documentation, see: - -http://techbase.kde.org/Development/Tutorials/Games/Palapeli_Slicers diff --git a/libpala-example/myslicer.cpp b/libpala-example/myslicer.cpp deleted file mode 100644 index d734788f24d55bd551c6142af6a1b38af132edf6..0000000000000000000000000000000000000000 --- a/libpala-example/myslicer.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * Copyright 2009 Stefan Majewsky - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - ***************************************************************************/ - -#include "myslicer.h" - -#include -#include -#include - -K_PLUGIN_FACTORY(MySlicerFactory, registerPlugin();) -K_EXPORT_PLUGIN(MySlicerFactory("myslicer")) - -MySlicer::MySlicer(QObject* parent, const QVariantList& args) - : Pala::Slicer(parent, args) -{ - Pala::IntegerProperty* prop; - prop = new Pala::IntegerProperty(i18n("Piece count in horizontal direction")); - prop->setRange(3, 100); - prop->setDefaultValue(10); - addProperty("XCount", prop); - prop = new Pala::IntegerProperty(i18n("Piece count in vertical direction")); - prop->setRange(3, 100); - prop->setDefaultValue(10); - addProperty("YCount", prop); -} - -bool MySlicer::run(Pala::SlicerJob* job) -{ - //read job - const int xCount = job->argument("XCount").toInt(); - const int yCount = job->argument("YCount").toInt(); - const QImage image = job->image(); - //calculate some metrics - const int pieceWidth = image.width() / xCount; - const int pieceHeight = image.height() / yCount; - const QSize pieceSize(pieceWidth, pieceHeight); - //create pieces - for (int x = 0; x < xCount; ++x) - { - for (int y = 0; y < yCount; ++y) - { - //calculate more metrics - const QPoint offset(x * pieceWidth, y * pieceHeight); - const QRect pieceBounds(offset, pieceSize); - //copy image part to piece - const QImage pieceImage = image.copy(pieceBounds); - job->addPiece(x + y * xCount, pieceImage, offset); - } - } - //create relations - for (int x = 0; x < xCount; ++x) - { - for (int y = 0; y < yCount; ++y) - { - //along X axis (pointing left) - if (x != 0) - job->addRelation(x + y * xCount, (x - 1) + y * xCount); - //along Y axis (pointing up) - if (y != 0) - job->addRelation(x + y * xCount, x + (y - 1) * xCount); - } - } - return true; -} - -#include "myslicer.moc" diff --git a/libpala-example/myslicer.desktop b/libpala-example/myslicer.desktop deleted file mode 100644 index 17dd2e4e0a3a1c1523335d20ceb908d57c630676..0000000000000000000000000000000000000000 --- a/libpala-example/myslicer.desktop +++ /dev/null @@ -1,34 +0,0 @@ -[Desktop Entry] -Name=My very first slicer -Name[ca]=El meu primer tallador -Name[en_GB]=My very first slicer -Name[et]=Minu esimene tükeldaja -Name[pt]=O meu primeiro divisor -Name[pt_BR]=Meu primeiro fatiador -Name[sv]=Mitt allra första delningsprogram -Name[uk]=Мій найперший інструмент розрізання -Name[x-test]=xxMy very first slicerxx -Name[zh_TW]=我的第一個切割器 -Comment=It is quite simple, actually. -Comment[ca]=És molt simple, actual. -Comment[en_GB]=It is quite simple, actually. -Comment[et]=See on tegelikult päris lihtne. -Comment[pt]=É muito simples, de facto. -Comment[pt_BR]=Ele é muito simples, realmente. -Comment[sv]=Det är faktiskt ganska enkelt. -Comment[uk]=Насправді, дуже простий. -Comment[x-test]=xxIt is quite simple, actually.xx -Comment[zh_TW]=真的是很簡單的。 -Type=Service -Icon=myslicer -X-KDE-Library=myslicer -X-KDE-ServiceTypes=Libpala/SlicerPlugin -X-KDE-PluginInfo-Author=Kandalf -X-KDE-PluginInfo-Email=kandalf@kde-hackers.example.org -X-KDE-PluginInfo-Name=myslicer -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-Website=http://kde-hackers.example.org/myslicer -X-KDE-PluginInfo-Category= -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/libpala-example/myslicer.h b/libpala-example/myslicer.h deleted file mode 100644 index f3cd825a7a1e1d9d0f81f9f1ffadfb7eb911dcfd..0000000000000000000000000000000000000000 --- a/libpala-example/myslicer.h +++ /dev/null @@ -1,38 +0,0 @@ -/*************************************************************************** - * Copyright 2009 Stefan Majewsky - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - ***************************************************************************/ - -#ifndef MYSLICER_H -#define MYSLICER_H - -#include -#include -#include - -class MySlicer : public Pala::Slicer -{ - Q_OBJECT - public: - explicit MySlicer(QObject* parent = 0, const QVariantList& args = QVariantList()); - virtual bool run(Pala::SlicerJob* job); -}; - -#endif // MYSLICER_H