porymap/include/mainwindow.h

230 lines
7.4 KiB
C
Raw Normal View History

2018-09-27 00:33:08 +01:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QString>
#include <QModelIndex>
#include <QMainWindow>
#include <QStandardItemModel>
#include <QGraphicsPixmapItem>
#include <QGraphicsItemGroup>
#include <QGraphicsSceneMouseEvent>
#include <QCloseEvent>
2018-09-27 00:33:08 +01:00
#include <QAbstractItemModel>
#include "project.h"
2018-12-21 15:25:28 +00:00
#include "config.h"
2018-09-27 00:33:08 +01:00
#include "map.h"
#include "editor.h"
2018-09-29 20:13:07 +01:00
#include "tileseteditor.h"
#include "regionmapeditor.h"
2019-05-21 03:08:04 +01:00
#include "mapimageexporter.h"
2018-10-05 07:02:40 +01:00
#include "filterchildrenproxymodel.h"
#include "newmappopup.h"
2019-03-21 23:50:50 +00:00
#include "newtilesetdialog.h"
2018-09-27 00:33:08 +01:00
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
2018-09-27 19:27:57 +01:00
public slots:
void scaleMapView(int);
2018-09-27 00:33:08 +01:00
private slots:
void on_action_Open_Project_triggered();
void on_mapList_activated(const QModelIndex &index);
void on_action_Save_Project_triggered();
void openWarpMap(QString map_name, QString warp_num);
void undo();
void redo();
void openInTextEditor();
void onLoadMapRequested(QString, QString);
void onMapChanged(Map *map);
void onMapNeedsRedrawing();
2018-10-03 01:01:15 +01:00
void onTilesetsSaved(QString, QString);
void openNewMapPopupWindow(int, QVariant);
void onNewMapCreated();
2018-09-27 00:33:08 +01:00
void on_action_NewMap_triggered();
2019-03-21 23:50:50 +00:00
void on_actionNew_Tileset_triggered();
2018-09-27 00:33:08 +01:00
void on_action_Save_triggered();
void on_tabWidget_2_currentChanged(int index);
void on_action_Exit_triggered();
void on_comboBox_Song_currentTextChanged(const QString &arg1);
void on_comboBox_Location_currentTextChanged(const QString &arg1);
void on_comboBox_Weather_currentTextChanged(const QString &arg1);
void on_comboBox_Type_currentTextChanged(const QString &arg1);
void on_comboBox_BattleScene_currentTextChanged(const QString &arg1);
2018-09-27 00:33:08 +01:00
void on_checkBox_ShowLocation_clicked(bool checked);
void on_checkBox_AllowRunning_clicked(bool checked);
void on_checkBox_AllowBiking_clicked(bool checked);
void on_checkBox_AllowEscapeRope_clicked(bool checked);
2020-03-11 21:06:26 +00:00
void on_spinBox_FloorNumber_valueChanged(int offset);
2018-09-27 00:33:08 +01:00
void on_tabWidget_currentChanged(int index);
void on_actionUndo_triggered();
void on_actionRedo_triggered();
void on_actionZoom_In_triggered();
void on_actionZoom_Out_triggered();
void on_actionBetter_Cursors_triggered();
2019-01-09 00:04:48 +00:00
void on_actionPlayer_View_Rectangle_triggered();
void on_actionCursor_Tile_Outline_triggered();
2018-09-27 00:33:08 +01:00
void on_actionPencil_triggered();
void on_actionPointer_triggered();
void on_actionFlood_Fill_triggered();
void on_actionEyedropper_triggered();
void on_actionMove_triggered();
void on_actionMap_Shift_triggered();
void on_toolButton_deleteObject_clicked();
void on_toolButton_Open_Scripts_clicked();
void addNewEvent(QString);
void updateSelectedObjects();
2018-11-28 01:39:57 +00:00
void updateObjects();
2018-09-27 00:33:08 +01:00
void on_toolButton_Paint_clicked();
void on_toolButton_Select_clicked();
void on_toolButton_Fill_clicked();
void on_toolButton_Dropper_clicked();
void on_toolButton_Move_clicked();
void on_toolButton_Shift_clicked();
void onOpenMapListContextMenu(const QPoint &point);
void onAddNewMapToGroupClick(QAction* triggeredAction);
void onAddNewMapToAreaClick(QAction* triggeredAction);
void onAddNewMapToLayoutClick(QAction* triggeredAction);
2018-09-27 00:33:08 +01:00
void onTilesetChanged(QString);
void currentMetatilesSelectionChanged();
void on_action_Export_Map_Image_triggered();
void on_comboBox_ConnectionDirection_currentIndexChanged(const QString &arg1);
void on_spinBox_ConnectionOffset_valueChanged(int offset);
void on_comboBox_ConnectedMap_currentTextChanged(const QString &mapName);
2018-09-27 00:33:08 +01:00
void on_pushButton_AddConnection_clicked();
void on_pushButton_RemoveConnection_clicked();
void on_comboBox_DiveMap_currentTextChanged(const QString &mapName);
void on_comboBox_EmergeMap_currentTextChanged(const QString &mapName);
void on_comboBox_PrimaryTileset_currentTextChanged(const QString &arg1);
void on_comboBox_SecondaryTileset_currentTextChanged(const QString &arg1);
2018-09-27 00:33:08 +01:00
void on_pushButton_clicked();
void on_checkBox_smartPaths_stateChanged(int selected);
void on_checkBox_Visibility_clicked(bool checked);
void on_checkBox_ToggleBorder_stateChanged(int arg1);
2018-09-27 19:27:57 +01:00
void resetMapViewScale();
2018-09-29 20:13:07 +01:00
void on_actionTileset_Editor_triggered();
2018-10-05 07:02:40 +01:00
void mapSortOrder_changed(QAction *action);
void on_lineEdit_filterBox_textChanged(const QString &arg1);
void closeEvent(QCloseEvent *);
2018-11-28 01:39:57 +00:00
void eventTabChanged(int index);
2018-11-30 03:59:03 +00:00
void selectedEventIndexChanged(int index);
void on_horizontalSlider_CollisionTransparency_valueChanged(int value);
void on_toolButton_ExpandAll_clicked();
void on_toolButton_CollapseAll_clicked();
void on_actionAbout_Porymap_triggered();
2019-08-14 22:39:23 +01:00
void on_actionThemes_triggered();
void on_pushButton_AddCustomHeaderField_clicked();
void on_pushButton_DeleteCustomHeaderField_clicked();
void on_tableWidget_CustomHeaderFields_cellChanged(int row, int column);
2019-02-09 23:19:11 +00:00
void on_horizontalSlider_MetatileZoom_valueChanged(int value);
void on_pushButton_NewWildMonGroup_clicked();
void on_pushButton_ConfigureEncountersJSON_clicked();
void on_actionRegion_Map_Editor_triggered();
2018-09-27 00:33:08 +01:00
private:
Ui::MainWindow *ui;
TilesetEditor *tilesetEditor = nullptr;
RegionMapEditor *regionMapEditor = nullptr;
2019-05-21 03:08:04 +01:00
MapImageExporter *mapImageExporter = nullptr;
2018-10-05 07:02:40 +01:00
FilterChildrenProxyModel *mapListProxyModel;
NewMapPopup *newmapprompt = nullptr;
2018-09-27 00:33:08 +01:00
QStandardItemModel *mapListModel;
2018-10-05 07:02:40 +01:00
QList<QStandardItem*> *mapGroupItemsList;
2018-09-29 15:22:50 +01:00
QMap<QString, QModelIndex> mapListIndexes;
2018-09-27 00:33:08 +01:00
Editor *editor = nullptr;
QIcon* mapIcon;
2018-10-03 03:46:08 +01:00
QIcon* mapEditedIcon;
2019-02-26 01:40:46 +00:00
QIcon* mapOpenedIcon;
2018-10-05 07:02:40 +01:00
2018-11-28 01:39:57 +00:00
QWidget *eventTabObjectWidget;
QWidget *eventTabWarpWidget;
QWidget *eventTabTriggerWidget;
QWidget *eventTabBGWidget;
QWidget *eventTabHealspotWidget;
QWidget *eventTabMultipleWidget;
DraggablePixmapItem *selectedObject;
DraggablePixmapItem *selectedWarp;
DraggablePixmapItem *selectedTrigger;
DraggablePixmapItem *selectedBG;
DraggablePixmapItem *selectedHealspot;
bool isProgrammaticEventTabChange;
bool projectHasUnsavedChanges;
2018-11-28 01:39:57 +00:00
2018-12-21 15:25:28 +00:00
MapSortOrder mapSortOrder;
2018-10-05 07:02:40 +01:00
bool setMap(QString, bool scrollTreeView = false);
2018-09-27 00:33:08 +01:00
void redrawMapScene();
2020-02-12 00:34:08 +00:00
bool loadDataStructures();
bool populateMapList();
2018-10-05 07:02:40 +01:00
void sortMapList();
2018-09-27 00:33:08 +01:00
QString getExistingDirectory(QString);
bool openProject(QString dir);
2018-09-27 00:33:08 +01:00
QString getDefaultMap();
void setRecentMap(QString map_name);
QStandardItem* createMapItem(QString mapName, int groupNum, int inGroupNum);
2019-02-26 01:40:46 +00:00
void drawMapListIcons(QAbstractItemModel *model);
2018-09-27 00:33:08 +01:00
void updateMapList();
void displayMapProperties();
void checkToolButtons();
void initWindow();
void initCustomUI();
2018-09-27 00:33:08 +01:00
void initExtraShortcuts();
void initExtraSignals();
void initEditor();
2018-10-05 07:02:40 +01:00
void initMiscHeapObjects();
void initMapSortOrder();
void setProjectSpecificUIVisibility();
2018-09-27 00:33:08 +01:00
void loadUserSettings();
void restoreWindowState();
void setTheme(QString);
bool openRecentProject();
void updateTilesetEditor();
2018-11-30 03:59:03 +00:00
QString getEventGroupFromTabWidget(QWidget *tab);
2018-10-05 07:02:40 +01:00
bool isProjectOpen();
2018-09-27 00:33:08 +01:00
};
enum MapListUserRoles {
GroupRole = Qt::UserRole + 1, // Used to hold the map group number.
2018-10-05 07:02:40 +01:00
TypeRole, // Used to differentiate between the different layers of the map list tree view.
2019-02-01 17:43:25 +00:00
TypeRole2, // Used for various extra data needed.
2018-09-27 00:33:08 +01:00
};
#endif // MAINWINDOW_H