Made a dedicated window modal, fixes #428
This commit is contained in:
@@ -16,6 +16,7 @@ add_executable(lms
|
||||
ui/Utils.cpp
|
||||
ui/admin/debug/Database.cpp
|
||||
ui/admin/debug/Tracing.cpp
|
||||
ui/admin/About.cpp
|
||||
ui/admin/DebugToolsView.cpp
|
||||
ui/admin/InitWizardView.cpp
|
||||
ui/admin/MediaLibrariesView.cpp
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "core/ILogger.hpp"
|
||||
#include "core/ITraceLogger.hpp"
|
||||
#include "core/Service.hpp"
|
||||
#include "core/Version.hpp"
|
||||
#include "database/IDb.hpp"
|
||||
#include "database/IQueryPlanRecorder.hpp"
|
||||
#include "database/Session.hpp"
|
||||
@@ -53,6 +52,7 @@
|
||||
#include "NotificationContainer.hpp"
|
||||
#include "PlayQueue.hpp"
|
||||
#include "SettingsView.hpp"
|
||||
#include "admin/About.hpp"
|
||||
#include "admin/DebugToolsView.hpp"
|
||||
#include "admin/InitWizardView.hpp"
|
||||
#include "admin/MediaLibrariesView.hpp"
|
||||
@@ -77,6 +77,7 @@ namespace lms::ui
|
||||
const std::string appRoot{ Wt::WApplication::appRoot() };
|
||||
|
||||
auto res{ std::make_shared<Wt::WMessageResourceBundle>() };
|
||||
res->use(appRoot + "admin-about");
|
||||
res->use(appRoot + "admin-db");
|
||||
res->use(appRoot + "admin-debugtools");
|
||||
res->use(appRoot + "admin-initwizard");
|
||||
@@ -461,7 +462,10 @@ namespace lms::ui
|
||||
if (LmsApp->getUserType() == db::UserType::ADMIN)
|
||||
{
|
||||
navbar->setCondition("if-is-admin", true);
|
||||
navbar->bindString("version", std::string{ core::getVersion() }, Wt::TextFormat::Plain);
|
||||
auto* about{ navbar->bindNew<Wt::WPushButton>("about", Wt::WString::tr("Lms.Admin.menu-about"), Wt::TextFormat::XHTML) };
|
||||
about->clicked().connect([] {
|
||||
showAboutModal();
|
||||
});
|
||||
navbar->bindNew<Wt::WAnchor>("media-libraries", Wt::WLink{ Wt::LinkType::InternalPath, "/admin/libraries" }, Wt::WString::tr("Lms.Admin.menu-media-libraries"));
|
||||
navbar->bindNew<Wt::WAnchor>("scan-settings", Wt::WLink{ Wt::LinkType::InternalPath, "/admin/scan-settings" }, Wt::WString::tr("Lms.Admin.menu-scan-settings"));
|
||||
navbar->bindNew<Wt::WAnchor>("scanner", Wt::WLink{ Wt::LinkType::InternalPath, "/admin/scanner" }, Wt::WString::tr("Lms.Admin.menu-scanner"));
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
* LMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ModalManager.hpp"
|
||||
|
||||
#include <Wt/WPushButton.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "core/Version.hpp"
|
||||
|
||||
#include "LmsApplication.hpp"
|
||||
|
||||
namespace lms::ui
|
||||
{
|
||||
void showAboutModal()
|
||||
{
|
||||
auto aboutModal{ std::make_unique<Wt::WTemplate>(Wt::WString::tr("Lms.Admin.About.template")) };
|
||||
Wt::WWidget* aboutModalPtr{ aboutModal.get() };
|
||||
aboutModal->addFunction("tr", &Wt::WTemplate::Functions::tr);
|
||||
|
||||
aboutModal->bindString("version", std::string{ core::getVersion() }, Wt::TextFormat::Plain);
|
||||
aboutModal->bindString("homepage-link", "https://github.com/epoupon/lms");
|
||||
|
||||
Wt::WPushButton* okBtn{ aboutModal->bindNew<Wt::WPushButton>("ok-btn", Wt::WString::tr("Lms.ok")) };
|
||||
okBtn->clicked().connect([=] {
|
||||
LmsApp->getModalManager().dispose(aboutModalPtr);
|
||||
});
|
||||
|
||||
LmsApp->getModalManager().show(std::move(aboutModal));
|
||||
}
|
||||
} // namespace lms::ui
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
* LMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace lms::ui
|
||||
{
|
||||
void showAboutModal();
|
||||
} // namespace lms::ui
|
||||
Reference in New Issue
Block a user