Added lots of icons in image editor
@@ -214,7 +214,7 @@
|
||||
<action name="actionCreateFromFile">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/open.png</normaloff>:/qtgameengine/icons/open.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/create-from-file.png</normaloff>:/qtgameengine/icons/create-from-file.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Create from file...</string>
|
||||
@@ -226,7 +226,7 @@
|
||||
<action name="actionAddFromFile">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/create-group.png</normaloff>:/qtgameengine/icons/create-group.png</iconset>
|
||||
<normaloff>:/qtgameengine/icons/add-from-file.png</normaloff>:/qtgameengine/icons/add-from-file.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add from file...</string>
|
||||
@@ -251,6 +251,10 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreateFromStrip">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/create-from-strip.png</normaloff>:/qtgameengine/icons/create-from-strip.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create from Strip...</string>
|
||||
</property>
|
||||
@@ -259,6 +263,10 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddFromStrip">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/add-from-strip.png</normaloff>:/qtgameengine/icons/add-from-strip.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add from Stri&p...</string>
|
||||
</property>
|
||||
@@ -334,6 +342,10 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMoveLeft">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/blue-arrow-left.png</normaloff>:/qtgameengine/icons/blue-arrow-left.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Move &Left</string>
|
||||
</property>
|
||||
@@ -342,6 +354,10 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMoveRight">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/blue-arrow-right.png</normaloff>:/qtgameengine/icons/blue-arrow-right.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Move Right</string>
|
||||
</property>
|
||||
@@ -350,6 +366,10 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddEmpty">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/add-sprite.png</normaloff>:/qtgameengine/icons/add-sprite.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add Empty</string>
|
||||
</property>
|
||||
@@ -358,6 +378,10 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInsertEmpty">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/insert-sprite.png</normaloff>:/qtgameengine/icons/insert-sprite.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Insert Empty</string>
|
||||
</property>
|
||||
@@ -366,6 +390,10 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/pen.png</normaloff>:/qtgameengine/icons/pen.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit...</string>
|
||||
</property>
|
||||
|
||||
@@ -41,11 +41,45 @@ ImageEditorDialog::ImageEditorDialog(const QPixmap &pixmap, const QString &title
|
||||
m_ui->actionCut->setShortcut(QKeySequence::Cut);
|
||||
m_ui->actionCopy->setShortcut(QKeySequence::Copy);
|
||||
m_ui->actionPaste->setShortcut(QKeySequence::Paste);
|
||||
m_ui->actionZoomIn->setShortcut(QKeySequence::ZoomIn);
|
||||
m_ui->actionZoomOut->setShortcut(QKeySequence::ZoomOut);
|
||||
|
||||
m_ui->scrollArea->setBackgroundRole(QPalette::Dark);
|
||||
|
||||
connect(m_ui->actionNew, &QAction::triggered,
|
||||
this, &ImageEditorDialog::newFile);
|
||||
connect(m_ui->actionOpen, &QAction::triggered,
|
||||
this, &ImageEditorDialog::openFile);
|
||||
connect(m_ui->actionSaveAsPngFile, &QAction::triggered,
|
||||
this, &ImageEditorDialog::saveAsPng);
|
||||
connect(m_ui->actionPreviousImage, &QAction::triggered,
|
||||
this, &ImageEditorDialog::previousSprite);
|
||||
connect(m_ui->actionNextImage, &QAction::triggered,
|
||||
this, &ImageEditorDialog::nextSprite);
|
||||
connect(m_ui->actionUndo, &QAction::triggered,
|
||||
this, &ImageEditorDialog::undo);
|
||||
connect(m_ui->actionRedo, &QAction::triggered,
|
||||
this, &ImageEditorDialog::redo);
|
||||
connect(m_ui->actionEraseToLeftColor, &QAction::triggered,
|
||||
this, &ImageEditorDialog::eraseToLeftColor);
|
||||
connect(m_ui->actionDelete, &QAction::triggered,
|
||||
this, &ImageEditorDialog::delete_);
|
||||
connect(m_ui->actionCut, &QAction::triggered,
|
||||
this, &ImageEditorDialog::cut);
|
||||
connect(m_ui->actionCopy, &QAction::triggered,
|
||||
this, &ImageEditorDialog::copy);
|
||||
connect(m_ui->actionPaste, &QAction::triggered,
|
||||
this, &ImageEditorDialog::paste);
|
||||
connect(m_ui->actionPasteFromFile, &QAction::triggered,
|
||||
this, &ImageEditorDialog::pasteFromFile);
|
||||
connect(m_ui->actionSelectAll, &QAction::triggered,
|
||||
this, &ImageEditorDialog::selectAll);
|
||||
connect(m_ui->actionZoomIn, &QAction::triggered,
|
||||
this, &ImageEditorDialog::zoomIn);
|
||||
connect(m_ui->actionNoZoom, &QAction::triggered,
|
||||
this, &ImageEditorDialog::resetZoom);
|
||||
connect(m_ui->actionZoomOut, &QAction::triggered,
|
||||
this, &ImageEditorDialog::zoomOut);
|
||||
connect(m_ui->actionSetTransparencyBackground, &QAction::triggered,
|
||||
this, &ImageEditorDialog::transparentBackgroundSettings);
|
||||
|
||||
@@ -204,6 +238,30 @@ void ImageEditorDialog::reject()
|
||||
}
|
||||
}
|
||||
|
||||
void ImageEditorDialog::newFile()
|
||||
{
|
||||
if (m_unsavedChanges)
|
||||
{
|
||||
if (QMessageBox::warning(
|
||||
this,
|
||||
tr("The Image has been modified."),
|
||||
tr("Do you really want to start new?"),
|
||||
QMessageBox::Ok | QMessageBox::Cancel
|
||||
) != QMessageBox::Ok)
|
||||
return;
|
||||
}
|
||||
|
||||
QPixmap pixmap{m_ui->canvas->pixmap().size()};
|
||||
pixmap.fill(Qt::transparent);
|
||||
m_ui->canvas->setPixmap(pixmap);
|
||||
changed();
|
||||
}
|
||||
|
||||
void ImageEditorDialog::openFile()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::saveAsPng()
|
||||
{
|
||||
const auto &image = m_ui->canvas->image();
|
||||
@@ -216,6 +274,76 @@ void ImageEditorDialog::saveAsPng()
|
||||
saveImage(this, image);
|
||||
}
|
||||
|
||||
void ImageEditorDialog::previousSprite()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::nextSprite()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::undo()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::redo()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::eraseToLeftColor()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::delete_()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::cut()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::copy()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::paste()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::pasteFromFile()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::selectAll()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Not yet implemented"), tr("Not yet implemented"));
|
||||
}
|
||||
|
||||
void ImageEditorDialog::zoomIn()
|
||||
{
|
||||
m_ui->canvas->setZoom(m_ui->canvas->zoom() * 2.f);
|
||||
}
|
||||
|
||||
void ImageEditorDialog::resetZoom()
|
||||
{
|
||||
m_ui->canvas->setZoom(1.f);
|
||||
}
|
||||
|
||||
void ImageEditorDialog::zoomOut()
|
||||
{
|
||||
m_ui->canvas->setZoom(m_ui->canvas->zoom() / 2.f);
|
||||
}
|
||||
|
||||
void ImageEditorDialog::transparentBackgroundSettings()
|
||||
{
|
||||
TransparentBackgroundSettingsDialog dialog{m_settings, this};
|
||||
|
||||
@@ -28,7 +28,23 @@ public:
|
||||
void reject() override;
|
||||
|
||||
private slots:
|
||||
void newFile();
|
||||
void openFile();
|
||||
void saveAsPng();
|
||||
void previousSprite();
|
||||
void nextSprite();
|
||||
void undo();
|
||||
void redo();
|
||||
void eraseToLeftColor();
|
||||
void delete_();
|
||||
void cut();
|
||||
void copy();
|
||||
void paste();
|
||||
void pasteFromFile();
|
||||
void selectAll();
|
||||
void zoomIn();
|
||||
void resetZoom();
|
||||
void zoomOut();
|
||||
void transparentBackgroundSettings();
|
||||
|
||||
void changed();
|
||||
|
||||
@@ -1054,16 +1054,31 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoomOut">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/zoom-out.png</normaloff>:/qtgameengine/icons/zoom-out.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom &Out</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNoZoom">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/zoom-original.png</normaloff>:/qtgameengine/icons/zoom-original.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&No Zoom</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+0</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoomIn">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources_editor.qrc">
|
||||
<normaloff>:/qtgameengine/icons/zoom-in.png</normaloff>:/qtgameengine/icons/zoom-in.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom &In</string>
|
||||
</property>
|
||||
|
||||
|
Before Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -1,6 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/qtgameengine">
|
||||
<file>icons/action.png</file>
|
||||
<file>icons/action-execute-code.png</file>
|
||||
<file>icons/action-move-fixed.png</file>
|
||||
<file>icons/action-move-free.png</file>
|
||||
@@ -8,6 +7,10 @@
|
||||
<file>icons/action-set-gravity.png</file>
|
||||
<file>icons/action-speed-horizontal.png</file>
|
||||
<file>icons/action-speed-vertical.png</file>
|
||||
<file>icons/action.png</file>
|
||||
<file>icons/add-from-file.png</file>
|
||||
<file>icons/add-from-strip.png</file>
|
||||
<file>icons/add-sprite.png</file>
|
||||
<file>icons/add.png</file>
|
||||
<file>icons/arrow-down.png</file>
|
||||
<file>icons/arrow-left.png</file>
|
||||
@@ -15,12 +18,23 @@
|
||||
<file>icons/arrow-up.png</file>
|
||||
<file>icons/background-file.png</file>
|
||||
<file>icons/background.png</file>
|
||||
<file>icons/blue-arrow-down-left.png</file>
|
||||
<file>icons/blue-arrow-down-right.png</file>
|
||||
<file>icons/blue-arrow-down.png</file>
|
||||
<file>icons/blue-arrow-left.png</file>
|
||||
<file>icons/blue-arrow-right.png</file>
|
||||
<file>icons/blue-arrow-up-left.png</file>
|
||||
<file>icons/blue-arrow-up-right.png</file>
|
||||
<file>icons/blue-arrow-up.png</file>
|
||||
<file>icons/blue-stop.png</file>
|
||||
<file>icons/cascade.png</file>
|
||||
<file>icons/center.png</file>
|
||||
<file>icons/check.png</file>
|
||||
<file>icons/constants.png</file>
|
||||
<file>icons/copy.png</file>
|
||||
<file>icons/create-executable.png</file>
|
||||
<file>icons/create-from-file.png</file>
|
||||
<file>icons/create-from-strip.png</file>
|
||||
<file>icons/create-group.png</file>
|
||||
<file>icons/create.png</file>
|
||||
<file>icons/cut.png</file>
|
||||
@@ -54,6 +68,7 @@
|
||||
<file>icons/import-resources.png</file>
|
||||
<file>icons/included-files.png</file>
|
||||
<file>icons/info.png</file>
|
||||
<file>icons/insert-sprite.png</file>
|
||||
<file>icons/isometric.png</file>
|
||||
<file>icons/lock.png</file>
|
||||
<file>icons/merge.png</file>
|
||||
@@ -67,6 +82,7 @@
|
||||
<file>icons/paste.png</file>
|
||||
<file>icons/path-file.png</file>
|
||||
<file>icons/path.png</file>
|
||||
<file>icons/pen.png</file>
|
||||
<file>icons/preferences.png</file>
|
||||
<file>icons/print.png</file>
|
||||
<file>icons/properties.png</file>
|
||||
@@ -97,14 +113,8 @@
|
||||
<file>icons/trigger.png</file>
|
||||
<file>icons/undo.png</file>
|
||||
<file>icons/unlock.png</file>
|
||||
<file>icons/blue-arrow-down.png</file>
|
||||
<file>icons/blue-arrow-down-left.png</file>
|
||||
<file>icons/blue-arrow-down-right.png</file>
|
||||
<file>icons/blue-arrow-left.png</file>
|
||||
<file>icons/blue-arrow-right.png</file>
|
||||
<file>icons/blue-arrow-up.png</file>
|
||||
<file>icons/blue-arrow-up-left.png</file>
|
||||
<file>icons/blue-arrow-up-right.png</file>
|
||||
<file>icons/blue-stop.png</file>
|
||||
<file>icons/zoom-in.png</file>
|
||||
<file>icons/zoom-original.png</file>
|
||||
<file>icons/zoom-out.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -32,7 +32,7 @@ void DrawingCanvasWidget::setPixmap(const QPixmap &pixmap)
|
||||
update();
|
||||
}
|
||||
|
||||
void DrawingCanvasWidget::setScale(float zoom)
|
||||
void DrawingCanvasWidget::setZoom(float zoom)
|
||||
{
|
||||
if (m_zoom == zoom)
|
||||
return;
|
||||
|
||||
@@ -10,7 +10,7 @@ class DrawingCanvasWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(float zoom READ zoom WRITE setScale NOTIFY zoomChanged FINAL)
|
||||
Q_PROPERTY(float zoom READ zoom WRITE setZoom NOTIFY zoomChanged FINAL)
|
||||
Q_PROPERTY(QColor leftButtonColor READ leftButtonColor WRITE setLeftButtonColor NOTIFY leftButtonColorChanged FINAL)
|
||||
Q_PROPERTY(QColor rightButtonColor READ rightButtonColor WRITE setRightButtonColor NOTIFY rightButtonColorChanged FINAL)
|
||||
Q_PROPERTY(TransparentBackgroundPattern transparentBackgroundPattern READ transparentBackgroundPattern WRITE setTransparentBackgroundPattern NOTIFY transparentBackgroundPatternChanged FINAL)
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
void setPixmap(const QPixmap &pixmap);
|
||||
|
||||
float zoom() const { return m_zoom; }
|
||||
void setScale(float zoom);
|
||||
void setZoom(float zoom);
|
||||
|
||||
QColor leftButtonColor() const { return m_leftButtonColor; }
|
||||
void setLeftButtonColor(const QColor &LeftButtonColor);
|
||||
|
||||
@@ -23,7 +23,7 @@ void ZoomableScrollArea::wheelEvent(QWheelEvent *event)
|
||||
else
|
||||
zoom /= 2;
|
||||
|
||||
w->setScale(zoom);
|
||||
w->setZoom(zoom);
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||