Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdbustrayicon_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
5#ifndef QDBUSTRAYICON_H
6#define QDBUSTRAYICON_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtGui/private/qtguiglobal_p.h>
20
21QT_REQUIRE_CONFIG(systemtrayicon);
22
23#include <QIcon>
24#include <QTemporaryFile>
25#include <QTimer>
26#include "QtGui/qpa/qplatformsystemtrayicon.h"
27#include "private/qdbusmenuconnection_p.h"
28
30
35
37{
50 Q_MOC_INCLUDE(<private/qdbusplatformmenu_p.h>)
51
52public:
54
55 virtual ~QDBusTrayIcon();
56
58
59 void init() override;
60 void cleanup() override;
61 void updateIcon(const QIcon &icon) override;
62 void updateToolTip(const QString &tooltip) override;
63 void updateMenu(QPlatformMenu *menu) override;
64 QPlatformMenu *createMenu() const override;
65 void showMessage(const QString &title, const QString &msg,
66 const QIcon &icon, MessageIcon iconType, int msecs) override;
67
68 bool isSystemTrayAvailable() const override;
69 bool supportsMessages() const override { return true; }
70 QRect geometry() const override { return QRect(); }
71
72 QString category() const { return m_category; }
73 QString status() const { return m_status; }
74 QString tooltip() const { return m_tooltip; }
75
76 QString iconName() const { return m_iconName; }
77 const QIcon & icon() const { return m_icon; }
78
79 bool isRequestingAttention() const { return m_attentionTimer.isActive(); }
80 QString attentionTitle() const { return m_messageTitle; }
81 QString attentionMessage() const { return m_message; }
82 QString attentionIconName() const { return m_attentionIconName; }
83 const QIcon & attentionIcon() const { return m_attentionIcon; }
84
85 QString instanceId() const { return m_instanceId; }
86
87 QDBusPlatformMenu *menu() { return m_menu; }
88
94 void attention();
96
97private Q_SLOTS:
98 void attentionTimerExpired();
99 void actionInvoked(uint id, const QString &action);
100 void notificationClosed(uint id, uint reason);
101 void watcherServiceRegistered(const QString &serviceName);
102
103private:
104 void setStatus(const QString &status);
105 QTemporaryFile *tempIcon(const QIcon &icon);
106
107private:
108 QDBusMenuConnection* m_dbusConnection;
110 QDBusMenuAdaptor *m_menuAdaptor;
111 QDBusPlatformMenu *m_menu;
112 QXdgNotificationInterface *m_notifier;
113 QString m_instanceId;
114 QString m_category;
115 QString m_defaultStatus;
116 QString m_status;
117 QString m_tooltip;
118 QString m_messageTitle;
119 QString m_message;
120 QIcon m_icon;
121 QTemporaryFile *m_tempIcon;
122 QString m_iconName;
123 QIcon m_attentionIcon;
124 QTemporaryFile *m_tempAttentionIcon;
125 QString m_attentionIconName;
126 QTimer m_attentionTimer;
127 bool m_registered;
128};
129
131
132#endif // QDBUSTRAYICON_H
void init() override
This method is called to initialize the platform dependent implementation.
void updateMenu(QPlatformMenu *menu) override
This method is called when the system tray menu did change.
void menuChanged()
void statusChanged(QString arg)
void categoryChanged()
bool isRequestingAttention() const
QString attentionMessage
QDBusPlatformMenu * menu
void showMessage(const QString &title, const QString &msg, const QIcon &icon, MessageIcon iconType, int msecs) override
Shows a balloon message for the entry with the given title, message msg and icon for the time specifi...
QString attentionTitle
QString attentionIconName() const
QDBusMenuConnection * dBusConnection()
void cleanup() override
This method is called to cleanup the platform dependent implementation.
QString category() const
const QIcon & icon() const
QRect geometry() const override
This method returns the geometry of the platform dependent system tray icon on the screen.
QString status() const
QString tooltip() const
void attention()
QString instanceId() const
QString attentionIconName
void tooltipChanged()
void updateIcon(const QIcon &icon) override
This method is called when the icon did change.
void iconChanged()
void updateToolTip(const QString &tooltip) override
This method is called when the tooltip text did change.
QString attentionTitle() const
bool supportsMessages() const override
Returns true if the system tray supports messages on the platform.
QString iconName() const
QDBusPlatformMenu * menu()
bool isSystemTrayAvailable() const override
Returns true if the system tray is available on the platform.
QPlatformMenu * createMenu() const override
This method allows platforms to use a different QPlatformMenu for system tray menus than what would n...
QString attentionMessage() const
const QIcon & attentionIcon() const
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
MessageIcon
This enum describes the icon that is shown when a balloon message is displayed.
\inmodule QtCore\reentrant
Definition qrect.h:30
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qtimer.h:20
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
Definition qtimer.cpp:167
Combined button and popup list for selecting options.
GLfloat GLfloat GLfloat GLfloat h
SSL_CTX int void * arg
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_MOC_INCLUDE(...)
#define signals
unsigned int uint
Definition qtypes.h:34
QString title
[35]