Add and default to icon type in notifiations
parent
f233b312fc
commit
f9ba57eb6d
|
|
@ -283,12 +283,19 @@ void IntegrationPluginKodi::executeAction(ThingActionInfo *info)
|
||||||
|
|
||||||
int commandId = -1;
|
int commandId = -1;
|
||||||
if (action.actionTypeId() == kodiNotifyActionTypeId) {
|
if (action.actionTypeId() == kodiNotifyActionTypeId) {
|
||||||
|
QString notificationType = action.param(kodiNotifyActionTypeParamTypeId).value().toString();
|
||||||
QUrl notificationUrl = thing->setting(kodiSettingsNotificationCustomIconUrlParamTypeId).toUrl();
|
QUrl notificationUrl = thing->setting(kodiSettingsNotificationCustomIconUrlParamTypeId).toUrl();
|
||||||
QString imageString;
|
QString imageString;
|
||||||
if (thing->setting(kodiSettingsNotificationUseCustomIconParamTypeId).toBool()) {
|
if (notificationType == "icon") {
|
||||||
imageString = notificationUrl.toString();
|
if (!notificationUrl.isEmpty() && notificationUrl.isValid()) {
|
||||||
|
imageString = notificationUrl.toString();
|
||||||
|
} else {
|
||||||
|
// No valid icon url configured. Let's fallback to info
|
||||||
|
imageString = "info";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
imageString = action.param(kodiNotifyActionTypeParamTypeId).value().toString();
|
// info, warning, error
|
||||||
|
imageString = notificationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
commandId = kodi->showNotification(
|
commandId = kodi->showNotification(
|
||||||
|
|
@ -421,9 +428,9 @@ void IntegrationPluginKodi::onConnectionChanged(bool connected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl notificationUrl = thing->setting(kodiSettingsNotificationCustomIconUrlParamTypeId).toUrl();
|
|
||||||
QString imageString;
|
QString imageString;
|
||||||
if (thing->setting(kodiSettingsNotificationUseCustomIconParamTypeId).toBool()) {
|
QUrl notificationUrl = thing->setting(kodiSettingsNotificationCustomIconUrlParamTypeId).toUrl();
|
||||||
|
if (!notificationUrl.isEmpty() && notificationUrl.isValid()) {
|
||||||
imageString = notificationUrl.toString();
|
imageString = notificationUrl.toString();
|
||||||
} else {
|
} else {
|
||||||
imageString = "info";
|
imageString = "info";
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,6 @@
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"defaultValue": "https://downloads.nymea.io/nymea-icons/kodi-notification/nymea-logo.png"
|
"defaultValue": "https://downloads.nymea.io/nymea-icons/kodi-notification/nymea-logo.png"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "2c534f37-e1c2-4762-8e38-1718306739f1",
|
|
||||||
"name": "notificationUseCustomIcon",
|
|
||||||
"displayName": "Use notification icon",
|
|
||||||
"type": "bool",
|
|
||||||
"defaultValue": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "55133408-794a-4c32-a7f1-f59e83e6eae7",
|
"id": "55133408-794a-4c32-a7f1-f59e83e6eae7",
|
||||||
"name": "notificationDuration",
|
"name": "notificationDuration",
|
||||||
|
|
@ -263,8 +256,9 @@
|
||||||
"name": "type",
|
"name": "type",
|
||||||
"displayName": "type",
|
"displayName": "type",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"defaultValue": "info",
|
"defaultValue": "icon",
|
||||||
"allowedValues": [
|
"allowedValues": [
|
||||||
|
"icon",
|
||||||
"info",
|
"info",
|
||||||
"warning",
|
"warning",
|
||||||
"error"
|
"error"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue