Nothing in the UI confirmed that a user had been added to the ignore
list, so the action felt ambiguous and could be repeated by accident.
Show an information dialog when the server acknowledges the
add-to-ignore command.
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Client] Prevent contacting users on the ignore list (#1249)
The ignore list silences incoming messages, but a user on it was still
reachable: the context menu's chat item stayed enabled, private messages
could be sent, and a chat tab could be opened for an ignored user.
Make ignored users uncontactable: disable the chat item for them, refuse
to deliver messages typed in an open PM tab with one, and refuse to open
a new private chat tab with an ignored user (with a hint on how to undo
the ignore).
* Update cockatrice/src/interface/widgets/tabs/tab_message.cpp
Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>
When a player left, GameScene::removePlayer iterated zoneViews while close()
synchronously removed the current view from that list. A judge with several open
views of the departing player (e.g. library and hand) only had the first one
closed; the remaining views were skipped and left pointing at a player that was
about to be deleted, crashing the client on the next access.
- GameScene::removePlayer: iterate over a copy of zoneViews
- GameScene::toggleZoneView: same fix for the identical iteration bug
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Use the landscape orientation flag to rotate sideways-layout card art
upright before cropping, so planes/sieges show their horizontal art as
the server profile banner card instead of a rotated full card.
- Curve cropCardArt around the card's landscapeOrientation flag with
landscape-specific art margins (mirrors CardInfoPictureWidget)
- Add shared CardArtUtils::rotateSidewaysLayoutArt helper and apply it
to the playmat (game render and settings preview) and card info widget,
replacing three duplicate 90-degree rotation blocks
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Game] Prevent spectator duplication when replaying joined events
The spectator branch of eventJoin emitted spectatorJoined unconditionally
even when the spectator was already present (e.g. replayed during a rewind).
Guard it like the player branch and eventGameStateChanged, and make
PlayerListWidget::addPlayer idempotent as defense in depth.
* In resetChatAndPhase() (the rewound() handler), also clear all spectators from both PlayerManager and PlayerListWidget before the replay rebuilds from event 0. The forward replay then re-adds exactly the spectators whose join events fall within the new time range via eventGameStateChanged/eventJoin.
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Game] Render custom deck zones in the deck view
The in-game deck view now walks custom zones like the standard
boards, so cards filed under a user-created zone show up in their
zone's card pile instead of disappearing from the view.
* [Game] Collect deck-view cards via DeckList::getCardNodes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Client] Show custom zones in the card display widgets
Card group displays and deck zone displays learn to render custom
zones alongside the standard boards.
- Group display widgets treat custom-zone nodes like other group
headers, keeping counts and layout consistent.
- Zone display widgets resolve their title through visibleNameFromName
so custom zones show their user-chosen names localized like the
standard zones.
* [DeckEditor] Apply sort criteria inside custom zones and align display order with the model
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Client] Expose custom zone management in the deck editor
Wires the state layer into every editor surface that shows deck zones.
- Deck dock: context menu on zones gains New/Rename/Delete/Change
board actions, with per-zone submenus for adding cards.
- Card database dock and visual database display gain an add-to-zone
submenu listing custom zones per board plus a create-zone entry.
- All prompt call sites pass validateNewZoneName so duplicates and
reserved names are rejected inline before Ok unlocks.
- Rename reuses the same dialog in name-only mode, keeping one
validation contract for every zone-name entry point.
- Change board marks the current board instead of offering a no-op,
and the state layer refuses moves onto boards holding a same-named
zone from imported decks.
* [DeckEditor] Address custom-zone menu and export review feedback
* [DeckLoader] Keep the sideboard marker and block ordering when exporting nested zones
- saveToStream_DeckZone threads the owning board zone name down to the card
writer, so cards in a custom zone under the sideboard keep their SB:
prefix instead of being re-imported into the maindeck
- nested sub-zones are collected during the loop and written after the
parent zone's own header and cards, so they no longer read as part of the
zone printed before them
* [DeckEditor] Fix move-to-zone menu use-after-free and per-zone enabled state
- resolve the card name/provider/collector number before createNewCustomZone
rebuilds the model tree, then re-find the refreshed index via findCard and
move it (mirrors the decrementCard re-find pattern)
- the enabled test now compares the card's own zone (nearest custom-zone
ancestor, else its board), matching moveCardToZone's lookup, so moving a
card out of a custom zone back to the board root is offered and the card's
own zone is disabled
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [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
* [DeckEditor] Address zone-management review feedback
- Expose DecklistNodeTree::hasZoneName and use it in validateNewZoneName
so the uniqueness scan covers custom zones on every board, not just the
standard ones.
- Hide the board selector in the rename dialog path where it is not used.
- Emit deckHashChanged after refreshDeckHash so the deck hash label stays
current after zone create/rename/move/remove.
* [DeckEditor] Notify card set changes after zone edits and drop the board scan
- modifyTree emits cardNodesChanged alongside deckHashChanged so the
banner-card combo and printing in-deck counts refresh after removing a
zone that still holds cards
- DecklistNodeTree::findCustomZoneByName is public and moveCustomZone uses
it, locating zones under non-standard boards (e.g. tokens) instead of
scanning only main/side/maybeboard
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Models] Mirror custom deck zones in the deck list model
DeckListModel now surfaces the custom zones from the deck tree so
views can render and edit them alongside criteria groups.
The custom-zone bookkeeping that made the model unwieldy is extracted
into DeckListModelCustomZones (deck_list_model_custom_zones.h/.cpp), a
single self-contained unit owning every "what is / where is a custom
zone" decision for the model's shadow tree:
- rebuildTree mirrors each custom zone as a DecklistModelSubZoneNode
under its board zone, cards flat inside (no further grouping).
- The freshly built shadow tree is sorted while the model reset is
still open, so views never observe unsorted intermediate order and
proxies cannot desync.
- Custom zones always sort after criteria groups within a board,
regardless of their names. One shared sortWithCustomZonesLast backs
both the live sortHelper (which remaps persistent indexes from the
movement mapping) and the silent reset-time sortShadowTree.
- addCard inserts flat into a custom zone by name and keeps grouping
by active criteria for board zones. findCardNode resolves cards in
both layouts, legacy top-level zones unchanged.
- New IsCustomZoneRole lets views tell zones apart from groups.
- Empty custom zones survive row removal. Zone rows themselves are
only mutable through the deck tree API.
A new deck_list_model_custom_zones_test suite locks the extracted
shadow-tree logic (type testing, mirroring, name lookup, and the
sort-with-custom-zones-last mapping).
No behavior change.
* [Models] Route group lookups around mirrored custom zones
Group lookups (createNodeIfNeeded, findCardNode) must not resolve a
mirrored custom zone that shares the group name. Introduce
findGroupChild to search only non-custom children, and make addCard
consult the deck tree before falling back to creating a top-level zone
so cards added to an un-mirrored custom zone land inside it.
mirrorCustomZones now flattens cards nested at any depth into the
mirrored zone so no card is left without a model row.
Add model behaviour tests (addCard routing, same-name group/zone
collision, removeRows guard, empty-zone survival, findCard inside a
custom zone) and fix the missing main() in the unit test binaries.
* [Models] Fix addCard routing for card-named zones and nested custom zones
- hasDeckZone no longer matches board cards that merely share the zone
name, which previously caused infinite addCard/rebuildTree recursion
- Adding to a custom zone whose deck side holds nested sub-zones appends
to the deck tree instead of writing past its direct children
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This compares the release dates of sets, which enables users to filter
for sets in a certain range, for example to filter for all commanders
with an old card frame, `t:legendary set<8ED` can be used, which will
only include cards appearing before 8th edition.
This acts as a more powerful superset of the "Filter to X most recent
sets" feature.
Fixes#7238
* [Oracle] Parse sets lazily to slash importer peak memory
- Add a raw JSON scanner that splits the document into per-set byte ranges
without materializing the JSON tree
- Keep only the raw document bytes and parse one set at a time in startImport
- Take readSetsFromByteArray by value so the wizard's buffer is moved, not copied
- Clear the retained raw data in releaseSetData()/clear()
- Cover the scanner and lazy parsing with tests
Took 2 minutes
* [Oracle] Fix nesting-depth cap, tolerate unescaped control chars, lazy-parse review fixes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Oracle] Add RAM usage benchmarks for the oracle importer
- Measure process peak/current RSS via procfs (Linux) or getrusage (macOS)
- Add a synthetic-scale RAM benchmark and an opt-in real AllPrintings
run gated by COCKATRICE_ORACLE_RAM_BENCHMARK=1
- Mirror the wizard's magic-byte handling to decompress .xz/.zip payloads
- Wire optional ZLIB/LibLZMA into the benchmark target and raise its timeout
Took 2 minutes
* [Oracle/Tests] Measure parse against post-fixture baseline; assert release empties sets
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Build] Enable ccache by default when it is installed
ccache is a near free win for both clean and incremental rebuilds and
has no effect on systems where it is not installed (find_program
guards the whole block). Aligns the CMake default with the documented
behavior; users can still arch with -DUSE_CCACHE=OFF.
* [Build] Disable ccache auto-engage on Windows (MSVC)
* [Build] Report ccache skip on Windows explicitly
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Build] Add precompiled headers for Qt-backed executables
Reparsing QtCore/QtGui/QtWidgets/QtNetwork in ~460 client translation
units is the dominant compilation cost. Precompile the two common layers:
- qtcore_pch.h (Qt Core only; safe even for headless Servatrice)
- qtwidgets_pch.h (adds Gui/Widgets/Network; used by Cockatrice and Oracle)
target_precompile_headers() requires CMake 3.16, now the project minimum.
Estimated 30-50% faster client rebuilds.
* [Build] Format qtwidgets precompiled header
clang-format include regrouping and a missing trailing newline.
* [Build] Add PCH-aware ccache sloppiness config; format cmake/pch headers
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Oracle] Add oracle importer tests and fix set parsing details
- Add oracle_importer_test and oracle_importer_benchmark_test targets
- Preserve the first printing's legalities when an existing card is reused
- Concatenate split-card coloridentity and sort/dedupe card colors
- Use a raw string for the Basic Land format regex
- Pre-allocate the card hash and micro-optimize string handling
Took 2 minutes
* [Oracle/Tests] Pin cmc coercion in CI run; scope the reserve pass
The #7214 coercion assertion lived only in oracle_importer_benchmark_test,
which gets no add_test and so never runs under ctest. Add NumericManaValueCoercedToCmc
and LegacyConvertedManaCostCoercedToCmc to oracle_importer_test (a CI-ran
binary): manaValue/convertedManaCost are JSON numbers in AllPrintings, and
QJsonValue::toString() would drop them to an empty cmc without the
#7214 coercion fix.
Wrap the distinct-name reserve pass in a bare block so the ~35k name
QStrings are handed back before the memory-heavy import loop starts.
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Oracle] Replace vendored QtJson with native QJson for set import
- Drop the vendored oracle/src/qt-json/json.{h,cpp} implementation
- Switch SetToDownload and importCardsFromSet from QList<QVariant> to
native QJsonArray/QJsonObject
- Release set JSON data after import in the save sets page
Took 20 minutes
* [Oracle] Restore property coercion and legality merge in native JSON import
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Security] Use a CSPRNG for salts, tokens, and RNG seeding
Password salts and activation tokens were generated with the global SFMT
RNG, which was seeded from a 32-bit timestamp, making registration
salts and activation tokens predictable. The game RNG used the same
timestamp seed across restarts.
Add CryptoUtil backed by OpenSSL RAND_bytes and use it for salt/token
generation and to seed RNG_SFMT with a 64-bit CSPRNG value in both the
client and server. Link libcockatrice_utility against OpenSSL::Crypto.
Took 30 seconds
Took 25 minutes
* Lint.
Took 4 minutes
Took 36 seconds
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
The .proto file appeared twice in the PROTO_FILES list, causing protoc to
process it twice on every build. Keep a single entry.
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Pass -pipe so GCC/Clang transfer intermediate representation between
compiler stages over pipes instead of temporary files, reducing build I/O.
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
3.16 is already required by Qt6 (and enforced at find_package time).
This unlocks native target_precompile_headers(), better AUTOMOC/AUTORCC
handling, and qt6_finalize_project() without a version guard.
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [GameScene] Sever connections properly.
Took 2 minutes
Took 54 minutes
* [GameScene] Sever animated item destroy connections at teardown
Fix crash when a replay's board is closed (GameScene teardown abort).
The old QObject::disconnect(nullptr, nullptr, this, nullptr) is invalid per
Qt docs (the sender must never be nullptr), so it never severed the PMF
destroyed -> GameScene::removeAnimatedItem connections that fire when
QGraphicsScene::~QGraphicsScene -> clear() destroys the remaining items.
Store the QMetaObject::Connection handle for each animated item and
disconnect them all in ~GameScene via the connection-handle overload.
Dedup connections on the connection map rather than animatedItems, since
the animation timer clears animatedItems on completion, which let a
re-registered item (e.g. a life counter flashed repeatedly) accumulate
orphaned duplicate destroyed connections that survived teardown.
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Client] Send game invites from the user context menu via a private message
The user context menu gains an "Invite to Game" submenu listing the
inviteable games in the room (the inviter's own games, honoring the
buddy-only setting). Picking one opens a private message to the target
user with a cockatrice://joingame link naming the game, so the target
gets a clickable invite instead of a raw URL. Multi-game rooms offer a
picker; a single inviteable game sends directly. Sending a message to
an offline user no longer swallows the draft — it reports that the
user is offline and keeps the typed text.
Took 30 seconds
Took 1 minute
* [Client] Open the invite dialog taller by default without enforcing a minimum size
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Move the deck-to-.cod conversion prompt logic (format check, saved
preference handling, overwrite confirmation, dialog) out of
DeckPreviewWidget into dlg_convert_deck_to_cod_format so the deck
editor can reuse it without duplicating it.
Took 4 minutes
Took 4 minutes
Took 1 minute
# Commit time for manual adjustment:
# Took 3 minutes
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* add a limit to the size of deckfiles cockatrice can load
the limit is 99999 or 100k -1 right now, which is kind of the limit of
what looks acceptable in the player
* format
* up limit to 100k because that's what the tests do
* [DeckList] Add custom deck zones to the deck tree
Introduce user-definable zones nested under a board zone (main, side
or maybeboard) so players can organize cards inside a board without
changing board semantics.
- addCustomZone, renameCustomZone, moveCustomZone and removeCustomZone
manage zones. Names are unique across the whole deck and the standard
zone names (main/side/maybeboard/tokens) stay reserved.
- Board zones are created lazily on first use.
- getZoneObjFromName resolves custom names to their nested node so
addCard and XML loading route cards into them. Unknown names keep
creating legacy top-level zones.
- deleteNode keeps empty custom zones alive and only prunes empty
board zones.
- New deck_list_zones test suite locks hash parity with flat decks,
sideboard size accounting, maybeboard exclusion from plain export
and native-format round-trips.
Took 17 minutes
Took 11 minutes
* Extract to function
Took 4 minutes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [VDS] Drive folder and preview widgets from the model (MVC views)
Took 16 minutes
Took 8 minutes
Took 3 minutes
Took 11 minutes
* Rebase whoopsie
Took 4 minutes
* Hide widgets instead of destroying, go back to signals, rename for consistency.
Took 13 minutes
Took 4 seconds
Took 26 minutes
Took 5 seconds
# Commit time for manual adjustment:
# Took 9 minutes
* Make VDS startup smooth: batch deck loads, guard preview resizes
- Move color identity computation into the background load task and apply
finished deck loads in bounded batches per event loop turn, so finishing
hundreds of loads at once cannot stall the UI thread
- Skip redundant resize work in DeckPreviewWidget when the banner width did
not change, and collect the clamped children once instead of searching the
widget tree on every layout pass
Took 19 minutes
# Commit time for manual adjustment:
# Took 3 minutes
* [VDS] Expose filter matches as a proxy role instead of dropping rows
The folder display scanned source-model rows and probed acceptance with
mapFromSource(...).isValid(), reaching into both models for one answer.
The proxy now keeps every row and exposes each row's search/tag/color
filter result through FilterMatchRole. The folder display and the tag
filter read everything off proxy indexes, and hidden previews keep their
sorted position in the flow layout instead of being appended at the end.
Took 11 minutes
* [VDS] Bound pending-load drain by time and make row lookups O(1)
The fixed DECK_LOADS_PER_TURN = 24 cap had no measured basis. It was guessed and existed
because every applied load emitted dataChanged into each DeckPreviewWidget,
whose handler resolved its own row with an O(n) linear scan per widget.
The model now maintains a file path -> row hash kept in sync across scans,
renames and deletions, so rowForFilePath is O(1) and the fan-out cost is
gone at its source. The drain applies finished loads until a small time
budget per event loop turn runs out, so throughput self-tunes instead of
relying on an arbitrary count.
* Actual minimal fix for resize squishing
Took 20 minutes
* Fix color widget sizing
Took 16 minutes
* [BannerWidget] Also set a max height
Took 4 minutes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [Client] Pin user list header length to the viewport width
The header stretch mode kept a resize section property, so after any
column grew past the viewport the list carried an invisible horizontal
pan range that scrolled rows sideways without visual feedback
Drop the leftover property so displayed length always equals viewport
width and horizontal panning is impossible
* Show columns 1 and 2
Took 12 minutes
Took 2 minutes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
* [App] Add onboarding wizard
Took 10 minutes
Took 3 minutes
Took 7 minutes
Took 9 minutes
Took 2 minutes
Took 1 minute
Took 7 minutes
* Adjust CI
Took 14 minutes
Took 56 seconds
Took 2 seconds
Took 3 seconds
* Adjust CI again
Took 14 minutes
Took 2 seconds
* Comments and fixes
Took 9 seconds
Took 1 minute
* Rebase.
Took 5 minutes
Took 50 seconds
Took 15 seconds
* Comments.
Took 7 minutes
* CI lol
Took 3 minutes
* CI again lol
Took 4 minutes
* Drop some settings, add some new ones.
Took 19 minutes
* Resize when expanding section
Took 4 minutes
Took 3 minutes
Took 7 minutes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>