From b1ed2a4f10fc3a1cacb213cc5795551cbe7a6713 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Tue, 17 Jan 2023 12:09:23 +0300 Subject: [PATCH] UI: Tray Menu: Move Options & Zones to Options sub-menu --- src/ui/form/tray/trayicon.cpp | 26 ++++++++++++++++++-------- src/ui/form/tray/trayicon.h | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/ui/form/tray/trayicon.cpp b/src/ui/form/tray/trayicon.cpp index d4381b13..c3591c9f 100644 --- a/src/ui/form/tray/trayicon.cpp +++ b/src/ui/form/tray/trayicon.cpp @@ -271,9 +271,10 @@ void TrayIcon::setupController() void TrayIcon::retranslateUi() { m_programsAction->setText(tr("Programs")); + m_optionsMenu->setTitle(tr("Options")); m_optionsAction->setText(tr("Options")); - m_statisticsAction->setText(tr("Statistics")); m_zonesAction->setText(tr("Zones")); + m_statisticsAction->setText(tr("Statistics")); m_graphAction->setText(tr("Traffic Graph")); m_filterEnabledAction->setText(tr("Filter Enabled")); @@ -312,9 +313,8 @@ void TrayIcon::setupTrayMenu() windowManager(), SLOT(showProgramsWindow())); addHotKey(m_programsAction, iniUser()->hotKeyPrograms()); - m_optionsAction = addAction(m_menu, IconCache::icon(":/icons/cog.png"), QString(), - windowManager(), SLOT(showOptionsWindow())); - addHotKey(m_optionsAction, iniUser()->hotKeyOptions()); + setupTrayMenuOptions(); + m_menu->addMenu(m_optionsMenu); m_statisticsAction = addAction(m_menu, IconCache::icon(":/icons/chart_bar.png"), QString(), windowManager(), SLOT(showStatisticsWindow())); @@ -324,10 +324,6 @@ void TrayIcon::setupTrayMenu() windowManager(), SLOT(switchGraphWindow()), true, !!windowManager()->graphWindow()); addHotKey(m_graphAction, iniUser()->hotKeyGraph()); - m_zonesAction = addAction(m_menu, IconCache::icon(":/icons/ip_class.png"), QString(), - windowManager(), SLOT(showZonesWindow())); - addHotKey(m_zonesAction, iniUser()->hotKeyZones()); - m_menu->addSeparator(); m_filterEnabledAction = @@ -374,6 +370,20 @@ void TrayIcon::setupTrayMenu() addHotKey(m_quitAction, iniUser()->hotKeyQuit()); } +void TrayIcon::setupTrayMenuOptions() +{ + m_optionsMenu = ControlUtil::createMenu(m_menu); + m_optionsMenu->setIcon(IconCache::icon(":/icons/cog.png")); + + m_optionsAction = addAction(m_optionsMenu, IconCache::icon(":/icons/cog.png"), QString(), + windowManager(), SLOT(showOptionsWindow())); + addHotKey(m_optionsAction, iniUser()->hotKeyOptions()); + + m_zonesAction = addAction(m_optionsMenu, IconCache::icon(":/icons/ip_class.png"), QString(), + windowManager(), SLOT(showZonesWindow())); + addHotKey(m_zonesAction, iniUser()->hotKeyZones()); +} + void TrayIcon::setupTrayMenuFilterMode() { m_filterModeMenu = ControlUtil::createMenu(m_menu); diff --git a/src/ui/form/tray/trayicon.h b/src/ui/form/tray/trayicon.h index 72c34993..4edbc526 100644 --- a/src/ui/form/tray/trayicon.h +++ b/src/ui/form/tray/trayicon.h @@ -85,6 +85,7 @@ private: void setupUi(); void setupTrayMenu(); + void setupTrayMenuOptions(); void setupTrayMenuFilterMode(); void updateTrayMenuFlags(); @@ -118,6 +119,7 @@ private: QMenu *m_menu = nullptr; QAction *m_programsAction = nullptr; + QMenu *m_optionsMenu = nullptr; QAction *m_optionsAction = nullptr; QAction *m_statisticsAction = nullptr; QAction *m_graphAction = nullptr;