tuned-switcher 1.1.0
Performance profile manager
Loading...
Searching...
No Matches
NotificationsManager Class Reference

#include <notificationsmanager.h>

Inheritance diagram for NotificationsManager:
Collaboration diagram for NotificationsManager:

Public Member Functions

 NotificationsManager (QObject *parent=nullptr)
 
bool ShowNotification (const QString &, const QString &) const
 
void SetNotificationSoundMode (const bool)
 

Private Member Functions

void GetCapabilities ()
 
const QImage GetNotificationImage (const int size=128) const
 
const QString FormatNotificationMessage (const QString &) const
 
const QVariantMap CreateHintsStructure () const
 
const QList< QVariant > CreateArgListStructure (const QString &, const QString &) const
 

Private Attributes

const QString NotifyBusName = QStringLiteral("org.freedesktop.Notifications")
 
const QString NotifyBusPath = QStringLiteral("/org/freedesktop/Notifications")
 
const QString NotifyBusInterface = QStringLiteral("org.freedesktop.Notifications")
 
const QString NotifyBusMethodNameCapabilities = QStringLiteral("GetCapabilities")
 
const QString NotifyBusMethodNameNotify = QStringLiteral("Notify")
 
QDBusConnection DBusInstance = QDBusConnection::sessionBus()
 
bool IsSoundEnabled = true
 
bool IsMarkupSupported
 
bool IsImagesSupported
 

Detailed Description

Class for working with native DBus notifications.

Constructor & Destructor Documentation

◆ NotificationsManager()

NotificationsManager::NotificationsManager ( QObject * parent = nullptr)
explicit

Main constructor of the NotificationsManager class.

Parameters
parentParent.

Member Function Documentation

◆ CreateArgListStructure()

const QList< QVariant > NotificationsManager::CreateArgListStructure ( const QString & title,
const QString & message ) const
private

Constructs and returns special ArgumentsList structure for the Notifications service.

Returns
ArgumentsList structure for the Notifications service.

◆ CreateHintsStructure()

const QVariantMap NotificationsManager::CreateHintsStructure ( ) const
private

Constructs and returns special Hints structure for the Notifications service.

Returns
Hints structure for the Notifications service.

◆ FormatNotificationMessage()

const QString NotificationsManager::FormatNotificationMessage ( const QString & message) const
private

Formats a message for the Notifications service based on supported features.

Parameters
messageSource string.
Returns
Formatted string for the Notifications service.

◆ GetCapabilities()

void NotificationsManager::GetCapabilities ( )
private

Gets information about available notifications capabilities and stores it in a private field.

◆ GetNotificationImage()

const QImage NotificationsManager::GetNotificationImage ( const int size = 128) const
private

Gets a default image for the Notifications service.

Parameters
sizeDesired image size. Default - 128 px.
Returns
Image for the Notifications service.

◆ SetNotificationSoundMode()

void NotificationsManager::SetNotificationSoundMode ( const bool mode)

Sets the notification sound mode: loud or silent.

Parameters
modeNotification mode: true - loud, false - silent.

◆ ShowNotification()

bool NotificationsManager::ShowNotification ( const QString & title,
const QString & message ) const

Shows DBus notification with specified title and message.

Parameters
titleNotification title.
messageNotification message.
Returns
Result of the operation.
Return values
trueThe requested operation completed successfully.
falseAn error occurred when trying to perform the requested operation.

Member Data Documentation

◆ DBusInstance

QDBusConnection NotificationsManager::DBusInstance = QDBusConnection::sessionBus()
private

Stores DBus instance.

◆ IsImagesSupported

bool NotificationsManager::IsImagesSupported
private

Stores information if the Notifications service supports images.

◆ IsMarkupSupported

bool NotificationsManager::IsMarkupSupported
private

Stores information if the Notifications service supports basic HTML markup.

◆ IsSoundEnabled

bool NotificationsManager::IsSoundEnabled = true
private

Stores if the notification sound is enabled.

◆ NotifyBusInterface

const QString NotificationsManager::NotifyBusInterface = QStringLiteral("org.freedesktop.Notifications")
private

Stores the Notifications DBus interface.

◆ NotifyBusMethodNameCapabilities

const QString NotificationsManager::NotifyBusMethodNameCapabilities = QStringLiteral("GetCapabilities")
private

Stores the Notifications DBus GetCapabilities method name.

◆ NotifyBusMethodNameNotify

const QString NotificationsManager::NotifyBusMethodNameNotify = QStringLiteral("Notify")
private

Stores the Notifications DBus Notify method name.

◆ NotifyBusName

const QString NotificationsManager::NotifyBusName = QStringLiteral("org.freedesktop.Notifications")
private

Stores the Notifications DBus interface name.

◆ NotifyBusPath

const QString NotificationsManager::NotifyBusPath = QStringLiteral("/org/freedesktop/Notifications")
private

Stores the Notifications DBus object path.


The documentation for this class was generated from the following files: