2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-03-24 00:11:46 +01:00
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-12-26 18:24:44 +01:00
|
|
|
#include "config.h"
|
2011-05-23 21:49:03 +02:00
|
|
|
#include "core/logging.h"
|
2010-01-08 15:52:05 +01:00
|
|
|
#include "osd.h"
|
2010-03-25 20:30:10 +01:00
|
|
|
#include "osdpretty.h"
|
2010-06-22 13:52:55 +02:00
|
|
|
#include "ui/systemtrayicon.h"
|
2010-01-08 15:52:05 +01:00
|
|
|
|
2010-12-26 14:38:35 +01:00
|
|
|
#ifdef HAVE_DBUS
|
2010-06-25 21:04:10 +02:00
|
|
|
# include "dbus/notification.h"
|
|
|
|
#endif
|
|
|
|
|
2010-01-08 17:21:22 +01:00
|
|
|
#include <QCoreApplication>
|
2010-01-08 20:50:29 +01:00
|
|
|
#include <QtDebug>
|
2010-02-03 18:21:25 +01:00
|
|
|
#include <QSettings>
|
|
|
|
|
|
|
|
const char* OSD::kSettingsGroup = "OSD";
|
2010-01-08 17:21:22 +01:00
|
|
|
|
2010-10-16 19:20:54 +02:00
|
|
|
OSD::OSD(SystemTrayIcon* tray_icon, QObject* parent)
|
2010-01-08 15:52:05 +01:00
|
|
|
: QObject(parent),
|
2010-01-08 16:37:35 +01:00
|
|
|
tray_icon_(tray_icon),
|
2010-03-30 02:08:16 +02:00
|
|
|
timeout_msec_(5000),
|
2010-02-27 01:48:27 +01:00
|
|
|
behaviour_(Native),
|
2010-02-28 02:08:18 +01:00
|
|
|
show_on_volume_change_(false),
|
2010-03-25 20:30:10 +01:00
|
|
|
show_art_(true),
|
2011-03-17 09:21:05 +01:00
|
|
|
show_on_play_mode_change_(true),
|
2011-05-22 23:15:11 +02:00
|
|
|
use_custom_text_(false),
|
|
|
|
custom_text1_(QString()),
|
|
|
|
custom_text2_(QString()),
|
|
|
|
preview_mode_(false),
|
2010-04-13 22:45:40 +02:00
|
|
|
force_show_next_(false),
|
2010-04-19 15:01:57 +02:00
|
|
|
ignore_next_stopped_(false),
|
2010-05-10 15:15:52 +02:00
|
|
|
pretty_popup_(new OSDPretty(OSDPretty::Mode_Popup)),
|
|
|
|
cover_loader_(new BackgroundThreadImplementation<AlbumCoverLoader, AlbumCoverLoader>(this))
|
2010-01-08 15:52:05 +01:00
|
|
|
{
|
2010-05-10 15:15:52 +02:00
|
|
|
cover_loader_->Start();
|
|
|
|
|
|
|
|
connect(cover_loader_, SIGNAL(Initialised()), SLOT(CoverLoaderInitialised()));
|
|
|
|
|
2010-02-03 18:21:25 +01:00
|
|
|
ReloadSettings();
|
2010-01-08 15:52:05 +01:00
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
2010-03-25 20:30:10 +01:00
|
|
|
OSD::~OSD() {
|
|
|
|
delete pretty_popup_;
|
|
|
|
}
|
|
|
|
|
2010-05-10 15:15:52 +02:00
|
|
|
void OSD::CoverLoaderInitialised() {
|
2010-05-17 00:41:01 +02:00
|
|
|
cover_loader_->Worker()->SetPadOutputImage(false);
|
2010-05-17 00:53:42 +02:00
|
|
|
cover_loader_->Worker()->SetDefaultOutputImage(QImage(":nocover.png"));
|
2010-05-10 15:15:52 +02:00
|
|
|
connect(cover_loader_->Worker().get(), SIGNAL(ImageLoaded(quint64,QImage)),
|
|
|
|
SLOT(AlbumArtLoaded(quint64,QImage)));
|
|
|
|
}
|
|
|
|
|
2010-02-03 18:21:25 +01:00
|
|
|
void OSD::ReloadSettings() {
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(kSettingsGroup);
|
|
|
|
behaviour_ = OSD::Behaviour(s.value("Behaviour", Native).toInt());
|
2010-03-30 02:08:16 +02:00
|
|
|
timeout_msec_ = s.value("Timeout", 5000).toInt();
|
2010-02-27 01:48:27 +01:00
|
|
|
show_on_volume_change_ = s.value("ShowOnVolumeChange", false).toBool();
|
2010-02-28 02:08:18 +01:00
|
|
|
show_art_ = s.value("ShowArt", true).toBool();
|
2011-03-17 09:21:05 +01:00
|
|
|
show_on_play_mode_change_ = s.value("ShowOnPlayModeChange", true).toBool();
|
2011-05-22 23:15:11 +02:00
|
|
|
use_custom_text_ = s.value(("CustomTextEnabled"), false).toBool();
|
|
|
|
custom_text1_ = s.value("CustomText1").toString();
|
|
|
|
custom_text2_ = s.value("CustomText2").toString();
|
2010-02-03 18:21:25 +01:00
|
|
|
|
2010-02-26 23:37:48 +01:00
|
|
|
if (!SupportsNativeNotifications() && behaviour_ == Native)
|
2010-03-25 22:29:17 +01:00
|
|
|
behaviour_ = Pretty;
|
2010-02-26 23:37:48 +01:00
|
|
|
if (!SupportsTrayPopups() && behaviour_ == TrayPopup)
|
|
|
|
behaviour_ = Disabled;
|
2010-03-25 20:30:10 +01:00
|
|
|
|
2011-05-28 10:50:29 +02:00
|
|
|
ReloadPrettyOSDSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reload just Pretty OSD settings, not everything
|
|
|
|
void OSD::ReloadPrettyOSDSettings() {
|
2010-03-30 02:08:16 +02:00
|
|
|
pretty_popup_->set_popup_duration(timeout_msec_);
|
2010-03-25 20:30:10 +01:00
|
|
|
pretty_popup_->ReloadSettings();
|
2010-02-03 18:21:25 +01:00
|
|
|
}
|
|
|
|
|
2010-01-08 15:52:05 +01:00
|
|
|
void OSD::SongChanged(const Song &song) {
|
2011-05-28 10:50:29 +02:00
|
|
|
// Don't change tray icon details if it's a preview
|
|
|
|
if (!preview_mode_) {
|
|
|
|
// no cover art yet
|
|
|
|
tray_icon_->SetNowPlaying(song, NULL);
|
|
|
|
}
|
2010-01-08 15:52:05 +01:00
|
|
|
|
2010-01-08 17:40:34 +01:00
|
|
|
QStringList message_parts;
|
2011-05-22 23:15:11 +02:00
|
|
|
QString summary;
|
|
|
|
if (!use_custom_text_) {
|
|
|
|
summary = song.PrettyTitle();
|
|
|
|
if (!song.artist().isEmpty())
|
|
|
|
summary = QString("%1 - %2").arg(song.artist(), summary);
|
|
|
|
if (!song.album().isEmpty())
|
|
|
|
message_parts << song.album();
|
|
|
|
if (song.disc() > 0)
|
|
|
|
message_parts << tr("disc %1").arg(song.disc());
|
|
|
|
if (song.track() > 0)
|
|
|
|
message_parts << tr("track %1").arg(song.track());
|
|
|
|
} else {
|
|
|
|
QRegExp variable_replacer("[%][a-z]+[%]");
|
|
|
|
summary = custom_text1_;
|
|
|
|
QString message(custom_text2_);
|
|
|
|
|
|
|
|
// Replace the first line
|
|
|
|
int pos = 0;
|
|
|
|
variable_replacer.indexIn(custom_text1_);
|
|
|
|
while ((pos = variable_replacer.indexIn(custom_text1_, pos)) != -1) {
|
|
|
|
QStringList captured = variable_replacer.capturedTexts();
|
|
|
|
summary.replace(captured[0], ReplaceVariable(captured[0], song));
|
|
|
|
pos += variable_replacer.matchedLength();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Replace the second line
|
|
|
|
pos = 0;
|
|
|
|
variable_replacer.indexIn(custom_text2_);
|
|
|
|
while ((pos = variable_replacer.indexIn(custom_text2_, pos)) != -1) {
|
|
|
|
QStringList captured = variable_replacer.capturedTexts();
|
|
|
|
message.replace(captured[0], ReplaceVariable(captured[0], song));
|
|
|
|
pos += variable_replacer.matchedLength();
|
|
|
|
}
|
|
|
|
message_parts << message;
|
|
|
|
}
|
2010-01-08 15:52:05 +01:00
|
|
|
|
2010-05-10 15:15:52 +02:00
|
|
|
WaitingForAlbumArt waiting;
|
|
|
|
waiting.icon = "notification-audio-play";
|
|
|
|
waiting.summary = summary;
|
|
|
|
waiting.message = message_parts.join(", ");
|
|
|
|
|
2010-07-19 19:55:02 +02:00
|
|
|
if (show_art_) {
|
2010-05-17 00:31:59 +02:00
|
|
|
// Load the art in a background thread (maybe from a remote server),
|
|
|
|
// AlbumArtLoaded gets called when it's ready.
|
2010-07-19 19:55:02 +02:00
|
|
|
quint64 id = cover_loader_->Worker()->LoadImageAsync(song);
|
2010-05-10 15:15:52 +02:00
|
|
|
waiting_for_album_art_.insert(id, waiting);
|
|
|
|
} else {
|
|
|
|
AlbumArtLoaded(waiting, QImage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-06 00:41:41 +01:00
|
|
|
void OSD::CoverArtPathReady(const Song& song, const QString& image_path) {
|
2011-05-28 10:50:29 +02:00
|
|
|
// Don't change tray icon details if it's a preview
|
|
|
|
if (!preview_mode_)
|
|
|
|
tray_icon_->SetNowPlaying(song, image_path);
|
2010-12-06 00:41:41 +01:00
|
|
|
}
|
|
|
|
|
2010-05-10 15:15:52 +02:00
|
|
|
void OSD::AlbumArtLoaded(quint64 id, const QImage& image) {
|
|
|
|
WaitingForAlbumArt info = waiting_for_album_art_.take(id);
|
|
|
|
AlbumArtLoaded(info, image);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::AlbumArtLoaded(const WaitingForAlbumArt info, const QImage& image) {
|
|
|
|
ShowMessage(info.summary, info.message, info.icon, image);
|
2011-05-22 23:15:11 +02:00
|
|
|
|
|
|
|
// Reload the saved settings if they were changed for preview
|
|
|
|
if (preview_mode_) {
|
|
|
|
ReloadSettings();
|
|
|
|
preview_mode_ = false;
|
|
|
|
}
|
2010-01-08 15:52:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::Paused() {
|
2010-02-23 19:33:09 +01:00
|
|
|
ShowMessage(QCoreApplication::applicationName(), tr("Paused"));
|
2010-01-08 15:52:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::Stopped() {
|
2010-09-08 13:53:35 +02:00
|
|
|
tray_icon_->ClearNowPlaying();
|
2010-04-19 15:01:57 +02:00
|
|
|
if (ignore_next_stopped_) {
|
|
|
|
ignore_next_stopped_ = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ShowMessage(QCoreApplication::applicationName(), tr("Stopped"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::PlaylistFinished() {
|
|
|
|
// We get a PlaylistFinished followed by a Stopped from the player
|
|
|
|
ignore_next_stopped_ = true;
|
|
|
|
|
2010-02-23 19:33:09 +01:00
|
|
|
ShowMessage(QCoreApplication::applicationName(), tr("Playlist finished"));
|
2010-01-08 15:52:05 +01:00
|
|
|
}
|
2010-01-08 17:40:34 +01:00
|
|
|
|
|
|
|
void OSD::VolumeChanged(int value) {
|
2010-02-27 01:48:27 +01:00
|
|
|
if (!show_on_volume_change_)
|
|
|
|
return;
|
|
|
|
|
2010-02-23 19:33:09 +01:00
|
|
|
ShowMessage(QCoreApplication::applicationName(), tr("Volume %1%").arg(value));
|
2010-01-08 17:40:34 +01:00
|
|
|
}
|
2010-02-03 18:21:25 +01:00
|
|
|
|
2010-06-12 22:43:07 +02:00
|
|
|
void OSD::MagnatuneDownloadFinished(const QStringList& albums) {
|
|
|
|
QString message;
|
|
|
|
if (albums.count() == 1)
|
|
|
|
message = albums[0];
|
|
|
|
else
|
|
|
|
message = tr("%1 albums").arg(albums.count());
|
|
|
|
|
|
|
|
ShowMessage(tr("Magnatune download finished"), message, QString(),
|
2010-10-09 14:39:49 +02:00
|
|
|
QImage(":/providers/magnatune.png"));
|
2010-06-12 22:43:07 +02:00
|
|
|
}
|
|
|
|
|
2010-02-03 18:21:25 +01:00
|
|
|
void OSD::ShowMessage(const QString& summary,
|
|
|
|
const QString& message,
|
2010-02-25 01:18:32 +01:00
|
|
|
const QString& icon,
|
|
|
|
const QImage& image) {
|
2011-06-05 10:21:17 +02:00
|
|
|
if (pretty_popup_->toggle_mode()) {
|
|
|
|
pretty_popup_->ShowMessage(summary, message, image);
|
|
|
|
} else {
|
|
|
|
switch (behaviour_) {
|
2010-02-03 18:21:25 +01:00
|
|
|
case Native:
|
2010-02-25 01:18:32 +01:00
|
|
|
if (image.isNull()) {
|
2010-03-30 02:08:16 +02:00
|
|
|
ShowMessageNative(summary, message, icon, QImage());
|
2010-02-25 01:18:32 +01:00
|
|
|
} else {
|
2010-03-30 02:08:16 +02:00
|
|
|
ShowMessageNative(summary, message, QString(), image);
|
2010-02-25 01:18:32 +01:00
|
|
|
}
|
2010-02-03 18:21:25 +01:00
|
|
|
break;
|
|
|
|
|
2010-04-14 21:38:09 +02:00
|
|
|
#ifndef Q_OS_DARWIN
|
2010-02-03 18:21:25 +01:00
|
|
|
case TrayPopup:
|
2010-06-22 13:52:55 +02:00
|
|
|
tray_icon_->ShowPopup(summary, message, timeout_msec_);
|
2010-02-03 18:21:25 +01:00
|
|
|
break;
|
2010-04-14 21:38:09 +02:00
|
|
|
#endif
|
2010-02-03 18:21:25 +01:00
|
|
|
|
2010-04-13 22:45:40 +02:00
|
|
|
case Disabled:
|
|
|
|
if (!force_show_next_)
|
|
|
|
break;
|
|
|
|
force_show_next_ = false;
|
|
|
|
// fallthrough
|
2010-03-25 20:30:10 +01:00
|
|
|
case Pretty:
|
2011-06-05 10:21:17 +02:00
|
|
|
pretty_popup_->ShowMessage(summary, message, image);
|
2010-03-25 20:30:10 +01:00
|
|
|
break;
|
|
|
|
|
2010-02-03 18:21:25 +01:00
|
|
|
default:
|
|
|
|
break;
|
2011-06-05 10:21:17 +02:00
|
|
|
}
|
2010-02-03 18:21:25 +01:00
|
|
|
}
|
|
|
|
}
|
2010-03-26 00:03:28 +01:00
|
|
|
|
2010-12-26 14:38:35 +01:00
|
|
|
#ifndef HAVE_DBUS
|
2010-03-26 00:03:28 +01:00
|
|
|
void OSD::CallFinished(QDBusPendingCallWatcher*) {}
|
|
|
|
#endif
|
2010-09-01 16:46:15 +02:00
|
|
|
|
2011-03-12 22:19:32 +01:00
|
|
|
#ifdef HAVE_WIIMOTEDEV
|
2010-09-01 16:46:15 +02:00
|
|
|
|
2010-09-01 17:37:09 +02:00
|
|
|
void OSD::WiiremoteActived(int id) {
|
|
|
|
ShowMessage(QString(tr("%1: Wiimotedev module")).arg(QCoreApplication::applicationName()),
|
2010-09-11 04:12:54 +02:00
|
|
|
tr("Wii Remote %1: actived").arg(QString::number(id)));
|
2010-09-01 17:37:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::WiiremoteDeactived(int id) {
|
|
|
|
ShowMessage(QString(tr("%1: Wiimotedev module")).arg(QCoreApplication::applicationName()),
|
2010-09-11 04:12:54 +02:00
|
|
|
tr("Wii Remote %1: disactived").arg(QString::number(id)));
|
2010-09-01 17:37:09 +02:00
|
|
|
}
|
|
|
|
|
2010-09-01 16:46:15 +02:00
|
|
|
void OSD::WiiremoteConnected(int id) {
|
|
|
|
ShowMessage(QString(tr("%1: Wiimotedev module")).arg(QCoreApplication::applicationName()),
|
2010-09-11 04:12:54 +02:00
|
|
|
tr("Wii Remote %1: connected").arg(QString::number(id)));
|
2010-09-01 16:46:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::WiiremoteDisconnected(int id) {
|
|
|
|
ShowMessage(QString(tr("%1: Wiimotedev module")).arg(QCoreApplication::applicationName()),
|
2010-09-11 04:12:54 +02:00
|
|
|
tr("Wii Remote %1: disconnected").arg(QString::number(id)));
|
2010-09-01 16:46:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::WiiremoteLowBattery(int id, int live) {
|
|
|
|
ShowMessage(QString(tr("%1: Wiimotedev module")).arg(QCoreApplication::applicationName()),
|
2010-09-11 04:12:54 +02:00
|
|
|
tr("Wii Remote %1: low battery (%2%)").arg(QString::number(id), QString::number(live)));
|
2010-09-01 16:46:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::WiiremoteCriticalBattery(int id, int live) {
|
|
|
|
ShowMessage(QString(tr("%1: Wiimotedev module")).arg(QCoreApplication::applicationName()),
|
2010-09-11 04:12:54 +02:00
|
|
|
tr("Wii Remote %1: critical battery (%2%) ").arg(QString::number(id), QString::number(live)));
|
2010-09-01 16:46:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2011-03-17 09:21:05 +01:00
|
|
|
|
|
|
|
void OSD::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) {
|
|
|
|
if (show_on_play_mode_change_) {
|
|
|
|
QString current_mode = QString();
|
|
|
|
switch (mode) {
|
2011-11-27 16:01:10 +01:00
|
|
|
case PlaylistSequence::Shuffle_Off: current_mode = tr("Don't shuffle"); break;
|
|
|
|
case PlaylistSequence::Shuffle_All: current_mode = tr("Shuffle all"); break;
|
|
|
|
case PlaylistSequence::Shuffle_InsideAlbum: current_mode = tr("Shuffle tracks in this album"); break;
|
|
|
|
case PlaylistSequence::Shuffle_Albums: current_mode = tr("Shuffle albums"); break;
|
2011-03-17 09:21:05 +01:00
|
|
|
}
|
|
|
|
ShowMessage(QCoreApplication::applicationName(), current_mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::RepeatModeChanged(PlaylistSequence::RepeatMode mode) {
|
|
|
|
if (show_on_play_mode_change_) {
|
|
|
|
QString current_mode = QString();
|
|
|
|
switch (mode) {
|
|
|
|
case PlaylistSequence::Repeat_Off: current_mode = tr("Don't repeat"); break;
|
|
|
|
case PlaylistSequence::Repeat_Track: current_mode = tr("Repeat track"); break;
|
|
|
|
case PlaylistSequence::Repeat_Album: current_mode = tr("Repeat album"); break;
|
|
|
|
case PlaylistSequence::Repeat_Playlist: current_mode = tr("Repeat playlist"); break;
|
|
|
|
}
|
|
|
|
ShowMessage(QCoreApplication::applicationName(), current_mode);
|
|
|
|
}
|
|
|
|
}
|
2011-05-22 23:15:11 +02:00
|
|
|
|
|
|
|
QString OSD::ReplaceVariable(const QString& variable, const Song& song) {
|
|
|
|
QString return_value;
|
|
|
|
if (variable == "%artist%") {
|
|
|
|
return song.artist();
|
|
|
|
} else if (variable == "%album%") {
|
|
|
|
return song.album();
|
|
|
|
} else if (variable == "%title%") {
|
|
|
|
return song.PrettyTitle();
|
|
|
|
} else if (variable == "%albumartist%") {
|
2011-11-28 06:58:27 +01:00
|
|
|
return song.effective_albumartist();
|
2011-05-22 23:15:11 +02:00
|
|
|
} else if (variable == "%year%") {
|
|
|
|
return song.PrettyYear();
|
|
|
|
} else if (variable == "%composer%") {
|
|
|
|
return song.composer();
|
|
|
|
} else if (variable == "%length%") {
|
|
|
|
return song.PrettyLength();
|
|
|
|
} else if (variable == "%disc%") {
|
|
|
|
return return_value.setNum(song.disc());
|
|
|
|
} else if (variable == "%track%") {
|
|
|
|
return return_value.setNum(song.track());
|
|
|
|
} else if (variable == "%genre%") {
|
|
|
|
return song.genre();
|
|
|
|
} else if (variable == "%playcount%") {
|
|
|
|
return return_value.setNum(song.playcount());
|
|
|
|
} else if (variable == "%skipcount%") {
|
|
|
|
return return_value.setNum(song.skipcount());
|
2011-05-23 21:49:03 +02:00
|
|
|
} else if (variable == "%newline%") {
|
|
|
|
// We need different strings depending on notification type
|
|
|
|
switch (behaviour_) {
|
|
|
|
case Native:
|
|
|
|
#ifdef Q_OS_DARWIN
|
|
|
|
return "\n";
|
|
|
|
#endif
|
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
return "<br/>";
|
|
|
|
#endif
|
2011-06-03 13:07:12 +02:00
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
// Other OS don't support native notifications
|
2011-06-05 15:34:12 +02:00
|
|
|
qLog(Debug) << "New line not supported by this notification type under Windows";
|
2011-05-23 21:49:03 +02:00
|
|
|
return "";
|
2011-06-03 13:07:12 +02:00
|
|
|
#endif
|
2011-06-05 15:34:12 +02:00
|
|
|
case TrayPopup:
|
|
|
|
qLog(Debug) << "New line not supported by this notification type";
|
|
|
|
return "";
|
2011-06-03 13:07:12 +02:00
|
|
|
case Pretty:
|
|
|
|
default:
|
|
|
|
// When notifications are disabled, we force the PrettyOSD
|
|
|
|
return "<br/>";
|
2011-05-23 21:49:03 +02:00
|
|
|
}
|
2011-05-22 23:15:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//if the variable is not recognized, just return it
|
|
|
|
return variable;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OSD::ShowPreview(const Behaviour type, const QString& line1, const QString& line2, const Song& song) {
|
|
|
|
behaviour_ = type;
|
|
|
|
custom_text1_ = line1;
|
|
|
|
custom_text2_ = line2;
|
|
|
|
if (!use_custom_text_)
|
|
|
|
use_custom_text_ = true;
|
|
|
|
|
|
|
|
// We want to reload the settings, but we can't do this here because the cover art loading is asynch
|
|
|
|
preview_mode_ = true;
|
2011-05-28 10:50:29 +02:00
|
|
|
SongChanged(song);
|
2011-05-22 23:15:11 +02:00
|
|
|
}
|
2011-06-05 10:21:17 +02:00
|
|
|
|
|
|
|
void OSD::SetPrettyOSDToggleMode(bool toggle) {
|
|
|
|
pretty_popup_->set_toggle_mode(toggle);
|
|
|
|
}
|