mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:55:54 +00:00
UI: HomeWindow: Show menu on activation
This commit is contained in:
parent
ac61771bc3
commit
2806813f48
@ -23,6 +23,12 @@ HomeWindow::HomeWindow(QWidget *parent) :
|
||||
setupUi();
|
||||
setupController();
|
||||
setupStateWatcher();
|
||||
|
||||
connect(this, &HomeWindow::activationChanged, this, [&] {
|
||||
if (isActiveWindow()) {
|
||||
m_btMenu->showMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ConfManager *HomeWindow::confManager() const
|
||||
|
@ -240,6 +240,9 @@ void TrayIcon::onTrayActivated(QSystemTrayIcon::ActivationReason reason)
|
||||
|
||||
void TrayIcon::updateTrayIcon(bool alerted)
|
||||
{
|
||||
if (m_alerted == alerted)
|
||||
return;
|
||||
|
||||
m_alerted = alerted;
|
||||
m_animatedAlert = false;
|
||||
|
||||
|
@ -327,6 +327,7 @@ void FortManager::show()
|
||||
if (iniUser.trayShowIcon()) {
|
||||
windowManager->showTrayIcon();
|
||||
} else {
|
||||
windowManager->setupHomeWindow(/*quitOnClose=*/true);
|
||||
windowManager->showHomeWindow();
|
||||
}
|
||||
|
||||
|
@ -146,14 +146,6 @@ void WindowManager::closeMainWindow()
|
||||
m_mainWindow = nullptr;
|
||||
}
|
||||
|
||||
void WindowManager::setupHomeWindow()
|
||||
{
|
||||
m_homeWindow = new HomeWindow();
|
||||
m_homeWindow->restoreWindowState();
|
||||
|
||||
connect(m_homeWindow, &HomeWindow::aboutToClose, this, &WindowManager::closeHomeWindow);
|
||||
}
|
||||
|
||||
void WindowManager::setupProgramsWindow()
|
||||
{
|
||||
m_progWindow = new ProgramsWindow();
|
||||
@ -269,14 +261,27 @@ void WindowManager::showTrayMessage(const QString &message, WindowManager::TrayM
|
||||
m_trayIcon->showMessage(QGuiApplication::applicationDisplayName(), message);
|
||||
}
|
||||
|
||||
void WindowManager::setupHomeWindow(bool quitOnClose)
|
||||
{
|
||||
if (m_homeWindow)
|
||||
return;
|
||||
|
||||
m_homeWindow = new HomeWindow();
|
||||
m_homeWindow->restoreWindowState();
|
||||
|
||||
if (quitOnClose) {
|
||||
connect(m_homeWindow, &HomeWindow::aboutToClose, trayIcon(), &TrayIcon::quitProgram);
|
||||
} else {
|
||||
connect(m_homeWindow, &HomeWindow::aboutToClose, this, &WindowManager::closeHomeWindow);
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManager::showHomeWindow()
|
||||
{
|
||||
if (!widgetVisibleByCheckPassword(m_homeWindow))
|
||||
return;
|
||||
|
||||
if (!m_homeWindow) {
|
||||
setupHomeWindow();
|
||||
}
|
||||
setupHomeWindow();
|
||||
|
||||
showWidget(m_homeWindow);
|
||||
}
|
||||
@ -291,10 +296,6 @@ void WindowManager::closeHomeWindow()
|
||||
|
||||
m_homeWindow->deleteLater();
|
||||
m_homeWindow = nullptr;
|
||||
|
||||
if (!trayIcon()->isVisible()) {
|
||||
trayIcon()->quitProgram();
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManager::showProgramsWindow()
|
||||
|
@ -57,6 +57,7 @@ public slots:
|
||||
void showTrayMessage(
|
||||
const QString &message, WindowManager::TrayMessageType type = MessageOptions);
|
||||
|
||||
void setupHomeWindow(bool quitOnClose = false);
|
||||
void showHomeWindow();
|
||||
void closeHomeWindow();
|
||||
|
||||
@ -107,7 +108,6 @@ private:
|
||||
void setupMainWindow();
|
||||
void closeMainWindow();
|
||||
|
||||
void setupHomeWindow();
|
||||
void setupProgramsWindow();
|
||||
void setupOptionsWindow();
|
||||
void setupPoliciesWindow();
|
||||
|
Loading…
Reference in New Issue
Block a user