From 04805de5c635771e238db92dff622c0d14095e3e Mon Sep 17 00:00:00 2001 From: Alan Briolat Date: Thu, 2 Feb 2012 18:50:19 +0000 Subject: [PATCH] Add %filename% as possible custom OSD variable. Fixes issue 2648 --- src/ui/notificationssettingspage.cpp | 1 + src/ui/notificationssettingspage.ui | 8 ++++++++ src/widgets/osd.cpp | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/ui/notificationssettingspage.cpp b/src/ui/notificationssettingspage.cpp index 781aa77af..2284124e2 100644 --- a/src/ui/notificationssettingspage.cpp +++ b/src/ui/notificationssettingspage.cpp @@ -54,6 +54,7 @@ NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog) menu->addAction(ui_->action_genre); menu->addAction(ui_->action_playcount); menu->addAction(ui_->action_skipcount); + menu->addAction(ui_->action_filename); menu->addSeparator(); menu->addAction(ui_->action_newline); ui_->notifications_exp_chooser1->setMenu(menu); diff --git a/src/ui/notificationssettingspage.ui b/src/ui/notificationssettingspage.ui index 195313a32..55719e17f 100644 --- a/src/ui/notificationssettingspage.ui +++ b/src/ui/notificationssettingspage.ui @@ -434,6 +434,14 @@ Add a new line if supported by the notification type + + + %filename% + + + Add song filename + + diff --git a/src/widgets/osd.cpp b/src/widgets/osd.cpp index a5e90d80a..8a84a5c31 100644 --- a/src/widgets/osd.cpp +++ b/src/widgets/osd.cpp @@ -339,6 +339,8 @@ QString OSD::ReplaceVariable(const QString& variable, const Song& song) { return return_value.setNum(song.playcount()); } else if (variable == "%skipcount%") { return return_value.setNum(song.skipcount()); + } else if (variable == "%filename%") { + return song.basefilename(); } else if (variable == "%newline%") { // We need different strings depending on notification type switch (behaviour_) {