mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-10 01:13:49 +00:00
Add option to change default file format (.aseprite is the new default)
This commit is contained in:
parent
5da8b2c8a9
commit
ebb7afde8b
@ -255,6 +255,7 @@
|
||||
<section id="save_file">
|
||||
<option id="show_file_format_doesnt_support_alert" type="bool" default="true" />
|
||||
<option id="show_export_animation_in_sequence_alert" type="bool" default="true" />
|
||||
<option id="default_extension" type="std::string" default=""aseprite"" />
|
||||
</section>
|
||||
<section id="gif">
|
||||
<option id="show_alert" type="bool" default="true" />
|
||||
|
@ -838,6 +838,7 @@ show_full_path_tooltip = <<<END
|
||||
Uncheck this option if you would prefer to hide
|
||||
full path on UI (e.g. useful for live streaming)
|
||||
END
|
||||
default_extension = Default extension when saving files
|
||||
locate_file = Locate Configuration File
|
||||
locate_crash_folder = Locate Crash Folder
|
||||
wheel_zoom = Zoom with scroll wheel
|
||||
|
@ -73,6 +73,10 @@
|
||||
<check id="show_full_path"
|
||||
text="@.show_full_path"
|
||||
tooltip="@.show_full_path_tooltip" />
|
||||
<hbox>
|
||||
<label text="@.default_extension" />
|
||||
<combobox id="default_extension" />
|
||||
</hbox>
|
||||
<separator horizontal="true" />
|
||||
<link id="locate_file" text="@.locate_file" />
|
||||
<link id="locate_crash_folder" text="@.locate_crash_folder" />
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "app/console.h"
|
||||
#include "app/context.h"
|
||||
#include "app/extensions.h"
|
||||
#include "app/file/file.h"
|
||||
#include "app/file_selector.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/ini_file.h"
|
||||
@ -140,6 +141,17 @@ public:
|
||||
{
|
||||
sectionListbox()->Change.connect(base::Bind<void>(&OptionsWindow::onChangeSection, this));
|
||||
|
||||
// Default extension to save files
|
||||
{
|
||||
std::string defExt = m_pref.saveFile.defaultExtension();
|
||||
base::paths exts = get_writable_extensions();
|
||||
for (const auto& e : exts) {
|
||||
int index = defaultExtension()->addItem(e);
|
||||
if (base::utf8_icmp(e, defExt) == 0)
|
||||
defaultExtension()->setSelectedItemIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
// Alerts
|
||||
fileFormatDoesntSupportAlert()->setSelected(m_pref.saveFile.showFileFormatDoesntSupportAlert());
|
||||
exportAnimationInSequenceAlert()->setSelected(m_pref.saveFile.showExportAnimationInSequenceAlert());
|
||||
@ -376,6 +388,10 @@ public:
|
||||
m_pref.general.rewindOnStop(rewindOnStop()->isSelected());
|
||||
m_globPref.timeline.firstFrame(firstFrame()->textInt());
|
||||
m_pref.general.showFullPath(showFullPath()->isSelected());
|
||||
{
|
||||
Widget* defExt = defaultExtension()->getSelectedItem();
|
||||
m_pref.saveFile.defaultExtension(defExt ? defExt->text(): std::string());
|
||||
}
|
||||
|
||||
bool expandOnMouseover = expandMenubarOnMouseover()->isSelected();
|
||||
m_pref.general.expandMenubarOnMouseover(expandOnMouseover);
|
||||
|
@ -27,6 +27,9 @@ bool show_file_selector(
|
||||
base::paths& output,
|
||||
FileSelectorDelegate* delegate)
|
||||
{
|
||||
const std::string defExtension =
|
||||
Preferences::instance().saveFile.defaultExtension();
|
||||
|
||||
if (Preferences::instance().experimental.useNativeFileDialog() &&
|
||||
she::instance()->nativeDialogs()) {
|
||||
she::FileDialog* dlg =
|
||||
@ -53,6 +56,9 @@ bool show_file_selector(
|
||||
for (const auto& ext : extensions)
|
||||
dlg->addFilter(ext, ext + " files (*." + ext + ")");
|
||||
|
||||
if (!defExtension.empty())
|
||||
dlg->setDefaultExtension(defExtension);
|
||||
|
||||
bool res = dlg->show(she::instance()->defaultDisplay());
|
||||
if (res) {
|
||||
if (type == FileSelectorType::OpenMultiple)
|
||||
@ -66,6 +72,10 @@ bool show_file_selector(
|
||||
}
|
||||
|
||||
FileSelector fileSelector(type, delegate);
|
||||
|
||||
if (!defExtension.empty())
|
||||
fileSelector.setDefaultExtension(defExtension);
|
||||
|
||||
return fileSelector.show(title, initialPath, extensions, output);
|
||||
}
|
||||
|
||||
|
@ -385,6 +385,11 @@ FileSelector::FileSelector(FileSelectorType type, FileSelectorDelegate* delegate
|
||||
updateExtraLabel();
|
||||
}
|
||||
|
||||
void FileSelector::setDefaultExtension(const std::string& extension)
|
||||
{
|
||||
m_defExtension = extension;
|
||||
}
|
||||
|
||||
FileSelector::~FileSelector()
|
||||
{
|
||||
delete m_extras;
|
||||
@ -495,7 +500,8 @@ bool FileSelector::show(
|
||||
fileType()->removeAllItems();
|
||||
|
||||
// Get the default extension from the given initial file name
|
||||
m_defExtension = initialExtension;
|
||||
if (m_defExtension.empty())
|
||||
m_defExtension = initialExtension;
|
||||
|
||||
// File type for all formats
|
||||
fileType()->addItem(
|
||||
|
@ -32,6 +32,8 @@ namespace app {
|
||||
FileSelector(FileSelectorType type, FileSelectorDelegate* delegate);
|
||||
~FileSelector();
|
||||
|
||||
void setDefaultExtension(const std::string& extension);
|
||||
|
||||
void goBack();
|
||||
void goForward();
|
||||
void goUp();
|
||||
|
Loading…
x
Reference in New Issue
Block a user