Lots of fixes and added more dialogs
This commit is contained in:
@@ -32,11 +32,11 @@ BackgroundPropertiesDialog::BackgroundPropertiesDialog(Background &background, P
|
||||
connect(&m_projectModel, &ProjectTreeModel::backgroundNameChanged,
|
||||
this, &BackgroundPropertiesDialog::backgroundNameChanged);
|
||||
|
||||
connect(m_ui->pushButtonLoad, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonLoad, &QAbstractButton::clicked,
|
||||
this, &BackgroundPropertiesDialog::loadBackground);
|
||||
connect(m_ui->pushButtonSave, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonSave, &QAbstractButton::clicked,
|
||||
this, &BackgroundPropertiesDialog::saveBackground);
|
||||
connect(m_ui->pushButtonEdit, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonEdit, &QAbstractButton::clicked,
|
||||
this, &BackgroundPropertiesDialog::editBackground);
|
||||
|
||||
connect(m_ui->lineEditName, &QLineEdit::textChanged,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <QString>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace Ui { class BackgroundPropertiesDialog; }
|
||||
struct Background;
|
||||
|
||||
@@ -5,16 +5,21 @@
|
||||
#include <QFont>
|
||||
#include <QLabel>
|
||||
#include <QTextBlock>
|
||||
#include <QMessageBox>
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "jshighlighter.h"
|
||||
|
||||
CodeEditorDialog::CodeEditorDialog(QWidget *parent) :
|
||||
CodeEditorDialog::CodeEditorDialog(const QString &title, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::CodeEditorDialog>()},
|
||||
m_title{title},
|
||||
m_labelPosition{new QLabel{this}}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
updateTitle();
|
||||
|
||||
m_labelPosition->setFrameStyle(QFrame::Sunken);
|
||||
m_ui->statusbar->addWidget(m_labelPosition);
|
||||
|
||||
@@ -37,6 +42,8 @@ CodeEditorDialog::CodeEditorDialog(QWidget *parent) :
|
||||
connect(m_ui->actionPrint, &QAction::triggered,
|
||||
this, &CodeEditorDialog::print);
|
||||
|
||||
connect(m_ui->codeEdit, &QPlainTextEdit::textChanged,
|
||||
this, &CodeEditorDialog::changed);
|
||||
connect(m_ui->codeEdit, &QPlainTextEdit::textChanged,
|
||||
this, &CodeEditorDialog::updatePosition);
|
||||
connect(m_ui->codeEdit, &QPlainTextEdit::cursorPositionChanged,
|
||||
@@ -45,6 +52,72 @@ CodeEditorDialog::CodeEditorDialog(QWidget *parent) :
|
||||
|
||||
CodeEditorDialog::~CodeEditorDialog() = default;
|
||||
|
||||
void CodeEditorDialog::accept()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void CodeEditorDialog::reject()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto result = QMessageBox::warning(
|
||||
this,
|
||||
tr("The Script has been modified."),
|
||||
tr("Do you want to save your changes?"),
|
||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
|
||||
QMessageBox::Save
|
||||
);
|
||||
switch (result)
|
||||
{
|
||||
case QMessageBox::Save:
|
||||
accept();
|
||||
return;
|
||||
case QMessageBox::Discard:
|
||||
QDialog::reject();
|
||||
return;
|
||||
case QMessageBox::Cancel:
|
||||
return;
|
||||
default:
|
||||
qWarning() << "unexpected dialog result" << result;
|
||||
}
|
||||
}
|
||||
|
||||
QString CodeEditorDialog::script() const
|
||||
{
|
||||
return m_ui->codeEdit->toPlainText();
|
||||
}
|
||||
|
||||
void CodeEditorDialog::setScript(const QString &script)
|
||||
{
|
||||
QSignalBlocker blocker{m_ui->codeEdit};
|
||||
m_ui->codeEdit->setPlainText(script);
|
||||
}
|
||||
|
||||
void CodeEditorDialog::changed()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
m_unsavedChanges = true;
|
||||
updateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
void CodeEditorDialog::addToolbarWidget(QWidget *widget)
|
||||
{
|
||||
m_ui->toolBar->addWidget(widget);
|
||||
}
|
||||
|
||||
void CodeEditorDialog::load()
|
||||
{
|
||||
|
||||
@@ -82,3 +155,11 @@ void CodeEditorDialog::updatePosition()
|
||||
|
||||
m_labelPosition->setText(tr("%0/%1: %2").arg(lines).arg(m_ui->codeEdit->blockCount()).arg(position));
|
||||
}
|
||||
|
||||
void CodeEditorDialog::updateTitle()
|
||||
{
|
||||
setWindowTitle(tr("%0%1")
|
||||
.arg(m_title)
|
||||
.arg(m_unsavedChanges ? tr("*") : QString{})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,9 +12,26 @@ class CodeEditorDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CodeEditorDialog(QWidget *parent = nullptr);
|
||||
explicit CodeEditorDialog(const QString &title, QWidget *parent = nullptr);
|
||||
~CodeEditorDialog();
|
||||
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
|
||||
const QString &title() const { return m_title; }
|
||||
void setTitle(const QString &title) { if (m_title == title) return; m_title = title; updateTitle(); }
|
||||
|
||||
QString script() const;
|
||||
void setScript(const QString &script);
|
||||
|
||||
protected slots:
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
bool m_unsavedChanges{};
|
||||
|
||||
void addToolbarWidget(QWidget *widget);
|
||||
|
||||
private slots:
|
||||
void load();
|
||||
void save();
|
||||
@@ -22,9 +39,12 @@ private slots:
|
||||
|
||||
void updatePosition();
|
||||
|
||||
protected:
|
||||
private:
|
||||
void updateTitle();
|
||||
|
||||
const std::unique_ptr<Ui::CodeEditorDialog> m_ui;
|
||||
|
||||
private:
|
||||
QString m_title;
|
||||
|
||||
QLabel * const m_labelPosition;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ CreateSpriteDialog::CreateSpriteDialog(QWidget *parent) :
|
||||
m_ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog | Qt::Window);
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowCloseButtonHint);
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
<property name="text">
|
||||
<string>Width:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxWidth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@@ -43,6 +46,9 @@
|
||||
<property name="text">
|
||||
<string>Height:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxHeight</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
|
||||
@@ -18,7 +18,7 @@ EditSpriteDialog::EditSpriteDialog(const std::vector<QPixmap> &pixmaps, const QS
|
||||
m_ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog | Qt::Window);
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowMinimizeButtonHint);
|
||||
setWindowFlag(Qt::WindowMaximizeButtonHint);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "extensionpackagesdialog.h"
|
||||
#include "ui_extensionpackagesdialog.h"
|
||||
|
||||
#include "installextensiondialog.h"
|
||||
|
||||
ExtensionPackagesDialog::ExtensionPackagesDialog(QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::ExtensionPackagesDialog>()}
|
||||
@@ -8,7 +10,7 @@ ExtensionPackagesDialog::ExtensionPackagesDialog(QWidget *parent) :
|
||||
m_ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog | Qt::Window);
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowCloseButtonHint);
|
||||
|
||||
@@ -16,8 +18,19 @@ ExtensionPackagesDialog::ExtensionPackagesDialog(QWidget *parent) :
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/delete.png"});
|
||||
m_ui->buttonBox->addButton(tr("Install"), QDialogButtonBox::ActionRole)
|
||||
->setIcon(QIcon{":/qtgameengine/icons/extension-packages-file.png"});
|
||||
|
||||
if (auto button = m_ui->buttonBox->addButton(tr("Install"), QDialogButtonBox::ActionRole))
|
||||
{
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/extension-packages-file.png"});
|
||||
connect(button, &QAbstractButton::clicked,
|
||||
this, &ExtensionPackagesDialog::install);
|
||||
}
|
||||
}
|
||||
|
||||
ExtensionPackagesDialog::~ExtensionPackagesDialog() = default;
|
||||
|
||||
void ExtensionPackagesDialog::install()
|
||||
{
|
||||
InstallExtensionDialog dialog{this};
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ public:
|
||||
explicit ExtensionPackagesDialog(QWidget *parent = nullptr);
|
||||
~ExtensionPackagesDialog();
|
||||
|
||||
private slots:
|
||||
void install();
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::ExtensionPackagesDialog> m_ui;
|
||||
};
|
||||
|
||||
@@ -35,13 +35,13 @@ FontPropertiesDialog::FontPropertiesDialog(Font &font, ProjectTreeModel &project
|
||||
connect(&m_projectModel, &ProjectTreeModel::fontNameChanged,
|
||||
this, &FontPropertiesDialog::fontNameChanged);
|
||||
|
||||
connect(m_ui->pushButtonNormal, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonNormal, &QAbstractButton::clicked,
|
||||
this, &FontPropertiesDialog::normalRange);
|
||||
connect(m_ui->pushButtonDigits, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonDigits, &QAbstractButton::clicked,
|
||||
this, &FontPropertiesDialog::digitsRange);
|
||||
connect(m_ui->pushButtonAll, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonAll, &QAbstractButton::clicked,
|
||||
this, &FontPropertiesDialog::allRange);
|
||||
connect(m_ui->pushButtonLetters, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonLetters, &QAbstractButton::clicked,
|
||||
this, &FontPropertiesDialog::lettersRange);
|
||||
|
||||
connect(m_ui->lineEditName, &QLineEdit::textChanged,
|
||||
@@ -64,6 +64,12 @@ FontPropertiesDialog::~FontPropertiesDialog() = default;
|
||||
|
||||
void FontPropertiesDialog::accept()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_font.name != m_ui->lineEditName->text())
|
||||
{
|
||||
if (!m_projectModel.rename<Font>(m_font, m_ui->lineEditName->text()))
|
||||
|
||||
@@ -8,7 +8,7 @@ GameInformationDialog::GameInformationDialog(QWidget *parent) :
|
||||
m_ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog | Qt::Window);
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowMinimizeButtonHint);
|
||||
setWindowFlag(Qt::WindowMaximizeButtonHint);
|
||||
|
||||
@@ -11,7 +11,7 @@ GlobalGameSettingsDialog::GlobalGameSettingsDialog(QWidget *parent) :
|
||||
m_ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog | Qt::Window);
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowCloseButtonHint);
|
||||
|
||||
|
||||
@@ -106,6 +106,9 @@
|
||||
<property name="text">
|
||||
<string>Color outside the room region:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>toolButtonColorOutside</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -12,7 +12,7 @@ ImageEditorDialog::ImageEditorDialog(const QPixmap &pixmap, const QString &title
|
||||
m_ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog | Qt::Window);
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowMinimizeButtonHint);
|
||||
setWindowFlag(Qt::WindowMaximizeButtonHint);
|
||||
|
||||
@@ -25,35 +25,67 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listView"/>
|
||||
<widget class="QListView" name="listView">
|
||||
<property name="toolTip">
|
||||
<string>This is the list of files to be included when creating a stand-alone game.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonAdd">
|
||||
<property name="toolTip">
|
||||
<string>Add a file to be included</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/add.png</normaloff>:/qtgameengine/icons/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonChange">
|
||||
<property name="toolTip">
|
||||
<string>Change the properties of the included file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change</string>
|
||||
<string>&Change</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/replace.png</normaloff>:/qtgameengine/icons/replace.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonDelete">
|
||||
<property name="toolTip">
|
||||
<string>Delete the indicated included file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/delete.png</normaloff>:/qtgameengine/icons/delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonClear">
|
||||
<property name="toolTip">
|
||||
<string>Clear the list of included files</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
<string>&Clear</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/new.png</normaloff>:/qtgameengine/icons/new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -74,7 +106,9 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "installextensiondialog.h"
|
||||
#include "ui_installextensiondialog.h"
|
||||
|
||||
InstallExtensionDialog::InstallExtensionDialog(QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::InstallExtensionDialog>()}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowCloseButtonHint);
|
||||
}
|
||||
|
||||
InstallExtensionDialog::~InstallExtensionDialog() = default;
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Ui { class InstallExtensionDialog; }
|
||||
|
||||
class InstallExtensionDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InstallExtensionDialog(QWidget *parent = nullptr);
|
||||
~InstallExtensionDialog();
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::InstallExtensionDialog> m_ui;
|
||||
};
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InstallExtensionDialog</class>
|
||||
<widget class="QDialog" name="InstallExtensionDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Installing Extension Packages</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelInstalledPackages">
|
||||
<property name="text">
|
||||
<string>Installed Packages:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>InstallExtensionDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>350</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>199</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>InstallExtensionDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>350</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>199</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -8,7 +8,7 @@ MaskPropertiesDialog::MaskPropertiesDialog(QWidget *parent) :
|
||||
m_ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog | Qt::Window);
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowCloseButtonHint);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,228 @@
|
||||
#include "objectpropertiesdialog.h"
|
||||
#include "ui_objectpropertiesdialog.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "projecttreemodel.h"
|
||||
#include "objecteventsmodel.h"
|
||||
#include "objectactionsmodel.h"
|
||||
|
||||
ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::ObjectPropertiesDialog>()}
|
||||
m_ui{std::make_unique<Ui::ObjectPropertiesDialog>()},
|
||||
m_object{object},
|
||||
m_projectModel{projectModel},
|
||||
m_eventsModel{std::make_unique<ObjectEventsModel>()},
|
||||
m_actionsModel{std::make_unique<ObjectActionsModel>()},
|
||||
m_spritesMenu{new QMenu{m_ui->toolButtonSprite}},
|
||||
m_spriteName{object.spriteName}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
updateTitle();
|
||||
|
||||
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"});
|
||||
|
||||
m_ui->lineEditName->setText(m_object.name);
|
||||
m_ui->lineEditSprite->setText(m_spriteName.isEmpty() ? tr("<no sprite>") : m_spriteName);
|
||||
if (!m_spriteName.isEmpty())
|
||||
{
|
||||
const auto &sprites = m_projectModel.project()->sprites;
|
||||
const auto iter = std::find_if(std::cbegin(sprites), std::cend(sprites),
|
||||
[&](const Sprite &sprite){ return sprite.name == m_spriteName; });
|
||||
if (iter == std::cend(sprites))
|
||||
qWarning() << "sprite" << m_spriteName << "not found";
|
||||
else
|
||||
m_ui->labelSpritePreview->setPixmap(iter->pixmaps.empty() ? QPixmap{} : iter->pixmaps.front().scaled(m_ui->labelSpritePreview->size(), Qt::KeepAspectRatio));
|
||||
}
|
||||
m_ui->toolButtonSprite->setMenu(m_spritesMenu);
|
||||
m_ui->checkBoxVisible->setChecked(m_object.visible);
|
||||
m_ui->checkBoxSolid->setChecked(m_object.solid);
|
||||
m_ui->spinBoxDepth->setValue(m_object.depth);
|
||||
m_ui->checkBoxPersistent->setChecked(m_object.persistent);
|
||||
|
||||
m_ui->listViewEvents->setModel(m_eventsModel.get());
|
||||
|
||||
connect(&m_projectModel, &ProjectTreeModel::objectNameChanged,
|
||||
this, &ObjectPropertiesDialog::objectNameChanged);
|
||||
|
||||
connect(m_ui->pushButtonNewSprite, &QAbstractButton::clicked,
|
||||
this, &ObjectPropertiesDialog::newSprite);
|
||||
connect(m_ui->pushButtonEditSprite, &QAbstractButton::clicked,
|
||||
this, &ObjectPropertiesDialog::editSprite);
|
||||
connect(m_ui->pushButtonShowInformation, &QAbstractButton::clicked,
|
||||
this, &ObjectPropertiesDialog::showInformation);
|
||||
connect(m_ui->pushButtonAddEvent, &QAbstractButton::clicked,
|
||||
this, &ObjectPropertiesDialog::addEvent);
|
||||
connect(m_ui->pushButtonDeleteEvent, &QAbstractButton::clicked,
|
||||
this, &ObjectPropertiesDialog::deleteEvent);
|
||||
connect(m_ui->pushButtonChangeEvent, &QAbstractButton::clicked,
|
||||
this, &ObjectPropertiesDialog::replaceEvent);
|
||||
|
||||
connect(m_ui->lineEditName, &QLineEdit::textChanged,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
connect(m_ui->checkBoxVisible, &QCheckBox::toggled,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
connect(m_ui->checkBoxSolid, &QCheckBox::toggled,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
connect(m_ui->spinBoxDepth, &QSpinBox::valueChanged,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
connect(m_ui->checkBoxPersistent, &QCheckBox::toggled,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
|
||||
connect(m_spritesMenu, &QMenu::aboutToShow,
|
||||
this, &ObjectPropertiesDialog::spritesMenuAboutToShow);
|
||||
}
|
||||
|
||||
ObjectPropertiesDialog::~ObjectPropertiesDialog() = default;
|
||||
|
||||
void ObjectPropertiesDialog::accept()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_object.name != m_ui->lineEditName->text())
|
||||
{
|
||||
if (!m_projectModel.rename<Object>(m_object, m_ui->lineEditName->text()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Renaming Object failed!"), tr("Renaming Object failed!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_object.spriteName = m_spriteName;
|
||||
m_object.visible = m_ui->checkBoxVisible->isChecked();
|
||||
m_object.solid = m_ui->checkBoxSolid->isChecked();
|
||||
m_object.depth = m_ui->spinBoxDepth->value();
|
||||
m_object.persistent = m_ui->checkBoxPersistent->isChecked();
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::reject()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto result = QMessageBox::warning(
|
||||
this,
|
||||
tr("The Object has been modified."),
|
||||
tr("Do you want to save your changes?"),
|
||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
|
||||
QMessageBox::Save
|
||||
);
|
||||
switch (result)
|
||||
{
|
||||
case QMessageBox::Save:
|
||||
accept();
|
||||
return;
|
||||
case QMessageBox::Discard:
|
||||
QDialog::reject();
|
||||
return;
|
||||
case QMessageBox::Cancel:
|
||||
return;
|
||||
default:
|
||||
qWarning() << "unexpected dialog result" << result;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::newSprite()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::editSprite()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::showInformation()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::addEvent()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::deleteEvent()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::replaceEvent()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::changed()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
m_unsavedChanges = true;
|
||||
updateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::objectNameChanged(const Object &object)
|
||||
{
|
||||
if (&object != &m_object)
|
||||
return;
|
||||
|
||||
{
|
||||
QSignalBlocker blocker{m_ui->lineEditName};
|
||||
m_ui->lineEditName->setText(object.name);
|
||||
}
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::spritesMenuAboutToShow()
|
||||
{
|
||||
m_spritesMenu->clear();
|
||||
m_spritesMenu->addAction(tr("<no sprite>"), this, &ObjectPropertiesDialog::clearSprite);
|
||||
for (const auto &sprite : m_projectModel.project()->sprites)
|
||||
m_spritesMenu->addAction(sprite.pixmaps.empty() ? QPixmap{} : sprite.pixmaps.front(),
|
||||
sprite.name,
|
||||
this,
|
||||
[&sprite,this](){ setSprite(sprite); });
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::clearSprite()
|
||||
{
|
||||
m_ui->labelSpritePreview->setPixmap(QPixmap{});
|
||||
m_ui->lineEditSprite->setText(tr("<no sprite>"));
|
||||
m_spriteName = QString{};
|
||||
changed();
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::setSprite(const Sprite &sprite)
|
||||
{
|
||||
m_ui->labelSpritePreview->setPixmap(sprite.pixmaps.empty() ? QPixmap{} : sprite.pixmaps.front().scaled(m_ui->labelSpritePreview->size(), Qt::KeepAspectRatio));
|
||||
m_ui->lineEditSprite->setText(sprite.name);
|
||||
m_spriteName = sprite.name;
|
||||
changed();
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::updateTitle()
|
||||
{
|
||||
setWindowTitle(tr("Object Properties: %0%1")
|
||||
.arg(m_object.name)
|
||||
.arg(m_unsavedChanges ? tr("*") : QString{})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,13 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
class QMenu;
|
||||
namespace Ui { class ObjectPropertiesDialog; }
|
||||
struct Object;
|
||||
class ProjectTreeModel;
|
||||
class ObjectEventsModel;
|
||||
class ObjectActionsModel;
|
||||
class Sprite;
|
||||
|
||||
class ObjectPropertiesDialog : public QDialog
|
||||
{
|
||||
@@ -16,6 +20,40 @@ public:
|
||||
explicit ObjectPropertiesDialog(Object &object, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
|
||||
~ObjectPropertiesDialog();
|
||||
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
|
||||
private slots:
|
||||
void newSprite();
|
||||
void editSprite();
|
||||
void showInformation();
|
||||
void addEvent();
|
||||
void deleteEvent();
|
||||
void replaceEvent();
|
||||
|
||||
void changed();
|
||||
|
||||
void objectNameChanged(const Object &object);
|
||||
|
||||
void spritesMenuAboutToShow();
|
||||
|
||||
void clearSprite();
|
||||
void setSprite(const Sprite &sprite);
|
||||
|
||||
private:
|
||||
void updateTitle();
|
||||
|
||||
const std::unique_ptr<Ui::ObjectPropertiesDialog> m_ui;
|
||||
|
||||
Object &m_object;
|
||||
ProjectTreeModel &m_projectModel;
|
||||
|
||||
const std::unique_ptr<ObjectEventsModel> m_eventsModel;
|
||||
const std::unique_ptr<ObjectActionsModel> m_actionsModel;
|
||||
|
||||
QMenu * const m_spritesMenu;
|
||||
|
||||
QString m_spriteName;
|
||||
|
||||
bool m_unsavedChanges{};
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>794</width>
|
||||
<height>466</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -17,9 +17,473 @@
|
||||
<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">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelName">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditName</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The name of the object</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxSprite">
|
||||
<property name="title">
|
||||
<string>Sprite</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSpritePreview">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditSprite">
|
||||
<property name="toolTip">
|
||||
<string>The sprite used to represent the object</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonSprite">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::InstantPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonNewSprite">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Create a new sprite for this object</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonEditSprite">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Edit the sprite for this object</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxVisible">
|
||||
<property name="toolTip">
|
||||
<string>Whether the object is visible</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Visible</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxSolid">
|
||||
<property name="toolTip">
|
||||
<string>Whether the object is solid</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Solid</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelDepth">
|
||||
<property name="text">
|
||||
<string>Depth:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxDepth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxDepth">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The depth at which the object is drawn</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxPersistent">
|
||||
<property name="toolTip">
|
||||
<string>Wheter the object is persistent between rooms</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Persistent</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelParent">
|
||||
<property name="text">
|
||||
<string>Parent:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditParent</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditParent">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The parent from which events and actions are</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><no parent></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonParent">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditMask">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The image used as a collision mask for the object</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><same as sprite></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonMask">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelMask">
|
||||
<property name="text">
|
||||
<string>Mask:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditMask</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonShowInformation">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show the information about the object</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Information</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/info.png</normaloff>:/qtgameengine/icons/info.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelEvents">
|
||||
<property name="text">
|
||||
<string>Events:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>listViewEvents</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listViewEvents">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonAddEvent">
|
||||
<property name="toolTip">
|
||||
<string>Click here to add another event</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Event</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonDeleteEvent">
|
||||
<property name="toolTip">
|
||||
<string>Delete the currently selected event</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonChangeEvent">
|
||||
<property name="toolTip">
|
||||
<string>Change which event has this behaviour</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ObjectPropertiesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>138</x>
|
||||
<y>511</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>423</x>
|
||||
<y>266</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ObjectPropertiesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>138</x>
|
||||
<y>511</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>423</x>
|
||||
<y>266</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
@@ -108,11 +108,11 @@ PathPropertiesDialog::PathPropertiesDialog(Path &path, ProjectTreeModel &project
|
||||
connect(m_ui->checkBoxClosed, &QCheckBox::toggled,
|
||||
m_ui->widget, &PathPointsWidget::setClosed);
|
||||
|
||||
connect(m_ui->pushButtonAdd, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonAdd, &QAbstractButton::clicked,
|
||||
this, &PathPropertiesDialog::add);
|
||||
connect(m_ui->pushButtonInsert, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonInsert, &QAbstractButton::clicked,
|
||||
this, &PathPropertiesDialog::insert);
|
||||
connect(m_ui->pushButtonDelete, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonDelete, &QAbstractButton::clicked,
|
||||
this, &PathPropertiesDialog::delete_);
|
||||
|
||||
connect(m_ui->lineEditName, &QLineEdit::textChanged,
|
||||
|
||||
@@ -191,6 +191,9 @@
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxX</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
@@ -208,6 +211,9 @@
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxY</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
@@ -225,6 +231,9 @@
|
||||
<property name="text">
|
||||
<string>sp:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxSp</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
@@ -341,6 +350,9 @@
|
||||
<property name="text">
|
||||
<string>Precision:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxPrecision</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
|
||||
@@ -10,7 +10,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) :
|
||||
m_ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog | Qt::Window);
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowCloseButtonHint);
|
||||
|
||||
|
||||
@@ -10,36 +10,38 @@
|
||||
#include "projecttreemodel.h"
|
||||
|
||||
ScriptPropertiesDialog::ScriptPropertiesDialog(Script &script, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
CodeEditorDialog{parent},
|
||||
CodeEditorDialog{tr("Script Properties: %0").arg(script.name), parent},
|
||||
m_script{script},
|
||||
m_projectModel{projectModel},
|
||||
m_lineEditName{new QLineEdit{this}}
|
||||
{
|
||||
updateTitle();
|
||||
|
||||
{
|
||||
auto label = new QLabel{tr("Name:"), this};
|
||||
label->setBuddy(m_lineEditName);
|
||||
m_ui->toolBar->addWidget(label);
|
||||
addToolbarWidget(label);
|
||||
}
|
||||
m_lineEditName->setMaximumWidth(100);
|
||||
m_ui->toolBar->addWidget(m_lineEditName);
|
||||
addToolbarWidget(m_lineEditName);
|
||||
|
||||
|
||||
m_lineEditName->setText(m_script.name);
|
||||
m_ui->codeEdit->setPlainText(m_script.script);
|
||||
setScript(m_script.script);
|
||||
|
||||
connect(&m_projectModel, &ProjectTreeModel::scriptNameChanged,
|
||||
this, &ScriptPropertiesDialog::scriptNameChanged);
|
||||
|
||||
connect(m_lineEditName, &QLineEdit::textChanged,
|
||||
this, &ScriptPropertiesDialog::changed);
|
||||
connect(m_ui->codeEdit, &QPlainTextEdit::textChanged,
|
||||
this, &ScriptPropertiesDialog::changed);
|
||||
}
|
||||
|
||||
void ScriptPropertiesDialog::accept()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_script.name != m_lineEditName->text())
|
||||
{
|
||||
if (!m_projectModel.rename<Script>(m_script, m_lineEditName->text()))
|
||||
@@ -49,68 +51,20 @@ void ScriptPropertiesDialog::accept()
|
||||
}
|
||||
}
|
||||
|
||||
m_script.script = m_ui->codeEdit->toPlainText();
|
||||
m_script.script = script();
|
||||
|
||||
CodeEditorDialog::accept();
|
||||
}
|
||||
|
||||
void ScriptPropertiesDialog::reject()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
CodeEditorDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto result = QMessageBox::warning(
|
||||
this,
|
||||
tr("The Script has been modified."),
|
||||
tr("Do you want to save your changes?"),
|
||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
|
||||
QMessageBox::Save
|
||||
);
|
||||
switch (result)
|
||||
{
|
||||
case QMessageBox::Save:
|
||||
accept();
|
||||
return;
|
||||
case QMessageBox::Discard:
|
||||
CodeEditorDialog::reject();
|
||||
return;
|
||||
case QMessageBox::Cancel:
|
||||
return;
|
||||
default:
|
||||
qWarning() << "unexpected dialog result" << result;
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptPropertiesDialog::changed()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
m_unsavedChanges = true;
|
||||
updateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptPropertiesDialog::scriptNameChanged(const Script &script)
|
||||
{
|
||||
if (&script != &m_script)
|
||||
return;
|
||||
|
||||
setTitle(tr("Script Properties: %0").arg(script.name));
|
||||
|
||||
{
|
||||
QSignalBlocker blocker{m_lineEditName};
|
||||
m_lineEditName->setText(script.name);
|
||||
}
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
void ScriptPropertiesDialog::updateTitle()
|
||||
{
|
||||
setWindowTitle(tr("Script Properties: %0%1")
|
||||
.arg(m_script.name)
|
||||
.arg(m_unsavedChanges ? tr("*") : QString{})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,20 +12,13 @@ public:
|
||||
ScriptPropertiesDialog(Script &script, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
|
||||
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
|
||||
private slots:
|
||||
void changed();
|
||||
|
||||
void scriptNameChanged(const Script &script);
|
||||
|
||||
private:
|
||||
void updateTitle();
|
||||
|
||||
Script &m_script;
|
||||
ProjectTreeModel &m_projectModel;
|
||||
|
||||
bool m_unsavedChanges{};
|
||||
|
||||
QLineEdit * const m_lineEditName;
|
||||
};
|
||||
|
||||
@@ -48,15 +48,15 @@ SoundPropertiesDialog::SoundPropertiesDialog(Sound &sound, ProjectTreeModel &pro
|
||||
connect(&m_projectModel, &ProjectTreeModel::soundNameChanged,
|
||||
this, &SoundPropertiesDialog::soundNameChanged);
|
||||
|
||||
connect(m_ui->pushButtonLoad, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonLoad, &QAbstractButton::clicked,
|
||||
this, &SoundPropertiesDialog::loadSound);
|
||||
connect(m_ui->pushButtonPlay, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonPlay, &QAbstractButton::clicked,
|
||||
this, &SoundPropertiesDialog::playSound);
|
||||
connect(m_ui->pushButtonStop, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonStop, &QAbstractButton::clicked,
|
||||
this, &SoundPropertiesDialog::stopSound);
|
||||
connect(m_ui->pushButtonSave, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonSave, &QAbstractButton::clicked,
|
||||
this, &SoundPropertiesDialog::saveSound);
|
||||
connect(m_ui->pushButtonEdit, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonEdit, &QAbstractButton::clicked,
|
||||
this, &SoundPropertiesDialog::editSound);
|
||||
|
||||
connect(m_ui->lineEditName, &QLineEdit::textChanged,
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <QSoundEffect>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace Ui { class SoundPropertiesDialog; }
|
||||
struct Sound;
|
||||
|
||||
@@ -37,15 +37,15 @@ SpritePropertiesDialog::SpritePropertiesDialog(Sprite &sprite, ProjectTreeModel
|
||||
connect(&m_projectModel, &ProjectTreeModel::spriteNameChanged,
|
||||
this, &SpritePropertiesDialog::spriteNameChanged);
|
||||
|
||||
connect(m_ui->pushButtonLoad, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonLoad, &QAbstractButton::clicked,
|
||||
this, &SpritePropertiesDialog::loadSprite);
|
||||
connect(m_ui->pushButtonSave, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonSave, &QAbstractButton::clicked,
|
||||
this, &SpritePropertiesDialog::saveSprite);
|
||||
connect(m_ui->pushButtonEdit, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonEdit, &QAbstractButton::clicked,
|
||||
this, &SpritePropertiesDialog::editSprite);
|
||||
connect(m_ui->pushButtonCenterOrigin, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonCenterOrigin, &QAbstractButton::clicked,
|
||||
this, &SpritePropertiesDialog::centerOrigin);
|
||||
connect(m_ui->pushButtonModifyCollisionmask, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonModifyCollisionmask, &QAbstractButton::clicked,
|
||||
this, &SpritePropertiesDialog::modifyMask);
|
||||
|
||||
connect(m_ui->lineEditName, &QLineEdit::textChanged,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <QString>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace Ui { class SpritePropertiesDialog; }
|
||||
struct Sprite;
|
||||
|
||||
@@ -1,11 +1,188 @@
|
||||
#include "timelinepropertiesdialog.h"
|
||||
#include "ui_timelinepropertiesdialog.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "projecttreemodel.h"
|
||||
#include "timelinemomentsmodel.h"
|
||||
#include "timelineactionsmodel.h"
|
||||
|
||||
TimeLinePropertiesDialog::TimeLinePropertiesDialog(TimeLine &timeLine, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::TimeLinePropertiesDialog>()}
|
||||
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_ui->setupUi(this);
|
||||
|
||||
updateTitle();
|
||||
|
||||
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"});
|
||||
|
||||
m_ui->lineEditName->setText(m_timeLine.name);
|
||||
|
||||
m_ui->listViewMoments->setModel(m_momentsModel.get());
|
||||
|
||||
m_ui->listViewActions->setModel(m_actionsModel.get());
|
||||
|
||||
connect(&m_projectModel, &ProjectTreeModel::timeLineNameChanged,
|
||||
this, &TimeLinePropertiesDialog::timeLineNameChanged);
|
||||
|
||||
connect(m_ui->lineEditName, &QLineEdit::textChanged,
|
||||
this, &TimeLinePropertiesDialog::changed);
|
||||
|
||||
connect(m_ui->pushButtonAdd, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::add);
|
||||
connect(m_ui->pushButtonChange, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::change);
|
||||
connect(m_ui->pushButtonDelete, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::delete_);
|
||||
connect(m_ui->pushButtonClear, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::clear);
|
||||
connect(m_ui->pushButtonShift, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::shift);
|
||||
connect(m_ui->pushButtonDuplicate, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::duplicate);
|
||||
connect(m_ui->pushButtonSpread, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::spread);
|
||||
connect(m_ui->pushButtonMerge, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::merge);
|
||||
connect(m_ui->pushButtonShowInformation, &QAbstractButton::clicked,
|
||||
this, &TimeLinePropertiesDialog::showInformation);
|
||||
}
|
||||
|
||||
TimeLinePropertiesDialog::~TimeLinePropertiesDialog() = default;
|
||||
|
||||
void TimeLinePropertiesDialog::accept()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_timeLine.name != m_ui->lineEditName->text())
|
||||
{
|
||||
if (!m_projectModel.rename<TimeLine>(m_timeLine, m_ui->lineEditName->text()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Renaming Time Line failed!"), tr("Renaming Time Line failed!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::reject()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto result = QMessageBox::warning(
|
||||
this,
|
||||
tr("The Time Line has been modified."),
|
||||
tr("Do you want to save your changes?"),
|
||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
|
||||
QMessageBox::Save
|
||||
);
|
||||
switch (result)
|
||||
{
|
||||
case QMessageBox::Save:
|
||||
accept();
|
||||
return;
|
||||
case QMessageBox::Discard:
|
||||
QDialog::reject();
|
||||
return;
|
||||
case QMessageBox::Cancel:
|
||||
return;
|
||||
default:
|
||||
qWarning() << "unexpected dialog result" << result;
|
||||
}
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::changed()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
m_unsavedChanges = true;
|
||||
updateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::timeLineNameChanged(const TimeLine &timeLine)
|
||||
{
|
||||
if (&timeLine != &m_timeLine)
|
||||
return;
|
||||
|
||||
{
|
||||
QSignalBlocker blocker{m_ui->lineEditName};
|
||||
m_ui->lineEditName->setText(timeLine.name);
|
||||
}
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::add()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::change()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::delete_()
|
||||
{
|
||||
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()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::showInformation()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TimeLinePropertiesDialog::updateTitle()
|
||||
{
|
||||
setWindowTitle(tr("Time Line Properties: %0%1")
|
||||
.arg(m_timeLine.name)
|
||||
.arg(m_unsavedChanges ? tr("*") : QString{})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
namespace Ui { class TimeLinePropertiesDialog; }
|
||||
struct TimeLine;
|
||||
class ProjectTreeModel;
|
||||
class TimelineMomentsModel;
|
||||
class TimelineActionsModel;
|
||||
|
||||
class TimeLinePropertiesDialog : public QDialog
|
||||
{
|
||||
@@ -16,6 +18,34 @@ public:
|
||||
explicit TimeLinePropertiesDialog(TimeLine &timeLine, ProjectTreeModel &projectModel, QWidget *parent = nullptr);
|
||||
~TimeLinePropertiesDialog();
|
||||
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
|
||||
private slots:
|
||||
void changed();
|
||||
|
||||
void timeLineNameChanged(const TimeLine &timeLine);
|
||||
|
||||
void add();
|
||||
void change();
|
||||
void delete_();
|
||||
void clear();
|
||||
void shift();
|
||||
void duplicate();
|
||||
void spread();
|
||||
void merge();
|
||||
void showInformation();
|
||||
|
||||
private:
|
||||
void updateTitle();
|
||||
|
||||
const std::unique_ptr<Ui::TimeLinePropertiesDialog> m_ui;
|
||||
|
||||
TimeLine &m_timeLine;
|
||||
ProjectTreeModel &m_projectModel;
|
||||
|
||||
const std::unique_ptr<TimelineMomentsModel> m_momentsModel;
|
||||
const std::unique_ptr<TimelineActionsModel> m_actionsModel;
|
||||
|
||||
bool m_unsavedChanges{};
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>838</width>
|
||||
<height>533</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -17,9 +17,341 @@
|
||||
<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">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelName">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditName</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditName">
|
||||
<property name="toolTip">
|
||||
<string>The name of the time line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButtonAdd">
|
||||
<property name="toolTip">
|
||||
<string>Click here to add another moment</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/add.png</normaloff>:/qtgameengine/icons/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButtonChange">
|
||||
<property name="toolTip">
|
||||
<string>Change the moment</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Change</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/replace.png</normaloff>:/qtgameengine/icons/replace.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButtonDelete">
|
||||
<property name="toolTip">
|
||||
<string>Delete moments</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/delete.png</normaloff>:/qtgameengine/icons/delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="pushButtonShift">
|
||||
<property name="toolTip">
|
||||
<string>Shift moments by an amount</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Shift</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/arrow-right.png</normaloff>:/qtgameengine/icons/arrow-right.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButtonClear">
|
||||
<property name="toolTip">
|
||||
<string>Clear all moments</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>C&lear</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/new.png</normaloff>:/qtgameengine/icons/new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="pushButtonDuplicate">
|
||||
<property name="toolTip">
|
||||
<string>Duplicate moments</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D&uplicate</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/copy.png</normaloff>:/qtgameengine/icons/copy.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<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="4" column="0">
|
||||
<widget class="QPushButton" name="pushButtonSpread">
|
||||
<property name="toolTip">
|
||||
<string>Spread out the moments adding additional time between them</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>S&pread</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/scale.png</normaloff>:/qtgameengine/icons/scale.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="pushButtonMerge">
|
||||
<property name="toolTip">
|
||||
<string>Merge a number of moments into one</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Merge</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/merge.png</normaloff>:/qtgameengine/icons/merge.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushButtonShowInformation">
|
||||
<property name="toolTip">
|
||||
<string>Show information about the time line</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show &Information</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/info.png</normaloff>:/qtgameengine/icons/info.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<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>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelMoments">
|
||||
<property name="text">
|
||||
<string>Moments:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>listViewMoments</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listViewMoments">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<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>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>TimeLinePropertiesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>150</x>
|
||||
<y>277</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>256</x>
|
||||
<y>239</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>TimeLinePropertiesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>150</x>
|
||||
<y>277</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>256</x>
|
||||
<y>239</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "triggerconditiondialog.h"
|
||||
|
||||
TriggerConditionDialog::TriggerConditionDialog(QWidget *parent) :
|
||||
CodeEditorDialog{parent}
|
||||
CodeEditorDialog{tr("Trigger condition"), parent}
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog | Qt::Window);
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowMinimizeButtonHint);
|
||||
setWindowFlag(Qt::WindowMaximizeButtonHint);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "triggersdialog.h"
|
||||
#include "ui_triggersdialog.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "triggersmodel.h"
|
||||
#include "triggerconditiondialog.h"
|
||||
@@ -20,14 +23,50 @@ TriggersDialog::TriggersDialog(ProjectContainer &project, QWidget *parent) :
|
||||
|
||||
m_ui->listView->setModel(m_model.get());
|
||||
|
||||
connect(m_ui->pushButtonUseCodeEditor, &QAbstractButton::pressed,
|
||||
connect(m_ui->pushButtonAdd, &QAbstractButton::clicked,
|
||||
this, &TriggersDialog::add);
|
||||
connect(m_ui->pushButtonDelete, &QAbstractButton::clicked,
|
||||
this, &TriggersDialog::delete_);
|
||||
connect(m_ui->pushButtonLoad, &QAbstractButton::clicked,
|
||||
this, &TriggersDialog::load);
|
||||
connect(m_ui->pushButtonSave, &QAbstractButton::clicked,
|
||||
this, &TriggersDialog::save);
|
||||
connect(m_ui->pushButtonClear, &QAbstractButton::clicked,
|
||||
this, &TriggersDialog::clear);
|
||||
connect(m_ui->pushButtonUseCodeEditor, &QAbstractButton::clicked,
|
||||
this, &TriggersDialog::openCodeEditor);
|
||||
}
|
||||
|
||||
void TriggersDialog::add()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TriggersDialog::delete_()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TriggersDialog::load()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TriggersDialog::save()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void TriggersDialog::clear()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
TriggersDialog::~TriggersDialog() = default;
|
||||
|
||||
void TriggersDialog::openCodeEditor()
|
||||
{
|
||||
TriggerConditionDialog dialog{this};
|
||||
dialog.exec();
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
m_ui->plainTextEdit->setPlainText(dialog.script());
|
||||
}
|
||||
|
||||
@@ -17,6 +17,12 @@ public:
|
||||
~TriggersDialog();
|
||||
|
||||
private slots:
|
||||
void add();
|
||||
void delete_();
|
||||
void load();
|
||||
void save();
|
||||
void clear();
|
||||
|
||||
void openCodeEditor();
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>List of all defined triggers. Click on a trigger to change it</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -36,6 +39,10 @@
|
||||
<property name="text">
|
||||
<string>&Load</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
@@ -46,6 +53,10 @@
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/delete.png</normaloff>:/qtgameengine/icons/delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@@ -56,6 +67,10 @@
|
||||
<property name="text">
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/add.png</normaloff>:/qtgameengine/icons/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
@@ -66,6 +81,10 @@
|
||||
<property name="text">
|
||||
<string>&Clear</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/new.png</normaloff>:/qtgameengine/icons/new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
@@ -76,6 +95,10 @@
|
||||
<property name="text">
|
||||
<string>&Save</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -103,20 +126,34 @@
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditName</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditName"/>
|
||||
<widget class="QLineEdit" name="lineEditName">
|
||||
<property name="toolTip">
|
||||
<string>Type here a name for the trigger</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCondition">
|
||||
<property name="text">
|
||||
<string>Condition:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>plainTextEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit"/>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||
<property name="toolTip">
|
||||
<string>Type here the condition for the trigger</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@@ -135,6 +172,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonUseCodeEditor">
|
||||
<property name="toolTip">
|
||||
<string>Use the code editor to edit the condition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Use code editor</string>
|
||||
</property>
|
||||
@@ -153,6 +193,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonBegin">
|
||||
<property name="toolTip">
|
||||
<string>Event will be checked at the beginning of each step</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Begin of step</string>
|
||||
</property>
|
||||
@@ -160,6 +203,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonMiddle">
|
||||
<property name="toolTip">
|
||||
<string>Event will be checked in the middle of each step (just before the step event)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Middle of step</string>
|
||||
</property>
|
||||
@@ -167,6 +213,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonEnd">
|
||||
<property name="toolTip">
|
||||
<string>Event will be checked at the end of each step</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>End of step</string>
|
||||
</property>
|
||||
@@ -179,17 +228,26 @@
|
||||
<property name="text">
|
||||
<string>Constant name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditConstantName</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditConstantName"/>
|
||||
<widget class="QLineEdit" name="lineEditConstantName">
|
||||
<property name="toolTip">
|
||||
<string>When required you can provide a constant name that you can use in code to call the event</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "userdefinedconstantsdialog.h"
|
||||
#include "ui_userdefinedconstantsdialog.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "constantsmodel.h"
|
||||
|
||||
@@ -18,6 +21,70 @@ UserDefinedConstantsDialog::UserDefinedConstantsDialog(ProjectContainer &project
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/delete.png"});
|
||||
|
||||
m_ui->treeView->setModel(m_model.get());
|
||||
|
||||
connect(m_ui->pushButtonInsert, &QAbstractButton::clicked,
|
||||
this, &UserDefinedConstantsDialog::insert);
|
||||
connect(m_ui->pushButtonAdd, &QAbstractButton::clicked,
|
||||
this, &UserDefinedConstantsDialog::add);
|
||||
connect(m_ui->pushButtonDelete, &QAbstractButton::clicked,
|
||||
this, &UserDefinedConstantsDialog::delete_);
|
||||
connect(m_ui->pushButtonClear, &QAbstractButton::clicked,
|
||||
this, &UserDefinedConstantsDialog::clear);
|
||||
connect(m_ui->pushButtonUp, &QAbstractButton::clicked,
|
||||
this, &UserDefinedConstantsDialog::up);
|
||||
connect(m_ui->pushButtonDown, &QAbstractButton::clicked,
|
||||
this, &UserDefinedConstantsDialog::down);
|
||||
connect(m_ui->pushButtonSort, &QAbstractButton::clicked,
|
||||
this, &UserDefinedConstantsDialog::sort);
|
||||
connect(m_ui->pushButtonLoad, &QAbstractButton::clicked,
|
||||
this, &UserDefinedConstantsDialog::load);
|
||||
connect(m_ui->pushButtonSave, &QAbstractButton::clicked,
|
||||
this, &UserDefinedConstantsDialog::save);
|
||||
}
|
||||
|
||||
UserDefinedConstantsDialog::~UserDefinedConstantsDialog() = default;
|
||||
|
||||
void UserDefinedConstantsDialog::insert()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void UserDefinedConstantsDialog::add()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void UserDefinedConstantsDialog::delete_()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void UserDefinedConstantsDialog::clear()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void UserDefinedConstantsDialog::up()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void UserDefinedConstantsDialog::down()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void UserDefinedConstantsDialog::sort()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void UserDefinedConstantsDialog::load()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void UserDefinedConstantsDialog::save()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,17 @@ public:
|
||||
explicit UserDefinedConstantsDialog(ProjectContainer &project, QWidget *parent = nullptr);
|
||||
~UserDefinedConstantsDialog();
|
||||
|
||||
private slots:
|
||||
void insert();
|
||||
void add();
|
||||
void delete_();
|
||||
void clear();
|
||||
void up();
|
||||
void down();
|
||||
void sort();
|
||||
void load();
|
||||
void save();
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::UserDefinedConstantsDialog> m_ui;
|
||||
|
||||
|
||||
@@ -32,65 +32,128 @@
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButtonInsert">
|
||||
<property name="toolTip">
|
||||
<string>Insert a constant before the current one</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Insert</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/add.png</normaloff>:/qtgameengine/icons/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pushButtonSort">
|
||||
<property name="toolTip">
|
||||
<string>Sort the constants</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Sort</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/sort.png</normaloff>:/qtgameengine/icons/sort.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButtonDelete">
|
||||
<property name="toolTip">
|
||||
<string>Delete the current constant</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/delete.png</normaloff>:/qtgameengine/icons/delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="pushButtonLoad">
|
||||
<property name="toolTip">
|
||||
<string>Load the constants from a text file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Load</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButtonUp">
|
||||
<property name="toolTip">
|
||||
<string>Moves the constant up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Up</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/arrow-up.png</normaloff>:/qtgameengine/icons/arrow-up.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButtonAdd">
|
||||
<property name="toolTip">
|
||||
<string>Append a constant at the end of the list</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/add.png</normaloff>:/qtgameengine/icons/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButtonClear">
|
||||
<property name="toolTip">
|
||||
<string>Clear all the constants</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Clear</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/new.png</normaloff>:/qtgameengine/icons/new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButtonDown">
|
||||
<property name="toolTip">
|
||||
<string>Moves the constant down</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do&wn</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/arrow-down.png</normaloff>:/qtgameengine/icons/arrow-down.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="pushButtonSave">
|
||||
<property name="toolTip">
|
||||
<string>Save the constants to a text file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sa&ve</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user