Input settings WIP
This commit is contained in:
@@ -14,10 +14,13 @@ SettingsWindow::SettingsWindow() : QWidget(nullptr) {
|
||||
|
||||
cpuSettings = new CPUSettings(settings);
|
||||
audioSettings = new AudioSettings(settings);
|
||||
inputSettings = new InputSettings(settings);
|
||||
keyMap = inputSettings->GetMappedKeys();
|
||||
|
||||
auto* tabs = new QTabWidget;
|
||||
tabs->addTab(cpuSettings, tr("CPU"));
|
||||
tabs->addTab(audioSettings, tr("Audio"));
|
||||
tabs->addTab(inputSettings, tr("Input"));
|
||||
|
||||
apply->setEnabled(false);
|
||||
|
||||
@@ -29,7 +32,16 @@ SettingsWindow::SettingsWindow() : QWidget(nullptr) {
|
||||
apply->setEnabled(true);
|
||||
});
|
||||
|
||||
connect(inputSettings, &InputSettings::modified, this, [&]() {
|
||||
apply->setEnabled(true);
|
||||
});
|
||||
|
||||
connect(apply, &QPushButton::pressed, this, [&]() {
|
||||
auto newMap = inputSettings->GetMappedKeys();
|
||||
if (!std::equal(keyMap.begin(), keyMap.end(), newMap.begin(), newMap.end())) {
|
||||
keyMap = newMap;
|
||||
emit regrabKeyboard();
|
||||
}
|
||||
apply->setEnabled(false);
|
||||
std::ofstream file("resources/settings.json");
|
||||
file << settings;
|
||||
|
||||
Reference in New Issue
Block a user