[1012] 模版中心内容改为后端管理#3385
Merged
Merged
Conversation
4d4c86c to
87cd121
Compare
Contributor
There was a problem hiding this comment.
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
QTMTemplatePageintoQTMStartupTabWidget. - 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); |
yinyuscloor
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.