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

+ 1
- 1
mainwindow.h View File

94
 
94
 
95
 enum MapListUserRoles {
95
 enum MapListUserRoles {
96
     GroupRole = Qt::UserRole + 1, // Used to hold the map group number.
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
 #endif // MAINWINDOW_H
100
 #endif // MAINWINDOW_H

+ 0
- 9
map.h View File

193
 public slots:
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
 #endif // MAP_H
196
 #endif // MAP_H

+ 3
- 1
project.cpp View File

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

+ 7
- 7
project.h View File

54
     void getTilesets(Map*);
54
     void getTilesets(Map*);
55
     void loadTilesetAssets(Tileset*);
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
     QString getBlockdataPath(Map*);
57
     QString getBlockdataPath(Map*);
65
     void saveBlockdata(Map*);
58
     void saveBlockdata(Map*);
66
     void saveMapBorder(Map*);
59
     void saveMapBorder(Map*);
102
     void saveMapHeader(Map*);
95
     void saveMapHeader(Map*);
103
     void saveMapAttributesTable();
96
     void saveMapAttributesTable();
104
     void updateMapAttributes(Map* map);
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
 #endif // PROJECT_H
107
 #endif // PROJECT_H