mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
Keymapper: support for saving to config file enabled
svn-id: r33850
This commit is contained in:
parent
70dde2d8bd
commit
5ca906fbd7
@ -96,6 +96,7 @@ public:
|
||||
|
||||
void addEvent(const Event &evt) { events.push_back(evt); }
|
||||
void setParent(Keymap *parent);
|
||||
Keymap *getParent() { return _parent; }
|
||||
void mapKey(const HardwareKey *key);
|
||||
const HardwareKey *getMappedKey() const;
|
||||
|
||||
|
@ -37,10 +37,8 @@ void KeymapManager::Domain::addKeymap(Keymap *map) {
|
||||
|
||||
void KeymapManager::Domain::deleteAllKeyMaps() {
|
||||
KeymapMap::iterator it;
|
||||
for (it = _keymaps.begin(); it != _keymaps.end(); it++) {
|
||||
//it->_value->saveMappings(_configDomain, it->_key);
|
||||
for (it = _keymaps.begin(); it != _keymaps.end(); it++)
|
||||
delete it->_value;
|
||||
}
|
||||
_keymaps.clear();
|
||||
}
|
||||
|
||||
@ -88,8 +86,11 @@ void KeymapManager::registerGameKeymap(Keymap *map) {
|
||||
void KeymapManager::initKeymap(ConfigManager::Domain *domain,
|
||||
Keymap *map) {
|
||||
map->loadMappings(domain, _hardwareKeys);
|
||||
if (map->isComplete(_hardwareKeys) == false)
|
||||
if (map->isComplete(_hardwareKeys) == false) {
|
||||
automaticMap(map);
|
||||
map->saveMappings(domain);
|
||||
ConfMan.flushToDisk();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO:
|
||||
@ -202,7 +203,7 @@ void KeymapManager::automaticMap(Keymap *map) {
|
||||
act->mapKey(*selectedKey);
|
||||
keys.erase(selectedKey);
|
||||
} else {// no match = no keys left
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +91,7 @@ public:
|
||||
/**
|
||||
* Save this keymap's mappings to the given config domain
|
||||
* @param domain config domain to save keymap to
|
||||
* @note Changes are *not* flushed to disk, to do so call ConfMan.flushToDisk()
|
||||
*/
|
||||
void saveMappings(ConfigManager::Domain *domain);
|
||||
|
||||
|
@ -37,9 +37,6 @@ enum {
|
||||
RemapDialog::RemapDialog()
|
||||
: Dialog("remap"), _keymapTable(0), _activeRemapAction(0), _topAction(0), _remapTimeout(0) {
|
||||
|
||||
const int screenW = g_system->getOverlayWidth();
|
||||
const int screenH = g_system->getOverlayHeight();
|
||||
|
||||
_keymapper = g_system->getEventManager()->getKeymapper();
|
||||
assert(_keymapper);
|
||||
|
||||
@ -95,10 +92,11 @@ void RemapDialog::open() {
|
||||
}
|
||||
}
|
||||
|
||||
Dialog::open();
|
||||
|
||||
_changes = false;
|
||||
_kmPopUp->setSelected(0);
|
||||
loadKeymap();
|
||||
|
||||
Dialog::open();
|
||||
}
|
||||
|
||||
void RemapDialog::close() {
|
||||
@ -107,6 +105,7 @@ void RemapDialog::close() {
|
||||
free(_keymapTable);
|
||||
_keymapTable = 0;
|
||||
}
|
||||
if (_changes) ConfMan.flushToDisk();
|
||||
Dialog::close();
|
||||
}
|
||||
|
||||
@ -203,6 +202,8 @@ void RemapDialog::handleKeyUp(Common::KeyState state) {
|
||||
const HardwareKey *hwkey = _keymapper->getHardwareKey(state);
|
||||
if (hwkey) {
|
||||
_activeRemapAction->mapKey(hwkey);
|
||||
// TODO: _activeRemapAction->getParent()->saveMappings();
|
||||
_changes = true;
|
||||
stopRemapping();
|
||||
}
|
||||
} else {
|
||||
@ -285,7 +286,6 @@ void RemapDialog::refreshKeymap() {
|
||||
//_container->draw();
|
||||
_scrollBar->draw();
|
||||
|
||||
uint widgetI = 0;
|
||||
uint actionI = _topAction;
|
||||
for (uint widgetI = 0; widgetI < _keymapWidgets.size(); widgetI++) {
|
||||
ActionWidgets& widg = _keymapWidgets[widgetI];
|
||||
|
@ -83,6 +83,8 @@ protected:
|
||||
uint32 _remapTimeout;
|
||||
static const uint32 kRemapTimeoutDelay = 3000;
|
||||
|
||||
bool _changes;
|
||||
|
||||
};
|
||||
|
||||
} // end of namespace Common
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user