mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-26 18:31:11 +00:00
Add category headers. Alphabetical sorting when no search query. Recent count adjustments
This commit is contained in:
@@ -286,6 +286,8 @@ void AppConfig::set_defaults()
|
||||
// The getter already defaults, parses and clamps; write back what it resolves to.
|
||||
set(SETTING_PLUGIN_PAGES_VISIBLE_COUNT, std::to_string(get_plugin_pages_visible_count()));
|
||||
|
||||
set(SETTING_SPEED_DIAL_RECENT_COUNT, std::to_string(get_speed_dial_recent_count()));
|
||||
|
||||
if (get(SETTING_OPENGL_SHOW_FPS_OVERLAY).empty())
|
||||
set_bool(SETTING_OPENGL_SHOW_FPS_OVERLAY, false);
|
||||
|
||||
@@ -1664,6 +1666,22 @@ int AppConfig::get_plugin_pages_visible_count() const
|
||||
return std::clamp(visible_count, PLUGIN_PAGES_VISIBLE_COUNT_MIN, PLUGIN_PAGES_VISIBLE_COUNT_MAX);
|
||||
}
|
||||
|
||||
int AppConfig::get_speed_dial_recent_count() const
|
||||
{
|
||||
std::string value = get(SETTING_SPEED_DIAL_RECENT_COUNT);
|
||||
if (value.empty())
|
||||
return SPEED_DIAL_RECENT_COUNT_DEFAULT;
|
||||
|
||||
int recent_count = SPEED_DIAL_RECENT_COUNT_DEFAULT;
|
||||
try {
|
||||
recent_count = std::stoi(value);
|
||||
}
|
||||
catch (...) {
|
||||
return SPEED_DIAL_RECENT_COUNT_DEFAULT;
|
||||
}
|
||||
return std::clamp(recent_count, SPEED_DIAL_RECENT_COUNT_MIN, SPEED_DIAL_RECENT_COUNT_MAX);
|
||||
}
|
||||
|
||||
std::vector<std::string> AppConfig::get_skipped_network_versions() const
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
|
||||
@@ -46,6 +46,11 @@ using namespace nlohmann;
|
||||
#define PLUGIN_PAGES_VISIBLE_COUNT_DEFAULT 5
|
||||
#define PLUGIN_PAGES_VISIBLE_COUNT_MAX 10
|
||||
|
||||
#define SETTING_SPEED_DIAL_RECENT_COUNT "speed_dial_recent_count"
|
||||
#define SPEED_DIAL_RECENT_COUNT_MIN 0
|
||||
#define SPEED_DIAL_RECENT_COUNT_DEFAULT 5
|
||||
#define SPEED_DIAL_RECENT_COUNT_MAX 10
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define BAMBU_NETWORK_AGENT_VERSION_LEGACY "01.10.01.09"
|
||||
#else
|
||||
@@ -394,6 +399,9 @@ public:
|
||||
// dropdown on the last tab.
|
||||
int get_plugin_pages_visible_count() const;
|
||||
|
||||
// Number of recently launched actions shown at the top of the Speed Dial; 0 hides them.
|
||||
int get_speed_dial_recent_count() const;
|
||||
|
||||
std::vector<std::string> get_skipped_network_versions() const;
|
||||
void add_skipped_network_version(const std::string& version);
|
||||
bool is_network_version_skipped(const std::string& version) const;
|
||||
|
||||
@@ -720,6 +720,7 @@ nlohmann::json ActionRegistry::snapshot()
|
||||
{"title", a->title()},
|
||||
{"source", a->source_name()},
|
||||
{"group", a->group},
|
||||
{"kind", a->kind == AppActionKind::Plugin ? "plugin" : "command"},
|
||||
{"input", a->input},
|
||||
{"icon", a->icon},
|
||||
{"mode", mode_key(a->required_mode)}});
|
||||
@@ -744,8 +745,9 @@ nlohmann::json ActionRegistry::snapshot()
|
||||
write_section("favourite_actions", nlohmann::json(live_favs));
|
||||
nlohmann::json favourites(live_favs);
|
||||
|
||||
// Recent = the last-N launched actions by recency (only actions with a run history).
|
||||
constexpr size_t kRecentLimit = 5;
|
||||
// Recent = the last-N launched actions by recency (only actions with a run history). N is a
|
||||
// user preference; 0 hides recents without affecting the frecency order below.
|
||||
const size_t recent_limit = size_t(wxGetApp().app_config->get_speed_dial_recent_count());
|
||||
std::vector<const AppAction*> recent;
|
||||
for (const auto& entry : m_actions)
|
||||
if (entry.second->last > 0)
|
||||
@@ -755,8 +757,8 @@ nlohmann::json ActionRegistry::snapshot()
|
||||
return a->last > b->last;
|
||||
return a->id() < b->id();
|
||||
});
|
||||
if (recent.size() > kRecentLimit)
|
||||
recent.resize(kRecentLimit);
|
||||
if (recent.size() > recent_limit)
|
||||
recent.resize(recent_limit);
|
||||
nlohmann::json recent_json = nlohmann::json::array();
|
||||
for (const AppAction* a : recent)
|
||||
recent_json.push_back(action_to_json(a));
|
||||
|
||||
@@ -1728,6 +1728,16 @@ void PreferencesDialog::create_items()
|
||||
"enable_speed_dial");
|
||||
g_sizer->Add(item_speed_dial);
|
||||
|
||||
auto item_speed_dial_recents = create_item_spinctrl(
|
||||
_L("Recent actions"),
|
||||
"",
|
||||
_L("actions"),
|
||||
_L("How many recently launched actions to show at the top of the Speed Dial. Set to 0 to hide recent actions."),
|
||||
SETTING_SPEED_DIAL_RECENT_COUNT,
|
||||
SPEED_DIAL_RECENT_COUNT_MIN,
|
||||
SPEED_DIAL_RECENT_COUNT_MAX);
|
||||
g_sizer->Add(item_speed_dial_recents);
|
||||
|
||||
#if 0
|
||||
g_sizer->Add(create_item_title(_L("Filament Grouping")), 1, wxEXPAND);
|
||||
//temporarily disable it
|
||||
|
||||
Reference in New Issue
Block a user