mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Add option to change the number of recent files/folders (#578)
* Added option to clear the list too * If we specify 0 as the number of recent items, the feature is disabled
This commit is contained in:
parent
8e6bd1a8dc
commit
5239db243a
@ -115,6 +115,7 @@
|
||||
<option id="show_full_path" type="bool" default="true" />
|
||||
<option id="timeline_position" type="TimelinePosition" default="TimelinePosition::BOTTOM" />
|
||||
<option id="show_menu_bar" type="bool" default="true" />
|
||||
<option id="recent_items" type="int" default="16" />
|
||||
</section>
|
||||
<section id="undo" text="Undo">
|
||||
<option id="size_limit" type="int" default="0" />
|
||||
|
@ -799,6 +799,7 @@ skip = &Skip
|
||||
[options]
|
||||
title = Preferences
|
||||
section_general = General
|
||||
section_files = Files
|
||||
section_alerts = Alerts
|
||||
section_editor = Editor
|
||||
section_selection = Selection
|
||||
@ -842,6 +843,10 @@ 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
|
||||
recent_files = Recent Items:
|
||||
recent_files_tooltip = Number of recent files and folders
|
||||
clear_recent_files = Clear
|
||||
clear_recent_files_tooltip = Clear the list of recent files and folders
|
||||
locate_file = Locate Configuration File
|
||||
locate_crash_folder = Locate Crash Folder
|
||||
wheel_zoom = Zoom with scroll wheel
|
||||
|
@ -7,6 +7,7 @@
|
||||
<view maxsize="true">
|
||||
<listbox id="section_listbox">
|
||||
<listitem text="@.section_general" value="section_general" />
|
||||
<listitem text="@.section_files" value="section_files" />
|
||||
<listitem text="@.section_alerts" value="section_alerts" />
|
||||
<listitem text="@.section_editor" value="section_editor" />
|
||||
<listitem text="@.section_selection" value="section_selection" />
|
||||
@ -70,16 +71,30 @@
|
||||
<listitem text="@.30_minutes" value="30" />
|
||||
</combobox>
|
||||
</hbox>
|
||||
<check id="show_full_path"
|
||||
text="@.show_full_path"
|
||||
tooltip="@.show_full_path_tooltip" />
|
||||
<separator horizontal="true" />
|
||||
<link id="locate_file" text="@.locate_file" />
|
||||
<link id="locate_crash_folder" text="@.locate_crash_folder" />
|
||||
</vbox>
|
||||
|
||||
<!-- Files -->
|
||||
<vbox id="section_files">
|
||||
<separator text="@.section_files" horizontal="true" />
|
||||
<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" />
|
||||
<grid columns="2">
|
||||
<label text="@.recent_files" />
|
||||
<hbox>
|
||||
<slider min="0" max="100" id="recent_files" width="128" tooltip="@.recent_files_tooltip" />
|
||||
<button id="clear_recent_files" text="@.clear_recent_files" tooltip="@.clear_recent_files_tooltip" width="60" />
|
||||
</hbox>
|
||||
|
||||
<boxfiller />
|
||||
<check id="show_full_path"
|
||||
text="@.show_full_path"
|
||||
tooltip="@.show_full_path_tooltip" />
|
||||
</grid>
|
||||
</vbox>
|
||||
|
||||
<!-- Editor -->
|
||||
|
2
laf
2
laf
@ -1 +1 @@
|
||||
Subproject commit dbcc5745d8433fc99a2da3faffebfb04a539bae9
|
||||
Subproject commit 0246ba538ce7ccd073739618bbd11c7bd28e44a2
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -103,9 +103,10 @@ public:
|
||||
// This is a raw pointer because we want to delete this explicitly.
|
||||
app::crash::DataRecovery* m_recovery;
|
||||
|
||||
Modules(bool createLogInDesktop)
|
||||
Modules(bool createLogInDesktop, Preferences& pref)
|
||||
: m_loggerModule(createLogInDesktop)
|
||||
, m_activeToolManager(&m_toolbox)
|
||||
, m_recent_files(pref.general.recentItems())
|
||||
, m_recovery(nullptr) {
|
||||
}
|
||||
|
||||
@ -173,7 +174,7 @@ void App::initialize(const AppOptions& options)
|
||||
break;
|
||||
}
|
||||
|
||||
m_modules = new Modules(createLogInDesktop);
|
||||
m_modules = new Modules(createLogInDesktop, preferences());
|
||||
m_legacy = new LegacyModules(isGui() ? REQUIRE_INTERFACE: 0);
|
||||
m_brushes.reset(new AppBrushes);
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "app/ini_file.h"
|
||||
#include "app/launcher.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/recent_files.h"
|
||||
#include "app/resource_finder.h"
|
||||
#include "app/send_crash.h"
|
||||
#include "app/ui/color_button.h"
|
||||
@ -152,6 +153,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Number of recent items
|
||||
recentFiles()->setValue(m_pref.general.recentItems());
|
||||
clearRecentFiles()->Click.connect(base::Bind<void>(&OptionsWindow::onClearRecentFiles, this));
|
||||
|
||||
// Alerts
|
||||
fileFormatDoesntSupportAlert()->setSelected(m_pref.saveFile.showFileFormatDoesntSupportAlert());
|
||||
exportAnimationInSequenceAlert()->setSelected(m_pref.saveFile.showExportAnimationInSequenceAlert());
|
||||
@ -393,6 +398,11 @@ public:
|
||||
Widget* defExt = defaultExtension()->getSelectedItem();
|
||||
m_pref.saveFile.defaultExtension(defExt ? defExt->text(): std::string());
|
||||
}
|
||||
{
|
||||
const int limit = recentFiles()->getValue();
|
||||
m_pref.general.recentItems(limit);
|
||||
App::instance()->recentFiles()->setLimit(limit);
|
||||
}
|
||||
|
||||
bool expandOnMouseover = expandMenubarOnMouseover()->isSelected();
|
||||
m_pref.general.expandMenubarOnMouseover(expandOnMouseover);
|
||||
@ -592,6 +602,10 @@ private:
|
||||
loadExtensions();
|
||||
}
|
||||
|
||||
void onClearRecentFiles() {
|
||||
App::instance()->recentFiles()->clear();
|
||||
}
|
||||
|
||||
void onResetAlerts() {
|
||||
fileFormatDoesntSupportAlert()->setSelected(m_pref.saveFile.showFileFormatDoesntSupportAlert.defaultValue());
|
||||
exportAnimationInSequenceAlert()->setSelected(m_pref.saveFile.showExportAnimationInSequenceAlert.defaultValue());
|
||||
|
@ -43,9 +43,9 @@ std::string format_folder_var(const int i) {
|
||||
|
||||
namespace app {
|
||||
|
||||
RecentFiles::RecentFiles()
|
||||
: m_files(16)
|
||||
, m_paths(16)
|
||||
RecentFiles::RecentFiles(const int limit)
|
||||
: m_files(limit)
|
||||
, m_paths(limit)
|
||||
{
|
||||
for (int c=m_files.limit()-1; c>=0; c--) {
|
||||
const char* filename = get_config_string(kRecentFilesSection,
|
||||
@ -130,6 +130,22 @@ void RecentFiles::removeRecentFolder(const std::string& dir)
|
||||
Changed();
|
||||
}
|
||||
|
||||
void RecentFiles::setLimit(const int n)
|
||||
{
|
||||
m_files.setLimit(n);
|
||||
m_paths.setLimit(n);
|
||||
|
||||
Changed();
|
||||
}
|
||||
|
||||
void RecentFiles::clear()
|
||||
{
|
||||
m_files.clear();
|
||||
m_paths.clear();
|
||||
|
||||
Changed();
|
||||
}
|
||||
|
||||
std::string RecentFiles::normalizePath(const std::string& filename)
|
||||
{
|
||||
return base::normalize_path(filename);
|
||||
|
@ -29,12 +29,14 @@ namespace app {
|
||||
const_iterator paths_begin() { return m_paths.begin(); }
|
||||
const_iterator paths_end() { return m_paths.end(); }
|
||||
|
||||
RecentFiles();
|
||||
RecentFiles(const int limit);
|
||||
~RecentFiles();
|
||||
|
||||
void addRecentFile(const std::string& filename);
|
||||
void removeRecentFile(const std::string& filename);
|
||||
void removeRecentFolder(const std::string& dir);
|
||||
void setLimit(const int n);
|
||||
void clear();
|
||||
|
||||
obs::signal<void()> Changed;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user