Browse Source

Show GUI lock icon after system tray icon is initialized

adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
cca93c2be2
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 10
      src/gui/mainwindow.cpp
  2. 3
      src/gui/mainwindow.h

10
src/gui/mainwindow.cpp

@ -177,6 +177,10 @@ MainWindow::MainWindow(QWidget *parent)
lockMenu->addAction(tr("&Set Password"), this, &MainWindow::defineUILockPassword); lockMenu->addAction(tr("&Set Password"), this, &MainWindow::defineUILockPassword);
lockMenu->addAction(tr("&Clear Password"), this, &MainWindow::clearUILockPassword); lockMenu->addAction(tr("&Clear Password"), this, &MainWindow::clearUILockPassword);
m_ui->actionLock->setMenu(lockMenu); m_ui->actionLock->setMenu(lockMenu);
connect(this, &MainWindow::systemTrayIconCreated, this, [this]()
{
m_ui->actionLock->setVisible(true);
});
// Creating Bittorrent session // Creating Bittorrent session
updateAltSpeedsBtn(BitTorrent::Session::instance()->isAltGlobalSpeedLimitEnabled()); updateAltSpeedsBtn(BitTorrent::Session::instance()->isAltGlobalSpeedLimitEnabled());
@ -1484,9 +1488,7 @@ void MainWindow::loadPreferences()
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
// system tray icon // system tray icon
const bool useSystray = pref->systemTrayEnabled(); if (pref->systemTrayEnabled())
m_ui->actionLock->setVisible(useSystray);
if (useSystray)
{ {
if (m_systrayIcon) if (m_systrayIcon)
{ {
@ -1502,6 +1504,7 @@ void MainWindow::loadPreferences()
{ {
delete m_systrayIcon; delete m_systrayIcon;
delete m_trayIconMenu; delete m_trayIconMenu;
m_ui->actionLock->setVisible(false);
} }
#endif #endif
@ -1713,6 +1716,7 @@ void MainWindow::createTrayIcon(const int retries)
connect(m_systrayIcon, &QSystemTrayIcon::messageClicked, this, &MainWindow::balloonClicked); connect(m_systrayIcon, &QSystemTrayIcon::messageClicked, this, &MainWindow::balloonClicked);
m_systrayIcon->show(); m_systrayIcon->show();
emit systemTrayIconCreated();
} }
else else
{ {

3
src/gui/mainwindow.h

@ -108,6 +108,9 @@ public:
void showNotificationBalloon(const QString &title, const QString &msg) const; void showNotificationBalloon(const QString &title, const QString &msg) const;
signals:
void systemTrayIconCreated();
private slots: private slots:
void showFilterContextMenu(const QPoint &); void showFilterContextMenu(const QPoint &);
void balloonClicked(); void balloonClicked();

Loading…
Cancel
Save