mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-27 08:24:39 -07:00
[Client] Add zone management to the deck state manager
State-layer operations for custom deck zones, plus the shared prompt dialog that later editor menus will call into. - moveCardToZone relocates every copy of a card row into any zone, refusing non-card rows and tokens so miswired selections can never shred a group or turn tokens into deck cards. The current zone is found by walking ancestors, which also handles legacy top-level zones. - createCustomZone, renameCustomZone, moveCustomZone and removeCustomZone wrap the tree API with memento history, model rebuilds and deck hash refreshes via modifyTree. - Same-board zone moves return success without minting a history entry, keeping the undo log honest. - promptForNewZone asks for a name and the parent zone, keeps Ok disabled until the trimmed name passes a caller-supplied validator (shown inline as an error), and reports its own translation context. Took 14 minutes # Commit time for manual adjustment: # Took 6 minutes # Commit time for manual adjustment: # Took 33 seconds
This commit is contained in:
parent
2a6f5a6953
commit
30c0ba2cd6
7 changed files with 544 additions and 0 deletions
|
|
@ -43,6 +43,13 @@ void InnerDecklistNode::setSortMethod(DeckSortMethod method)
|
|||
}
|
||||
}
|
||||
|
||||
const QList<QString> &InnerDecklistNode::boardZoneNames()
|
||||
{
|
||||
static const QList<QString> names = {QString(DECK_ZONE_MAIN), QString(DECK_ZONE_SIDE),
|
||||
QString(DECK_ZONE_MAYBEBOARD)};
|
||||
return names;
|
||||
}
|
||||
|
||||
QString InnerDecklistNode::getVisibleName() const
|
||||
{
|
||||
return visibleNameFromName(name);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "abstract_deck_list_node.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
/** @brief Constant for the "main" deck zone name. */
|
||||
#define DECK_ZONE_MAIN "main"
|
||||
/** @brief Constant for the "sideboard" zone name. */
|
||||
|
|
@ -118,6 +121,13 @@ public:
|
|||
*/
|
||||
static QString visibleNameFromName(const QString &_name);
|
||||
|
||||
/**
|
||||
* @brief The standard board zone names, in display order.
|
||||
*
|
||||
* @return main, side and maybeboard.
|
||||
*/
|
||||
static const QList<QString> &boardZoneNames();
|
||||
|
||||
/**
|
||||
* @brief Get this node’s display-friendly name.
|
||||
* @return Human-readable name (zone/group name).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue