Setting window title to help browsing in history. ref #253
This commit is contained in:
@@ -106,6 +106,7 @@ getOrCreateMessageBundle()
|
||||
return res;
|
||||
}
|
||||
|
||||
static constexpr const char* titleSeparator {" | "};
|
||||
static constexpr const char* defaultPath {"/releases"};
|
||||
|
||||
std::unique_ptr<Wt::WApplication>
|
||||
@@ -378,21 +379,22 @@ handlePathChange(Wt::WStackedWidget& stack, bool isAdmin)
|
||||
std::string path;
|
||||
int index;
|
||||
bool admin;
|
||||
std::optional<Wt::WString> title;
|
||||
} views[] =
|
||||
{
|
||||
{ "/artists", IdxExplore, false },
|
||||
{ "/artist", IdxExplore, false },
|
||||
{ "/releases", IdxExplore, false },
|
||||
{ "/release", IdxExplore, false },
|
||||
{ "/search", IdxExplore, false },
|
||||
{ "/tracks", IdxExplore, false },
|
||||
{ "/tracklists", IdxExplore, false },
|
||||
{ "/tracklist", IdxExplore, false },
|
||||
{ "/playqueue", IdxPlayQueue, false },
|
||||
{ "/settings", IdxSettings, false },
|
||||
{ "/admin/database", IdxAdminDatabase, true },
|
||||
{ "/admin/users", IdxAdminUsers, true },
|
||||
{ "/admin/user", IdxAdminUser, true },
|
||||
{ "/artists", IdxExplore, false, Wt::WString::tr("Lms.Explore.artists") },
|
||||
{ "/artist", IdxExplore, false, std::nullopt },
|
||||
{ "/releases", IdxExplore, false, Wt::WString::tr("Lms.Explore.releases") },
|
||||
{ "/release", IdxExplore, false, std::nullopt },
|
||||
{ "/search", IdxExplore, false, Wt::WString::tr("Lms.Explore.search") },
|
||||
{ "/tracks", IdxExplore, false, Wt::WString::tr("Lms.Explore.tracks") },
|
||||
{ "/tracklists", IdxExplore, false, Wt::WString::tr("Lms.Explore.tracklists") },
|
||||
{ "/tracklist", IdxExplore, false, std::nullopt },
|
||||
{ "/playqueue", IdxPlayQueue, false, Wt::WString::tr("Lms.PlayQueue.playqueue") },
|
||||
{ "/settings", IdxSettings, false, Wt::WString::tr("Lms.Settings.settings") },
|
||||
{ "/admin/database", IdxAdminDatabase, true, Wt::WString::tr("Lms.Admin.Database.database") },
|
||||
{ "/admin/users", IdxAdminUsers, true, Wt::WString::tr("Lms.Admin.Users.users") },
|
||||
{ "/admin/user", IdxAdminUser, true, std::nullopt },
|
||||
};
|
||||
|
||||
LMS_LOG(UI, DEBUG) << "Internal path changed to '" << wApp->internalPath() << "'";
|
||||
@@ -406,6 +408,8 @@ handlePathChange(Wt::WStackedWidget& stack, bool isAdmin)
|
||||
break;
|
||||
|
||||
stack.setCurrentIndex(view.index);
|
||||
if (view.title)
|
||||
LmsApp->setTitle(*view.title);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -623,7 +627,7 @@ LmsApplication::setTitle(const Wt::WString& title)
|
||||
if (title.empty())
|
||||
WApplication::setTitle("LMS");
|
||||
else
|
||||
WApplication::setTitle(title + " | LMS");
|
||||
WApplication::setTitle(Wt::WString {"LMS"} + titleSeparator + title);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -215,16 +215,22 @@ UserView::refreshView()
|
||||
if (!user)
|
||||
throw UserNotFoundException {};
|
||||
|
||||
t->bindString("title", Wt::WString::tr("Lms.Admin.User.user-edit").arg(user->getLoginName()), Wt::TextFormat::Plain);
|
||||
const Wt::WString title {Wt::WString::tr("Lms.Admin.User.user-edit").arg(user->getLoginName())};
|
||||
LmsApp->setTitle(title);
|
||||
|
||||
t->bindString("title", title, Wt::TextFormat::Plain);
|
||||
t->setCondition("if-has-last-login", true);
|
||||
t->bindString("last-login", user->getLastLogin().toString(), Wt::TextFormat::Plain);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Wt::WString title {Wt::WString::tr("Lms.Admin.User.user-create")};
|
||||
LmsApp->setTitle(title);
|
||||
|
||||
// Login
|
||||
t->setCondition("if-has-login", true);
|
||||
t->setFormWidget(UserModel::LoginField, std::make_unique<Wt::WLineEdit>());
|
||||
t->bindString("title", Wt::WString::tr("Lms.Admin.User.user-create"));
|
||||
t->bindString("title", title);
|
||||
}
|
||||
|
||||
if (authPasswordService)
|
||||
|
||||
@@ -109,6 +109,7 @@ Artist::refreshView()
|
||||
if (!artist)
|
||||
throw ArtistNotFoundException {};
|
||||
|
||||
LmsApp->setTitle(artist->getName());
|
||||
_artistId = *artistId;
|
||||
|
||||
std::size_t sectionCount{};
|
||||
|
||||
@@ -106,6 +106,8 @@ Release::refreshView()
|
||||
if (!release)
|
||||
throw ReleaseNotFoundException {};
|
||||
|
||||
LmsApp->setTitle(release->getName());
|
||||
|
||||
refreshCopyright(release);
|
||||
refreshLinks(release);
|
||||
refreshSimilarReleases(similarReleasesIds);
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace UserInterface
|
||||
if (!trackList)
|
||||
throw TrackListNotFoundException {};
|
||||
|
||||
LmsApp->setTitle(std::string {trackList->getName()});
|
||||
_trackListId = *trackListId;
|
||||
|
||||
clear();
|
||||
|
||||
Reference in New Issue
Block a user