Removed unused category in toasts
This commit is contained in:
@@ -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
|
||||||
@@ -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; }
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -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);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user