Clean up favorites preferences code

This commit is contained in:
Lawrence Lee
2021-12-11 15:35:52 -08:00
parent 80944d6c9b
commit 546c99d276
3 changed files with 85 additions and 40 deletions

View File

@@ -305,7 +305,7 @@ public:
std::vector<ToolTree> children;
};
using ToolLayout = std::unordered_map<Panel, const std::vector<ToolTree>, ScopedEnumHash>;
using ToolLayout = std::unordered_map<Panel, const std::vector<ToolTree> &, ScopedEnumHash>;
CoarsePanel* coarse;
Gtk::Notebook* toolPanelNotebook;
@@ -313,12 +313,13 @@ public:
ToolPanelCoordinator(bool batch = false);
~ToolPanelCoordinator () override;
static const ToolLayout& getDefaultToolLayout();
static const ToolLayout &getDefaultToolLayout();
/**
* Gets the tool with the provided tool name.
*
* @param name The tool name as a raw string.
* @return The tool.
* @throws std::out_of_range If the name is not recognized.
*/
static Tool getToolFromName(const std::string &name);
/**
@@ -472,7 +473,7 @@ protected:
Gtk::Box *panelBox,
const std::vector<T> &children,
int level,
std::unordered_set<Tool, ScopedEnumHash> favorites,
const std::unordered_set<Tool, ScopedEnumHash> &favorites,
bool cloneFavoriteTools);
private: