Skip to content

[1012] 模版中心内容改为后端管理#3385

Merged
Yuki-Nagori merged 9 commits into
mainfrom
yuki/1012/startup
May 19, 2026
Merged

[1012] 模版中心内容改为后端管理#3385
Yuki-Nagori merged 9 commits into
mainfrom
yuki/1012/startup

Conversation

@Yuki-Nagori
Copy link
Copy Markdown
Contributor

No description provided.

@Yuki-Nagori Yuki-Nagori marked this pull request as draft May 18, 2026 06:20
@Yuki-Nagori Yuki-Nagori requested a review from Copilot May 18, 2026 10:46
@Yuki-Nagori Yuki-Nagori marked this pull request as ready for review May 18, 2026 10:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Template Center to use backend-managed categories/templates, moves category navigation into the startup sidebar, and adds cache/parser tests around the new API and MD5 cache behavior.

Changes:

  • Replaces the old metadata fetch flow with separate POST-based category and template list APIs.
  • Moves template category selection from QTMTemplatePage into QTMStartupTabWidget.
  • Adds category/template cache fields, MD5 bookkeeping, default Scheme category updates, and new Template Center tests.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
TeXmacs/templates/categories.scm Updates default categories to backend-style fields.
TeXmacs/misc/themes/liii.css Removes obsolete template page/category styles.
TeXmacs/misc/themes/liii-night.css Removes obsolete dark-theme template category styles.
src/Mogan/TemplateCenter/template_api.hpp Defines split category/template API surface.
src/Mogan/TemplateCenter/template_api.cpp Implements POST category/template fetching and response parsing.
src/Mogan/TemplateCenter/template_cache.hpp Adds category/cache MD5 fields and removes metadata ETag API.
src/Mogan/TemplateCenter/template_cache.cpp Persists new category/cache fields and removes ETag storage.
src/Mogan/TemplateCenter/template_manager.hpp Adds split refresh state and MD5 verification API.
src/Mogan/TemplateCenter/template_manager.cpp Implements category/template refresh, incremental merge, and MD5 cache handling.
src/Mogan/TemplateCenter/template_types.hpp Extends TemplateCategory for backend fields.
src/Plugins/Qt/QTMStartupTabWidget.hpp Adds dynamic category navigation state.
src/Plugins/Qt/QTMStartupTabWidget.cpp Builds sidebar category buttons and triggers per-category template loads.
src/Plugins/Qt/QTMTemplatePage.hpp Removes internal category bar API and exposes category/grid controls.
src/Plugins/Qt/QTMTemplatePage.cpp Updates template grid refresh to use externally selected category.
src/Plugins/Qt/QTMTemplateOpener.hpp Adjusts local availability check signature.
src/Plugins/Qt/QTMTemplateOpener.cpp Uses MD5 verification before opening local templates.
tests/Mogan/TemplateCenter/template_api_parser_test.cpp Adds parser unit tests for new API fields.
tests/Mogan/TemplateCenter/template_api_integration_test.cpp Updates integration tests for split category/template APIs.
tests/Mogan/TemplateCenter/template_cache_test.cpp Adds cache tests for categories and template entries.
tests/Mogan/Startup/startup_tab_widget_test.cpp Updates startup/template page behavior tests.
devel/1012.md Documents the refactor, testing, and expected flows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

TemplateManager::refreshTemplates () {
if (isRefreshing_) {
TemplateManager::refreshCategories () {
if (isRefreshingCategories_ || categoriesFetched_) {
Comment on lines +513 to 520
// 空数据保护:本地已有数据时,空响应视为异常
if (remoteMetadata.isEmpty () && !templates_.isEmpty ()) {
QString error= tr ("Remote metadata is empty");
qWarning () << "Skip metadata merge:" << error;
QString error= qt_translate ("Remote templates list is empty");
qWarning () << "[Template] Skip templates merge:" << error;
pendingIncrementalCategoryId_.clear ();
emit templatesLoaded ();
emit templatesLoadFailed (error);
return;
// Register in cache
QFileInfo fileInfo (localPath);
cache_->registerCachedTemplate (templateId, localPath, fileInfo.size ());
QString fileMd5= computeFileMd5 (localPath);
@Yuki-Nagori Yuki-Nagori merged commit d8f3958 into main May 19, 2026
5 checks passed
@Yuki-Nagori Yuki-Nagori deleted the yuki/1012/startup branch May 19, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants