c09ff382a4
To prepare for translation support, this makes all of the widgets cognizant of the language change event that occurs whenever installTranslator() is called and automatically retranslates their text where necessary. This is important as calling the backing UI's retranslateUi() is often not enough, particularly in cases where we add our own strings that aren't controlled by it. In that case we need to manually refresh the strings ourselves.
43 lines
1 KiB
C++
43 lines
1 KiB
C++
// Copyright 2017 Citra Emulator Project
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <QWidget>
|
|
|
|
namespace Ui {
|
|
class ConfigureHotkeys;
|
|
}
|
|
|
|
class HotkeyRegistry;
|
|
class QStandardItemModel;
|
|
|
|
class ConfigureHotkeys : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ConfigureHotkeys(QWidget* parent = nullptr);
|
|
~ConfigureHotkeys() override;
|
|
|
|
void ApplyConfiguration(HotkeyRegistry& registry);
|
|
|
|
/**
|
|
* Populates the hotkey list widget using data from the provided registry.
|
|
* Called everytime the Configure dialog is opened.
|
|
* @param registry The HotkeyRegistry whose data is used to populate the list.
|
|
*/
|
|
void Populate(const HotkeyRegistry& registry);
|
|
|
|
private:
|
|
void changeEvent(QEvent* event) override;
|
|
void RetranslateUI();
|
|
|
|
void Configure(QModelIndex index);
|
|
bool IsUsedKey(QKeySequence key_sequence) const;
|
|
|
|
std::unique_ptr<Ui::ConfigureHotkeys> ui;
|
|
|
|
QStandardItemModel* model;
|
|
};
|