service/notifications: use DROP_EMIT_SET for notification properties

This commit is contained in:
outfoxxed 2024-07-30 12:20:39 -07:00
parent 3a8e67e8ab
commit 8873a06962
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -8,6 +8,7 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h> #include <qtypes.h>
#include "../../core/util.hpp"
#include "../../core/desktopentry.hpp" #include "../../core/desktopentry.hpp"
#include "../../core/iconimageprovider.hpp" #include "../../core/iconimageprovider.hpp"
#include "dbusimage.hpp" #include "dbusimage.hpp"
@ -130,29 +131,20 @@ void Notification::updateProperties(
} }
} }
auto appNameChanged = appName != this->mAppName; DROP_EMIT_SET(this, appName, mAppName, appNameChanged);
auto appIconChanged = appIcon != this->mAppIcon; DROP_EMIT_SET(this, appIcon, mAppIcon, appIconChanged);
auto summaryChanged = summary != this->mSummary; DROP_EMIT_SET(this, summary, mSummary, summaryChanged);
auto bodyChanged = body != this->mBody; DROP_EMIT_SET(this, body, mBody, bodyChanged);
auto expireTimeoutChanged = expireTimeout != this->mExpireTimeout; DROP_EMIT_SET(this, expireTimeout, mExpireTimeout, expireTimeoutChanged);
auto urgencyChanged = urgency != this->mUrgency; DEFINE_DROP_EMIT_IF(urgency != this->mUrgency, this, urgencyChanged);
auto hasActionIconsChanged = hasActionIcons != this->mHasActionIcons; DROP_EMIT_SET(this, hasActionIcons, mHasActionIcons, hasActionIconsChanged);
auto isResidentChanged = isResident != this->mIsResident; DROP_EMIT_SET(this, isResident, mIsResident, isResidentChanged);
auto isTransientChanged = isTransient != this->mIsTransient; DROP_EMIT_SET(this, isTransient, mIsTransient, isTransientChanged);
auto desktopEntryChanged = desktopEntry != this->mDesktopEntry; DROP_EMIT_SET(this, desktopEntry, mDesktopEntry, desktopEntryChanged);
auto imageChanged = imagePixmap || imagePath != this->mImagePath; DEFINE_DROP_EMIT_IF(imagePixmap || imagePath != this->mImagePath, this, imageChanged);
auto hintsChanged = hints != this->mHints; DROP_EMIT_SET(this, hints, mHints, hintsChanged);
if (appNameChanged) this->mAppName = appName;
if (appIconChanged) this->mAppIcon = appIcon;
if (summaryChanged) this->mSummary = summary;
if (bodyChanged) this->mBody = body;
if (expireTimeoutChanged) this->mExpireTimeout = expireTimeout;
if (urgencyChanged) this->mUrgency = static_cast<NotificationUrgency::Enum>(urgency); if (urgencyChanged) this->mUrgency = static_cast<NotificationUrgency::Enum>(urgency);
if (hasActionIcons) this->mHasActionIcons = hasActionIcons;
if (isResidentChanged) this->mIsResident = isResident;
if (isTransientChanged) this->mIsTransient = isTransient;
if (desktopEntryChanged) this->mDesktopEntry = desktopEntry;
NotificationImage* oldImage = nullptr; NotificationImage* oldImage = nullptr;
@ -203,19 +195,7 @@ void Notification::updateProperties(
<< "sent an action set of an invalid length."; << "sent an action set of an invalid length.";
} }
if (appNameChanged) emit this->appNameChanged();
if (appIconChanged) emit this->appIconChanged();
if (summaryChanged) emit this->summaryChanged();
if (bodyChanged) emit this->bodyChanged();
if (expireTimeoutChanged) emit this->expireTimeoutChanged();
if (urgencyChanged) emit this->urgencyChanged();
if (actionsChanged) emit this->actionsChanged(); if (actionsChanged) emit this->actionsChanged();
if (hasActionIconsChanged) emit this->hasActionIconsChanged();
if (isResidentChanged) emit this->isResidentChanged();
if (isTransientChanged) emit this->isTransientChanged();
if (desktopEntryChanged) emit this->desktopEntryChanged();
if (imageChanged) emit this->imageChanged();
if (hintsChanged) emit this->hintsChanged();
for (auto* action: deletedActions) { for (auto* action: deletedActions) {
delete action; delete action;