Templates: consistent naming, fix translation catalog names & more

Summary:
* remove unneeded cmake includes
* consistently use org.kde.plasma.* prefix for names
* fix catalog names to match applet identifier
* bump min cmake version to 3.0
* remove duplicated X-KDE-PluginInfo-Name entries
* remove no longer (Plasma >=5.8) needed i18nd in wallpaper code
* prepare qml extension for ki18n usage

Reviewers: mart

Reviewed By: mart

Subscribers: kde-frameworks-devel, apol

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D10848
This commit is contained in:
Friedrich W. H. Kossebau 2018-02-26 07:11:54 +01:00
parent 330ce3207f
commit 98e64e01a6
20 changed files with 118 additions and 26 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.0)
project(plasma-%{APPNAMELC})
@ -8,20 +8,18 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
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
find_package(Qt5 CONFIG REQUIRED COMPONENTS
Quick
Core
)
add_subdirectory(src)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@ -1,3 +1,2 @@
#! /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
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.%{APPNAMELC}.pot

View File

@ -1,6 +1,23 @@
Plasma Applet mixed C++/QML Template
----------------------
-- Namespace adaption --
Each Plasma plugin has a unique identifier, which is also used to find related
resources (like the translation catalogs).
To avoid naming collisions, Plasma plugins use a reverse domain name notation
for that identifier:
* org.kde.plasma.* - plugins coming from Plasma modules
* org.kde.* - plugins coming from other software from KDE
* $(my.domain).* - plugins of your 3rd-party
The generated code uses the "org.kde.plasma" namespace for the plugin identifier.
As this namespace is reserved for use by plugins part of Plasma modules, you will
need to adapt this namespace if you are writing a plugin which is not intended to
end up in the Plasma modules.
-- Build instructions --
cd /where/your/applet/is/generated

View File

@ -1,4 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.%{APPNAMELC}\")
# TODO: adapt "org.kde.plasma" here & elsewhere if needed (see README)
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.%{APPNAMELC}\")
set(%{APPNAMELC}_SRCS
%{APPNAMELC}.cpp
@ -16,4 +17,4 @@ target_link_libraries(plasma_applet_%{APPNAMELC}
install(TARGETS plasma_applet_%{APPNAMELC} DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
plasma_install_package(package org.kde.%{APPNAMELC})
plasma_install_package(package org.kde.plasma.%{APPNAMELC})

View File

@ -85,14 +85,13 @@ X-KDE-Library=plasma_applet_%{APPNAMELC}
X-KDE-PluginInfo-Author=%{AUTHOR}
X-KDE-PluginInfo-Email=%{EMAIL}
X-KDE-PluginInfo-Name=%{APPNAMELC}
X-KDE-PluginInfo-Name=org.kde.plasma.%{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

@ -22,6 +22,7 @@ find_package(Qt5 CONFIG REQUIRED COMPONENTS
)
# wallpaper applet
# TODO: adapt "org.kde.plasma" here & elsewhere if needed (see README)
plasma_install_package(package org.kde.plasma.%{APPNAMELC} wallpapers wallpaper)
# qml extension plugin

View File

@ -1,6 +1,23 @@
Plasma Wallpaper Template
----------------------
-- Namespace adaption --
Each Plasma plugin has a unique identifier, which is also used to find related
resources (like the translation catalogs).
To avoid naming collisions, Plasma plugins use a reverse domain name notation
for that identifier:
* org.kde.plasma.* - plugins coming from Plasma modules
* org.kde.* - plugins coming from other software from KDE
* $(my.domain).* - plugins of your 3rd-party
The generated code uses the "org.kde.plasma" namespace for the plugin identifier.
As this namespace is reserved for use by plugins part of Plasma modules, you will
need to adapt this namespace if you are writing a plugin which is not intended to
end up in the Plasma modules.
-- Build instructions --
cd /where/your/wallpaper/is/generated

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.0)
project(plasma-%{APPNAMELC})
@ -7,4 +7,5 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(KF5Plasma REQUIRED)
# TODO: adapt "org.kde.plasma" here & elsewhere if needed (see README)
plasma_install_package(package org.kde.plasma.%{APPNAMELC} wallpapers wallpaper)

View File

@ -1,6 +1,23 @@
Plasma Wallpaper Template
----------------------
-- Namespace adaption --
Each Plasma plugin has a unique identifier, which is also used to find related
resources (like the translation catalogs).
To avoid naming collisions, Plasma plugins use a reverse domain name notation
for that identifier:
* org.kde.plasma.* - plugins coming from Plasma modules
* org.kde.* - plugins coming from other software from KDE
* $(my.domain).* - plugins of your 3rd-party
The generated code uses the "org.kde.plasma" namespace for the plugin identifier.
As this namespace is reserved for use by plugins part of Plasma modules, you will
need to adapt this namespace if you are writing a plugin which is not intended to
end up in the Plasma modules.
-- Build instructions --
cd /where/your/wallpaper/is/generated

View File

@ -32,8 +32,7 @@ Item {
PlasmaExtras.Title {
anchors.centerIn: parent
// use i18nd in wallpaper QML, as the default textdomain is not setup at least in Plasma 5.7
text: wallpaper.configuration.DisplayText ||
i18nd("plasma_wallpaper_org.kde.plasma.%{APPNAMELC}", "<Please configure a text to display>")
i18n("<Please configure a text to display>")
}
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.0)
project(plasma-%{APPNAMELC})
@ -8,6 +8,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(FeatureSummary)
find_package(KF5 REQUIRED COMPONENTS
Plasma
@ -21,7 +22,10 @@ find_package(Qt5 CONFIG REQUIRED COMPONENTS
)
# plasmoid
plasma_install_package(package org.kde.%{APPNAMELC})
# TODO: adapt "org.kde.plasma" here & elsewhere if needed (see README)
plasma_install_package(package org.kde.plasma.%{APPNAMELC})
# qml extension plugin
add_subdirectory(plugin)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

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

View File

@ -1,6 +1,23 @@
Plasma Applet Template
----------------------
-- Namespace adaption --
Each Plasma plugin has a unique identifier, which is also used to find related
resources (like the translation catalogs).
To avoid naming collisions, Plasma plugins use a reverse domain name notation
for that identifier:
* org.kde.plasma.* - plugins coming from Plasma modules
* org.kde.* - plugins coming from other software from KDE
* $(my.domain).* - plugins of your 3rd-party
The generated code uses the "org.kde.plasma" namespace for the plugin identifier.
As this namespace is reserved for use by plugins part of Plasma modules, you will
need to adapt this namespace if you are writing a plugin which is not intended to
end up in the Plasma modules.
-- Build instructions --
cd /where/your/applet/is/generated

View File

@ -83,14 +83,13 @@ X-KDE-ServiceTypes=Plasma/Applet
X-KDE-PluginInfo-Author=%{AUTHOR}
X-KDE-PluginInfo-Email=%{EMAIL}
X-KDE-PluginInfo-Name=%{APPNAMELC}
X-KDE-PluginInfo-Name=org.kde.plasma.%{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

@ -18,6 +18,9 @@
#include "%{APPNAMELC}plugin.h"
// KF
#include <KLocalizedString>
// Qt
#include <QJSEngine>
#include <QQmlEngine>
#include <QQmlContext>
@ -27,7 +30,7 @@ static QJSValue singletonTypeExampleProvider(QQmlEngine* engine, QJSEngine* scri
Q_UNUSED(engine)
QJSValue helloWorld = scriptEngine->newObject();
helloWorld.setProperty("text", QStringLiteral("Hello world!"));
helloWorld.setProperty("text", i18n("Hello world!"));
return helloWorld;
}

View File

@ -1,3 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.%{APPNAMELC}\")
set(%{APPNAMELC}plugin_SRCS
%{APPNAMELC}plugin.cpp
)
@ -5,6 +7,7 @@ set(%{APPNAMELC}plugin_SRCS
add_library(%{APPNAMELC}plugin SHARED ${%{APPNAMELC}plugin_SRCS})
target_link_libraries(%{APPNAMELC}plugin
KF5::I18n
Qt5::Gui
Qt5::Qml
)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.0)
project(plasma-%{APPNAMELC})
@ -7,4 +7,5 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(KF5Plasma REQUIRED)
plasma_install_package(package org.kde.%{APPNAMELC})
# TODO: adapt "org.kde.plasma" here & elsewhere if needed (see README)
plasma_install_package(package org.kde.plasma.%{APPNAMELC})

View File

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

View File

@ -1,6 +1,23 @@
Plasma Applet Template
----------------------
-- Namespace adaption --
Each Plasma plugin has a unique identifier, which is also used to find related
resources (like the translation catalogs).
To avoid naming collisions, Plasma plugins use a reverse domain name notation
for that identifier:
* org.kde.plasma.* - plugins coming from Plasma modules
* org.kde.* - plugins coming from other software from KDE
* $(my.domain).* - plugins of your 3rd-party
The generated code uses the "org.kde.plasma" namespace for the plugin identifier.
As this namespace is reserved for use by plugins part of Plasma modules, you will
need to adapt this namespace if you are writing a plugin which is not intended to
end up in the Plasma modules.
-- Build instructions --
cd /where/your/applet/is/generated

View File

@ -83,14 +83,13 @@ X-KDE-ServiceTypes=Plasma/Applet
X-KDE-PluginInfo-Author=%{AUTHOR}
X-KDE-PluginInfo-Email=%{EMAIL}
X-KDE-PluginInfo-Name=%{APPNAMELC}
X-KDE-PluginInfo-Name=org.kde.plasma.%{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