equal
deleted
inserted
replaced
21 * @brief GameStyleModel class implementation |
21 * @brief GameStyleModel class implementation |
22 */ |
22 */ |
23 |
23 |
24 #include <QTextStream> |
24 #include <QTextStream> |
25 |
25 |
|
26 #include "physfs.h" |
26 #include "GameStyleModel.h" |
27 #include "GameStyleModel.h" |
27 |
28 |
28 |
29 |
29 void GameStyleModel::loadGameStyles() |
30 void GameStyleModel::loadGameStyles() |
30 { |
31 { |
|
32 const QString appDir = QString(PHYSFS_getBaseDir()); |
|
33 |
31 beginResetModel(); |
34 beginResetModel(); |
32 |
|
33 |
35 |
34 // empty list, so that we can (re)fill it |
36 // empty list, so that we can (re)fill it |
35 QStandardItemModel::clear(); |
37 QStandardItemModel::clear(); |
36 |
38 |
37 QList<QStandardItem * > items; |
39 QList<QStandardItem * > items; |
75 |
77 |
76 if (!weapons.isEmpty()) |
78 if (!weapons.isEmpty()) |
77 weapons.replace("_", " "); |
79 weapons.replace("_", " "); |
78 } |
80 } |
79 |
81 |
80 QStandardItem * item = new QStandardItem(name); |
82 // detect if script is dlc |
|
83 QString scriptPath = PHYSFS_getRealDir(QString("Scripts/Multiplayer/%1.lua").arg(script).toLocal8Bit().data()); |
|
84 bool isDLC = !scriptPath.startsWith(appDir); |
|
85 |
|
86 QStandardItem * item = new QStandardItem((isDLC ? "*" : "") + name); |
81 |
87 |
82 item->setData(script, ScriptRole); |
88 item->setData(script, ScriptRole); |
83 item->setData(scheme, SchemeRole); |
89 item->setData(scheme, SchemeRole); |
84 item->setData(weapons, WeaponsRole); |
90 item->setData(weapons, WeaponsRole); |
|
91 item->setData(isDLC, IsDlcRole); |
85 |
92 |
86 items.append(item); |
93 items.append(item); |
87 } |
94 } |
88 |
95 |
89 QStandardItemModel::appendColumn(items); |
96 QStandardItemModel::appendColumn(items); |