LeechCraft 0.6.70-19424-g027e980fd1
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
fancytrayiconfreedesktop.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <QObject>
12#include <QDBusAbstractAdaptor>
13#include "fancytrayiconimpl.h"
14
15namespace LC::Util
16{
18}
19
20namespace LC::Util::detail
21{
22 struct IconFrame
23 {
24 int Width_;
26 QByteArray Data_;
27
28 static IconFrame FromPixmap (const QPixmap&);
29 };
30
32 {
33 QString Title_;
34 QString Subtitle_;
35 };
36}
37
40
41namespace LC::Util::detail
42{
43 class SNIAdaptor : public QDBusAbstractAdaptor
44 {
45 Q_OBJECT
46
47 // KDE seems to expect `org.kde.StatusNotifierItem` contrary to the spec
48 Q_CLASSINFO ("D-Bus Interface", "org.kde.StatusNotifierItem")
49
50 Q_PROPERTY (QString Category MEMBER Category_ CONSTANT)
51 Q_PROPERTY (quint32 WindowId MEMBER WindowId_ CONSTANT)
52
53 Q_PROPERTY (QString Id READ GetId CONSTANT)
54 Q_PROPERTY (QString Title READ GetTitle)
55 Q_PROPERTY (QString Status READ GetStatus NOTIFY NewStatus)
56
57 Q_PROPERTY (QString IconName READ GetIconName)
58 Q_PROPERTY (QList<LC::Util::detail::IconFrame> IconPixmap READ GetIconPixmap NOTIFY NewIcon)
59
60 Q_PROPERTY (LC::Util::detail::DBusTooltip ToolTip READ GetTooltip NOTIFY NewTooltip)
61
63
64 const QString Category_ = QStringLiteral ("ApplicationStatus");
65 const QString Status_ = QStringLiteral ("Active");
66 const quint32 WindowId_ = 0;
67 public:
69 public slots:
70 void ContextMenu (int x, int y);
71 void Activate (int, int);
72 void SecondaryActivate (int, int);
73 void Scroll (int, const QString&);
74 private:
75 QString GetId () const;
76 QString GetTitle () const;
77 QString GetStatus () const;
78 QString GetIconName () const;
79 QList<IconFrame> GetIconPixmap () const;
80 DBusTooltip GetTooltip () const;
81 signals:
82 void NewIcon ();
83 void NewTooltip ();
84 void NewStatus ();
85 };
86}
87
88namespace LC::Util
89{
91 {
92 friend class detail::SNIAdaptor;
93
94 FancyTrayIcon& FTI_;
95
96 detail::SNIAdaptor Adaptor_;
97 public:
99
100 void UpdateIcon () override;
101 void UpdateTooltip () override;
102 void UpdateMenu () override;
103 void UpdateStatus () override;
104 };
105}
QList< LC::Util::detail::IconFrame > IconPixmap
LC::Util::detail::DBusTooltip ToolTip
SNIAdaptor(FancyTrayIconFreedesktop &)
Definition constants.h:15
static IconFrame FromPixmap(const QPixmap &)
Q_DECLARE_METATYPE(QVariantList *)