mirror of
https://github.com/tnodir/fort
synced 2024-11-15 09:36:28 +00:00
UI: Unify "Menu" button creation
This commit is contained in:
parent
611e8865e0
commit
2fe847f3af
@ -90,7 +90,6 @@ void HomeWindow::retranslateUi()
|
||||
|
||||
m_btPasswordLock->setText(tr("Lock"));
|
||||
m_btPasswordUnlock->setText(tr("Unlock"));
|
||||
m_btMenu->setText(tr("Menu"));
|
||||
|
||||
m_btLogs->setText(tr("Logs"));
|
||||
m_btProfile->setText(tr("Profile"));
|
||||
@ -152,7 +151,7 @@ QWidget *HomeWindow::setupHeader()
|
||||
frame->setPalette(palette);
|
||||
|
||||
auto layout = new QHBoxLayout();
|
||||
layout->setContentsMargins(16, 6, 16, 6);
|
||||
layout->setContentsMargins(16, 6, 6, 6);
|
||||
layout->setSpacing(10);
|
||||
|
||||
// Logo image
|
||||
@ -170,8 +169,7 @@ QWidget *HomeWindow::setupHeader()
|
||||
setupPasswordButtons();
|
||||
|
||||
// Menu button
|
||||
m_btMenu = ControlUtil::createButton(":/icons/large_tiles.png");
|
||||
m_btMenu->setMenu(windowManager()->trayIcon()->menu());
|
||||
m_btMenu = windowManager()->createMenuButton();
|
||||
|
||||
layout->addWidget(iconLogo);
|
||||
layout->addLayout(textLogo);
|
||||
|
@ -80,8 +80,7 @@ void OptMainPage::setupTabBar()
|
||||
m_tabWidget->addTab(schedulePage, IconCache::icon(":/icons/clock.png"), QString());
|
||||
|
||||
// Menu button
|
||||
m_btMenu = ControlUtil::createLinkButton(":/icons/large_tiles.png");
|
||||
m_btMenu->setMenu(windowManager()->trayIcon()->menu());
|
||||
m_btMenu = windowManager()->createMenuButton();
|
||||
|
||||
m_tabWidget->setCornerWidget(m_btMenu);
|
||||
|
||||
|
@ -211,8 +211,7 @@ QLayout *ProgramsWindow::setupHeader()
|
||||
&WindowManager::showServicesWindow);
|
||||
|
||||
// Menu button
|
||||
m_btMenu = ControlUtil::createLinkButton(":/icons/large_tiles.png");
|
||||
m_btMenu->setMenu(windowManager()->trayIcon()->menu());
|
||||
m_btMenu = windowManager()->createMenuButton();
|
||||
|
||||
layout->addWidget(m_btEdit);
|
||||
layout->addWidget(ControlUtil::createSeparator(Qt::Vertical));
|
||||
|
@ -48,8 +48,7 @@ void StatMainPage::setupTabBar()
|
||||
m_tabWidget->addTab(connectionsPage, IconCache::icon(":/icons/connect.png"), QString());
|
||||
|
||||
// Menu button
|
||||
m_btMenu = ControlUtil::createLinkButton(":/icons/large_tiles.png");
|
||||
m_btMenu->setMenu(windowManager()->trayIcon()->menu());
|
||||
m_btMenu = windowManager()->createMenuButton();
|
||||
|
||||
m_tabWidget->setCornerWidget(m_btMenu);
|
||||
}
|
||||
|
@ -5,11 +5,13 @@
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QProcess>
|
||||
#include <QPushButton>
|
||||
#include <QStyle>
|
||||
#include <QStyleFactory>
|
||||
#include <QStyleHints>
|
||||
|
||||
#include <conf/confmanager.h>
|
||||
#include <form/controls/controlutil.h>
|
||||
#include <form/controls/mainwindow.h>
|
||||
#include <form/dialog/passworddialog.h>
|
||||
#include <form/graph/graphwindow.h>
|
||||
@ -88,6 +90,13 @@ void WindowManager::tearDown()
|
||||
closeAll();
|
||||
}
|
||||
|
||||
QPushButton *WindowManager::createMenuButton() const
|
||||
{
|
||||
auto c = ControlUtil::createLinkButton(":/icons/large_tiles.png");
|
||||
c->setMenu(trayIcon()->menu());
|
||||
return c;
|
||||
}
|
||||
|
||||
QFont WindowManager::defaultFont()
|
||||
{
|
||||
static QFont g_font(
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include <form/windowtypes.h>
|
||||
#include <util/ioc/iocservice.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
||||
|
||||
class GraphWindow;
|
||||
class HomeWindow;
|
||||
class MainWindow;
|
||||
@ -49,6 +51,8 @@ public:
|
||||
|
||||
bool isWindowOpen(WindowCode code) const { return isAnyWindowOpen(code); }
|
||||
|
||||
QPushButton *createMenuButton() const;
|
||||
|
||||
static QFont defaultFont();
|
||||
|
||||
signals:
|
||||
|
Loading…
Reference in New Issue
Block a user