Files
live-caption/src/ui/settingsdialog.h
T

96 lines
2.9 KiB
C++
Raw Normal View History

#pragma once
#include <QDialog>
class QComboBox;
class QCheckBox;
class QDoubleSpinBox;
class QGroupBox;
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 updateStreamGroupEnabled(); // 流式参数只在 llama 后端下可用
void onDownload();
void onVerify();
void onDelete();
void onOpenDir();
void applySettings(); // 读取控件 → 保存 → 发 settingsApplied(不关闭对话框)
void onAccept(); // 确定:applySettings + 关闭
void onApplyClicked(); // 应用:只 applySettings
bool ensureModelSelected();
QTableWidget * table_ = nullptr;
QComboBox * activeCombo_ = nullptr;
QComboBox * languageCombo_ = nullptr;
QComboBox * captureCombo_ = nullptr;
QPushButton * verifyBtn_ = 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;
// 高级:流式参数(只影响 llama 后端)
QGroupBox * streamGroup_ = nullptr;
QLabel * streamNote_ = nullptr;
QComboBox * streamModeCombo_ = nullptr;
QDoubleSpinBox * windowSpin_ = nullptr;
QDoubleSpinBox * segmentSpin_ = nullptr;
QSpinBox * unfixedTokenSpin_ = nullptr;
QSpinBox * unfixedChunkSpin_ = nullptr;
QSpinBox * maxTokenSpin_ = nullptr;
// 高级:调试
QCheckBox * verboseCheck_ = nullptr;
QLineEdit * modelDirEdit_ = nullptr;
models::ModelDownloader * downloader_ = nullptr;
bool firstRun_ = false;
};
} // namespace lc