mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
KeyboardSettings: Add icons
A calculator isn't the ideal icon for the Num-lock section, so hopefully someone will produce a better one later.
This commit is contained in:
parent
c6099eca5c
commit
dc3fa1c2e5
2 changed files with 58 additions and 25 deletions
|
@ -10,46 +10,66 @@
|
||||||
title: "Mapping"
|
title: "Mapping"
|
||||||
fixed_height: 200
|
fixed_height: 200
|
||||||
|
|
||||||
layout: @GUI::VerticalBoxLayout {
|
layout: @GUI::HorizontalBoxLayout {
|
||||||
margins: [16, 8, 8]
|
margins: [16, 8, 8]
|
||||||
spacing: 2
|
spacing: 16
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::Widget {
|
@GUI::Widget {
|
||||||
layout: @GUI::HorizontalBoxLayout {
|
fixed_width: 32
|
||||||
spacing: 16
|
layout: @GUI::VerticalBoxLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::Label {
|
@GUI::Label {
|
||||||
text: "Character mapping file:"
|
fixed_width: 32
|
||||||
fixed_width: 130
|
fixed_height: 32
|
||||||
text_alignment: "CenterLeft"
|
name: "character_map_image_label"
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::ComboBox {
|
@GUI::Widget
|
||||||
name: "character_map_file_combo"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::Widget {
|
@GUI::Widget {
|
||||||
layout: @GUI::HorizontalBoxLayout {
|
layout: @GUI::VerticalBoxLayout {
|
||||||
spacing: 16
|
spacing: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::Label {
|
@GUI::Widget {
|
||||||
text: "Test your current keymap below"
|
layout: @GUI::HorizontalBoxLayout {
|
||||||
text_alignment: "CenterLeft"
|
spacing: 16
|
||||||
}
|
}
|
||||||
@GUI::Button {
|
|
||||||
text: "Clear"
|
|
||||||
name: "button_clear_test_typing_area"
|
|
||||||
fixed_width: 48
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GUI::TextEditor {
|
@GUI::Label {
|
||||||
fixed_height: 100
|
text: "Character mapping file:"
|
||||||
name: "test_typing_area"
|
fixed_width: 130
|
||||||
|
text_alignment: "CenterLeft"
|
||||||
|
}
|
||||||
|
|
||||||
|
@GUI::ComboBox {
|
||||||
|
name: "character_map_file_combo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GUI::Widget {
|
||||||
|
layout: @GUI::HorizontalBoxLayout {
|
||||||
|
spacing: 16
|
||||||
|
}
|
||||||
|
|
||||||
|
@GUI::Label {
|
||||||
|
text: "Test your current keymap below"
|
||||||
|
text_alignment: "CenterLeft"
|
||||||
|
}
|
||||||
|
@GUI::Button {
|
||||||
|
text: "Clear"
|
||||||
|
name: "button_clear_test_typing_area"
|
||||||
|
fixed_width: 48
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GUI::TextEditor {
|
||||||
|
fixed_height: 100
|
||||||
|
name: "test_typing_area"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +79,13 @@
|
||||||
|
|
||||||
layout: @GUI::HorizontalBoxLayout {
|
layout: @GUI::HorizontalBoxLayout {
|
||||||
margins: [16, 8, 8]
|
margins: [16, 8, 8]
|
||||||
|
spacing: 16
|
||||||
|
}
|
||||||
|
|
||||||
|
@GUI::Label {
|
||||||
|
fixed_width: 32
|
||||||
|
fixed_height: 32
|
||||||
|
name: "num_lock_image_label"
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::CheckBox {
|
@GUI::CheckBox {
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/ItemListModel.h>
|
#include <LibGUI/ItemListModel.h>
|
||||||
|
#include <LibGUI/Label.h>
|
||||||
#include <LibGUI/MessageBox.h>
|
#include <LibGUI/MessageBox.h>
|
||||||
#include <LibKeyboard/CharacterMap.h>
|
#include <LibKeyboard/CharacterMap.h>
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
|
@ -51,6 +52,9 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
|
||||||
}
|
}
|
||||||
VERIFY(initial_keymap_index < m_character_map_files.size());
|
VERIFY(initial_keymap_index < m_character_map_files.size());
|
||||||
|
|
||||||
|
auto& character_map_image_label = *find_descendant_of_type_named<GUI::Label>("character_map_image_label");
|
||||||
|
character_map_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-keyboard-mapper.png").release_value_but_fixme_should_propagate_errors());
|
||||||
|
|
||||||
m_character_map_file_combo = find_descendant_of_type_named<GUI::ComboBox>("character_map_file_combo");
|
m_character_map_file_combo = find_descendant_of_type_named<GUI::ComboBox>("character_map_file_combo");
|
||||||
m_character_map_file_combo->set_only_allow_values_from_model(true);
|
m_character_map_file_combo->set_only_allow_values_from_model(true);
|
||||||
m_character_map_file_combo->set_model(*GUI::ItemListModel<String>::create(m_character_map_files));
|
m_character_map_file_combo->set_model(*GUI::ItemListModel<String>::create(m_character_map_files));
|
||||||
|
@ -69,6 +73,8 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
|
||||||
m_test_typing_area->set_focus(true);
|
m_test_typing_area->set_focus(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto& num_lock_image_label = *find_descendant_of_type_named<GUI::Label>("num_lock_image_label");
|
||||||
|
num_lock_image_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-calculator.png").release_value_but_fixme_should_propagate_errors());
|
||||||
m_num_lock_checkbox = find_descendant_of_type_named<GUI::CheckBox>("num_lock_checkbox");
|
m_num_lock_checkbox = find_descendant_of_type_named<GUI::CheckBox>("num_lock_checkbox");
|
||||||
m_num_lock_checkbox->set_checked(Config::read_bool("KeyboardSettings", "StartupEnable", "NumLock", true));
|
m_num_lock_checkbox->set_checked(Config::read_bool("KeyboardSettings", "StartupEnable", "NumLock", true));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue