Included Files and Triggers improvements

This commit is contained in:
2024-01-07 16:49:13 +01:00
parent e3502e84c9
commit ef2a9e9fb8
41 changed files with 432 additions and 57 deletions

View File

@ -27,6 +27,7 @@ INCLUDEPATH += \
HEADERS += \
src/closeeventfilter.h \
src/editor/dialogs/genericcodeeditordialog.h \
src/editor/dialogs/includedfilepropertiesdialog.h \
src/editor/dialogs/transparentbackgroundsettingsdialog.h \
src/editor/editorguiutils.h \
src/editor/roomscene.h \
@ -89,6 +90,7 @@ HEADERS += \
SOURCES += \
src/closeeventfilter.cpp \
src/editor/dialogs/genericcodeeditordialog.cpp \
src/editor/dialogs/includedfilepropertiesdialog.cpp \
src/editor/dialogs/transparentbackgroundsettingsdialog.cpp \
src/editor/editorguiutils.cpp \
src/editor/roomscene.cpp \
@ -148,6 +150,7 @@ SOURCES += \
src/projectserialization.cpp
FORMS += \
src/editor/dialogs/includedfilepropertiesdialog.ui \
src/editor/dialogs/transparentbackgroundsettingsdialog.ui \
src/editor/mainwindow.ui \
src/editor/dialogs/addeventdialog.ui \

View File

@ -5,10 +5,12 @@
#include <QMenu>
#include "models/projecttreemodel.h"
#include "mainwindow.h"
AddEventDialog::AddEventDialog(ProjectTreeModel &projectModel, QWidget *parent) :
AddEventDialog::AddEventDialog(ProjectTreeModel &projectModel, MainWindow &mainWindow, QWidget *parent) :
QDialog{parent},
m_projectModel{projectModel},
m_mainWindow{mainWindow},
m_ui{std::make_unique<Ui::AddEventDialog>()}
{
m_ui->setupUi(this);
@ -80,6 +82,12 @@ AddEventDialog::AddEventDialog(ProjectTreeModel &projectModel, QWidget *parent)
});
m_ui->pushButtonCollision->setMenu(menu);
}
{
auto menu = new QMenu;
menu->addAction(tr("Add/Modify Triggers..."), this, [this](){ m_mainWindow.showDefineTriggers(); reject(); });
m_ui->pushButtonTrigger->setMenu(menu);
}
}
AddEventDialog::~AddEventDialog() = default;

View File

@ -10,13 +10,14 @@
namespace Ui { class AddEventDialog; }
class ProjectTreeModel;
class MainWindow;
class AddEventDialog : public QDialog
{
Q_OBJECT
public:
explicit AddEventDialog(ProjectTreeModel &projectModel, QWidget *parent = nullptr);
explicit AddEventDialog(ProjectTreeModel &projectModel, MainWindow &mainWindow, QWidget *parent = nullptr);
~AddEventDialog();
const std::optional<std::variant<Object::EventType, QString>> &eventType() const { return m_eventType; }
@ -26,6 +27,7 @@ public:
private:
ProjectTreeModel &m_projectModel;
MainWindow &m_mainWindow;
const std::unique_ptr<Ui::AddEventDialog> m_ui;

View File

@ -122,6 +122,10 @@
<property name="text">
<string>&amp;Trigger</string>
</property>
<property name="icon">
<iconset resource="../resources_editor.qrc">
<normaloff>:/qtgameengine/icons/trigger.png</normaloff>:/qtgameengine/icons/trigger.png</iconset>
</property>
</widget>
</item>
</layout>

View File

@ -8,9 +8,10 @@
#include "projectcontainer.h"
#include "models/projecttreemodel.h"
#include "imageeditordialog.h"
#include "mainwindow.h"
BackgroundPropertiesDialog::BackgroundPropertiesDialog(Background &background, ProjectTreeModel &projectModel, QWidget *parent) :
QDialog{parent},
BackgroundPropertiesDialog::BackgroundPropertiesDialog(Background &background, ProjectTreeModel &projectModel, MainWindow &mainWindow) :
QDialog{&mainWindow},
m_ui{std::make_unique<Ui::BackgroundPropertiesDialog>()},
m_background{background},
m_projectModel{projectModel},

View File

@ -8,13 +8,14 @@
namespace Ui { class BackgroundPropertiesDialog; }
struct Background;
class ProjectTreeModel;
class MainWindow;
class BackgroundPropertiesDialog : public QDialog
{
Q_OBJECT
public:
explicit BackgroundPropertiesDialog(Background &background, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
explicit BackgroundPropertiesDialog(Background &background, ProjectTreeModel &projectModel, MainWindow &mainWindow);
~BackgroundPropertiesDialog();
void accept() override;

View File

@ -6,9 +6,10 @@
#include "projectcontainer.h"
#include "models/projecttreemodel.h"
#include "mainwindow.h"
FontPropertiesDialog::FontPropertiesDialog(Font &font, ProjectTreeModel &projectModel, QWidget *parent) :
QDialog{parent},
FontPropertiesDialog::FontPropertiesDialog(Font &font, ProjectTreeModel &projectModel, MainWindow &mainWindow) :
QDialog{&mainWindow},
m_ui{std::make_unique<Ui::FontPropertiesDialog>()},
m_font{font},
m_projectModel{projectModel}

View File

@ -7,13 +7,14 @@
namespace Ui { class FontPropertiesDialog; }
struct Font;
class ProjectTreeModel;
class MainWindow;
class FontPropertiesDialog : public QDialog
{
Q_OBJECT
public:
explicit FontPropertiesDialog(Font &font, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
explicit FontPropertiesDialog(Font &font, ProjectTreeModel &projectModel, MainWindow &mainWindow);
~FontPropertiesDialog();
void accept() override;

View File

@ -13,19 +13,184 @@
<property name="windowTitle">
<string>Game Information</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>50</x>
<y>50</y>
<width>201</width>
<height>16</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
<item>
<widget class="QMenuBar" name="menuBar">
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="actionNew"/>
<addaction name="actionOpen"/>
<addaction name="separator"/>
<addaction name="actionSave"/>
<addaction name="actionSaveAs"/>
<addaction name="separator"/>
<addaction name="actionPrint"/>
<addaction name="actionPrintPreview"/>
<addaction name="actionExportPDF"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
<string>&amp;Edit</string>
</property>
<addaction name="actionUndo"/>
<addaction name="actionRedo"/>
<addaction name="separator"/>
<addaction name="actionCut"/>
<addaction name="actionCopy"/>
<addaction name="actionPaste"/>
</widget>
<widget class="QMenu" name="menuFormat">
<property name="title">
<string>F&amp;ormat</string>
</property>
<addaction name="actionBold"/>
<addaction name="actionItalic"/>
<addaction name="actionUnderline"/>
<addaction name="separator"/>
<addaction name="actionLeft"/>
<addaction name="actionCenter"/>
<addaction name="actionRight"/>
<addaction name="actionIndent"/>
<addaction name="actionUnindent"/>
<addaction name="separator"/>
<addaction name="actionColor"/>
<addaction name="separator"/>
<addaction name="actionChecked"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
<addaction name="menuFormat"/>
</widget>
</item>
<item>
<widget class="QToolBar" name="toolBar">
<addaction name="actionNew"/>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="actionPrint"/>
<addaction name="actionExportPDF"/>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Not yet implemented</string>
</property>
</widget>
</item>
</layout>
<action name="actionNew">
<property name="text">
<string>Not yet implemented</string>
<string>&amp;New</string>
</property>
</widget>
</action>
<action name="actionOpen">
<property name="text">
<string>&amp;Open...</string>
</property>
</action>
<action name="actionSave">
<property name="text">
<string>&amp;Save</string>
</property>
</action>
<action name="actionSaveAs">
<property name="text">
<string>Save &amp;As...</string>
</property>
</action>
<action name="actionPrint">
<property name="text">
<string>&amp;Print...</string>
</property>
</action>
<action name="actionPrintPreview">
<property name="text">
<string>Print Preview...</string>
</property>
</action>
<action name="actionExportPDF">
<property name="text">
<string>&amp;Export PDF...</string>
</property>
</action>
<action name="actionUndo">
<property name="text">
<string>&amp;Undo</string>
</property>
</action>
<action name="actionRedo">
<property name="text">
<string>&amp;Redo</string>
</property>
</action>
<action name="actionCut">
<property name="text">
<string>Cu&amp;t</string>
</property>
</action>
<action name="actionCopy">
<property name="text">
<string>&amp;Copy</string>
</property>
</action>
<action name="actionPaste">
<property name="text">
<string>&amp;Paste</string>
</property>
</action>
<action name="actionBold">
<property name="text">
<string>&amp;Bold</string>
</property>
</action>
<action name="actionItalic">
<property name="text">
<string>&amp;Italic</string>
</property>
</action>
<action name="actionUnderline">
<property name="text">
<string>&amp;Underline</string>
</property>
</action>
<action name="actionLeft">
<property name="text">
<string>&amp;Left</string>
</property>
</action>
<action name="actionCenter">
<property name="text">
<string>C&amp;enter</string>
</property>
</action>
<action name="actionRight">
<property name="text">
<string>&amp;Justify</string>
</property>
</action>
<action name="actionIndent">
<property name="text">
<string>&amp;Indent</string>
</property>
</action>
<action name="actionUnindent">
<property name="text">
<string>&amp;Unindent</string>
</property>
</action>
<action name="actionColor">
<property name="text">
<string>&amp;Color</string>
</property>
</action>
<action name="actionChecked">
<property name="text">
<string>Chec&amp;ked</string>
</property>
</action>
</widget>
<resources/>
<connections/>

View File

@ -0,0 +1,22 @@
#include "includedfilepropertiesdialog.h"
#include "ui_includedfilepropertiesdialog.h"
IncludedFilePropertiesDialog::IncludedFilePropertiesDialog(IncludedFile &includedFile, QWidget *parent) :
QDialog{parent},
m_includedFile{includedFile},
m_ui{std::make_unique<Ui::IncludedFilePropertiesDialog>()}
{
m_ui->setupUi(this);
#ifdef Q_OS_LINUX
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
#endif
setWindowFlag(Qt::WindowCloseButtonHint);
}
IncludedFilePropertiesDialog::~IncludedFilePropertiesDialog() = default;
void IncludedFilePropertiesDialog::accept()
{
QDialog::reject();
}

View File

@ -0,0 +1,25 @@
#pragma once
#include <QDialog>
#include <memory>
namespace Ui { class IncludedFilePropertiesDialog; }
struct IncludedFile;
class IncludedFilePropertiesDialog : public QDialog
{
Q_OBJECT
public:
explicit IncludedFilePropertiesDialog(IncludedFile &includedFile, QWidget *parent = nullptr);
~IncludedFilePropertiesDialog() override;
public slots:
void accept() override;
private:
IncludedFile &m_includedFile;
const std::unique_ptr<Ui::IncludedFilePropertiesDialog> m_ui;
};

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>IncludedFilePropertiesDialog</class>
<widget class="QDialog" name="IncludedFilePropertiesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>IncludedFilePropertiesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>IncludedFilePropertiesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -3,6 +3,7 @@
#include "projectcontainer.h"
#include "models/includedfilesmodel.h"
#include "dialogs/includedfilepropertiesdialog.h"
IncludedFilesDialog::IncludedFilesDialog(ProjectContainer &project, QWidget *parent) :
QDialog{parent},
@ -18,6 +19,18 @@ IncludedFilesDialog::IncludedFilesDialog(ProjectContainer &project, QWidget *par
button->setIcon(QIcon{":/qtgameengine/icons/delete.png"});
m_ui->listView->setModel(m_model.get());
connect(m_ui->pushButtonAdd, &QAbstractButton::clicked, this, &IncludedFilesDialog::addPressed);
}
IncludedFilesDialog::~IncludedFilesDialog() = default;
void IncludedFilesDialog::addPressed()
{
IncludedFile includedFile;
IncludedFilePropertiesDialog dialog{includedFile, this};
if (dialog.exec() == QDialog::Accepted)
{
// TODO
}
}

View File

@ -16,6 +16,9 @@ public:
explicit IncludedFilesDialog(ProjectContainer &project, QWidget *parent = nullptr);
~IncludedFilesDialog();
private slots:
void addPressed();
private:
const std::unique_ptr<Ui::IncludedFilesDialog> m_ui;

View File

@ -7,12 +7,16 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<height>462</height>
</rect>
</property>
<property name="windowTitle">
<string>Included Files</string>
</property>
<property name="windowIcon">
<iconset resource="../resources_editor.qrc">
<normaloff>:/qtgameengine/icons/included-files.png</normaloff>:/qtgameengine/icons/included-files.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
<item>
<widget class="QGroupBox" name="groupBox">

View File

@ -12,8 +12,8 @@
#include "models/objecteventsmodel.h"
#include "addeventdialog.h"
ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel &projectModel, MainWindow *mainWindow) :
QDialog{mainWindow},
ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel &projectModel, MainWindow &mainWindow) :
QDialog{&mainWindow},
m_ui{std::make_unique<Ui::ObjectPropertiesDialog>()},
m_object{object},
m_projectModel{projectModel},
@ -191,12 +191,6 @@ void ObjectPropertiesDialog::newSprite()
void ObjectPropertiesDialog::editSprite()
{
if (!m_mainWindow)
{
qCritical() << "no mainWindow available";
return;
}
auto &sprites = m_projectModel.project()->sprites;
const auto iter = std::find_if(std::begin(sprites), std::end(sprites),
[&](const Sprite &sprite){ return sprite.name == m_spriteName; });
@ -206,7 +200,7 @@ void ObjectPropertiesDialog::editSprite()
return;
}
m_mainWindow->openPropertiesWindowFor(*iter);
m_mainWindow.openPropertiesWindowFor(*iter);
}
void ObjectPropertiesDialog::showInformation()
@ -216,7 +210,7 @@ void ObjectPropertiesDialog::showInformation()
void ObjectPropertiesDialog::addEvent()
{
AddEventDialog dialog{m_projectModel, this};
AddEventDialog dialog{m_projectModel, m_mainWindow, this};
if (dialog.exec() == QDialog::Accepted)
if (const auto &eventType = dialog.eventType())
if (!m_eventsModel->addEvent(*eventType))
@ -248,7 +242,7 @@ void ObjectPropertiesDialog::replaceEvent()
std::variant<Object::EventType, QString> x = event->first;
AddEventDialog dialog{m_projectModel, this};
AddEventDialog dialog{m_projectModel, m_mainWindow, this};
if (dialog.exec() == QDialog::Accepted)
if (const auto &eventType = dialog.eventType())
if (!m_eventsModel->changeEvent(event->first, *eventType))
@ -432,7 +426,7 @@ void ObjectPropertiesDialog::setParent(const Object &object)
{
if (&m_object == &object)
{
QMessageBox::warning(m_mainWindow, tr("This will create a loop in parents."), tr("This will create a loop in parents."));
QMessageBox::warning(this, tr("This will create a loop in parents."), tr("This will create a loop in parents."));
return;
}

View File

@ -18,7 +18,7 @@ class ObjectPropertiesDialog : public QDialog
Q_OBJECT
public:
explicit ObjectPropertiesDialog(Object &object, ProjectTreeModel &projectModel, MainWindow *mainWindow);
explicit ObjectPropertiesDialog(Object &object, ProjectTreeModel &projectModel, MainWindow &mainWindow);
~ObjectPropertiesDialog();
void accept() override;
@ -62,7 +62,7 @@ private:
Object &m_object;
ProjectTreeModel &m_projectModel;
MainWindow * const m_mainWindow;
MainWindow &m_mainWindow;
Object::events_container_t m_events;
Object::collision_events_container_t m_collisionEvents;

View File

@ -12,9 +12,10 @@
#include "projectcontainer.h"
#include "models/projecttreemodel.h"
#include "models/pathpointsmodel.h"
#include "mainwindow.h"
PathPropertiesDialog::PathPropertiesDialog(Path &path, ProjectTreeModel &projectModel, QWidget *parent) :
QDialog{parent},
PathPropertiesDialog::PathPropertiesDialog(Path &path, ProjectTreeModel &projectModel, MainWindow &mainWindow) :
QDialog{&mainWindow},
m_ui{std::make_unique<Ui::PathPropertiesDialog>()},
m_path{path},
m_projectModel{projectModel},

View File

@ -13,13 +13,14 @@ class QMenu;
namespace Ui { class PathPropertiesDialog; }
class ProjectTreeModel;
class PathPointsModel;
class MainWindow;
class PathPropertiesDialog : public QDialog
{
Q_OBJECT
public:
explicit PathPropertiesDialog(Path &path, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
explicit PathPropertiesDialog(Path &path, ProjectTreeModel &projectModel, MainWindow &mainWindow);
~PathPropertiesDialog();
void accept() override;

View File

@ -13,9 +13,10 @@
#include "roomscene.h"
#include "editorguiutils.h"
#include "genericcodeeditordialog.h"
#include "mainwindow.h"
RoomPropertiesDialog::RoomPropertiesDialog(Room &room, ProjectTreeModel &projectModel, QWidget *parent) :
QDialog{parent},
RoomPropertiesDialog::RoomPropertiesDialog(Room &room, ProjectTreeModel &projectModel, MainWindow &mainWindow) :
QDialog{&mainWindow},
m_ui{std::make_unique<Ui::RoomPropertiesDialog>()},
m_room{room},
m_projectModel{projectModel},

View File

@ -15,13 +15,14 @@ struct Sprite;
struct Object;
class ProjectTreeModel;
class RoomScene;
class MainWindow;
class RoomPropertiesDialog : public QDialog
{
Q_OBJECT
public:
explicit RoomPropertiesDialog(Room &room, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
explicit RoomPropertiesDialog(Room &room, ProjectTreeModel &projectModel, MainWindow &mainWindow);
~RoomPropertiesDialog();
void accept() override;

View File

@ -8,9 +8,10 @@
#include "projectcontainer.h"
#include "models/projecttreemodel.h"
#include "mainwindow.h"
ScriptPropertiesDialog::ScriptPropertiesDialog(Script &script, ProjectTreeModel &projectModel, QWidget *parent) :
CodeEditorDialog{tr("Script Properties: %0").arg(script.name), parent},
ScriptPropertiesDialog::ScriptPropertiesDialog(Script &script, ProjectTreeModel &projectModel, MainWindow &mainWindow) :
CodeEditorDialog{tr("Script Properties: %0").arg(script.name), &mainWindow},
m_script{script},
m_projectModel{projectModel},
m_lineEditName{new QLineEdit{this}}

View File

@ -3,13 +3,14 @@
class QLineEdit;
struct Script;
class ProjectTreeModel;
class MainWindow;
class ScriptPropertiesDialog : public CodeEditorDialog
{
Q_OBJECT
public:
ScriptPropertiesDialog(Script &script, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
ScriptPropertiesDialog(Script &script, ProjectTreeModel &projectModel, MainWindow &mainWindow);
void accept() override;

View File

@ -9,9 +9,10 @@
#include "projectcontainer.h"
#include "models/projecttreemodel.h"
#include "mainwindow.h"
SoundPropertiesDialog::SoundPropertiesDialog(Sound &sound, ProjectTreeModel &projectModel, QWidget *parent) :
QDialog{parent},
SoundPropertiesDialog::SoundPropertiesDialog(Sound &sound, ProjectTreeModel &projectModel, MainWindow &mainWindow) :
QDialog{&mainWindow},
m_ui{std::make_unique<Ui::SoundPropertiesDialog>()},
m_sound{sound},
m_projectModel{projectModel},

View File

@ -9,13 +9,14 @@
namespace Ui { class SoundPropertiesDialog; }
struct Sound;
class ProjectTreeModel;
class MainWindow;
class SoundPropertiesDialog : public QDialog
{
Q_OBJECT
public:
explicit SoundPropertiesDialog(Sound &sound, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
explicit SoundPropertiesDialog(Sound &sound, ProjectTreeModel &projectModel, MainWindow &mainWindow);
~SoundPropertiesDialog();
void accept() override;

View File

@ -10,9 +10,10 @@
#include "models/projecttreemodel.h"
#include "editspritedialog.h"
#include "maskpropertiesdialog.h"
#include "mainwindow.h"
SpritePropertiesDialog::SpritePropertiesDialog(Sprite &sprite, ProjectTreeModel &projectModel, QWidget *parent) :
QDialog{parent},
SpritePropertiesDialog::SpritePropertiesDialog(Sprite &sprite, ProjectTreeModel &projectModel, MainWindow &mainWindow) :
QDialog{&mainWindow},
m_ui{std::make_unique<Ui::SpritePropertiesDialog>()},
m_sprite{sprite},
m_projectModel{projectModel},

View File

@ -8,13 +8,14 @@
namespace Ui { class SpritePropertiesDialog; }
struct Sprite;
class ProjectTreeModel;
class MainWindow;
class SpritePropertiesDialog : public QDialog
{
Q_OBJECT
public:
explicit SpritePropertiesDialog(Sprite &sprite, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
explicit SpritePropertiesDialog(Sprite &sprite, ProjectTreeModel &projectModel, MainWindow &mainWindow);
~SpritePropertiesDialog();
void accept() override;

View File

@ -11,9 +11,10 @@
#include "models/projecttreemodel.h"
#include "models/timelinemomentsmodel.h"
#include "dialogs/deletemomentsdialog.h"
#include "mainwindow.h"
TimeLinePropertiesDialog::TimeLinePropertiesDialog(TimeLine &timeLine, ProjectTreeModel &projectModel, QWidget *parent) :
QDialog{parent},
TimeLinePropertiesDialog::TimeLinePropertiesDialog(TimeLine &timeLine, ProjectTreeModel &projectModel, MainWindow &mainWindow) :
QDialog{&mainWindow},
m_ui{std::make_unique<Ui::TimeLinePropertiesDialog>()},
m_timeLine{timeLine},
m_projectModel{projectModel},

View File

@ -9,13 +9,14 @@
namespace Ui { class TimeLinePropertiesDialog; }
class ProjectTreeModel;
class TimelineMomentsModel;
class MainWindow;
class TimeLinePropertiesDialog : public QDialog
{
Q_OBJECT
public:
explicit TimeLinePropertiesDialog(TimeLine &timeLine, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
explicit TimeLinePropertiesDialog(TimeLine &timeLine, ProjectTreeModel &projectModel, MainWindow &mainWindow);
~TimeLinePropertiesDialog();
void accept() override;

View File

@ -13,6 +13,10 @@
<property name="windowTitle">
<string>Triggers</string>
</property>
<property name="windowIcon">
<iconset resource="../resources_editor.qrc">
<normaloff>:/qtgameengine/icons/trigger.png</normaloff>:/qtgameengine/icons/trigger.png</iconset>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<item>
<layout class="QVBoxLayout" name="verticalLayout">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -232,7 +232,7 @@ void MainWindow::openPropertiesWindowFor(T &entry)
return;
}
auto dialog = new PropertiesDialogFor<T>{entry, *m_projectTreeModel, this};
auto dialog = new PropertiesDialogFor<T>{entry, *m_projectTreeModel, *this};
auto subwindow = m_ui->mdiArea->addSubWindow(dialog);
auto action = m_ui->menuWindow->addAction(dialog->windowTitle());
m_actionGroupWindows->addAction(action);

View File

@ -65,7 +65,9 @@ private slots:
void showGlobalGameSettings();
void showExtensionPackages();
void showDefineConstants();
public slots:
void showDefineTriggers();
private slots:
void showIncludedFiles();
void runGame();
void debugGame();

View File

@ -634,6 +634,10 @@
</property>
</action>
<action name="actionDefineTriggers">
<property name="icon">
<iconset resource="resources_editor.qrc">
<normaloff>:/qtgameengine/icons/trigger.png</normaloff>:/qtgameengine/icons/trigger.png</iconset>
</property>
<property name="text">
<string>&amp;Define Triggers...</string>
</property>
@ -642,6 +646,10 @@
</property>
</action>
<action name="actionIncludedFiles">
<property name="icon">
<iconset resource="resources_editor.qrc">
<normaloff>:/qtgameengine/icons/included-files.png</normaloff>:/qtgameengine/icons/included-files.png</iconset>
</property>
<property name="text">
<string>Inc&amp;luded Files...</string>
</property>

View File

@ -49,6 +49,7 @@
<file>icons/grid.png</file>
<file>icons/help.png</file>
<file>icons/import-resources.png</file>
<file>icons/included-files.png</file>
<file>icons/info.png</file>
<file>icons/isometric.png</file>
<file>icons/lock.png</file>
@ -90,6 +91,7 @@
<file>icons/tile.png</file>
<file>icons/timeline-file.png</file>
<file>icons/timeline.png</file>
<file>icons/trigger.png</file>
<file>icons/undo.png</file>
<file>icons/unlock.png</file>
<file>icons/blue-arrow-down.png</file>

View File

@ -5,7 +5,6 @@
#include <QDrag>
#include <QMimeData>
#include "projectcontainer.h"
#include "projectserialization.h"
#include "stdserialization.h"
@ -39,7 +38,7 @@ void ActionDragWidget::mouseMoveEvent(QMouseEvent *event)
QMimeData *mimeData = new QMimeData;
QByteArray encoded;
QDataStream stream(&encoded, QDataStream::WriteOnly);
stream << Action{ExecuteCodeAction{ .script = "hatschi" }};
stream << m_action;
mimeData->setData("custom", encoded);
drag->setMimeData(mimeData);

View File

@ -3,6 +3,8 @@
#include <QToolButton>
#include <QPoint>
#include "projectcontainer.h"
class ActionDragWidget : public QToolButton
{
Q_OBJECT
@ -10,10 +12,16 @@ class ActionDragWidget : public QToolButton
public:
explicit ActionDragWidget(QWidget *parent = nullptr);
const Action &action() const { return m_action; }
void setAction(Action &&action) { m_action = std::move(action); }
void setAction(const Action &action) { m_action = action; }
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
private:
QPoint m_dragStartPosition;
Action m_action;
};

View File

@ -277,9 +277,14 @@ struct Room
std::vector<Object> objects;
};
struct IncludedFile {
};
struct ProjectContainer
{
GlobalGameSettings globalGameSettings;
std::list<Sprite> sprites;
std::list<Sound> sounds;
std::list<Background> backgrounds;
@ -290,6 +295,8 @@ struct ProjectContainer
std::list<Object> objects;
std::list<Room> rooms;
std::list<IncludedFile> includedFiles;
template<typename T> std::list<T> &containerFor();
template<typename T> const std::list<T> &containerFor() const;
};

View File

@ -408,6 +408,20 @@ QDataStream &operator>>(QDataStream &ds, Room &room)
return ds;
}
QDataStream &operator<<(QDataStream &ds, const IncludedFile &includedFile)
{
Q_UNUSED(includedFile);
//ds << includedFile.;
return ds;
}
QDataStream &operator>>(QDataStream &ds, IncludedFile &includedFile)
{
Q_UNUSED(includedFile);
//ds >> includedFile.;
return ds;
}
QDataStream &operator<<(QDataStream &ds, const ProjectContainer &project)
{
ds << project.globalGameSettings
@ -419,7 +433,8 @@ QDataStream &operator<<(QDataStream &ds, const ProjectContainer &project)
<< project.fonts
<< project.timeLines
<< project.objects
<< project.rooms;
<< project.rooms
<< project.includedFiles;
return ds;
}
@ -434,6 +449,7 @@ QDataStream &operator>>(QDataStream &ds, ProjectContainer &project)
>> project.fonts
>> project.timeLines
>> project.objects
>> project.rooms;
>> project.rooms
>> project.includedFiles;
return ds;
}

View File

@ -44,5 +44,7 @@ QDataStream &operator<<(QDataStream &ds, const Room::Object &object);
QDataStream &operator>>(QDataStream &ds, Room::Object &object);
QDataStream &operator<<(QDataStream &ds, const Room &room);
QDataStream &operator>>(QDataStream &ds, Room &room);
QDataStream &operator<<(QDataStream &ds, const IncludedFile &includedFile);
QDataStream &operator>>(QDataStream &ds, IncludedFile &includedFile);
QDataStream &operator<<(QDataStream &ds, const ProjectContainer &project);;
QDataStream &operator>>(QDataStream &ds, ProjectContainer &project);;