2026-06-17 22:44:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QTabWidget>
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QListWidget>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QRadioButton>
|
|
|
|
|
#include <QButtonGroup>
|
|
|
|
|
#include <QVariant>
|
2026-08-24 10:29:13 +02:00
|
|
|
#include <QTreeWidget>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
#include <QColorDialog>
|
2026-08-28 13:45:21 +02:00
|
|
|
#include <QSpinBox>
|
2026-07-05 10:45:44 +02:00
|
|
|
#include "services/accountservice.h"
|
2026-08-28 02:27:46 +02:00
|
|
|
#include "services/preferencesservice.h"
|
|
|
|
|
#include "services/startupbehaviorservice.h"
|
|
|
|
|
#include "services/translationservice.h"
|
|
|
|
|
#include "services/aiactionoptionsservice.h"
|
2026-08-24 10:29:13 +02:00
|
|
|
#include "db/dao/common_structs.h"
|
2026-06-17 22:44:27 +02:00
|
|
|
|
|
|
|
|
class SettingsView : public QWidget {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit SettingsView(QWidget *parent = nullptr);
|
2026-08-28 13:21:54 +02:00
|
|
|
~SettingsView() override;
|
2026-06-17 22:44:27 +02:00
|
|
|
|
2026-07-05 10:45:44 +02:00
|
|
|
void setAccountService(AccountService *service);
|
2026-08-28 02:27:46 +02:00
|
|
|
void setPreferencesService(PreferencesService *service);
|
|
|
|
|
void setStartupBehaviorService(StartupBehaviorService *service);
|
|
|
|
|
void setTranslationService(TranslationService *service);
|
|
|
|
|
void setAiActionOptionsService(AiActionOptionsService *service);
|
2026-07-05 10:45:44 +02:00
|
|
|
|
2026-06-17 22:44:27 +02:00
|
|
|
signals:
|
|
|
|
|
void accountAddRequested();
|
2026-07-05 10:45:44 +02:00
|
|
|
void accountEditRequested(int accountId);
|
|
|
|
|
void accountDeleteRequested(int accountId);
|
2026-06-17 22:44:27 +02:00
|
|
|
void themeChanged(const QString &theme);
|
|
|
|
|
void settingChanged(const QString &key, const QVariant &value);
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Categories
|
|
|
|
|
void categoryAddRequested(const Category &cat);
|
|
|
|
|
void categoryEditRequested(const Category &cat);
|
|
|
|
|
void categoryDeleteRequested(qint64 categoryId);
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Rules
|
|
|
|
|
void ruleAddRequested(const Rule &rule);
|
|
|
|
|
void ruleEditRequested(const Rule &rule);
|
|
|
|
|
void ruleDeleteRequested(qint64 ruleId);
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Templates
|
|
|
|
|
void templateAddRequested(const Template &tmpl);
|
|
|
|
|
void templateEditRequested(const Template &tmpl);
|
|
|
|
|
void templateDeleteRequested(qint64 templateId);
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Signatures
|
|
|
|
|
void signatureAddRequested(const Signature &sig);
|
|
|
|
|
void signatureEditRequested(const Signature &sig);
|
|
|
|
|
void signatureDeleteRequested(qint64 signatureId);
|
2026-06-17 22:44:27 +02:00
|
|
|
|
2026-07-05 10:45:44 +02:00
|
|
|
private slots:
|
|
|
|
|
void onAccountListChanged();
|
|
|
|
|
void loadAccounts();
|
|
|
|
|
void onEditClicked();
|
|
|
|
|
void onDeleteClicked();
|
|
|
|
|
void onAccountSelectionChanged();
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Categories
|
|
|
|
|
void onCategorySelectionChanged();
|
|
|
|
|
void onCategoryAddClicked();
|
|
|
|
|
void onCategoryEditClicked();
|
|
|
|
|
void onCategoryDeleteClicked();
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Rules
|
|
|
|
|
void onRuleSelectionChanged();
|
|
|
|
|
void onRuleAddClicked();
|
|
|
|
|
void onRuleEditClicked();
|
|
|
|
|
void onRuleDeleteClicked();
|
|
|
|
|
void onRuleToggleEnabled();
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Templates
|
|
|
|
|
void onTemplateSelectionChanged();
|
|
|
|
|
void onTemplateAddClicked();
|
|
|
|
|
void onTemplateEditClicked();
|
|
|
|
|
void onTemplateDeleteClicked();
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Signatures
|
|
|
|
|
void onSignatureSelectionChanged();
|
|
|
|
|
void onSignatureAddClicked();
|
|
|
|
|
void onSignatureEditClicked();
|
|
|
|
|
void onSignatureDeleteClicked();
|
2026-07-05 10:45:44 +02:00
|
|
|
|
2026-06-17 22:44:27 +02:00
|
|
|
private:
|
|
|
|
|
void setupUI();
|
|
|
|
|
QWidget* createAccountsTab();
|
|
|
|
|
QWidget* createGeneralTab();
|
|
|
|
|
QWidget* createAppearanceTab();
|
2026-08-28 02:27:46 +02:00
|
|
|
QWidget* createPreferencesTab(); // New: Preferences tab
|
2026-08-24 10:29:13 +02:00
|
|
|
QWidget* createCategoriesTab();
|
|
|
|
|
QWidget* createRulesTab();
|
|
|
|
|
QWidget* createTemplatesTab();
|
|
|
|
|
QWidget* createSignaturesTab();
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Category helpers
|
|
|
|
|
void loadCategories();
|
|
|
|
|
void refreshCategoryTree();
|
|
|
|
|
QTreeWidgetItem* createCategoryTreeItem(const Category &cat, QTreeWidgetItem *parent = nullptr);
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Rule helpers
|
|
|
|
|
void loadRules();
|
|
|
|
|
QString ruleToString(const Rule &rule) const;
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Template helpers
|
|
|
|
|
void loadTemplates();
|
|
|
|
|
QString templateToString(const Template &tmpl) const;
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Signature helpers
|
|
|
|
|
void loadSignatures();
|
|
|
|
|
QString signatureToString(const Signature &sig) const;
|
2026-06-17 22:44:27 +02:00
|
|
|
|
|
|
|
|
QTabWidget *m_tabWidget;
|
|
|
|
|
QListWidget *m_accountList;
|
|
|
|
|
QComboBox *m_syncIntervalCombo;
|
|
|
|
|
QButtonGroup *m_themeGroup;
|
2026-07-05 10:45:44 +02:00
|
|
|
QPushButton *m_editBtn;
|
|
|
|
|
QPushButton *m_addBtn;
|
|
|
|
|
QPushButton *m_deleteBtn;
|
|
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Categories
|
|
|
|
|
QTreeWidget *m_categoryTree;
|
|
|
|
|
QPushButton *m_categoryAddBtn;
|
|
|
|
|
QPushButton *m_categoryEditBtn;
|
|
|
|
|
QPushButton *m_categoryDeleteBtn;
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Rules
|
|
|
|
|
QListWidget *m_ruleList;
|
|
|
|
|
QPushButton *m_ruleAddBtn;
|
|
|
|
|
QPushButton *m_ruleEditBtn;
|
|
|
|
|
QPushButton *m_ruleDeleteBtn;
|
|
|
|
|
QPushButton *m_ruleToggleBtn;
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Templates
|
|
|
|
|
QListWidget *m_templateList;
|
|
|
|
|
QPushButton *m_templateAddBtn;
|
|
|
|
|
QPushButton *m_templateEditBtn;
|
|
|
|
|
QPushButton *m_templateDeleteBtn;
|
2026-08-28 07:51:39 +02:00
|
|
|
|
2026-08-24 10:29:13 +02:00
|
|
|
// Signatures
|
|
|
|
|
QListWidget *m_signatureList;
|
|
|
|
|
QPushButton *m_signatureAddBtn;
|
|
|
|
|
QPushButton *m_signatureEditBtn;
|
|
|
|
|
QPushButton *m_signatureDeleteBtn;
|
2026-08-28 02:27:46 +02:00
|
|
|
|
|
|
|
|
// Services
|
|
|
|
|
AccountService *m_accountService = nullptr;
|
|
|
|
|
PreferencesService *m_preferencesService = nullptr;
|
|
|
|
|
StartupBehaviorService *m_startupBehaviorService = nullptr;
|
|
|
|
|
TranslationService *m_translationService = nullptr;
|
|
|
|
|
AiActionOptionsService *m_aiActionOptionsService = nullptr;
|
|
|
|
|
|
|
|
|
|
// Preferences tab controls
|
|
|
|
|
QComboBox *m_searchModeCombo = nullptr;
|
|
|
|
|
QComboBox *m_defaultAppModeCombo = nullptr;
|
|
|
|
|
QComboBox *m_languageCombo = nullptr;
|
|
|
|
|
QSpinBox *m_syncIntervalSpin = nullptr;
|
|
|
|
|
QCheckBox *m_startOnLoginCheck = nullptr;
|
|
|
|
|
QCheckBox *m_minimizeToTrayCheck = nullptr;
|
|
|
|
|
QCheckBox *m_enableNotificationsCheck = nullptr;
|
|
|
|
|
QComboBox *m_translateLanguageCombo = nullptr;
|
|
|
|
|
QComboBox *m_summarizeLanguageCombo = nullptr;
|
|
|
|
|
QLineEdit *m_summarySavePathEdit = nullptr;
|
|
|
|
|
QPushButton *m_summarySavePathBtn = nullptr;
|
|
|
|
|
|
|
|
|
|
int m_selectedAccountId = -1;
|
2026-06-17 22:44:27 +02:00
|
|
|
};
|