2022-01-09 06:42:13 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
|
#include "projectcontainer.h"
|
|
|
|
|
|
|
|
|
|
class QMdiSubWindow;
|
2022-01-15 01:52:55 +01:00
|
|
|
class QActionGroup;
|
2022-01-09 06:42:13 +01:00
|
|
|
namespace Ui { class MainWindow; }
|
2025-11-30 19:43:05 +01:00
|
|
|
class EditorSettings;
|
2022-01-09 06:42:13 +01:00
|
|
|
class ProjectTreeModel;
|
|
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2025-11-30 19:43:05 +01:00
|
|
|
explicit MainWindow(const QString &filePath, EditorSettings &settings, QWidget *parent = nullptr);
|
2022-01-09 06:42:13 +01:00
|
|
|
~MainWindow();
|
|
|
|
|
|
2025-11-30 19:43:05 +01:00
|
|
|
EditorSettings &settings() { return m_settings; }
|
|
|
|
|
const EditorSettings &settings() const { return m_settings; }
|
|
|
|
|
|
2024-01-02 19:54:25 +01:00
|
|
|
private:
|
|
|
|
|
template<typename T>
|
|
|
|
|
std::map<T*, QMdiSubWindow*> &propertyWindowsFor();
|
|
|
|
|
|
|
|
|
|
public:
|
2023-12-29 10:49:04 +01:00
|
|
|
template<typename T>
|
|
|
|
|
void openPropertiesWindowFor(T &entry);
|
|
|
|
|
|
2022-01-09 06:42:13 +01:00
|
|
|
protected:
|
|
|
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void contextMenuRequested(const QPoint &pos);
|
2025-11-29 19:36:21 +01:00
|
|
|
void activated(const QModelIndex &index);
|
2022-01-09 06:42:13 +01:00
|
|
|
void selectionChanged(const QModelIndex &index);
|
2022-01-09 21:07:41 +01:00
|
|
|
void modelErrorOccured(const QString &message);
|
2022-01-10 21:49:06 +01:00
|
|
|
void changed();
|
2022-01-09 06:42:13 +01:00
|
|
|
|
|
|
|
|
void newFile();
|
|
|
|
|
void openFile();
|
|
|
|
|
void saveFile();
|
|
|
|
|
void saveFileAs();
|
|
|
|
|
void createExecutable();
|
|
|
|
|
void publishGame();
|
|
|
|
|
void importResources();
|
|
|
|
|
void exportResources();
|
|
|
|
|
void preferences();
|
|
|
|
|
void create();
|
|
|
|
|
void duplicate();
|
|
|
|
|
void createGroup();
|
|
|
|
|
void sortByName();
|
|
|
|
|
void delete_();
|
|
|
|
|
void rename();
|
|
|
|
|
void showProperties();
|
2022-01-09 21:07:41 +01:00
|
|
|
void findResource();
|
|
|
|
|
void showObjectInformation();
|
2024-01-06 17:19:08 +01:00
|
|
|
void transparentBackgroundSettings();
|
2022-01-10 01:43:41 +01:00
|
|
|
private:
|
|
|
|
|
template<typename T>
|
|
|
|
|
void createFor();
|
|
|
|
|
private slots:
|
2022-01-09 06:42:13 +01:00
|
|
|
void showGameInformation();
|
|
|
|
|
void showGlobalGameSettings();
|
|
|
|
|
void showExtensionPackages();
|
2022-01-10 21:49:06 +01:00
|
|
|
void showDefineConstants();
|
2024-01-07 16:49:13 +01:00
|
|
|
public slots:
|
2022-01-10 21:49:06 +01:00
|
|
|
void showDefineTriggers();
|
2024-01-07 16:49:13 +01:00
|
|
|
private slots:
|
2022-01-10 21:49:06 +01:00
|
|
|
void showIncludedFiles();
|
2022-01-15 01:52:55 +01:00
|
|
|
void runGame();
|
|
|
|
|
void debugGame();
|
2022-01-09 06:42:13 +01:00
|
|
|
void about();
|
|
|
|
|
|
|
|
|
|
void rowsInserted(const QModelIndex &parent, int first, int last);
|
|
|
|
|
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
|
|
|
|
|
void modelAboutToBeReset();
|
|
|
|
|
|
|
|
|
|
private:
|
2022-01-15 01:52:55 +01:00
|
|
|
void setupStylesMenu();
|
2022-01-11 02:35:26 +01:00
|
|
|
void loadFile(const QString &path);
|
2022-01-09 06:42:13 +01:00
|
|
|
void updateTitle();
|
2025-12-20 15:05:27 +01:00
|
|
|
void updateVisibilities();
|
2022-01-09 06:42:13 +01:00
|
|
|
|
2025-12-08 10:07:11 +01:00
|
|
|
QMdiSubWindow *addSubWindow(QDialog *dialog);
|
|
|
|
|
|
2022-01-10 21:49:06 +01:00
|
|
|
template<typename T, typename ...Targs>
|
|
|
|
|
void openOrActivateWindow(QMdiSubWindow * &ptr, Targs &&...args);
|
|
|
|
|
|
2022-01-10 01:43:41 +01:00
|
|
|
template<typename T>
|
2025-11-29 19:36:21 +01:00
|
|
|
bool activatedFor(const QModelIndex &index);
|
2022-01-10 01:43:41 +01:00
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
bool rowsAboutToBeRemovedFor(const QModelIndex &parent, int first, int last);
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
|
void modelAboutToBeResetFor();
|
|
|
|
|
|
2022-01-09 06:42:13 +01:00
|
|
|
const std::unique_ptr<Ui::MainWindow> m_ui;
|
|
|
|
|
|
2025-11-30 19:43:05 +01:00
|
|
|
EditorSettings &m_settings;
|
|
|
|
|
|
2022-01-09 06:42:13 +01:00
|
|
|
ProjectContainer m_project;
|
|
|
|
|
|
|
|
|
|
QString m_filePath;
|
|
|
|
|
bool m_unsavedChanges{};
|
|
|
|
|
|
|
|
|
|
const std::unique_ptr<ProjectTreeModel> m_projectTreeModel;
|
|
|
|
|
|
2022-01-09 21:07:41 +01:00
|
|
|
std::map<Sprite*, QMdiSubWindow*> m_spritePropertiesWindows;
|
|
|
|
|
std::map<Sound*, QMdiSubWindow*> m_soundPropertiesWindows;
|
|
|
|
|
std::map<Background*, QMdiSubWindow*> m_backgroundPropertiesWindows;
|
|
|
|
|
std::map<Path*, QMdiSubWindow*> m_pathPropertiesWindows;
|
|
|
|
|
std::map<Script*, QMdiSubWindow*> m_scriptPropertiesWindows;
|
|
|
|
|
std::map<Font*, QMdiSubWindow*> m_fontPropertiesWindows;
|
2022-01-10 01:43:41 +01:00
|
|
|
std::map<TimeLine*, QMdiSubWindow*> m_timeLinePropertiesWindows;
|
|
|
|
|
std::map<Object*, QMdiSubWindow*> m_objectPropertiesWindows;
|
|
|
|
|
std::map<Room*, QMdiSubWindow*> m_roomPropertiesWindows;
|
2022-01-09 21:07:41 +01:00
|
|
|
|
|
|
|
|
QMdiSubWindow *m_objectInformationWindow{};
|
2022-01-10 21:49:06 +01:00
|
|
|
QMdiSubWindow *m_userDefinedConstantsWindow{};
|
|
|
|
|
QMdiSubWindow *m_triggersWindow{};
|
|
|
|
|
QMdiSubWindow *m_includedFilesWindow{};
|
2022-01-15 01:52:55 +01:00
|
|
|
|
|
|
|
|
QActionGroup *m_actionGroupViewMode{};
|
|
|
|
|
QActionGroup *m_actionGroupStyles{};
|
|
|
|
|
QActionGroup *m_actionGroupWindows{};
|
2022-01-09 06:42:13 +01:00
|
|
|
};
|