diff --git a/data/data.qrc b/data/data.qrc index c6b40e271..11fb4b594 100644 --- a/data/data.qrc +++ b/data/data.qrc @@ -18,6 +18,8 @@ volumeslider-gradient.png logo.png icon.png + icon_large.png + icon_large_grey.png currenttrack_bar_left.png currenttrack_bar_mid.png currenttrack_bar_right.png diff --git a/data/icon_large_grey.png b/data/icon_large_grey.png new file mode 100644 index 000000000..202b8caa8 Binary files /dev/null and b/data/icon_large_grey.png differ diff --git a/macdeploy.py b/macdeploy.py index d04456ce5..ac2853b0c 100755 --- a/macdeploy.py +++ b/macdeploy.py @@ -78,7 +78,6 @@ GSTREAMER_PLUGINS=[ 'libgstmpegaudioparse.so', 'libgstmusepack.so', 'libgstogg.so', - 'libgstpnm.so', 'libgstvorbis.so', # HTTP src support diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8ff06c159..7641a42aa 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -77,11 +77,7 @@ const char* MainWindow::kMediaFilterSpec = MainWindow::MainWindow(QNetworkAccessManager* network, Engine::Type engine, QWidget *parent) : QMainWindow(parent), -#ifdef Q_OS_DARWIN - tray_icon_(NULL), -#else tray_icon_(new SystemTrayIcon(this)), -#endif osd_(new OSD(tray_icon_, this)), track_slider_(new TrackSlider(this)), playlist_sequence_(new PlaylistSequence(this)), @@ -105,10 +101,8 @@ MainWindow::MainWindow(QNetworkAccessManager* network, Engine::Type engine, QWid was_maximized_(false) { ui_.setupUi(this); -#ifndef Q_OS_DARWIN tray_icon_->setIcon(windowIcon()); tray_icon_->setToolTip(QCoreApplication::applicationName()); -#endif ui_.volume->setValue(player_->GetVolume()); @@ -501,10 +495,8 @@ void MainWindow::MediaStopped() { track_position_timer_->stop(); track_slider_->SetStopped(); -#ifndef Q_OS_DARWIN tray_icon_->SetProgress(0); tray_icon_->SetStopped(); -#endif } void MainWindow::MediaPaused() { @@ -517,9 +509,7 @@ void MainWindow::MediaPaused() { track_position_timer_->stop(); -#ifndef Q_OS_DARWIN tray_icon_->SetPaused(); -#endif } void MainWindow::MediaPlaying() { @@ -542,9 +532,7 @@ void MainWindow::MediaPlaying() { track_position_timer_->start(); UpdateTrackPosition(); -#ifndef Q_OS_DARWIN tray_icon_->SetPlaying(); -#endif } void MainWindow::ScrobblingEnabledChanged(bool value) { @@ -668,9 +656,7 @@ void MainWindow::UpdateTrackPosition() { if (length <= 0) { // Probably a stream that we don't know the length of track_slider_->SetStopped(); -#ifndef Q_OS_DARWIN tray_icon_->SetProgress(0); -#endif return; } @@ -686,12 +672,10 @@ void MainWindow::UpdateTrackPosition() { // Update the slider track_slider_->SetValue(position, length); -#ifndef Q_OS_DARWIN // Update the tray icon every 10 seconds if (position % 10 == 1) { tray_icon_->SetProgress(double(position) / length * 100); } -#endif } void MainWindow::Love() { diff --git a/src/systemtrayicon.cpp b/src/systemtrayicon.cpp index 7df18cb03..5a9ec2dd2 100644 --- a/src/systemtrayicon.cpp +++ b/src/systemtrayicon.cpp @@ -16,9 +16,11 @@ #include "systemtrayicon.h" +#include #include #include #include +#include #include #include @@ -29,6 +31,9 @@ SystemTrayIcon::SystemTrayIcon(QObject* parent) paused_icon_(":/tiny-pause.png"), percentage_(0) { +#ifdef Q_OS_DARWIN + hide(); +#endif } SystemTrayIcon::~SystemTrayIcon() {} @@ -48,8 +53,16 @@ void SystemTrayIcon::SetProgress(int percentage) { void SystemTrayIcon::Update() { if (icon_.isNull()) { +#ifdef Q_OS_DARWIN + QIcon big_icon(":icon_large.png"); + icon_ = big_icon.pixmap(128, 128, QIcon::Normal); + QIcon big_grey_icon(":icon_large_grey.png"); + grey_icon_ = big_grey_icon.pixmap(128, 128, QIcon::Normal); + grey_icon_.save("grey.png"); +#else icon_ = icon().pixmap(geometry().size(), QIcon::Normal); grey_icon_ = icon().pixmap(geometry().size(), QIcon::Disabled); +#endif if (icon_.isNull()) return; @@ -93,7 +106,13 @@ void SystemTrayIcon::Update() { p.end(); +#ifdef Q_OS_DARWIN + // Setting main window icon. + QApplication::setWindowIcon(icon); + icon.save("icon.png"); +#else setIcon(icon); +#endif } void SystemTrayIcon::SetPaused() {