Browse Source

Small cleanup

Marcus Huderle 6 years ago
parent
commit
b39f44c6d0
5 changed files with 12 additions and 18 deletions
  1. 1
    0
      main.cpp
  2. 1
    1
      mainwindow.h
  3. 0
    9
      map.h
  4. 3
    1
      project.cpp
  5. 7
    7
      project.h

+ 1
- 0
main.cpp View File

@@ -4,6 +4,7 @@
4 4
 int main(int argc, char *argv[])
5 5
 {
6 6
     QApplication a(argc, argv);
7
+    a.setStyle("fusion");
7 8
     MainWindow w;
8 9
     w.show();
9 10
 

+ 1
- 1
mainwindow.h View File

@@ -94,7 +94,7 @@ private:
94 94
 
95 95
 enum MapListUserRoles {
96 96
     GroupRole = Qt::UserRole + 1, // Used to hold the map group number.
97
-    TypeRole = Qt::UserRole + 10, // Used to differentiate between the different layers of the map list tree view.
97
+    TypeRole = Qt::UserRole + 2,  // Used to differentiate between the different layers of the map list tree view.
98 98
 };
99 99
 
100 100
 #endif // MAINWINDOW_H

+ 0
- 9
map.h View File

@@ -193,13 +193,4 @@ signals:
193 193
 public slots:
194 194
 };
195 195
 
196
-class MapGroup : public QObject
197
-{
198
-    Q_OBJECT
199
-public:
200
-    QString name;
201
-    int group_num;
202
-    QList<Map*> maps;
203
-};
204
-
205 196
 #endif // MAP_H

+ 3
- 1
project.cpp View File

@@ -232,6 +232,7 @@ void Project::readMapAttributesTable() {
232 232
         }
233 233
     }
234 234
 
235
+    // Deep copy
235 236
     mapAttributesTableMaster = mapAttributesTable;
236 237
     mapAttributesTableMaster.detach();
237 238
 }
@@ -357,7 +358,6 @@ void Project::readAllMapAttributes() {
357 358
             if (!mapAttributes.contains(altMapName)) {
358 359
                 mapAttributes.insert(altMapName, QMap<QString, QString>());
359 360
             }
360
-            mapAttributes[altMapName]["attributes_label"] = attributeMapLabel;
361 361
             mapAttributes[altMapName].insert("attributes_label", attributeMapLabel);
362 362
             mapAttributes[altMapName].insert("width", attrWidth);
363 363
             mapAttributes[altMapName].insert("height", attrHeight);
@@ -372,6 +372,7 @@ void Project::readAllMapAttributes() {
372 372
         }
373 373
     }
374 374
 
375
+    // Deep copy
375 376
     mapAttributesMaster = mapAttributes;
376 377
     mapAttributesMaster.detach();
377 378
 }
@@ -687,6 +688,7 @@ void Project::saveMap(Map *map) {
687 688
 void Project::updateMapAttributes(Map* map) {
688 689
     mapAttributesTableMaster.insert(map->index.toInt(nullptr, 0), map->name);
689 690
 
691
+    // Deep copy
690 692
     QMap<QString, QString> attrs = mapAttributes.value(map->name);
691 693
     attrs.detach();
692 694
     mapAttributesMaster.insert(map->name, attrs);

+ 7
- 7
project.h View File

@@ -54,13 +54,6 @@ public:
54 54
     void getTilesets(Map*);
55 55
     void loadTilesetAssets(Tileset*);
56 56
 
57
-    void setNewMapHeader(Map* map, int mapIndex);
58
-    void setNewMapAttributes(Map* map);
59
-    void setNewMapBlockdata(Map* map);
60
-    void setNewMapBorder(Map *map);
61
-    void setNewMapEvents(Map *map);
62
-    void setNewMapConnections(Map *map);
63
-
64 57
     QString getBlockdataPath(Map*);
65 58
     void saveBlockdata(Map*);
66 59
     void saveMapBorder(Map*);
@@ -102,6 +95,13 @@ private:
102 95
     void saveMapHeader(Map*);
103 96
     void saveMapAttributesTable();
104 97
     void updateMapAttributes(Map* map);
98
+
99
+    void setNewMapHeader(Map* map, int mapIndex);
100
+    void setNewMapAttributes(Map* map);
101
+    void setNewMapBlockdata(Map* map);
102
+    void setNewMapBorder(Map *map);
103
+    void setNewMapEvents(Map *map);
104
+    void setNewMapConnections(Map *map);
105 105
 };
106 106
 
107 107
 #endif // PROJECT_H