share a single ItemIconCache across the UI
This commit is contained in:
@@ -111,14 +111,12 @@ namespace
|
||||
|
||||
RecipeSelectionDialog::RecipeSelectionDialog(
|
||||
const std::vector<RecipeSelectionOption>& options,
|
||||
const QString& title, const QString& itemIconDir, QWidget* parent)
|
||||
const QString& title, ItemIconCache* itemIcons, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle(title);
|
||||
setModal(true);
|
||||
|
||||
ItemIconCache iconCache(itemIconDir);
|
||||
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
QGridLayout* grid = new QGridLayout();
|
||||
mainLayout->addLayout(grid);
|
||||
@@ -131,9 +129,9 @@ RecipeSelectionDialog::RecipeSelectionDialog(
|
||||
QPushButton* button = new QPushButton(this);
|
||||
// Icon-only when the produced item has an icon (REQ-UI-RECIPE-ICON); otherwise
|
||||
// fall back to the caption. The name stays reachable via the tooltip.
|
||||
if (!option.iconItemId.empty() && iconCache.hasIcon(option.iconItemId))
|
||||
if (!option.iconItemId.empty() && itemIcons->hasIcon(option.iconItemId))
|
||||
{
|
||||
button->setIcon(QIcon(iconCache.getPixmap(
|
||||
button->setIcon(QIcon(itemIcons->getPixmap(
|
||||
option.iconItemId, kOptionIconSize.width())));
|
||||
button->setIconSize(kOptionIconSize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user