Lots of changes again
@ -7,7 +7,10 @@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
|
||||
|
||||
HEADERS += \
|
||||
codeeditorwidget.h \
|
||||
dialogs/createspritedialog.h \
|
||||
dialogs/fontpropertiesdialog.h \
|
||||
dialogs/imageeditordialog.h \
|
||||
dialogs/objectinformationdialog.h \
|
||||
dialogs/pathpropertiesdialog.h \
|
||||
dialogs/scriptpropertiesdialog.h \
|
||||
futurecpp.h \
|
||||
@ -22,11 +25,15 @@ HEADERS += \
|
||||
dialogs/globalgamesettingsdialog.h \
|
||||
dialogs/preferencesdialog.h \
|
||||
dialogs/soundpropertiesdialog.h \
|
||||
dialogs/spritepropertiesdialog.h
|
||||
dialogs/spritepropertiesdialog.h \
|
||||
spritesmodel.h
|
||||
|
||||
SOURCES += main.cpp \
|
||||
codeeditorwidget.cpp \
|
||||
dialogs/createspritedialog.cpp \
|
||||
dialogs/fontpropertiesdialog.cpp \
|
||||
dialogs/imageeditordialog.cpp \
|
||||
dialogs/objectinformationdialog.cpp \
|
||||
dialogs/pathpropertiesdialog.cpp \
|
||||
dialogs/scriptpropertiesdialog.cpp \
|
||||
jshighlighter.cpp \
|
||||
@ -40,10 +47,14 @@ SOURCES += main.cpp \
|
||||
dialogs/globalgamesettingsdialog.cpp \
|
||||
dialogs/preferencesdialog.cpp \
|
||||
dialogs/soundpropertiesdialog.cpp \
|
||||
dialogs/spritepropertiesdialog.cpp
|
||||
dialogs/spritepropertiesdialog.cpp \
|
||||
spritesmodel.cpp
|
||||
|
||||
FORMS += \
|
||||
dialogs/createspritedialog.ui \
|
||||
dialogs/fontpropertiesdialog.ui \
|
||||
dialogs/imageeditordialog.ui \
|
||||
dialogs/objectinformationdialog.ui \
|
||||
dialogs/pathpropertiesdialog.ui \
|
||||
dialogs/scriptpropertiesdialog.ui \
|
||||
mainwindow.ui \
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "imageeditordialog.h"
|
||||
|
||||
BackgroundPropertiesDialog::BackgroundPropertiesDialog(Background &background, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
@ -91,7 +92,7 @@ void BackgroundPropertiesDialog::saveBackground()
|
||||
|
||||
void BackgroundPropertiesDialog::editBackground()
|
||||
{
|
||||
|
||||
ImageEditorDialog{this}.exec();
|
||||
}
|
||||
|
||||
void BackgroundPropertiesDialog::changed()
|
||||
|
@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/dialogs/background-file.png</normaloff>:/qtgameengine/icons/dialogs/background-file.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/background-file.png</normaloff>:/qtgameengine/icons/background-file.png</iconset>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
<item>
|
||||
@ -51,7 +51,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/open.png</normaloff>:/qtgameengine/icons/actions/open.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -62,7 +62,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/save.png</normaloff>:/qtgameengine/icons/actions/save.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -73,7 +73,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/buttons/edit.png</normaloff>:/qtgameengine/icons/buttons/edit.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/edit.png</normaloff>:/qtgameengine/icons/edit.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -127,7 +127,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/buttons/ok.png</normaloff>:/qtgameengine/icons/buttons/ok.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/ok.png</normaloff>:/qtgameengine/icons/ok.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
28
dialogs/createspritedialog.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "createspritedialog.h"
|
||||
#include "ui_createspritedialog.h"
|
||||
|
||||
CreateSpriteDialog::CreateSpriteDialog(QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::CreateSpriteDialog>()}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setWindowFlags(windowFlags()
|
||||
& ~Qt::Dialog
|
||||
| Qt::Window
|
||||
| Qt::WindowCloseButtonHint);
|
||||
}
|
||||
|
||||
CreateSpriteDialog::CreateSpriteDialog(const QSize &size, QWidget *parent) :
|
||||
CreateSpriteDialog{parent}
|
||||
{
|
||||
m_ui->spinBoxWidth->setValue(size.width());
|
||||
m_ui->spinBoxHeight->setValue(size.height());
|
||||
}
|
||||
|
||||
CreateSpriteDialog::~CreateSpriteDialog() = default;
|
||||
|
||||
QSize CreateSpriteDialog::size() const
|
||||
{
|
||||
return QSize{m_ui->spinBoxWidth->value(), m_ui->spinBoxHeight->value()};
|
||||
}
|
22
dialogs/createspritedialog.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Ui { class CreateSpriteDialog; }
|
||||
|
||||
class CreateSpriteDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CreateSpriteDialog(QWidget *parent = nullptr);
|
||||
explicit CreateSpriteDialog(const QSize &size, QWidget *parent = nullptr);
|
||||
~CreateSpriteDialog();
|
||||
|
||||
QSize size() const;
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::CreateSpriteDialog> m_ui;
|
||||
};
|
119
dialogs/createspritedialog.ui
Normal file
@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CreateSpriteDialog</class>
|
||||
<widget class="QDialog" name="CreateSpriteDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>283</width>
|
||||
<height>142</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create a new sprite</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
|
||||
<item>
|
||||
<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>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelWidth">
|
||||
<property name="text">
|
||||
<string>Width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelHeight">
|
||||
<property name="text">
|
||||
<string>Height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxWidth">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>32</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxHeight">
|
||||
<property name="maximum">
|
||||
<number>16384</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>32</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CreateSpriteDialog</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>CreateSpriteDialog</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>
|
@ -2,13 +2,18 @@
|
||||
#include "ui_editspritedialog.h"
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "spritesmodel.h"
|
||||
#include "createspritedialog.h"
|
||||
#include "imageeditordialog.h"
|
||||
|
||||
EditSpriteDialog::EditSpriteDialog(Sprite &sprite, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::EditSpriteDialog>()},
|
||||
m_sprite{sprite}
|
||||
m_sprite{sprite},
|
||||
m_model{std::make_unique<SpritesModel>(this)}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setWindowFlags(windowFlags()
|
||||
& ~Qt::Dialog
|
||||
| Qt::Window
|
||||
@ -17,6 +22,30 @@ EditSpriteDialog::EditSpriteDialog(Sprite &sprite, QWidget *parent) :
|
||||
| Qt::WindowCloseButtonHint);
|
||||
|
||||
setWindowTitle(tr("Sprite editor - %0").arg(m_sprite.name));
|
||||
|
||||
m_ui->actionNew->setShortcut(QKeySequence::New);
|
||||
m_ui->actionCreateFromFile->setShortcut(QKeySequence::Open);
|
||||
m_ui->actionSaveAsPngFile->setShortcut(QKeySequence::Save);
|
||||
|
||||
m_ui->listView->setModel(m_model.get());
|
||||
|
||||
connect(m_ui->actionNew, &QAction::triggered, this, &EditSpriteDialog::newSprite);
|
||||
|
||||
connect(m_ui->listView, &QListView::doubleClicked, this, &EditSpriteDialog::doubleClicked);
|
||||
}
|
||||
|
||||
EditSpriteDialog::~EditSpriteDialog() = default;
|
||||
|
||||
void EditSpriteDialog::newSprite()
|
||||
{
|
||||
CreateSpriteDialog dialog{this};
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void EditSpriteDialog::doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
ImageEditorDialog{this}.exec();
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
namespace Ui { class EditSpriteDialog; }
|
||||
struct Sprite;
|
||||
class SpritesModel;
|
||||
|
||||
class EditSpriteDialog : public QDialog
|
||||
{
|
||||
@ -15,8 +16,14 @@ public:
|
||||
explicit EditSpriteDialog(Sprite &sprite, QWidget *parent = nullptr);
|
||||
~EditSpriteDialog();
|
||||
|
||||
private slots:
|
||||
void newSprite();
|
||||
void doubleClicked(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::EditSpriteDialog> m_ui;
|
||||
|
||||
Sprite &m_sprite;
|
||||
|
||||
const std::unique_ptr<SpritesModel> m_model;
|
||||
};
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>491</width>
|
||||
<height>500</height>
|
||||
<width>590</width>
|
||||
<height>510</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -124,7 +124,43 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true"/>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxShowPreview">
|
||||
<property name="text">
|
||||
<string>Show Preview</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>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QListView" name="listView">
|
||||
<property name="spacing">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
@ -133,7 +169,7 @@
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/new.png</normaloff>:/qtgameengine/icons/actions/new.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/new.png</normaloff>:/qtgameengine/icons/new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&New...</string>
|
||||
@ -142,7 +178,7 @@
|
||||
<action name="actionCreateFromFile">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/open.png</normaloff>:/qtgameengine/icons/actions/open.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Create from file...</string>
|
||||
@ -151,13 +187,20 @@
|
||||
<action name="actionAddFromFile">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/create-group.png</normaloff>:/qtgameengine/icons/actions/create-group.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/create-group.png</normaloff>:/qtgameengine/icons/create-group.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add from file...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+A</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveAsPngFile">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Save as PNG File...</string>
|
||||
</property>
|
||||
@ -166,16 +209,22 @@
|
||||
<property name="text">
|
||||
<string>Create from Strip...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+I</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddFromStrip">
|
||||
<property name="text">
|
||||
<string>Add from Stri&p...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+P</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCloseSavingChanges">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/ok.png</normaloff>:/qtgameengine/icons/actions/ok.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/ok.png</normaloff>:/qtgameengine/icons/ok.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close Saving Changes</string>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>338</width>
|
||||
<width>266</width>
|
||||
<height>451</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/dialogs/font-file.png</normaloff>:/qtgameengine/icons/dialogs/font-file.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/font-file.png</normaloff>:/qtgameengine/icons/font-file.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@ -54,7 +54,8 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QFontComboBox" name="fontComboBox"/>
|
||||
<widget class="QFontComboBox" name="fontComboBox">
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxSize"/>
|
||||
@ -213,7 +214,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/buttons/ok.png</normaloff>:/qtgameengine/icons/buttons/ok.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/ok.png</normaloff>:/qtgameengine/icons/ok.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
18
dialogs/imageeditordialog.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "imageeditordialog.h"
|
||||
#include "ui_imageeditordialog.h"
|
||||
|
||||
ImageEditorDialog::ImageEditorDialog(QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::ImageEditorDialog>()}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setWindowFlags(windowFlags()
|
||||
& ~Qt::Dialog
|
||||
| Qt::Window
|
||||
| Qt::WindowMinimizeButtonHint
|
||||
| Qt::WindowMaximizeButtonHint
|
||||
| Qt::WindowCloseButtonHint);
|
||||
}
|
||||
|
||||
ImageEditorDialog::~ImageEditorDialog() = default;
|
19
dialogs/imageeditordialog.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Ui { class ImageEditorDialog; }
|
||||
|
||||
class ImageEditorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ImageEditorDialog(QWidget *parent = nullptr);
|
||||
~ImageEditorDialog();
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::ImageEditorDialog> m_ui;
|
||||
};
|
271
dialogs/imageeditordialog.ui
Normal file
@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ImageEditorDialog</class>
|
||||
<widget class="QDialog" name="ImageEditorDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>572</width>
|
||||
<height>454</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Image Editor</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<widget class="QMenu" name="menu_File">
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<addaction name="actionNew"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSaveAsPngFile"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPreviousImage"/>
|
||||
<addaction name="actionNextImage"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionCloseSavingChanges"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Edit">
|
||||
<property name="title">
|
||||
<string>&Edit</string>
|
||||
</property>
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="actionRedo"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionEraseToLeftColor"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionDelete"/>
|
||||
<addaction name="actionCut"/>
|
||||
<addaction name="actionCopy"/>
|
||||
<addaction name="actionPaste"/>
|
||||
<addaction name="actionPasteFromFile"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSelectAll"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_View">
|
||||
<property name="title">
|
||||
<string>&View</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Transform">
|
||||
<property name="title">
|
||||
<string>&Transform</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Image">
|
||||
<property name="title">
|
||||
<string>&Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menu_File"/>
|
||||
<addaction name="menu_Edit"/>
|
||||
<addaction name="menu_View"/>
|
||||
<addaction name="menu_Transform"/>
|
||||
<addaction name="menu_Image"/>
|
||||
</widget>
|
||||
</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="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="movable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<addaction name="actionCloseSavingChanges"/>
|
||||
<addaction name="actionPreviousImage"/>
|
||||
<addaction name="actionNextImage"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionNew"/>
|
||||
<addaction name="actionLoad"/>
|
||||
<addaction name="actionSaveAsPngFile"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="actionRedo"/>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="graphicsView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/new.png</normaloff>:/qtgameengine/icons/new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&New...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Create a new, empty image</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveAsPngFile">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Save as PNG file...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save the image as a PNG file</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPreviousImage">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/arrow-left.png</normaloff>:/qtgameengine/icons/arrow-left.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Previous image...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Edit the previous subimage of the sprite</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNextImage">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/arrow-right.png</normaloff>:/qtgameengine/icons/arrow-right.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>N&ext image...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Edit the next subimage of the sprite</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCloseSavingChanges">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/ok.png</normaloff>:/qtgameengine/icons/ok.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close Saving Changes</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Close the image editor, saving the changes made</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoad">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUndo">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/undo.png</normaloff>:/qtgameengine/icons/undo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Undo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRedo">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/redo.png</normaloff>:/qtgameengine/icons/redo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Redo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEraseToLeftColor">
|
||||
<property name="text">
|
||||
<string>&Erase to left color</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete">
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCut">
|
||||
<property name="text">
|
||||
<string>Cu&t</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCopy">
|
||||
<property name="text">
|
||||
<string>&Copy</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPaste">
|
||||
<property name="text">
|
||||
<string>&Paste</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPasteFromFile">
|
||||
<property name="text">
|
||||
<string>Paste from F&ile</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSelectAll">
|
||||
<property name="text">
|
||||
<string>Select &All</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
11
dialogs/objectinformationdialog.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include "objectinformationdialog.h"
|
||||
#include "ui_objectinformationdialog.h"
|
||||
|
||||
ObjectInformationDialog::ObjectInformationDialog(QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::ObjectInformationDialog>()}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
ObjectInformationDialog::~ObjectInformationDialog() = default;
|
19
dialogs/objectinformationdialog.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Ui { class ObjectInformationDialog; }
|
||||
|
||||
class ObjectInformationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ObjectInformationDialog(QWidget *parent = nullptr);
|
||||
~ObjectInformationDialog();
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::ObjectInformationDialog> m_ui;
|
||||
};
|
100
dialogs/objectinformationdialog.ui
Normal file
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ObjectInformationDialog</class>
|
||||
<widget class="QDialog" name="ObjectInformationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Information about all Objects</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/object-file.png</normaloff>:/qtgameengine/icons/object-file.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<addaction name="actionOk"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPrint"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="actionOk">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/ok.png</normaloff>:/qtgameengine/icons/ok.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ok</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Close the form</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save the object information to a file</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPrint">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/print.png</normaloff>:/qtgameengine/icons/print.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Print the object information</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/dialogs/path-file.png</normaloff>:/qtgameengine/icons/dialogs/path-file.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/path-file.png</normaloff>:/qtgameengine/icons/path-file.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
|
||||
<property name="spacing">
|
||||
@ -76,6 +76,8 @@
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionClear"/>
|
||||
<addaction name="actionReverse"/>
|
||||
<addaction name="actionShift"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -105,7 +107,7 @@
|
||||
<item>
|
||||
<widget class="QListView" name="listView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -275,7 +277,7 @@
|
||||
<action name="actionOk">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/ok.png</normaloff>:/qtgameengine/icons/actions/ok.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/ok.png</normaloff>:/qtgameengine/icons/ok.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
@ -287,7 +289,7 @@
|
||||
<action name="actionUndo">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/undo.png</normaloff>:/qtgameengine/icons/actions/undo.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/undo.png</normaloff>:/qtgameengine/icons/undo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Undo</string>
|
||||
@ -299,7 +301,7 @@
|
||||
<action name="actionClear">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/new.png</normaloff>:/qtgameengine/icons/actions/new.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/new.png</normaloff>:/qtgameengine/icons/new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
@ -308,6 +310,30 @@
|
||||
<string>Clear the path</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionReverse">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/rotate.png</normaloff>:/qtgameengine/icons/rotate.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reverse</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reverse the path</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShift">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/move.png</normaloff>:/qtgameengine/icons/move.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Shift</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Shift the path</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/dialogs/script-file.png</normaloff>:/qtgameengine/icons/dialogs/script-file.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/script-file.png</normaloff>:/qtgameengine/icons/script-file.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
||||
<property name="spacing">
|
||||
@ -226,7 +226,7 @@
|
||||
<action name="actionOk">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/ok.png</normaloff>:/qtgameengine/icons/actions/ok.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/ok.png</normaloff>:/qtgameengine/icons/ok.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
@ -235,7 +235,7 @@
|
||||
<action name="actionLoad">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/open.png</normaloff>:/qtgameengine/icons/actions/open.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
@ -247,7 +247,7 @@
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/save.png</normaloff>:/qtgameengine/icons/actions/save.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
@ -259,7 +259,7 @@
|
||||
<action name="actionPrint">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/print.png</normaloff>:/qtgameengine/icons/actions/print.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/print.png</normaloff>:/qtgameengine/icons/print.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print</string>
|
||||
@ -274,7 +274,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/undo.png</normaloff>:/qtgameengine/icons/actions/undo.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/undo.png</normaloff>:/qtgameengine/icons/undo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Undo</string>
|
||||
@ -289,7 +289,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/redo.png</normaloff>:/qtgameengine/icons/actions/redo.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/redo.png</normaloff>:/qtgameengine/icons/redo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Redo</string>
|
||||
@ -304,7 +304,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/cut.png</normaloff>:/qtgameengine/icons/actions/cut.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/cut.png</normaloff>:/qtgameengine/icons/cut.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cut</string>
|
||||
@ -319,7 +319,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/copy.png</normaloff>:/qtgameengine/icons/actions/copy.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/copy.png</normaloff>:/qtgameengine/icons/copy.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
@ -331,7 +331,7 @@
|
||||
<action name="actionPaste">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/paste.png</normaloff>:/qtgameengine/icons/actions/paste.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/paste.png</normaloff>:/qtgameengine/icons/paste.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Paste</string>
|
||||
@ -349,7 +349,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/find.png</normaloff>:/qtgameengine/icons/actions/find.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/find.png</normaloff>:/qtgameengine/icons/find.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Find</string>
|
||||
@ -367,7 +367,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/check.png</normaloff>:/qtgameengine/icons/actions/check.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/check.png</normaloff>:/qtgameengine/icons/check.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check</string>
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "ui_soundpropertiesdialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QFileInfo>
|
||||
@ -18,7 +19,11 @@ SoundPropertiesDialog::SoundPropertiesDialog(Sound &sound, QWidget *parent) :
|
||||
setWindowTitle(tr("Sound Properties: %0").arg(m_sound.name));
|
||||
|
||||
m_ui->lineEditName->setText(m_sound.name);
|
||||
m_ui->labelFilename->setText(tr("Filename: %0").arg(QFileInfo{m_sound.path}.fileName()));
|
||||
if (!m_sound.path.isEmpty())
|
||||
{
|
||||
m_ui->labelFilename->setText(tr("Filename: %0").arg(QFileInfo{m_sound.path}.fileName()));
|
||||
m_soundEffect.setSource(QUrl::fromLocalFile(m_sound.path));
|
||||
}
|
||||
m_ui->radioButtonNormal->setChecked(m_sound.type == Sound::Type::Sound);
|
||||
m_ui->radioButtonMusic->setChecked(m_sound.type == Sound::Type::Music);
|
||||
m_ui->checkBoxChorus->setChecked(m_sound.effects.chorus);
|
||||
@ -79,6 +84,9 @@ void SoundPropertiesDialog::accept()
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_newPath)
|
||||
m_sound.path = *m_newPath;
|
||||
|
||||
if (m_ui->radioButtonNormal->isChecked())
|
||||
m_sound.type = Sound::Type::Sound;
|
||||
else if (m_ui->radioButtonMusic->isChecked())
|
||||
@ -132,13 +140,44 @@ void SoundPropertiesDialog::reject()
|
||||
|
||||
void SoundPropertiesDialog::loadSound()
|
||||
{
|
||||
QFileDialog::getOpenFileName(this, tr("Open a Sound File..."));
|
||||
const auto path = QFileDialog::getOpenFileName(this, tr("Open a Sound File..."));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
if (QFile file{path}; !file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Could not load Sound!"), tr("Could not load Sound!") + "\n\n" + file.errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
m_newPath = path;
|
||||
changed();
|
||||
m_ui->labelFilename->setText(tr("Filename: %0").arg(QFileInfo{path}.fileName()));
|
||||
m_soundEffect.setSource(QUrl::fromLocalFile(path));
|
||||
}
|
||||
|
||||
void SoundPropertiesDialog::saveSound()
|
||||
{
|
||||
const auto &path = m_newPath ? *m_newPath : m_sound.path;
|
||||
if (path.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Could not save Sound!"), tr("Could not save Sound!") + "\n\n" + tr("No sound has been selected yet."));
|
||||
return;
|
||||
}
|
||||
|
||||
const auto savePath = QFileDialog::getSaveFileName(this, tr("Save a Sound File..."), m_sound.name + ".wav", tr("WAV Files (*.wav)"));
|
||||
if (savePath.isEmpty())
|
||||
return;
|
||||
|
||||
if (!QFile::copy(path, savePath))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Could not save Sound!"), tr("Could not save Sound!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void SoundPropertiesDialog::playSound()
|
||||
{
|
||||
m_soundEffect.setSource(QUrl::fromLocalFile(m_sound.path));
|
||||
m_soundEffect.stop();
|
||||
m_soundEffect.play();
|
||||
}
|
||||
|
||||
@ -147,11 +186,6 @@ void SoundPropertiesDialog::stopSound()
|
||||
m_soundEffect.stop();
|
||||
}
|
||||
|
||||
void SoundPropertiesDialog::saveSound()
|
||||
{
|
||||
QFileDialog::getSaveFileName(this, tr("Save a Sound File..."), m_sound.name + ".wav", tr("WAV Files (*.wav)"));
|
||||
}
|
||||
|
||||
void SoundPropertiesDialog::editSound()
|
||||
{
|
||||
QMessageBox::critical(this, tr("Setup not complete"), tr("No valid external editor has been indicated for this type of sound. You can specify this editor in the Preferences."));
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QSoundEffect>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace Ui { class SoundPropertiesDialog; }
|
||||
struct Sound;
|
||||
@ -22,9 +23,9 @@ public:
|
||||
|
||||
private slots:
|
||||
void loadSound();
|
||||
void saveSound();
|
||||
void playSound();
|
||||
void stopSound();
|
||||
void saveSound();
|
||||
void editSound();
|
||||
|
||||
void changed();
|
||||
@ -36,5 +37,7 @@ private:
|
||||
|
||||
bool m_unsavedChanges{};
|
||||
|
||||
std::optional<QString> m_newPath;
|
||||
|
||||
QSoundEffect m_soundEffect;
|
||||
};
|
||||
|
@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/dialogs/sound-file.png</normaloff>:/qtgameengine/icons/dialogs/sound-file.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/sound-file.png</normaloff>:/qtgameengine/icons/sound-file.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
@ -44,7 +44,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/open.png</normaloff>:/qtgameengine/icons/actions/open.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -58,7 +58,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/run.png</normaloff>:/qtgameengine/icons/actions/run.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/run.png</normaloff>:/qtgameengine/icons/run.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -72,7 +72,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/exit.png</normaloff>:/qtgameengine/icons/actions/exit.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/exit.png</normaloff>:/qtgameengine/icons/exit.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -85,7 +85,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/save.png</normaloff>:/qtgameengine/icons/actions/save.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -268,7 +268,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/sound.png</normaloff>:/qtgameengine/icons/actions/sound.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/sound.png</normaloff>:/qtgameengine/icons/sound.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -309,7 +309,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/buttons/ok.png</normaloff>:/qtgameengine/icons/buttons/ok.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/ok.png</normaloff>:/qtgameengine/icons/ok.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -58,6 +58,8 @@ void SpritePropertiesDialog::accept()
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_newPixmaps)
|
||||
m_sprite.pixmaps = *m_newPixmaps;
|
||||
m_sprite.origin.x = m_ui->spinBoxOriginX->value();
|
||||
m_sprite.origin.y = m_ui->spinBoxOriginY->value();
|
||||
m_sprite.preciseCollisionChecking = m_ui->checkBoxPreciseCollisionChecking->isChecked();
|
||||
@ -98,12 +100,44 @@ void SpritePropertiesDialog::reject()
|
||||
|
||||
void SpritePropertiesDialog::loadSprite()
|
||||
{
|
||||
QFileDialog::getOpenFileName(this, tr("Open a Sprite Image..."));
|
||||
const auto path = QFileDialog::getOpenFileName(this, tr("Open a Sprite Image..."), {}, tr("BMP Files (*.bmp), PNG Files (*png)"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!pixmap.load(path))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Could not load sprite!"), tr("Could not load sprite!"));
|
||||
return;
|
||||
}
|
||||
|
||||
m_ui->labelPreview->setPixmap(pixmap);
|
||||
|
||||
m_newPixmaps = std::vector<QPixmap>{ std::move(pixmap) };
|
||||
m_unsavedChanges = true;
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
void SpritePropertiesDialog::saveSprite()
|
||||
{
|
||||
QFileDialog::getSaveFileName(this, tr("Save a Sprite Image..."), m_sprite.name + ".png", tr("PNG Files (*.png)"));
|
||||
const auto &pixmaps = m_newPixmaps ? *m_newPixmaps : m_sprite.pixmaps;
|
||||
|
||||
if (pixmaps.empty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("No sprites available to save!"), tr("No sprites available to save!"));
|
||||
return;
|
||||
}
|
||||
|
||||
const auto path = QFileDialog::getSaveFileName(this, tr("Save a Sprite Image..."), m_sprite.name + ".png", tr("PNG Files (*.png)"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
if (!pixmaps.front().save(path))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Could not save sprite!"), tr("Could not save sprite!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void SpritePropertiesDialog::editSprite()
|
||||
@ -127,7 +161,15 @@ void SpritePropertiesDialog::changed()
|
||||
{
|
||||
if (!m_unsavedChanges)
|
||||
{
|
||||
setWindowTitle(tr("Sprite Properties: %0*").arg(m_sprite.name));
|
||||
m_unsavedChanges = true;
|
||||
updateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
void SpritePropertiesDialog::updateTitle()
|
||||
{
|
||||
setWindowTitle(tr("Sprite Properties: %0%1")
|
||||
.arg(m_sprite.name)
|
||||
.arg(m_unsavedChanges ? tr("*") : QString{})
|
||||
);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QString>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace Ui { class SpritePropertiesDialog; }
|
||||
struct Sprite;
|
||||
@ -28,9 +29,13 @@ private slots:
|
||||
void changed();
|
||||
|
||||
private:
|
||||
void updateTitle();
|
||||
|
||||
const std::unique_ptr<Ui::SpritePropertiesDialog> m_ui;
|
||||
|
||||
Sprite &m_sprite;
|
||||
|
||||
bool m_unsavedChanges{};
|
||||
|
||||
std::optional<std::vector<QPixmap>> m_newPixmaps;
|
||||
};
|
||||
|
@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/dialogs/sprite-file.png</normaloff>:/qtgameengine/icons/dialogs/sprite-file.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/sprite-file.png</normaloff>:/qtgameengine/icons/sprite-file.png</iconset>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
|
||||
<item>
|
||||
@ -61,7 +61,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/open.png</normaloff>:/qtgameengine/icons/actions/open.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -72,7 +72,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/save.png</normaloff>:/qtgameengine/icons/actions/save.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -83,7 +83,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/buttons/edit.png</normaloff>:/qtgameengine/icons/buttons/edit.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/edit.png</normaloff>:/qtgameengine/icons/edit.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -246,7 +246,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/buttons/ok.png</normaloff>:/qtgameengine/icons/buttons/ok.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/ok.png</normaloff>:/qtgameengine/icons/ok.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
BIN
icons/arrow-down.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
icons/arrow-left.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
icons/arrow-right.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
icons/arrow-up.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
BIN
icons/file.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
BIN
icons/move.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
icons/object-file.png
Normal file
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
BIN
icons/rotate.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
141
mainwindow.cpp
@ -5,6 +5,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "projecttreemodel.h"
|
||||
#include "dialogs/spritepropertiesdialog.h"
|
||||
@ -17,11 +18,12 @@
|
||||
#include "dialogs/gameinformationdialog.h"
|
||||
#include "dialogs/globalgamesettingsdialog.h"
|
||||
#include "dialogs/extensionpackagesdialog.h"
|
||||
#include "dialogs/objectinformationdialog.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow{parent},
|
||||
m_ui{std::make_unique<Ui::MainWindow>()},
|
||||
m_projectTreeModel{std::make_unique<ProjectTreeModel>(&m_project, this)}
|
||||
m_projectTreeModel{std::make_unique<ProjectTreeModel>(m_project, this)}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@ -74,6 +76,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(m_ui->actionDelete, &QAction::triggered, this, &MainWindow::delete_);
|
||||
connect(m_ui->actionRename, &QAction::triggered, this, &MainWindow::rename);
|
||||
connect(m_ui->actionProperties, &QAction::triggered, this, &MainWindow::showProperties);
|
||||
connect(m_ui->actionFindResource, &QAction::triggered, this, &MainWindow::findResource);
|
||||
connect(m_ui->actionShowObjectInformation, &QAction::triggered, this, &MainWindow::showObjectInformation);
|
||||
connect(m_ui->actionCreateSprite, &QAction::triggered, this, &MainWindow::createSprite);
|
||||
connect(m_ui->actionCreateSound, &QAction::triggered, this, &MainWindow::createSound);
|
||||
connect(m_ui->actionCreateBackground, &QAction::triggered, this, &MainWindow::createBackground);
|
||||
@ -88,6 +92,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
m_ui->treeView->setModel(m_projectTreeModel.get());
|
||||
|
||||
connect(m_projectTreeModel.get(), &ProjectTreeModel::errorOccured,
|
||||
this, &MainWindow::modelErrorOccured);
|
||||
|
||||
connect(m_ui->treeView, &QTreeView::customContextMenuRequested,
|
||||
this, &MainWindow::contextMenuRequested);
|
||||
|
||||
@ -189,7 +196,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
if (!sprite)
|
||||
break;
|
||||
|
||||
if (const auto iter = m_spritePropertiesDialogs.find(sprite); iter != std::cend(m_spritePropertiesDialogs))
|
||||
if (const auto iter = m_spritePropertiesWindows.find(sprite); iter != std::cend(m_spritePropertiesWindows))
|
||||
{
|
||||
m_ui->mdiArea->setActiveSubWindow(iter->second);
|
||||
}
|
||||
@ -210,7 +217,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
});
|
||||
connect(dialog, &QWidget::windowTitleChanged, action, &QAction::setText);
|
||||
connect(dialog, &QDialog::finished,
|
||||
this, [&spritePropertiesDialogs=m_spritePropertiesDialogs,subwindow](){
|
||||
this, [&spritePropertiesDialogs=m_spritePropertiesWindows,subwindow](){
|
||||
for (auto iter = std::begin(spritePropertiesDialogs); iter != std::end(spritePropertiesDialogs); )
|
||||
{
|
||||
if (iter->second == subwindow)
|
||||
@ -223,7 +230,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
subwindow, &QObject::deleteLater);
|
||||
connect(dialog, &QDialog::finished,
|
||||
action, &QObject::deleteLater);
|
||||
m_spritePropertiesDialogs[sprite] = subwindow;
|
||||
m_spritePropertiesWindows[sprite] = subwindow;
|
||||
dialog->show();
|
||||
}
|
||||
break;
|
||||
@ -234,7 +241,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
if (!sound)
|
||||
break;
|
||||
|
||||
if (const auto iter = m_soundPropertiesDialogs.find(sound); iter != std::cend(m_soundPropertiesDialogs))
|
||||
if (const auto iter = m_soundPropertiesWindows.find(sound); iter != std::cend(m_soundPropertiesWindows))
|
||||
{
|
||||
m_ui->mdiArea->setActiveSubWindow(iter->second);
|
||||
}
|
||||
@ -255,7 +262,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
});
|
||||
connect(dialog, &QWidget::windowTitleChanged, action, &QAction::setText);
|
||||
connect(dialog, &QDialog::finished,
|
||||
this, [&soundPropertiesDialogs=m_soundPropertiesDialogs,subwindow](){
|
||||
this, [&soundPropertiesDialogs=m_soundPropertiesWindows,subwindow](){
|
||||
for (auto iter = std::begin(soundPropertiesDialogs); iter != std::end(soundPropertiesDialogs); )
|
||||
{
|
||||
if (iter->second == subwindow)
|
||||
@ -268,7 +275,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
subwindow, &QObject::deleteLater);
|
||||
connect(dialog, &QDialog::finished,
|
||||
action, &QObject::deleteLater);
|
||||
m_soundPropertiesDialogs[sound] = subwindow;
|
||||
m_soundPropertiesWindows[sound] = subwindow;
|
||||
dialog->show();
|
||||
}
|
||||
break;
|
||||
@ -279,7 +286,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
if (!background)
|
||||
break;
|
||||
|
||||
if (const auto iter = m_backgroundPropertiesDialogs.find(background); iter != std::cend(m_backgroundPropertiesDialogs))
|
||||
if (const auto iter = m_backgroundPropertiesWindows.find(background); iter != std::cend(m_backgroundPropertiesWindows))
|
||||
{
|
||||
m_ui->mdiArea->setActiveSubWindow(iter->second);
|
||||
}
|
||||
@ -300,7 +307,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
});
|
||||
connect(dialog, &QWidget::windowTitleChanged, action, &QAction::setText);
|
||||
connect(dialog, &QDialog::finished,
|
||||
this, [&backgroundPropertiesDialogs=m_backgroundPropertiesDialogs,subwindow](){
|
||||
this, [&backgroundPropertiesDialogs=m_backgroundPropertiesWindows,subwindow](){
|
||||
for (auto iter = std::begin(backgroundPropertiesDialogs); iter != std::end(backgroundPropertiesDialogs); )
|
||||
{
|
||||
if (iter->second == subwindow)
|
||||
@ -313,7 +320,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
subwindow, &QObject::deleteLater);
|
||||
connect(dialog, &QDialog::finished,
|
||||
action, &QObject::deleteLater);
|
||||
m_backgroundPropertiesDialogs[background] = subwindow;
|
||||
m_backgroundPropertiesWindows[background] = subwindow;
|
||||
dialog->show();
|
||||
}
|
||||
break;
|
||||
@ -324,7 +331,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
if (!path)
|
||||
break;
|
||||
|
||||
if (const auto iter = m_pathPropertiesDialogs.find(path); iter != std::cend(m_pathPropertiesDialogs))
|
||||
if (const auto iter = m_pathPropertiesWindows.find(path); iter != std::cend(m_pathPropertiesWindows))
|
||||
{
|
||||
m_ui->mdiArea->setActiveSubWindow(iter->second);
|
||||
}
|
||||
@ -345,7 +352,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
});
|
||||
connect(dialog, &QWidget::windowTitleChanged, action, &QAction::setText);
|
||||
connect(dialog, &QDialog::finished,
|
||||
this, [&pathPropertiesDialogs=m_pathPropertiesDialogs,subwindow](){
|
||||
this, [&pathPropertiesDialogs=m_pathPropertiesWindows,subwindow](){
|
||||
for (auto iter = std::begin(pathPropertiesDialogs); iter != std::end(pathPropertiesDialogs); )
|
||||
{
|
||||
if (iter->second == subwindow)
|
||||
@ -358,7 +365,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
subwindow, &QObject::deleteLater);
|
||||
connect(dialog, &QDialog::finished,
|
||||
action, &QObject::deleteLater);
|
||||
m_pathPropertiesDialogs[path] = subwindow;
|
||||
m_pathPropertiesWindows[path] = subwindow;
|
||||
dialog->show();
|
||||
}
|
||||
break;
|
||||
@ -369,7 +376,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
if (!script)
|
||||
break;
|
||||
|
||||
if (const auto iter = m_scriptPropertiesDialogs.find(script); iter != std::cend(m_scriptPropertiesDialogs))
|
||||
if (const auto iter = m_scriptPropertiesWindows.find(script); iter != std::cend(m_scriptPropertiesWindows))
|
||||
{
|
||||
m_ui->mdiArea->setActiveSubWindow(iter->second);
|
||||
}
|
||||
@ -390,7 +397,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
});
|
||||
connect(dialog, &QWidget::windowTitleChanged, action, &QAction::setText);
|
||||
connect(dialog, &QDialog::finished,
|
||||
this, [&scriptPropertiesDialogs=m_scriptPropertiesDialogs,subwindow](){
|
||||
this, [&scriptPropertiesDialogs=m_scriptPropertiesWindows,subwindow](){
|
||||
for (auto iter = std::begin(scriptPropertiesDialogs); iter != std::end(scriptPropertiesDialogs); )
|
||||
{
|
||||
if (iter->second == subwindow)
|
||||
@ -403,7 +410,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
subwindow, &QObject::deleteLater);
|
||||
connect(dialog, &QDialog::finished,
|
||||
action, &QObject::deleteLater);
|
||||
m_scriptPropertiesDialogs[script] = subwindow;
|
||||
m_scriptPropertiesWindows[script] = subwindow;
|
||||
dialog->show();
|
||||
}
|
||||
break;
|
||||
@ -414,7 +421,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
if (!font)
|
||||
break;
|
||||
|
||||
if (const auto iter = m_fontPropertiesDialogs.find(font); iter != std::cend(m_fontPropertiesDialogs))
|
||||
if (const auto iter = m_fontPropertiesWindows.find(font); iter != std::cend(m_fontPropertiesWindows))
|
||||
{
|
||||
m_ui->mdiArea->setActiveSubWindow(iter->second);
|
||||
}
|
||||
@ -435,7 +442,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
});
|
||||
connect(dialog, &QWidget::windowTitleChanged, action, &QAction::setText);
|
||||
connect(dialog, &QDialog::finished,
|
||||
this, [&fontPropertiesDialogs=m_fontPropertiesDialogs,subwindow](){
|
||||
this, [&fontPropertiesDialogs=m_fontPropertiesWindows,subwindow](){
|
||||
for (auto iter = std::begin(fontPropertiesDialogs); iter != std::end(fontPropertiesDialogs); )
|
||||
{
|
||||
if (iter->second == subwindow)
|
||||
@ -448,7 +455,7 @@ void MainWindow::doubleClicked(const QModelIndex &index)
|
||||
subwindow, &QObject::deleteLater);
|
||||
connect(dialog, &QDialog::finished,
|
||||
action, &QObject::deleteLater);
|
||||
m_fontPropertiesDialogs[font] = subwindow;
|
||||
m_fontPropertiesWindows[font] = subwindow;
|
||||
dialog->show();
|
||||
}
|
||||
break;
|
||||
@ -542,6 +549,11 @@ void MainWindow::selectionChanged(const QModelIndex &index)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::modelErrorOccured(const QString &message)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Error occured!"), tr("Error occured!") + "\n\n" + message);
|
||||
}
|
||||
|
||||
void MainWindow::newFile()
|
||||
{
|
||||
m_ui->mdiArea->closeAllSubWindows();
|
||||
@ -795,6 +807,49 @@ void MainWindow::showProperties()
|
||||
doubleClicked(index);
|
||||
}
|
||||
|
||||
void MainWindow::findResource()
|
||||
{
|
||||
bool ok;
|
||||
const auto filter = QInputDialog::getText(this, tr("Finding a resource"), tr("Resource name:"), QLineEdit::Normal, {}, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void MainWindow::showObjectInformation()
|
||||
{
|
||||
if (m_objectInformationWindow)
|
||||
m_ui->mdiArea->setActiveSubWindow(m_objectInformationWindow);
|
||||
else
|
||||
{
|
||||
auto dialog = new ObjectInformationDialog;
|
||||
auto subwindow = m_ui->mdiArea->addSubWindow(dialog);
|
||||
auto action = m_ui->menuWindow->addAction(dialog->windowTitle());
|
||||
action->setCheckable(true);
|
||||
connect(action, &QAction::triggered,
|
||||
m_ui->mdiArea, [mdiArea=m_ui->mdiArea,subwindow,action](){
|
||||
mdiArea->setActiveSubWindow(subwindow);
|
||||
action->setChecked(subwindow->windowState().testFlag(Qt::WindowActive));
|
||||
});
|
||||
connect(subwindow, &QMdiSubWindow::windowStateChanged,
|
||||
action, [action](Qt::WindowStates oldState, Qt::WindowStates newState){
|
||||
action->setChecked(newState.testFlag(Qt::WindowActive));
|
||||
});
|
||||
connect(dialog, &QWidget::windowTitleChanged, action, &QAction::setText);
|
||||
connect(dialog, &QDialog::finished,
|
||||
this, [&objectInformationWindow=m_objectInformationWindow](){
|
||||
objectInformationWindow = nullptr;
|
||||
});
|
||||
connect(dialog, &QDialog::finished,
|
||||
subwindow, &QObject::deleteLater);
|
||||
connect(dialog, &QDialog::finished,
|
||||
action, &QObject::deleteLater);
|
||||
m_objectInformationWindow = subwindow;
|
||||
dialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::createSprite()
|
||||
{
|
||||
if (!m_projectTreeModel->insertRows(m_project.sprites.size(), 1, m_projectTreeModel->spritesRoot()))
|
||||
@ -868,10 +923,10 @@ void MainWindow::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int
|
||||
{
|
||||
if (const auto sprite = m_projectTreeModel->getSprite(m_projectTreeModel->index(row, 0, parent)))
|
||||
{
|
||||
if (const auto iter = m_spritePropertiesDialogs.find(sprite); iter != std::end(m_spritePropertiesDialogs))
|
||||
if (const auto iter = m_spritePropertiesWindows.find(sprite); iter != std::end(m_spritePropertiesWindows))
|
||||
{
|
||||
delete iter->second;
|
||||
m_spritePropertiesDialogs.erase(iter);
|
||||
m_spritePropertiesWindows.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -882,10 +937,10 @@ void MainWindow::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int
|
||||
{
|
||||
if (const auto sound = m_projectTreeModel->getSound(m_projectTreeModel->index(row, 0, parent)))
|
||||
{
|
||||
if (const auto iter = m_soundPropertiesDialogs.find(sound); iter != std::end(m_soundPropertiesDialogs))
|
||||
if (const auto iter = m_soundPropertiesWindows.find(sound); iter != std::end(m_soundPropertiesWindows))
|
||||
{
|
||||
delete iter->second;
|
||||
m_soundPropertiesDialogs.erase(iter);
|
||||
m_soundPropertiesWindows.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -896,10 +951,10 @@ void MainWindow::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int
|
||||
{
|
||||
if (const auto background = m_projectTreeModel->getBackground(m_projectTreeModel->index(row, 0, parent)))
|
||||
{
|
||||
if (const auto iter = m_backgroundPropertiesDialogs.find(background); iter != std::end(m_backgroundPropertiesDialogs))
|
||||
if (const auto iter = m_backgroundPropertiesWindows.find(background); iter != std::end(m_backgroundPropertiesWindows))
|
||||
{
|
||||
delete iter->second;
|
||||
m_backgroundPropertiesDialogs.erase(iter);
|
||||
m_backgroundPropertiesWindows.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -910,10 +965,10 @@ void MainWindow::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int
|
||||
{
|
||||
if (const auto path = m_projectTreeModel->getPath(m_projectTreeModel->index(row, 0, parent)))
|
||||
{
|
||||
if (const auto iter = m_pathPropertiesDialogs.find(path); iter != std::end(m_pathPropertiesDialogs))
|
||||
if (const auto iter = m_pathPropertiesWindows.find(path); iter != std::end(m_pathPropertiesWindows))
|
||||
{
|
||||
delete iter->second;
|
||||
m_pathPropertiesDialogs.erase(iter);
|
||||
m_pathPropertiesWindows.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -924,10 +979,10 @@ void MainWindow::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int
|
||||
{
|
||||
if (const auto script = m_projectTreeModel->getScript(m_projectTreeModel->index(row, 0, parent)))
|
||||
{
|
||||
if (const auto iter = m_scriptPropertiesDialogs.find(script); iter != std::end(m_scriptPropertiesDialogs))
|
||||
if (const auto iter = m_scriptPropertiesWindows.find(script); iter != std::end(m_scriptPropertiesWindows))
|
||||
{
|
||||
delete iter->second;
|
||||
m_scriptPropertiesDialogs.erase(iter);
|
||||
m_scriptPropertiesWindows.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -938,10 +993,10 @@ void MainWindow::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int
|
||||
{
|
||||
if (const auto font = m_projectTreeModel->getFont(m_projectTreeModel->index(row, 0, parent)))
|
||||
{
|
||||
if (const auto iter = m_fontPropertiesDialogs.find(font); iter != std::end(m_fontPropertiesDialogs))
|
||||
if (const auto iter = m_fontPropertiesWindows.find(font); iter != std::end(m_fontPropertiesWindows))
|
||||
{
|
||||
delete iter->second;
|
||||
m_fontPropertiesDialogs.erase(iter);
|
||||
m_fontPropertiesWindows.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -950,24 +1005,24 @@ void MainWindow::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int
|
||||
|
||||
void MainWindow::modelAboutToBeReset()
|
||||
{
|
||||
for (const auto &pair : m_spritePropertiesDialogs)
|
||||
for (const auto &pair : m_spritePropertiesWindows)
|
||||
delete pair.second;
|
||||
m_spritePropertiesDialogs.clear();
|
||||
for (const auto &pair : m_soundPropertiesDialogs)
|
||||
m_spritePropertiesWindows.clear();
|
||||
for (const auto &pair : m_soundPropertiesWindows)
|
||||
delete pair.second;
|
||||
m_soundPropertiesDialogs.clear();
|
||||
for (const auto &pair : m_backgroundPropertiesDialogs)
|
||||
m_soundPropertiesWindows.clear();
|
||||
for (const auto &pair : m_backgroundPropertiesWindows)
|
||||
delete pair.second;
|
||||
m_backgroundPropertiesDialogs.clear();
|
||||
for (const auto &pair : m_pathPropertiesDialogs)
|
||||
m_backgroundPropertiesWindows.clear();
|
||||
for (const auto &pair : m_pathPropertiesWindows)
|
||||
delete pair.second;
|
||||
m_pathPropertiesDialogs.clear();
|
||||
for (const auto &pair : m_scriptPropertiesDialogs)
|
||||
m_pathPropertiesWindows.clear();
|
||||
for (const auto &pair : m_scriptPropertiesWindows)
|
||||
delete pair.second;
|
||||
m_scriptPropertiesDialogs.clear();
|
||||
for (const auto &pair : m_fontPropertiesDialogs)
|
||||
m_scriptPropertiesWindows.clear();
|
||||
for (const auto &pair : m_fontPropertiesWindows)
|
||||
delete pair.second;
|
||||
m_fontPropertiesDialogs.clear();
|
||||
m_fontPropertiesWindows.clear();
|
||||
}
|
||||
|
||||
void MainWindow::updateTitle()
|
||||
|
17
mainwindow.h
@ -26,6 +26,7 @@ private slots:
|
||||
void contextMenuRequested(const QPoint &pos);
|
||||
void doubleClicked(const QModelIndex &index);
|
||||
void selectionChanged(const QModelIndex &index);
|
||||
void modelErrorOccured(const QString &message);
|
||||
|
||||
void newFile();
|
||||
void openFile();
|
||||
@ -43,6 +44,8 @@ private slots:
|
||||
void delete_();
|
||||
void rename();
|
||||
void showProperties();
|
||||
void findResource();
|
||||
void showObjectInformation();
|
||||
void createSprite();
|
||||
void createSound();
|
||||
void createBackground();
|
||||
@ -70,10 +73,12 @@ private:
|
||||
|
||||
const std::unique_ptr<ProjectTreeModel> m_projectTreeModel;
|
||||
|
||||
std::map<Sprite*, QMdiSubWindow*> m_spritePropertiesDialogs;
|
||||
std::map<Sound*, QMdiSubWindow*> m_soundPropertiesDialogs;
|
||||
std::map<Background*, QMdiSubWindow*> m_backgroundPropertiesDialogs;
|
||||
std::map<Path*, QMdiSubWindow*> m_pathPropertiesDialogs;
|
||||
std::map<Script*, QMdiSubWindow*> m_scriptPropertiesDialogs;
|
||||
std::map<Font*, QMdiSubWindow*> m_fontPropertiesDialogs;
|
||||
std::map<Sprite*, QMdiSubWindow*> m_spritePropertiesWindows;
|
||||
std::map<Sound*, QMdiSubWindow*> m_soundPropertiesWindows;
|
||||
std::map<Background*, QMdiSubWindow*> m_backgroundPropertiesWindows;
|
||||
std::map<Path*, QMdiSubWindow*> m_pathPropertiesWindows;
|
||||
std::map<Script*, QMdiSubWindow*> m_scriptPropertiesWindows;
|
||||
std::map<Font*, QMdiSubWindow*> m_fontPropertiesWindows;
|
||||
|
||||
QMdiSubWindow *m_objectInformationWindow{};
|
||||
};
|
||||
|
@ -262,7 +262,7 @@
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/new.png</normaloff>:/qtgameengine/icons/actions/new.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/new.png</normaloff>:/qtgameengine/icons/new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&New</string>
|
||||
@ -271,7 +271,7 @@
|
||||
<action name="actionOpen">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/open.png</normaloff>:/qtgameengine/icons/actions/open.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Open</string>
|
||||
@ -280,7 +280,7 @@
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/save.png</normaloff>:/qtgameengine/icons/actions/save.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/save.png</normaloff>:/qtgameengine/icons/save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Save</string>
|
||||
@ -289,7 +289,7 @@
|
||||
<action name="actionSaveAs">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/save-as.png</normaloff>:/qtgameengine/icons/actions/save-as.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/save-as.png</normaloff>:/qtgameengine/icons/save-as.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save &As...</string>
|
||||
@ -298,7 +298,7 @@
|
||||
<action name="actionCreateExecutable">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/create-executable.png</normaloff>:/qtgameengine/icons/actions/create-executable.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/create-executable.png</normaloff>:/qtgameengine/icons/create-executable.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Create Executable...</string>
|
||||
@ -307,7 +307,7 @@
|
||||
<action name="actionPublishGame">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/publish-game.png</normaloff>:/qtgameengine/icons/actions/publish-game.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/publish-game.png</normaloff>:/qtgameengine/icons/publish-game.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>P&ublish your Game...</string>
|
||||
@ -316,7 +316,7 @@
|
||||
<action name="actionImportResources">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/import-resources.png</normaloff>:/qtgameengine/icons/actions/import-resources.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/import-resources.png</normaloff>:/qtgameengine/icons/import-resources.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Import Resources...</string>
|
||||
@ -325,7 +325,7 @@
|
||||
<action name="actionExportResources">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/export-resources.png</normaloff>:/qtgameengine/icons/actions/export-resources.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/export-resources.png</normaloff>:/qtgameengine/icons/export-resources.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Export Resources...</string>
|
||||
@ -345,7 +345,7 @@
|
||||
<action name="actionPreferences">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/preferences.png</normaloff>:/qtgameengine/icons/actions/preferences.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/preferences.png</normaloff>:/qtgameengine/icons/preferences.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Preferences...</string>
|
||||
@ -357,7 +357,7 @@
|
||||
<action name="actionExit">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/exit.png</normaloff>:/qtgameengine/icons/actions/exit.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/exit.png</normaloff>:/qtgameengine/icons/exit.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>E&xit</string>
|
||||
@ -377,7 +377,7 @@
|
||||
<action name="actionCreate">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/create.png</normaloff>:/qtgameengine/icons/actions/create.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/create.png</normaloff>:/qtgameengine/icons/create.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Create</string>
|
||||
@ -386,7 +386,7 @@
|
||||
<action name="actionDuplicate">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/duplicate.png</normaloff>:/qtgameengine/icons/actions/duplicate.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/duplicate.png</normaloff>:/qtgameengine/icons/duplicate.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D&uplicate</string>
|
||||
@ -398,7 +398,7 @@
|
||||
<action name="actionCreateGroup">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/create-group.png</normaloff>:/qtgameengine/icons/actions/create-group.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/create-group.png</normaloff>:/qtgameengine/icons/create-group.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cr&eate Group</string>
|
||||
@ -412,7 +412,7 @@
|
||||
<action name="actionDelete">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/delete.png</normaloff>:/qtgameengine/icons/actions/delete.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/delete.png</normaloff>:/qtgameengine/icons/delete.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
@ -421,7 +421,7 @@
|
||||
<action name="actionRename">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/rename.png</normaloff>:/qtgameengine/icons/actions/rename.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/rename.png</normaloff>:/qtgameengine/icons/rename.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Rename</string>
|
||||
@ -430,7 +430,7 @@
|
||||
<action name="actionProperties">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/properties.png</normaloff>:/qtgameengine/icons/actions/properties.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/properties.png</normaloff>:/qtgameengine/icons/properties.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Properties</string>
|
||||
@ -442,7 +442,7 @@
|
||||
<action name="actionFindResource">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/find.png</normaloff>:/qtgameengine/icons/actions/find.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/find.png</normaloff>:/qtgameengine/icons/find.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Find Resource</string>
|
||||
@ -466,7 +466,7 @@
|
||||
<action name="actionCreateSprite">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/sprite.png</normaloff>:/qtgameengine/icons/actions/sprite.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/sprite.png</normaloff>:/qtgameengine/icons/sprite.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create &Sprite</string>
|
||||
@ -478,7 +478,7 @@
|
||||
<action name="actionCreateSound">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/sound.png</normaloff>:/qtgameengine/icons/actions/sound.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/sound.png</normaloff>:/qtgameengine/icons/sound.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create So&und</string>
|
||||
@ -490,7 +490,7 @@
|
||||
<action name="actionCreateBackground">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/background.png</normaloff>:/qtgameengine/icons/actions/background.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/background.png</normaloff>:/qtgameengine/icons/background.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create &Background</string>
|
||||
@ -502,7 +502,7 @@
|
||||
<action name="actionCreatePath">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/path.png</normaloff>:/qtgameengine/icons/actions/path.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/path.png</normaloff>:/qtgameengine/icons/path.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create &Path</string>
|
||||
@ -514,7 +514,7 @@
|
||||
<action name="actionCreateScript">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/script.png</normaloff>:/qtgameengine/icons/actions/script.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/script.png</normaloff>:/qtgameengine/icons/script.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create S&cript</string>
|
||||
@ -526,7 +526,7 @@
|
||||
<action name="actionCreateFont">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/font.png</normaloff>:/qtgameengine/icons/actions/font.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/font.png</normaloff>:/qtgameengine/icons/font.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create &Font</string>
|
||||
@ -538,7 +538,7 @@
|
||||
<action name="actionCreateTimeLine">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/timeline.png</normaloff>:/qtgameengine/icons/actions/timeline.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/timeline.png</normaloff>:/qtgameengine/icons/timeline.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create &Time Line</string>
|
||||
@ -550,7 +550,7 @@
|
||||
<action name="actionCreateObject">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/object.png</normaloff>:/qtgameengine/icons/actions/object.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/object.png</normaloff>:/qtgameengine/icons/object.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create &Object</string>
|
||||
@ -562,7 +562,7 @@
|
||||
<action name="actionCreateRoom">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/room.png</normaloff>:/qtgameengine/icons/actions/room.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/room.png</normaloff>:/qtgameengine/icons/room.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create &Room</string>
|
||||
@ -574,7 +574,7 @@
|
||||
<action name="actionGameInformation">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/game-information.png</normaloff>:/qtgameengine/icons/actions/game-information.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/game-information.png</normaloff>:/qtgameengine/icons/game-information.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change Game &Information</string>
|
||||
@ -586,7 +586,7 @@
|
||||
<action name="actionGlobalGameSettings">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/global-game-settings.png</normaloff>:/qtgameengine/icons/actions/global-game-settings.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/global-game-settings.png</normaloff>:/qtgameengine/icons/global-game-settings.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change &Global Game Settings</string>
|
||||
@ -598,7 +598,7 @@
|
||||
<action name="actionExtensionPackages">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/extension-packages.png</normaloff>:/qtgameengine/icons/actions/extension-packages.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/extension-packages.png</normaloff>:/qtgameengine/icons/extension-packages.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select &Extension Packages</string>
|
||||
@ -634,7 +634,7 @@
|
||||
<action name="actionRunNormally">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/run.png</normaloff>:/qtgameengine/icons/actions/run.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/run.png</normaloff>:/qtgameengine/icons/run.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Run normally</string>
|
||||
@ -646,7 +646,7 @@
|
||||
<action name="actionRunInDebugMode">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/debug.png</normaloff>:/qtgameengine/icons/actions/debug.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/debug.png</normaloff>:/qtgameengine/icons/debug.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Run in &Debug mode</string>
|
||||
@ -663,7 +663,7 @@
|
||||
<action name="actionContents">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/help.png</normaloff>:/qtgameengine/icons/actions/help.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/help.png</normaloff>:/qtgameengine/icons/help.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Contents</string>
|
||||
@ -773,7 +773,7 @@
|
||||
<action name="actionTile">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/tile.png</normaloff>:/qtgameengine/icons/actions/tile.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/tile.png</normaloff>:/qtgameengine/icons/tile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Tile</string>
|
||||
@ -782,7 +782,7 @@
|
||||
<action name="actionCascade">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/qtgameengine/icons/actions/cascade.png</normaloff>:/qtgameengine/icons/actions/cascade.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/cascade.png</normaloff>:/qtgameengine/icons/cascade.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Cascade</string>
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QPixmap>
|
||||
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
#include "futurecpp.h"
|
||||
#include "projectcontainer.h"
|
||||
@ -24,9 +25,14 @@ enum {
|
||||
NumberOfRows
|
||||
};
|
||||
|
||||
ProjectTreeModel::ProjectTreeModel(ProjectContainer *project, QObject *parent) :
|
||||
ProjectTreeModel::ProjectTreeModel(QObject *parent) :
|
||||
QAbstractItemModel{parent}
|
||||
{
|
||||
}
|
||||
|
||||
ProjectTreeModel::ProjectTreeModel(ProjectContainer &project, QObject *parent) :
|
||||
QAbstractItemModel{parent},
|
||||
m_project{project}
|
||||
m_project{&project}
|
||||
{
|
||||
}
|
||||
|
||||
@ -206,10 +212,10 @@ QVariant ProjectTreeModel::data(const QModelIndex &index, int role) const
|
||||
case RowFonts:
|
||||
case RowTimeLines:
|
||||
case RowObjects:
|
||||
case RowRooms: return QPixmap{":/qtgameengine/icons/tree/folder.png"}.scaled(16, 16);
|
||||
case RowGameInformation: return QPixmap{":/qtgameengine/icons/tree/game-information.png"}.scaled(16, 16);
|
||||
case RowGlobalGameSettings: return QPixmap{":/qtgameengine/icons/tree/global-game-settings.png"}.scaled(16, 16);
|
||||
case RowExtensionPackages: return QPixmap{":/qtgameengine/icons/tree/extension-packages.png"}.scaled(16, 16);
|
||||
case RowRooms: return QPixmap{":/qtgameengine/icons/folder.png"}.scaled(16, 16);
|
||||
case RowGameInformation: return QPixmap{":/qtgameengine/icons/game-information-file.png"}.scaled(16, 16);
|
||||
case RowGlobalGameSettings: return QPixmap{":/qtgameengine/icons/global-game-settings-file.png"}.scaled(16, 16);
|
||||
case RowExtensionPackages: return QPixmap{":/qtgameengine/icons/extension-packages-file.png"}.scaled(16, 16);
|
||||
default:
|
||||
qWarning() << "unexpected root row" << index.row();
|
||||
return {};
|
||||
@ -240,12 +246,13 @@ QVariant ProjectTreeModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::EditRole:
|
||||
return iter->name;
|
||||
case Qt::DecorationRole:
|
||||
if (iter->pixmaps.empty())
|
||||
if (iter->pixmaps.empty() || iter->pixmaps.front().isNull())
|
||||
{
|
||||
qWarning() << "sprite has no pixmaps";
|
||||
return {};
|
||||
QPixmap pixmap{16, 16};
|
||||
pixmap.fill(Qt::white);
|
||||
return pixmap;
|
||||
}
|
||||
return iter->pixmaps.front().scaled(16, 16, Qt::KeepAspectRatio);
|
||||
return iter->pixmaps.front().scaled(16, 16, Qt::IgnoreAspectRatio /*KeepAspectRatio*/);
|
||||
|
||||
default:
|
||||
return {};
|
||||
@ -276,9 +283,9 @@ QVariant ProjectTreeModel::data(const QModelIndex &index, int role) const
|
||||
switch (iter->type)
|
||||
{
|
||||
case Sound::Type::Sound:
|
||||
return QPixmap{":/qtgameengine/icons/tree/sound-file.png"}.scaled(16, 16);
|
||||
return QPixmap{":/qtgameengine/icons/sound-file.png"}.scaled(16, 16);
|
||||
case Sound::Type::Music:
|
||||
return QPixmap{":/qtgameengine/icons/tree/music-file.png"}.scaled(16, 16);
|
||||
return QPixmap{":/qtgameengine/icons/music-file.png"}.scaled(16, 16);
|
||||
default:
|
||||
qWarning() << "unexpected sound type" << std::to_underlying(iter->type);
|
||||
return {};
|
||||
@ -310,6 +317,12 @@ QVariant ProjectTreeModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::EditRole:
|
||||
return iter->name;
|
||||
case Qt::DecorationRole:
|
||||
if (iter->pixmap.isNull())
|
||||
{
|
||||
QPixmap pixmap{16, 16};
|
||||
pixmap.fill(Qt::white);
|
||||
return pixmap;
|
||||
}
|
||||
return iter->pixmap.scaled(16, 16, Qt::KeepAspectRatio);
|
||||
default:
|
||||
return {};
|
||||
@ -337,7 +350,7 @@ QVariant ProjectTreeModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::EditRole:
|
||||
return iter->name;
|
||||
case Qt::DecorationRole:
|
||||
return QPixmap{":/qtgameengine/icons/tree/path-file.png"}.scaled(16, 16);
|
||||
return QPixmap{":/qtgameengine/icons/path-file.png"}.scaled(16, 16);
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
@ -364,7 +377,7 @@ QVariant ProjectTreeModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::EditRole:
|
||||
return iter->name;
|
||||
case Qt::DecorationRole:
|
||||
return QPixmap{":/qtgameengine/icons/tree/script-file.png"}.scaled(16, 16);
|
||||
return QPixmap{":/qtgameengine/icons/script-file.png"}.scaled(16, 16);
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
@ -391,7 +404,7 @@ QVariant ProjectTreeModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::EditRole:
|
||||
return iter->name;
|
||||
case Qt::DecorationRole:
|
||||
return QPixmap{":/qtgameengine/icons/tree/font-file.png"}.scaled(16, 16);
|
||||
return QPixmap{":/qtgameengine/icons/font-file.png"}.scaled(16, 16);
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
@ -442,8 +455,18 @@ bool ProjectTreeModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
iter->name = value.toString();
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
if (auto name = value.toString(); name != iter->name)
|
||||
{
|
||||
if (std::any_of(std::cbegin(m_project->sprites), std::cend(m_project->sprites),
|
||||
[&name](const auto &entry){ return entry.name == name; }))
|
||||
{
|
||||
qWarning() << "duplicate name" << name;
|
||||
emit errorOccured(tr("A Sprite with the name \"%0\" is already existing").arg(name));
|
||||
return false;
|
||||
}
|
||||
iter->name = std::move(name);
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
qWarning() << "unexpected role" << role;
|
||||
@ -468,8 +491,18 @@ bool ProjectTreeModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
iter->name = value.toString();
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
if (auto name = value.toString(); name != iter->name)
|
||||
{
|
||||
if (std::any_of(std::cbegin(m_project->sprites), std::cend(m_project->sprites),
|
||||
[&name](const auto &entry){ return entry.name == name; }))
|
||||
{
|
||||
qWarning() << "duplicate name" << name;
|
||||
emit errorOccured(tr("A Sound with the name \"%0\" is already existing").arg(name));
|
||||
return false;
|
||||
}
|
||||
iter->name = std::move(name);
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
qWarning() << "unexpected role" << role;
|
||||
@ -494,8 +527,18 @@ bool ProjectTreeModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
iter->name = value.toString();
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
if (auto name = value.toString(); name != iter->name)
|
||||
{
|
||||
if (std::any_of(std::cbegin(m_project->sprites), std::cend(m_project->sprites),
|
||||
[&name](const auto &entry){ return entry.name == name; }))
|
||||
{
|
||||
qWarning() << "duplicate name" << name;
|
||||
emit errorOccured(tr("A Background with the name \"%0\" is already existing").arg(name));
|
||||
return false;
|
||||
}
|
||||
iter->name = std::move(name);
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
qWarning() << "unexpected role" << role;
|
||||
@ -520,8 +563,18 @@ bool ProjectTreeModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
iter->name = value.toString();
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
if (auto name = value.toString(); name != iter->name)
|
||||
{
|
||||
if (std::any_of(std::cbegin(m_project->sprites), std::cend(m_project->sprites),
|
||||
[&name](const auto &entry){ return entry.name == name; }))
|
||||
{
|
||||
qWarning() << "duplicate name" << name;
|
||||
emit errorOccured(tr("A Path with the name \"%0\" is already existing").arg(name));
|
||||
return false;
|
||||
}
|
||||
iter->name = std::move(name);
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
qWarning() << "unexpected role" << role;
|
||||
@ -546,8 +599,18 @@ bool ProjectTreeModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
iter->name = value.toString();
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
if (auto name = value.toString(); name != iter->name)
|
||||
{
|
||||
if (std::any_of(std::cbegin(m_project->sprites), std::cend(m_project->sprites),
|
||||
[&name](const auto &entry){ return entry.name == name; }))
|
||||
{
|
||||
qWarning() << "duplicate name" << name;
|
||||
emit errorOccured(tr("A Script with the name \"%0\" is already existing").arg(name));
|
||||
return false;
|
||||
}
|
||||
iter->name = std::move(name);
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
qWarning() << "unexpected role" << role;
|
||||
@ -572,8 +635,18 @@ bool ProjectTreeModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
iter->name = value.toString();
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
if (auto name = value.toString(); name != iter->name)
|
||||
{
|
||||
if (std::any_of(std::cbegin(m_project->sprites), std::cend(m_project->sprites),
|
||||
[&name](const auto &entry){ return entry.name == name; }))
|
||||
{
|
||||
qWarning() << "duplicate name" << name;
|
||||
emit errorOccured(tr("A Font with the name \"%0\" is already existing").arg(name));
|
||||
return false;
|
||||
}
|
||||
iter->name = std::move(name);
|
||||
emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
qWarning() << "unexpected role" << role;
|
||||
|
@ -25,7 +25,8 @@ public:
|
||||
Font,
|
||||
};
|
||||
|
||||
explicit ProjectTreeModel(ProjectContainer *project, QObject *parent = nullptr);
|
||||
explicit ProjectTreeModel(QObject *parent = nullptr);
|
||||
explicit ProjectTreeModel(ProjectContainer &project, QObject *parent = nullptr);
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
|
||||
QModelIndex parent(const QModelIndex &child) const override;
|
||||
@ -74,6 +75,9 @@ public:
|
||||
Font *getFont(const QModelIndex &index);
|
||||
const Font *getFont(const QModelIndex &index) const;
|
||||
|
||||
signals:
|
||||
void errorOccured(const QString &message);
|
||||
|
||||
private:
|
||||
ProjectContainer *m_project{};
|
||||
};
|
||||
|
122
resources.qrc
@ -1,63 +1,67 @@
|
||||
<RCC>
|
||||
<qresource prefix="/qtgameengine">
|
||||
<file>icons/actions/background.png</file>
|
||||
<file>icons/actions/create-executable.png</file>
|
||||
<file>icons/actions/debug.png</file>
|
||||
<file>icons/actions/font.png</file>
|
||||
<file>icons/actions/new.png</file>
|
||||
<file>icons/actions/object.png</file>
|
||||
<file>icons/actions/open.png</file>
|
||||
<file>icons/actions/path.png</file>
|
||||
<file>icons/actions/publish-game.png</file>
|
||||
<file>icons/actions/room.png</file>
|
||||
<file>icons/actions/run.png</file>
|
||||
<file>icons/actions/save-as.png</file>
|
||||
<file>icons/actions/save.png</file>
|
||||
<file>icons/actions/script.png</file>
|
||||
<file>icons/actions/sound.png</file>
|
||||
<file>icons/actions/sprite.png</file>
|
||||
<file>icons/actions/timeline.png</file>
|
||||
<file>icons/tree/folder.png</file>
|
||||
<file>icons/actions/game-information.png</file>
|
||||
<file>icons/actions/global-game-settings.png</file>
|
||||
<file>icons/actions/extension-packages.png</file>
|
||||
<file>icons/actions/help.png</file>
|
||||
<file>icons/tree/music-file.png</file>
|
||||
<file>icons/tree/sound-file.png</file>
|
||||
<file>icons/dialogs/sprite-file.png</file>
|
||||
<file>icons/buttons/edit.png</file>
|
||||
<file>icons/buttons/ok.png</file>
|
||||
<file>icons/actions/exit.png</file>
|
||||
<file>icons/dialogs/background-file.png</file>
|
||||
<file>icons/dialogs/sound-file.png</file>
|
||||
<file>icons/tree/extension-packages.png</file>
|
||||
<file>icons/tree/global-game-settings.png</file>
|
||||
<file>icons/tree/game-information.png</file>
|
||||
<file>icons/actions/create.png</file>
|
||||
<file>icons/actions/duplicate.png</file>
|
||||
<file>icons/actions/create-group.png</file>
|
||||
<file>icons/actions/delete.png</file>
|
||||
<file>icons/actions/rename.png</file>
|
||||
<file>icons/actions/properties.png</file>
|
||||
<file>icons/actions/find.png</file>
|
||||
<file>icons/actions/preferences.png</file>
|
||||
<file>icons/actions/export-resources.png</file>
|
||||
<file>icons/actions/import-resources.png</file>
|
||||
<file>icons/actions/cascade.png</file>
|
||||
<file>icons/actions/tile.png</file>
|
||||
<file>icons/tree/path-file.png</file>
|
||||
<file>icons/actions/ok.png</file>
|
||||
<file>icons/dialogs/path-file.png</file>
|
||||
<file>icons/tree/script-file.png</file>
|
||||
<file>icons/dialogs/script-file.png</file>
|
||||
<file>icons/actions/undo.png</file>
|
||||
<file>icons/actions/print.png</file>
|
||||
<file>icons/actions/redo.png</file>
|
||||
<file>icons/dialogs/font-file.png</file>
|
||||
<file>icons/tree/font-file.png</file>
|
||||
<file>icons/actions/copy.png</file>
|
||||
<file>icons/actions/cut.png</file>
|
||||
<file>icons/actions/paste.png</file>
|
||||
<file>icons/actions/check.png</file>
|
||||
<file>icons/arrow-down.png</file>
|
||||
<file>icons/arrow-left.png</file>
|
||||
<file>icons/arrow-right.png</file>
|
||||
<file>icons/arrow-up.png</file>
|
||||
<file>icons/background-file.png</file>
|
||||
<file>icons/background.png</file>
|
||||
<file>icons/cascade.png</file>
|
||||
<file>icons/check.png</file>
|
||||
<file>icons/copy.png</file>
|
||||
<file>icons/create-executable.png</file>
|
||||
<file>icons/create-group.png</file>
|
||||
<file>icons/create.png</file>
|
||||
<file>icons/cut.png</file>
|
||||
<file>icons/debug.png</file>
|
||||
<file>icons/delete.png</file>
|
||||
<file>icons/duplicate.png</file>
|
||||
<file>icons/edit.png</file>
|
||||
<file>icons/exit.png</file>
|
||||
<file>icons/export-resources.png</file>
|
||||
<file>icons/extension-packages-file.png</file>
|
||||
<file>icons/extension-packages.png</file>
|
||||
<file>icons/file.png</file>
|
||||
<file>icons/find.png</file>
|
||||
<file>icons/folder.png</file>
|
||||
<file>icons/font-file.png</file>
|
||||
<file>icons/font.png</file>
|
||||
<file>icons/game-information-file.png</file>
|
||||
<file>icons/game-information.png</file>
|
||||
<file>icons/global-game-settings-file.png</file>
|
||||
<file>icons/global-game-settings.png</file>
|
||||
<file>icons/help.png</file>
|
||||
<file>icons/import-resources.png</file>
|
||||
<file>icons/move.png</file>
|
||||
<file>icons/music-file.png</file>
|
||||
<file>icons/new.png</file>
|
||||
<file>icons/object.png</file>
|
||||
<file>icons/ok.png</file>
|
||||
<file>icons/open.png</file>
|
||||
<file>icons/paste.png</file>
|
||||
<file>icons/path-file.png</file>
|
||||
<file>icons/path.png</file>
|
||||
<file>icons/preferences.png</file>
|
||||
<file>icons/print.png</file>
|
||||
<file>icons/properties.png</file>
|
||||
<file>icons/publish-game.png</file>
|
||||
<file>icons/redo.png</file>
|
||||
<file>icons/rename.png</file>
|
||||
<file>icons/room.png</file>
|
||||
<file>icons/rotate.png</file>
|
||||
<file>icons/run.png</file>
|
||||
<file>icons/save-as.png</file>
|
||||
<file>icons/save.png</file>
|
||||
<file>icons/script-file.png</file>
|
||||
<file>icons/script.png</file>
|
||||
<file>icons/sound-file.png</file>
|
||||
<file>icons/sound-file2.png</file>
|
||||
<file>icons/sound.png</file>
|
||||
<file>icons/sprite-file.png</file>
|
||||
<file>icons/sprite.png</file>
|
||||
<file>icons/tile.png</file>
|
||||
<file>icons/timeline.png</file>
|
||||
<file>icons/undo.png</file>
|
||||
<file>icons/object-file.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
29
spritesmodel.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include "spritesmodel.h"
|
||||
|
||||
#include <QPixmap>
|
||||
|
||||
SpritesModel::SpritesModel(QObject *parent)
|
||||
: QAbstractListModel{parent}
|
||||
{
|
||||
}
|
||||
|
||||
int SpritesModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
QVariant SpritesModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
switch (role)
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
return tr("image %0").arg(index.row());
|
||||
case Qt::DecorationRole:
|
||||
QPixmap pixmap{64, 64};
|
||||
pixmap.fill(Qt::black);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
14
spritesmodel.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
class SpritesModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SpritesModel(QObject *parent = nullptr);
|
||||
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
};
|