Add ability to export map stitch images.

This commit is contained in:
Marcus Huderle
2020-04-18 13:07:41 -05:00
committed by huderlem
parent 800d584eb5
commit bb6dbedabf
11 changed files with 275 additions and 57 deletions

View File

@@ -28,6 +28,7 @@
#include <QSysInfo>
#include <QDesktopServices>
#include <QMatrix>
#include <QSet>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
@@ -2080,13 +2081,21 @@ void MainWindow::onTilesetsSaved(QString primaryTilesetLabel, QString secondaryT
this->editor->updateSecondaryTileset(secondaryTilesetLabel, true);
}
void MainWindow::on_action_Export_Map_Image_triggered()
{
if (!this->mapImageExporter) {
this->mapImageExporter = new MapImageExporter(this, this->editor);
connect(this->mapImageExporter, &QObject::destroyed, [=](QObject *) { this->mapImageExporter = nullptr; });
this->mapImageExporter->setAttribute(Qt::WA_DeleteOnClose);
}
void MainWindow::on_action_Export_Map_Image_triggered() {
showExportMapImageWindow(false);
}
void MainWindow::on_actionExport_Stitched_Map_Image_triggered() {
showExportMapImageWindow(true);
}
void MainWindow::showExportMapImageWindow(bool stitchMode) {
if (this->mapImageExporter)
delete this->mapImageExporter;
this->mapImageExporter = new MapImageExporter(this, this->editor, stitchMode);
connect(this->mapImageExporter, &QObject::destroyed, [=](QObject *) { this->mapImageExporter = nullptr; });
this->mapImageExporter->setAttribute(Qt::WA_DeleteOnClose);
if (!this->mapImageExporter->isVisible()) {
this->mapImageExporter->show();