settings_dialog.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @file settings_dialog.h
  3. * @brief 设置对话框 - 应用程序设置界面
  4. *
  5. * 功能:
  6. * - 守护进程模式设置
  7. * - 其他应用程序设置
  8. */
  9. #ifndef SETTINGS_DIALOG_H
  10. #define SETTINGS_DIALOG_H
  11. #include <QDialog>
  12. class QCheckBox;
  13. class QLabel;
  14. class QPushButton;
  15. class QVBoxLayout;
  16. class QHBoxLayout;
  17. class QGroupBox;
  18. class DaemonClient;
  19. /**
  20. * @brief 设置对话框
  21. */
  22. class SettingsDialog : public QDialog
  23. {
  24. Q_OBJECT
  25. public:
  26. explicit SettingsDialog(QWidget *parent = nullptr);
  27. ~SettingsDialog();
  28. /**
  29. * @brief 获取是否使用守护进程模式
  30. */
  31. bool useDaemonMode() const;
  32. /**
  33. * @brief 设置是否使用守护进程模式
  34. */
  35. void setUseDaemonMode(bool use);
  36. /**
  37. * @brief 设置守护进程客户端(用于检查守护进程状态)
  38. */
  39. void setDaemonClient(DaemonClient* daemonClient);
  40. /**
  41. * @brief 加载设置
  42. */
  43. void loadSettings();
  44. /**
  45. * @brief 保存设置
  46. */
  47. void saveSettings();
  48. private slots:
  49. void onApply();
  50. void onOk();
  51. void onCancel();
  52. void onDaemonModeChanged(bool enabled);
  53. private:
  54. void createUI();
  55. void updateDaemonStatus();
  56. // UI 组件
  57. QGroupBox *m_daemonGroupBox;
  58. QCheckBox *m_useDaemonCheckBox;
  59. QLabel *m_daemonStatusLabel;
  60. QLabel *m_daemonInfoLabel;
  61. QPushButton *m_applyButton;
  62. QPushButton *m_okButton;
  63. QPushButton *m_cancelButton;
  64. QVBoxLayout *m_mainLayout;
  65. QHBoxLayout *m_buttonLayout;
  66. // 设置值
  67. bool m_useDaemonMode;
  68. // 守护进程客户端(用于检查状态)
  69. DaemonClient* m_daemonClient;
  70. };
  71. #endif // SETTINGS_DIALOG_H