plugin code
[lbook_fbreader.git] / fbreader / src / migration / Migration_0_8_11.cpp
blob53569e695d6700e08af8e848295cbf4af2fc565a
1 /*
2 * Copyright (C) 2008 Geometer Plus <contact@geometerplus.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
20 #include <map>
22 #include <ZLStringUtil.h>
24 #include "Migration.h"
26 static void changeActionNames(const std::map<std::string,std::string> map, const std::string &group) {
27 const int length = ZLIntegerOption(ZLCategoryKey::CONFIG, group, "Number", 0).value();
28 for (int i = 0; i < length; ++i) {
29 std::string optionName = "Action";
30 ZLStringUtil::appendNumber(optionName, i);
31 ZLStringOption option(ZLCategoryKey::CONFIG, group, optionName, "");
32 std::string value = option.value();
33 std::map<std::string,std::string>::const_iterator it = map.find(value);
34 if (it != map.end()) {
35 option.setValue(it->second);
40 static void changeActionNames() {
41 std::map<std::string,std::string> oldToNewNames;
42 oldToNewNames["0"] = "none";
43 oldToNewNames["1"] = "showLibrary";
44 oldToNewNames["28"] = "showRecent";
45 oldToNewNames["30"] = "previousBook";
46 oldToNewNames["5"] = "toc";
47 oldToNewNames["15"] = "gotoHome";
48 oldToNewNames["16"] = "gotoSectionStart";
49 oldToNewNames["17"] = "gotoSectionEnd";
50 oldToNewNames["33"] = "nextTOCSection";
51 oldToNewNames["34"] = "previousTOCSection";
52 oldToNewNames["9"] = "largeScrollForward";
53 oldToNewNames["10"] = "largeScrollBackward";
54 oldToNewNames["11"] = "smallScrollForward";
55 oldToNewNames["12"] = "smallScrollBackward";
56 oldToNewNames["3"] = "undo";
57 oldToNewNames["4"] = "redo";
58 oldToNewNames["35"] = "copyToClipboard";
59 oldToNewNames["37"] = "openInDictionary";
60 oldToNewNames["36"] = "clearSelection";
61 oldToNewNames["6"] = "search";
62 oldToNewNames["7"] = "findPrevious";
63 oldToNewNames["8"] = "findNext";
64 oldToNewNames["19"] = "increaseFont";
65 oldToNewNames["20"] = "decreaseFont";
66 oldToNewNames["21"] = "toggleIndicator";
67 oldToNewNames["22"] = "toggleFullscreen";
68 oldToNewNames["23"] = "onFullscreen";
69 oldToNewNames["27"] = "rotate";
70 oldToNewNames["2"] = "preferences";
71 oldToNewNames["25"] = "bookInfo";
72 oldToNewNames["24"] = "addBook";
73 oldToNewNames["18"] = "cancel";
74 oldToNewNames["29"] = "quit";
76 changeActionNames(oldToNewNames, "Keys");
77 changeActionNames(oldToNewNames, "Keys90");
78 changeActionNames(oldToNewNames, "Keys180");
79 changeActionNames(oldToNewNames, "Keys270");
82 Migration_0_8_11::Migration_0_8_11() : Migration("0.8.11") {
85 void Migration_0_8_11::doMigrationInternal() {
86 moveOption(
87 ZLCategoryKey::CONFIG, "FingerTapScrolling", "ScrollingDelay",
88 ZLCategoryKey::CONFIG, "TapScrolling", "ScrollingDelay",
89 "0"
91 moveOption(
92 ZLCategoryKey::CONFIG, "FingerTapScrolling", "Mode",
93 ZLCategoryKey::CONFIG, "TapScrolling", "Mode",
94 "0"
96 moveOption(
97 ZLCategoryKey::CONFIG, "FingerTapScrolling", "LinesToKeep",
98 ZLCategoryKey::CONFIG, "TapScrolling", "LinesToKeep",
99 "1"
101 moveOption(
102 ZLCategoryKey::CONFIG, "FingerTapScrolling", "LinesToScroll",
103 ZLCategoryKey::CONFIG, "TapScrolling", "LinesToScroll",
104 "1"
106 moveOption(
107 ZLCategoryKey::CONFIG, "FingerTapScrolling", "PercentToScroll",
108 ZLCategoryKey::CONFIG, "TapScrolling", "PercentToScroll",
109 "50"
111 moveOption(
112 ZLCategoryKey::CONFIG, "FingerTapScrolling", "Enabled",
113 ZLCategoryKey::CONFIG, "TapScrolling", "Enabled",
114 "true"
116 moveOption(
117 ZLCategoryKey::CONFIG, "Options", "ScrollingDelay",
118 ZLCategoryKey::CONFIG, "LargeScrolling", "ScrollingDelay",
119 "250"
121 changeActionNames();