plugin code
[lbook_fbreader.git] / fbreader / src / migration / Migration_0_8_13.cpp
blob3f77f7a6401285f641e99bfa1147940df033def7
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 <vector>
22 #include <ZLStringUtil.h>
24 #include "Migration.h"
26 Migration_0_8_13::Migration_0_8_13() : Migration("0.8.13") {
29 void Migration_0_8_13::doMigrationInternal() {
30 std::vector<std::string> optionNames;
31 ZLOption::listOptionNames("Style", optionNames);
32 for (std::vector<std::string>::const_iterator it = optionNames.begin(); it != optionNames.end(); ++it) {
33 if (ZLStringUtil::stringEndsWith(*it, ":lineSpacing") ||
34 ZLStringUtil::stringEndsWith(*it, ":lineSpace")) {
35 ZLDoubleOption doubleOption(ZLCategoryKey::LOOK_AND_FEEL, "Style", *it, 0.0);
36 ZLIntegerOption intOption(ZLCategoryKey::LOOK_AND_FEEL, "Style", *it + "Percent", -1);
37 const double doubleValue = doubleOption.value();
38 const int intValue = intOption.value();
39 doubleOption.setValue((intValue == -1) ? 0.0 : (intValue / 100.0));
40 intOption.setValue((int)(doubleValue * 100));