2020-06-02 20:59:30 +03:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Hüseyin Aslıtürk <asliturk@hotmail.com>
|
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-02 20:59:30 +03:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "KeyButton.h"
|
|
|
|
|
#include <LibGUI/Button.h>
|
|
|
|
|
#include <LibKeyboard/CharacterMapData.h>
|
|
|
|
|
|
2021-11-01 01:38:04 +03:00
|
|
|
|
class KeyboardMapperWidget final : public GUI::Widget {
|
2020-06-02 20:59:30 +03:00
|
|
|
|
C_OBJECT(KeyboardMapperWidget)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual ~KeyboardMapperWidget() override;
|
|
|
|
|
|
|
|
|
|
void create_frame();
|
|
|
|
|
void load_from_file(const String);
|
2021-01-31 00:30:46 +03:00
|
|
|
|
void load_from_system();
|
2020-06-02 20:59:30 +03:00
|
|
|
|
void save();
|
2021-11-11 02:55:02 +03:00
|
|
|
|
void save_to_file(StringView);
|
2020-06-02 20:59:30 +03:00
|
|
|
|
|
|
|
|
|
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:
|
2021-11-01 01:38:04 +03:00
|
|
|
|
KeyboardMapperWidget();
|
|
|
|
|
|
2020-06-02 20:59:30 +03:00
|
|
|
|
Vector<KeyButton*> m_keys;
|
|
|
|
|
RefPtr<GUI::Widget> m_map_group;
|
2021-12-15 20:44:55 +03:00
|
|
|
|
void add_map_radio_button(const StringView map_name, const StringView button_text);
|
2021-12-15 23:58:46 +03:00
|
|
|
|
u32* map_from_name(const StringView map_name);
|
2020-06-02 20:59:30 +03:00
|
|
|
|
|
2021-04-29 22:46:15 +03:00
|
|
|
|
String m_filename;
|
2020-06-02 20:59:30 +03:00
|
|
|
|
Keyboard::CharacterMapData m_character_map;
|
|
|
|
|
String m_current_map_name;
|
|
|
|
|
bool m_modified { false };
|
|
|
|
|
};
|