Removed unused category in toasts

This commit is contained in:
emeric
2025-09-13 18:20:09 +02:00
parent f786b8b705
commit 98b7e6c542
10 changed files with 19 additions and 27 deletions
+3 -4
View File
@@ -546,7 +546,6 @@ namespace lms::ui
{ {
_scannerEvents.scanComplete.connect([this](const scanner::ScanStats& stats) { _scannerEvents.scanComplete.connect([this](const scanner::ScanStats& stats) {
notifyMsg(Notification::Type::Info, notifyMsg(Notification::Type::Info,
Wt::WString::tr("Lms.Admin.Database.database"),
Wt::WString::tr("Lms.Admin.Database.scan-complete") Wt::WString::tr("Lms.Admin.Database.scan-complete")
.arg(static_cast<unsigned>(stats.getTotalFileCount())) .arg(static_cast<unsigned>(stats.getTotalFileCount()))
.arg(static_cast<unsigned>(stats.additions)) .arg(static_cast<unsigned>(stats.additions))
@@ -596,9 +595,9 @@ namespace lms::ui
WApplication::setTitle(title); WApplication::setTitle(title);
} }
void LmsApplication::notifyMsg(Notification::Type type, const Wt::WString& category, const Wt::WString& message, std::chrono::milliseconds duration) void LmsApplication::notifyMsg(Notification::Type type, const Wt::WString& message, std::chrono::milliseconds duration)
{ {
LMS_LOG(UI, INFO, "Notifying message '" << message.toUTF8() << "' for category '" << category.toUTF8() << "'"); LMS_LOG(UI, INFO, "Notifying message '" << message.toUTF8() << "'");
_notificationContainer->add(type, category, message, duration); _notificationContainer->add(type, message, duration);
} }
} // namespace lms::ui } // namespace lms::ui
+1 -1
View File
@@ -80,7 +80,7 @@ namespace lms::ui
void setTitle(const Wt::WString& title = ""); void setTitle(const Wt::WString& title = "");
// Used to classify the message sent to the user // Used to classify the message sent to the user
void notifyMsg(Notification::Type type, const Wt::WString& category, const Wt::WString& message, std::chrono::milliseconds duration = std::chrono::milliseconds{ 5000 }); void notifyMsg(Notification::Type type, const Wt::WString& message, std::chrono::milliseconds duration = std::chrono::milliseconds{ 5000 });
MediaPlayer& getMediaPlayer() const { return *_mediaPlayer; } MediaPlayer& getMediaPlayer() const { return *_mediaPlayer; }
PlayQueue& getPlayQueue() const { return *_playQueue; } PlayQueue& getPlayQueue() const { return *_playQueue; }
+4 -5
View File
@@ -34,12 +34,12 @@ namespace lms::ui
class NotificationWidget : public Wt::WTemplate class NotificationWidget : public Wt::WTemplate
{ {
public: public:
NotificationWidget(Notification::Type type, const Wt::WString& category, const Wt::WString& message, std::chrono::milliseconds duration); NotificationWidget(Notification::Type type, const Wt::WString& message, std::chrono::milliseconds duration);
Wt::JSignal<> closed{ this, "closed" }; Wt::JSignal<> closed{ this, "closed" };
}; };
} // namespace } // namespace
NotificationWidget::NotificationWidget(Notification::Type type, const Wt::WString& category, const Wt::WString& message, std::chrono::milliseconds duration) NotificationWidget::NotificationWidget(Notification::Type type, const Wt::WString& message, std::chrono::milliseconds duration)
: Wt::WTemplate{ Wt::WString::tr("Lms.notifications.template.entry") } : Wt::WTemplate{ Wt::WString::tr("Lms.notifications.template.entry") }
{ {
switch (type) switch (type)
@@ -58,7 +58,6 @@ namespace lms::ui
break; break;
} }
bindString("category", category);
bindString("message", message); bindString("message", message);
bindInt("duration", duration.count()); bindInt("duration", duration.count());
@@ -78,9 +77,9 @@ namespace lms::ui
doJavaScript(oss.str()); doJavaScript(oss.str());
} }
void NotificationContainer::add(Notification::Type type, const Wt::WString& category, const Wt::WString& message, std::chrono::milliseconds duration) void NotificationContainer::add(Notification::Type type, const Wt::WString& message, std::chrono::milliseconds duration)
{ {
NotificationWidget* notification{ addNew<NotificationWidget>(type, category, message, duration) }; NotificationWidget* notification{ addNew<NotificationWidget>(type, message, duration) };
notification->closed.connect([this, notification] { notification->closed.connect([this, notification] {
removeWidget(notification); removeWidget(notification);
+1 -3
View File
@@ -31,8 +31,6 @@ namespace lms::ui
class NotificationContainer : public Wt::WContainerWidget class NotificationContainer : public Wt::WContainerWidget
{ {
public: public:
void add(Notification::Type type, const Wt::WString& category, const Wt::WString& message, std::chrono::milliseconds duration); void add(Notification::Type type, const Wt::WString& message, std::chrono::milliseconds duration);
private:
}; };
} // namespace lms::ui } // namespace lms::ui
+2 -2
View File
@@ -758,7 +758,7 @@ namespace lms::ui
{ {
if (LmsApp->getUserType() == db::UserType::DEMO) if (LmsApp->getUserType() == db::UserType::DEMO)
{ {
LmsApp->notifyMsg(Notification::Type::Warning, Wt::WString::tr("Lms.Settings.settings"), Wt::WString::tr("Lms.Settings.demo-cannot-save")); LmsApp->notifyMsg(Notification::Type::Warning, Wt::WString::tr("Lms.Settings.demo-cannot-save"));
return; return;
} }
} }
@@ -768,7 +768,7 @@ namespace lms::ui
if (model->validate()) if (model->validate())
{ {
model->saveData(); model->saveData();
LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Settings.settings"), Wt::WString::tr("Lms.Settings.settings-saved")); LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Settings.settings-saved"));
} }
// Udate the view: Delete any validation message in the view, etc. // Udate the view: Delete any validation message in the view, etc.
+3 -3
View File
@@ -47,7 +47,7 @@ namespace lms::ui
Wt::WTemplate* entry{ addEntry() }; Wt::WTemplate* entry{ addEntry() };
updateEntry(newMediaLibraryId, entry); updateEntry(newMediaLibraryId, entry);
// No need to stop the current scan if we add stuff // No need to stop the current scan if we add stuff
LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.MediaLibraries.media-libraries"), Wt::WString::tr("Lms.Admin.MediaLibrary.library-created")); LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.MediaLibrary.library-created"));
LmsApp->getModalManager().dispose(mediaLibraryModalPtr); LmsApp->getModalManager().dispose(mediaLibraryModalPtr);
}); });
@@ -99,7 +99,7 @@ namespace lms::ui
// Don't want the scanner to go on with wrong settings // Don't want the scanner to go on with wrong settings
core::Service<scanner::IScannerService>::get()->requestReload(); core::Service<scanner::IScannerService>::get()->requestReload();
LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.MediaLibraries.media-libraries"), Wt::WString::tr("Lms.Admin.MediaLibrary.library-deleted")); LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.MediaLibrary.library-deleted"));
_libraries->removeWidget(libraryEntry); _libraries->removeWidget(libraryEntry);
@@ -138,7 +138,7 @@ namespace lms::ui
// Don't want the scanner to go on with wrong settings // Don't want the scanner to go on with wrong settings
core::Service<scanner::IScannerService>::get()->requestReload(); core::Service<scanner::IScannerService>::get()->requestReload();
LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.MediaLibraries.media-libraries"), Wt::WString::tr("Lms.settings-saved")); LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.settings-saved"));
LmsApp->getModalManager().dispose(mediaLibraryModalPtr); LmsApp->getModalManager().dispose(mediaLibraryModalPtr);
}); });
+1 -1
View File
@@ -493,7 +493,7 @@ namespace lms::ui
core::Service<recommendation::IRecommendationService>::get()->load(); core::Service<recommendation::IRecommendationService>::get()->load();
// Don't want the scanner to go on with wrong settings // Don't want the scanner to go on with wrong settings
core::Service<scanner::IScannerService>::get()->requestReload(); core::Service<scanner::IScannerService>::get()->requestReload();
LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.Database.database"), Wt::WString::tr("Lms.settings-saved")); LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.settings-saved"));
} }
// Udate the view: Delete any validation message in the view, etc. // Udate the view: Delete any validation message in the view, etc.
+2 -2
View File
@@ -88,10 +88,10 @@ namespace lms::ui
auto onDbEvent{ [&]() { refreshContents(); } }; auto onDbEvent{ [&]() { refreshContents(); } };
LmsApp->getScannerEvents().scanAborted.connect(this, [] { LmsApp->getScannerEvents().scanAborted.connect(this, [] {
LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.Database.database"), Wt::WString::tr("Lms.Admin.Database.scan-aborted")); LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.Database.scan-aborted"));
}); });
LmsApp->getScannerEvents().scanStarted.connect(this, [] { LmsApp->getScannerEvents().scanStarted.connect(this, [] {
LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.Database.database"), Wt::WString::tr("Lms.Admin.Database.scan-launched")); LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Admin.Database.scan-launched"));
}); });
LmsApp->getScannerEvents().scanComplete.connect(this, onDbEvent); LmsApp->getScannerEvents().scanComplete.connect(this, onDbEvent);
LmsApp->getScannerEvents().scanInProgress.connect(this, onDbEvent); LmsApp->getScannerEvents().scanInProgress.connect(this, onDbEvent);
+1 -3
View File
@@ -263,9 +263,7 @@ namespace lms::ui
if (model->validate()) if (model->validate())
{ {
model->saveData(); model->saveData();
LmsApp->notifyMsg(Notification::Type::Info, LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr(userId ? "Lms.Admin.User.user-updated" : "Lms.Admin.User.user-created"));
Wt::WString::tr("Lms.Admin.Users.users"),
Wt::WString::tr(userId ? "Lms.Admin.User.user-updated" : "Lms.Admin.User.user-created"));
LmsApp->setInternalPath("/admin/users", true); LmsApp->setInternalPath("/admin/users", true);
} }
else else
+1 -3
View File
@@ -326,9 +326,7 @@ namespace lms::ui
void Filters::emitFilterAddedNotification() void Filters::emitFilterAddedNotification()
{ {
LmsApp->notifyMsg(Notification::Type::Info, LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Explore.filter-added"), std::chrono::seconds{ 2 });
Wt::WString::tr("Lms.Explore.filters"),
Wt::WString::tr("Lms.Explore.filter-added"), std::chrono::seconds{ 2 });
_sigUpdated.emit(); _sigUpdated.emit();
} }