Lots of changes again
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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()};
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user