author | smxx |
Mon, 01 Mar 2010 12:20:38 +0000 | |
changeset 2897 | 5eda7b3cc24f |
parent 2894 | d77353a57810 |
child 2915 | a02f276035e8 |
permissions | -rw-r--r-- |
1881 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
3 |
* Copyright (c) 2009 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
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. |
|
13 |
* |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
1885 | 19 |
#include <QDebug> |
1881 | 20 |
#include <QModelIndex> |
1897 | 21 |
|
1881 | 22 |
#include "ammoSchemeModel.h" |
1897 | 23 |
#include "hwconsts.h" |
1881 | 24 |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
25 |
QList<QVariant> defaultScheme = QList<QVariant>() |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
26 |
<< QVariant("Default") // name 0 |
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
27 |
<< QVariant(false) // fortsmode 1 |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
28 |
<< QVariant(false) // team divide 2 |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
29 |
<< QVariant(false) // solid land 3 |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
30 |
<< QVariant(false) // border 4 |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
31 |
<< QVariant(false) // low gravity 5 |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
32 |
<< QVariant(false) // laser sight 6 |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
33 |
<< QVariant(false) // invulnerable 7 |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
34 |
<< QVariant(true) // add mines 8 |
2017 | 35 |
<< QVariant(false) // vampiric 9 |
36 |
<< QVariant(false) // karma 10 |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
37 |
<< QVariant(false) // artillery 11 |
2703 | 38 |
<< QVariant(true) // random order 12 |
2726 | 39 |
<< QVariant(false) // king 13 |
2762
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2726
diff
changeset
|
40 |
<< QVariant(false) // place hog 14 |
2881 | 41 |
<< QVariant(false) // shared ammo 15 |
2891
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
42 |
<< QVariant(false) //disable girders 16 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
43 |
<< QVariant(100) // damage modfier 17 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
44 |
<< QVariant(45) // turn time 18 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
45 |
<< QVariant(100) // init health 19 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
46 |
<< QVariant(15) // sudden death 20 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
47 |
<< QVariant(5) // case prob 21 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
48 |
<< QVariant(3) // mines time 22 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
49 |
<< QVariant(4) // landadds 23 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
50 |
<< QVariant(0) // mine dud pct 24 |
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
51 |
; |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
52 |
|
1897 | 53 |
AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) : |
54 |
QAbstractTableModel(parent), |
|
1974 | 55 |
numberOfDefaultSchemes(4), |
1940 | 56 |
fileConfig(fileName, QSettings::IniFormat) |
1881 | 57 |
{ |
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
58 |
QStringList predefSchemesNames; |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
59 |
predefSchemesNames |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
60 |
<< "Default" |
1968 | 61 |
<< "Pro mode" |
1974 | 62 |
<< "Shoppa" |
2093
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
63 |
<< "Basketball" |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
64 |
<< "Minefield"; |
2377 | 65 |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
66 |
spNames = QStringList() |
1897 | 67 |
<< "name" // 0 |
68 |
<< "fortsmode" // 1 |
|
69 |
<< "divteams" // 2 |
|
70 |
<< "solidland" // 3 |
|
71 |
<< "border" // 4 |
|
72 |
<< "lowgrav" // 5 |
|
73 |
<< "laser" // 6 |
|
74 |
<< "invulnerability" // 7 |
|
75 |
<< "mines" // 8 |
|
2017 | 76 |
<< "vampiric" // 9 |
77 |
<< "karma" // 10 |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
78 |
<< "artillery" // 11 |
2703 | 79 |
<< "randomorder" // 12 |
2726 | 80 |
<< "king" // 13 |
2762
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2726
diff
changeset
|
81 |
<< "placehog" // 14 |
2881 | 82 |
<< "sharedammo" // 15 |
2891
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
83 |
<< "disablegirders" // 16 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
84 |
<< "damagefactor" // 17 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
85 |
<< "turntime" // 18 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
86 |
<< "health" // 19 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
87 |
<< "suddendeath" // 20 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
88 |
<< "caseprobability" // 21 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
89 |
<< "minestime" // 22 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
90 |
<< "landadds" // 23 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
91 |
<< "minedudpct" // 24 |
1897 | 92 |
; |
93 |
||
94 |
QList<QVariant> proMode; |
|
95 |
proMode |
|
1968 | 96 |
<< predefSchemesNames[1] // name 0 |
1897 | 97 |
<< QVariant(false) // fortsmode 1 |
98 |
<< QVariant(false) // team divide 2 |
|
99 |
<< QVariant(false) // solid land 3 |
|
100 |
<< QVariant(false) // border 4 |
|
101 |
<< QVariant(false) // low gravity 5 |
|
102 |
<< QVariant(false) // laser sight 6 |
|
103 |
<< QVariant(false) // invulnerable 7 |
|
104 |
<< QVariant(false) // add mines 8 |
|
2017 | 105 |
<< QVariant(false) // vampiric 9 |
106 |
<< QVariant(false) // karma 10 |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
107 |
<< QVariant(false) // artillery 11 |
2703 | 108 |
<< QVariant(true) // random order 12 |
2726 | 109 |
<< QVariant(false) // king 13 |
2762
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2726
diff
changeset
|
110 |
<< QVariant(false) // place hog 14 |
2881 | 111 |
<< QVariant(true) // shared ammo 15 |
2891
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
112 |
<< QVariant(false) //disable girders 16 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
113 |
<< QVariant(100) // damage modfier 17 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
114 |
<< QVariant(15) // turn time 18 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
115 |
<< QVariant(100) // init health 19 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
116 |
<< QVariant(15) // sudden death 20 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
117 |
<< QVariant(0) // case prob 21 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
118 |
<< QVariant(3) // mines time 22 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
119 |
<< QVariant(4) // landadds 23 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
120 |
<< QVariant(0) // mine dud pct 24 |
1897 | 121 |
; |
122 |
||
1968 | 123 |
QList<QVariant> shoppa; |
124 |
shoppa |
|
125 |
<< predefSchemesNames[2] // name 0 |
|
126 |
<< QVariant(false) // fortsmode 1 |
|
127 |
<< QVariant(false) // team divide 2 |
|
128 |
<< QVariant(true) // solid land 3 |
|
129 |
<< QVariant(true) // border 4 |
|
130 |
<< QVariant(false) // low gravity 5 |
|
131 |
<< QVariant(false) // laser sight 6 |
|
132 |
<< QVariant(false) // invulnerable 7 |
|
133 |
<< QVariant(false) // add mines 8 |
|
2017 | 134 |
<< QVariant(false) // vampiric 9 |
135 |
<< QVariant(false) // karma 10 |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
136 |
<< QVariant(false) // artillery 11 |
2703 | 137 |
<< QVariant(true) // random order 12 |
2726 | 138 |
<< QVariant(false) // king 13 |
2762
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2726
diff
changeset
|
139 |
<< QVariant(false) // place hog 14 |
2881 | 140 |
<< QVariant(true) // shared ammo 15 |
2891
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
141 |
<< QVariant(true) //disable girders 16 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
142 |
<< QVariant(100) // damage modfier 17 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
143 |
<< QVariant(30) // turn time 18 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
144 |
<< QVariant(100) // init health 19 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
145 |
<< QVariant(50) // sudden death 20 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
146 |
<< QVariant(1) // case prob 21 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
147 |
<< QVariant(3) // mines time 22 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
148 |
<< QVariant(4) // landadds 23 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
149 |
<< QVariant(0) // mine dud pct 24 |
1974 | 150 |
; |
151 |
||
152 |
QList<QVariant> basketball; |
|
153 |
basketball |
|
154 |
<< predefSchemesNames[3] // name 0 |
|
155 |
<< QVariant(false) // fortsmode 1 |
|
156 |
<< QVariant(false) // team divide 2 |
|
157 |
<< QVariant(true) // solid land 3 |
|
158 |
<< QVariant(true) // border 4 |
|
159 |
<< QVariant(true) // low gravity 5 |
|
160 |
<< QVariant(false) // laser sight 6 |
|
161 |
<< QVariant(true) // invulnerable 7 |
|
162 |
<< QVariant(false) // add mines 8 |
|
2017 | 163 |
<< QVariant(false) // vampiric 9 |
164 |
<< QVariant(false) // karma 10 |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
165 |
<< QVariant(false) // artillery 11 |
2703 | 166 |
<< QVariant(true) // random order 12 |
2726 | 167 |
<< QVariant(false) // king 13 |
2762
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2726
diff
changeset
|
168 |
<< QVariant(false) // place hog 14 |
2881 | 169 |
<< QVariant(true) // shared ammo 15 |
2891
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
170 |
<< QVariant(true) //disable girders 16 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
171 |
<< QVariant(100) // damage modfier 17 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
172 |
<< QVariant(30) // turn time 18 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
173 |
<< QVariant(100) // init health 19 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
174 |
<< QVariant(15) // sudden death 20 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
175 |
<< QVariant(0) // case prob 21 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
176 |
<< QVariant(3) // mines time 22 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
177 |
<< QVariant(4) // landadds 23 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
178 |
<< QVariant(0) // mine dud pct 24 |
1968 | 179 |
; |
180 |
||
2093
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
181 |
QList<QVariant> minefield; |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
182 |
minefield |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
183 |
<< predefSchemesNames[4] // name 0 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
184 |
<< QVariant(false) // fortsmode 1 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
185 |
<< QVariant(false) // team divide 2 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
186 |
<< QVariant(false) // solid land 3 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
187 |
<< QVariant(false) // border 4 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
188 |
<< QVariant(false) // low gravity 5 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
189 |
<< QVariant(false) // laser sight 6 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
190 |
<< QVariant(false) // invulnerable 7 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
191 |
<< QVariant(true) // add mines 8 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
192 |
<< QVariant(false) // vampiric 9 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
193 |
<< QVariant(false) // karma 10 |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
194 |
<< QVariant(false) // artillery 11 |
2703 | 195 |
<< QVariant(true) // random order 12 |
2726 | 196 |
<< QVariant(false) // king 13 |
2762
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2726
diff
changeset
|
197 |
<< QVariant(false) // place hog 14 |
2881 | 198 |
<< QVariant(true) // shared ammo 15 |
2891
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
199 |
<< QVariant(true) //disable girders 16 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
200 |
<< QVariant(150) // damage modfier 17 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
201 |
<< QVariant(30) // turn time 18 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
202 |
<< QVariant(50) // init health 19 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
203 |
<< QVariant(15) // sudden death 20 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
204 |
<< QVariant(0) // case prob 21 |
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
205 |
<< QVariant(0) // mines time 22 |
2894 | 206 |
<< QVariant(80) // landadds 23 |
2891
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2882
diff
changeset
|
207 |
<< QVariant(0) // mine dud pct 24 |
2093
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
208 |
; |
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
209 |
|
1884 | 210 |
schemes.append(defaultScheme); |
1897 | 211 |
schemes.append(proMode); |
1968 | 212 |
schemes.append(shoppa); |
1974 | 213 |
schemes.append(basketball); |
2093
485e084cedc4
Portugese (european) translation, Tiy's "minefield" scheme/wepset, disable vampirism, update translations
nemo
parents:
2031
diff
changeset
|
214 |
schemes.append(minefield); |
1897 | 215 |
|
216 |
||
217 |
int size = fileConfig.beginReadArray("schemes"); |
|
218 |
for (int i = 0; i < size; ++i) { |
|
219 |
fileConfig.setArrayIndex(i); |
|
220 |
||
221 |
if (!predefSchemesNames.contains(fileConfig.value(spNames[0]).toString())) |
|
222 |
{ |
|
223 |
QList<QVariant> scheme; |
|
224 |
||
225 |
for (int k = 0; k < spNames.size(); ++k) |
|
226 |
scheme << fileConfig.value(spNames[k], defaultScheme[k]); |
|
227 |
||
228 |
schemes.append(scheme); |
|
229 |
} |
|
230 |
} |
|
231 |
fileConfig.endArray(); |
|
1881 | 232 |
} |
233 |
||
234 |
QVariant AmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const |
|
235 |
{ |
|
236 |
return QVariant(); |
|
237 |
} |
|
238 |
||
239 |
int AmmoSchemeModel::rowCount(const QModelIndex &parent) const |
|
240 |
{ |
|
241 |
if (parent.isValid()) |
|
242 |
return 0; |
|
243 |
else |
|
244 |
return schemes.size(); |
|
245 |
} |
|
246 |
||
247 |
int AmmoSchemeModel::columnCount(const QModelIndex & parent) const |
|
248 |
{ |
|
249 |
if (parent.isValid()) |
|
250 |
return 0; |
|
251 |
else |
|
1884 | 252 |
return defaultScheme.size(); |
1881 | 253 |
} |
254 |
||
255 |
Qt::ItemFlags AmmoSchemeModel::flags(const QModelIndex & index) const |
|
256 |
{ |
|
257 |
return |
|
258 |
Qt::ItemIsEnabled |
|
259 |
| Qt::ItemIsSelectable |
|
260 |
| Qt::ItemIsEditable; |
|
261 |
} |
|
262 |
||
263 |
bool AmmoSchemeModel::setData(const QModelIndex & index, const QVariant & value, int role) |
|
264 |
{ |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
265 |
if (!index.isValid() || index.row() < numberOfDefaultSchemes |
1884 | 266 |
|| index.row() >= schemes.size() |
267 |
|| index.column() >= defaultScheme.size() |
|
1885 | 268 |
|| role != Qt::EditRole) |
1884 | 269 |
return false; |
270 |
||
1890 | 271 |
schemes[index.row()][index.column()] = value; |
1885 | 272 |
|
1881 | 273 |
emit dataChanged(index, index); |
1884 | 274 |
return true; |
1881 | 275 |
} |
1884 | 276 |
|
277 |
bool AmmoSchemeModel::insertRows(int row, int count, const QModelIndex & parent) |
|
278 |
{ |
|
279 |
beginInsertRows(parent, row, row); |
|
280 |
||
1890 | 281 |
QList<QVariant> newScheme = defaultScheme; |
282 |
newScheme[0] = QVariant(tr("new")); |
|
2377 | 283 |
|
1889 | 284 |
schemes.insert(row, newScheme); |
1884 | 285 |
|
286 |
endInsertRows(); |
|
2377 | 287 |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
288 |
return true; |
1884 | 289 |
} |
290 |
||
291 |
bool AmmoSchemeModel::removeRows(int row, int count, const QModelIndex & parent) |
|
292 |
{ |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
293 |
if(count != 1 |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
294 |
|| row < numberOfDefaultSchemes |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
295 |
|| row >= schemes.size()) |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
296 |
return false; |
2377 | 297 |
|
1884 | 298 |
beginRemoveRows(parent, row, row); |
299 |
||
300 |
schemes.removeAt(row); |
|
301 |
||
302 |
endRemoveRows(); |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
303 |
|
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
304 |
return true; |
1884 | 305 |
} |
306 |
||
307 |
QVariant AmmoSchemeModel::data(const QModelIndex &index, int role) const |
|
308 |
{ |
|
309 |
if (!index.isValid() || index.row() < 0 |
|
310 |
|| index.row() >= schemes.size() |
|
311 |
|| index.column() >= defaultScheme.size() |
|
1889 | 312 |
|| (role != Qt::EditRole && role != Qt::DisplayRole) |
313 |
) |
|
1884 | 314 |
return QVariant(); |
315 |
||
1890 | 316 |
return schemes[index.row()][index.column()]; |
1884 | 317 |
} |
1897 | 318 |
|
319 |
void AmmoSchemeModel::Save() |
|
320 |
{ |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
321 |
fileConfig.beginWriteArray("schemes", schemes.size()); |
2377 | 322 |
|
1897 | 323 |
for (int i = 0; i < schemes.size(); ++i) { |
324 |
fileConfig.setArrayIndex(i); |
|
325 |
||
326 |
QList<QVariant> scheme = schemes[i]; |
|
2377 | 327 |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
328 |
for (int k = 0; k < scheme.size(); ++k) |
1897 | 329 |
fileConfig.setValue(spNames[k], scheme[k]); |
330 |
} |
|
331 |
fileConfig.endArray(); |
|
332 |
} |
|
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
333 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
334 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
335 |
NetAmmoSchemeModel::NetAmmoSchemeModel(QObject * parent) : |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
336 |
QAbstractTableModel(parent) |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
337 |
{ |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
338 |
netScheme = defaultScheme; |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
339 |
} |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
340 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
341 |
QVariant NetAmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
342 |
{ |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
343 |
return QVariant(); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
344 |
} |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
345 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
346 |
int NetAmmoSchemeModel::rowCount(const QModelIndex & parent) const |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
347 |
{ |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
348 |
if (parent.isValid()) |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
349 |
return 0; |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
350 |
else |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
351 |
return 1; |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
352 |
} |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
353 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
354 |
int NetAmmoSchemeModel::columnCount(const QModelIndex & parent) const |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
355 |
{ |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
356 |
if (parent.isValid()) |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
357 |
return 0; |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
358 |
else |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
359 |
return defaultScheme.size(); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
360 |
} |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
361 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
362 |
QVariant NetAmmoSchemeModel::data(const QModelIndex &index, int role) const |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
363 |
{ |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
364 |
if (!index.isValid() || index.row() < 0 |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
365 |
|| index.row() > 1 |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
366 |
|| index.column() >= defaultScheme.size() |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
367 |
|| (role != Qt::EditRole && role != Qt::DisplayRole) |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
368 |
) |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
369 |
return QVariant(); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
370 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
371 |
return netScheme[index.column()]; |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
372 |
} |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
373 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
374 |
void NetAmmoSchemeModel::setNetSchemeConfig(QStringList & cfg) |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
375 |
{ |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
376 |
if(cfg.size() != netScheme.size()) |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
377 |
{ |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
378 |
qWarning("Incorrect scheme cfg size"); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
379 |
return; |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
380 |
} |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
381 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
382 |
for(int i = 0; i < cfg.size(); ++i) |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
383 |
netScheme[i] = QVariant(cfg[i]); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
384 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
385 |
reset(); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
386 |
} |