mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 03:45:56 +01:00
Neater system tray initialisation.
This commit is contained in:
parent
2669b4aebd
commit
4799823ed1
@ -102,11 +102,7 @@ const char* MainWindow::kAllFilesFilterSpec =
|
||||
MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
ui_(new Ui_MainWindow),
|
||||
#ifdef Q_OS_DARWIN
|
||||
tray_icon_(new MacSystemTrayIcon(this)),
|
||||
#else
|
||||
tray_icon_(new QtSystemTrayIcon(this)),
|
||||
#endif
|
||||
tray_icon_(SystemTrayIcon::CreateSystemTrayIcon(this)),
|
||||
osd_(new OSD(tray_icon_, network, this)),
|
||||
edit_tag_dialog_(new EditTagDialog),
|
||||
about_dialog_(new About),
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
#include "systemtrayicon.h"
|
||||
|
||||
#include "macsystemtrayicon.h"
|
||||
#include "qtsystemtrayicon.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QEvent>
|
||||
#include <QWheelEvent>
|
||||
@ -94,3 +97,11 @@ void SystemTrayIcon::SetStopped() {
|
||||
current_state_icon_ = QPixmap();
|
||||
UpdateIcon();
|
||||
}
|
||||
|
||||
SystemTrayIcon* SystemTrayIcon::CreateSystemTrayIcon(QObject* parent) {
|
||||
#ifdef Q_OS_DARWIN
|
||||
return new MacSystemTrayIcon(parent);
|
||||
#else
|
||||
return new QtSystemTrayIcon(parent);
|
||||
#endif
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ class SystemTrayIcon : public QObject {
|
||||
virtual void ShowPopup(const QString& summary, const QString& message,
|
||||
int timeout) {}
|
||||
|
||||
static SystemTrayIcon* CreateSystemTrayIcon(QObject* parent = 0);
|
||||
|
||||
public slots:
|
||||
void SetProgress(int percentage);
|
||||
void SetPaused();
|
||||
|
Loading…
Reference in New Issue
Block a user