add translations mechanism for plugins
This commit is contained in:
parent
3db2fe81d6
commit
1e4e2ac09c
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -1,5 +1,6 @@
|
|||||||
guh (0.7.6) xenial; urgency=medium
|
guh (0.7.6) xenial; urgency=medium
|
||||||
|
|
||||||
|
* Add translations
|
||||||
* Add bluetooth server
|
* Add bluetooth server
|
||||||
|
|
||||||
-- Simon Stürz <simon.stuerz@guh.guru> Wed, 14 Sep 2016 15:43:22 +0200
|
-- Simon Stürz <simon.stuerz@guh.guru> Wed, 14 Sep 2016 15:43:22 +0200
|
||||||
|
|||||||
@ -448,7 +448,7 @@ QTranslator *DevicePlugin::translator()
|
|||||||
|
|
||||||
void DevicePlugin::setLocale(const QLocale &locale)
|
void DevicePlugin::setLocale(const QLocale &locale)
|
||||||
{
|
{
|
||||||
m_translator->load(locale, pluginName(), "_", GuhSettings::translationsPath(), ".qm");
|
m_translator->load(locale, "mock", "_", GuhSettings::translationsPath(), ".qm");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Override this if your plugin supports Device with DeviceClass::CreationMethodAuto.
|
/*! Override this if your plugin supports Device with DeviceClass::CreationMethodAuto.
|
||||||
|
|||||||
@ -79,7 +79,7 @@
|
|||||||
{
|
{
|
||||||
"id": "55d6d7a8-446f-48ae-8014-1225810d03ee",
|
"id": "55d6d7a8-446f-48ae-8014-1225810d03ee",
|
||||||
"idName": "averagePrice",
|
"idName": "averagePrice",
|
||||||
"name": "average market price [± 12 h]",
|
"name": "average market price [+/- 12 h]",
|
||||||
"index": 3,
|
"index": 3,
|
||||||
"type": "double",
|
"type": "double",
|
||||||
"unit": "EuroCentPerKiloWattHour",
|
"unit": "EuroCentPerKiloWattHour",
|
||||||
@ -89,7 +89,7 @@
|
|||||||
{
|
{
|
||||||
"id": "e7af5bdc-48d7-4e96-b877-331da4dcfae5",
|
"id": "e7af5bdc-48d7-4e96-b877-331da4dcfae5",
|
||||||
"idName": "lowestPrice",
|
"idName": "lowestPrice",
|
||||||
"name": "lowest market price [± 12 h]",
|
"name": "lowest market price [+/- 12 h]",
|
||||||
"index": 4,
|
"index": 4,
|
||||||
"type": "double",
|
"type": "double",
|
||||||
"unit": "EuroCentPerKiloWattHour",
|
"unit": "EuroCentPerKiloWattHour",
|
||||||
@ -100,7 +100,7 @@
|
|||||||
{
|
{
|
||||||
"id": "0c171c42-b070-453e-8a63-df9aebfa8533",
|
"id": "0c171c42-b070-453e-8a63-df9aebfa8533",
|
||||||
"idName": "highestPrice",
|
"idName": "highestPrice",
|
||||||
"name": "highest market price [± 12 h]",
|
"name": "highest market price [+/- 12 h]",
|
||||||
"index": 5,
|
"index": 5,
|
||||||
"type": "double",
|
"type": "double",
|
||||||
"unit": "EuroCentPerKiloWattHour",
|
"unit": "EuroCentPerKiloWattHour",
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
include (../../plugins.pri)
|
include (../../plugins.pri)
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(guh_deviceplugincommandlauncher)
|
TARGET = $$qtLibraryTarget(guh_deviceplugincommandlauncher)
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
|||||||
@ -211,7 +211,7 @@ DeviceManager::DeviceError DevicePluginMock::displayPin(const PairingTransaction
|
|||||||
Q_UNUSED(pairingTransactionId)
|
Q_UNUSED(pairingTransactionId)
|
||||||
Q_UNUSED(deviceDescriptor)
|
Q_UNUSED(deviceDescriptor)
|
||||||
|
|
||||||
qCDebug(dcMockDevice) << "Display pin!! The pin is 243681";
|
qCDebug(dcMockDevice) << QString(tr("Display pin!! The pin is 243681"));
|
||||||
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Mock Devices",
|
"name": "Mock Devices",
|
||||||
"idName": "MockDevice",
|
"idName": "MockDevice",
|
||||||
|
"translationPrefix": "mock",
|
||||||
"id": "727a4a9a-c187-446f-aadf-f1b2220607d1",
|
"id": "727a4a9a-c187-446f-aadf-f1b2220607d1",
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
TRANSLATIONS = translations/mock_en_US.ts \
|
||||||
|
translations/mock_de_DE.ts
|
||||||
|
|
||||||
|
# Note: include after the TRANSLATIONS definition
|
||||||
include(../../plugins.pri)
|
include(../../plugins.pri)
|
||||||
|
|
||||||
QT+= network
|
QT+= network
|
||||||
@ -11,5 +15,3 @@ SOURCES += \
|
|||||||
HEADERS += \
|
HEADERS += \
|
||||||
devicepluginmock.h \
|
devicepluginmock.h \
|
||||||
httpdaemon.h
|
httpdaemon.h
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
153
plugins/deviceplugins/mock/translations/mock_de_DE.ts
Normal file
153
plugins/deviceplugins/mock/translations/mock_de_DE.ts
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.1" language="de_DE">
|
||||||
|
<context>
|
||||||
|
<name>DevicePluginMock</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../devicepluginmock.cpp" line="214"/>
|
||||||
|
<source>Display pin!! The pin is 243681</source>
|
||||||
|
<translation>Pin anzeigen!! Der pin lautet 243581</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>MockDevice</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="50"/>
|
||||||
|
<source>guh</source>
|
||||||
|
<extracomment>The name of the vendor (2062d64d-3232-433c-88bc-0d33c0ba2ba6)</extracomment>
|
||||||
|
<translation>guh</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="53"/>
|
||||||
|
<source>Mock Device</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation>Pseudo Gerät</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="56"/>
|
||||||
|
<source>Mock Action 3 (async)</source>
|
||||||
|
<extracomment>The name of the ActionType fbae06d3-7666-483e-a39e-ec50fe89054e of deviceClass Mock Device</extracomment>
|
||||||
|
<translation>Pseudo Aktion 3 (async)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="59"/>
|
||||||
|
<source>Mock Action 4 (broken)</source>
|
||||||
|
<extracomment>The name of the ActionType df3cf33d-26d5-4577-9132-9823bd33fad0 of deviceClass Mock Device</extracomment>
|
||||||
|
<translation>Pseudo Aktion 4 (kaputt)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="62"/>
|
||||||
|
<source>Mock Action 5 (async, broken)</source>
|
||||||
|
<extracomment>The name of the ActionType bfe89a1d-3497-4121-8318-e77c37537219 of deviceClass Mock Device</extracomment>
|
||||||
|
<translation>Pseudo Aktion 5 (async, kaputt)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="65"/>
|
||||||
|
<source>Mock Device (Auto created)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation>Pseudo Gerät (Automatisch erstellt)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="68"/>
|
||||||
|
<source>Mock Device (Push Button)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation>Pseudo Gerät (Drückknopf)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="71"/>
|
||||||
|
<source>Wait 3 second before you continue, the push button will be pressed automatically.</source>
|
||||||
|
<extracomment>The pairing info of deviceClass Mock Device (Push Button)</extracomment>
|
||||||
|
<translation>Warten Sie 3 Sekunden bevor sie fortfahren, der Knopf wird automatisch für Sie gedrückt.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="74"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="98"/>
|
||||||
|
<source>Timeout action</source>
|
||||||
|
<extracomment>The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation>Timeout Aktion</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="77"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="101"/>
|
||||||
|
<source>color</source>
|
||||||
|
<extracomment>The name of the stateType (20dc7c22-c50e-42db-837c-2bbced939f8e) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (20dc7c22-c50e-42db-837c-2bbced939f8e) of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation>Farbe</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="80"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="104"/>
|
||||||
|
<source>percentage</source>
|
||||||
|
<extracomment>The name of the stateType (72981c04-267a-4ba0-a59e-9921d2f3af9c) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (72981c04-267a-4ba0-a59e-9921d2f3af9c) of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation>Prozent</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="83"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="107"/>
|
||||||
|
<source>allowed values</source>
|
||||||
|
<extracomment>The name of the stateType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b) of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation>Erlaubte Werte</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="86"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="110"/>
|
||||||
|
<source>double value</source>
|
||||||
|
<extracomment>The name of the stateType (53cd7c55-49b7-441b-b970-9048f20f0e2c) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (53cd7c55-49b7-441b-b970-9048f20f0e2c) of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation>Double Wert</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="89"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="113"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="119"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="125"/>
|
||||||
|
<source>bool value</source>
|
||||||
|
<extracomment>The name of the stateType (e680f7a4-b39e-46da-be41-fa3170fe3768) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (e680f7a4-b39e-46da-be41-fa3170fe3768) of deviceClass Mock Device (Display Pin)
|
||||||
|
----------
|
||||||
|
The name of the stateType (d24ede5f-4064-4898-bb84-cfb533b1fbc0) of deviceClass Mock Device (Parent)
|
||||||
|
----------
|
||||||
|
The name of the stateType (d24ede5f-4064-4898-bb84-cfb533b1fbc0) of deviceClass Mock Device (Child)</extracomment>
|
||||||
|
<translation>Bool Wert</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="92"/>
|
||||||
|
<source>Mock Device (Display Pin)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation>Pseudo Gerät (Pin Anzeigen)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="95"/>
|
||||||
|
<source>Please enter the secret which normaly will be displayed on the device. For the mockdevice the pin is 243681.</source>
|
||||||
|
<extracomment>The pairing info of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation>Bitte geben sie den Pin ein, der normalerweise auf dem Display des Gerätes angezeigt wird. Für das Pseudo-Gerät lautet der Pin eventType.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="116"/>
|
||||||
|
<source>Mock Device (Parent)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation>Pseudo Gerät (Parent)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="122"/>
|
||||||
|
<source>Mock Device (Child)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation>Pseudo Gerät (Child)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="128"/>
|
||||||
|
<source>Mock Device (InputTypes)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation>Pseudo Gerät (Eingabe Arten)</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
||||||
153
plugins/deviceplugins/mock/translations/mock_en_US.ts
Normal file
153
plugins/deviceplugins/mock/translations/mock_en_US.ts
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.1" language="en_US">
|
||||||
|
<context>
|
||||||
|
<name>DevicePluginMock</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../devicepluginmock.cpp" line="214"/>
|
||||||
|
<source>Display pin!! The pin is 243681</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>MockDevice</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="50"/>
|
||||||
|
<source>guh</source>
|
||||||
|
<extracomment>The name of the vendor (2062d64d-3232-433c-88bc-0d33c0ba2ba6)</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="53"/>
|
||||||
|
<source>Mock Device</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="56"/>
|
||||||
|
<source>Mock Action 3 (async)</source>
|
||||||
|
<extracomment>The name of the ActionType fbae06d3-7666-483e-a39e-ec50fe89054e of deviceClass Mock Device</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="59"/>
|
||||||
|
<source>Mock Action 4 (broken)</source>
|
||||||
|
<extracomment>The name of the ActionType df3cf33d-26d5-4577-9132-9823bd33fad0 of deviceClass Mock Device</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="62"/>
|
||||||
|
<source>Mock Action 5 (async, broken)</source>
|
||||||
|
<extracomment>The name of the ActionType bfe89a1d-3497-4121-8318-e77c37537219 of deviceClass Mock Device</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="65"/>
|
||||||
|
<source>Mock Device (Auto created)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="68"/>
|
||||||
|
<source>Mock Device (Push Button)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="71"/>
|
||||||
|
<source>Wait 3 second before you continue, the push button will be pressed automatically.</source>
|
||||||
|
<extracomment>The pairing info of deviceClass Mock Device (Push Button)</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="74"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="98"/>
|
||||||
|
<source>Timeout action</source>
|
||||||
|
<extracomment>The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the ActionType 54646e7c-bc54-4895-81a2-590d72d120f9 of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="77"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="101"/>
|
||||||
|
<source>color</source>
|
||||||
|
<extracomment>The name of the stateType (20dc7c22-c50e-42db-837c-2bbced939f8e) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (20dc7c22-c50e-42db-837c-2bbced939f8e) of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="80"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="104"/>
|
||||||
|
<source>percentage</source>
|
||||||
|
<extracomment>The name of the stateType (72981c04-267a-4ba0-a59e-9921d2f3af9c) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (72981c04-267a-4ba0-a59e-9921d2f3af9c) of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="83"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="107"/>
|
||||||
|
<source>allowed values</source>
|
||||||
|
<extracomment>The name of the stateType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (05f63f9c-f61e-4dcf-ad55-3f13fde2765b) of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="86"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="110"/>
|
||||||
|
<source>double value</source>
|
||||||
|
<extracomment>The name of the stateType (53cd7c55-49b7-441b-b970-9048f20f0e2c) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (53cd7c55-49b7-441b-b970-9048f20f0e2c) of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="89"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="113"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="119"/>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="125"/>
|
||||||
|
<source>bool value</source>
|
||||||
|
<extracomment>The name of the stateType (e680f7a4-b39e-46da-be41-fa3170fe3768) of deviceClass Mock Device (Push Button)
|
||||||
|
----------
|
||||||
|
The name of the stateType (e680f7a4-b39e-46da-be41-fa3170fe3768) of deviceClass Mock Device (Display Pin)
|
||||||
|
----------
|
||||||
|
The name of the stateType (d24ede5f-4064-4898-bb84-cfb533b1fbc0) of deviceClass Mock Device (Parent)
|
||||||
|
----------
|
||||||
|
The name of the stateType (d24ede5f-4064-4898-bb84-cfb533b1fbc0) of deviceClass Mock Device (Child)</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="92"/>
|
||||||
|
<source>Mock Device (Display Pin)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="95"/>
|
||||||
|
<source>Please enter the secret which normaly will be displayed on the device. For the mockdevice the pin is 243681.</source>
|
||||||
|
<extracomment>The pairing info of deviceClass Mock Device (Display Pin)</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="116"/>
|
||||||
|
<source>Mock Device (Parent)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="122"/>
|
||||||
|
<source>Mock Device (Child)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../../../build-guh-Desktop-Debug/plugins/deviceplugins/mock/plugininfo.h" line="128"/>
|
||||||
|
<source>Mock Device (InputTypes)</source>
|
||||||
|
<extracomment>The name of the deviceClass</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
||||||
@ -26,46 +26,66 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import traceback
|
import traceback
|
||||||
import json
|
import json
|
||||||
import sys
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
__version__="1.0.0"
|
__version__="1.0.0"
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='The guh-generateplugininfo is a precompiler for building plugins. This precompiler will create a plugininfo.h containing the uuid definitions from the plugin json file.')
|
# Argument parser
|
||||||
parser.add_argument("input", help="The JSON input file with the plugin description")
|
parser = argparse.ArgumentParser(description='The guh-generateplugininfo is a precompiler for building plugins. This precompiler will create a plugininfo.h containing the uuid definitions from the plugin json file and creates the translations for the plugin.')
|
||||||
parser.add_argument("output", help="The plugininfo.h outputfile file with the uuid declarations")
|
parser.add_argument('-j', '--jsonfile', help='The JSON input file name with the plugin description', metavar='jsonfile')
|
||||||
parser.add_argument('-v','--version', action='version', version=__version__)
|
parser.add_argument('-b', '--builddir', help='The path to the build directory of the plugin where the plugininfo.h file can be found.', metavar='buildpath')
|
||||||
|
parser.add_argument('-o', '--output', help='The plugininfo.h outputFile with the uuid declarations', metavar='output')
|
||||||
|
parser.add_argument('-t', '--translations', help='The translation files for the plugin.', nargs='*', type=str, metavar='*.ts')
|
||||||
|
parser.add_argument('-v', '--version', action='version', version=__version__)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
inputFile = open(args.input, "r")
|
# Get the source directors
|
||||||
outputfile = open(args.output, "w")
|
sourceDir = os.path.dirname(os.path.abspath(args.jsonfile))
|
||||||
outputfile2 = open("extern-" + args.output, "w")
|
|
||||||
|
|
||||||
print "%s -> %s" %(args.input, args.output)
|
print "Json file: %s" % args.jsonfile
|
||||||
|
print "Output: %s/%s" % (args.builddir, args.output)
|
||||||
|
print "Build directory: %s" % args.builddir
|
||||||
|
print "Source directory: %s" % sourceDir
|
||||||
|
print "Translations: %s" % args.translations
|
||||||
|
|
||||||
|
# Tuple ('string to translate', 'comment for translater')
|
||||||
|
translationStrings = []
|
||||||
|
|
||||||
variableNames = []
|
variableNames = []
|
||||||
externDefinitions = []
|
externDefinitions = []
|
||||||
|
|
||||||
|
|
||||||
|
# Open files
|
||||||
|
inputFile = open(args.jsonfile, "r")
|
||||||
|
outputFile = open(args.builddir + "/" + args.output, "w")
|
||||||
|
outputFileExtern = open(args.builddir + "/" + "extern-" + args.output, "w")
|
||||||
|
|
||||||
|
# Read json file
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pluginMap = json.loads(inputFile.read())
|
pluginMap = json.loads(inputFile.read())
|
||||||
except ValueError as e:
|
inputFile.close()
|
||||||
print " --> Error loading input file \"%s\"" % (sys.argv[1])
|
except ValueError as error:
|
||||||
print " %s" % (e)
|
print " --> Error loading input file \"%s\"" % (args.input)
|
||||||
|
print " %s" % (error)
|
||||||
|
inputFile.close()
|
||||||
exit -1
|
exit -1
|
||||||
|
|
||||||
|
# Methods
|
||||||
|
|
||||||
def writePluginInfo(line):
|
def writePluginInfo(line):
|
||||||
outputfile.write("%s\n" % line)
|
outputFile.write("%s\n" % line)
|
||||||
|
|
||||||
|
|
||||||
def writeExternPluginInfo(line):
|
def writeExternPluginInfo(line):
|
||||||
outputfile2.write("%s\n" % line)
|
outputFileExtern.write("%s\n" % line)
|
||||||
|
|
||||||
|
|
||||||
def extractVendors(pluginMap):
|
def extractVendors(pluginMap):
|
||||||
for vendor in pluginMap['vendors']:
|
for vendor in pluginMap['vendors']:
|
||||||
try:
|
try:
|
||||||
print("define VendorId %sVendorId = %s" % (pluginMap["idName"], vendor["id"]))
|
print("define VendorId %sVendorId = %s" % (pluginMap["idName"], vendor["id"]))
|
||||||
writePluginInfo("VendorId %sVendorId = VendorId(\"%s\");" % (vendor["idName"], vendor["id"]))
|
writePluginInfo("VendorId %sVendorId = VendorId(\"%s\");" % (vendor["idName"], vendor["id"]))
|
||||||
|
addTranslationString(vendor['name'], 'The name of the vendor (%s)' % vendor['id'])
|
||||||
createExternDefinition("VendorId", "%sVendorId" % (vendor["idName"]))
|
createExternDefinition("VendorId", "%sVendorId" % (vendor["idName"]))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@ -75,14 +95,18 @@ def extractVendors(pluginMap):
|
|||||||
def extractDeviceClasses(vendorMap):
|
def extractDeviceClasses(vendorMap):
|
||||||
for deviceClass in vendorMap["deviceClasses"]:
|
for deviceClass in vendorMap["deviceClasses"]:
|
||||||
try:
|
try:
|
||||||
variableName = "%sDeviceClassId" % (deviceClass["idName"])
|
variableName = "%sDeviceClassId" % (deviceClass['idName'])
|
||||||
|
addTranslationString(deviceClass['name'], 'The name of the deviceClass')
|
||||||
|
if 'pairingInfo' in deviceClass:
|
||||||
|
addTranslationString(deviceClass['pairingInfo'], 'The pairing info of deviceClass %s' % deviceClass['name'])
|
||||||
|
|
||||||
if not variableName in variableNames:
|
if not variableName in variableNames:
|
||||||
variableNames.append(variableName)
|
variableNames.append(variableName)
|
||||||
print("define DeviceClassId %s = %s" % (variableName, deviceClass["deviceClassId"]))
|
print('define DeviceClassId %s = %s' % (variableName, deviceClass['deviceClassId']))
|
||||||
writePluginInfo("DeviceClassId %s = DeviceClassId(\"%s\");" % (variableName, deviceClass["deviceClassId"]))
|
writePluginInfo('DeviceClassId %s = DeviceClassId(\"%s\");' % (variableName, deviceClass['deviceClassId']))
|
||||||
createExternDefinition("DeviceClassId", variableName)
|
createExternDefinition('DeviceClassId', variableName)
|
||||||
else:
|
else:
|
||||||
print("duplicated variable name \"%s\" for DeviceClassId %s -> skipping") % (variableName, deviceClass["deviceClassId"])
|
print("duplicated variable name \"%s\" for DeviceClassId %s -> skipping") % (variableName, deviceClass['deviceClassId'])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
extractActionTypes(deviceClass)
|
extractActionTypes(deviceClass)
|
||||||
@ -92,9 +116,10 @@ def extractDeviceClasses(vendorMap):
|
|||||||
|
|
||||||
def extractStateTypes(deviceClassMap):
|
def extractStateTypes(deviceClassMap):
|
||||||
try:
|
try:
|
||||||
for stateType in deviceClassMap["stateTypes"]:
|
for stateType in deviceClassMap['stateTypes']:
|
||||||
try:
|
try:
|
||||||
variableName = "%sStateTypeId" % (stateType["idName"])
|
variableName = "%sStateTypeId" % (stateType["idName"])
|
||||||
|
addTranslationString(stateType['name'], 'The name of the stateType (%s) of deviceClass %s' % (stateType["id"], deviceClassMap['name']))
|
||||||
if not variableName in variableNames:
|
if not variableName in variableNames:
|
||||||
variableNames.append(variableName)
|
variableNames.append(variableName)
|
||||||
print("define StateTypeId %s = %s" % (variableName, stateType["id"]))
|
print("define StateTypeId %s = %s" % (variableName, stateType["id"]))
|
||||||
@ -102,6 +127,7 @@ def extractStateTypes(deviceClassMap):
|
|||||||
createExternDefinition("StateTypeId", variableName)
|
createExternDefinition("StateTypeId", variableName)
|
||||||
else:
|
else:
|
||||||
print("duplicated variable name \"%s\" for StateTypeId %s -> skipping") % (variableName, stateType["id"])
|
print("duplicated variable name \"%s\" for StateTypeId %s -> skipping") % (variableName, stateType["id"])
|
||||||
|
|
||||||
# create ActionTypeId if the state is writable
|
# create ActionTypeId if the state is writable
|
||||||
if 'writable' in stateType:
|
if 'writable' in stateType:
|
||||||
if stateType['writable']:
|
if stateType['writable']:
|
||||||
@ -124,6 +150,7 @@ def extractActionTypes(deviceClassMap):
|
|||||||
for actionType in deviceClassMap["actionTypes"]:
|
for actionType in deviceClassMap["actionTypes"]:
|
||||||
try:
|
try:
|
||||||
variableName = "%sActionTypeId" % (actionType["idName"])
|
variableName = "%sActionTypeId" % (actionType["idName"])
|
||||||
|
addTranslationString(actionType["name"], 'The name of the ActionType %s of deviceClass %s' % (actionType["id"], deviceClassMap['name']))
|
||||||
if not variableName in variableNames:
|
if not variableName in variableNames:
|
||||||
variableNames.append(variableName)
|
variableNames.append(variableName)
|
||||||
writePluginInfo("ActionTypeId %s = ActionTypeId(\"%s\");" % (variableName, actionType["id"]))
|
writePluginInfo("ActionTypeId %s = ActionTypeId(\"%s\");" % (variableName, actionType["id"]))
|
||||||
@ -141,6 +168,7 @@ def extractEventTypes(deviceClassMap):
|
|||||||
for eventType in deviceClassMap["eventTypes"]:
|
for eventType in deviceClassMap["eventTypes"]:
|
||||||
try:
|
try:
|
||||||
variableName = "%sEventTypeId" % (eventType["idName"])
|
variableName = "%sEventTypeId" % (eventType["idName"])
|
||||||
|
addTranslationString(eventType["name"], 'The name of the EventType %s of deviceClass %s' % (eventType["id"], deviceClassMap['name']))
|
||||||
if not variableName in variableNames:
|
if not variableName in variableNames:
|
||||||
variableNames.append(variableName)
|
variableNames.append(variableName)
|
||||||
writePluginInfo("EventTypeId %s = EventTypeId(\"%s\");" % (variableName, eventType["id"]))
|
writePluginInfo("EventTypeId %s = EventTypeId(\"%s\");" % (variableName, eventType["id"]))
|
||||||
@ -152,6 +180,7 @@ def extractEventTypes(deviceClassMap):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def createExternDefinition(type, name):
|
def createExternDefinition(type, name):
|
||||||
definition = {}
|
definition = {}
|
||||||
definition['type'] = type
|
definition['type'] = type
|
||||||
@ -159,10 +188,41 @@ def createExternDefinition(type, name):
|
|||||||
externDefinitions.append(definition)
|
externDefinitions.append(definition)
|
||||||
|
|
||||||
|
|
||||||
|
def addTranslationString(string, comment):
|
||||||
|
translationStrings.append([string, comment])
|
||||||
|
#translationStrings.append([unicode(string, "utf-8"), unicode(comment, "utf-8")])
|
||||||
|
|
||||||
|
def writeTranslationStrings():
|
||||||
|
if len(args.translations) is 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(translationStrings) is not 0:
|
||||||
|
writePluginInfo("// Translation strings")
|
||||||
|
writePluginInfo("const QString translations[] {")
|
||||||
|
|
||||||
|
for index, value in enumerate(translationStrings):
|
||||||
|
writePluginInfo(" //: %s" % value[1])
|
||||||
|
if index != len(translationStrings) - 1:
|
||||||
|
writePluginInfo(" QT_TRANSLATE_NOOP(\"%s\", \"%s\"), \n" % (pluginMap["idName"], value[0]))
|
||||||
|
else:
|
||||||
|
writePluginInfo(" QT_TRANSLATE_NOOP(\"%s\", \"%s\")" % (pluginMap["idName"], value[0]))
|
||||||
|
|
||||||
|
writePluginInfo("};")
|
||||||
|
|
||||||
|
|
||||||
|
def createTranslationFiles():
|
||||||
|
for translation in args.translations:
|
||||||
|
translationFile = (sourceDir + "/" + translation)
|
||||||
|
translationOutput = os.path.splitext(translationFile)[0] + '.qm'
|
||||||
|
print " --> Translation update %s" % translationFile
|
||||||
|
print subprocess.check_output(['lupdate', '-recursive', sourceDir, (args.builddir + "/" + args.output), '-ts', translationFile])
|
||||||
|
print " --> Translation release %s" % translationOutput
|
||||||
|
print subprocess.check_output(['lrelease', translationFile, '-qm', translationOutput])
|
||||||
|
|
||||||
##################################################################################################################
|
##################################################################################################################
|
||||||
# write plugininfo.h
|
# write plugininfo.h
|
||||||
print " --> generate plugininfo.h"
|
|
||||||
print "PluginId for plugin \"%s\" = %s" %(pluginMap['name'], pluginMap['id'])
|
print " --> generate plugininfo.h for plugin \"%s\" = %s" % (pluginMap['name'], pluginMap['id'])
|
||||||
|
|
||||||
writePluginInfo("/* This file is generated by the guh build system. Any changes to this file will")
|
writePluginInfo("/* This file is generated by the guh build system. Any changes to this file will")
|
||||||
writePluginInfo(" * be lost.")
|
writePluginInfo(" * be lost.")
|
||||||
@ -173,29 +233,45 @@ writePluginInfo(" */")
|
|||||||
writePluginInfo("")
|
writePluginInfo("")
|
||||||
writePluginInfo("#ifndef PLUGININFO_H")
|
writePluginInfo("#ifndef PLUGININFO_H")
|
||||||
writePluginInfo("#define PLUGININFO_H")
|
writePluginInfo("#define PLUGININFO_H")
|
||||||
writePluginInfo("#include \"typeutils.h\"")
|
writePluginInfo("")
|
||||||
writePluginInfo("#include <QLoggingCategory>")
|
writePluginInfo("#include <QLoggingCategory>")
|
||||||
|
writePluginInfo("#include <QObject>")
|
||||||
|
writePluginInfo("")
|
||||||
|
writePluginInfo("#include \"typeutils.h\"")
|
||||||
writePluginInfo("")
|
writePluginInfo("")
|
||||||
writePluginInfo("// Id definitions")
|
writePluginInfo("// Id definitions")
|
||||||
writePluginInfo("PluginId pluginId = PluginId(\"%s\");" % pluginMap['id'])
|
writePluginInfo("PluginId pluginId = PluginId(\"%s\");" % pluginMap['id'])
|
||||||
|
|
||||||
extractVendors(pluginMap)
|
extractVendors(pluginMap)
|
||||||
|
|
||||||
writePluginInfo("")
|
writePluginInfo("")
|
||||||
writePluginInfo("// Loging category")
|
writePluginInfo("// Loging category")
|
||||||
|
|
||||||
if 'idName' in pluginMap:
|
if 'idName' in pluginMap:
|
||||||
writePluginInfo("Q_DECLARE_LOGGING_CATEGORY(dc%s)" % pluginMap['idName'])
|
writePluginInfo('Q_DECLARE_LOGGING_CATEGORY(dc%s)' % pluginMap['idName'])
|
||||||
writePluginInfo("Q_LOGGING_CATEGORY(dc%s, \"%s\")" % (pluginMap['idName'], pluginMap['idName']))
|
writePluginInfo('Q_LOGGING_CATEGORY(dc%s, \"%s\")' % (pluginMap['idName'], pluginMap['idName']))
|
||||||
print "define logging category: \"dc%s\"" % pluginMap['idName']
|
print 'define logging category: \"dc%s\"' % pluginMap['idName']
|
||||||
|
|
||||||
|
writePluginInfo("")
|
||||||
|
|
||||||
|
# Write translation strings
|
||||||
|
writeTranslationStrings()
|
||||||
|
|
||||||
writePluginInfo("")
|
writePluginInfo("")
|
||||||
writePluginInfo("#endif // PLUGININFO_H")
|
writePluginInfo("#endif // PLUGININFO_H")
|
||||||
print " --> generated successfully \"%s\"" % sys.argv[2]
|
outputFile.close()
|
||||||
|
print " --> generated successfully \"%s\"" % (args.output)
|
||||||
|
|
||||||
##################################################################################################################
|
##################################################################################################################
|
||||||
# write extern-plugininfo.h
|
# Translate
|
||||||
print " --> generate extern-plugininfo.h"
|
if len(translationStrings) is not 0:
|
||||||
|
createTranslationFiles()
|
||||||
|
|
||||||
|
##################################################################################################################
|
||||||
|
# Write extern-plugininfo.h
|
||||||
|
|
||||||
|
print " --> generate extern-plugininfo.h for plugin \"%s\" = %s" % (pluginMap['name'], pluginMap['id'])
|
||||||
|
|
||||||
writeExternPluginInfo("/* This file is generated by the guh build system. Any changes to this file will")
|
writeExternPluginInfo("/* This file is generated by the guh build system. Any changes to this file will")
|
||||||
writeExternPluginInfo(" * be lost.")
|
writeExternPluginInfo(" * be lost.")
|
||||||
writeExternPluginInfo(" *")
|
writeExternPluginInfo(" *")
|
||||||
@ -221,5 +297,8 @@ if 'idName' in pluginMap:
|
|||||||
|
|
||||||
writeExternPluginInfo("")
|
writeExternPluginInfo("")
|
||||||
writeExternPluginInfo("#endif // EXTERNPLUGININFO_H")
|
writeExternPluginInfo("#endif // EXTERNPLUGININFO_H")
|
||||||
|
outputFileExtern.close()
|
||||||
|
print " --> generated successfully \"extern-%s\"" % (args.output)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print " --> generated successfully \"extern-%s\"" % (sys.argv[2])
|
|
||||||
|
|||||||
@ -13,14 +13,24 @@ contains(DEFINES, BLUETOOTH_LE) {
|
|||||||
INCLUDEPATH += $$top_srcdir/libguh
|
INCLUDEPATH += $$top_srcdir/libguh
|
||||||
LIBS += -L../../../libguh -lguh
|
LIBS += -L../../../libguh -lguh
|
||||||
|
|
||||||
|
# Create plugininfo file
|
||||||
infofile.output = plugininfo.h
|
infofile.output = plugininfo.h
|
||||||
infofile.commands = $$top_srcdir/plugins/guh-generateplugininfo ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT}
|
|
||||||
infofile.depends = $$top_srcdir/plugins/guh-generateplugininfo
|
infofile.depends = $$top_srcdir/plugins/guh-generateplugininfo
|
||||||
infofile.CONFIG = no_link
|
infofile.CONFIG = no_link
|
||||||
JSONFILES = deviceplugin"$$TARGET".json
|
JSONFILES = deviceplugin"$$TARGET".json
|
||||||
infofile.input = JSONFILES
|
infofile.input = JSONFILES
|
||||||
|
infofile.commands = $$top_srcdir/plugins/guh-generateplugininfo -j ${QMAKE_FILE_NAME} \
|
||||||
|
-o ${QMAKE_FILE_OUT} \
|
||||||
|
-b $$OUT_PWD \
|
||||||
|
-t $$TRANSLATIONS
|
||||||
|
|
||||||
QMAKE_EXTRA_COMPILERS += infofile
|
QMAKE_EXTRA_COMPILERS += infofile
|
||||||
|
|
||||||
|
# Install translation files
|
||||||
|
translations.path = /usr/share/guh/translations
|
||||||
|
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
|
||||||
|
|
||||||
|
# Install plugin
|
||||||
target.path = /usr/lib/guh/plugins/
|
target.path = /usr/lib/guh/plugins/
|
||||||
INSTALLS += target
|
INSTALLS += target translations
|
||||||
|
|
||||||
|
|||||||
@ -24,11 +24,13 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMessageLogger>
|
#include <QMessageLogger>
|
||||||
|
#include <QTranslator>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
#include <QString>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
@ -131,14 +133,15 @@ int main(int argc, char *argv[])
|
|||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
QString applicationDescription = QString("\nguh ( /[guːh]/ ) is an open source IoT (Internet of Things) server, \n"
|
QString applicationDescription = QCoreApplication::translate("main", "\nguh ( /[guːh]/ ) is an open source IoT (Internet of Things) server, \n"
|
||||||
"which allows to control a lot of different devices from many different \n"
|
"which allows to control a lot of different devices from many different \n"
|
||||||
"manufacturers. With the powerful rule engine you are able to connect any \n"
|
"manufacturers. With the powerful rule engine you are able to connect any \n"
|
||||||
"device available in the system and create individual scenes and behaviors \n"
|
"device available in the system and create individual scenes and behaviors \n"
|
||||||
"for your environment.\n\n"
|
"for your environment.\n\n");
|
||||||
"guhd %1 %2 2014-2016 guh GmbH\n"
|
|
||||||
"Released under the GNU GENERAL PUBLIC LICENSE Version 2.\n\n"
|
applicationDescription.append(QString("guhd %1 %2 2014-2016 guh GmbH\n"
|
||||||
"API version: %3\n").arg(GUH_VERSION_STRING).arg(QChar(0xA9)).arg(JSON_PROTOCOL_VERSION);
|
"Released under the GNU GENERAL PUBLIC LICENSE Version 2.\n\n"
|
||||||
|
"API version: %3\n").arg(GUH_VERSION_STRING).arg(QChar(0xA9)).arg(JSON_PROTOCOL_VERSION));
|
||||||
|
|
||||||
parser.setApplicationDescription(applicationDescription);
|
parser.setApplicationDescription(applicationDescription);
|
||||||
|
|
||||||
@ -162,7 +165,7 @@ int main(int argc, char *argv[])
|
|||||||
debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
|
debugDescription += "\n- " + filterName + " (" + (s_loggingFilters.value(filterName) ? "yes" : "no") + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
QCommandLineOption allOption(QStringList() << "p" << "print-all", "Enables all debug categories. This parameter overrides all debug category parameters.");
|
QCommandLineOption allOption(QStringList() << "p" << "print-all", QCoreApplication::translate("main", "Enables all debug categories. This parameter overrides all debug category parameters."));
|
||||||
parser.addOption(allOption);
|
parser.addOption(allOption);
|
||||||
QCommandLineOption debugOption(QStringList() << "d" << "debug-category", debugDescription, "[No]DebugCategory");
|
QCommandLineOption debugOption(QStringList() << "d" << "debug-category", debugDescription, "[No]DebugCategory");
|
||||||
parser.addOption(debugOption);
|
parser.addOption(debugOption);
|
||||||
@ -182,7 +185,7 @@ int main(int argc, char *argv[])
|
|||||||
if (s_loggingFilters.contains(debugArea)) {
|
if (s_loggingFilters.contains(debugArea)) {
|
||||||
s_loggingFilters[debugArea] = enable;
|
s_loggingFilters[debugArea] = enable;
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcApplication) << "No such debug category:" << debugArea;
|
qCWarning(dcApplication) << QCoreApplication::translate("main", "No such debug category:") << debugArea;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -16,7 +16,20 @@ LIBS += -L$$top_builddir/libguh/ -lguh
|
|||||||
TRANSLATIONS *= $$top_srcdir/translations/guhd_en_US.ts \
|
TRANSLATIONS *= $$top_srcdir/translations/guhd_en_US.ts \
|
||||||
$$top_srcdir/translations/guhd_de_DE.ts
|
$$top_srcdir/translations/guhd_de_DE.ts
|
||||||
|
|
||||||
include(../translations.pri)
|
# Update ts files and create translation qm files
|
||||||
|
lrelease.input = TRANSLATIONS
|
||||||
|
lrelease.CONFIG += no_link
|
||||||
|
lrelease.output = $$top_srcdir/${QMAKE_FILE_BASE}.qm
|
||||||
|
lrelease.commands = $$[QT_INSTALL_BINS]/lupdate $$_FILE_; \
|
||||||
|
$$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm;
|
||||||
|
|
||||||
|
QMAKE_EXTRA_COMPILERS += lrelease
|
||||||
|
PRE_TARGETDEPS += compiler_lrelease_make_all
|
||||||
|
|
||||||
|
# Install translation files
|
||||||
|
translations.path = /usr/share/guh/translations
|
||||||
|
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
|
||||||
|
INSTALLS += translations
|
||||||
|
|
||||||
# Server files
|
# Server files
|
||||||
include(server.pri)
|
include(server.pri)
|
||||||
|
|||||||
@ -68,12 +68,23 @@
|
|||||||
"enabled": "Bool"
|
"enabled": "Bool"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Configuration.GetAvailableLanguages": {
|
||||||
|
"description": "Returns a list of locale codes available for the server. i.e. en_US, de_AT",
|
||||||
|
"params": {
|
||||||
|
},
|
||||||
|
"returns": {
|
||||||
|
"languages": [
|
||||||
|
"String"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"Configuration.GetConfigurations": {
|
"Configuration.GetConfigurations": {
|
||||||
"description": "Get all configuration parameters of the server.",
|
"description": "Get all configuration parameters of the server.",
|
||||||
"params": {
|
"params": {
|
||||||
},
|
},
|
||||||
"returns": {
|
"returns": {
|
||||||
"basicConfiguration": {
|
"basicConfiguration": {
|
||||||
|
"language": "String",
|
||||||
"serverName": "String",
|
"serverName": "String",
|
||||||
"serverTime": "Uint",
|
"serverTime": "Uint",
|
||||||
"serverUuid": "Uuid",
|
"serverUuid": "Uuid",
|
||||||
@ -106,6 +117,15 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Configuration.SetLanguage": {
|
||||||
|
"description": "Sets the server language to the given language. See also: \"GetAvailableLanguages\"",
|
||||||
|
"params": {
|
||||||
|
"language": "String"
|
||||||
|
},
|
||||||
|
"returns": {
|
||||||
|
"configurationError": "$ref:ConfigurationError"
|
||||||
|
}
|
||||||
|
},
|
||||||
"Configuration.SetServerName": {
|
"Configuration.SetServerName": {
|
||||||
"description": "Set the name of the server. Default is guhIO.",
|
"description": "Set the name of the server. Default is guhIO.",
|
||||||
"params": {
|
"params": {
|
||||||
|
|||||||
@ -1,17 +1,3 @@
|
|||||||
include(guh.pri)
|
include(guh.pri)
|
||||||
|
|
||||||
# Create translation files
|
|
||||||
lrelease.input = TRANSLATIONS
|
|
||||||
lrelease.output = $$top_srcdir/${QMAKE_FILE_BASE}.qm
|
|
||||||
lrelease.commands = $$[QT_INSTALL_BINS]/lupdate ${QMAKE_FILE_IN} -ts $$TRANSLATIONS; $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm
|
|
||||||
lrelease.CONFIG += no_link
|
|
||||||
|
|
||||||
QMAKE_EXTRA_COMPILERS += lrelease
|
|
||||||
PRE_TARGETDEPS += compiler_lrelease_make_all
|
|
||||||
|
|
||||||
message("Translations:" $$TRANSLATIONS )
|
|
||||||
|
|
||||||
translations.path = /usr/share/guh/translations
|
|
||||||
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
|
|
||||||
|
|
||||||
INSTALLS += translations
|
|
||||||
|
|||||||
@ -4,17 +4,46 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>main</name>
|
<name>main</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../server/main.cpp" line="145"/>
|
<location filename="../server/main.cpp" line="136"/>
|
||||||
<source>Run guhd in the foreground, not as daemon.</source>
|
<source>
|
||||||
<translation>Starte guhd im Vordergrund, nicht als service.</translation>
|
guh ( /[guːh]/ ) is an open source IoT (Internet of Things) server,
|
||||||
|
which allows to control a lot of different devices from many different
|
||||||
|
manufacturers. With the powerful rule engine you are able to connect any
|
||||||
|
device available in the system and create individual scenes and behaviors
|
||||||
|
for your environment.
|
||||||
|
|
||||||
|
</source>
|
||||||
|
<translation>
|
||||||
|
guh ( /[guːh]/ ) ist ein Opensource IoT (Internet der Dinge) Server,
|
||||||
|
der es ermöglicht viele verschiedene Geräte von unterschiedlichen
|
||||||
|
Herstellern anzusteuern. Durch das eingebaute Regelwerk wird es ermöglicht,
|
||||||
|
die im System verfügbaren Geräte miteinander zu verbinden und individuelle
|
||||||
|
Szenen undVerhaltensweisen des Systems festzulegen.
|
||||||
|
|
||||||
|
</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../server/main.cpp" line="148"/>
|
<location filename="../server/main.cpp" line="148"/>
|
||||||
|
<source>Run guhd in the foreground, not as daemon.</source>
|
||||||
|
<translation>Starte guhd im Vordergrund, nicht als Service.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../server/main.cpp" line="151"/>
|
||||||
<source>Debug categories to enable. Prefix with "No" to disable. Warnings from all categories will be printed unless explicitly muted with "NoWarnings".
|
<source>Debug categories to enable. Prefix with "No" to disable. Warnings from all categories will be printed unless explicitly muted with "NoWarnings".
|
||||||
|
|
||||||
Categories are:</source>
|
Categories are:</source>
|
||||||
<translation>Zu aktivierende Debug-Kategorien. Kategorien mit dem Präfix "No" werden deaktiviert. Warnungen werden von allen Kategorien ausgegeben außer sie wurden explizit mit dem Prefix "NoWarnings" deaktiviert.
|
<translation>Zu aktivierende Debug-Kategorien. Kategorien mit dem Präfix "No" werden deaktiviert. Warnungen werden von allen Kategorien angezeigt außer sie wurden explizit mit dem Prefix "NoWarnings" deaktiviert.
|
||||||
Kategorien sind:</translation>
|
Es gibt folgende Kategorien:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../server/main.cpp" line="168"/>
|
||||||
|
<source>Enables all debug categories. This parameter overrides all debug category parameters.</source>
|
||||||
|
<translation>Aktiviere alle Debug-Kategorien. Dieser Parameter überschreibt alle anderen Debug-Kategorien Parameter.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../server/main.cpp" line="188"/>
|
||||||
|
<source>No such debug category:</source>
|
||||||
|
<translation>Diese Debug-Kategorie existiert nicht:</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|||||||
@ -4,16 +4,38 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>main</name>
|
<name>main</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../server/main.cpp" line="145"/>
|
<location filename="../server/main.cpp" line="136"/>
|
||||||
<source>Run guhd in the foreground, not as daemon.</source>
|
<source>
|
||||||
|
guh ( /[guːh]/ ) is an open source IoT (Internet of Things) server,
|
||||||
|
which allows to control a lot of different devices from many different
|
||||||
|
manufacturers. With the powerful rule engine you are able to connect any
|
||||||
|
device available in the system and create individual scenes and behaviors
|
||||||
|
for your environment.
|
||||||
|
|
||||||
|
</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../server/main.cpp" line="148"/>
|
<location filename="../server/main.cpp" line="148"/>
|
||||||
|
<source>Run guhd in the foreground, not as daemon.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../server/main.cpp" line="151"/>
|
||||||
<source>Debug categories to enable. Prefix with "No" to disable. Warnings from all categories will be printed unless explicitly muted with "NoWarnings".
|
<source>Debug categories to enable. Prefix with "No" to disable. Warnings from all categories will be printed unless explicitly muted with "NoWarnings".
|
||||||
|
|
||||||
Categories are:</source>
|
Categories are:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../server/main.cpp" line="168"/>
|
||||||
|
<source>Enables all debug categories. This parameter overrides all debug category parameters.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../server/main.cpp" line="188"/>
|
||||||
|
<source>No such debug category:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|||||||
Reference in New Issue
Block a user