10#ifndef PREFERENCESDIALOG_H
11#define PREFERENCESDIALOG_H
21#include <QStackedWidget>
30enum class Theme { Dark, Light };
40 Theme theme = Theme::Dark;
41 int editorFontSize = 11;
45 bool showLineNumbers =
true;
46 bool wordWrap =
false;
49 bool restoreLastFile =
false;
60class PreferencesDialog :
public QDialog {
64 explicit PreferencesDialog(
const Preferences& current,
65 QWidget* parent =
nullptr);
66 ~PreferencesDialog()
override =
default;
90 void onCategoryChanged(
int currentRow);
92 void onRestoreDefaults();
96 QWidget* createAppearancePage();
97 QWidget* createEditorPage();
98 QWidget* createGeneralPage();
99 void applyDialogStyle();
100 void populateFromPreferences(
const Preferences& prefs);
103 QListWidget* categoryList =
nullptr;
104 QStackedWidget* pages =
nullptr;
107 QComboBox* themeCombo =
nullptr;
108 QSpinBox* fontSizeSpin =
nullptr;
111 QComboBox* tabWidthCombo =
nullptr;
112 QCheckBox* lineNumbersCheck =
nullptr;
113 QCheckBox* wordWrapCheck =
nullptr;
116 QCheckBox* restoreLastFileCheck =
nullptr;
118 QPushButton* okButton =
nullptr;
119 QPushButton* cancelButton =
nullptr;
120 QPushButton* defaultsButton =
nullptr;
Preferences result() const
Returns the (possibly modified) preferences after the dialog is accepted.
Definition preferencesDialog.cpp:43
static Preferences load()
Load preferences from QSettings.
Definition preferencesDialog.cpp:65
static void save(const Preferences &prefs)
Save preferences to QSettings.
Definition preferencesDialog.cpp:89
void preferencesChanged(const nsbaci::ui::Preferences &prefs)
Emitted when the user accepts the dialog with changed preferences.
User interface namespace for nsbaci.
Definition drawingWidget.cpp:18
Theme
Enumerates the available application themes.
Definition preferencesDialog.h:30
Holds all user-configurable preferences.
Definition preferencesDialog.h:38