Handling pre-main window status notifications
This commit is contained in:
parent
6cdd5a0583
commit
17accd23ac
3 changed files with 13 additions and 6 deletions
|
|
@ -4,6 +4,7 @@ Bug fixes:
|
|||
- #6900 Remaining SonarCloud reported bug items (test fixed)
|
||||
- #6889 Systray Icon on Ubuntu Auto Start (take 2)
|
||||
- #6910 Don't use the word “Version” for release names because it can lead to errors during update checking.
|
||||
- #69XX Handling pre-main window creation status notifications
|
||||
===========
|
||||
|
||||
v1.13.0-stable
|
||||
|
|
|
|||
|
|
@ -12,8 +12,3 @@ void TrayIcon::tryCreate() const
|
|||
QTimer::singleShot(2500, this, &TrayIcon::tryCreate);
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::set(const QIcon& icon) const
|
||||
{
|
||||
m_pTrayIcon->setIcon(icon);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,15 @@ class TrayIcon : public QObject
|
|||
public:
|
||||
using TConnector = std::function<void(QObject const *, const char *)>;
|
||||
|
||||
TrayIcon()
|
||||
{
|
||||
set = [this](const QIcon &icon){
|
||||
m_init = [this,icon](){
|
||||
this->set(icon);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
template<typename TActionContainer>
|
||||
void create(TActionContainer const &actionContainer, TConnector const &connector)
|
||||
{
|
||||
|
|
@ -30,16 +39,18 @@ public:
|
|||
m_pTrayIcon = std::make_unique<QSystemTrayIcon>();
|
||||
m_pTrayIcon->setContextMenu(m_pTrayIconMenu.get());
|
||||
m_pTrayIcon->setToolTip("Synergy");
|
||||
set = [this](const QIcon& icon) { m_pTrayIcon->setIcon(icon); };
|
||||
|
||||
tryCreate();
|
||||
}
|
||||
|
||||
void tryCreate() const;
|
||||
|
||||
void set(const QIcon& icon) const;
|
||||
std::function<void(const QIcon& icon)> set;
|
||||
|
||||
private:
|
||||
std::unique_ptr<QSystemTrayIcon> m_pTrayIcon {};
|
||||
std::unique_ptr<QMenu> m_pTrayIconMenu {};
|
||||
TConnector m_connector;
|
||||
std::function<void()> m_init;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue