UI: Tray Menu: Move Options & Zones to Options sub-menu

This commit is contained in:
Nodir Temirkhodjaev 2023-01-17 12:09:23 +03:00
parent ada64a6887
commit b1ed2a4f10
2 changed files with 20 additions and 8 deletions

View File

@ -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);

View File

@ -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;