From b0956925bd4b3cdc3610847c9faeb5c60fc73d17 Mon Sep 17 00:00:00 2001 From: emeric Date: Thu, 30 Aug 2018 11:24:59 +0200 Subject: [PATCH] Reduced duration of the annoying notifications --- src/ui/LmsApplication.cpp | 6 ++++-- src/ui/LmsApplication.hpp | 2 +- src/ui/PlayQueueView.cpp | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ui/LmsApplication.cpp b/src/ui/LmsApplication.cpp index 8a407ff6..0893b9a5 100644 --- a/src/ui/LmsApplication.cpp +++ b/src/ui/LmsApplication.cpp @@ -533,7 +533,7 @@ static std::string msgTypeToString(MsgType type) } void -LmsApplication::notifyMsg(MsgType type, const Wt::WString& message) +LmsApplication::notifyMsg(MsgType type, const Wt::WString& message, std::chrono::milliseconds duration) { LMS_LOG(UI, INFO) << "Notifying message '" << message.toUTF8() << "' of type '" << msgTypeToString(type); @@ -543,7 +543,9 @@ LmsApplication::notifyMsg(MsgType type, const Wt::WString& message) "message: '" << message.toUTF8() << "'" "},{" "type: '" << msgTypeToString(type) << "'," - "placement: {from: 'top', align: 'center'}" + "placement: {from: 'top', align: 'center'}," + "timer: 250," + "delay: " << duration.count() << "" "});"; LmsApp->doJavaScript(oss.str()); diff --git a/src/ui/LmsApplication.hpp b/src/ui/LmsApplication.hpp index 7b6145fd..5f301920 100644 --- a/src/ui/LmsApplication.hpp +++ b/src/ui/LmsApplication.hpp @@ -79,7 +79,7 @@ class LmsApplication : public Wt::WApplication void goHome(); void goHomeAndQuit(); - void notifyMsg(MsgType type, const Wt::WString& message); + void notifyMsg(MsgType type, const Wt::WString& message, std::chrono::milliseconds duration = std::chrono::milliseconds(4000)); static Wt::WLink createArtistLink(Database::Artist::pointer artist); static std::unique_ptr createArtistAnchor(Database::Artist::pointer artist, bool addText = true); diff --git a/src/ui/PlayQueueView.cpp b/src/ui/PlayQueueView.cpp index fe5d2b75..c20d2506 100644 --- a/src/ui/PlayQueueView.cpp +++ b/src/ui/PlayQueueView.cpp @@ -236,7 +236,7 @@ void PlayQueue::addTracks(const std::vector& tracks) { enqueueTracks(tracks); - LmsApp->notifyMsg(MsgType::Info, Wt::WString::tr("Lms.PlayQueue.nb-tracks-added").arg(tracks.size())); + LmsApp->notifyMsg(MsgType::Info, Wt::WString::tr("Lms.PlayQueue.nb-tracks-added").arg(tracks.size()), std::chrono::milliseconds(2000)); } void @@ -248,7 +248,7 @@ PlayQueue::playTracks(const std::vector& tracks) enqueueTracks(tracks); play(0); - LmsApp->notifyMsg(MsgType::Info, Wt::WString::tr("Lms.PlayQueue.nb-tracks-playing").arg(tracks.size())); + LmsApp->notifyMsg(MsgType::Info, Wt::WString::tr("Lms.PlayQueue.nb-tracks-playing").arg(tracks.size()), std::chrono::milliseconds(2000)); }