#include <settings_plugin.h>
Definition at line 25 of file settings_plugin.h.
◆ PlatformBrightness
◆ SettingsPlugin()
Definition at line 57 of file settings_plugin.cc.
59 : channel_(std::make_unique<BasicMessageChannel<rapidjson::Document>>(
60 messenger,
63 task_runner_(task_runner) {}
static const JsonMessageCodec & GetInstance()
◆ ~SettingsPlugin()
flutter::SettingsPlugin::~SettingsPlugin |
( |
| ) |
|
|
virtual |
◆ GetAlwaysUse24HourFormat()
bool flutter::SettingsPlugin::GetAlwaysUse24HourFormat |
( |
| ) |
|
|
protectedvirtual |
Definition at line 112 of file settings_plugin.cc.
112 {
114}
std::wstring GetUserTimeFormat()
bool Prefer24HourTime(std::wstring time_format)
◆ GetPreferredBrightness()
Definition at line 131 of file settings_plugin.cc.
131 {
133 DWORD window_color = GetSysColor(COLOR_WINDOW);
134 int luminance = GetLuminance(window_color);
137 } else {
138 return GetThemeBrightness();
139 }
140}
◆ GetTextScaleFactor()
float flutter::SettingsPlugin::GetTextScaleFactor |
( |
| ) |
|
|
protectedvirtual |
Definition at line 116 of file settings_plugin.cc.
116 {
117 DWORD text_scale_factor;
118 DWORD text_scale_factor_size =
sizeof(text_scale_factor);
121 RRF_RT_REG_DWORD, nullptr, &text_scale_factor, &text_scale_factor_size);
122
124 return text_scale_factor / 100.0;
125 } else {
126
127 return 1.0;
128 }
129}
#define HKEY_CURRENT_USER
◆ SendSettings()
void flutter::SettingsPlugin::SendSettings |
( |
| ) |
|
Definition at line 69 of file settings_plugin.cc.
69 {
70 rapidjson::Document
settings(rapidjson::kObjectType);
71 auto& allocator =
settings.GetAllocator();
73 allocator);
75
78 } else {
80 allocator);
81 }
83}
virtual bool GetAlwaysUse24HourFormat()
virtual PlatformBrightness GetPreferredBrightness()
virtual float GetTextScaleFactor()
static constexpr char kPlatformBrightnessLight[]
static constexpr char kPlatformBrightnessDark[]
◆ StartWatching()
void flutter::SettingsPlugin::StartWatching |
( |
| ) |
|
|
virtual |
Definition at line 85 of file settings_plugin.cc.
85 {
87 RRF_RT_REG_DWORD,
KEY_NOTIFY, &preferred_brightness_reg_hkey_);
90
91
92 if (preferred_brightness_reg_hkey_ != nullptr) {
94 }
95 if (text_scale_factor_reg_hkey_ != nullptr) {
97 }
98}
virtual void WatchPreferredBrightnessChanged()
virtual void WatchTextScaleFactorChanged()
◆ StopWatching()
void flutter::SettingsPlugin::StopWatching |
( |
| ) |
|
|
virtual |
Definition at line 100 of file settings_plugin.cc.
100 {
101 preferred_brightness_changed_watcher_ = nullptr;
102 text_scale_factor_changed_watcher_ = nullptr;
103
104 if (preferred_brightness_reg_hkey_ != nullptr) {
105 RegCloseKey(preferred_brightness_reg_hkey_);
106 }
107 if (text_scale_factor_reg_hkey_ != nullptr) {
108 RegCloseKey(text_scale_factor_reg_hkey_);
109 }
110}
◆ UpdateHighContrastMode()
void flutter::SettingsPlugin::UpdateHighContrastMode |
( |
bool |
is_high_contrast | ) |
|
|
virtual |
◆ WatchPreferredBrightnessChanged()
void flutter::SettingsPlugin::WatchPreferredBrightnessChanged |
( |
| ) |
|
|
protectedvirtual |
Definition at line 142 of file settings_plugin.cc.
142 {
143 preferred_brightness_changed_watcher_ =
144 std::make_unique<EventWatcher>([this]() {
148 });
149 });
150
151 RegNotifyChangeKeyValue(
152 preferred_brightness_reg_hkey_,
FALSE, REG_NOTIFY_CHANGE_LAST_SET,
153 preferred_brightness_changed_watcher_->GetHandle(),
TRUE);
154}
void PostTask(TaskClosure task)
◆ WatchTextScaleFactorChanged()
void flutter::SettingsPlugin::WatchTextScaleFactorChanged |
( |
| ) |
|
|
protectedvirtual |
Definition at line 156 of file settings_plugin.cc.
156 {
157 text_scale_factor_changed_watcher_ = std::make_unique<EventWatcher>([this]() {
161 });
162 });
163
164 RegNotifyChangeKeyValue(
165 text_scale_factor_reg_hkey_,
FALSE, REG_NOTIFY_CHANGE_LAST_SET,
166 text_scale_factor_changed_watcher_->GetHandle(),
TRUE);
167}
◆ is_high_contrast_
bool flutter::SettingsPlugin::is_high_contrast_ = false |
|
protected |
The documentation for this class was generated from the following files: