First pass at custom app-settings support (#1381)

* First draft of custom app settings support.

* WIP new settings

* Working per-app custom settings

* Revert design to use "bound settings"
This commit is contained in:
Kyle Reed 2023-08-18 12:35:41 -07:00 committed by GitHub
parent a4636d7872
commit 63f99742fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 269 additions and 43 deletions

View file

@ -32,6 +32,7 @@
#include "ui_styles.hpp"
#include "ui_widget.hpp"
#include "app_settings.hpp"
#include "file_wrapper.hpp"
#include "optional.hpp"
@ -80,7 +81,10 @@ class TextViewer : public Widget {
const Style& style() { return *font_style; }
void set_font_zoom(bool zoom);
void toggle_font_zoom() { set_font_zoom(!font_zoom); };
bool toggle_font_zoom() {
set_font_zoom(!font_zoom);
return font_zoom;
};
private:
bool font_zoom{};
@ -220,6 +224,12 @@ class TextEditorView : public View {
void on_show() override;
private:
// Settings
bool enable_zoom = false;
SettingsStore settings_store_{
"notepad",
{{"enable_zoom", &enable_zoom}}};
static constexpr size_t max_edit_length = 1024;
std::string edit_line_buffer_{};