diff --git a/data/data.qrc b/data/data.qrc index 828cb76b..3b2ca3e0 100644 --- a/data/data.qrc +++ b/data/data.qrc @@ -17,7 +17,6 @@ schema/device-schema.sql style/strawberry.css style/smartplaylistsearchterm.css - html/playing-tooltip.html html/oauthsuccess.html pictures/strawberry.png pictures/strawberry-faded.png diff --git a/data/html/playing-tooltip.html b/data/html/playing-tooltip.html deleted file mode 100644 index 5a3de69f..00000000 --- a/data/html/playing-tooltip.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - %image - - -
-

%appName

-
- - - - - - - - - - - - - - - - - - - -
-

%titleKey

-
%titleValue
-

%artistKey

-
%artistValue
-

%albumKey

-
%albumValue
-
-

%lengthKey

-
%lengthValue
-
diff --git a/src/core/qtsystemtrayicon.cpp b/src/core/qtsystemtrayicon.cpp index cf27142d..5309a0ac 100644 --- a/src/core/qtsystemtrayicon.cpp +++ b/src/core/qtsystemtrayicon.cpp @@ -61,16 +61,6 @@ QtSystemTrayIcon::QtSystemTrayIcon(QObject *parent) tray_->installEventFilter(this); ClearNowPlaying(); -#ifndef Q_OS_WIN - de_ = Utilities::DesktopEnvironment().toLower(); - QFile pattern_file(":/html/playing-tooltip.html"); - if (pattern_file.open(QIODevice::ReadOnly)) { - pattern_ = QString::fromLatin1(pattern_file.readAll()); - pattern_file.close(); - } - -#endif - connect(tray_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(Clicked(QSystemTrayIcon::ActivationReason))); } @@ -231,50 +221,9 @@ void QtSystemTrayIcon::SetVisible(bool visible) { tray_->setVisible(visible); } -void QtSystemTrayIcon::SetNowPlaying(const Song &song, const QUrl &cover_url) { +void QtSystemTrayIcon::SetNowPlaying(const Song &song, const QUrl&) { -#ifdef Q_OS_WIN - Q_UNUSED(song); - Q_UNUSED(cover_url); - // Windows doesn't support HTML in tooltips, so just show something basic tray_->setToolTip(song.PrettyTitleWithArtist()); -#else - - if (de_ == "kde" || de_ == "cinnamon" || de_ == "x-cinnamon") { - tray_->setToolTip(song.PrettyTitleWithArtist()); - return; - } - - int columns = cover_url.isEmpty() ? 1 : 2; - - QString tooltip(pattern_); - - tooltip.replace("%columns" , QString::number(columns)); - tooltip.replace("%appName" , app_name_); - - tooltip.replace("%titleKey" , tr("Title") % ":"); - tooltip.replace("%titleValue" , song.PrettyTitle().toHtmlEscaped()); - tooltip.replace("%artistKey" , tr("Artist") % ":"); - tooltip.replace("%artistValue", song.artist().toHtmlEscaped()); - tooltip.replace("%albumKey" , tr("Album") % ":"); - tooltip.replace("%albumValue" , song.album().toHtmlEscaped()); - - tooltip.replace("%lengthKey" , tr("Length") % ":"); - tooltip.replace("%lengthValue", song.PrettyLength().toHtmlEscaped()); - - if (columns == 2) { - QString final_path = cover_url.isLocalFile() ? cover_url.path() : cover_url.toString(); - tooltip.replace("%image", " "); - } - else { - tooltip.replace("%image", ""); - tooltip.replace("%image", ""); - } - - // TODO: we should also repaint this - tray_->setToolTip(tooltip); - -#endif } diff --git a/src/core/qtsystemtrayicon.h b/src/core/qtsystemtrayicon.h index 862c7122..c9462b58 100644 --- a/src/core/qtsystemtrayicon.h +++ b/src/core/qtsystemtrayicon.h @@ -52,7 +52,7 @@ class QtSystemTrayIcon : public SystemTrayIcon { void ShowPopup(const QString &summary, const QString &message, int timeout) override; - void SetNowPlaying(const Song &song, const QUrl &cover_url) override; + void SetNowPlaying(const Song &song, const QUrl&) override; void ClearNowPlaying() override; bool MuteEnabled() const override { return action_mute_->isVisible(); } @@ -88,11 +88,6 @@ class QtSystemTrayIcon : public SystemTrayIcon { QAction *action_mute_; QAction *action_love_; -#ifndef Q_OS_WIN - QString de_; - QString pattern_; -#endif - }; #endif // QTSYSTEMTRAYICON_H