feat: v0.12.0 —— 顶部工具栏、最近目录、统一配置文件

- 顶部工具栏:新建 / 打开 / 保存,以及「最近文件」「最近目录」下拉菜单
- 文件菜单同样拆成「最近文件」「最近目录」两个子菜单,各记 8 条、可分别清空
- 启动时自动打开上次编辑的文件,文件不存在则显示欢迎文档
- 所有设置改用 AppConfig 单例写进同一个 config.ini;关于对话框显示其路径
- 修掉编辑器一创建就被标成「已修改」的问题(setDocumentMargin 的副作用),
  否则恢复上次文件时会误弹保存提示
- 工具栏加了配套的 QSS 与中英文翻译,截图更新到 0.12.0
This commit is contained in:
2026-10-23 11:25:46 +08:00
parent 09e8f13901
commit 505063a2e7
14 changed files with 444 additions and 222 deletions
+8 -3
View File
@@ -13,6 +13,8 @@
#include <QTimer>
#include <QXmlStreamReader>
#include "AppConfig.h"
namespace {
QString runCommand(const QString &program, const QStringList &arguments, int timeoutMs)
@@ -184,7 +186,7 @@ void ThemeManager::initialize(Mode forcedMode, bool persist)
if (forcedMode != Mode::System) {
setMode(forcedMode, persist);
} else {
const QString saved = QSettings().value(QStringLiteral("theme/mode")).toString();
const QString saved = AppConfig::settings().value(QStringLiteral("theme/mode")).toString();
m_mode = modeFromString(saved, nullptr);
applyScheme(schemeForMode(m_mode), true);
}
@@ -195,7 +197,7 @@ void ThemeManager::setMode(Mode mode, bool persist)
{
m_mode = mode;
if (persist)
QSettings().setValue(QStringLiteral("theme/mode"), modeToString(mode));
AppConfig::settings().setValue(QStringLiteral("theme/mode"), modeToString(mode));
applyScheme(schemeForMode(m_mode), true);
}
@@ -282,6 +284,9 @@ QMenu::item { padding: 6px 28px 6px 22px; border-radius: 5px; }
QMenu::item:selected { background-color: @highlight; color: @highlightedText; }
QMenu::item:disabled { color: @disabled; }
QMenu::separator { height: 1px; background-color: @border; margin: 5px 8px; }
QToolBar { background-color: @window; border: none; border-bottom: 1px solid @border;
spacing: 2px; padding: 2px 6px; }
QToolBar::separator { width: 1px; background-color: @border; margin: 4px 6px; }
QStatusBar { background-color: @window; color: @placeholder; border-top: 1px solid @border; }
QStatusBar::item { border: none; }
QPlainTextEdit { background-color: @editorBase; color: @editorText; border: none;
@@ -303,7 +308,7 @@ QPushButton { background-color: @button; color: @buttonText; border: 1px solid @
QPushButton:hover { background-color: @highlight; color: @highlightedText; }
QPushButton:default { background-color: @accent; color: #ffffff; border-color: @accent; }
QToolTip { background-color: @menuBackground; color: @text; border: 1px solid @border; padding: 4px; }
QToolButton { border: none; border-radius: 5px; padding: 3px 8px; color: @text; background: transparent; }
QToolButton { border: none; border-radius: 5px; padding: 2px 8px; color: @text; background: transparent; }
QToolButton:hover { background-color: @hoverBackground; }
QToolButton:checked { background-color: @highlight; color: @highlightedText; }
QDockWidget { color: @text; }