Add option to ignore a warning overwriting files on Export Sprite Sheet (related to #917)

This commit is contained in:
David Capello 2018-03-12 16:44:19 -03:00
parent 478c4c3296
commit 9f96ccbd39
5 changed files with 15 additions and 3 deletions

View File

@ -257,6 +257,9 @@
<option id="show_export_animation_in_sequence_alert" type="bool" default="true" />
<option id="default_extension" type="std::string" default="&quot;aseprite&quot;" />
</section>
<section id="sprite_sheet">
<option id="show_overwrite_files_alert" type="bool" default="true" />
</section>
<section id="gif">
<option id="show_alert" type="bool" default="true" />
<option id="interlaced" type="bool" default="false" migrate="GIF.Interlaced" />

View File

@ -951,6 +951,7 @@ END
undo_allow_nonlinear_history = Allow non-linear history
file_format_doesnt_support_alert = Show warning when saving a file with unsupported features
export_animation_in_sequence_alert = Show warning when saving an animation as a sequence of static images
overwrite_files_on_export_sprite_sheet_alert = Show warning when overwriting files on Export Sprite Sheet
gif_options_alert = Show GIF options when saving .gif files
jpeg_options_alert = Show JPEG options when saving .jpeg files
advanced_mode_alert = Show alert when we enter to Advanced Mode

View File

@ -276,6 +276,7 @@
<separator text="@.section_alerts" horizontal="true" />
<check id="file_format_doesnt_support_alert" text="@.file_format_doesnt_support_alert" />
<check id="export_animation_in_sequence_alert" text="@.export_animation_in_sequence_alert" />
<check id="overwrite_files_on_export_sprite_sheet_alert" text="@.overwrite_files_on_export_sprite_sheet_alert" />
<check id="gif_options_alert" text="@.gif_options_alert" />
<check id="jpeg_options_alert" text="@.jpeg_options_alert" />
<check id="advanced_mode_alert" text="@.advanced_mode_alert" />

View File

@ -22,6 +22,7 @@
#include "app/restore_visible_layers.h"
#include "app/ui/editor/editor.h"
#include "app/ui/layer_frame_comboboxes.h"
#include "app/ui/optional_alert.h"
#include "app/ui/status_bar.h"
#include "app/ui/timeline/timeline.h"
#include "base/bind.h"
@ -147,9 +148,12 @@ namespace {
if (base::is_file(dataname))
text << "<<" << base::get_file_name(dataname).c_str();
if (ui::Alert::show(
int ret = OptionalAlert::show(
Preferences::instance().spriteSheet.showOverwriteFilesAlert,
1, // Yes is the default option when the alert dialog is disabled
fmt::format(Strings::alerts_overwrite_files_on_export_sprite_sheet(),
text.str())) != 1)
text.str()));
if (ret != 1)
return false;
}
return true;

View File

@ -155,6 +155,7 @@ public:
// Alerts
fileFormatDoesntSupportAlert()->setSelected(m_pref.saveFile.showFileFormatDoesntSupportAlert());
exportAnimationInSequenceAlert()->setSelected(m_pref.saveFile.showExportAnimationInSequenceAlert());
overwriteFilesOnExportSpriteSheetAlert()->setSelected(m_pref.spriteSheet.showOverwriteFilesAlert());
gifOptionsAlert()->setSelected(m_pref.gif.showAlert());
jpegOptionsAlert()->setSelected(m_pref.jpeg.showAlert());
advancedModeAlert()->setSelected(m_pref.advancedMode.showAlert());
@ -410,6 +411,7 @@ public:
m_pref.saveFile.showFileFormatDoesntSupportAlert(fileFormatDoesntSupportAlert()->isSelected());
m_pref.saveFile.showExportAnimationInSequenceAlert(exportAnimationInSequenceAlert()->isSelected());
m_pref.spriteSheet.showOverwriteFilesAlert(overwriteFilesOnExportSpriteSheetAlert()->isSelected());
m_pref.gif.showAlert(gifOptionsAlert()->isSelected());
m_pref.jpeg.showAlert(jpegOptionsAlert()->isSelected());
m_pref.advancedMode.showAlert(advancedModeAlert()->isSelected());
@ -593,6 +595,7 @@ private:
void onResetAlerts() {
fileFormatDoesntSupportAlert()->setSelected(m_pref.saveFile.showFileFormatDoesntSupportAlert.defaultValue());
exportAnimationInSequenceAlert()->setSelected(m_pref.saveFile.showExportAnimationInSequenceAlert.defaultValue());
overwriteFilesOnExportSpriteSheetAlert()->setSelected(m_pref.spriteSheet.showOverwriteFilesAlert.defaultValue());
gifOptionsAlert()->setSelected(m_pref.gif.showAlert.defaultValue());
jpegOptionsAlert()->setSelected(m_pref.jpeg.showAlert.defaultValue());
advancedModeAlert()->setSelected(m_pref.advancedMode.showAlert.defaultValue());