Add sorting options to the Locations and Layouts list

This commit is contained in:
GriffinR
2025-08-17 20:34:32 -04:00
parent ccc0ddd2f2
commit e232ef760c
10 changed files with 65 additions and 24 deletions

View File

@@ -97,6 +97,8 @@ public:
int mapListTab;
bool mapListEditGroupsEnabled;
QMap<int, bool> mapListHideEmptyEnabled;
bool mapListLayoutsSorted;
bool mapListLocationsSorted;
bool prettyCursors;
bool mirrorConnectingMaps;
bool showDiveEmergeMaps;

View File

@@ -393,10 +393,10 @@ private:
void openDuplicateMapOrLayoutDialog();
void openNewMapGroupDialog();
void openNewLocationDialog();
void scrollMapList(MapTree *list, const QString &itemName);
void scrollMapList(MapTree *list, const QString &itemName, bool expandItem = true);
void scrollMapListToCurrentMap(MapTree *list);
void scrollMapListToCurrentLayout(MapTree *list);
void scrollCurrentMapListToItem(const QString &itemName);
void scrollCurrentMapListToItem(const QString &itemName, bool expandItem = true);
void showFileWatcherWarning();
bool openProject(QString dir, bool initial = false);
bool closeProject();
@@ -410,6 +410,7 @@ private:
void rebuildMapList_Locations();
void rebuildMapList_Layouts();
void setMapListSorted(MapTree *list, bool sort);
void updateMapList();
void openMapListItem(const QModelIndex &index);
void onMapListTabChanged(int index);

View File

@@ -52,8 +52,6 @@ public:
QStringList bgEventFacingDirections;
QStringList trainerTypes;
QStringList globalScriptLabels;
QStringList mapSectionIdNamesSaveOrder;
QStringList mapSectionIdNames;
QMap<uint32_t, QString> encounterTypeToName;
QMap<uint32_t, QString> terrainTypeToName;
QMap<QString, QMap<QString, uint16_t>> metatileLabelsMap;
@@ -83,6 +81,7 @@ public:
Map* loadMap(const QString &mapName);
const QStringList& layoutIds() const { return this->alphabeticalLayoutIds; }
const QStringList& layoutIdsOrdered() const { return this->orderedLayoutIds; }
bool isKnownLayout(const QString &layoutId) const { return this->mapLayouts.contains(layoutId); }
bool isLoadedLayout(const QString &layoutId) const { return this->loadedLayoutIds.contains(layoutId); }
bool isUnsavedLayout(const QString &layoutId) const;
@@ -93,6 +92,12 @@ public:
Layout* getLayout(const QString &layoutId) const { return this->mapLayouts.value(layoutId); }
Layout* loadLayout(const QString &layoutId);
const QStringList& locationNames() const { return this->mapSectionIdNames; }
const QStringList& locationNamesOrdered() const { return this->mapSectionIdNamesSaveOrder; }
QString getLocationName(int locationValue) const { return this->mapSectionIdNamesSaveOrder.value(locationValue, getEmptyMapsecName()); }
int getLocationValue(const QString &locationName) const { return this->mapSectionIdNamesSaveOrder.indexOf(locationName); }
void clearMaps();
void clearTilesetCache();
void clearMapLayouts();
@@ -284,6 +289,8 @@ private:
QStringList orderedLayoutIdsMaster;
QHash<QString, Layout*> mapLayouts;
QHash<QString, Layout*> mapLayoutsMaster;
QStringList mapSectionIdNamesSaveOrder;
QStringList mapSectionIdNames;
// Fields for preserving top-level JSON data that Porymap isn't expecting.
QJsonObject customLayoutsData;