2022-08-28 23:28:36 +02:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QGraphicsScene>
|
2022-08-31 20:05:57 +02:00
|
|
|
#include <QStandardItemModel>
|
2022-09-05 02:19:21 +02:00
|
|
|
#include "mapcontroller.h"
|
2022-09-01 03:51:29 +02:00
|
|
|
#include "../lib/Terrain.h"
|
2022-08-28 23:28:36 +02:00
|
|
|
|
2022-09-01 03:51:29 +02:00
|
|
|
|
2022-08-30 00:44:02 +02:00
|
|
|
class CMap;
|
2022-09-03 06:12:07 +02:00
|
|
|
class ObjectBrowser;
|
2022-09-04 02:12:33 +02:00
|
|
|
class CGObjectInstance;
|
2022-08-30 00:44:02 +02:00
|
|
|
|
2022-08-28 23:28:36 +02:00
|
|
|
namespace Ui {
|
|
|
|
class MainWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
|
|
|
~MainWindow();
|
|
|
|
|
2022-09-05 02:19:21 +02:00
|
|
|
void initializeMap(bool isNew);
|
2022-08-30 23:24:12 +02:00
|
|
|
void reloadMap(int level = 0);
|
|
|
|
void saveMap();
|
2022-09-05 02:19:21 +02:00
|
|
|
|
|
|
|
MapView * mapView();
|
2022-08-31 20:05:57 +02:00
|
|
|
|
|
|
|
void loadObjectsTree();
|
|
|
|
|
|
|
|
void setStatusMessage(const QString & status);
|
|
|
|
|
2022-09-03 06:12:07 +02:00
|
|
|
int getMapLevel() const {return mapLevel;}
|
2022-09-05 02:19:21 +02:00
|
|
|
|
|
|
|
MapController controller;
|
2022-09-03 06:12:07 +02:00
|
|
|
|
2022-08-28 23:28:36 +02:00
|
|
|
private slots:
|
|
|
|
void on_actionOpen_triggered();
|
|
|
|
|
2022-08-30 15:08:33 +02:00
|
|
|
void on_actionSave_as_triggered();
|
|
|
|
|
|
|
|
void on_actionNew_triggered();
|
|
|
|
|
2022-08-30 23:24:12 +02:00
|
|
|
void on_actionLevel_triggered();
|
|
|
|
|
|
|
|
void on_actionSave_triggered();
|
2022-09-05 18:27:09 +02:00
|
|
|
|
|
|
|
void on_actionUndo_triggered();
|
|
|
|
|
|
|
|
void on_actionRedo_triggered();
|
2022-08-30 23:24:12 +02:00
|
|
|
|
2022-08-31 20:05:57 +02:00
|
|
|
void on_actionPass_triggered(bool checked);
|
|
|
|
|
|
|
|
void on_actionGrid_triggered(bool checked);
|
|
|
|
|
2022-09-01 03:51:29 +02:00
|
|
|
void on_toolBrush_clicked(bool checked);
|
|
|
|
|
|
|
|
void on_toolArea_clicked(bool checked);
|
|
|
|
|
|
|
|
void terrainButtonClicked(Terrain terrain);
|
|
|
|
|
2022-09-02 23:04:28 +02:00
|
|
|
void on_toolErase_clicked();
|
|
|
|
|
2022-09-03 06:12:07 +02:00
|
|
|
void on_treeView_activated(const QModelIndex &index);
|
|
|
|
|
|
|
|
void on_terrainFilterCombo_currentTextChanged(const QString &arg1);
|
|
|
|
|
|
|
|
void on_filter_textChanged(const QString &arg1);
|
|
|
|
|
2022-09-03 14:27:06 +02:00
|
|
|
void on_actionFill_triggered();
|
|
|
|
|
2022-09-03 15:43:20 +02:00
|
|
|
void on_toolBrush2_clicked(bool checked);
|
|
|
|
|
|
|
|
void on_toolBrush4_clicked(bool checked);
|
|
|
|
|
2022-09-04 02:12:33 +02:00
|
|
|
void on_inspectorWidget_itemChanged(QTableWidgetItem *item);
|
|
|
|
|
2022-09-04 18:16:36 +02:00
|
|
|
void on_actionMapSettings_triggered();
|
|
|
|
|
2022-09-04 20:01:49 +02:00
|
|
|
void on_actionPlayers_settings_triggered();
|
|
|
|
|
2022-09-06 21:16:30 +02:00
|
|
|
void on_actionValidate_triggered();
|
|
|
|
|
2022-09-02 23:04:28 +02:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void treeViewSelected(const QModelIndex &selected, const QModelIndex &deselected);
|
2022-09-05 02:19:21 +02:00
|
|
|
void loadInspector(CGObjectInstance * obj);
|
2022-09-05 04:18:38 +02:00
|
|
|
void mapChanged();
|
2022-09-05 18:27:09 +02:00
|
|
|
void enableUndo(bool enable);
|
|
|
|
void enableRedo(bool enable);
|
2022-09-02 23:04:28 +02:00
|
|
|
|
2022-09-03 06:12:07 +02:00
|
|
|
private:
|
|
|
|
void preparePreview(const QModelIndex &index, bool createNew);
|
|
|
|
void addGroupIntoCatalog(const std::string & groupName, bool staticOnly);
|
|
|
|
void addGroupIntoCatalog(const std::string & groupName, bool staticOnly, int ID);
|
|
|
|
|
2022-09-03 15:43:20 +02:00
|
|
|
void changeBrushState(int idx);
|
2022-09-06 03:46:22 +02:00
|
|
|
void setTitle();
|
2022-09-03 15:43:20 +02:00
|
|
|
|
2022-08-28 23:28:36 +02:00
|
|
|
private:
|
|
|
|
Ui::MainWindow *ui;
|
2022-09-03 06:12:07 +02:00
|
|
|
ObjectBrowser * objectBrowser = nullptr;
|
2022-09-02 23:04:28 +02:00
|
|
|
QGraphicsScene * scenePreview;
|
2022-08-30 00:44:02 +02:00
|
|
|
|
2022-08-30 15:08:33 +02:00
|
|
|
QString filename;
|
|
|
|
bool unsaved = false;
|
2022-08-30 23:24:12 +02:00
|
|
|
|
2022-08-31 20:05:57 +02:00
|
|
|
QStandardItemModel objectsModel;
|
|
|
|
|
2022-08-30 23:24:12 +02:00
|
|
|
int mapLevel = 0;
|
2022-09-03 06:12:07 +02:00
|
|
|
|
|
|
|
std::set<int> catalog;
|
2022-08-28 23:28:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|