mirror of
https://github.com/tnodir/fort
synced 2024-11-15 11:35:07 +00:00
UI: TrayIcon: Refactor windows visibility handling
This commit is contained in:
parent
36f89efea0
commit
9ee0b96fb3
@ -13,8 +13,7 @@
|
||||
#include <form/controls/clickablemenu.h>
|
||||
#include <form/controls/controlutil.h>
|
||||
#include <form/controls/mainwindow.h>
|
||||
#include <form/graph/graphwindow.h>
|
||||
#include <form/opt/optionswindow.h>
|
||||
#include <form/windowtypes.h>
|
||||
#include <fortsettings.h>
|
||||
#include <manager/hotkeymanager.h>
|
||||
#include <manager/windowmanager.h>
|
||||
@ -295,10 +294,8 @@ void TrayIcon::switchFilterModeMenu(bool /*checked*/)
|
||||
|
||||
void TrayIcon::setupController()
|
||||
{
|
||||
connect(windowManager()->optWindow(), &WidgetWindow::visibilityChanged, this,
|
||||
&TrayIcon::updateTrayMenuFlags);
|
||||
connect(windowManager()->graphWindow(), &WidgetWindow::visibilityChanged, m_graphAction,
|
||||
&QAction::setChecked);
|
||||
connect(windowManager(), &WindowManager::windowVisibilityChanged, this,
|
||||
&TrayIcon::onWindowVisibilityChanged);
|
||||
|
||||
connect(settings(), &FortSettings::passwordCheckedChanged, this,
|
||||
&TrayIcon::updateTrayMenuFlags);
|
||||
@ -738,3 +735,15 @@ void TrayIcon::onTrayActivatedByClick(TrayIcon::ClickType clickType, bool checkT
|
||||
m_trayTriggered = false;
|
||||
onMouseClicked(clickType);
|
||||
}
|
||||
|
||||
void TrayIcon::onWindowVisibilityChanged(quint32 code, bool isVisible)
|
||||
{
|
||||
switch (code) {
|
||||
case WindowOptions: {
|
||||
updateTrayMenuFlags();
|
||||
} break;
|
||||
case WindowGraph: {
|
||||
m_graphAction->setChecked(isVisible);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,8 @@ private:
|
||||
void onTrayActivatedByTrigger();
|
||||
void onTrayActivatedByClick(TrayIcon::ClickType clickType, bool checkTriggered = false);
|
||||
|
||||
void onWindowVisibilityChanged(quint32 code, bool isVisible);
|
||||
|
||||
private:
|
||||
bool m_trayTriggered : 1;
|
||||
bool m_alerted : 1;
|
||||
|
Loading…
Reference in New Issue
Block a user