Fix image exporter reset button
This commit is contained in:
parent
6e79c6c4c3
commit
bdcfc0467b
2 changed files with 79 additions and 72 deletions
|
@ -16,6 +16,24 @@ enum ImageExporterMode {
|
||||||
Timelapse,
|
Timelapse,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ImageExporterSettings {
|
||||||
|
bool showObjects = false;
|
||||||
|
bool showWarps = false;
|
||||||
|
bool showBGs = false;
|
||||||
|
bool showTriggers = false;
|
||||||
|
bool showHealLocations = false;
|
||||||
|
bool showUpConnections = false;
|
||||||
|
bool showDownConnections = false;
|
||||||
|
bool showLeftConnections = false;
|
||||||
|
bool showRightConnections = false;
|
||||||
|
bool showGrid = false;
|
||||||
|
bool showBorder = false;
|
||||||
|
bool showCollision = false;
|
||||||
|
bool previewActualSize = false;
|
||||||
|
int timelapseSkipAmount = 1;
|
||||||
|
int timelapseDelayMs = 200;
|
||||||
|
};
|
||||||
|
|
||||||
class MapImageExporter : public QDialog
|
class MapImageExporter : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -33,21 +51,7 @@ private:
|
||||||
|
|
||||||
QPixmap preview;
|
QPixmap preview;
|
||||||
|
|
||||||
bool showObjects = false;
|
ImageExporterSettings settings;
|
||||||
bool showWarps = false;
|
|
||||||
bool showBGs = false;
|
|
||||||
bool showTriggers = false;
|
|
||||||
bool showHealLocations = false;
|
|
||||||
bool showUpConnections = false;
|
|
||||||
bool showDownConnections = false;
|
|
||||||
bool showLeftConnections = false;
|
|
||||||
bool showRightConnections = false;
|
|
||||||
bool showGrid = false;
|
|
||||||
bool showBorder = false;
|
|
||||||
bool showCollision = false;
|
|
||||||
bool previewActualSize = false;
|
|
||||||
int timelapseSkipAmount = 1;
|
|
||||||
int timelapseDelayMs = 200;
|
|
||||||
ImageExporterMode mode = ImageExporterMode::Normal;
|
ImageExporterMode mode = ImageExporterMode::Normal;
|
||||||
|
|
||||||
void updatePreview();
|
void updatePreview();
|
||||||
|
|
|
@ -121,7 +121,7 @@ void MapImageExporter::saveImage() {
|
||||||
|
|
||||||
int maxWidth = this->map->getWidth() * 16;
|
int maxWidth = this->map->getWidth() * 16;
|
||||||
int maxHeight = this->map->getHeight() * 16;
|
int maxHeight = this->map->getHeight() * 16;
|
||||||
if (showBorder) {
|
if (this->settings.showBorder) {
|
||||||
maxWidth += 2 * STITCH_MODE_BORDER_DISTANCE * 16;
|
maxWidth += 2 * STITCH_MODE_BORDER_DISTANCE * 16;
|
||||||
maxHeight += 2 * STITCH_MODE_BORDER_DISTANCE * 16;
|
maxHeight += 2 * STITCH_MODE_BORDER_DISTANCE * 16;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ void MapImageExporter::saveImage() {
|
||||||
this->map->editHistory.undo();
|
this->map->editHistory.undo();
|
||||||
int width = this->map->getWidth() * 16;
|
int width = this->map->getWidth() * 16;
|
||||||
int height = this->map->getHeight() * 16;
|
int height = this->map->getHeight() * 16;
|
||||||
if (showBorder) {
|
if (this->settings.showBorder) {
|
||||||
width += 2 * STITCH_MODE_BORDER_DISTANCE * 16;
|
width += 2 * STITCH_MODE_BORDER_DISTANCE * 16;
|
||||||
height += 2 * STITCH_MODE_BORDER_DISTANCE * 16;
|
height += 2 * STITCH_MODE_BORDER_DISTANCE * 16;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ void MapImageExporter::saveImage() {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
QGifImage timelapseImg(QSize(maxWidth, maxHeight));
|
QGifImage timelapseImg(QSize(maxWidth, maxHeight));
|
||||||
timelapseImg.setDefaultDelay(timelapseDelayMs);
|
timelapseImg.setDefaultDelay(this->settings.timelapseDelayMs);
|
||||||
timelapseImg.setDefaultTransparentColor(QColor(0, 0, 0));
|
timelapseImg.setDefaultTransparentColor(QColor(0, 0, 0));
|
||||||
// Draw each frame, skpping the specified number of map edits in
|
// Draw each frame, skpping the specified number of map edits in
|
||||||
// the undo history.
|
// the undo history.
|
||||||
|
@ -175,7 +175,7 @@ void MapImageExporter::saveImage() {
|
||||||
pixmap = pixmap2;
|
pixmap = pixmap2;
|
||||||
}
|
}
|
||||||
timelapseImg.addFrame(pixmap.toImage());
|
timelapseImg.addFrame(pixmap.toImage());
|
||||||
for (int j = 0; j < timelapseSkipAmount; j++) {
|
for (int j = 0; j < this->settings.timelapseSkipAmount; j++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
i--;
|
i--;
|
||||||
this->map->editHistory.redo();
|
this->map->editHistory.redo();
|
||||||
|
@ -213,26 +213,26 @@ bool MapImageExporter::historyItemAppliesToFrame(const QUndoCommand *command) {
|
||||||
case CommandId::ID_PaintCollision:
|
case CommandId::ID_PaintCollision:
|
||||||
case CommandId::ID_BucketFillCollision:
|
case CommandId::ID_BucketFillCollision:
|
||||||
case CommandId::ID_MagicFillCollision:
|
case CommandId::ID_MagicFillCollision:
|
||||||
return this->showCollision;
|
return this->settings.showCollision;
|
||||||
case CommandId::ID_PaintBorder:
|
case CommandId::ID_PaintBorder:
|
||||||
return this->showBorder;
|
return this->settings.showBorder;
|
||||||
case CommandId::ID_MapConnectionMove:
|
case CommandId::ID_MapConnectionMove:
|
||||||
case CommandId::ID_MapConnectionChangeDirection:
|
case CommandId::ID_MapConnectionChangeDirection:
|
||||||
case CommandId::ID_MapConnectionChangeMap:
|
case CommandId::ID_MapConnectionChangeMap:
|
||||||
case CommandId::ID_MapConnectionAdd:
|
case CommandId::ID_MapConnectionAdd:
|
||||||
case CommandId::ID_MapConnectionRemove:
|
case CommandId::ID_MapConnectionRemove:
|
||||||
return this->showUpConnections || this->showDownConnections || this->showLeftConnections || this->showRightConnections;
|
return this->settings.showUpConnections || this->settings.showDownConnections || this->settings.showLeftConnections || this->settings.showRightConnections;
|
||||||
case CommandId::ID_EventMove:
|
case CommandId::ID_EventMove:
|
||||||
case CommandId::ID_EventShift:
|
case CommandId::ID_EventShift:
|
||||||
case CommandId::ID_EventCreate:
|
case CommandId::ID_EventCreate:
|
||||||
case CommandId::ID_EventDelete:
|
case CommandId::ID_EventDelete:
|
||||||
case CommandId::ID_EventDuplicate: {
|
case CommandId::ID_EventDuplicate: {
|
||||||
bool eventTypeIsApplicable =
|
bool eventTypeIsApplicable =
|
||||||
(this->showObjects && (command->id() & IDMask_EventType_Object) != 0)
|
(this->settings.showObjects && (command->id() & IDMask_EventType_Object) != 0)
|
||||||
|| (this->showWarps && (command->id() & IDMask_EventType_Warp) != 0)
|
|| (this->settings.showWarps && (command->id() & IDMask_EventType_Warp) != 0)
|
||||||
|| (this->showBGs && (command->id() & IDMask_EventType_BG) != 0)
|
|| (this->settings.showBGs && (command->id() & IDMask_EventType_BG) != 0)
|
||||||
|| (this->showTriggers && (command->id() & IDMask_EventType_Trigger) != 0)
|
|| (this->settings.showTriggers && (command->id() & IDMask_EventType_Trigger) != 0)
|
||||||
|| (this->showHealLocations && (command->id() & IDMask_EventType_Heal) != 0);
|
|| (this->settings.showHealLocations && (command->id() & IDMask_EventType_Heal) != 0);
|
||||||
return eventTypeIsApplicable;
|
return eventTypeIsApplicable;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -387,7 +387,7 @@ void MapImageExporter::updatePreview() {
|
||||||
progress.setWindowModality(Qt::WindowModal);
|
progress.setWindowModality(Qt::WindowModal);
|
||||||
progress.setModal(true);
|
progress.setModal(true);
|
||||||
progress.setMinimumDuration(1000);
|
progress.setMinimumDuration(1000);
|
||||||
this->preview = getStitchedImage(&progress, this->showBorder);
|
this->preview = getStitchedImage(&progress, this->settings.showBorder);
|
||||||
progress.close();
|
progress.close();
|
||||||
} else {
|
} else {
|
||||||
// Timelapse mode doesn't currently have a real preview. It just displays the current map as in Normal mode.
|
// Timelapse mode doesn't currently have a real preview. It just displays the current map as in Normal mode.
|
||||||
|
@ -399,7 +399,7 @@ void MapImageExporter::updatePreview() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::scalePreview() {
|
void MapImageExporter::scalePreview() {
|
||||||
if (this->scene && !this->previewActualSize){
|
if (this->scene && !this->settings.previewActualSize){
|
||||||
ui->graphicsView_Preview->fitInView(this->scene->sceneRect(), Qt::KeepAspectRatioByExpanding);
|
ui->graphicsView_Preview->fitInView(this->scene->sceneRect(), Qt::KeepAspectRatioByExpanding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ QPixmap MapImageExporter::getFormattedMapPixmap(Map *map, bool ignoreBorder) {
|
||||||
map->render(true);
|
map->render(true);
|
||||||
pixmap = map->pixmap;
|
pixmap = map->pixmap;
|
||||||
|
|
||||||
if (showCollision) {
|
if (this->settings.showCollision) {
|
||||||
QPainter collisionPainter(&pixmap);
|
QPainter collisionPainter(&pixmap);
|
||||||
map->renderCollision(true);
|
map->renderCollision(true);
|
||||||
collisionPainter.setOpacity(editor->collisionOpacity);
|
collisionPainter.setOpacity(editor->collisionOpacity);
|
||||||
|
@ -422,7 +422,7 @@ QPixmap MapImageExporter::getFormattedMapPixmap(Map *map, bool ignoreBorder) {
|
||||||
// draw map border
|
// draw map border
|
||||||
// note: this will break when allowing map to be selected from drop down maybe
|
// note: this will break when allowing map to be selected from drop down maybe
|
||||||
int borderHeight = 0, borderWidth = 0;
|
int borderHeight = 0, borderWidth = 0;
|
||||||
if (!ignoreBorder && this->showBorder) {
|
if (!ignoreBorder && this->settings.showBorder) {
|
||||||
int borderDistance = this->mode ? STITCH_MODE_BORDER_DISTANCE : BORDER_DISTANCE;
|
int borderDistance = this->mode ? STITCH_MODE_BORDER_DISTANCE : BORDER_DISTANCE;
|
||||||
map->renderBorder();
|
map->renderBorder();
|
||||||
int borderHorzDist = editor->getBorderDrawDistance(map->getBorderWidth());
|
int borderHorzDist = editor->getBorderDrawDistance(map->getBorderWidth());
|
||||||
|
@ -441,16 +441,16 @@ QPixmap MapImageExporter::getFormattedMapPixmap(Map *map, bool ignoreBorder) {
|
||||||
pixmap = newPixmap;
|
pixmap = newPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignoreBorder && (this->showUpConnections || this->showDownConnections || this->showLeftConnections || this->showRightConnections)) {
|
if (!ignoreBorder && (this->settings.showUpConnections || this->settings.showDownConnections || this->settings.showLeftConnections || this->settings.showRightConnections)) {
|
||||||
// if showing connections, draw on outside of image
|
// if showing connections, draw on outside of image
|
||||||
QPainter connectionPainter(&pixmap);
|
QPainter connectionPainter(&pixmap);
|
||||||
// TODO: Reading the connections from the editor and not 'map' is incorrect.
|
// TODO: Reading the connections from the editor and not 'map' is incorrect.
|
||||||
for (auto connectionItem : editor->connection_items) {
|
for (auto connectionItem : editor->connection_items) {
|
||||||
const QString direction = connectionItem->connection->direction();
|
const QString direction = connectionItem->connection->direction();
|
||||||
if ((showUpConnections && direction == "up")
|
if ((this->settings.showUpConnections && direction == "up")
|
||||||
|| (showDownConnections && direction == "down")
|
|| (this->settings.showDownConnections && direction == "down")
|
||||||
|| (showLeftConnections && direction == "left")
|
|| (this->settings.showLeftConnections && direction == "left")
|
||||||
|| (showRightConnections && direction == "right"))
|
|| (this->settings.showRightConnections && direction == "right"))
|
||||||
connectionPainter.drawImage(connectionItem->x() + borderWidth, connectionItem->y() + borderHeight,
|
connectionPainter.drawImage(connectionItem->x() + borderWidth, connectionItem->y() + borderHeight,
|
||||||
connectionItem->connection->getPixmap().toImage());
|
connectionItem->connection->getPixmap().toImage());
|
||||||
}
|
}
|
||||||
|
@ -458,20 +458,20 @@ QPixmap MapImageExporter::getFormattedMapPixmap(Map *map, bool ignoreBorder) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw events
|
// draw events
|
||||||
if (this->showObjects || this->showWarps || this->showBGs || this->showTriggers || this->showHealLocations) {
|
if (this->settings.showObjects || this->settings.showWarps || this->settings.showBGs || this->settings.showTriggers || this->settings.showHealLocations) {
|
||||||
QPainter eventPainter(&pixmap);
|
QPainter eventPainter(&pixmap);
|
||||||
int pixelOffset = 0;
|
int pixelOffset = 0;
|
||||||
if (!ignoreBorder && this->showBorder) {
|
if (!ignoreBorder && this->settings.showBorder) {
|
||||||
pixelOffset = this->mode == ImageExporterMode::Normal ? BORDER_DISTANCE * 16 : STITCH_MODE_BORDER_DISTANCE * 16;
|
pixelOffset = this->mode == ImageExporterMode::Normal ? BORDER_DISTANCE * 16 : STITCH_MODE_BORDER_DISTANCE * 16;
|
||||||
}
|
}
|
||||||
const QList<Event *> events = map->getAllEvents();
|
const QList<Event *> events = map->getAllEvents();
|
||||||
for (const auto &event : events) {
|
for (const auto &event : events) {
|
||||||
Event::Group group = event->getEventGroup();
|
Event::Group group = event->getEventGroup();
|
||||||
if ((this->showObjects && group == Event::Group::Object)
|
if ((this->settings.showObjects && group == Event::Group::Object)
|
||||||
|| (this->showWarps && group == Event::Group::Warp)
|
|| (this->settings.showWarps && group == Event::Group::Warp)
|
||||||
|| (this->showBGs && group == Event::Group::Bg)
|
|| (this->settings.showBGs && group == Event::Group::Bg)
|
||||||
|| (this->showTriggers && group == Event::Group::Coord)
|
|| (this->settings.showTriggers && group == Event::Group::Coord)
|
||||||
|| (this->showHealLocations && group == Event::Group::Heal)) {
|
|| (this->settings.showHealLocations && group == Event::Group::Heal)) {
|
||||||
editor->project->setEventPixmap(event);
|
editor->project->setEventPixmap(event);
|
||||||
eventPainter.drawImage(QPoint(event->getPixelX() + pixelOffset, event->getPixelY() + pixelOffset), event->getPixmap().toImage());
|
eventPainter.drawImage(QPoint(event->getPixelX() + pixelOffset, event->getPixelY() + pixelOffset), event->getPixmap().toImage());
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ QPixmap MapImageExporter::getFormattedMapPixmap(Map *map, bool ignoreBorder) {
|
||||||
|
|
||||||
// draw grid directly onto the pixmap
|
// draw grid directly onto the pixmap
|
||||||
// since the last grid lines are outside of the pixmap, add a pixel to the bottom and right
|
// since the last grid lines are outside of the pixmap, add a pixel to the bottom and right
|
||||||
if (this->showGrid) {
|
if (this->settings.showGrid) {
|
||||||
int addX = 1, addY = 1;
|
int addX = 1, addY = 1;
|
||||||
if (borderHeight) addY = 0;
|
if (borderHeight) addY = 0;
|
||||||
if (borderWidth) addX = 0;
|
if (borderWidth) addX = 0;
|
||||||
|
@ -504,50 +504,50 @@ QPixmap MapImageExporter::getFormattedMapPixmap(Map *map, bool ignoreBorder) {
|
||||||
|
|
||||||
void MapImageExporter::updateShowBorderState() {
|
void MapImageExporter::updateShowBorderState() {
|
||||||
// If any of the Connections settings are enabled then this setting is locked (it's implicitly enabled)
|
// If any of the Connections settings are enabled then this setting is locked (it's implicitly enabled)
|
||||||
bool on = (showUpConnections || showDownConnections || showLeftConnections || showRightConnections);
|
bool on = (this->settings.showUpConnections || this->settings.showDownConnections || this->settings.showLeftConnections || this->settings.showRightConnections);
|
||||||
const QSignalBlocker blocker(ui->checkBox_Border);
|
const QSignalBlocker blocker(ui->checkBox_Border);
|
||||||
ui->checkBox_Border->setChecked(on);
|
ui->checkBox_Border->setChecked(on);
|
||||||
ui->checkBox_Border->setDisabled(on);
|
ui->checkBox_Border->setDisabled(on);
|
||||||
showBorder = on;
|
this->settings.showBorder = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_Elevation_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_Elevation_stateChanged(int state) {
|
||||||
showCollision = (state == Qt::Checked);
|
this->settings.showCollision = (state == Qt::Checked);
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_Grid_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_Grid_stateChanged(int state) {
|
||||||
showGrid = (state == Qt::Checked);
|
this->settings.showGrid = (state == Qt::Checked);
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_Border_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_Border_stateChanged(int state) {
|
||||||
showBorder = (state == Qt::Checked);
|
this->settings.showBorder = (state == Qt::Checked);
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_Objects_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_Objects_stateChanged(int state) {
|
||||||
showObjects = (state == Qt::Checked);
|
this->settings.showObjects = (state == Qt::Checked);
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_Warps_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_Warps_stateChanged(int state) {
|
||||||
showWarps = (state == Qt::Checked);
|
this->settings.showWarps = (state == Qt::Checked);
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_BGs_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_BGs_stateChanged(int state) {
|
||||||
showBGs = (state == Qt::Checked);
|
this->settings.showBGs = (state == Qt::Checked);
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_Triggers_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_Triggers_stateChanged(int state) {
|
||||||
showTriggers = (state == Qt::Checked);
|
this->settings.showTriggers = (state == Qt::Checked);
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_HealLocations_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_HealLocations_stateChanged(int state) {
|
||||||
showHealLocations = (state == Qt::Checked);
|
this->settings.showHealLocations = (state == Qt::Checked);
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,51 +558,51 @@ void MapImageExporter::on_checkBox_AllEvents_stateChanged(int state) {
|
||||||
const QSignalBlocker b_Objects(ui->checkBox_Objects);
|
const QSignalBlocker b_Objects(ui->checkBox_Objects);
|
||||||
ui->checkBox_Objects->setChecked(on);
|
ui->checkBox_Objects->setChecked(on);
|
||||||
ui->checkBox_Objects->setDisabled(on);
|
ui->checkBox_Objects->setDisabled(on);
|
||||||
showObjects = on;
|
this->settings.showObjects = on;
|
||||||
|
|
||||||
const QSignalBlocker b_Warps(ui->checkBox_Warps);
|
const QSignalBlocker b_Warps(ui->checkBox_Warps);
|
||||||
ui->checkBox_Warps->setChecked(on);
|
ui->checkBox_Warps->setChecked(on);
|
||||||
ui->checkBox_Warps->setDisabled(on);
|
ui->checkBox_Warps->setDisabled(on);
|
||||||
showWarps = on;
|
this->settings.showWarps = on;
|
||||||
|
|
||||||
const QSignalBlocker b_BGs(ui->checkBox_BGs);
|
const QSignalBlocker b_BGs(ui->checkBox_BGs);
|
||||||
ui->checkBox_BGs->setChecked(on);
|
ui->checkBox_BGs->setChecked(on);
|
||||||
ui->checkBox_BGs->setDisabled(on);
|
ui->checkBox_BGs->setDisabled(on);
|
||||||
showBGs = on;
|
this->settings.showBGs = on;
|
||||||
|
|
||||||
const QSignalBlocker b_Triggers(ui->checkBox_Triggers);
|
const QSignalBlocker b_Triggers(ui->checkBox_Triggers);
|
||||||
ui->checkBox_Triggers->setChecked(on);
|
ui->checkBox_Triggers->setChecked(on);
|
||||||
ui->checkBox_Triggers->setDisabled(on);
|
ui->checkBox_Triggers->setDisabled(on);
|
||||||
showTriggers = on;
|
this->settings.showTriggers = on;
|
||||||
|
|
||||||
const QSignalBlocker b_HealLocations(ui->checkBox_HealLocations);
|
const QSignalBlocker b_HealLocations(ui->checkBox_HealLocations);
|
||||||
ui->checkBox_HealLocations->setChecked(on);
|
ui->checkBox_HealLocations->setChecked(on);
|
||||||
ui->checkBox_HealLocations->setDisabled(on);
|
ui->checkBox_HealLocations->setDisabled(on);
|
||||||
showHealLocations = on;
|
this->settings.showHealLocations = on;
|
||||||
|
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_ConnectionUp_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_ConnectionUp_stateChanged(int state) {
|
||||||
showUpConnections = (state == Qt::Checked);
|
this->settings.showUpConnections = (state == Qt::Checked);
|
||||||
updateShowBorderState();
|
updateShowBorderState();
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_ConnectionDown_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_ConnectionDown_stateChanged(int state) {
|
||||||
showDownConnections = (state == Qt::Checked);
|
this->settings.showDownConnections = (state == Qt::Checked);
|
||||||
updateShowBorderState();
|
updateShowBorderState();
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_ConnectionLeft_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_ConnectionLeft_stateChanged(int state) {
|
||||||
showLeftConnections = (state == Qt::Checked);
|
this->settings.showLeftConnections = (state == Qt::Checked);
|
||||||
updateShowBorderState();
|
updateShowBorderState();
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_ConnectionRight_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_ConnectionRight_stateChanged(int state) {
|
||||||
showRightConnections = (state == Qt::Checked);
|
this->settings.showRightConnections = (state == Qt::Checked);
|
||||||
updateShowBorderState();
|
updateShowBorderState();
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
@ -614,30 +614,30 @@ void MapImageExporter::on_checkBox_AllConnections_stateChanged(int state) {
|
||||||
const QSignalBlocker b_Up(ui->checkBox_ConnectionUp);
|
const QSignalBlocker b_Up(ui->checkBox_ConnectionUp);
|
||||||
ui->checkBox_ConnectionUp->setChecked(on);
|
ui->checkBox_ConnectionUp->setChecked(on);
|
||||||
ui->checkBox_ConnectionUp->setDisabled(on);
|
ui->checkBox_ConnectionUp->setDisabled(on);
|
||||||
showUpConnections = on;
|
this->settings.showUpConnections = on;
|
||||||
|
|
||||||
const QSignalBlocker b_Down(ui->checkBox_ConnectionDown);
|
const QSignalBlocker b_Down(ui->checkBox_ConnectionDown);
|
||||||
ui->checkBox_ConnectionDown->setChecked(on);
|
ui->checkBox_ConnectionDown->setChecked(on);
|
||||||
ui->checkBox_ConnectionDown->setDisabled(on);
|
ui->checkBox_ConnectionDown->setDisabled(on);
|
||||||
showDownConnections = on;
|
this->settings.showDownConnections = on;
|
||||||
|
|
||||||
const QSignalBlocker b_Left(ui->checkBox_ConnectionLeft);
|
const QSignalBlocker b_Left(ui->checkBox_ConnectionLeft);
|
||||||
ui->checkBox_ConnectionLeft->setChecked(on);
|
ui->checkBox_ConnectionLeft->setChecked(on);
|
||||||
ui->checkBox_ConnectionLeft->setDisabled(on);
|
ui->checkBox_ConnectionLeft->setDisabled(on);
|
||||||
showLeftConnections = on;
|
this->settings.showLeftConnections = on;
|
||||||
|
|
||||||
const QSignalBlocker b_Right(ui->checkBox_ConnectionRight);
|
const QSignalBlocker b_Right(ui->checkBox_ConnectionRight);
|
||||||
ui->checkBox_ConnectionRight->setChecked(on);
|
ui->checkBox_ConnectionRight->setChecked(on);
|
||||||
ui->checkBox_ConnectionRight->setDisabled(on);
|
ui->checkBox_ConnectionRight->setDisabled(on);
|
||||||
showRightConnections = on;
|
this->settings.showRightConnections = on;
|
||||||
|
|
||||||
updateShowBorderState();
|
updateShowBorderState();
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_checkBox_ActualSize_stateChanged(int state) {
|
void MapImageExporter::on_checkBox_ActualSize_stateChanged(int state) {
|
||||||
previewActualSize = (state == Qt::Checked);
|
this->settings.previewActualSize = (state == Qt::Checked);
|
||||||
if (previewActualSize) {
|
if (this->settings.previewActualSize) {
|
||||||
ui->graphicsView_Preview->resetTransform();
|
ui->graphicsView_Preview->resetTransform();
|
||||||
} else {
|
} else {
|
||||||
scalePreview();
|
scalePreview();
|
||||||
|
@ -645,17 +645,20 @@ void MapImageExporter::on_checkBox_ActualSize_stateChanged(int state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_pushButton_Reset_pressed() {
|
void MapImageExporter::on_pushButton_Reset_pressed() {
|
||||||
|
this->settings = {};
|
||||||
for (auto widget : this->findChildren<QCheckBox *>()) {
|
for (auto widget : this->findChildren<QCheckBox *>()) {
|
||||||
const QSignalBlocker b(widget);
|
const QSignalBlocker b(widget); // Prevent calls to updatePreview
|
||||||
widget->setChecked(false);
|
widget->setChecked(false);
|
||||||
}
|
}
|
||||||
|
ui->spinBox_TimelapseDelay->setValue(this->settings.timelapseDelayMs);
|
||||||
|
ui->spinBox_FrameSkip->setValue(this->settings.timelapseSkipAmount);
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_spinBox_TimelapseDelay_valueChanged(int delayMs) {
|
void MapImageExporter::on_spinBox_TimelapseDelay_valueChanged(int delayMs) {
|
||||||
timelapseDelayMs = delayMs;
|
this->settings.timelapseDelayMs = delayMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapImageExporter::on_spinBox_FrameSkip_valueChanged(int skip) {
|
void MapImageExporter::on_spinBox_FrameSkip_valueChanged(int skip) {
|
||||||
timelapseSkipAmount = skip;
|
this->settings.timelapseSkipAmount = skip;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue