diff --git a/data/data.qrc b/data/data.qrc
index cd4b56e34..844c519e2 100644
--- a/data/data.qrc
+++ b/data/data.qrc
@@ -6,7 +6,7 @@
schema/schema-3.sql
schema/device-schema.sql
style/strawberry.css
- misc/playing_tooltip.txt
+ misc/playing-tooltip.html
misc/oauthsuccess.html
pictures/strawberry.png
pictures/strawberry-faded.png
diff --git a/data/misc/playing_tooltip.txt b/data/misc/playing-tooltip.html
similarity index 64%
rename from data/misc/playing_tooltip.txt
rename to data/misc/playing-tooltip.html
index 5a3de69fa..d77237f10 100644
--- a/data/misc/playing_tooltip.txt
+++ b/data/misc/playing-tooltip.html
@@ -9,30 +9,22 @@
- |
- %titleKey
- |
+ %titleKey |
%titleValue |
- |
- %artistKey
- |
+ %artistKey |
%artistValue |
- |
- %albumKey
- |
+ %albumKey |
%albumValue |
|
- |
- %lengthKey
- |
+ %lengthKey |
%lengthValue |
diff --git a/data/pictures/cdcase.png b/data/pictures/cdcase.png
index c92576389..a93c406e5 100644
Binary files a/data/pictures/cdcase.png and b/data/pictures/cdcase.png differ
diff --git a/src/core/qtsystemtrayicon.cpp b/src/core/qtsystemtrayicon.cpp
index aef44b543..12233898c 100644
--- a/src/core/qtsystemtrayicon.cpp
+++ b/src/core/qtsystemtrayicon.cpp
@@ -44,26 +44,27 @@ QtSystemTrayIcon::QtSystemTrayIcon(QObject *parent)
: SystemTrayIcon(parent),
tray_(new QSystemTrayIcon(this)),
menu_(new QMenu),
+ app_name_(QCoreApplication::applicationName()),
+ icon_(":/icons/48x48/strawberry.png"),
+ normal_icon_(icon_.pixmap(48, QIcon::Normal)),
+ grey_icon_(icon_.pixmap(48, QIcon::Disabled)),
action_play_pause_(nullptr),
action_stop_(nullptr),
action_stop_after_this_track_(nullptr),
action_mute_(nullptr) {
- QIcon icon(":/icons/48x48/strawberry.png");
-
- normal_icon_ = icon.pixmap(48, QIcon::Normal);
- grey_icon_ = icon.pixmap(48, QIcon::Disabled);
-
tray_->setIcon(normal_icon_);
tray_->installEventFilter(this);
ClearNowPlaying();
- QFile pattern_file(":/misc/playing_tooltip.txt");
+ QFile pattern_file(":/misc/playing-tooltip.html");
pattern_file.open(QIODevice::ReadOnly);
pattern_ = QString::fromLatin1(pattern_file.readAll());
connect(tray_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(Clicked(QSystemTrayIcon::ActivationReason)));
+ app_name_[0] = app_name_[0].toUpper();
+
}
QtSystemTrayIcon::~QtSystemTrayIcon() {
@@ -230,7 +231,7 @@ void QtSystemTrayIcon::SetNowPlaying(const Song &song, const QString &image_path
QString clone = pattern_;
clone.replace("%columns" , QString::number(columns));
- clone.replace("%appName" , QCoreApplication::applicationName());
+ clone.replace("%appName" , app_name_);
clone.replace("%titleKey" , tr("Title") % ":");
clone.replace("%titleValue" , song.PrettyTitle().toHtmlEscaped());
@@ -256,5 +257,5 @@ void QtSystemTrayIcon::SetNowPlaying(const Song &song, const QString &image_path
}
void QtSystemTrayIcon::ClearNowPlaying() {
- tray_->setToolTip(QCoreApplication::applicationName());
+ tray_->setToolTip(app_name_);
}
diff --git a/src/core/qtsystemtrayicon.h b/src/core/qtsystemtrayicon.h
index f4716872f..1333deee8 100644
--- a/src/core/qtsystemtrayicon.h
+++ b/src/core/qtsystemtrayicon.h
@@ -72,15 +72,17 @@ private slots:
private:
QSystemTrayIcon *tray_;
QMenu *menu_;
+ QString app_name_;
+ QIcon icon_;
+ QPixmap normal_icon_;
+ QPixmap grey_icon_;
+
QAction *action_play_pause_;
QAction *action_stop_;
QAction *action_stop_after_this_track_;
QAction *action_mute_;
QString pattern_;
-
- QPixmap normal_icon_;
- QPixmap grey_icon_;
};
#endif // QTSYSTEMTRAYICON_H
diff --git a/src/covermanager/albumcoverchoicecontroller.cpp b/src/covermanager/albumcoverchoicecontroller.cpp
index f6f273735..cd967c409 100644
--- a/src/covermanager/albumcoverchoicecontroller.cpp
+++ b/src/covermanager/albumcoverchoicecontroller.cpp
@@ -66,11 +66,11 @@ QSet *AlbumCoverChoiceController::sImageExtensions = nullptr;
AlbumCoverChoiceController::AlbumCoverChoiceController(QWidget *parent) :
QWidget(parent),
- app_(nullptr),
- cover_searcher_(nullptr),
- cover_fetcher_(nullptr),
- save_file_dialog_(nullptr),
- cover_from_url_dialog_(nullptr) {
+ app_(nullptr),
+ cover_searcher_(nullptr),
+ cover_fetcher_(nullptr),
+ save_file_dialog_(nullptr),
+ cover_from_url_dialog_(nullptr) {
cover_from_file_ = new QAction(IconLoader::Load("document-open"), tr("Load cover from disk..."), this);
cover_to_file_ = new QAction(IconLoader::Load("document-save"), tr("Save cover to disk..."), this);
diff --git a/src/covermanager/albumcovermanager.cpp b/src/covermanager/albumcovermanager.cpp
index 3236d4f5d..69880158f 100644
--- a/src/covermanager/albumcovermanager.cpp
+++ b/src/covermanager/albumcovermanager.cpp
@@ -119,17 +119,6 @@ AlbumCoverManager::AlbumCoverManager(Application *app, CollectionBackend *collec
album_cover_choice_controller_->SetApplication(app_);
- // Get a square version of cdcase.png
- QImage nocover(":/pictures/cdcase.png");
- nocover = nocover.scaled(120, 120, Qt::KeepAspectRatio, Qt::SmoothTransformation);
- QImage square_nocover(120, 120, QImage::Format_ARGB32);
- square_nocover.fill(0);
- QPainter p(&square_nocover);
- p.setOpacity(0.4);
- p.drawImage((120 - nocover.width()) / 2, (120 - nocover.height()) / 2, nocover);
- p.end();
- // no_cover_item_icon_ = QPixmap::fromImage(square_nocover);
-
cover_searcher_ = new AlbumCoverSearcher(no_cover_item_icon_, app_, this);
cover_export_ = new AlbumCoverExport(this);
diff --git a/src/covermanager/currentartloader.cpp b/src/covermanager/currentartloader.cpp
index fca3a6a17..0329a8d2d 100644
--- a/src/covermanager/currentartloader.cpp
+++ b/src/covermanager/currentartloader.cpp
@@ -44,12 +44,9 @@ CurrentArtLoader::CurrentArtLoader(Application *app, QObject *parent)
options_.scale_output_image_ = false;
options_.pad_output_image_ = false;
- // QIcon nocover = IconLoader::Load("cdcase");
- // options_.default_output_image_ = nocover.pixmap(nocover.availableSizes().last()).toImage();
options_.default_output_image_ = QImage(":/pictures/cdcase.png");
connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64, QImage)), SLOT(TempArtLoaded(quint64, QImage)));
-
connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)), SLOT(LoadArt(Song)));
}
diff --git a/src/dialogs/edittagdialog.cpp b/src/dialogs/edittagdialog.cpp
index c15236afd..82a2cf473 100644
--- a/src/dialogs/edittagdialog.cpp
+++ b/src/dialogs/edittagdialog.cpp
@@ -104,8 +104,6 @@ EditTagDialog::EditTagDialog(Application *app, QWidget *parent)
results_dialog_(new TrackSelectionDialog(this))
{
- // QIcon nocover = IconLoader::Load("cdcase");
- // cover_options_.default_output_image_ = AlbumCoverLoader::ScaleAndPad(cover_options_, nocover.pixmap(nocover.availableSizes().last()).toImage());
cover_options_.default_output_image_ = AlbumCoverLoader::ScaleAndPad(cover_options_, QImage(":/pictures/cdcase.png"));
connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64,QImage,QImage)), SLOT(ArtLoaded(quint64,QImage,QImage)));
diff --git a/src/widgets/osd.cpp b/src/widgets/osd.cpp
index d2cb9991c..f2bc7178e 100644
--- a/src/widgets/osd.cpp
+++ b/src/widgets/osd.cpp
@@ -49,8 +49,9 @@ const char *OSD::kSettingsGroup = "OSD";
OSD::OSD(SystemTrayIcon *tray_icon, Application *app, QObject *parent)
: QObject(parent),
- tray_icon_(tray_icon),
app_(app),
+ tray_icon_(tray_icon),
+ app_name_(QCoreApplication::applicationName()),
timeout_msec_(5000),
behaviour_(Native),
show_on_volume_change_(false),
@@ -63,13 +64,16 @@ OSD::OSD(SystemTrayIcon *tray_icon, Application *app, QObject *parent)
preview_mode_(false),
force_show_next_(false),
ignore_next_stopped_(false),
- pretty_popup_(new OSDPretty(OSDPretty::Mode_Popup)) {
+ pretty_popup_(new OSDPretty(OSDPretty::Mode_Popup))
+ {
connect(app_->current_art_loader(), SIGNAL(ThumbnailLoaded(Song, QString, QImage)), SLOT(AlbumArtLoaded(Song, QString, QImage)));
ReloadSettings();
Init();
+ app_name_[0] = app_name_[0].toUpper();
+
}
OSD::~OSD() {
@@ -89,10 +93,12 @@ void OSD::ReloadSettings() {
use_custom_text_ = s.value(("CustomTextEnabled"), false).toBool();
custom_text1_ = s.value("CustomText1").toString();
custom_text2_ = s.value("CustomText2").toString();
+ s.endGroup();
if (!SupportsNativeNotifications() && behaviour_ == Native)
behaviour_ = Pretty;
- if (!SupportsTrayPopups() && behaviour_ == TrayPopup) behaviour_ = Disabled;
+ if (!SupportsTrayPopups() && behaviour_ == TrayPopup)
+ behaviour_ = Disabled;
ReloadPrettyOSDSettings();
@@ -112,7 +118,8 @@ void OSD::ReshowCurrentSong() {
void OSD::AlbumArtLoaded(const Song &song, const QString &uri, const QImage &image) {
// Don't change tray icon details if it's a preview
- if (!preview_mode_ && tray_icon_) tray_icon_->SetNowPlaying(song, uri);
+ if (!preview_mode_ && tray_icon_)
+ tray_icon_->SetNowPlaying(song, uri);
last_song_ = song;
last_image_ = image;
@@ -172,7 +179,7 @@ void OSD::AlbumArtLoaded(const Song &song, const QString &uri, const QImage &ima
void OSD::Paused() {
if (show_on_pause_) {
- ShowMessage(QCoreApplication::applicationName(), tr("Paused"));
+ ShowMessage(app_name_, tr("Paused"));
}
}
@@ -183,24 +190,24 @@ void OSD::Stopped() {
return;
}
- ShowMessage(QCoreApplication::applicationName(), tr("Stopped"));
+ ShowMessage(app_name_, tr("Stopped"));
}
void OSD::StopAfterToggle(bool stop) {
- ShowMessage(QCoreApplication::applicationName(), tr("Stop playing after track: %1").arg(stop ? tr("On") : tr("Off")));
+ ShowMessage(app_name_, tr("Stop playing after track: %1").arg(stop ? tr("On") : tr("Off")));
}
void OSD::PlaylistFinished() {
// We get a PlaylistFinished followed by a Stopped from the player
ignore_next_stopped_ = true;
- ShowMessage(QCoreApplication::applicationName(), tr("Playlist finished"));
+ ShowMessage(app_name_, tr("Playlist finished"));
}
void OSD::VolumeChanged(int value) {
if (!show_on_volume_change_) return;
- ShowMessage(QCoreApplication::applicationName(), tr("Volume %1%").arg(value));
+ ShowMessage(app_name_, tr("Volume %1%").arg(value));
}
void OSD::ShowMessage(const QString &summary, const QString &message, const QString &icon, const QImage &image) {
@@ -251,7 +258,7 @@ void OSD::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) {
case PlaylistSequence::Shuffle_InsideAlbum: current_mode = tr("Shuffle tracks in this album"); break;
case PlaylistSequence::Shuffle_Albums: current_mode = tr("Shuffle albums"); break;
}
- ShowMessage(QCoreApplication::applicationName(), current_mode);
+ ShowMessage(app_name_, current_mode);
}
}
@@ -266,7 +273,7 @@ void OSD::RepeatModeChanged(PlaylistSequence::RepeatMode mode) {
case PlaylistSequence::Repeat_OneByOne: current_mode = tr("Stop after every track"); break;
case PlaylistSequence::Repeat_Intro: current_mode = tr("Intro tracks"); break;
}
- ShowMessage(QCoreApplication::applicationName(), current_mode);
+ ShowMessage(app_name_, current_mode);
}
}
diff --git a/src/widgets/osd.h b/src/widgets/osd.h
index 9337c06e7..c3d45ab84 100644
--- a/src/widgets/osd.h
+++ b/src/widgets/osd.h
@@ -106,8 +106,9 @@ class OSD : public QObject {
void AlbumArtLoaded(const Song &song, const QString &uri, const QImage &image);
private:
- SystemTrayIcon *tray_icon_;
Application *app_;
+ SystemTrayIcon *tray_icon_;
+ QString app_name_;
int timeout_msec_;
Behaviour behaviour_;
bool show_on_volume_change_;
diff --git a/src/widgets/osdpretty.cpp b/src/widgets/osdpretty.cpp
index ace9ff4c7..b54041637 100644
--- a/src/widgets/osdpretty.cpp
+++ b/src/widgets/osdpretty.cpp
@@ -87,8 +87,8 @@ OSDPretty::OSDPretty(Mode mode, QWidget *parent)
timeout_(new QTimer(this)),
fading_enabled_(false),
fader_(new QTimeLine(300, this)),
- toggle_mode_(false)
-{
+ toggle_mode_(false) {
+
Qt::WindowFlags flags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint;
setWindowFlags(flags);
@@ -180,6 +180,7 @@ void OSDPretty::Load() {
popup_pos_ = s.value("popup_pos", QPoint(0, 0)).toPoint();
font_.fromString(s.value("font", "Verdana,9,-1,5,50,0,0,0,0,0").toString());
disable_duration_ = s.value("disable_duration", false).toBool();
+ s.endGroup();
set_font(font());
set_foreground_color(foreground_color());
|