diff --git a/QtGameMaker.pro b/QtGameMaker.pro index 2ee6515..aafece6 100644 --- a/QtGameMaker.pro +++ b/QtGameMaker.pro @@ -32,6 +32,7 @@ HEADERS += \ src/editor/dialogs/actions/movetowardsdialog.h \ src/editor/dialogs/actions/executecodedialog.h \ src/editor/dialogs/actions/speedverticaldialog.h \ + src/editor/dialogs/changeimagesizedialog.h \ src/editor/dialogs/genericcodeeditordialog.h \ src/editor/dialogs/includedfilepropertiesdialog.h \ src/editor/dialogs/transparentbackgroundsettingsdialog.h \ @@ -109,6 +110,7 @@ SOURCES += \ src/editor/dialogs/actions/movefreedialog.cpp \ src/editor/dialogs/actions/movetowardsdialog.cpp \ src/editor/dialogs/actions/speedverticaldialog.cpp \ + src/editor/dialogs/changeimagesizedialog.cpp \ src/editor/dialogs/genericcodeeditordialog.cpp \ src/editor/dialogs/includedfilepropertiesdialog.cpp \ src/editor/dialogs/transparentbackgroundsettingsdialog.cpp \ @@ -183,6 +185,7 @@ FORMS += \ src/editor/dialogs/actions/movefreedialog.ui \ src/editor/dialogs/actions/movetowardsdialog.ui \ src/editor/dialogs/actions/speedverticaldialog.ui \ + src/editor/dialogs/changeimagesizedialog.ui \ src/editor/dialogs/includedfilepropertiesdialog.ui \ src/editor/dialogs/transparentbackgroundsettingsdialog.ui \ src/editor/mainwindow.ui \ diff --git a/src/editor/dialogs/changeimagesizedialog.cpp b/src/editor/dialogs/changeimagesizedialog.cpp new file mode 100644 index 0000000..465d500 --- /dev/null +++ b/src/editor/dialogs/changeimagesizedialog.cpp @@ -0,0 +1,20 @@ +#include "changeimagesizedialog.h" +#include "ui_changeimagesizedialog.h" + +#include "editorguiutils.h" + +ChangeImageSizeDialog::ChangeImageSizeDialog(QWidget *parent) : + QDialog{parent}, + m_ui{std::make_unique()} +{ + m_ui->setupUi(this); + +#ifdef Q_OS_LINUX + setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window); +#endif + setWindowFlag(Qt::WindowCloseButtonHint); + + improveButtonBox(m_ui->buttonBox); +} + +ChangeImageSizeDialog::~ChangeImageSizeDialog() = default; diff --git a/src/editor/dialogs/changeimagesizedialog.h b/src/editor/dialogs/changeimagesizedialog.h new file mode 100644 index 0000000..44728c9 --- /dev/null +++ b/src/editor/dialogs/changeimagesizedialog.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include + +namespace Ui { class ChangeImageSizeDialog; } + +class ChangeImageSizeDialog : public QDialog +{ + Q_OBJECT + +public: + explicit ChangeImageSizeDialog(QWidget *parent = nullptr); + ~ChangeImageSizeDialog() override; + +private: + const std::unique_ptr m_ui; +}; diff --git a/src/editor/dialogs/changeimagesizedialog.ui b/src/editor/dialogs/changeimagesizedialog.ui new file mode 100644 index 0000000..34bdff5 --- /dev/null +++ b/src/editor/dialogs/changeimagesizedialog.ui @@ -0,0 +1,143 @@ + + + ChangeImageSizeDialog + + + + 0 + 0 + 336 + 332 + + + + Dialog + + + + + + The size of the image(s) is not equal to the current image. What should happen? + + + true + + + + + + + Size + + + + + + Keep original size + + + true + + + + + + + Use new size + + + + + + + Use maximal size + + + + + + + + + + Placement + + + + + + Place at left-top + + + true + + + + + + + Place in center + + + + + + + Stretch + + + + + + + + + + Qt::Orientation::Horizontal + + + QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok + + + true + + + + + + + + + buttonBox + accepted() + ChangeImageSizeDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ChangeImageSizeDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/editor/dialogs/createspritedialog.cpp b/src/editor/dialogs/createspritedialog.cpp index 6beb3c6..e4a70e0 100644 --- a/src/editor/dialogs/createspritedialog.cpp +++ b/src/editor/dialogs/createspritedialog.cpp @@ -2,7 +2,6 @@ #include "ui_createspritedialog.h" #include -#include #include "editorguiutils.h" diff --git a/src/editor/dialogs/editspritedialog.cpp b/src/editor/dialogs/editspritedialog.cpp index 726548e..ee7b54b 100644 --- a/src/editor/dialogs/editspritedialog.cpp +++ b/src/editor/dialogs/editspritedialog.cpp @@ -9,6 +9,7 @@ #include "createspritedialog.h" #include "imageeditordialog.h" #include "imagehelpers.h" +#include "changeimagesizedialog.h" EditSpriteDialog::EditSpriteDialog(const std::vector &pixmaps, const QString &spriteName, EditorSettings &settings, QWidget *parent) : @@ -176,8 +177,11 @@ void EditSpriteDialog::addFromFile() if (!m_model->empty() && m_model->front().size() != pixmap.size()) { - QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented")); - return; + ChangeImageSizeDialog dialog{this}; + if (dialog.exec() == QDialog::Accepted) + { + QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented")); + } } else {