mirror of
https://github.com/tnodir/fort
synced 2024-11-15 13:26:48 +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/clickablemenu.h>
|
||||||
#include <form/controls/controlutil.h>
|
#include <form/controls/controlutil.h>
|
||||||
#include <form/controls/mainwindow.h>
|
#include <form/controls/mainwindow.h>
|
||||||
#include <form/graph/graphwindow.h>
|
#include <form/windowtypes.h>
|
||||||
#include <form/opt/optionswindow.h>
|
|
||||||
#include <fortsettings.h>
|
#include <fortsettings.h>
|
||||||
#include <manager/hotkeymanager.h>
|
#include <manager/hotkeymanager.h>
|
||||||
#include <manager/windowmanager.h>
|
#include <manager/windowmanager.h>
|
||||||
@ -295,10 +294,8 @@ void TrayIcon::switchFilterModeMenu(bool /*checked*/)
|
|||||||
|
|
||||||
void TrayIcon::setupController()
|
void TrayIcon::setupController()
|
||||||
{
|
{
|
||||||
connect(windowManager()->optWindow(), &WidgetWindow::visibilityChanged, this,
|
connect(windowManager(), &WindowManager::windowVisibilityChanged, this,
|
||||||
&TrayIcon::updateTrayMenuFlags);
|
&TrayIcon::onWindowVisibilityChanged);
|
||||||
connect(windowManager()->graphWindow(), &WidgetWindow::visibilityChanged, m_graphAction,
|
|
||||||
&QAction::setChecked);
|
|
||||||
|
|
||||||
connect(settings(), &FortSettings::passwordCheckedChanged, this,
|
connect(settings(), &FortSettings::passwordCheckedChanged, this,
|
||||||
&TrayIcon::updateTrayMenuFlags);
|
&TrayIcon::updateTrayMenuFlags);
|
||||||
@ -738,3 +735,15 @@ void TrayIcon::onTrayActivatedByClick(TrayIcon::ClickType clickType, bool checkT
|
|||||||
m_trayTriggered = false;
|
m_trayTriggered = false;
|
||||||
onMouseClicked(clickType);
|
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 onTrayActivatedByTrigger();
|
||||||
void onTrayActivatedByClick(TrayIcon::ClickType clickType, bool checkTriggered = false);
|
void onTrayActivatedByClick(TrayIcon::ClickType clickType, bool checkTriggered = false);
|
||||||
|
|
||||||
|
void onWindowVisibilityChanged(quint32 code, bool isVisible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_trayTriggered : 1;
|
bool m_trayTriggered : 1;
|
||||||
bool m_alerted : 1;
|
bool m_alerted : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user