mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00

Extract the creation of map-selection radio buttons from create_frame into the new private method add_map_radio_button(map_name, button_text) turning 24 lines into 4 + 6 lines. This makes create_frame a little easier to read. :^)
43 lines
1 KiB
C++
43 lines
1 KiB
C++
/*
|
||
* Copyright (c) 2020, Hüseyin Aslıtürk <asliturk@hotmail.com>
|
||
*
|
||
* SPDX-License-Identifier: BSD-2-Clause
|
||
*/
|
||
|
||
#pragma once
|
||
|
||
#include "KeyButton.h"
|
||
#include <LibGUI/Button.h>
|
||
#include <LibKeyboard/CharacterMapData.h>
|
||
|
||
class KeyboardMapperWidget final : public GUI::Widget {
|
||
C_OBJECT(KeyboardMapperWidget)
|
||
|
||
public:
|
||
virtual ~KeyboardMapperWidget() override;
|
||
|
||
void create_frame();
|
||
void load_from_file(const String);
|
||
void load_from_system();
|
||
void save();
|
||
void save_to_file(StringView);
|
||
|
||
protected:
|
||
virtual void keydown_event(GUI::KeyEvent&) override;
|
||
virtual void keyup_event(GUI::KeyEvent&) override;
|
||
|
||
void set_current_map(const String);
|
||
void update_window_title();
|
||
|
||
private:
|
||
KeyboardMapperWidget();
|
||
|
||
Vector<KeyButton*> m_keys;
|
||
RefPtr<GUI::Widget> m_map_group;
|
||
void add_map_radio_button(const StringView map_name, const StringView button_text);
|
||
|
||
String m_filename;
|
||
Keyboard::CharacterMapData m_character_map;
|
||
String m_current_map_name;
|
||
bool m_modified { false };
|
||
};
|