equal
deleted
inserted
replaced
54 << "Default" |
54 << "Default" |
55 << "Pro mode" |
55 << "Pro mode" |
56 << "Shoppa" |
56 << "Shoppa" |
57 << "Basketball" |
57 << "Basketball" |
58 << "Minefield"; |
58 << "Minefield"; |
59 |
59 |
60 spNames = QStringList() |
60 spNames = QStringList() |
61 << "name" // 0 |
61 << "name" // 0 |
62 << "fortsmode" // 1 |
62 << "fortsmode" // 1 |
63 << "divteams" // 2 |
63 << "divteams" // 2 |
64 << "solidland" // 3 |
64 << "solidland" // 3 |
242 { |
242 { |
243 beginInsertRows(parent, row, row); |
243 beginInsertRows(parent, row, row); |
244 |
244 |
245 QList<QVariant> newScheme = defaultScheme; |
245 QList<QVariant> newScheme = defaultScheme; |
246 newScheme[0] = QVariant(tr("new")); |
246 newScheme[0] = QVariant(tr("new")); |
247 |
247 |
248 schemes.insert(row, newScheme); |
248 schemes.insert(row, newScheme); |
249 |
249 |
250 endInsertRows(); |
250 endInsertRows(); |
251 |
251 |
252 return true; |
252 return true; |
253 } |
253 } |
254 |
254 |
255 bool AmmoSchemeModel::removeRows(int row, int count, const QModelIndex & parent) |
255 bool AmmoSchemeModel::removeRows(int row, int count, const QModelIndex & parent) |
256 { |
256 { |
257 if(count != 1 |
257 if(count != 1 |
258 || row < numberOfDefaultSchemes |
258 || row < numberOfDefaultSchemes |
259 || row >= schemes.size()) |
259 || row >= schemes.size()) |
260 return false; |
260 return false; |
261 |
261 |
262 beginRemoveRows(parent, row, row); |
262 beginRemoveRows(parent, row, row); |
263 |
263 |
264 schemes.removeAt(row); |
264 schemes.removeAt(row); |
265 |
265 |
266 endRemoveRows(); |
266 endRemoveRows(); |
281 } |
281 } |
282 |
282 |
283 void AmmoSchemeModel::Save() |
283 void AmmoSchemeModel::Save() |
284 { |
284 { |
285 fileConfig.beginWriteArray("schemes", schemes.size()); |
285 fileConfig.beginWriteArray("schemes", schemes.size()); |
286 |
286 |
287 for (int i = 0; i < schemes.size(); ++i) { |
287 for (int i = 0; i < schemes.size(); ++i) { |
288 fileConfig.setArrayIndex(i); |
288 fileConfig.setArrayIndex(i); |
289 |
289 |
290 QList<QVariant> scheme = schemes[i]; |
290 QList<QVariant> scheme = schemes[i]; |
291 |
291 |
292 for (int k = 0; k < scheme.size(); ++k) |
292 for (int k = 0; k < scheme.size(); ++k) |
293 fileConfig.setValue(spNames[k], scheme[k]); |
293 fileConfig.setValue(spNames[k], scheme[k]); |
294 } |
294 } |
295 fileConfig.endArray(); |
295 fileConfig.endArray(); |
296 } |
296 } |