1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-07 15:10:43 +02:00
vcmi/mapeditor/mainwindow.h

113 lines
2.2 KiB
C
Raw Normal View History

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