30 |
30 |
31 void GameStyleModel::loadGameStyles() |
31 void GameStyleModel::loadGameStyles() |
32 { |
32 { |
33 beginResetModel(); |
33 beginResetModel(); |
34 |
34 |
|
35 QIcon dlcIcon; |
|
36 dlcIcon.addFile(":/res/dlcMarker.png", QSize(), QIcon::Normal, QIcon::On); |
|
37 QPixmap emptySpace = QPixmap(7, 15); |
|
38 emptySpace.fill(QColor(0, 0, 0, 0)); |
|
39 QIcon notDlcIcon = QIcon(emptySpace); |
|
40 |
35 // empty list, so that we can (re)fill it |
41 // empty list, so that we can (re)fill it |
36 QStandardItemModel::clear(); |
42 QStandardItemModel::clear(); |
37 |
43 |
38 QList<QStandardItem * > items; |
44 QList<QStandardItem * > items; |
39 items.append(new QStandardItem("Normal")); |
45 items.append(new QStandardItem(notDlcIcon, "Normal")); |
40 |
46 |
41 // define a separator item |
47 // define a separator item |
42 QStandardItem * separator = new QStandardItem("---"); |
48 QStandardItem * separator = new QStandardItem("---"); |
43 separator->setData(QLatin1String("separator"), Qt::AccessibleDescriptionRole); |
49 separator->setData(QLatin1String("separator"), Qt::AccessibleDescriptionRole); |
44 separator->setFlags(separator->flags() & ~( Qt::ItemIsEnabled | Qt::ItemIsSelectable ) ); |
50 separator->setFlags(separator->flags() & ~( Qt::ItemIsEnabled | Qt::ItemIsSelectable ) ); |
80 |
86 |
81 // detect if script is dlc |
87 // detect if script is dlc |
82 QString scriptPath = PHYSFS_getRealDir(QString("Scripts/Multiplayer/%1.lua").arg(script).toLocal8Bit().data()); |
88 QString scriptPath = PHYSFS_getRealDir(QString("Scripts/Multiplayer/%1.lua").arg(script).toLocal8Bit().data()); |
83 bool isDLC = !scriptPath.startsWith(datadir->absolutePath()); |
89 bool isDLC = !scriptPath.startsWith(datadir->absolutePath()); |
84 |
90 |
85 QStandardItem * item = new QStandardItem((isDLC ? "*" : "") + name); |
91 QStandardItem * item; |
|
92 if (isDLC) |
|
93 item = new QStandardItem(dlcIcon, name); |
|
94 else |
|
95 item = new QStandardItem(notDlcIcon, name); |
86 |
96 |
87 item->setData(script, ScriptRole); |
97 item->setData(script, ScriptRole); |
88 item->setData(scheme, SchemeRole); |
98 item->setData(scheme, SchemeRole); |
89 item->setData(weapons, WeaponsRole); |
99 item->setData(weapons, WeaponsRole); |
90 item->setData(isDLC, IsDlcRole); |
100 item->setData(isDLC, IsDlcRole); |