Gentoo Archives: gentoo-commits

From: Davide Pesavento <pesa@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/qt:master commit in: dev-qt/qtwidgets/, dev-qt/qtwidgets/files/
Date: Sat, 28 Jun 2014 01:50:39
Message-Id: 1403920108.dec357e79272b00c9d5e5a6113a3147f9fe1ad73.pesa@gentoo
1 commit: dec357e79272b00c9d5e5a6113a3147f9fe1ad73
2 Author: David Heidelberger <david.heidelberger <AT> ixit <DOT> cz>
3 AuthorDate: Fri Jun 27 16:49:47 2014 +0000
4 Commit: Davide Pesavento <pesa <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 28 01:48:28 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/qt.git;a=commit;h=dec357e7
7
8 [dev-qt/qtwidgets] Cherry pick systray improvement from dev branch.
9
10 Recommended by KDE developers, for more information see
11 http://blog.martin-graesslin.com/blog/2014/06/where-are-my-systray-icons/
12
13 ---
14 .../files/qtwidgets-5.3.1-prefer-qpa.patch | 343 +++++++++++++++++++++
15 ...gets-5.3.1.ebuild => qtwidgets-5.3.1-r1.ebuild} | 5 +
16 dev-qt/qtwidgets/qtwidgets-5.3.9999.ebuild | 5 +
17 3 files changed, 353 insertions(+)
18
19 diff --git a/dev-qt/qtwidgets/files/qtwidgets-5.3.1-prefer-qpa.patch b/dev-qt/qtwidgets/files/qtwidgets-5.3.1-prefer-qpa.patch
20 new file mode 100644
21 index 0000000..2a5d130
22 --- /dev/null
23 +++ b/dev-qt/qtwidgets/files/qtwidgets-5.3.1-prefer-qpa.patch
24 @@ -0,0 +1,343 @@
25 +From f1ee10f81ac18789e9a7dc715b464415ba2bc2b8 Mon Sep 17 00:00:00 2001
26 +From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= <mgraesslin@×××.org>
27 +Date: Wed, 19 Feb 2014 11:01:44 +0100
28 +Subject: Prefer QPA implementation in qsystemtrayicon_x11 if available
29 +
30 +In order to have the possibility to provide a custom QSystemTrayIcon
31 +implementation in the platform theme instead of the X11 xembed based
32 +one, the qpa implementation needs to be called. This was not possible
33 +as qpa and x11 implementation were compile time mutual exclusive.
34 +
35 +This change moves the qpa implementation in the shared part and the
36 +methods in qsystemtrayicon_qpa just delegate to them. In addition the
37 +_x11 part tries to create a QPlatformSystemTrayIcon through the
38 +platform theme and if that succeeds the implementation prefers the qpa
39 +variant and delegates to the same methods.
40 +
41 +Change-Id: I6b33acac63524a77ebdce39af6eb74666f8c7561
42 +Reviewed-by: Kevin Krammer <kevin.krammer@××××.com>
43 +Reviewed-by: Friedemann Kleint <Friedemann.Kleint@×××××.com>
44 +Reviewed-by: Paul Olav Tvete <paul.tvete@×××××.com>
45 +---
46 + src/widgets/util/qsystemtrayicon.cpp | 68 ++++++++++++++++++++++++++++++++
47 + src/widgets/util/qsystemtrayicon_p.h | 9 +++++
48 + src/widgets/util/qsystemtrayicon_qpa.cpp | 51 +++++-------------------
49 + src/widgets/util/qsystemtrayicon_x11.cpp | 40 ++++++++++++++++++-
50 + 4 files changed, 126 insertions(+), 42 deletions(-)
51 +
52 +diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
53 +index f1a69e6..fa318f3 100644
54 +--- a/src/widgets/util/qsystemtrayicon.cpp
55 ++++ b/src/widgets/util/qsystemtrayicon.cpp
56 +@@ -672,6 +672,74 @@ void QBalloonTip::timerEvent(QTimerEvent *e)
57 + QWidget::timerEvent(e);
58 + }
59 +
60 ++//////////////////////////////////////////////////////////////////////
61 ++void QSystemTrayIconPrivate::install_sys_qpa()
62 ++{
63 ++ qpa_sys->init();
64 ++ QObject::connect(qpa_sys, SIGNAL(activated(QPlatformSystemTrayIcon::ActivationReason)),
65 ++ q_func(), SLOT(_q_emitActivated(QPlatformSystemTrayIcon::ActivationReason)));
66 ++ QObject::connect(qpa_sys, &QPlatformSystemTrayIcon::messageClicked,
67 ++ q_func(), &QSystemTrayIcon::messageClicked);
68 ++ updateMenu_sys();
69 ++ updateIcon_sys();
70 ++ updateToolTip_sys();
71 ++}
72 ++
73 ++void QSystemTrayIconPrivate::remove_sys_qpa()
74 ++{
75 ++ qpa_sys->cleanup();
76 ++}
77 ++
78 ++QRect QSystemTrayIconPrivate::geometry_sys_qpa() const
79 ++{
80 ++ return qpa_sys->geometry();
81 ++}
82 ++
83 ++void QSystemTrayIconPrivate::updateIcon_sys_qpa()
84 ++{
85 ++ qpa_sys->updateIcon(icon);
86 ++}
87 ++
88 ++void QSystemTrayIconPrivate::updateMenu_sys_qpa()
89 ++{
90 ++ if (menu) {
91 ++ if (!menu->platformMenu()) {
92 ++ QPlatformMenu *platformMenu = qpa_sys->createMenu();
93 ++ if (platformMenu)
94 ++ menu->setPlatformMenu(platformMenu);
95 ++ }
96 ++ qpa_sys->updateMenu(menu->platformMenu());
97 ++ }
98 ++}
99 ++
100 ++void QSystemTrayIconPrivate::updateToolTip_sys_qpa()
101 ++{
102 ++ qpa_sys->updateToolTip(toolTip);
103 ++}
104 ++
105 ++void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &message,
106 ++ const QString &title,
107 ++ QSystemTrayIcon::MessageIcon icon,
108 ++ int msecs)
109 ++{
110 ++ QIcon notificationIcon;
111 ++ switch (icon) {
112 ++ case QSystemTrayIcon::Information:
113 ++ notificationIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation);
114 ++ break;
115 ++ case QSystemTrayIcon::Warning:
116 ++ notificationIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning);
117 ++ break;
118 ++ case QSystemTrayIcon::Critical:
119 ++ notificationIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical);
120 ++ break;
121 ++ default:
122 ++ break;
123 ++ }
124 ++ qpa_sys->showMessage(message, title, notificationIcon,
125 ++ static_cast<QPlatformSystemTrayIcon::MessageIcon>(icon), msecs);
126 ++}
127 ++
128 + QT_END_NAMESPACE
129 +
130 + #endif // QT_NO_SYSTEMTRAYICON
131 +diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
132 +index 211ef30..317664a 100644
133 +--- a/src/widgets/util/qsystemtrayicon_p.h
134 ++++ b/src/widgets/util/qsystemtrayicon_p.h
135 +@@ -98,6 +98,15 @@ public:
136 + QSystemTrayIconSys *sys;
137 + QPlatformSystemTrayIcon *qpa_sys;
138 + bool visible;
139 ++
140 ++private:
141 ++ void install_sys_qpa();
142 ++ void remove_sys_qpa();
143 ++ void updateIcon_sys_qpa();
144 ++ void updateToolTip_sys_qpa();
145 ++ void updateMenu_sys_qpa();
146 ++ QRect geometry_sys_qpa() const;
147 ++ void showMessage_sys_qpa(const QString &msg, const QString &title, QSystemTrayIcon::MessageIcon icon, int secs);
148 + };
149 +
150 + class QBalloonTip : public QWidget
151 +diff --git a/src/widgets/util/qsystemtrayicon_qpa.cpp b/src/widgets/util/qsystemtrayicon_qpa.cpp
152 +index f98aeaf..045641c 100644
153 +--- a/src/widgets/util/qsystemtrayicon_qpa.cpp
154 ++++ b/src/widgets/util/qsystemtrayicon_qpa.cpp
155 +@@ -65,28 +65,20 @@ QSystemTrayIconPrivate::~QSystemTrayIconPrivate()
156 +
157 + void QSystemTrayIconPrivate::install_sys()
158 + {
159 +- if (qpa_sys) {
160 +- qpa_sys->init();
161 +- QObject::connect(qpa_sys, SIGNAL(activated(QPlatformSystemTrayIcon::ActivationReason)),
162 +- q_func(), SLOT(_q_emitActivated(QPlatformSystemTrayIcon::ActivationReason)));
163 +- QObject::connect(qpa_sys, SIGNAL(messageClicked()),
164 +- q_func(), SIGNAL(messageClicked()));
165 +- updateMenu_sys();
166 +- updateIcon_sys();
167 +- updateToolTip_sys();
168 +- }
169 ++ if (qpa_sys)
170 ++ install_sys_qpa();
171 + }
172 +
173 + void QSystemTrayIconPrivate::remove_sys()
174 + {
175 + if (qpa_sys)
176 +- qpa_sys->cleanup();
177 ++ remove_sys_qpa();
178 + }
179 +
180 + QRect QSystemTrayIconPrivate::geometry_sys() const
181 + {
182 + if (qpa_sys)
183 +- return qpa_sys->geometry();
184 ++ return geometry_sys_qpa();
185 + else
186 + return QRect();
187 + }
188 +@@ -94,25 +86,19 @@ QRect QSystemTrayIconPrivate::geometry_sys() const
189 + void QSystemTrayIconPrivate::updateIcon_sys()
190 + {
191 + if (qpa_sys)
192 +- qpa_sys->updateIcon(icon);
193 ++ updateIcon_sys_qpa();
194 + }
195 +
196 + void QSystemTrayIconPrivate::updateMenu_sys()
197 + {
198 +- if (qpa_sys && menu) {
199 +- if (!menu->platformMenu()) {
200 +- QPlatformMenu *platformMenu = qpa_sys->createMenu();
201 +- if (platformMenu)
202 +- menu->setPlatformMenu(platformMenu);
203 +- }
204 +- qpa_sys->updateMenu(menu->platformMenu());
205 +- }
206 ++ if (qpa_sys)
207 ++ updateMenu_sys_qpa();
208 + }
209 +
210 + void QSystemTrayIconPrivate::updateToolTip_sys()
211 + {
212 + if (qpa_sys)
213 +- qpa_sys->updateToolTip(toolTip);
214 ++ updateToolTip_sys_qpa();
215 + }
216 +
217 + bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
218 +@@ -138,25 +124,8 @@ void QSystemTrayIconPrivate::showMessage_sys(const QString &message,
219 + QSystemTrayIcon::MessageIcon icon,
220 + int msecs)
221 + {
222 +- if (!qpa_sys)
223 +- return;
224 +-
225 +- QIcon notificationIcon;
226 +- switch (icon) {
227 +- case QSystemTrayIcon::Information:
228 +- notificationIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation);
229 +- break;
230 +- case QSystemTrayIcon::Warning:
231 +- notificationIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning);
232 +- break;
233 +- case QSystemTrayIcon::Critical:
234 +- notificationIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical);
235 +- break;
236 +- default:
237 +- break;
238 +- }
239 +- qpa_sys->showMessage(message, title, notificationIcon,
240 +- static_cast<QPlatformSystemTrayIcon::MessageIcon>(icon), msecs);
241 ++ if (qpa_sys)
242 ++ showMessage_sys_qpa(message, title, icon, msecs);
243 + }
244 +
245 + QT_END_NAMESPACE
246 +diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
247 +index 347e570..27d0418 100644
248 +--- a/src/widgets/util/qsystemtrayicon_x11.cpp
249 ++++ b/src/widgets/util/qsystemtrayicon_x11.cpp
250 +@@ -55,6 +55,9 @@
251 + #include <qscreen.h>
252 + #include <qbackingstore.h>
253 + #include <qpa/qplatformnativeinterface.h>
254 ++#include <qpa/qplatformsystemtrayicon.h>
255 ++#include <qpa/qplatformtheme.h>
256 ++#include <private/qguiapplication_p.h>
257 + #include <qdebug.h>
258 +
259 + #ifndef QT_NO_SYSTEMTRAYICON
260 +@@ -209,16 +212,22 @@ void QSystemTrayIconSys::paintEvent(QPaintEvent *)
261 +
262 + QSystemTrayIconPrivate::QSystemTrayIconPrivate()
263 + : sys(0),
264 ++ qpa_sys(QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon()),
265 + visible(false)
266 + {
267 + }
268 +
269 + QSystemTrayIconPrivate::~QSystemTrayIconPrivate()
270 + {
271 ++ delete qpa_sys;
272 + }
273 +
274 + void QSystemTrayIconPrivate::install_sys()
275 + {
276 ++ if (qpa_sys) {
277 ++ install_sys_qpa();
278 ++ return;
279 ++ }
280 + Q_Q(QSystemTrayIcon);
281 + if (!sys && locateSystemTray()) {
282 + sys = new QSystemTrayIconSys(q);
283 +@@ -229,6 +238,8 @@ void QSystemTrayIconPrivate::install_sys()
284 +
285 + QRect QSystemTrayIconPrivate::geometry_sys() const
286 + {
287 ++ if (qpa_sys)
288 ++ return geometry_sys_qpa();
289 + if (!sys)
290 + return QRect();
291 + return sys->globalGeometry();
292 +@@ -236,6 +247,10 @@ QRect QSystemTrayIconPrivate::geometry_sys() const
293 +
294 + void QSystemTrayIconPrivate::remove_sys()
295 + {
296 ++ if (qpa_sys) {
297 ++ remove_sys_qpa();
298 ++ return;
299 ++ }
300 + if (!sys)
301 + return;
302 + QBalloonTip::hideBalloon();
303 +@@ -246,17 +261,26 @@ void QSystemTrayIconPrivate::remove_sys()
304 +
305 + void QSystemTrayIconPrivate::updateIcon_sys()
306 + {
307 ++ if (qpa_sys) {
308 ++ updateIcon_sys_qpa();
309 ++ return;
310 ++ }
311 + if (sys)
312 + sys->updateIcon();
313 + }
314 +
315 + void QSystemTrayIconPrivate::updateMenu_sys()
316 + {
317 +-
318 ++ if (qpa_sys)
319 ++ updateMenu_sys_qpa();
320 + }
321 +
322 + void QSystemTrayIconPrivate::updateToolTip_sys()
323 + {
324 ++ if (qpa_sys) {
325 ++ updateToolTip_sys_qpa();
326 ++ return;
327 ++ }
328 + if (!sys)
329 + return;
330 + #ifndef QT_NO_TOOLTIP
331 +@@ -266,6 +290,11 @@ void QSystemTrayIconPrivate::updateToolTip_sys()
332 +
333 + bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
334 + {
335 ++ QScopedPointer<QPlatformSystemTrayIcon> sys(QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon());
336 ++ if (sys)
337 ++ return sys->isSystemTrayAvailable();
338 ++
339 ++ // no QPlatformSystemTrayIcon so fall back to default xcb platform behavior
340 + const QString platform = QGuiApplication::platformName();
341 + if (platform.compare(QStringLiteral("xcb"), Qt::CaseInsensitive) == 0)
342 + return locateSystemTray();
343 +@@ -274,12 +303,21 @@ bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
344 +
345 + bool QSystemTrayIconPrivate::supportsMessages_sys()
346 + {
347 ++ QScopedPointer<QPlatformSystemTrayIcon> sys(QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon());
348 ++ if (sys)
349 ++ return sys->supportsMessages();
350 ++
351 ++ // no QPlatformSystemTrayIcon so fall back to default xcb platform behavior
352 + return true;
353 + }
354 +
355 + void QSystemTrayIconPrivate::showMessage_sys(const QString &message, const QString &title,
356 + QSystemTrayIcon::MessageIcon icon, int msecs)
357 + {
358 ++ if (qpa_sys) {
359 ++ showMessage_sys_qpa(message, title, icon, msecs);
360 ++ return;
361 ++ }
362 + if (!sys)
363 + return;
364 + const QPoint g = sys->globalGeometry().topLeft();
365 +--
366 +2.0.0
367 +
368
369 diff --git a/dev-qt/qtwidgets/qtwidgets-5.3.1.ebuild b/dev-qt/qtwidgets/qtwidgets-5.3.1-r1.ebuild
370 similarity index 79%
371 rename from dev-qt/qtwidgets/qtwidgets-5.3.1.ebuild
372 rename to dev-qt/qtwidgets/qtwidgets-5.3.1-r1.ebuild
373 index e2b87e5..c50f5ce 100644
374 --- a/dev-qt/qtwidgets/qtwidgets-5.3.1.ebuild
375 +++ b/dev-qt/qtwidgets/qtwidgets-5.3.1-r1.ebuild
376 @@ -24,6 +24,11 @@ DEPEND="
377 "
378 RDEPEND="${DEPEND}"
379
380 +PATCHES=(
381 + # http://blog.martin-graesslin.com/blog/2014/06/where-are-my-systray-icons/
382 + "${FILESDIR}/${PN}-5.3.1-prefer-qpa.patch"
383 +)
384 +
385 QT5_TARGET_SUBDIRS=(
386 src/tools/uic
387 src/widgets
388
389 diff --git a/dev-qt/qtwidgets/qtwidgets-5.3.9999.ebuild b/dev-qt/qtwidgets/qtwidgets-5.3.9999.ebuild
390 index e2b87e5..c50f5ce 100644
391 --- a/dev-qt/qtwidgets/qtwidgets-5.3.9999.ebuild
392 +++ b/dev-qt/qtwidgets/qtwidgets-5.3.9999.ebuild
393 @@ -24,6 +24,11 @@ DEPEND="
394 "
395 RDEPEND="${DEPEND}"
396
397 +PATCHES=(
398 + # http://blog.martin-graesslin.com/blog/2014/06/where-are-my-systray-icons/
399 + "${FILESDIR}/${PN}-5.3.1-prefer-qpa.patch"
400 +)
401 +
402 QT5_TARGET_SUBDIRS=(
403 src/tools/uic
404 src/widgets