LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
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 
12 namespace LC::Util
13 {
15  : FancyTrayIconImpl { &icon }
16  , FTI_ { icon }
17  {
18  Icon_.setVisible (true);
19  connect (&Icon_,
20  &QSystemTrayIcon::activated,
21  [&icon] (QSystemTrayIcon::ActivationReason reason)
22  {
23  switch (reason)
24  {
25  case QSystemTrayIcon::Trigger:
26  emit icon.activated ();
27  break;
28  case QSystemTrayIcon::MiddleClick:
29  emit icon.secondaryActivated ();
30  break;
31  default:
32  break;
33  }
34  });
35  }
36 
38  {
39  const auto& icon = Util::Visit (FTI_.GetIcon (),
40  [] (const QString& filename) { return QIcon { filename }; },
41  [] (const QIcon& icon) { return icon; });
42  Icon_.setIcon (icon);
43  }
44 
46  {
47 #if Q_OS_WIN
48  Icon_.setToolTip (FTI_.GetTooltip ().Plain_);
49 #else
50  Icon_.setToolTip (FTI_.GetTooltip ().HTML_);
51 #endif
52  }
53 
55  {
56  Icon_.setContextMenu (FTI_.GetContextMenu ());
57  }
58 
60  {
61  }
62 }
QMenu * GetContextMenu() const
const Icon & GetIcon() const
const Tooltip & GetTooltip() const
auto Visit(const Either< Left, Right > &either, Args &&... args)
Definition: either.h:215