Mark custom maps/forts/scripts with circle icon instead of icon
authorWuzzy <almikes@aol.com>
Tue, 10 Oct 2017 22:45:48 +0200
changeset 12690 ad1fd7ae479d
parent 12689 5f68b259305c
child 12691 d5e09024d722
Mark custom maps/forts/scripts with circle icon instead of icon
ChangeLog.txt
QTfrontend/hedgewars.qrc
QTfrontend/model/GameStyleModel.cpp
QTfrontend/model/MapModel.cpp
QTfrontend/res/dlcMarker.png
QTfrontend/ui/page/pageeditteam.cpp
--- a/ChangeLog.txt	Tue Oct 10 21:00:11 2017 +0200
+++ b/ChangeLog.txt	Tue Oct 10 22:45:48 2017 +0200
@@ -273,7 +273,8 @@
  + Allow to randomize hog names, hats, team name, flag, grave, voice and fort separately
  + “Random team” button is now able to randomly select from all available hats
  + Creating new game/weapon schemes guarantees unique names
- + Mark custom forts with asterisk in team editor
+ + Custom maps and styles are now marked with a circle instead of an asterisk symbol
+ + Mark custom forts in team editor
  * Fix flag being selectable for computer players although it had no effect
  * Campaign screen does no longer show AI-controlled teams
  * Campaign names and campaign mission names can now be translated
--- a/QTfrontend/hedgewars.qrc	Tue Oct 10 21:00:11 2017 +0200
+++ b/QTfrontend/hedgewars.qrc	Tue Oct 10 22:45:48 2017 +0200
@@ -87,6 +87,7 @@
         <file>res/unchecked.png</file>
         <file>res/missionFinished.png</file>
         <file>res/missionFinishedSelected.png</file>
+        <file>res/dlcMarker.png</file>
         <file>res/graphicsicon.png</file>
         <file>res/frontendicon.png</file>
         <file>res/folder.png</file>
--- a/QTfrontend/model/GameStyleModel.cpp	Tue Oct 10 21:00:11 2017 +0200
+++ b/QTfrontend/model/GameStyleModel.cpp	Tue Oct 10 22:45:48 2017 +0200
@@ -32,11 +32,17 @@
 {
     beginResetModel();
 
+    QIcon dlcIcon;
+    dlcIcon.addFile(":/res/dlcMarker.png", QSize(), QIcon::Normal, QIcon::On);
+    QPixmap emptySpace = QPixmap(7, 15);
+    emptySpace.fill(QColor(0, 0, 0, 0));
+    QIcon notDlcIcon = QIcon(emptySpace);
+
     // empty list, so that we can (re)fill it
     QStandardItemModel::clear();
 
     QList<QStandardItem * > items;
-    items.append(new QStandardItem("Normal"));
+    items.append(new QStandardItem(notDlcIcon, "Normal"));
 
     // define a separator item
     QStandardItem * separator = new QStandardItem("---");
@@ -82,7 +88,11 @@
         QString scriptPath = PHYSFS_getRealDir(QString("Scripts/Multiplayer/%1.lua").arg(script).toLocal8Bit().data());
         bool isDLC = !scriptPath.startsWith(datadir->absolutePath());
 
-        QStandardItem * item = new QStandardItem((isDLC ? "*" : "") + name);
+        QStandardItem * item;
+        if (isDLC)
+            item = new QStandardItem(dlcIcon, name);
+        else
+            item = new QStandardItem(notDlcIcon, name);
 
         item->setData(script, ScriptRole);
         item->setData(scheme, SchemeRole);
--- a/QTfrontend/model/MapModel.cpp	Tue Oct 10 21:00:11 2017 +0200
+++ b/QTfrontend/model/MapModel.cpp	Tue Oct 10 22:45:48 2017 +0200
@@ -80,6 +80,13 @@
     //QList<QStandardItem *> missionMaps;
     QList<QStandardItem *> mapList;
 
+
+    QIcon dlcIcon;
+    dlcIcon.addFile(":/res/dlcMarker.png", QSize(), QIcon::Normal, QIcon::On);
+    QPixmap emptySpace = QPixmap(7, 15);
+    emptySpace.fill(QColor(0, 0, 0, 0));
+    QIcon notDlcIcon = QIcon(emptySpace);
+
     // add mission/static maps to lists
     foreach (QString map, maps)
     {
@@ -163,9 +170,15 @@
             // caption
             caption = map;
 
+            QIcon icon;
+            if (dlc)
+                icon = dlcIcon;
+            else
+                icon = notDlcIcon;
+
             // we know everything there is about the map, let's get am item for it
             QStandardItem * item = MapModel::infoToItem(
-                QIcon(), caption, type, map, theme, limit, scheme, weapons, desc, dlc);
+                icon, caption, type, map, theme, limit, scheme, weapons, desc, dlc);
 
             // append item to the list
             mapList.append(item);
@@ -225,7 +238,7 @@
     QString desc,
     bool dlc)
 {
-    QStandardItem * item = new QStandardItem(icon, (dlc ? "*" : "") + caption);
+    QStandardItem * item = new QStandardItem(icon, caption);
     MapInfo mapInfo;
     QVariant qvar(QVariant::UserType);
 
Binary file QTfrontend/res/dlcMarker.png has changed
--- a/QTfrontend/ui/page/pageeditteam.cpp	Tue Oct 10 21:00:11 2017 +0200
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Tue Oct 10 22:45:48 2017 +0200
@@ -312,6 +312,11 @@
 
     CBVoicepack->addItems(list);
 
+    QIcon dlcIcon;
+    dlcIcon.addFile(":/res/dlcMarker.png", QSize(), QIcon::Normal, QIcon::On);
+    QPixmap emptySpace = QPixmap(7, 15);
+    emptySpace.fill(QColor(0, 0, 0, 0));
+    QIcon notDlcIcon = QIcon(emptySpace);
 
     // forts
     list = dataMgr.entryList("Forts", QDir::Files, QStringList("*L.png"));
@@ -320,15 +325,17 @@
         QString fortPath = PHYSFS_getRealDir(QString("Forts/%1").arg(file).toLocal8Bit().data());
 
         QString fort = file.replace(QRegExp("L\\.png$"), "");
-        QString fortDisplay;
 
         bool isDLC = !fortPath.startsWith(datadir->absolutePath());
         if (isDLC)
-            fortDisplay = "*" + fort;
+        {
+            CBFort->addItem(dlcIcon, fort, fort);
+        }
         else
-            fortDisplay = fort;
+        {
+            CBFort->addItem(notDlcIcon, fort, fort);
+        }
 
-        CBFort->addItem(fortDisplay, fort);
     }