add a couple of plasmoid templates for kapptemplate/kdevelop

this makes easier to develop a new plasmoid,
 there are two templates:
one is for a pure QML plasmoid
the othe rone has a C++ part
This commit is contained in:
Marco Martin 2015-11-30 14:58:35 +01:00
parent 29f9449fda
commit 46789eb1c8
21 changed files with 492 additions and 0 deletions

View File

@ -19,6 +19,7 @@ include(KDECompilerSettings)
include(ECMPackageConfigHelpers)
include(ECMSetupVersion)
include(KDEFrameworkCompilerSettings)
include(KDETemplateMacro)
set(KF5_VERSION "5.16.0") # handled by release scripts
set(KF5_DEP_VERSION "5.16.0") # handled by release scripts
@ -187,5 +188,6 @@ endif()
add_subdirectory(autotests)
add_subdirectory(tests)
add_subdirectory(templates)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

5
templates/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
set(apptemplate_DIRS
qml-plasmoid
cpp-plasmoid)
kdetemplate_add_app_templates(${apptemplate_DIRS})

View File

@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 2.8.12)
project(plasma-%{APPNAMELC})
find_package(ECM 1.4.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(ECMInstallIcons)
include(ECMMarkAsTest)
include(ECMMarkNonGuiExecutable)
include(FeatureSummary)
include(CheckIncludeFiles)
find_package(KF5 REQUIRED COMPONENTS
Plasma
I18n
)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Quick
Core
)
add_subdirectory(src)

View File

@ -0,0 +1,3 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.qml` -o $podir/plasma_applet_%{APPNAMELC}.pot
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_%{APPNAMELC}.pot

View File

@ -0,0 +1,32 @@
Plasma Applet mixed C++/QML Template
----------------------
-- Build instructions --
cd /where/your/applet/is/generated
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=MYPREFIX ..
make
make install
(MYPREFIX is where you install your Plasma setup, replace it accordingly)
Restart plasma to load the applet
(in a terminal type:
kquitapp plasmashell
and then
plasmashell)
or view it with
plasmoidviewer -a YourAppletName
-- Tutorials and resources --
The explanation of the template
http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/GettingStarted
Plasma techbase pages
http://techbase.kde.org/Projects/Plasma
Plasma QML API explained
http://techbase.kde.org/Development/Tutorials/Plasma/QML/API

View File

@ -0,0 +1,6 @@
# KDE Config File
[General]
Name=Plasma QML/C++ Applet
Comment=A Plasma Applet Template written in an hybrid mix of QML and C++: a plasma applet template displaying a svg picture and a text.
Category=KDE/Plasmoid
Icon=qml-plasmoid.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, 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 Library 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 "%{APPNAMELC}.h"
#include <klocalizedstring.h>
%{APPNAME}::%{APPNAME}(QObject *parent, const QVariantList &args)
: Plasma::Applet(parent, args),
m_nativeText(i18n("Text coming from C++ plugin"))
{
}
%{APPNAME}::~%{APPNAME}()
{
}
QString %{APPNAME}::nativeText() const
{
return m_nativeText;
}
K_EXPORT_PLASMA_APPLET_WITH_JSON(%{APPNAMELC}, %{APPNAME}, "metadata.json")
#include "%{APPNAMELC}.moc"

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, 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 Library 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 %{APPNAMEUC}_H
#define %{APPNAMEUC}_H
#include <Plasma/Applet>
class %{APPNAME} : public Plasma::Applet
{
Q_OBJECT
Q_PROPERTY(QString nativeText READ nativeText CONSTANT)
public:
%{APPNAME}( QObject *parent, const QVariantList &args );
~%{APPNAME}();
QString nativeText() const;
private:
QString m_nativeText;
};
#endif

View File

@ -0,0 +1,19 @@
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.%{APPNAMELC}\")
set(%{APPNAMELC}_SRCS
%{APPNAMELC}.cpp
)
add_library(plasma_applet_%{APPNAMELC} MODULE ${%{APPNAMELC}_SRCS})
kcoreaddons_desktop_to_json(plasma_applet_%{APPNAMELC} package/metadata.desktop)
target_link_libraries(plasma_applet_%{APPNAMELC}
Qt5::Gui
KF5::Plasma
KF5::I18n)
install(TARGETS plasma_applet_%{APPNAMELC} DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
plasma_install_package(package org.kde.%{APPNAMELC})

View File

@ -0,0 +1,36 @@
/***************************************************************************
* Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> *
* *
* 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 . *
***************************************************************************/
import QtQuick 2.1
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
Plasmoid.fullRepresentation: ColumnLayout {
anchors.fill: parent
PlasmaCore.IconItem {
source: "kde"
}
PlasmaComponents.Label {
text: plasmoid.nativeInterface.nativeText
}
}
}

View File

@ -0,0 +1,24 @@
[Desktop Entry]
Name=%{APPNAME}
Comment=what your app does in a few words
Icon=applications-system
Type=Service
ServiceTypes=Plasma/Applet
X-KDE-Library=plasma_applet_%{APPNAMELC}
X-KDE-PluginInfo-Author=%{AUTHOR}
X-KDE-PluginInfo-Email=%{EMAIL}
X-KDE-PluginInfo-Name=%{APPNAMELC}
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Utilities
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-PluginInfo-Name=org.kde.%{APPNAMELC}
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml

View File

@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 2.8.12)
project(plasma-%{APPNAMELC})
find_package(ECM 1.4.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(KF5Plasma REQUIRED)
plasma_install_package(package org.kde.%{APPNAMELC})

View File

@ -0,0 +1,2 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.qml` -o $podir/plasma_applet_%{APPNAMELC}.pot

View File

@ -0,0 +1,32 @@
Plasma Applet Template
----------------------
-- Build instructions --
cd /where/your/applet/is/generated
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=MYPREFIX ..
make
make install
(MYPREFIX is where you install your Plasma setup, replace it accordingly)
Restart plasma to load the applet
(in a terminal type:
kquitapp plasmashell
and then
plasmashell)
or view it with
plasmoidviewer -a YourAppletName
-- Tutorials and resources --
The explanation of the template
http://techbase.kde.org/index.php?title=Development/Tutorials/Plasma/GettingStarted
Plasma techbase pages
http://techbase.kde.org/Projects/Plasma
Plasma QML API explained
http://techbase.kde.org/Development/Tutorials/Plasma/QML/API

View File

@ -0,0 +1,36 @@
/***************************************************************************
* Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> *
* *
* 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 . *
***************************************************************************/
import QtQuick 2.1
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
Plasmoid.fullRepresentation: ColumnLayout {
anchors.fill: parent
PlasmaCore.IconItem {
source: "kde"
}
PlasmaComponents.Label {
text: "This is Plasma!"
}
}
}

View File

@ -0,0 +1,105 @@
[Desktop Entry]
Name=%{APPNAME}
Name[bg]=%{APPNAME}
Name[bs]=%{APPNAME}
Name[ca]=%{APPNAME}
Name[ca@valencia]=%{APPNAME}
Name[cs]=%{APPNAME}
Name[da]=%{APPNAME}
Name[de]=%{APPNAME}
Name[el]=%{APPNAME}
Name[en_GB]=%{APPNAME}
Name[eo]=%{APPNAME}
Name[es]=%{APPNAME}
Name[et]=%{APPNAME}
Name[fi]=%{APPNAME}
Name[fr]=%{APPNAME}
Name[ga]=%{APPNAME}
Name[gl]=%{APPNAME}
Name[hu]=%{APPNAME}
Name[it]=%{APPNAME}
Name[ja]=%{APPNAME}
Name[kk]=%{APPNAME}
Name[km]=%{APPNAME}
Name[ko]=%{APPNAME}
Name[lt]=%{APPNAME}
Name[lv]=%{APPNAME}
Name[nb]=%{APPNAME}
Name[nds]=%{APPNAME}
Name[nl]=%{APPNAME}
Name[nn]=%{APPNAME}
Name[pa]=%{APPNAME}
Name[pl]=%{APPNAME}
Name[pt]=%{APPNAME}
Name[pt_BR]=%{APPNAME}
Name[ro]=%{APPNAME}
Name[ru]=%{APPNAME}
Name[sk]=%{APPNAME}
Name[sl]=%{APPNAME}
Name[sq]=%{APPNAME}
Name[sr]=%{APPNAME}
Name[sr@ijekavian]=%{APPNAME}
Name[sr@ijekavianlatin]=%{APPNAME}
Name[sr@latin]=%{APPNAME}
Name[sv]=%{APPNAME}
Name[tr]=%{APPNAME}
Name[ug]=%{APPNAME}
Name[uk]=%{APPNAME}
Name[x-test]=xx%{APPNAME}xx
Name[zh_CN]=%{APPNAME}
Name[zh_TW]=%{APPNAME}
Comment=what your app does in a few words
Comment[bs]=šta vaš program radi u nekoliko riječi
Comment[ca]=Què fa la vostra aplicació en poques paraules
Comment[ca@valencia]=Què fa la vostra aplicació en poques paraules
Comment[da]=nogle få ord om hvad din app gør
Comment[de]=Kurze Bescheibung, was Ihre Anwendung tut
Comment[el]=με λίγα λόγια,τι κάνει η εφαρμογή σας
Comment[en_GB]=what your app does in a few words
Comment[es]=lo que hace su aplicación, en pocas palabras
Comment[et]=Mõne sõnaga, mida rakendus teeb
Comment[fi]=ohjelmasi toiminta muutamalla sanalla
Comment[fr]=ce que fait votre application en quelques mots
Comment[gl]=o que fai o seu programa en poucas palabras
Comment[hu]=mit csinál az alkalmazása néhány szóban
Comment[it]=cosa fa la tua applicazione in poche parole
Comment[kk]=қолданбаңыз не істейді - бір-екі сөзде
Comment[ko]=
Comment[nb]=hva programmet gjør, med noen få ord
Comment[nl]=wat uw app in een paar woorden doet
Comment[pl]=w kilku słowach opis co robi twój program
Comment[pt]=o que a sua aplicação faz, em poucas palavras
Comment[pt_BR]=breve descrição do que o seu aplicativo faz
Comment[ru]=Краткое описание вашего приложений
Comment[sk]=čo vaša aplikácia robí v niekoľkých slovách
Comment[sl]=kaj vaš program dela, nekaj besed
Comment[sr]=Неколико речи о намени програма
Comment[sr@ijekavian]=Неколико речи о намени програма
Comment[sr@ijekavianlatin]=Nekoliko reči o nameni programa
Comment[sr@latin]=Nekoliko reči o nameni programa
Comment[sv]=vad programmet gör med några få ord
Comment[tr]=uygulamanızın birkaç kelime ile ne yaptığı
Comment[uk]=призначення вашої програми у декількох словах
Comment[x-test]=xxwhat your app does in a few wordsxx
Comment[zh_TW]=
Icon=applications-system
Type=Service
ServiceTypes=Plasma/Applet
X-KDE-PluginInfo-Author=%{AUTHOR}
X-KDE-PluginInfo-Email=%{EMAIL}
X-KDE-PluginInfo-Name=%{APPNAMELC}
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Utilities
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-PluginInfo-Name=org.kde.%{APPNAMELC}
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
X-Plasma-Requires-FileDialog=Unused
X-Plasma-Requires-LaunchApp=Unused
X-Plasma-DefaultSize=200,300

View File

@ -0,0 +1,74 @@
# KDE Config File
[General]
Name=Plasma QML Applet
Name[bs]=Plasma QML Applet
Name[ca]=Miniaplicació en QML pel Plasma
Name[ca@valencia]=Miniaplicació en QML pel Plasma
Name[cs]=Aplet QML Plasma
Name[da]=Plasma QML-applet
Name[de]=Plasma-QML-Miniprogramm
Name[el]=Μικροεφαρμογή Plasma QML
Name[en_GB]=Plasma QML Applet
Name[es]=Miniaplicación QML para Plasma
Name[et]=Plasma QML aplett
Name[fi]=Plasma QML-sovelma
Name[fr]=Composant graphique QML pour Plasma
Name[gl]=Applet QML para Plasma
Name[hu]=Plasma QML kisalkalmazás
Name[it]=Applet di Plasma in QML
Name[kk]=Plasma QML апплеті
Name[ko]=Plasma QML 애플릿
Name[nb]=Plasma QML-miniprogram
Name[nl]=Plasma QML-applet
Name[pl]=Aplet plazmy QML Applet
Name[pt]='Applet' do Plasma em QML
Name[pt_BR]=Miniaplicativo Plasma em QML
Name[ru]=Аплет Plasma QML
Name[sk]=Plasma QML Applet
Name[sl]=Aplet QML za Plasmo
Name[sr]=Плазма КуМЛ аплет
Name[sr@ijekavian]=Плазма КуМЛ аплет
Name[sr@ijekavianlatin]=Plasma QML aplet
Name[sr@latin]=Plasma QML aplet
Name[sv]=Plasma QML-miniprogram
Name[tr]=Plasma QML Programcığı
Name[uk]=Аплет Плазми мовою QML
Name[x-test]=xxPlasma QML Appletxx
Name[zh_CN]=Plasma QML 小程序
Name[zh_TW]=Plasma QML 小程式
Comment=Plasma QML Applet Template: a plasma applet template displaying a svg picture and a text.
Comment[bs]=Predložak za QML aplete. Predložak za plasma aplete koji prikazuju SVG sliku i tekst.
Comment[ca]=Plantilla de miniaplicació pel Plasma: una plantilla de miniaplicació del plasma que mostra una icona i un text.
Comment[ca@valencia]=Plantilla de miniaplicació pel Plasma: una plantilla de miniaplicació del plasma que mostra una icona i un text.
Comment[da]=Skabelon til Plasma QML-applet. En skabelon til en Plasma-applet, som viser et SVG-billede og en tekst.
Comment[de]=Vorlage für Plasma-QML-Miniprogramm. Eine Vorlage für ein Plasma-Miniprogramm, das ein SVG-Symbol und einen Text anzeigt
Comment[el]=Πρότυπο μικροεφαρμογής Plasma QML: ένα πρότυπο μικροεφαρμογής plasma που εμφανίζει μια εικόνα svg και ένα κείμενο.
Comment[en_GB]=Plasma QML Applet Template: a plasma applet template displaying a svg picture and a text.
Comment[es]=Plantilla de miniaplicación QML para Plasma: una plantilla de miniaplicación para Plasma que muestra una imagen SVG y un texto.
Comment[et]=Plasma QML apleti mall. Plasma apleti mall, näitab SVG-pilti ja teksti
Comment[fi]=Plasman QML-sovelmamalli: Plasma-sovelmamalli, joka näyttää kuvakkeen ja tekstiä.
Comment[fr]=Modèle de composant graphique QML pour Plasma. Un modèle de composant graphique pour Plasma affichant une image « svg » et un texte.
Comment[gl]=Modelo de applet para Plasma: un modelo de applet para Plasma que mostra unha imaxe SVG e un texto.
Comment[hu]=Plasma QML kisalkalmazás sablon: egy Plasma kisalkalmazás sablon, amely megjelenít egy SVG képet és egy szöveget.
Comment[it]=Modello di applet Plasma in QML. Un modello di programmino Plasma che visualizza un'immagine SVG e del testo
Comment[kk]=Plasma QML апплет үлгісі. SVG-суреті мен мәтінді көрсететін Plasma апплет үлгісі.
Comment[ko]=Plasma QML 애플릿 템플릿. SVG 그림과 텍스트를 표시하는 Plasma 애플릿 템플릿
Comment[nb]=Plasma mal for QML miniprogram: en mal for et Plasma-element som viser et svg-bilde og en tekst.
Comment[nl]=Sjabloon voor Plasma-QML-applet: Een sjabloon voor een plasma-applet dat een svg-afbeelding en een tekst toont
Comment[pl]=Szablon apletu Plazmy QML: szablon apletu plazmy wyświetlający zdjęcie svg i tekst.
Comment[pt]=Modelo de 'Applet' do Plasma. Um modelo de 'applet' do Plasma que mostra uma imagem SVG e algum texto.
Comment[pt_BR]=Modelo de miniaplicativo Plasma em QML: Um modelo de miniaplicativo Plasma que mostra uma imagem SVG e texto.
Comment[ru]=Пример виджета Plasma на QML. Шаблон виджета Plasma, показывающий изображение SVG и текст.
Comment[sk]=Šablóna appletu Plasma QML: šablóna plasma appletu zobrazujúca svg obrázok a text.
Comment[sl]=Predloga apleta Plasma, ki prikazuje sliko svg in besedilo.
Comment[sr]=Шаблон за плазма КуМЛ аплет који даје СВГ слику и текст
Comment[sr@ijekavian]=Шаблон за плазма КуМЛ аплет који даје СВГ слику и текст
Comment[sr@ijekavianlatin]=Šablon za plasma QML aplet koji daje SVG sliku i tekst
Comment[sr@latin]=Šablon za plasma QML aplet koji daje SVG sliku i tekst
Comment[sv]=Mall för Plasma QML-miniprogram. En mall för ett Plasma-miniprogram som visar en SVG-bild och en text.
Comment[tr]=Plasma QML Programcığı Şablonu: Bir metin ve svg resmi gösteren plasma programcığı şablonu
Comment[uk]=Шаблон аплету Плазми. Шаблон аплету Плазми, який показу зображення SVG і текст.
Comment[x-test]=xxPlasma QML Applet Template: a plasma applet template displaying a svg picture and a text.xx
Comment[zh_TW]=Plasma QML 小程式樣本:用於顯示 svg 圖片與文字的 plasma 小程式樣本
Category=KDE/Plasmoid
Icon=qml-plasmoid.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB