show recipes visually instead of describing them in text
This commit is contained in:
@@ -8,11 +8,13 @@
|
||||
#include <QString>
|
||||
|
||||
#include "BuildingType.h"
|
||||
#include "RecipeLineRow.h"
|
||||
|
||||
struct GameConfig;
|
||||
class BuildingIconCache;
|
||||
class ItemIconCache;
|
||||
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.
|
||||
@@ -20,23 +22,23 @@ struct RecipeSelectionOption
|
||||
{
|
||||
std::string id;
|
||||
QString caption;
|
||||
QString tooltip;
|
||||
// Id of the item whose icon is shown on the option button (REQ-UI-RECIPE-ICON);
|
||||
// empty for the "(None)" option and for Shipyard schematics, which keep their
|
||||
// caption. When set but no icon file exists, the button falls back to the caption.
|
||||
std::string iconItemId;
|
||||
// What the option makes, drawn beneath its caption on the button
|
||||
// (REQ-UI-SELECT-OPTIONS). Empty for the "(None)" option, which is a caption alone.
|
||||
// A ship schematic fills the inputs and the time and leaves the outputs empty: a
|
||||
// ship is not an item and has no icon, so the caption is what it produces.
|
||||
RecipeLineRow::Spec line;
|
||||
};
|
||||
|
||||
// Builds the lock-aware list of selectable options for a production building
|
||||
// of the given type, with display captions and info tooltips
|
||||
// (REQ-UI-SELECT-BUTTON, REQ-UI-SELECT-TOOLTIP). The first entry is always a
|
||||
// of the given type, with display captions and recipe lines
|
||||
// (REQ-UI-SELECT-BUTTON, REQ-UI-SELECT-OPTIONS). The first entry is always a
|
||||
// "(None)" option with an empty id. Shared by the selection dialog and the
|
||||
// panel selection button so both render identical captions and tooltips, and
|
||||
// panel selection button so both render identical captions, and
|
||||
// usable for construction sites which have no Building yet (REQ-BLD-SITE-CONFIG).
|
||||
std::vector<RecipeSelectionOption> buildRecipeSelectionOptions(
|
||||
BuildingType type, Simulation& sim, const GameConfig& config);
|
||||
|
||||
// Modal dialog showing a grid of option buttons (REQ-UI-SELECT-BUTTON). The
|
||||
// Modal dialog listing the options in one vertical column (REQ-UI-SELECT-OPTIONS). The
|
||||
// game is paused by the caller while it is open. Clicking an option selects it
|
||||
// and closes the dialog; dismissing it (close/Esc) leaves no choice.
|
||||
class RecipeSelectionDialog : public QDialog
|
||||
@@ -44,12 +46,10 @@ class RecipeSelectionDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// 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.
|
||||
// The icon caches draw each option's recipe line (REQ-UI-ITEM-ICON). Not owned.
|
||||
RecipeSelectionDialog(const std::vector<RecipeSelectionOption>& options,
|
||||
const QString& title, ItemIconCache* itemIcons,
|
||||
QWidget* parent = nullptr);
|
||||
BuildingIconCache* buildingIcons, QWidget* parent = nullptr);
|
||||
|
||||
std::optional<std::string> getChosenId() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user