LeechCraft 0.6.70-19424-g027e980fd1
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
fancytrayiconfallback.cpp
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
10#include <util/sll/visitor.h>
11
12namespace LC::Util
13{
15 : FancyTrayIconImpl { &icon }
16 , FTI_ { icon }
17 {
18 Icon_.setVisible (true);
19 connect (&Icon_,
20 &QSystemTrayIcon::activated,
21 &icon,
22 [&icon] (QSystemTrayIcon::ActivationReason reason)
23 {
24 switch (reason)
25 {
26 case QSystemTrayIcon::Trigger:
27 emit icon.activated ();
28 break;
29 case QSystemTrayIcon::MiddleClick:
30 emit icon.secondaryActivated ();
31 break;
32 default:
33 break;
34 }
35 });
36 }
37
39 {
40 const auto& icon = Util::Visit (FTI_.GetIcon (),
41 [] (const QString& filename) { return QIcon { filename }; },
42 [] (const QIcon& icon) { return icon; });
43 Icon_.setIcon (icon);
44 }
45
47 {
48#if Q_OS_WIN
49 Icon_.setToolTip (FTI_.GetTooltip ().Plain_);
50#else
51 Icon_.setToolTip (FTI_.GetTooltip ().HTML_);
52#endif
53 }
54
56 {
57 Icon_.setContextMenu (FTI_.GetContextMenu ());
58 }
59
63}
auto Visit(const Either< Left, Right > &either, Args &&... args)
Definition either.h:189