Simplify tray icon related code

This commit is contained in:
Chocobo1
2021-12-13 15:56:20 +08:00
parent b8a84dbd83
commit 85777ea491
8 changed files with 125 additions and 140 deletions

View File

@@ -82,7 +82,6 @@ public:
QWidget *currentTabWidget() const;
TransferListWidget *transferListWidget() const;
PropertiesWidget *propertiesWidget() const;
QMenu *trayIconMenu();
// ExecutionLog properties
bool isExecutionLogEnabled() const;
@@ -132,7 +131,7 @@ private slots:
void focusSearchFilter();
void reloadSessionStats();
void reloadTorrentStats(const QVector<BitTorrent::Torrent *> &torrents);
void loadPreferences(bool configureSession = true);
void loadPreferences();
void addTorrentFailed(const QString &error) const;
void torrentNew(BitTorrent::Torrent *const torrent) const;
void finishedTorrent(BitTorrent::Torrent *const torrent) const;
@@ -189,16 +188,14 @@ private slots:
void on_actionCloseWindow_triggered();
#else
void toggleVisibility(const QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::Trigger);
void createSystrayDelayed();
void updateTrayIconMenu();
#endif
private:
void createTrayIconMenu();
#ifdef Q_OS_MACOS
void setupDockClickHandler();
#else
void createTrayIcon();
QIcon getSystrayIcon() const;
void createTrayIcon(int retries);
#endif
#ifdef Q_OS_WIN
void installPython();
@@ -227,11 +224,12 @@ private:
QPointer<StatsDialog> m_statsDlg;
QPointer<TorrentCreatorDialog> m_createTorrentDlg;
QPointer<DownloadFromURLDialog> m_downloadFromURLDialog;
#ifndef Q_OS_MACOS
QPointer<QSystemTrayIcon> m_systrayIcon;
QPointer<QTimer> m_systrayCreator;
#endif
QPointer<QMenu> m_trayIconMenu;
TransferListWidget *m_transferListWidget;
TransferListFiltersWidget *m_transferListFiltersWidget;
PropertiesWidget *m_propertiesWidget;