Files
dota_factory/src/ui/SchematicChoiceDialog.h
Malte Langkabel 44ec3c51f1 explain an item wherever the UI names one
Every display naming an item now shows that item's production tooltip, not
only the selection panel's chips: the header block stock, the total cost of
a building multi-selection, the remaining scrap of a debris selection, the
icons of every recipe summary, and a blueprint card's cost.

ItemTooltip moves out of the selection panel and takes an
ItemTooltipContext of its own -- an item is named all over the UI, and the
panel's context carries visuals and a debug flag no tooltip reads. A
recipe line wraps each icon with its amount so the pair can be pointed at
as one statement, and attaches tooltips only where asked: a module button
and the item tooltip itself draw the same line and stay silent.

Hover only wherever the display sits on something the player clicks, whose
click is not free to explain. Note that a recipe line on an option button
can no longer be transparent to the mouse -- Qt never looks inside a
transparent widget for the cursor -- so it relies on press propagation to
keep picking the option.

The header block stock loses world.building_blocks_tooltip, showing what
every other block icon shows instead. The Expand button keeps no tooltip:
its cost is painted into its face with nowhere to hang one, and the button
is due to be removed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
2026-08-18 21:41:34 +02:00

44 lines
1.6 KiB
C++

#pragma once
#include <vector>
#include "ItemTooltipContext.h"
#include "ModalDialog.h"
#include "SchematicChoiceOption.h"
struct RecipesConfig;
// The drop's choice dialog (REQ-DEF-SCHEMATIC-DROP). Unlike every other dialog it cannot
// be dismissed: clicking an option is the only way out, so getChosenIndex() always names
// an option the player picked, and it only ever finishes Accepted. It inherits the base's
// refusal of Q and of a click outside (ModalDialog::isDismissible) and adds the refusal
// of Escape below.
class SchematicChoiceDialog : public ModalDialog
{
Q_OBJECT
public:
// The context's icon caches draw the recipe lines of the "Unlocks recipes" list
// (REQ-DEF-SCHEMATIC-DROP, REQ-UI-ITEM-ICON, REQ-UI-BUILD-ICON), and the rest of it
// lets the items those lines name explain themselves (REQ-UI-ITEM-VALUE-TOOLTIP).
// Nothing in it is owned.
SchematicChoiceDialog(const std::vector<SchematicChoiceOption>& options,
const RecipesConfig& recipes,
const ItemTooltipContext& context,
QWidget* parent = nullptr);
int getChosenIndex() const;
public slots:
// Refuses the dismissal (REQ-DEF-SCHEMATIC-DROP): the drop is a reward the player
// has earned, and leaving without choosing would either forfeit it or award the
// option that happens to be first. Escape funnels through QDialog::reject(), so
// declining it here turns it away without swallowing keys one at a time.
void reject() override;
private:
void onOptionClicked(int index);
int m_chosenIndex;
};