Implemented actions widget and editing functionalities
This commit is contained in:
1 parent
8d45958d45
commit
0b4c275dfc
464 files changed
+36929
-439
No files matched your search
@@ -21,10 +21,12 @@ AddEventDialog::AddEventDialog(QWidget *parent) :
|
||||
|
||||
connect(m_ui->pushButtonCreate, &QAbstractButton::clicked,
|
||||
this, [this](){ m_eventType = Object::EventType::Create; accept(); });
|
||||
connect(m_ui->pushButtonStep, &QAbstractButton::clicked,
|
||||
this, [this](){ m_eventType = Object::EventType::Step; accept(); });
|
||||
connect(m_ui->pushButtonDestroy, &QAbstractButton::clicked,
|
||||
this, [this](){ m_eventType = Object::EventType::Destroy; accept(); });
|
||||
connect(m_ui->pushButtonDraw, &QAbstractButton::clicked,
|
||||
this, [this](){ m_eventType = Object::EventType::Draw; accept(); });
|
||||
connect(m_ui->pushButtonStep, &QAbstractButton::clicked,
|
||||
this, [this](){ m_eventType = Object::EventType::Step; accept(); });
|
||||
}
|
||||
|
||||
AddEventDialog::~AddEventDialog() = default;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>265</width>
|
||||
<height>220</height>
|
||||
<height>221</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -21,6 +21,10 @@
|
||||
<property name="text">
|
||||
<string>Dra&w</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/event-draw.png</normaloff>:/qtgameengine/icons/event-draw.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "projecttreemodel.h"
|
||||
#include "models/projecttreemodel.h"
|
||||
#include "imageeditordialog.h"
|
||||
|
||||
BackgroundPropertiesDialog::BackgroundPropertiesDialog(Background &background, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "codeactiondialog.h"
|
||||
|
||||
#include <QRadioButton>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
|
||||
CodeActionDialog::CodeActionDialog(Action &action, QWidget *parent) :
|
||||
CodeEditorDialog{tr("Execute Code"), parent},
|
||||
m_action{action},
|
||||
m_radioButtonSelf{new QRadioButton{tr("Self"), this}},
|
||||
m_radioButtonOther{new QRadioButton{tr("Other"), this}},
|
||||
m_radioButtonObject{new QRadioButton{tr("Object"), this}}
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowCloseButtonHint);
|
||||
|
||||
addToolbarWidget(new QLabel{tr("Applies to:"), this});
|
||||
addToolbarWidget(m_radioButtonSelf);
|
||||
addToolbarWidget(m_radioButtonOther);
|
||||
addToolbarWidget(m_radioButtonObject);
|
||||
|
||||
m_radioButtonSelf->setChecked(m_action.appliesTo == Action::AppliesTo::Self);
|
||||
m_radioButtonOther->setChecked(m_action.appliesTo == Action::AppliesTo::Other);
|
||||
m_radioButtonObject->setChecked(m_action.appliesTo == Action::AppliesTo::Object);
|
||||
|
||||
setScript(m_action.script);
|
||||
|
||||
connect(m_radioButtonSelf, &QRadioButton::toggled,
|
||||
this, &CodeActionDialog::changed);
|
||||
connect(m_radioButtonOther, &QRadioButton::toggled,
|
||||
this, &CodeActionDialog::changed);
|
||||
connect(m_radioButtonObject, &QRadioButton::toggled,
|
||||
this, &CodeActionDialog::changed);
|
||||
}
|
||||
|
||||
void CodeActionDialog::accept()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_radioButtonSelf->isChecked())
|
||||
m_action.appliesTo = Action::AppliesTo::Self;
|
||||
else if (m_radioButtonOther->isChecked())
|
||||
m_action.appliesTo = Action::AppliesTo::Other;
|
||||
else if (m_radioButtonObject->isChecked())
|
||||
m_action.appliesTo = Action::AppliesTo::Object;
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this, tr("No Applies To selected!"), tr("No Applies To selected!"));
|
||||
return;
|
||||
}
|
||||
|
||||
m_action.script = script();
|
||||
|
||||
CodeEditorDialog::accept();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "codeeditordialog.h"
|
||||
|
||||
class QRadioButton;
|
||||
struct Action;
|
||||
|
||||
class CodeActionDialog : public CodeEditorDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CodeActionDialog(Action &action, QWidget *parent = nullptr);
|
||||
|
||||
void accept() override;
|
||||
|
||||
private:
|
||||
Action &m_action;
|
||||
|
||||
QRadioButton * const m_radioButtonSelf;
|
||||
QRadioButton * const m_radioButtonOther;
|
||||
QRadioButton * const m_radioButtonObject;
|
||||
};
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <QTextBlock>
|
||||
#include <QMessageBox>
|
||||
#include <QSignalBlocker>
|
||||
#include <QFileDialog>
|
||||
#include <QFile>
|
||||
|
||||
#include "jshighlighter.h"
|
||||
|
||||
@@ -77,7 +79,7 @@ void CodeEditorDialog::reject()
|
||||
tr("Do you want to save your changes?"),
|
||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
|
||||
QMessageBox::Save
|
||||
);
|
||||
);
|
||||
switch (result)
|
||||
{
|
||||
case QMessageBox::Save:
|
||||
@@ -120,17 +122,45 @@ void CodeEditorDialog::addToolbarWidget(QWidget *widget)
|
||||
|
||||
void CodeEditorDialog::load()
|
||||
{
|
||||
const auto path = QFileDialog::getOpenFileName(this, tr("Load Code from a Text File..."));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
QFile file{path};
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Could not open file!"), tr("Could not open file!") + "\n\n" + file.errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
m_ui->codeEdit->setPlainText(QString::fromUtf8(file.readAll()));
|
||||
}
|
||||
|
||||
void CodeEditorDialog::save()
|
||||
{
|
||||
const auto path = QFileDialog::getSaveFileName(this, tr("Save Code to a Text File..."));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
QFile file{path};
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Could not open file!"), tr("Could not open file!") + "\n\n" + file.errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
auto asUtf8 = script().toUtf8();
|
||||
const auto size = asUtf8.size();
|
||||
if (const auto written = file.write(std::move(asUtf8)); written != size)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Could not write file!"), tr("Could not write file!") + "\n\n" + tr("written(%0) != size(%1)") + "\n\n" + file.errorString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CodeEditorDialog::print()
|
||||
{
|
||||
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void CodeEditorDialog::updatePosition()
|
||||
|
||||
@@ -384,7 +384,7 @@
|
||||
<customwidget>
|
||||
<class>CodeEditorWidget</class>
|
||||
<extends>QPlainTextEdit</extends>
|
||||
<header>codeeditorwidget.h</header>
|
||||
<header>widgets/codeeditorwidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "deletemomentsdialog.h"
|
||||
#include "ui_deletemomentsdialog.h"
|
||||
|
||||
DeleteMomentsDialog::DeleteMomentsDialog(QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::DeleteMomentsDialog>()}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
DeleteMomentsDialog::DeleteMomentsDialog(int fromMoment, int tillMoment, QWidget *parent) :
|
||||
DeleteMomentsDialog{parent}
|
||||
{
|
||||
setFromMoment(fromMoment);
|
||||
setTillMoment(tillMoment);
|
||||
}
|
||||
|
||||
DeleteMomentsDialog::~DeleteMomentsDialog() = default;
|
||||
|
||||
int DeleteMomentsDialog::fromMoment() const
|
||||
{
|
||||
return m_ui->spinBoxFromMoment->value();
|
||||
}
|
||||
|
||||
void DeleteMomentsDialog::setFromMoment(int fromMoment)
|
||||
{
|
||||
m_ui->spinBoxFromMoment->setValue(fromMoment);
|
||||
}
|
||||
|
||||
int DeleteMomentsDialog::tillMoment() const
|
||||
{
|
||||
return m_ui->spinBoxTillMoment->value();
|
||||
}
|
||||
|
||||
void DeleteMomentsDialog::setTillMoment(int tillMoment)
|
||||
{
|
||||
m_ui->spinBoxTillMoment->setValue(tillMoment);
|
||||
}
|
||||
|
||||
void DeleteMomentsDialog::setFromTillMoment(int fromMoment, int tillMoment)
|
||||
{
|
||||
setFromMoment(fromMoment);
|
||||
setTillMoment(tillMoment);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Ui { class DeleteMomentsDialog; }
|
||||
|
||||
class DeleteMomentsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeleteMomentsDialog(QWidget *parent = nullptr);
|
||||
explicit DeleteMomentsDialog(int fromMoment, int tillMoment, QWidget *parent = nullptr);
|
||||
~DeleteMomentsDialog();
|
||||
|
||||
int fromMoment() const;
|
||||
void setFromMoment(int fromMoment);
|
||||
|
||||
int tillMoment() const;
|
||||
void setTillMoment(int tillMoment);
|
||||
|
||||
void setFromTillMoment(int fromMoment, int tillMoment);
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::DeleteMomentsDialog> m_ui;
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DeleteMomentsDialog</class>
|
||||
<widget class="QDialog" name="DeleteMomentsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>218</width>
|
||||
<height>139</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Deleting Moments</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelFromMoment">
|
||||
<property name="text">
|
||||
<string>From moment:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxFromMoment</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelTillMoment">
|
||||
<property name="text">
|
||||
<string>Till moment:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxTillMoment</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxFromMoment">
|
||||
<property name="maximum">
|
||||
<number>2147483647</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxTillMoment">
|
||||
<property name="maximum">
|
||||
<number>2147483647</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DeleteMomentsDialog</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>DeleteMomentsDialog</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>
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "spritesmodel.h"
|
||||
#include "models/spritesmodel.h"
|
||||
#include "createspritedialog.h"
|
||||
#include "imageeditordialog.h"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "projecttreemodel.h"
|
||||
#include "models/projecttreemodel.h"
|
||||
|
||||
FontPropertiesDialog::FontPropertiesDialog(Font &font, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
|
||||
@@ -301,7 +301,7 @@
|
||||
<customwidget>
|
||||
<class>DrawingCanvasWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>drawingcanvaswidget.h</header>
|
||||
<header>widgets/drawingcanvaswidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "ui_includedfilesdialog.h"
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "includedfilesmodel.h"
|
||||
#include "models/includedfilesmodel.h"
|
||||
|
||||
IncludedFilesDialog::IncludedFilesDialog(ProjectContainer &project, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "projecttreemodel.h"
|
||||
#include "objecteventsmodel.h"
|
||||
#include "objectactionsmodel.h"
|
||||
#include "models/projecttreemodel.h"
|
||||
#include "models/objecteventsmodel.h"
|
||||
#include "addeventdialog.h"
|
||||
|
||||
ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
@@ -19,7 +18,6 @@ ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel
|
||||
m_projectModel{projectModel},
|
||||
m_events{m_object.events},
|
||||
m_eventsModel{std::make_unique<ObjectEventsModel>(m_events)},
|
||||
m_actionsModel{std::make_unique<ObjectActionsModel>()},
|
||||
m_spritesMenu{new QMenu{m_ui->toolButtonSprite}},
|
||||
m_spriteName{object.spriteName}
|
||||
{
|
||||
@@ -55,6 +53,15 @@ ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel
|
||||
connect(&m_projectModel, &ProjectTreeModel::objectNameChanged,
|
||||
this, &ObjectPropertiesDialog::objectNameChanged);
|
||||
|
||||
connect(m_eventsModel.get(), &QAbstractItemModel::modelReset,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
connect(m_eventsModel.get(), &QAbstractItemModel::rowsInserted,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
connect(m_eventsModel.get(), &QAbstractItemModel::dataChanged,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
connect(m_eventsModel.get(), &QAbstractItemModel::rowsRemoved,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
|
||||
connect(m_ui->pushButtonNewSprite, &QAbstractButton::clicked,
|
||||
this, &ObjectPropertiesDialog::newSprite);
|
||||
connect(m_ui->pushButtonEditSprite, &QAbstractButton::clicked,
|
||||
@@ -81,6 +88,15 @@ ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel
|
||||
|
||||
connect(m_spritesMenu, &QMenu::aboutToShow,
|
||||
this, &ObjectPropertiesDialog::spritesMenuAboutToShow);
|
||||
|
||||
connect(m_ui->listViewEvents->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||
this, &ObjectPropertiesDialog::currentEventChanged);
|
||||
|
||||
connect(m_ui->listViewEvents, &QListView::customContextMenuRequested,
|
||||
this, &ObjectPropertiesDialog::eventsContextMenuRequested);
|
||||
|
||||
connect(m_ui->actionsWidget, &ActionsContainerWidget::changed,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
}
|
||||
|
||||
ObjectPropertiesDialog::~ObjectPropertiesDialog() = default;
|
||||
@@ -162,22 +178,43 @@ void ObjectPropertiesDialog::addEvent()
|
||||
AddEventDialog dialog{this};
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
if (!m_events.contains(dialog.eventType()))
|
||||
{
|
||||
m_eventsModel->beginResetModel();
|
||||
m_events[dialog.eventType()];
|
||||
m_eventsModel->endResetModel();
|
||||
m_unsavedChanges = true;
|
||||
}
|
||||
if (!m_eventsModel->addEvent(dialog.eventType()))
|
||||
QMessageBox::warning(this, tr("Could not add Event!"), tr("Could not add Event!"));
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::deleteEvent()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
const auto index = m_ui->listViewEvents->currentIndex();
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
if (QMessageBox::question(this, tr("Confirm"), tr("Are you sure, that you really want to remove the event with all its actions?")) != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
if (!m_eventsModel->removeRow(index.row()))
|
||||
QMessageBox::warning(this, tr("Could not delete Event!"), tr("Could not delete Event!"));
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::replaceEvent()
|
||||
{
|
||||
const auto index = m_ui->listViewEvents->currentIndex();
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
const auto event = m_eventsModel->getEvent(index);
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
AddEventDialog dialog{this};
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
if (!m_eventsModel->changeEvent(event->first, dialog.eventType()))
|
||||
QMessageBox::warning(this, tr("Could not change Event!"), tr("Could not change Event!"));
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::duplicateEvent()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
@@ -215,6 +252,35 @@ void ObjectPropertiesDialog::spritesMenuAboutToShow()
|
||||
[&sprite,this](){ setSprite(sprite); });
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::currentEventChanged(const QModelIndex &index)
|
||||
{
|
||||
if (index.isValid())
|
||||
{
|
||||
if (auto event = m_eventsModel->getEvent(index))
|
||||
m_ui->actionsWidget->setActionsContainer(&event->second);
|
||||
else
|
||||
goto none;
|
||||
}
|
||||
else
|
||||
{
|
||||
none:
|
||||
m_ui->actionsWidget->setActionsContainer(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::eventsContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
const auto index = m_ui->listViewEvents->indexAt(pos);
|
||||
auto event = index.isValid() ? m_eventsModel->getEvent(index) : nullptr;
|
||||
|
||||
QMenu menu{this};
|
||||
menu.addAction(tr("&Add Event"), this, &ObjectPropertiesDialog::addEvent);
|
||||
menu.addAction(tr("&Change Event"), this, &ObjectPropertiesDialog::replaceEvent)->setEnabled(event);
|
||||
menu.addAction(tr("&Duplicate Event"), this, &ObjectPropertiesDialog::duplicateEvent)->setEnabled(event);
|
||||
menu.addAction(tr("D&elete Event"), this, &ObjectPropertiesDialog::deleteEvent)->setEnabled(event);
|
||||
menu.exec(m_ui->listViewEvents->viewport()->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::clearSprite()
|
||||
{
|
||||
m_ui->labelSpritePreview->setPixmap(QPixmap{});
|
||||
|
||||
@@ -11,7 +11,6 @@ class QMenu;
|
||||
namespace Ui { class ObjectPropertiesDialog; }
|
||||
class ProjectTreeModel;
|
||||
class ObjectEventsModel;
|
||||
class ObjectActionsModel;
|
||||
|
||||
class ObjectPropertiesDialog : public QDialog
|
||||
{
|
||||
@@ -31,12 +30,15 @@ private slots:
|
||||
void addEvent();
|
||||
void deleteEvent();
|
||||
void replaceEvent();
|
||||
void duplicateEvent();
|
||||
|
||||
void changed();
|
||||
|
||||
void objectNameChanged(const Object &object);
|
||||
|
||||
void spritesMenuAboutToShow();
|
||||
void currentEventChanged(const QModelIndex &index);
|
||||
void eventsContextMenuRequested(const QPoint &pos);
|
||||
|
||||
void clearSprite();
|
||||
void setSprite(const Sprite &sprite);
|
||||
@@ -49,10 +51,9 @@ private:
|
||||
Object &m_object;
|
||||
ProjectTreeModel &m_projectModel;
|
||||
|
||||
std::map<Object::EventType, QString> m_events;
|
||||
Object::events_container_t m_events;
|
||||
|
||||
const std::unique_ptr<ObjectEventsModel> m_eventsModel;
|
||||
const std::unique_ptr<ObjectActionsModel> m_actionsModel;
|
||||
|
||||
QMenu * const m_spritesMenu;
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>794</width>
|
||||
<height>466</height>
|
||||
<width>894</width>
|
||||
<height>496</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -17,7 +17,7 @@
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/object-file.png</normaloff>:/qtgameengine/icons/object-file.png</iconset>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0,1,0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0,1">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@@ -355,6 +355,15 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -394,61 +403,18 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelActions">
|
||||
<property name="text">
|
||||
<string>Actions:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>listViewActions</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listViewActions">
|
||||
<property name="toolTip">
|
||||
<string>Drag actions here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>68</width>
|
||||
<height>390</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Page 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>68</width>
|
||||
<height>390</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Page 2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="ActionsContainerWidget" name="actionsWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ActionsContainerWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/actionscontainerwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "projecttreemodel.h"
|
||||
#include "pathpointsmodel.h"
|
||||
#include "models/projecttreemodel.h"
|
||||
#include "models/pathpointsmodel.h"
|
||||
|
||||
PathPropertiesDialog::PathPropertiesDialog(Path &path, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
|
||||
@@ -617,7 +617,7 @@
|
||||
<customwidget>
|
||||
<class>PathPointsWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>pathpointswidget.h</header>
|
||||
<header>widgets/pathpointswidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "projecttreemodel.h"
|
||||
#include "models/projecttreemodel.h"
|
||||
|
||||
ScriptPropertiesDialog::ScriptPropertiesDialog(Script &script, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
CodeEditorDialog{tr("Script Properties: %0").arg(script.name), parent},
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "projecttreemodel.h"
|
||||
#include "models/projecttreemodel.h"
|
||||
|
||||
SoundPropertiesDialog::SoundPropertiesDialog(Sound &sound, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "projecttreemodel.h"
|
||||
#include "models/projecttreemodel.h"
|
||||
#include "editspritedialog.h"
|
||||
#include "maskpropertiesdialog.h"
|
||||
|
||||
|
||||
@@ -3,19 +3,22 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QMenu>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "projecttreemodel.h"
|
||||
#include "timelinemomentsmodel.h"
|
||||
#include "timelineactionsmodel.h"
|
||||
#include <limits>
|
||||
|
||||
#include "models/projecttreemodel.h"
|
||||
#include "models/timelinemomentsmodel.h"
|
||||
#include "dialogs/deletemomentsdialog.h"
|
||||
|
||||
TimeLinePropertiesDialog::TimeLinePropertiesDialog(TimeLine &timeLine, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::TimeLinePropertiesDialog>()},
|
||||
m_timeLine{timeLine},
|
||||
m_projectModel{projectModel},
|
||||
m_momentsModel{std::make_unique<TimelineMomentsModel>(this)},
|
||||
m_actionsModel{std::make_unique<TimelineActionsModel>(this)}
|
||||
m_moments{timeLine.moments},
|
||||
m_momentsModel{std::make_unique<TimelineMomentsModel>(m_moments, this)}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -30,32 +33,51 @@ TimeLinePropertiesDialog::TimeLinePropertiesDialog(TimeLine &timeLine, ProjectTr
|
||||
|
||||
m_ui->listViewMoments->setModel(m_momentsModel.get());
|
||||
|
||||
m_ui->listViewActions->setModel(m_actionsModel.get());
|
||||
|
||||
connect(&m_projectModel, &ProjectTreeModel::timeLineNameChanged,
|
||||
this, &TimeLinePropertiesDialog::timeLineNameChanged);
|
||||
|
||||
connect(m_momentsModel.get(), &QAbstractItemModel::modelReset,
|
||||
this, &TimeLinePropertiesDialog::changed);
|
||||
connect(m_momentsModel.get(), &QAbstractItemModel::rowsInserted,
|
||||
this, &TimeLinePropertiesDialog::changed);
|
||||
connect(m_momentsModel.get(), &QAbstractItemModel::dataChanged,
|
||||
this, &TimeLinePropertiesDialog::changed);
|
||||
connect(m_momentsModel.get(), &QAbstractItemModel::rowsRemoved,
|
||||
this, &TimeLinePropertiesDialog::changed);
|
||||
|
||||
connect(m_ui->lineEditName, &QLineEdit::textChanged,
|
||||
this, &TimeLinePropertiesDialog::changed);
|
||||
|
||||
connect(m_ui->pushButtonAdd, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::add);
|
||||
this, &TimeLinePropertiesDialog::addMoment);
|
||||
connect(m_ui->pushButtonChange, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::change);
|
||||
this, &TimeLinePropertiesDialog::changeMoment);
|
||||
connect(m_ui->pushButtonDelete, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::delete_);
|
||||
this, &TimeLinePropertiesDialog::deleteMoments);
|
||||
connect(m_ui->pushButtonClear, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::clear);
|
||||
this, &TimeLinePropertiesDialog::clearMoments);
|
||||
connect(m_ui->pushButtonShift, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::shift);
|
||||
this, &TimeLinePropertiesDialog::shiftMoments);
|
||||
connect(m_ui->pushButtonDuplicate, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::duplicate);
|
||||
this, &TimeLinePropertiesDialog::duplicateMoments);
|
||||
connect(m_ui->pushButtonSpread, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::spread);
|
||||
this, &TimeLinePropertiesDialog::spreadMoments);
|
||||
connect(m_ui->pushButtonMerge, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::merge);
|
||||
this, &TimeLinePropertiesDialog::mergeMoments);
|
||||
connect(m_ui->pushButtonShowInformation, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::showInformation);
|
||||
|
||||
connect(m_ui->listViewMoments->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||
this, &TimeLinePropertiesDialog::currentMomentChanged);
|
||||
connect(m_momentsModel.get(), &QAbstractItemModel::modelAboutToBeReset,
|
||||
m_ui->listViewMoments, [listView=m_ui->listViewMoments](){
|
||||
listView->setCurrentIndex(QModelIndex{});
|
||||
});
|
||||
connect(m_ui->listViewMoments, &QListView::customContextMenuRequested,
|
||||
this, &TimeLinePropertiesDialog::momentsContextMenuRequested);
|
||||
|
||||
connect(m_ui->actionsWidget, &ActionsContainerWidget::changed,
|
||||
this, &TimeLinePropertiesDialog::changed);
|
||||
}
|
||||
|
||||
TimeLinePropertiesDialog::~TimeLinePropertiesDialog() = default;
|
||||
@@ -77,7 +99,7 @@ void TimeLinePropertiesDialog::accept()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
m_timeLine.moments = m_moments;
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
@@ -134,42 +156,92 @@ void TimeLinePropertiesDialog::timeLineNameChanged(const TimeLine &timeLine)
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::add()
|
||||
void TimeLinePropertiesDialog::addMoment()
|
||||
{
|
||||
TimeLine::moment_key_t newMoment{};
|
||||
for (const auto &moment : m_moments)
|
||||
if (moment.first >= newMoment)
|
||||
newMoment = moment.first + 1;
|
||||
|
||||
bool ok;
|
||||
const auto moment = QInputDialog::getInt(this, tr("Adding a Moment"), tr("Indicate the moment:"), newMoment, 0, std::numeric_limits<TimeLine::moment_key_t>::max(), 1, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
if (!m_momentsModel->addMoment(moment))
|
||||
QMessageBox::warning(this, tr("Could not add Moment!"), tr("Could not add Moment!"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::changeMoment()
|
||||
{
|
||||
const auto index = m_ui->listViewMoments->currentIndex();
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
const auto moment = m_momentsModel->getMoment(index);
|
||||
if (!moment)
|
||||
return;
|
||||
|
||||
bool ok;
|
||||
const auto newMoment = QInputDialog::getInt(this, tr("Changing a Moment"), tr("Indicate the moment:"), moment->first, 0, std::numeric_limits<TimeLine::moment_key_t>::max(), 1, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
if (!m_momentsModel->changeMoment(moment->first, newMoment))
|
||||
QMessageBox::warning(this, tr("Could not change Moment!"), tr("Could not change Moment!"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::deleteMoments()
|
||||
{
|
||||
if (m_moments.empty())
|
||||
return;
|
||||
|
||||
std::optional<TimeLine::moment_key_t> momentKey;
|
||||
|
||||
if (const auto index = m_ui->listViewMoments->currentIndex(); index.isValid())
|
||||
if (const auto moment = m_momentsModel->getMoment(index); moment)
|
||||
momentKey = moment->first;
|
||||
|
||||
DeleteMomentsDialog dialog = momentKey ? DeleteMomentsDialog{*momentKey, *momentKey, this} : DeleteMomentsDialog{this};
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
if (dialog.fromMoment() > dialog.tillMoment())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Invalid input!"), tr("Invalid input!") + "\n\n" + tr("From moment cannot be greater than Till moment!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_momentsModel->removeRows(dialog.fromMoment(), dialog.tillMoment() - dialog.fromMoment() + 1))
|
||||
QMessageBox::warning(this, tr("Could not remove Moments!"), tr("Could not remove Moments!"));
|
||||
}
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::clearMoments()
|
||||
{
|
||||
if (m_moments.empty())
|
||||
return;
|
||||
if (QMessageBox::question(this, tr("Confirm"), tr("Are you sure, that you really want to remove all Moments?")) != QMessageBox::Yes)
|
||||
return;
|
||||
if (!m_momentsModel->clearMoments())
|
||||
QMessageBox::warning(this, tr("Could not clear Moments!"), tr("Could not clear Moments!"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::shiftMoments()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::change()
|
||||
void TimeLinePropertiesDialog::duplicateMoments()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::delete_()
|
||||
void TimeLinePropertiesDialog::spreadMoments()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::clear()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::shift()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::duplicate()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::spread()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::merge()
|
||||
void TimeLinePropertiesDialog::mergeMoments()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
@@ -179,6 +251,39 @@ void TimeLinePropertiesDialog::showInformation()
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::currentMomentChanged(const QModelIndex &index)
|
||||
{
|
||||
qDebug() << index.isValid() << index.row();
|
||||
|
||||
if (index.isValid())
|
||||
{
|
||||
if (auto moment = m_momentsModel->getMoment(index))
|
||||
m_ui->actionsWidget->setActionsContainer(&moment->second);
|
||||
else
|
||||
goto none;
|
||||
}
|
||||
else
|
||||
{
|
||||
none:
|
||||
m_ui->actionsWidget->setActionsContainer(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::momentsContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
const auto index = m_ui->listViewMoments->indexAt(pos);
|
||||
auto moment = index.isValid() ? m_momentsModel->getMoment(index) : nullptr;
|
||||
|
||||
QMenu menu{this};
|
||||
menu.addAction(tr("&Add Moment"), this, &TimeLinePropertiesDialog::addMoment);
|
||||
menu.addAction(tr("&Change Moment"), this, &TimeLinePropertiesDialog::changeMoment)->setEnabled(moment);
|
||||
menu.addAction(tr("&Delete Moment"), this, &TimeLinePropertiesDialog::deleteMoments)->setEnabled(moment);
|
||||
menu.addSeparator();
|
||||
menu.addAction(tr("&Shift Moments"), this, &TimeLinePropertiesDialog::shiftMoments)->setEnabled(moment);
|
||||
menu.addAction(tr("&Merge Moments"), this, &TimeLinePropertiesDialog::mergeMoments)->setEnabled(moment);
|
||||
menu.exec(m_ui->listViewMoments->viewport()->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::updateTitle()
|
||||
{
|
||||
setWindowTitle(tr("Time Line Properties: %0%1")
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
|
||||
namespace Ui { class TimeLinePropertiesDialog; }
|
||||
struct TimeLine;
|
||||
class ProjectTreeModel;
|
||||
class TimelineMomentsModel;
|
||||
class TimelineActionsModel;
|
||||
|
||||
class TimeLinePropertiesDialog : public QDialog
|
||||
{
|
||||
@@ -26,16 +26,19 @@ private slots:
|
||||
|
||||
void timeLineNameChanged(const TimeLine &timeLine);
|
||||
|
||||
void add();
|
||||
void change();
|
||||
void delete_();
|
||||
void clear();
|
||||
void shift();
|
||||
void duplicate();
|
||||
void spread();
|
||||
void merge();
|
||||
void addMoment();
|
||||
void changeMoment();
|
||||
void deleteMoments();
|
||||
void clearMoments();
|
||||
void shiftMoments();
|
||||
void duplicateMoments();
|
||||
void spreadMoments();
|
||||
void mergeMoments();
|
||||
void showInformation();
|
||||
|
||||
void currentMomentChanged(const QModelIndex &index);
|
||||
void momentsContextMenuRequested(const QPoint &pos);
|
||||
|
||||
private:
|
||||
void updateTitle();
|
||||
|
||||
@@ -44,8 +47,9 @@ private:
|
||||
TimeLine &m_timeLine;
|
||||
ProjectTreeModel &m_projectModel;
|
||||
|
||||
TimeLine::moments_container_t m_moments;
|
||||
|
||||
const std::unique_ptr<TimelineMomentsModel> m_momentsModel;
|
||||
const std::unique_ptr<TimelineActionsModel> m_actionsModel;
|
||||
|
||||
bool m_unsavedChanges{};
|
||||
};
|
||||
@@ -17,7 +17,7 @@
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/timeline-file.png</normaloff>:/qtgameengine/icons/timeline-file.png</iconset>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1,0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@@ -257,66 +257,26 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelActions">
|
||||
<property name="text">
|
||||
<string>Actions:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>listViewActions</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listViewActions">
|
||||
<property name="toolTip">
|
||||
<string>Drag actions here</string>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>68</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Page 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>68</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Page 2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="ActionsContainerWidget" name="actionsWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ActionsContainerWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/actionscontainerwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "triggersmodel.h"
|
||||
#include "models/triggersmodel.h"
|
||||
#include "triggerconditiondialog.h"
|
||||
|
||||
TriggersDialog::TriggersDialog(ProjectContainer &project, QWidget *parent) :
|
||||
@@ -67,6 +67,10 @@ TriggersDialog::~TriggersDialog() = default;
|
||||
void TriggersDialog::openCodeEditor()
|
||||
{
|
||||
TriggerConditionDialog dialog{this};
|
||||
dialog.setScript(m_ui->plainTextEdit->toPlainText());
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
m_ui->plainTextEdit->setPlainText(dialog.script());
|
||||
// changed();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "constantsmodel.h"
|
||||
#include "models/constantsmodel.h"
|
||||
|
||||
UserDefinedConstantsDialog::UserDefinedConstantsDialog(ProjectContainer &project, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
|
||||
Reference in new issue
Block a user