Small cleanup

This commit is contained in:
Marcus Huderle 2018-02-18 10:32:30 -08:00
parent c61b8a9b18
commit b39f44c6d0
5 changed files with 12 additions and 18 deletions

View file

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

View file

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

9
map.h
View file

@ -193,13 +193,4 @@ signals:
public slots:
};
class MapGroup : public QObject
{
Q_OBJECT
public:
QString name;
int group_num;
QList<Map*> maps;
};
#endif // MAP_H

View file

@ -232,6 +232,7 @@ void Project::readMapAttributesTable() {
}
}
// Deep copy
mapAttributesTableMaster = mapAttributesTable;
mapAttributesTableMaster.detach();
}
@ -357,7 +358,6 @@ void Project::readAllMapAttributes() {
if (!mapAttributes.contains(altMapName)) {
mapAttributes.insert(altMapName, QMap<QString, QString>());
}
mapAttributes[altMapName]["attributes_label"] = attributeMapLabel;
mapAttributes[altMapName].insert("attributes_label", attributeMapLabel);
mapAttributes[altMapName].insert("width", attrWidth);
mapAttributes[altMapName].insert("height", attrHeight);
@ -372,6 +372,7 @@ void Project::readAllMapAttributes() {
}
}
// Deep copy
mapAttributesMaster = mapAttributes;
mapAttributesMaster.detach();
}
@ -687,6 +688,7 @@ void Project::saveMap(Map *map) {
void Project::updateMapAttributes(Map* map) {
mapAttributesTableMaster.insert(map->index.toInt(nullptr, 0), map->name);
// Deep copy
QMap<QString, QString> attrs = mapAttributes.value(map->name);
attrs.detach();
mapAttributesMaster.insert(map->name, attrs);

View file

@ -54,13 +54,6 @@ public:
void getTilesets(Map*);
void loadTilesetAssets(Tileset*);
void setNewMapHeader(Map* map, int mapIndex);
void setNewMapAttributes(Map* map);
void setNewMapBlockdata(Map* map);
void setNewMapBorder(Map *map);
void setNewMapEvents(Map *map);
void setNewMapConnections(Map *map);
QString getBlockdataPath(Map*);
void saveBlockdata(Map*);
void saveMapBorder(Map*);
@ -102,6 +95,13 @@ private:
void saveMapHeader(Map*);
void saveMapAttributesTable();
void updateMapAttributes(Map* map);
void setNewMapHeader(Map* map, int mapIndex);
void setNewMapAttributes(Map* map);
void setNewMapBlockdata(Map* map);
void setNewMapBorder(Map *map);
void setNewMapEvents(Map *map);
void setNewMapConnections(Map *map);
};
#endif // PROJECT_H