Add more actions and improve error message when dragged into empty actions container

This commit is contained in:
feedc0de committed 2024-01-12 21:53:29 +01:00
1 parent 6136280507
commit 4046a5c044
23 files changed
+535 -41

No files matched your search

@@ -253,6 +253,9 @@
<property name="text">
<string>Speed:</string>
</property>
<property name="buddy">
<cstring>spinBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
@@ -143,6 +143,9 @@
<property name="text">
<string>direction:</string>
</property>
<property name="buddy">
<cstring>spinBoxDirection</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
@@ -153,6 +156,9 @@
<property name="text">
<string>speed:</string>
</property>
<property name="buddy">
<cstring>spinBoxSpeed</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
@@ -1,12 +1,19 @@
#include "movetowardsdialog.h"
#include "ui_movetowardsdialog.h"
#include <QPushButton>
MoveTowardsDialog::MoveTowardsDialog(MoveTowardsAction &action, QWidget *parent) :
QDialog{parent},
m_ui{std::make_unique<Ui::MoveTowardsDialog>()},
m_action{action}
{
m_ui->setupUi(this);
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok))
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
button->setIcon(QIcon{":/qtgameengine/icons/delete.png"});
}
MoveTowardsDialog::~MoveTowardsDialog() = default;
+197 -24
View File
@@ -6,31 +6,204 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>435</width>
<height>429</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Move Towards</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>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../resources_editor.qrc">:/qtgameengine/icons/action-move-towards.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Applies to</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="radioButtonSelf">
<property name="text">
<string>Self</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonOther">
<property name="text">
<string>Other</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QRadioButton" name="radioButtonObject">
<property name="text">
<string>Object:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelX">
<property name="text">
<string>x:</string>
</property>
<property name="buddy">
<cstring>spinBoxX</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBoxX"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelY">
<property name="text">
<string>y:</string>
</property>
<property name="buddy">
<cstring>spinBoxY</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxY"/>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxRelative">
<property name="text">
<string>Relative</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBoxSpeed"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelSpeed">
<property name="text">
<string>speed:</string>
</property>
<property name="buddy">
<cstring>spinBoxSpeed</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</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/>
<resources>
<include location="../../resources_editor.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
@@ -39,8 +212,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
<x>257</x>
<y>419</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@@ -55,8 +228,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
<x>325</x>
<y>419</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
@@ -0,0 +1,19 @@
#include "speedhorizontaldialog.h"
#include "ui_speedhorizontaldialog.h"
#include <QPushButton>
SpeedHorizontalDialog::SpeedHorizontalDialog(SpeedHorizontalAction &action, QWidget *parent) :
QDialog{parent},
m_ui{std::make_unique<Ui::SpeedHorizontalDialog>()},
m_action{action}
{
m_ui->setupUi(this);
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok))
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
button->setIcon(QIcon{":/qtgameengine/icons/delete.png"});
}
SpeedHorizontalDialog::~SpeedHorizontalDialog() = default;
@@ -0,0 +1,22 @@
#pragma once
#include <QDialog>
#include <memory>
namespace Ui { class SpeedHorizontalDialog; }
struct SpeedHorizontalAction;
class SpeedHorizontalDialog : public QDialog
{
Q_OBJECT
public:
explicit SpeedHorizontalDialog(SpeedHorizontalAction &action, QWidget *parent = nullptr);
~SpeedHorizontalDialog() override;
private:
const std::unique_ptr<Ui::SpeedHorizontalDialog> m_ui;
SpeedHorizontalAction &m_action;
};
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SpeedHorizontalDialog</class>
<widget class="QDialog" name="SpeedHorizontalDialog">
<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>SpeedHorizontalDialog</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>SpeedHorizontalDialog</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>
@@ -0,0 +1,19 @@
#include "speedverticaldialog.h"
#include "ui_speedverticaldialog.h"
#include <QPushButton>
SpeedVerticalDialog::SpeedVerticalDialog(SpeedVerticalAction &action, QWidget *parent) :
QDialog{parent},
m_ui{std::make_unique<Ui::SpeedVerticalDialog>()},
m_action{action}
{
m_ui->setupUi(this);
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok))
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
button->setIcon(QIcon{":/qtgameengine/icons/delete.png"});
}
SpeedVerticalDialog::~SpeedVerticalDialog() = default;
@@ -0,0 +1,22 @@
#pragma once
#include <QDialog>
#include <memory>
namespace Ui { class SpeedVerticalDialog; }
struct SpeedVerticalAction;
class SpeedVerticalDialog : public QDialog
{
Q_OBJECT
public:
explicit SpeedVerticalDialog(SpeedVerticalAction &action, QWidget *parent = nullptr);
~SpeedVerticalDialog() override;
private:
const std::unique_ptr<Ui::SpeedVerticalDialog> m_ui;
SpeedVerticalAction &m_action;
};
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SpeedVerticalDialog</class>
<widget class="QDialog" name="SpeedVerticalDialog">
<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>SpeedVerticalDialog</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>SpeedVerticalDialog</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>