mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-26 10:35:55 -05:00
Merge branch 'dev' into tileset-types
This commit is contained in:
@@ -52,6 +52,8 @@ public:
|
||||
this->projectManuallyClosed = false;
|
||||
this->reopenOnLaunch = true;
|
||||
this->mapListTab = 0;
|
||||
this->mapListEditGroupsEnabled = false;
|
||||
this->mapListHideEmptyEnabled.clear();
|
||||
this->prettyCursors = true;
|
||||
this->mirrorConnectingMaps = true;
|
||||
this->showDiveEmergeMaps = false;
|
||||
@@ -110,6 +112,8 @@ public:
|
||||
bool reopenOnLaunch;
|
||||
bool projectManuallyClosed;
|
||||
int mapListTab;
|
||||
bool mapListEditGroupsEnabled;
|
||||
QMap<int, bool> mapListHideEmptyEnabled;
|
||||
bool prettyCursors;
|
||||
bool mirrorConnectingMaps;
|
||||
bool showDiveEmergeMaps;
|
||||
|
||||
@@ -51,9 +51,6 @@ public:
|
||||
void setLayout(Layout *layout);
|
||||
Layout* layout() const { return m_layout; }
|
||||
|
||||
void setLayoutId(const QString &layoutId) { m_layoutId = layoutId; }
|
||||
QString layoutId() const { return m_layoutId; }
|
||||
|
||||
int getWidth() const;
|
||||
int getHeight() const;
|
||||
int getBorderWidth() const;
|
||||
@@ -109,7 +106,6 @@ public:
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_constantName;
|
||||
QString m_layoutId;
|
||||
QString m_sharedEventsMap = "";
|
||||
QString m_sharedScriptsMap = "";
|
||||
|
||||
@@ -144,6 +140,7 @@ signals:
|
||||
void openScriptRequested(QString label);
|
||||
void connectionAdded(MapConnection*);
|
||||
void connectionRemoved(MapConnection*);
|
||||
void layoutChanged();
|
||||
};
|
||||
|
||||
#endif // MAP_H
|
||||
|
||||
@@ -22,7 +22,6 @@ public:
|
||||
|
||||
static QString layoutConstantFromName(const QString &name);
|
||||
|
||||
bool loaded = false;
|
||||
bool hasUnsavedDataChanges = false;
|
||||
|
||||
QString id;
|
||||
@@ -141,9 +140,7 @@ private:
|
||||
void setNewBorderDimensionsBlockdata(int newWidth, int newHeight);
|
||||
|
||||
signals:
|
||||
void layoutChanged(Layout *layout);
|
||||
//void modified();
|
||||
void layoutDimensionsChanged(const QSize &size);
|
||||
void dimensionsChanged(const QSize &size);
|
||||
void needsRedrawing();
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
QString prefix() const { return m_prefix; }
|
||||
void setPrefix(const QString &prefix);
|
||||
|
||||
bool isValid(QString &input) const;
|
||||
bool isValid(const QString &input) const;
|
||||
|
||||
private:
|
||||
QString m_prefix;
|
||||
|
||||
@@ -215,6 +215,7 @@ private:
|
||||
void clearMapBorder();
|
||||
void clearMapGrid();
|
||||
void clearWildMonTables();
|
||||
int getSortedItemIndex(QComboBox *combo, QString item);
|
||||
void updateBorderVisibility();
|
||||
void removeConnectionPixmap(MapConnection *connection);
|
||||
void displayConnection(MapConnection *connection);
|
||||
|
||||
@@ -186,7 +186,6 @@ private slots:
|
||||
void copy();
|
||||
void paste();
|
||||
|
||||
void onLayoutChanged(Layout *layout);
|
||||
void onOpenConnectedMap(MapConnection*);
|
||||
void onTilesetsSaved(QString, QString);
|
||||
void onNewMapCreated(Map *newMap, const QString &groupName);
|
||||
@@ -205,6 +204,7 @@ private slots:
|
||||
void on_actionNew_Tileset_triggered();
|
||||
void on_action_Save_triggered();
|
||||
void on_action_Exit_triggered();
|
||||
void onLayoutSelectorEditingFinished();
|
||||
void on_comboBox_LayoutSelector_currentTextChanged(const QString &text);
|
||||
void on_actionShortcuts_triggered();
|
||||
|
||||
@@ -383,6 +383,8 @@ private:
|
||||
|
||||
void refreshRecentProjectsMenu();
|
||||
|
||||
void rebuildMapList_Locations();
|
||||
void rebuildMapList_Layouts();
|
||||
void updateMapList();
|
||||
void openMapListItem(const QModelIndex &index);
|
||||
void onMapListTabChanged(int index);
|
||||
@@ -421,6 +423,7 @@ private:
|
||||
double getMetatilesZoomScale();
|
||||
void redrawMetatileSelection();
|
||||
void scrollMetatileSelectorToSelection();
|
||||
MapListToolBar* getMapListToolBar(int tab);
|
||||
MapListToolBar* getCurrentMapListToolBar();
|
||||
MapTree* getCurrentMapList();
|
||||
void setLocationComboBoxes(const QStringList &locations);
|
||||
|
||||
@@ -37,9 +37,6 @@ public:
|
||||
QStringList healLocationSaveOrder;
|
||||
QMap<QString, QList<HealLocationEvent*>> healLocations;
|
||||
QMap<QString, QString> mapConstantsToMapNames;
|
||||
QMap<QString, QString> mapNamesToMapConstants;
|
||||
QMap<QString, QString> mapNameToLayoutId;
|
||||
QMap<QString, QString> mapNameToMapSectionName;
|
||||
QString layoutsLabel;
|
||||
QStringList layoutIds;
|
||||
QStringList layoutIdsMaster;
|
||||
@@ -83,7 +80,7 @@ public:
|
||||
|
||||
void set_root(QString);
|
||||
|
||||
void clearMapCache();
|
||||
void clearMaps();
|
||||
void clearTilesetCache();
|
||||
void clearMapLayouts();
|
||||
void clearEventGraphics();
|
||||
@@ -92,9 +89,15 @@ public:
|
||||
bool sanityCheck();
|
||||
bool load();
|
||||
|
||||
QMap<QString, Map*> mapCache;
|
||||
Map* loadMap(QString);
|
||||
Map* getMap(QString);
|
||||
Map* loadMap(const QString &mapName);
|
||||
|
||||
// Note: This does not guarantee the map is loaded.
|
||||
Map* getMap(const QString &mapName) { return this->maps.value(mapName); }
|
||||
|
||||
bool isMapLoaded(const Map *map) const { return map && isMapLoaded(map->name()); }
|
||||
bool isMapLoaded(const QString &mapName) const { return this->loadedMapNames.contains(mapName); }
|
||||
bool isLayoutLoaded(const Layout *layout) const { return layout && isLayoutLoaded(layout->id); }
|
||||
bool isLayoutLoaded(const QString &layoutId) const { return this->loadedLayoutIds.contains(layoutId); }
|
||||
|
||||
QMap<QString, Tileset*> tilesetCache;
|
||||
Tileset* loadTileset(QString, Tileset *tileset = nullptr);
|
||||
@@ -113,7 +116,10 @@ public:
|
||||
|
||||
bool readMapGroups();
|
||||
void addNewMapGroup(const QString &groupName);
|
||||
QString mapNameToMapGroup(const QString &mapName);
|
||||
QString mapNameToMapGroup(const QString &mapName) const;
|
||||
QString getMapConstant(const QString &mapName, const QString &defaultValue = QString()) const;
|
||||
QString getMapLayoutId(const QString &mapName, const QString &defaultValue = QString()) const;
|
||||
QString getMapLocation(const QString &mapName, const QString &defaultValue = QString()) const;
|
||||
|
||||
struct NewMapSettings {
|
||||
QString name;
|
||||
@@ -132,7 +138,7 @@ public:
|
||||
Layout *createNewLayout(const Layout::Settings &layoutSettings, const Layout* toDuplicate = nullptr);
|
||||
Tileset *createNewTileset(QString name, bool secondary, bool checkerboardFill);
|
||||
bool isIdentifierUnique(const QString &identifier) const;
|
||||
bool isValidNewIdentifier(QString identifier) const;
|
||||
bool isValidNewIdentifier(const QString &identifier) const;
|
||||
QString toUniqueIdentifier(const QString &identifier) const;
|
||||
QString getProjectTitle() const;
|
||||
QString getNewHealLocationName(const Map* map) const;
|
||||
@@ -148,7 +154,7 @@ public:
|
||||
QString getDefaultSpeciesIconPath(const QString &species);
|
||||
QPixmap getSpeciesIcon(const QString &species);
|
||||
|
||||
void addNewMapsec(const QString &idName);
|
||||
bool addNewMapsec(const QString &idName, const QString &displayName = QString());
|
||||
void removeMapsec(const QString &idName);
|
||||
QString getMapsecDisplayName(const QString &idName) const { return this->mapSectionDisplayNames.value(idName); }
|
||||
void setMapsecDisplayName(const QString &idName, const QString &displayName);
|
||||
@@ -255,10 +261,20 @@ public:
|
||||
static QString getMapGroupPrefix();
|
||||
|
||||
private:
|
||||
QMap<QString, QString> mapSectionDisplayNames;
|
||||
QHash<QString, QString> mapSectionDisplayNames;
|
||||
QMap<QString, qint64> modifiedFileTimestamps;
|
||||
QMap<QString, QString> facingDirections;
|
||||
QMap<QString, QString> speciesToIconPath;
|
||||
QHash<QString, QString> speciesToIconPath;
|
||||
QHash<QString, Map*> maps;
|
||||
|
||||
// Maps/layouts represented in these sets have been fully loaded from the project.
|
||||
// If a valid map name / layout id is not in these sets, a Map / Layout object exists
|
||||
// for it in Project::maps / Project::mapLayouts, but it has been minimally populated
|
||||
// (i.e. for a map layout it only has the data read from layouts.json, none of its assets
|
||||
// have been loaded, and for a map it only has the data needed to identify it in the map
|
||||
// list, none of the rest of its data in map.json).
|
||||
QSet<QString> loadedMapNames;
|
||||
QSet<QString> loadedLayoutIds;
|
||||
|
||||
const QRegularExpression re_gbapalExtension;
|
||||
const QRegularExpression re_bppExtension;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <QStringList>
|
||||
#include <QJSEngine>
|
||||
|
||||
// !! New callback functions or changes to existing callback function names/arguments
|
||||
// should be synced to resources/text/script_template.txt and docsrc/manual/scripting-capabilities.rst
|
||||
enum CallbackType {
|
||||
OnProjectOpened,
|
||||
OnProjectClosed,
|
||||
@@ -17,6 +19,7 @@ enum CallbackType {
|
||||
OnBlockHoverChanged,
|
||||
OnBlockHoverCleared,
|
||||
OnMapOpened,
|
||||
OnLayoutOpened,
|
||||
OnMapResized,
|
||||
OnBorderResized,
|
||||
OnMapShifted,
|
||||
@@ -43,6 +46,7 @@ public:
|
||||
static void cb_BlockHoverChanged(int x, int y);
|
||||
static void cb_BlockHoverCleared();
|
||||
static void cb_MapOpened(QString mapName);
|
||||
static void cb_LayoutOpened(QString layoutName);
|
||||
static void cb_MapResized(int oldWidth, int oldHeight, int newWidth, int newHeight);
|
||||
static void cb_BorderResized(int oldWidth, int oldHeight, int newWidth, int newHeight);
|
||||
static void cb_MapShifted(int xDelta, int yDelta);
|
||||
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
signals:
|
||||
void filterCleared(MapTree*);
|
||||
void addFolderClicked();
|
||||
void editsAllowedChanged(bool allowed);
|
||||
void emptyFoldersVisibleChanged(bool visible);
|
||||
|
||||
private:
|
||||
Ui::MapListToolBar *ui;
|
||||
|
||||
@@ -70,11 +70,13 @@ public:
|
||||
Q_INVOKABLE void addTileImage(int x, int y, QJSValue tileObj, bool setTransparency = false, int layer = 0);
|
||||
Q_INVOKABLE void addMetatileImage(int x, int y, int metatileId, bool setTransparency = false, int layer = 0);
|
||||
|
||||
private:
|
||||
QMap<int, Overlay*> overlayMap;
|
||||
protected:
|
||||
virtual void drawForeground(QPainter *painter, const QRectF &rect) override;
|
||||
virtual void keyPressEvent(QKeyEvent*) override;
|
||||
private:
|
||||
QMap<int, Overlay*> overlayMap;
|
||||
|
||||
void updateScene();
|
||||
};
|
||||
|
||||
#endif // GRAPHICSVIEW_H
|
||||
|
||||
Reference in New Issue
Block a user