2026-10-12 16:30:00 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
|
|
|
|
|
class QComboBox;
|
|
|
|
|
class QCheckBox;
|
|
|
|
|
class QDoubleSpinBox;
|
2026-10-12 17:36:43 +08:00
|
|
|
class QGroupBox;
|
2026-10-12 16:30:00 +08:00
|
|
|
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();
|
2026-10-12 17:36:43 +08:00
|
|
|
void updateStreamGroupEnabled(); // 流式参数只在 llama 后端下可用
|
2026-10-12 16:30:00 +08:00
|
|
|
void onDownload();
|
2026-10-12 17:03:20 +08:00
|
|
|
void onVerify();
|
2026-10-12 16:30:00 +08:00
|
|
|
void onDelete();
|
|
|
|
|
void onOpenDir();
|
2026-10-12 17:18:16 +08:00
|
|
|
void applySettings(); // 读取控件 → 保存 → 发 settingsApplied(不关闭对话框)
|
|
|
|
|
void onAccept(); // 确定:applySettings + 关闭
|
|
|
|
|
void onApplyClicked(); // 应用:只 applySettings
|
2026-10-12 16:30:00 +08:00
|
|
|
bool ensureModelSelected();
|
|
|
|
|
|
|
|
|
|
QTableWidget * table_ = nullptr;
|
|
|
|
|
QComboBox * activeCombo_ = nullptr;
|
|
|
|
|
QComboBox * languageCombo_ = nullptr;
|
2026-10-12 17:03:20 +08:00
|
|
|
QComboBox * captureCombo_ = nullptr;
|
|
|
|
|
QPushButton * verifyBtn_ = nullptr;
|
2026-10-12 16:30:00 +08:00
|
|
|
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;
|
|
|
|
|
|
2026-10-12 17:36:43 +08:00
|
|
|
// 高级:流式参数(只影响 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;
|
|
|
|
|
|
2026-10-12 16:30:00 +08:00
|
|
|
models::ModelDownloader * downloader_ = nullptr;
|
|
|
|
|
bool firstRun_ = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace lc
|