1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-17 20:09:50 +01:00

Neater system tray initialisation.

This commit is contained in:
John Maguire 2010-06-22 14:16:04 +00:00
parent 2669b4aebd
commit 4799823ed1
3 changed files with 14 additions and 5 deletions

View File

@ -102,11 +102,7 @@ const char* MainWindow::kAllFilesFilterSpec =
MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidget *parent) MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidget *parent)
: QMainWindow(parent), : QMainWindow(parent),
ui_(new Ui_MainWindow), ui_(new Ui_MainWindow),
#ifdef Q_OS_DARWIN tray_icon_(SystemTrayIcon::CreateSystemTrayIcon(this)),
tray_icon_(new MacSystemTrayIcon(this)),
#else
tray_icon_(new QtSystemTrayIcon(this)),
#endif
osd_(new OSD(tray_icon_, network, this)), osd_(new OSD(tray_icon_, network, this)),
edit_tag_dialog_(new EditTagDialog), edit_tag_dialog_(new EditTagDialog),
about_dialog_(new About), about_dialog_(new About),

View File

@ -16,6 +16,9 @@
#include "systemtrayicon.h" #include "systemtrayicon.h"
#include "macsystemtrayicon.h"
#include "qtsystemtrayicon.h"
#include <QApplication> #include <QApplication>
#include <QEvent> #include <QEvent>
#include <QWheelEvent> #include <QWheelEvent>
@ -94,3 +97,11 @@ void SystemTrayIcon::SetStopped() {
current_state_icon_ = QPixmap(); current_state_icon_ = QPixmap();
UpdateIcon(); UpdateIcon();
} }
SystemTrayIcon* SystemTrayIcon::CreateSystemTrayIcon(QObject* parent) {
#ifdef Q_OS_DARWIN
return new MacSystemTrayIcon(parent);
#else
return new QtSystemTrayIcon(parent);
#endif
}

View File

@ -40,6 +40,8 @@ class SystemTrayIcon : public QObject {
virtual void ShowPopup(const QString& summary, const QString& message, virtual void ShowPopup(const QString& summary, const QString& message,
int timeout) {} int timeout) {}
static SystemTrayIcon* CreateSystemTrayIcon(QObject* parent = 0);
public slots: public slots:
void SetProgress(int percentage); void SetProgress(int percentage);
void SetPaused(); void SetPaused();