share a single ItemIconCache across the UI
Four separate caches rasterized the same item SVGs, one of them rebuilt on every recipe-dialog open. MainWindow now owns one cache and hands a non-owning pointer to HeaderBar, BuildButtonGrid, GameWorldView and RecipeSelectionDialog. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GH8ZMRY3vhxxXcaUxBqxkk
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
struct GameConfig;
|
||||
class Simulation;
|
||||
class QPushButton;
|
||||
class ItemIconCache;
|
||||
|
||||
// One selectable entry in the recipe/schematic selection dialog
|
||||
// (REQ-UI-SELECT-BUTTON). The "(None)" entry uses an empty id.
|
||||
@@ -43,11 +44,11 @@ class RecipeSelectionDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// itemIconDir is the directory holding per-item icon SVGs (REQ-UI-ITEM-ICON);
|
||||
// used to render recipe options icon-only (REQ-UI-RECIPE-ICON). Options whose
|
||||
// item has no icon file fall back to their caption text.
|
||||
// itemIcons is the window-wide per-item icon cache (REQ-UI-ITEM-ICON); used to
|
||||
// render recipe options icon-only (REQ-UI-RECIPE-ICON). Options whose item has
|
||||
// no icon file fall back to their caption text. Not owned.
|
||||
RecipeSelectionDialog(const std::vector<RecipeSelectionOption>& options,
|
||||
const QString& title, const QString& itemIconDir,
|
||||
const QString& title, ItemIconCache* itemIcons,
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
std::optional<std::string> getChosenId() const;
|
||||
|
||||
Reference in New Issue
Block a user