Delete pre-3.0.0 hotkey migrations

This commit is contained in:
Thomas Goyne 2013-06-08 18:17:53 -07:00
parent f21a72992b
commit 6c08f53d1b

View file

@ -29,24 +29,6 @@
#include <libaegisub/path.h>
namespace {
const char *removed_commands_6294[] = {
"edit/line/swap",
"grid/swap/up",
"grid/swap/down",
"time/sort/end",
"time/sort/start",
"time/sort/style",
0
};
const char *added_hotkeys_6294[][4] = {
{ "grid/move/down", "Default", "Alt", "Down" },
{ "grid/move/up", "Default", "Alt", "Up" },
{ "grid/line/next/create", "Subtitle Edit Box", "Enter", 0 },
{ "grid/line/next/create", "Subtitle Edit Box", "KP_Enter", 0 },
{ 0 }
};
const char *removed_commands_7035[] = { 0 };
const char *added_hotkeys_7035[][4] = {
{ "audio/play/line", "Audio", "R", 0 },
@ -81,42 +63,6 @@ namespace {
hotkey::inst->SetHotkeyMap(hk_map);
}
const char *renamed_commands[][2] = {
{ "timing shift start backward", "time/start/decrease" },
{ "timing shift start forward", "time/start/increase" },
{ "timing shift end backward", "time/length/decrease" },
{ "timing shift end forward", "time/length/increase" },
{ "timing karaoke decrease length" , "time/length/decrease" },
{ "timing karaoke increase length" , "time/length/increase" },
{ "timing karaoke decrease length and shift following" , "time/length/decrease/shift" },
{ "timing karaoke increase length and shift following" , "time/length/increase/shift" },
{ 0, 0}
};
void rename_commands() {
std::map<std::string, const char *> name_map;
for (size_t i = 0; renamed_commands[i][0]; ++i)
name_map[renamed_commands[i][0]] = renamed_commands[i][1];
bool renamed_any = false;
auto hk_map = hotkey::inst->GetHotkeyMap();
for (auto it = hk_map.begin(); it != hk_map.end(); ) {
auto ren = name_map.find(it->first);
if (ren != name_map.end()) {
hk_map.insert(make_pair(std::string(ren->second),
agi::hotkey::Combo(it->second.Context(), ren->second, it->second.Get())));
hk_map.erase(it++);
renamed_any = true;
}
else
++it;
}
if (renamed_any)
hotkey::inst->SetHotkeyMap(hk_map);
}
}
namespace hotkey {
@ -128,10 +74,6 @@ void init() {
GET_DEFAULT_CONFIG(default_hotkey));
int last_version = OPT_GET("Version/Last Version")->GetInt();
if (last_version < 6294)
migrate_hotkeys(removed_commands_6294, added_hotkeys_6294);
if (last_version < 6933)
rename_commands();
if (last_version < 7035)
migrate_hotkeys(removed_commands_7035, added_hotkeys_7035);
if (last_version < 7070)