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) {
notifyMsg(Notification::Type::Info,
Wt::WString::tr("Lms.Admin.Database.database"),
Wt::WString::tr("Lms.Admin.Database.scan-complete")
.arg(static_cast<unsigned>(stats.getTotalFileCount()))
.arg(static_cast<unsigned>(stats.additions))
@@ -596,9 +595,9 @@ namespace lms::ui
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() << "'");
_notificationContainer->add(type, category, message, duration);
LMS_LOG(UI, INFO, "Notifying message '" << message.toUTF8() << "'");
_notificationContainer->add(type, message, duration);
}
} // namespace lms::ui
+1 -1
View File
@@ -80,7 +80,7 @@ namespace lms::ui
void setTitle(const Wt::WString& title = "");
// 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; }
PlayQueue& getPlayQueue() const { return *_playQueue; }
+4 -5
View File
@@ -34,12 +34,12 @@ namespace lms::ui
class NotificationWidget : public Wt::WTemplate
{
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" };
};
} // 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") }
{
switch (type)
@@ -58,7 +58,6 @@ namespace lms::ui
break;
}
bindString("category", category);
bindString("message", message);
bindInt("duration", duration.count());
@@ -78,9 +77,9 @@ namespace lms::ui
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] {
removeWidget(notification);
+1 -3
View File
@@ -31,8 +31,6 @@ namespace lms::ui
class NotificationContainer : public Wt::WContainerWidget
{
public:
void add(Notification::Type type, const Wt::WString& category, const Wt::WString& message, std::chrono::milliseconds duration);
private:
void add(Notification::Type type, const Wt::WString& message, std::chrono::milliseconds duration);
};
} // namespace lms::ui
+2 -2
View File
@@ -758,7 +758,7 @@ namespace lms::ui
{
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;
}
}
@@ -768,7 +768,7 @@ namespace lms::ui
if (model->validate())
{
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.
+3 -3
View File
@@ -47,7 +47,7 @@ namespace lms::ui
Wt::WTemplate* entry{ addEntry() };
updateEntry(newMediaLibraryId, entry);
// 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);
});
@@ -99,7 +99,7 @@ namespace lms::ui
// Don't want the scanner to go on with wrong settings
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);
@@ -138,7 +138,7 @@ namespace lms::ui
// Don't want the scanner to go on with wrong settings
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);
});
+1 -1
View File
@@ -493,7 +493,7 @@ namespace lms::ui
core::Service<recommendation::IRecommendationService>::get()->load();
// Don't want the scanner to go on with wrong settings
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.
+2 -2
View File
@@ -88,10 +88,10 @@ namespace lms::ui
auto onDbEvent{ [&]() { refreshContents(); } };
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->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().scanInProgress.connect(this, onDbEvent);
+1 -3
View File
@@ -263,9 +263,7 @@ namespace lms::ui
if (model->validate())
{
model->saveData();
LmsApp->notifyMsg(Notification::Type::Info,
Wt::WString::tr("Lms.Admin.Users.users"),
Wt::WString::tr(userId ? "Lms.Admin.User.user-updated" : "Lms.Admin.User.user-created"));
LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr(userId ? "Lms.Admin.User.user-updated" : "Lms.Admin.User.user-created"));
LmsApp->setInternalPath("/admin/users", true);
}
else
+1 -3
View File
@@ -326,9 +326,7 @@ namespace lms::ui
void Filters::emitFilterAddedNotification()
{
LmsApp->notifyMsg(Notification::Type::Info,
Wt::WString::tr("Lms.Explore.filters"),
Wt::WString::tr("Lms.Explore.filter-added"), std::chrono::seconds{ 2 });
LmsApp->notifyMsg(Notification::Type::Info, Wt::WString::tr("Lms.Explore.filter-added"), std::chrono::seconds{ 2 });
_sigUpdated.emit();
}