feat(gui): drive everything from settings, add tray and in-app download
The GUI no longer needs command line arguments: on first run it opens a settings dialog that lists the registry, downloads models in-app (mirror base, HTTP proxy, resume), and picks the active model. The caption window gains a tray icon (show/hide, settings, quit); its close button hides to the tray so the window can always be brought back, and the language pill opens the settings. Appearance (font, opacity, line counts, position) is persisted. CLI flags remain for automated testing and override settings. GUI 不再依赖命令行参数:首次启动打开设置对话框,可在应用内下载模型 (下载源/代理/断点续传)、选择当前模型与识别语言;字幕窗增加托盘(显示 隐藏/设置/退出),关闭按钮改为隐藏到托盘以免关掉后无法再打开,语言标签 点击进设置;字号/透明度/行数/位置都会持久化。命令行参数保留作自动化测试。
This commit is contained in:
1 parent
b37b9eb779
commit
a7a6f3e6b6
15 files changed
+1175
-90
No files matched your search
@@ -0,0 +1,75 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QComboBox;
|
||||
class QCheckBox;
|
||||
class QDoubleSpinBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QProgressBar;
|
||||
class QPushButton;
|
||||
class QSlider;
|
||||
class QSpinBox;
|
||||
class QTableWidget;
|
||||
|
||||
namespace lc {
|
||||
|
||||
namespace models { class ModelDownloader; }
|
||||
|
||||
// 设置对话框:模型管理(下载/删除/选择)、显示、窗口、下载源与代理、高级。
|
||||
// GUI 用户完全靠它驱动,不再需要命令行参数。
|
||||
class SettingsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingsDialog(bool firstRun, QWidget * parent = nullptr);
|
||||
~SettingsDialog() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
// 设置已变更且用户点了确定
|
||||
void settingsApplied();
|
||||
|
||||
private:
|
||||
QWidget * buildModelPage();
|
||||
QWidget * buildDisplayPage();
|
||||
QWidget * buildAdvancedPage();
|
||||
|
||||
void refreshModelTable();
|
||||
void refreshActiveCombo();
|
||||
void onDownload();
|
||||
void onDelete();
|
||||
void onOpenDir();
|
||||
void onApply();
|
||||
bool ensureModelSelected();
|
||||
|
||||
QTableWidget * table_ = nullptr;
|
||||
QComboBox * activeCombo_ = nullptr;
|
||||
QComboBox * languageCombo_ = nullptr;
|
||||
QPushButton * downloadBtn_ = nullptr;
|
||||
QPushButton * deleteBtn_ = nullptr;
|
||||
QProgressBar * progress_ = nullptr;
|
||||
QLabel * statusLabel_ = nullptr;
|
||||
|
||||
QLineEdit * mirrorEdit_ = nullptr;
|
||||
QComboBox * proxyCombo_ = nullptr;
|
||||
QLineEdit * proxyHost_ = nullptr;
|
||||
QSpinBox * proxyPort_ = nullptr;
|
||||
QLineEdit * proxyUser_ = nullptr;
|
||||
QLineEdit * proxyPass_ = nullptr;
|
||||
|
||||
QSpinBox * fontSpin_ = nullptr;
|
||||
QCheckBox * showTailCheck_ = nullptr;
|
||||
QSpinBox * collapsedSpin_ = nullptr;
|
||||
QSpinBox * expandedSpin_ = nullptr;
|
||||
QSlider * opacitySlider_ = nullptr;
|
||||
QLabel * opacityLabel_ = nullptr;
|
||||
|
||||
QDoubleSpinBox * chunkSpin_ = nullptr;
|
||||
QSpinBox * threadsSpin_ = nullptr;
|
||||
|
||||
models::ModelDownloader * downloader_ = nullptr;
|
||||
bool firstRun_ = false;
|
||||
};
|
||||
|
||||
} // namespace lc
|
||||
Reference in new issue
Block a user