Add and default to icon type in notifiations
parent
f233b312fc
commit
f9ba57eb6d
|
|
@ -283,12 +283,19 @@ void IntegrationPluginKodi::executeAction(ThingActionInfo *info)
|
|||
|
||||
int commandId = -1;
|
||||
if (action.actionTypeId() == kodiNotifyActionTypeId) {
|
||||
QString notificationType = action.param(kodiNotifyActionTypeParamTypeId).value().toString();
|
||||
QUrl notificationUrl = thing->setting(kodiSettingsNotificationCustomIconUrlParamTypeId).toUrl();
|
||||
QString imageString;
|
||||
if (thing->setting(kodiSettingsNotificationUseCustomIconParamTypeId).toBool()) {
|
||||
if (notificationType == "icon") {
|
||||
if (!notificationUrl.isEmpty() && notificationUrl.isValid()) {
|
||||
imageString = notificationUrl.toString();
|
||||
} else {
|
||||
imageString = action.param(kodiNotifyActionTypeParamTypeId).value().toString();
|
||||
// No valid icon url configured. Let's fallback to info
|
||||
imageString = "info";
|
||||
}
|
||||
} else {
|
||||
// info, warning, error
|
||||
imageString = notificationType;
|
||||
}
|
||||
|
||||
commandId = kodi->showNotification(
|
||||
|
|
@ -421,9 +428,9 @@ void IntegrationPluginKodi::onConnectionChanged(bool connected)
|
|||
}
|
||||
}
|
||||
|
||||
QUrl notificationUrl = thing->setting(kodiSettingsNotificationCustomIconUrlParamTypeId).toUrl();
|
||||
QString imageString;
|
||||
if (thing->setting(kodiSettingsNotificationUseCustomIconParamTypeId).toBool()) {
|
||||
QUrl notificationUrl = thing->setting(kodiSettingsNotificationCustomIconUrlParamTypeId).toUrl();
|
||||
if (!notificationUrl.isEmpty() && notificationUrl.isValid()) {
|
||||
imageString = notificationUrl.toString();
|
||||
} else {
|
||||
imageString = "info";
|
||||
|
|
|
|||
|
|
@ -52,13 +52,6 @@
|
|||
"type": "QString",
|
||||
"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",
|
||||
"name": "notificationDuration",
|
||||
|
|
@ -263,8 +256,9 @@
|
|||
"name": "type",
|
||||
"displayName": "type",
|
||||
"type": "QString",
|
||||
"defaultValue": "info",
|
||||
"defaultValue": "icon",
|
||||
"allowedValues": [
|
||||
"icon",
|
||||
"info",
|
||||
"warning",
|
||||
"error"
|
||||
|
|
|
|||
Loading…
Reference in New Issue