Compare commits

...

261 Commits

Author SHA1 Message Date
Bruno Alexandre Rosa
452bf61ef9 FIX: re-add CMAKE_GENERATOR_PLATFORM: 'x64' (#5954) 2025-05-22 19:01:53 -04:00
RickyRister
50d3dfb98b Load deck from clipboard in Game Lobby (#5950) 2025-05-20 10:36:17 -04:00
RickyRister
d729df5cba Add missing shortcuts for Game Lobby buttons (#5951) 2025-05-19 08:09:03 -04:00
RickyRister
a5638ccc3b Parent the "new sets found" dialog (#5948) 2025-05-18 22:06:32 -04:00
RickyRister
46643065ef Refactor banner card ComboBox (#5947) 2025-05-18 22:06:18 -04:00
RickyRister
b270562a44 Fix wrong Message Dock widget order from #5942 (#5946)
* fix

* refactor
2025-05-18 22:05:27 -04:00
BruebachL
cfbe59868b [VDS] Add prompt before overwriting existing files when converting to .cod (#5926)
* Add prompt before overwriting existing files.

* Lint.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-17 22:25:13 -04:00
tooomm
207211facc CI: Tweak ccache for Linux builds (#5938)
* rework ccache

* use branch name
2025-05-17 22:25:01 -04:00
Bruno Alexandre Rosa
269523a034 ci: use Ninja on Linux and macOS builds (#5939)
* ci: use Ninja on linux and macos

* ci: simplify parallelism
2025-05-17 22:24:14 -04:00
RickyRister
1eee314d17 [VDS] Add ability to search by deck contents (#5943)
* [VDS] Add ability to search by deck contents

* add deck search syntax help

* fix build failure
2025-05-17 22:23:54 -04:00
RickyRister
8cc64bf44e Refactor TabGame: inline some QLayout and QWidget class fields (#5942)
* inline layouts

* inline widgets
2025-05-17 22:23:30 -04:00
RickyRister
5dd027ad63 [VDS] Deselect tag if clicked while already selected (#5944) 2025-05-16 14:39:33 -04:00
RickyRister
d51620640b [VDS] Add setting to show deck filepath in tooltip (#5899)
* [VDS] Show deck filepath in tooltip

* Make tooltip type into a setting

* Fix build failure
2025-05-12 17:39:58 -04:00
BruebachL
17c767fa42 [GDE] Add a group criteria to the deck list model (#5931)
* Add a group criteria to the deck list model and a combo box to the deck dock widget to change it.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-12 17:36:55 -04:00
tooomm
b2749a0c4e Add debug log (#5937) 2025-05-11 17:40:04 -04:00
tooomm
3b0c7a3a30 Re-add vcpkg binary caching (#5933) 2025-05-11 17:39:45 -04:00
tooomm
797681883b CI: Remove Ubuntu 20.04 (EOL May 31st) (#5849)
* ubuntu 20.04 eol

* Update release_template.md

* [skip ci] Delete .ci/Ubuntu20.04 directory
2025-05-11 17:38:13 -04:00
ebbit1q
48b6e1590c increase cache size for ccache on linux ci (#5935) 2025-05-11 11:48:58 +02:00
RickyRister
b423edf2b5 Fix segfault when multiple cards are dragged from view zone (#5934) 2025-05-11 01:44:32 +02:00
BruebachL
9cf979d154 [GDE/VDE] More granular modification signals. (#5927)
* More granular modification signals.

* Bruh.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-08 21:32:00 -04:00
RickyRister
033c8b269d [VDS] Refactor: move quick settings to separate class (#5905) 2025-05-06 23:00:11 -04:00
RickyRister
c4e42b94f9 Refactor CardSizeWidget: don't update setting directly (#5903) 2025-05-06 21:31:01 -04:00
tooomm
5b9cb4fc8d Small changes related to docker image build+upload (#5907)
* ci label

* naming

* downloads

* run

* fix toc
2025-05-06 21:29:09 -04:00
BruebachL
99d9ce10c3 [GDE, VDS & VDE] Tooltips and labels (#5916)
* Add correct inversion for isHidden() on bannerCardLabel.

* Add tooltips to VDS buttons.

* Add tooltip to GDE button.

* Add tooltips to visual deck editor buttons.

* Add tooltips to visual database display buttons.

* Lint.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-06 21:28:50 -04:00
BruebachL
34400c7f60 [VDE] Sample Hand Improvements (#5917)
* Actually call retranslateUi, add spinBox to change sample hand size, add card size slider.

* Lint.

* Fix include.

* Fix include again.

* Fix overloads.

* Update visual_deck_editor_sample_hand_widget.cpp

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Co-authored-by: Zach H <zahalpern+github@gmail.com>
2025-05-06 21:28:03 -04:00
transifex-integration[bot]
05914e38f0 Translate oracle/oracle_en@source.ts in pt_BR (#5918)
100% translated source file: 'oracle/oracle_en@source.ts'
on 'pt_BR'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-05-06 21:26:27 -04:00
BruebachL
bddb54ef4c [VDE] Deck analytics visibility (#5919)
* Add scrollArea, I guess.

* Set mana curve bar color to grey for visibility.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-06 21:24:24 -04:00
BruebachL
46e146b34a [VDS] Allow tags to toggle to a NOT state to hide non-matching decks (#5920)
* Allow excluding tags.

* Lint.

* My linter is broken, don't ask.

* Zzz.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-06 21:23:49 -04:00
BruebachL
f16ba6861b Forward scroll event to scrollable parents if possible in NoScrollFilter. (#5921)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-06 21:22:37 -04:00
BruebachL
fb6af544e2 Set Banner Card again when restoring index on deckList data changes. (#5922)
* Set Banner Card again when restoring index on deckList data changes.

* Lint.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-06 21:20:38 -04:00
Bruno Alexandre Rosa
4c3cfc8c2d fix: fix qt5 builds on macos 15 (#5923)
Although this config is not built on CI, while trying to compile locally, the build failed due to warnings and -Werror.
Some qt functions were actually deprecated (but not removed) before version 6.0.0 and clang (righfully) complains about comparison between different types of enums.
2025-05-06 21:18:59 -04:00
Basile Clement
286a7494d3 client: Support arbitrary game zones (#5877)
* Remove `isView` flag from CardZone

This flag is used for two purposes:

 1. It is used as a check for casting to a zone to a `ZoneViewZone`;

 2. Non-view zones are added to the player's zones on construction

This patch removes the `isView` flag and instead:

 1. We directly cast zones to `ZoneViewZone` using a dynamic (qobject)
    cast and use the result of the cast instead of the `isView` flag to
    detect if we are a view zone or not;

 2. The player records its own zones when they are created, simplifying
    control flow.

* Review

* client: Support arbitrary game zones

Currently, the client ignores cards in unknown zones, as there is an
implicit assumption that the set of zones known by the server and the
client are the same.

This patch makes it so that the client accept "custom zones" from the
server (zones outside the builtin deck, graveyard, exile, sideboard,
table, stack and hand zones) using the information from the
ServerInfo_CardZone. Moving cards from/into these zones happens
through a "View custom zone" action in the Game > Player menu and
properly appears in the chat.

Note that this patch intentionally does not introduce any support for
having the server actually create such zones. Instead, this patch aims
to improve backwards compatibility for when we do get to adding this
capability in the future, by making sure that current clients will be
able to interact with future new zones (even if suboptimally).
2025-05-06 21:18:08 -04:00
RickyRister
a07c1badd8 Add "copy to clipboard" button to Debug Log window (#5913) 2025-05-05 11:45:22 -04:00
RickyRister
29d93fb9c1 Delete CardDragItem when referenced CardItem is destroyed (#5911) 2025-05-05 09:50:34 -04:00
RickyRister
4a54412d47 Pass log messages by const ref (#5914)
* Pass log messages by const ref

* Rename method
2025-05-05 09:46:29 -04:00
RickyRister
bd8306bd33 Strip color escape codes in Debug Log window (#5915) 2025-05-05 09:38:46 -04:00
RickyRister
69107f79e3 Add setting to auto focus search bar when opening card view window (#5906)
* add new setting

* implement thing

* Rename setting

* fix build failure
2025-05-04 20:09:11 -04:00
Bruno Alexandre Rosa
2687a34019 ci: temporarily remove run-vcpkg step (#5902)
There is an issue with run-vcpkg GHA not caching properly. This ends up wasting 20 minutes of redundant vcpkg depency compilation.
See https://github.com/lukka/run-vcpkg/issues/243
2025-05-04 15:02:11 +02:00
BruebachL
9ae6357c34 Properly manage hover-zoom child widget in CardInfoPictureWidget destructor. (#5900)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-03 20:03:53 -04:00
Sebastian Di Luzio
baa7e25e30 feat: build and release docker images using github actions and container registry (#5807)
* feat: build and release docker images using github cicd

* fix: attempt to publish to specific image name

* fix: typo in pipeline step

* typo

* typo

* limit to certain paths for PRs & naming

* ci: configure image title and url

* docker: include only necessary files and directories

this should make caching more powerful

* docker: reorder COPY with best guess of what changes least

* build(docker): remove seemingly unnecessary files

* fix: clean up docker metadata

remove annotations, it seems they're applied from the labels already, add description

* fix(ci): add back docker image annotations

* Update desktop-build.yml

* Update desktop-lint.yml

* Update desktop-build.yml

* Update docker-release.yml

* fix: remove run on master and add affected files to PR trigger

* metadata

* ci: run pipeline on main

this will ensure the container can always build and keep caches ready for release. push should only happen on tag triggers

It also removes some files from the PR trigger that should never break the build, and would just invalidate cache.

* Update docker-release.yml

---------

Co-authored-by: tooomm <tooomm@users.noreply.github.com>
2025-05-02 18:10:09 -04:00
BruebachL
700feb68af Don't require .svg for mana symbols. (#5897)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-05-02 14:34:41 -04:00
RickyRister
57c6f2716f Add setting for which deck editor tab to open deck in (#5895)
* Create new setting

* Update settings dlg

* implement functionality

* Make setting into an enum
2025-05-02 13:00:32 -04:00
Basile Clement
24e27d3c31 fix: Prevent dragged cards getting stuck (#5896)
* fix: Prevent dragged cards getting stuck

Update the position of the card even if it is not above any zone.

* Also update the currentZone
2025-05-02 12:58:21 -04:00
SlightlyCircuitous
77d13090b5 Remove Fedora 40 build and Add Fedora 42 build (#5893)
* Create Fedora 42 Dockerfile

* Delete .ci/Fedora40 directory

* Update Fedora releases

* Update Fedora builds
2025-04-29 22:18:18 -04:00
tooomm
fc40fea97a Fix install Qt step (#5883) 2025-04-28 00:31:00 -04:00
RickyRister
bb8213deb5 Support creating face-down tokens (#5800)
* add new fields to proto

* update token dlg

* send facedown in command

* update server to get it to work

* disable certain edits when face down

* update client event processing

* log face-down token creation

* Don't support colors on face-down tokens

The other client doesn't know about the color, so it causes a desync

* Update wording

Co-authored-by: Basile Clement <Elarnon@users.noreply.github.com>

* Allow annotations on face-down tokens

---------

Co-authored-by: Basile Clement <Elarnon@users.noreply.github.com>
2025-04-28 00:30:23 -04:00
RickyRister
e3465be8c1 Allow cards to transform directly on stack (#5888) 2025-04-28 00:27:22 -04:00
RickyRister
42ce9f4d89 Allow tokens on the stack (#5886) 2025-04-26 19:59:59 -04:00
Basile Clement
1409dcc2e8 Remove isView flag from CardZone (#5728)
* Remove `isView` flag from CardZone

This flag is used for two purposes:

 1. It is used as a check for casting to a zone to a `ZoneViewZone`;

 2. Non-view zones are added to the player's zones on construction

This patch removes the `isView` flag and instead:

 1. We directly cast zones to `ZoneViewZone` using a dynamic (qobject)
    cast and use the result of the cast instead of the `isView` flag to
    detect if we are a view zone or not;

 2. The player records its own zones when they are created, simplifying
    control flow.

* Review
2025-04-26 19:55:54 -04:00
dependabot[bot]
6fd1e9a4c4 Bump serialize-javascript from 6.0.0 to 6.0.2 in /webclient (#5878)
Bumps [serialize-javascript](https://github.com/yahoo/serialize-javascript) from 6.0.0 to 6.0.2.
- [Release notes](https://github.com/yahoo/serialize-javascript/releases)
- [Commits](https://github.com/yahoo/serialize-javascript/compare/v6.0.0...v6.0.2)

---
updated-dependencies:
- dependency-name: serialize-javascript
  dependency-version: 6.0.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-24 22:42:18 -04:00
transifex-integration[bot]
95a86703b3 Updates for project Cockatrice and language it (#5876)
* Translate cockatrice/cockatrice_en@source.ts in it

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'it'.

* Translate cockatrice/cockatrice_en@source.ts in it

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'it'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-04-24 22:39:35 -04:00
RickyRister
bcaa6c6b8a Refactor files in common to new Qt Slot/Signal syntax (#5872) 2025-04-21 16:30:40 -04:00
RickyRister
ffe02e59c7 Refactor: clean up OracleImporter (#5871)
* remove unused dataDir variable

* inline setsMap

* join declaration and assignment

* make the protected methods static

* make getSetPriority static

* inline mainCardTypes list and make the method static

* pass by const ref when able

* rename param to match
2025-04-21 16:29:42 -04:00
RickyRister
f7152befec Refactor: clean up MessageLogWidget (#5870)
* use constants instead of static methods

* make static methods static

* remove unused variables
2025-04-21 16:28:45 -04:00
RickyRister
ca73033aea Refactor files in oracle to new Qt Slot/Signal syntax (#5869)
* Refactor files in oracle to new Qt Slot/Signal syntax

* fix build failure
2025-04-20 23:53:37 -04:00
RickyRister
a1499854f9 Make OracleImporter not extend CardDatabase (#5868)
* Move TOKENS_SETNAME to CardSet

* make OracleImporter no longer extend CardDatabase
2025-04-21 01:48:13 +00:00
BruebachL
873e0d346e Make a setting for filtering to the most recent sets. (#5865)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-20 14:39:20 +00:00
RickyRister
44ac782978 Move card_item and related to src/game/board (#5867)
* move files

* update includes

* update cmake
2025-04-20 14:37:52 +00:00
ebbit1q
6b39f6f6fa fix indenting in test cards.xml (#5866) 2025-04-20 14:36:38 +00:00
BruebachL
dcbb8bab75 [VDD] Defer filter tree assignment (#5864)
* RetranslateUi instead of updating filter mode.

* Defer setting the filter tree on the database display model until AFTER all the filter widgets are initialized.

* Update visual_database_display_set_filter_widget.cpp

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Co-authored-by: Zach H <zahalpern+github@gmail.com>
2025-04-20 04:17:25 +00:00
BruebachL
acd9a163f0 [VDD] Saner and more performant color filtering, allow deleting specific filter from filterTree (#5863)
* Saner and more performant color filtering.

* Update visual_database_display_color_filter_widget.cpp

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Co-authored-by: Zach H <zahalpern+github@gmail.com>
2025-04-20 04:15:28 +00:00
BruebachL
795149e776 Don't force size unnecessarily, correctly parent scrollArea. (#5862)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-20 04:12:46 +00:00
BruebachL
55bff6b52f Make sample hand flow widget a scrollbar one until we figure out why non-scrollbar ones don't resize correctly. (#5861)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-20 04:12:30 +00:00
BruebachL
82be0a8898 Propagate display updates to found widgets. (#5860)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-20 04:12:16 +00:00
BruebachL
f98aad57d3 Add filter connection after toggling buttons and emit on end. (#5858)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-20 04:11:52 +00:00
BruebachL
81a911dc11 Add the option to hide banner card and tags in deck editor. (#5857)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-20 04:11:32 +00:00
RickyRister
39f87a5e78 VDS: Optimize refreshTags in VisualDeckStorageTagFilterWidget (#5856)
* make methods const

* remove redundant calls to gatherAllTags

* make methods private

* use QSet instead of QStringList
2025-04-20 04:10:32 +00:00
BruebachL
aff4ffdf83 [GDE] Disable add tag button until text is entered. (#5855)
* Disable add tag button until text is entered.

* Reduce capture scope.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-20 04:09:25 +00:00
lilyhuang-github
574ea01e08 update handling of keywords: AND, OR, NOT in card search (#5788)
* update hnadling of keywords: AND, OR, NOT in card search

* added and

* update test

* update test

* update OR to not be [oO][rR] and just look for OR

* keyword testing

* adjusted new test

* implement test case for cards with keyword in name

* implement test case to cards with keyword in name

* format

* update test case

* change test cas

* update truth test case

* changed test card search from real cards to fake and added cards

* Update tests/carddatabase/data/cards.xml

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>

* Update tests/carddatabase/filter_string_test.cpp

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>

* Update tests/carddatabase/filter_string_test.cpp

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>

* update formatting

* update cardatabase_test to include +2 cards

* update test case +1 set + 1 type

---------

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>
2025-04-20 04:08:00 +00:00
RickyRister
26dcb015ce Refactor function structs into lambdas (#5675)
* change signature to use lambda

* reuse comparator

* inline structs in forEachCard

* inline structs

* Refactor exportDeckToDecklist

* fix unit test
2025-04-20 04:07:22 +00:00
BruebachL
1d259a86c1 Don't add duplicate CardInfos to set. (#5852)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-18 19:27:50 -04:00
BruebachL
0c02d15e0d Allow empty collectorNumber. (#5853)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-18 19:26:17 -04:00
BruebachL
1e01c684c4 Display cards as set variants if only a single set is selected. (#5854)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-18 19:25:39 -04:00
BruebachL
3b1d6e394d [EDHRec] Display name above card, add bars for inclusion and synergy instead of coloring the whole label, card size slider (#5851)
* Display name above card, add bars for inclusion and synergy instead of coloring the whole label.

* Re-add commander label.

* Add a card size slider.

* Lint.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-18 22:28:44 +00:00
BruebachL
2fe639676b VDS performance fixes (#5848)
* Block updates, don't validate cardInfo and use ItemModel instead of looped addItem.

* Change to QVariant map directly.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-18 22:15:33 +00:00
tooomm
a35707ae18 Overhaul README (#5806)
* Update README.md

* Update README.md
2025-04-18 09:27:32 -04:00
tooomm
b1cf8ff0bb Update issue templates (#5824) 2025-04-18 09:26:23 -04:00
BruebachL
adaa31b34d Only emit cardClicked if it wasn't a right click. (#5838)
* Only emit cardClicked if it wasn't a right click.

* Oh.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-18 03:32:16 +00:00
BruebachL
00095cb71c Delete later where possible. (#5842)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-18 03:32:01 +00:00
BruebachL
8af1f2b6d9 Implement a little "raise on enter" animation for deck preview widgets. (#5844)
* Implement a little "raise on enter" animation for deck preview widgets.

* Why does the linter need to be run twice?

* Fix build.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-18 03:31:47 +00:00
RickyRister
2dc1b875d2 Refactor files in src/dialogs to new Qt Slot/Signal syntax (#5846)
* Refactor to use new signal/slot syntax in src/dialogs

* add todo comment

* fix build failure

* fix build failure
2025-04-18 03:30:26 +00:00
BruebachL
653362567b Refactor Tab EDHRec into folders, add navigation for budget and GC, add card prices (#5845)
* Refactor things into more sensible folders.

* Add navigation widget for budget and game changers.

* Lint.

* Add a card price display widget.

* Qt version check.

* Lint some thangs.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-18 03:28:04 +00:00
BruebachL
ca538399f6 Improved EDHrec tab (#5840) 2025-04-17 10:10:38 -04:00
RickyRister
36f9f65798 Fix intermittent segfault in VDS sort (#5843) 2025-04-17 10:10:08 -04:00
RickyRister
2189fc0a96 Include card_info.h over card_database.h if able (#5841)
* Move a typedef to card_info.h

* Include card_info.h over card_database.h if able
2025-04-17 00:38:57 -04:00
BruebachL
854208ea0a Implement deck analytics widgets. (#5837)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-16 14:23:13 +00:00
BruebachL
67db245aea Add a button to quickly clear all filters, correctly emit signals in filter tree when clearing. (#5835)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-16 12:32:57 +00:00
BruebachL
42c56898d5 Visual Deck Editor Base (#5834)
* Visual Deck Editor.

* Lint.

* Address comments.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-16 12:02:53 +00:00
BruebachL
a55a287a9d Pull the subfilters out. (#5836)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-15 22:16:19 +00:00
RickyRister
b4024ee552 Refactor DeckViewContainer (#5830) 2025-04-15 22:10:24 +00:00
RickyRister
181bef0057 Use the common search syntax window method in visual database display (#5829) 2025-04-15 22:09:36 +00:00
github-actions[bot]
e9d05e6271 Update translation files (#5828)
Co-authored-by: github-actions <github-actions@github.com>
2025-04-15 22:08:52 +00:00
RickyRister
15415afa9a Refactor files in src/server to new Qt Slot/Signal syntax (#5831)
* Refactor files in src/server to new Qt Slot/Signal syntax

* fix deprecation warning
2025-04-15 22:08:02 +00:00
RickyRister
728c87589f Refactor files in src/client/ui to new Qt Slot/Signal syntax (#5832) 2025-04-15 22:06:56 +00:00
RickyRister
686717e544 Refactor files in src/client/tabs to new Qt Slot/Signal syntax (#5833)
* Refactor files in src/client/tabs to new Qt Slot/Signal syntax

* Refactor DeckEditorMenu to use new signal/slot syntax

Add DeckEditorMenu as friend class to AbstractTabDeckEditor since the slots are protected

* fix build failure
2025-04-15 22:05:52 +00:00
BruebachL
c4d0921a15 Visual Database Display Tab. (#5822)
* Visual Database Display Tab.

* Address comments.

* Readd dropped method.

* Update filterTree properly in case the filter is empty after modification.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-15 01:25:49 +00:00
RickyRister
ae90b6c93f Add logging to LocalClient (#5827) 2025-04-15 01:25:17 +00:00
transifex-integration[bot]
ac1ae4fed5 Translate oracle/oracle_en@source.ts in it (#5826)
100% translated source file: 'oracle/oracle_en@source.ts'
on 'it'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-04-14 05:32:55 +00:00
transifex-integration[bot]
a1f2617931 Translate oracle/oracle_en@source.ts in de (#5825)
100% translated source file: 'oracle/oracle_en@source.ts'
on 'de'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-04-13 04:16:33 +02:00
ebbit1q
300a37a199 change settings entry of the cod conversion prompt to a combobox (#5801)
* change settings entry of the cod conversion prompt to a combobox

replace the two checkboxes of which one state is ignored if one is
checked with a three state combobox for better user experience

* Update dlg_settings.cpp

---------

Co-authored-by: Zach H <zahalpern+github@gmail.com>
2025-04-11 23:12:34 -04:00
ebbit1q
351c77182c put multiple printings of the same dual face/split cards in the xml (#5823) 2025-04-11 23:02:48 -04:00
Basile Clement
b214933da9 fix: Disable HTTP compression when downloading pictures (#5793)
This causes Qt to leak file descriptors and causes the "Too many open
file descriptors" error that we sporadically see, see
https://bugreports.qt.io/browse/QTBUG-135641
2025-04-11 23:01:35 -04:00
ebbit1q
9463390e80 fix client crash when server goes down during registration (#5787) 2025-04-11 23:01:14 -04:00
RickyRister
3b758962e4 Add search filter to card view window (#5791)
* refactor out search syntax help window

* add search bar to ZoneViewWidget

* implement filter logic
2025-04-11 23:00:46 -04:00
RickyRister
ad06814ac7 Fix game phases not being translated in game log (#5798) 2025-04-11 22:58:23 -04:00
BruebachL
13d18986b2 Set fixed width instead of maximum width for symbols. (#5821)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-09 22:38:07 -04:00
BruebachL
6171658c0c Add main and sub type as filter options, add helper functions to remove or get specific and all filters. (#5820)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-09 22:37:52 -04:00
BruebachL
9b5f5595b0 Add modelDirty signal, add helper functions to gather all main and sub card types. (#5819)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-09 22:21:02 -04:00
RickyRister
676ea0d5a7 Sort cockatrice sources alphabetically (#5818) 2025-04-09 22:20:55 -04:00
BruebachL
80b6d6a31f Properly calculate a lot of things related to these layouts. (#5817)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-09 12:09:04 -04:00
BruebachL
6661a5d946 Fix some display issues with settings button widget. (#5816)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-09 12:08:59 -04:00
BruebachL
53e9a91dc6 Emit more signals when data is changed and add utility functions to interact with a decklist in the context of cardinfoptrs. (#5815)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-09 12:08:54 -04:00
RickyRister
56bbd8a172 Refactor: move last token info into struct (#5808)
* add override

* refactor token info into struct

* correct default destroy value
2025-04-09 11:26:14 -04:00
BruebachL
0bd53d6dc7 Try to find the card again without providerId when searching fails during swap card. (#5814)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-09 11:19:21 -04:00
BruebachL
61cb3d1d7c Remove unnecessary parent argument from deck_editor_menu (#5813)
* Remove unnecessary parent argument.

* Correctly invoke new instance now.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-09 11:16:56 -04:00
BruebachL
e808d030db Correctly size hint card_info_picture_widget, adjust scaleFactor default and correctly parent hover-to-zoom scaled picture. (#5812)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-09 11:16:34 -04:00
RickyRister
4a68d9d3ea Use QMessageBox::question for force start confirmation (#5811) 2025-04-08 10:24:05 +02:00
BruebachL
730305f4d2 Revert source file globbing (#5799)
* Revert "Add CONFIGURE_DEPENDS to the cmake (#5739)"

This reverts commit 57b9f0e54c.

* Revert "Automatically find all files for cockatrice_SOURCES (#5716)"

This reverts commit 4a0e0ed954.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-04-07 19:32:57 +00:00
RickyRister
d17523ff17 Add confirmation dialog for force start (#5797) 2025-04-06 12:39:08 +02:00
RickyRister
195116d1de Bump to 2.11.0 for beta releases (#5796) 2025-04-06 12:27:11 +02:00
transifex-integration[bot]
92d7828a77 Translate webclient/src/i18n-default.json in it (#5790)
100% translated source file: 'webclient/src/i18n-default.json'
on 'it'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-04-05 13:31:46 +02:00
RickyRister
2a3b9a9a5e Fix QImage::mirrored deprecation warning (#5792) 2025-04-05 12:21:11 +02:00
transifex-integration[bot]
0e7d7ffcb2 Translate oracle/oracle_en@source.ts in it (#5786)
100% translated source file: 'oracle/oracle_en@source.ts'
on 'it'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-04-04 03:40:14 +00:00
RickyRister
b1fca404b7 Bump to 2.10.2 for hotfix release (#5785) 2025-04-03 00:24:11 -04:00
HypersonicWalrus
b6e6328e6a Modified setup_addfirstadmin script to bring it up to date to current cockatrice_users table (#5784)
Co-authored-by: Ben Boelens <bboelens@pop-os.tailc0350.ts.net>
2025-04-03 00:18:31 -04:00
tooomm
ecf0327378 Improve list of release binaries (#5783) 2025-04-03 00:17:44 -04:00
github-actions[bot]
787c551f5f Update translation source strings (#5781)
Co-authored-by: github-actions <github-actions@github.com>
2025-04-03 00:17:25 -04:00
RickyRister
d662152088 Change default log level to info (#5779)
* update qtlogging.ini

* bump some qCDebug to qCInfo and qCWarning
2025-04-03 00:17:10 -04:00
Basile Clement
2fcdb52157 fix: Use isRebalanced to detect Arena cards (#5778)
* fix: Use isRebalanced to detect Arena cards

In #5759 we introduced a setting (off by default) to disable the use of
Arena cards. This was done by checking the `isOnlineOnly` property of
the card, which accidentally also disabled online *printings* of cards
that otherwise exist in paper (e.g. Vintage Masters).

This PR does the same thing but uses the `isRebalanced` property
instead, which is `true` for Arena cards only and should have been used
from the start. This setting does not impact online-only printings such
as Vintage Masters. The settings is still on by default.

* Update setting to mention Alchemy rather than Arena
2025-04-03 00:16:38 -04:00
ZeldaZach
70f2a32fad Bump to 2.11.0 for beta releases 2025-03-27 21:34:03 -04:00
github-actions[bot]
37356317a4 Update translation files (#5775)
Co-authored-by: github-actions <github-actions@github.com>
2025-03-27 21:31:05 -04:00
RickyRister
08f3a56285 Fix crash when right click floating card info window (#5773) 2025-03-27 00:54:34 +00:00
RickyRister
5af71d1c2e Hardcode default log level for FlowWidget/FlowLayout (#5769) 2025-03-26 01:23:23 +00:00
Basile Clement
1ada5ea424 fix: Always prefer local cards if available (#5762)
* Try to better reproduce pre-provider ID behavior

If "override all card art with personal preference" setting is set, look
for custom art for all sets instead of just the most preferred set.

* Warning when using both custom art and the printing selector

* QDirIterator::nextFileInfo is Qt 6.3+

* Translation
2025-03-26 01:23:09 +00:00
transifex-integration[bot]
91ee6097d2 Translate oracle/oracle_en@source.ts in it (#5770)
100% translated source file: 'oracle/oracle_en@source.ts'
on 'it'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-03-24 22:11:47 +00:00
Zach H
a4b0cddcf8 Revert "Disable CardMenu iff no items selected (#5376)" (#5768)
This reverts commit b4036c8671.
2025-03-23 19:04:24 -04:00
RickyRister
9bc6ae1567 Fix delete action in filters not working (#5765)
* Fix delete action in filters not working

* move filterRemove under slots
2025-03-23 12:03:56 -04:00
Basile Clement
c71685b261 Add option to disable card rounding (#5760)
* Add option to disable card rounding

* Effing mocks

* format

* Get rid of cardCornerRadius property
2025-03-22 01:07:52 -04:00
Basile Clement
0ae7d01234 Hide arena only cards (#5759)
* Add settings (default: true) to ignore online-only cards

* Use QAbstractButton::toggled

Also, fix dbconverter build

* Mocks mocks mocks

* Update dlg_manage_sets.cpp

* translations

* Update dlg_manage_sets.cpp

---------

Co-authored-by: Zach H <zahalpern+github@gmail.com>
2025-03-22 01:07:42 -04:00
RickyRister
345606846f Enable shortcuts for the remaining export deck actions (#5761) 2025-03-21 02:49:02 +00:00
RickyRister
9decf78d2d Fix typo in comment about accepted decklist file formats (#5754) 2025-03-21 00:31:38 +00:00
Basile Clement
a6f2e69e1a vds: Allow editing tags more than once (#5752)
`refreshTags` is not connecting the signal to open the dialog to edit
the tags, so tags can only be edited once for a given deck.

Fix by only having the logic for creating the "Edit tags" button once
and call it from `connectDeckList`.
2025-03-21 00:31:25 +00:00
Basile Clement
76fa87c63e Fix StackZone crash when divideCardSpaceInZone overflows (#5751)
The divideCardSpaceInZone function introduced in #4930 is buggy and
sometimes returns an index that is too large for the current zone, which
causes us to call `cards.at(index)` with an `index` that's bigger than
the amount of cards.

This is the bug that #5609 intended to fix but was improperly diagnosed.
Remove part of #5609 as the cases it is guarding against (e.g. null card
pointer) cannot actually happen.
2025-03-21 00:30:46 +00:00
RickyRister
2e01dfd23a Remember past entries in "reveal card until X" window (#5755) 2025-03-21 00:29:59 +00:00
RickyRister
99376e75d6 Support exporting to decklist.xyz website (#5756)
* Support exporting to decklist.xyz

* fix typo
2025-03-21 00:28:15 +00:00
Basile Clement
be28d50997 Revert "Use native hover events (#5722)" (#5757)
This reverts commit e4f40a82a2.

This change had unintended consequences in the hover behavior, reverting
for now.
2025-03-21 00:25:20 +00:00
Basile Clement
d03f5388d4 Update translations (#5758) 2025-03-21 00:23:26 +00:00
Zach H
48123c8822 Revert "Display visual feedback of where cards will go (#5737)" (#5750)
This reverts commit a7641a571f.
2025-03-19 01:53:35 +00:00
RickyRister
0fa744f6ec Consolidate accepted decklist file extensions (#5749)
* Consolidate accepted decklist file extensions

* rename the other const
2025-03-19 01:53:14 +00:00
RickyRister
42301d4f1a Filter out non-deck files when building VDS (#5748) 2025-03-18 22:22:36 +00:00
RickyRister
6c19254abd Fix AttachTo tokens not having card info (#5747) 2025-03-18 22:22:16 +00:00
RickyRister
b5c5d221c4 Remove redundant "show unused color identities" settings (#5745)
* move setting to vds settings menu

* emit signal on change

* rename setting
2025-03-18 22:21:28 +00:00
Basile Clement
c219d8bdbb hotfix: Remove menus when closing game (#5744)
Version of #5740 that doesn't leave freed `QMenu`s lying around.
2025-03-17 22:54:16 -04:00
Basile Clement
4812508afc DeckEditor: Initialize the modified flag (#5743)
C++ does not require compilers to zero-initialize value types, so
depending on the platform (here: Linux), the deck editor starts up with
an uninitialized value in the `modified` flag, which is usually not
zero.
2025-03-17 21:43:14 -04:00
RickyRister
57b9f0e54c Add CONFIGURE_DEPENDS to the cmake (#5739) 2025-03-17 02:43:11 +00:00
RickyRister
0d2061365c Fix edit deck in clipboard clearing values (#5732)
* Fix edit deck in clipboard clearing values

* fix build failures
2025-03-16 23:30:12 +00:00
RickyRister
4d8a124822 Rename save to clipboard actions in DeckPreviewWidget (#5738) 2025-03-16 23:19:57 +00:00
Basile Clement
a7641a571f Display visual feedback of where cards will go (#5737)
This is part of the code from #4974, including an improved drag-and-drop
API and its use to display visual feedback of card destination on the
board.

It does not include the improved logic for pushing cards around as I
still need to figure out edge cases there - the logic for choosing where
cards go is not changed, so some of the artifacts described in #4817
and #4975 (particularly around multi-card) are still present.
2025-03-16 23:19:39 +00:00
BruebachL
bd28e04635 Reintroduce unused color identity opacity (#5733)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-03-16 23:05:38 +00:00
Basile Clement
37382dea44 Close the TabGames when closing the TabSupervisor (#5735)
* Close the `TabGame`s when closing the `TabSupervisor`

This ensures that we go through the same code path (in terms of Qt
events) when closing the whole supervisor as when closing a single tab.
Also, use the `close` event instead of the `hide` event to detect when
we are closing a game.

Fixes #5697

* Compat with old Qt versions

* Old Qt, reloaded

* Review: use hideEvent and call super
2025-03-16 23:05:04 +00:00
Basile Clement
57a8960841 Add declaration for setAttrRecur (#5734) 2025-03-16 23:02:31 +00:00
RickyRister
6b4ae8308a Reduce tag display widget spacing (#5731)
* Reduce tag display widget spacing

* Reduce bottom margin in deck dock
2025-03-16 23:02:06 +00:00
Basile Clement
2739550087 Use enum for ThemeManager brushes (#5730)
* Use enum for ThemeManager brushes

This patch introduces an enum to distinguish the different brushes that
can be set by the theme (hand, stack, etc.) and generic functions taking
the enum rather than having one copy of each function for each brush.

This is preliminary work before merging StackZone and HandZone to
simplify #4974.

* Include <array> header

* Header spacing
2025-03-16 23:01:25 +00:00
Basile Clement
4ada011632 game: Automatic update of arrow position (#5729)
Currently, zones must keep track of which cards they move in order to
manually call `updatePath` on arrows.

This patch sets the `ItemSendsScenePositionChanges` flag on
`ArrowTarget`s to automatically update arrow positions without requiring
zones to keep track of that information.
2025-03-16 22:58:06 +00:00
RickyRister
c99afe7956 Optimize cipt parsing by early returning (#5727) 2025-03-15 21:23:41 +00:00
RickyRister
b58b85dc0f Re-add old names for mana value property to oracle (#5711) 2025-03-15 19:13:13 +00:00
BruebachL
a407c8b956 Reintroduce ability to display unused mana symbol widgets. (#5726)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-03-15 19:11:46 +00:00
Basile Clement
1851f71850 Remove revealedCard flag from CardItem (#5723)
It is no longer used since #5254.
2025-03-15 19:09:14 +00:00
Basile Clement
e4f40a82a2 Use native hover events (#5722)
* Use native hover events

* Update cockatrice/src/game/cards/abstract_card_item.cpp

* Reorder

---------

Co-authored-by: Zach H <zahalpern+github@gmail.com>
2025-03-15 19:07:51 +00:00
Basile Clement
b9900e67a6 nix: Add development utilities to shell.nix (#5725)
- Remove hardening flags to allow debug builds (otherwise GCC complains
   because nix adds the FORTIFY_SOURCE flag, which is not compatible
   with -O0)

 - Allow ninja as build system

 - Add clang-tools dependency for LSP support
2025-03-15 19:03:26 +00:00
RickyRister
7d558edb3e Fix banner and tags not resetting on blank new deck (#5721)
* Fix bannerWidget not resetting when opening new blank deck

* also reset tags
2025-03-15 18:44:51 +00:00
RickyRister
eb4b1c2a07 Fix extra .cod in "save deck as" default name (#5720) 2025-03-15 18:44:03 +00:00
RickyRister
087f88146d Make internal updater failure message more user-friendly (#5718) 2025-03-15 05:19:07 +00:00
RickyRister
3a11ccb854 Update cipt parsing (#5712)
* refactor

* move thing out

* write unit tests

* get thing to work

* optimization?

* fix build failure
2025-03-14 21:44:13 -04:00
tooomm
068465143b Update CONTRIBUTING file (#5701)
* Update CONTRIBUTING.md

* cleanup

* Update CONTRIBUTING.md
2025-03-14 21:43:43 -04:00
tooomm
1f0846297f websocket is our default port/connection (#5679) 2025-03-14 21:43:11 -04:00
RickyRister
4a0e0ed954 Automatically find all files for cockatrice_SOURCES (#5716)
* Use GLOB_RECURSIVE to find all source files

* fix code style

---------

Co-authored-by: Zach H <zahalpern+github@gmail.com>
2025-03-14 21:42:56 -04:00
RickyRister
4b7d1ebb59 Refactor: split card_database into two files (#5715)
* make the duplicate

* restore original

* Refactor: split card_database into two files
2025-03-14 00:02:10 +00:00
RickyRister
ec536126b9 Compute deck hashes lazily (#5707)
* Calculate deck hashes lazily

* rename
2025-03-11 21:43:21 -04:00
Zach H
9b00bdcaea Merge pull request #5710 from lilyhuang-github/i18n
Change prebuild.js to allow i18n-default.json indentation to exist
2025-03-11 21:00:53 -04:00
Lily
da17c68830 Change prebuild.js to allow i18n-default.json indentation to exist 2025-03-11 19:59:20 -04:00
Zach H
badfb483b2 Merge pull request #5703 from RickyRister/5699-fix-printing
Show correct printing for top card of library
2025-03-10 20:45:05 -04:00
Zach H
fafe636b7c Merge pull request #5702 from RickyRister/rename-export-actions
Rename some save to clipboard actions
2025-03-10 20:44:33 -04:00
RickyRister
ef15aa2dcd Show correct printing for top card of library 2025-03-09 05:40:03 -07:00
RickyRister
2d44c9ad2f Rename some save to clipboard actions 2025-03-08 20:02:32 -08:00
RickyRister
0a1d0f650f Enable shortcuts for new save to clipboard actions (#5700)
* Enable shortcuts for new save to clipboard actions

* rename shortcut
2025-03-08 22:41:58 -05:00
RickyRister
2ba7c1ff9a Fix incorrect deck modified state (#5698) 2025-03-08 02:16:59 +00:00
RickyRister
0ecf6298a3 Add actions for shuffle top/bottom X cards (#5695)
* Add actions for shuffle top/bottom X cards

* fix typo

* move shuffle actions into existing menus
2025-03-08 01:48:48 +00:00
RickyRister
1d11bb19b8 Fix view bottom cards using the wrong default (#5696) 2025-03-07 16:17:40 -05:00
RickyRister
ff7f31ca33 add "Set Banner Card" action to VDS right-click menu (#5692) 2025-03-05 21:05:34 -05:00
RickyRister
6bb9ae92bf Update recently opened decks regardless of where the deck is opened from (#5691) 2025-03-05 21:04:53 -05:00
ZeldaZach
5238087ddf Parent bannerCardLabel to avoid popups 2025-03-04 22:45:53 -05:00
RickyRister
08bb18cefe Fix VDS filters not applying after refresh (#5662)
* reapply sort and filters after each reset

* fix unflatten folder still not applying afterwards
2025-03-05 00:57:28 +00:00
RickyRister
ecbdd32a2d Reduce redundant recursion in VDS (#5664)
* remove recursion from flattenFolderStructure

findChildren is already recursive by default

* only trigger the top-level updateVisibility on filter update

Every folder widget was connecting the filter update signals to their updateVisibility, but updateVisibility is already recursive.
That means a bunch of redundant updateVisibility calls happen every time a filter update signal is emitted

* reduce redundant recursion in updateVisibility

findChildren is recursive by default, so only the top-level updateVisibility needs to loop through the found children

* delete now-unused signals
2025-03-05 00:56:31 +00:00
RickyRister
2f415dcc6e Add action to Edit Deck via Clipboard (#5681)
* implement functionality in dlg

* add action to deck editor

* refactor and comments

* is this refactor even a good idea?

* remove the friend class stuff

* reorder

* add option for not annotated
2025-03-05 00:55:05 +00:00
BruebachL
8fc1b22889 Use the new mana symbols. (#5687)
* Use the new mana symbols.

* Fixup some thangs.

* Lint.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-03-05 00:53:42 +00:00
BruebachL
85a50ce9d5 Generic mana symbols. (#5685)
* Generic mana symbols.

* Update black mana symbol skull and symbol color.

* Update white mana symbol contrast.

* Update black mana symbol contrast.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-03-03 13:12:09 -05:00
BruebachL
b706e26a32 Fix image quality when fractional scaling is applied. (#5684)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-03-03 08:40:12 -05:00
BruebachL
15725c67c7 Fix banner widget buddy being uninitialized. (#5686)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-03-03 08:38:27 -05:00
RickyRister
d8da4473e2 add rename and delete actions to VDS right-click menu (#5683) 2025-03-03 08:35:50 -05:00
RickyRister
e1964f21de Fix memory leaks from DeckLoader usage (#5665)
* add comment

* stack allocate DeckLoader for loading tags

* deckModel now takes ownership of DeckLoader

* fix remaining

* add comment
2025-03-02 18:57:30 -05:00
RickyRister
87c5d07807 Switch current tab when opening a single-instance tab (#5651) 2025-03-02 09:30:55 -05:00
lilyhuang-github
3d0f4868df Focus tab for quit game dialog (#5670) 2025-03-02 09:29:17 -05:00
BruebachL
56bd11794e Set modification state correctly. (#5678)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-03-02 09:28:16 -05:00
BruebachL
e541b9d572 Silence picture loader warnings for null pixmaps by introducing checks. (#5677)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-03-02 09:27:52 -05:00
RickyRister
a7e8c1f59b Make BannerWidget's dropdown icon more robust (#5676)
* Make BannerWidget's dropdown icon more robust

* use isHidden

Otherwise, it doesn't work correctly if the BannerWidget is offscreen

* don't show icon if there's no buddy
2025-03-02 09:26:03 -05:00
BruebachL
ec452aabe2 Fallback to regular card name search in case the providerId one fails for the database display widget. (#5673)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-03-01 09:22:00 -05:00
RickyRister
2a9599eed8 refactor saveDeckToClipboard in AbstractTabDeckEditor (#5671)
* refactor saveDeckToClipboard in AbstractTabDeckEditor

* make deckloader functions const

* use const

* move method into DeckLoader
2025-03-01 09:21:31 -05:00
RickyRister
58a2b7ff39 Fix move to top of library shuffling an extra card (#5672)
* Fix move to top of library shuffling an extra card

* Update cockatrice/src/game/player/player.cpp

---------

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2025-03-01 13:32:07 +01:00
RickyRister
448903efe3 Add tip of the day for Expand Card View Window (#5666) 2025-02-28 11:29:09 -05:00
BruebachL
d76e8f9146 Clamp all DeckPreviewWidget children to the card size on resize. (#5669)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-02-28 11:10:40 -05:00
BruebachL
3620664a9f Cache correct providerId cards on deck load (#5668)
* Implement new method for DeckList to return cardlist with providerId, a new carddatabase method to fetch a cardlist with name and providerId and changed PictureLoader to use providerId versions of cards for caching.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-02-28 11:10:06 -05:00
lilyhuang-github
7ff43f15fc Add hint on version downloading (#5663) 2025-02-27 23:34:32 -05:00
lilyhuang-github
e271e6ecf8 Implement advertisement to FAQ page align right (#5657) 2025-02-27 23:34:06 -05:00
BruebachL
93d28717e0 Abstract deck editor (#5646)
* Generify TabDeckEditor.

* Connect dockTopLevelChanged signals.

* Connect eventFilters.

* Remove comments.

* Fix ze build (accidentally deleted a line)

* Fix some pointer chaining.

* Be a lot saner about some signals/slots, as in, individual Deck Editor widgets now internally determine their CardInfo and then simply communicate this to the DeckEditor

* Lint.

* DeckDock can handle its own menu.

* DeckDock can handle its own decrement.

* DeckDock now notifies the deck editor on deck change, instead of individually modifying menu items and modification status.

* Rename.

* Include pixelmap generator for icon.

* Directly use an AbstractTabDeckEditor as parent.

* Move clearing database filter into signal/slot relation.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-02-27 10:57:58 -05:00
RickyRister
6df97a156f Change "include folder name in VDS search" into a setting (#5659)
* add new setting

* implement thing
2025-02-26 12:01:30 -05:00
BruebachL
05d06f9016 Sort Tags in TagFilterWidget (#5660)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-02-26 11:59:59 -05:00
RickyRister
e8574641b0 use new rename icon in replays tab (#5658) 2025-02-26 00:14:27 -05:00
RickyRister
9ac13018c6 include folder name in VDS search when folders are enabled (#5637) 2025-02-25 18:39:34 -05:00
RickyRister
06b25f1cfc add "edit tags" to VDS right-click menu (#5631)
* refactor: move openTagEditDlg up a level

* add edit tags to menu

* set DeleteOnClose attribute on menu

* fix build failure
2025-02-25 18:38:55 -05:00
RickyRister
6f5d369416 Add folder dropdown icons to VDS (#5632)
* add svg

* update pixmap cache

* get icon to work

* hide icon when not clickable

* use consistent naming

* use expandOnly because apparently that leads to higher image quality
2025-02-25 18:36:48 -05:00
RickyRister
4543038fd8 add "open in deck editor" to VDS right-click menu (#5634) 2025-02-25 18:35:56 -05:00
RickyRister
345f8b772c show error message when open deck fails in VDS (#5642) 2025-02-25 18:33:16 -05:00
RickyRister
47311b1dfd Expand/shrink card view window on double click (#5652) 2025-02-25 18:32:45 -05:00
RickyRister
21e22ed5fb Destroy VDS in game lobby once game starts (#5643)
* push back setting change

* rename method and make it public

* destroy vds on game start
2025-02-25 18:31:44 -05:00
RickyRister
0d6497fcdc Fix banner card changing when opening deck in new tab (#5649) 2025-02-25 18:30:53 -05:00
RickyRister
bfaeeb5aea fix transform from non-table zones not moving card (#5648) 2025-02-25 18:30:38 -05:00
RickyRister
b46667f6db Fix memory leak when refreshing VDS (#5647)
* parent deckLoader

* leave comment
2025-02-25 18:30:20 -05:00
RickyRister
49932ee6f8 Fix segfault when oracle reads card without "num" field (#5654) 2025-02-25 18:29:43 -05:00
RickyRister
57e37e8f4d Allow loading local xml file in oracle (#5655) 2025-02-25 18:29:27 -05:00
RickyRister
af68a95964 Add rename action to deck storage tab (#5656)
* add icon

* add rename action
2025-02-25 18:29:07 -05:00
RickyRister
959a268f91 Mark deck as modified when banner card is changed (#5641)
* Mark deck as modified when banner card is changed

* set modified inside setBannerCard
2025-02-22 13:56:48 +00:00
RickyRister
77a3515470 Always download macOS 13 version on intel macs (#5630)
* Always download macOS 13 version for intel macs

* use contains instead of regex
2025-02-18 22:27:17 +00:00
BruebachL
6a008acb2b Enhance card update error description. (#5638)
* Enhance card update error description.

* Enhance card update error description.

* Lint.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-02-18 22:20:06 +00:00
RickyRister
247e1aff83 Also parse "colors" field in xml (#5635) 2025-02-18 20:04:59 +00:00
RickyRister
3df4efebaa Revert file watcher in VDS (#5636) 2025-02-18 20:04:37 +00:00
RickyRister
5c8d1f3cff Make AttachTo tokens work from non-table zones (#5629)
* move card to play before creating attached token

* leave comment

* hardcode createCard target zone to table

To get attached token from graveyard/exile to work
2025-02-16 17:02:45 -05:00
Zach H
01d5e58a5f Change Sorting Order of User List (#5626)
* 1) Online Users > Offline Users
* 2) Admins, judge/vip/donator status ignored
* 3) Moderators, judge/vip/donator status ignored
* 4) Judges
* 5) VIPs
* 6) Donators
* 7) Everyone else
2025-02-16 04:35:28 +00:00
RickyRister
a28300ac42 add "save deck to clipboard" to VDS right click menu (#5625) 2025-02-16 04:18:47 +00:00
RickyRister
0666483756 refactor saveDeckToClipboard in TabDeckEditor (#5623) 2025-02-16 02:43:44 +00:00
RickyRister
abca5514af support right-click menu in VDS (#5622)
* support right-click menu in VDS

* move methods around
2025-02-16 02:43:20 +00:00
RickyRister
2247c66ea6 refactor how double click signal gets passed up in VDS (#5621) 2025-02-15 19:06:11 -05:00
RickyRister
3b638598ad fix load remote deck window being empty (#5613) 2025-02-15 21:05:33 +00:00
RickyRister
63e3e3ceb1 refactor and add missing log categories to ReleaseChannel (#5615)
* adding missing log categories

* refactor version lookup

* refactor OS checking code
2025-02-15 21:05:12 +00:00
BruebachL
23f4c9c4e4 Tags in deck editor (#5608) 2025-02-12 03:18:00 +00:00
Zach H
356b00e8c7 Fix Ricky Crash (#5609) 2025-02-12 01:39:41 +00:00
RickyRister
8916e049bd fix printing selector dropdown not working on mac (#5606) 2025-02-11 04:42:31 +00:00
ZeldaZach
287b4a5597 Bump to 2.10.1 2025-02-10 23:26:35 -05:00
RickyRister
d77ee00e70 Fix crash when VDS show tags is unchecked (#5605)
* Fix crash when VDS show tags is unchecked

* revert the refactor since I don't know if there's a reason they did it that way
2025-02-11 04:24:08 +00:00
ZeldaZach
18ac4c2bd4 Set Release Name: Omenpath 2025-02-10 16:41:18 -05:00
Zach H
2dc614c6b7 Add new Tips of the Day (#5603)
- Thanks WargiCorgi!
2025-02-10 21:22:26 +00:00
BruebachL
7c9bf75393 Overhaul quick settings for VDS and PrintingSelector (#5602)
* Move show folders option next to the search bar.

* Add a new settings button and settings popup, move the folder visibility checkbox there and the ability to hide tags.

* Make popup not close when interacting with child widgets.

* Fix mocks.

* Include cog icon.

* Move PrintingSelector Display options to new quick settings widget.

* Adjust size before first show so as to not overflow.

* Add option to hide card size slider in VDS.

* Qt5 support.

* Fix some warnings by containerizing layouts because addChildLayout is silly.

* Fix an incorrect slot/signal assignment.

* Correct sub-categories for settings to persist them.

* Shuffle some slots and signals around to distinguish between the tag filter and the tags on the deck preview widgets.

* Add a quick setting to draw unused color identities and center them.

* Respect the setting on startup.

* Move card size slider to the quick settings menu.

* Move PrintingSelector card size slider to quick menu, adjust other layout from other options.

* Improve layout, add a gray border.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-02-10 16:50:08 +00:00
transifex-integration[bot]
d1102939a2 Translate cockatrice_en@source.ts in pt_BR (#5601)
100% translated source file: 'cockatrice_en@source.ts'
on 'pt_BR'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-02-09 22:12:38 +00:00
Zach H
cb060f43b5 Prevent server crash if DB is down and game is attempted to be created (#5600) 2025-02-09 22:11:00 +00:00
transifex-integration[bot]
80bd783d54 Updates for project Cockatrice and language de (#5595)
* Translate cockatrice/cockatrice_en@source.ts in de

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

* Translate cockatrice/cockatrice_en@source.ts in de

100% translated source file: 'cockatrice/cockatrice_en@source.ts'
on 'de'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-02-09 19:16:27 +01:00
tooomm
82b147d235 uniform artifact naming (#5592) 2025-02-09 12:40:07 +00:00
Zach H
6944f5f81c Put Logging config on MacOS (#5591) 2025-02-09 12:39:09 +00:00
danbopes
8cbfe85ed4 Fix db reconnecting issues (#5590)
See:

c1b0d50237 (diff-02a32f437187bd4cbfab74877100fee0cfc669dab2c05418681a3557c2cf73f2R109)

We should be checking to see if the query is notActive. In this case, we're literally closing and reopening the connection to the database every time `checkSql()` is called, which is called in numerous places.
2025-02-09 12:12:16 +00:00
Zach H
eb2c71d381 Fix MacOS Finding releases (#5589) 2025-02-09 02:26:04 -05:00
RickyRister
86161185d9 Use local-aware compare in VDS file name sort (#5588) 2025-02-09 04:38:48 +00:00
RickyRister
79bf3adb2a Re-sort decks in VDS after toggling show folders (#5587) 2025-02-09 04:38:22 +00:00
489 changed files with 63183 additions and 42011 deletions

View File

@@ -7,6 +7,7 @@ RUN pacman --sync --refresh --sysupgrade --needed --noconfirm \
git \
gtest \
mariadb-libs \
ninja \
protobuf \
qt6-base \
qt6-imageformats \

View File

@@ -16,6 +16,7 @@ RUN apt-get update && \
libqt5sql5-mysql \
libqt5svg5-dev \
libqt5websockets5-dev \
ninja-build \
protobuf-compiler \
qt5-image-formats-plugins \
qtmultimedia5-dev \

View File

@@ -15,13 +15,14 @@ RUN apt-get update && \
libprotobuf-dev \
libqt6multimedia6 \
libqt6sql6-mysql \
qt6-svg-dev \
qt6-websockets-dev \
ninja-build \
protobuf-compiler \
qt6-image-formats-plugins \
qt6-l10n-tools \
qt6-multimedia-dev \
qt6-svg-dev \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-websockets-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

View File

@@ -6,6 +6,7 @@ RUN dnf install -y \
gcc-c++ \
git \
mariadb-devel \
ninja-build \
protobuf-devel \
qt6-{qttools,qtsvg,qtmultimedia,qtwebsockets}-devel \
qt6-qtimageformats \

View File

@@ -1,4 +1,4 @@
FROM fedora:40
FROM fedora:42
RUN dnf install -y \
ccache \
@@ -6,6 +6,7 @@ RUN dnf install -y \
gcc-c++ \
git \
mariadb-devel \
ninja-build \
protobuf-devel \
qt6-{qttools,qtsvg,qtmultimedia,qtwebsockets}-devel \
qt6-qtimageformats \

View File

@@ -1,26 +0,0 @@
FROM ubuntu:20.04
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
ccache \
clang-format \
cmake \
file \
g++ \
git \
liblzma-dev \
libmariadb-dev-compat \
libprotobuf-dev \
libqt5multimedia5-plugins \
libqt5sql5-mysql \
libqt5svg5-dev \
libqt5websockets5-dev \
protobuf-compiler \
qt5-default \
qt5-image-formats-plugins \
qtmultimedia5-dev \
qttools5-dev \
qttools5-dev-tools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

View File

@@ -17,6 +17,7 @@ RUN apt-get update && \
libqt6sql6-mysql \
libqt6svg6-dev \
libqt6websockets6-dev \
ninja-build \
protobuf-compiler \
qt6-image-formats-plugins \
qt6-l10n-tools \

View File

@@ -15,13 +15,14 @@ RUN apt-get update && \
libprotobuf-dev \
libqt6multimedia6 \
libqt6sql6-mysql \
qt6-svg-dev \
qt6-websockets-dev \
ninja-build \
protobuf-compiler \
qt6-image-formats-plugins \
qt6-l10n-tools \
qt6-multimedia-dev \
qt6-svg-dev \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-websockets-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

View File

@@ -11,9 +11,8 @@
# --debug or --release sets the build type ie CMAKE_BUILD_TYPE
# --ccache [<size>] uses ccache and shows stats, optionally provide size
# --dir <dir> sets the name of the build dir, default is "build"
# --parallel <core count> sets how many cores cmake should build with in parallel
# uses env: BUILDTYPE MAKE_INSTALL MAKE_PACKAGE PACKAGE_TYPE PACKAGE_SUFFIX MAKE_SERVER MAKE_TEST USE_CCACHE CCACHE_SIZE BUILD_DIR PARALLEL_COUNT
# (correspond to args: --debug/--release --install --package <package type> --suffix <suffix> --server --test --ccache <ccache_size> --dir <dir> --parallel <core_count>)
# uses env: BUILDTYPE MAKE_INSTALL MAKE_PACKAGE PACKAGE_TYPE PACKAGE_SUFFIX MAKE_SERVER MAKE_TEST USE_CCACHE CCACHE_SIZE BUILD_DIR CMAKE_GENERATOR
# (correspond to args: --debug/--release --install --package <package type> --suffix <suffix> --server --test --ccache <ccache_size> --dir <dir>)
# exitcode: 1 for failure, 3 for invalid arguments
# Read arguments
@@ -76,15 +75,6 @@ while [[ $# != 0 ]]; do
BUILD_DIR="$1"
shift
;;
'--parallel')
shift
if [[ $# == 0 ]]; then
echo "::error file=$0::--parallel expects an argument"
exit 3
fi
PARALLEL_COUNT="$1"
shift
;;
*)
echo "::error file=$0::unrecognized option: $1"
exit 3
@@ -126,16 +116,6 @@ fi
# Add cmake --build flags
buildflags=(--config "$BUILDTYPE")
if [[ $PARALLEL_COUNT ]]; then
if [[ $(cmake --build /not_a_dir --parallel 2>&1 | head -1) =~ parallel ]]; then
# workaround for bionic having an old cmake
echo "this version of cmake does not support --parallel, using native build tool -j instead"
buildflags+=(-- -j "$PARALLEL_COUNT")
# note, no normal build flags should be added after this
else
buildflags+=(--parallel "$PARALLEL_COUNT")
fi
fi
function ccachestatsverbose() {
# note, verbose only works on newer ccache, discard the error

View File

@@ -147,6 +147,7 @@ function RUN ()
if [[ $CCACHE_DIR ]]; then
args+=(--mount "type=bind,source=$CCACHE_DIR,target=/.ccache")
args+=(--env "CCACHE_DIR=/.ccache")
args+=(--env "CMAKE_GENERATOR="Ninja"")
fi
docker run "${args[@]}" $RUN_ARGS "$IMAGE_NAME" bash "$BUILD_SCRIPT" $RUN_OPTS "$@"
return $?

View File

@@ -4,24 +4,29 @@
git push -d origin --REPLACE-WITH-BETA-LIST--
-->
<!-- This list of binaries should be updated every time the CI is changed to
include different targets -->
<!-- This list of binaries should be updated every time the CI is changed to include all targets -->
<pre>
<b>Pre-compiled binaries we serve:</b>
- <kbd>Windows 10+</kbd>
- <kbd>Windows 7+</kbd>
- <kbd>macOS 14+</kbd> ("Sonoma") / Apple M
- <kbd>macOS 13+</kbd> ("Ventura") / Intel
- <kbd>Ubuntu 24.04 LTS</kbd> ("Noble Numbat")
- <kbd>Ubuntu 22.04 LTS</kbd> ("Jammy Jellyfish")
- <kbd>Ubuntu 20.04 LTS</kbd> ("Focal Fossa")
- <kbd>Debian 12</kbd> ("Bookworm")
- <kbd>Debian 11</kbd> ("Bullseye")
- <kbd>Fedora 41</kbd>
- <kbd>Fedora 40</kbd>
<i>We are also packaged in <kbd>Arch Linux</kbd>'s official "extra" repository, courtesy of @FFY00</i>
<i>General Linux support is available via a <kbd>flatpak</kbd> package (Flathub)</i>
Available pre-compiled binaries for installation:
<b>Windows</b>
<kbd>Windows 10+</kbd>
<kbd>Windows 7+</kbd>
<b>macOS</b>
<kbd>macOS 15+</kbd> <sub><i>Sequoia</i></sub> <sub>Apple M</sub>
<kbd>macOS 14+</kbd> <sub><i>Sonoma</i></sub> <sub>Apple M</sub>
<kbd>macOS 13+</kbd> <sub><i>Ventura</i></sub> <sub>Intel</sub>
<b>Linux</b>
• <kbd>Ubuntu 24.04 LTS</kbd> <sub><i>Noble Numbat</i></sub>
• <kbd>Ubuntu 22.04 LTS</kbd> <sub><i>Jammy Jellyfish</i></sub>
• <kbd>Debian 12</kbd> <sub><i>Bookworm</i></sub>
• <kbd>Debian 11</kbd> <sub><i>Bullseye</i></sub>
• <kbd>Fedora 42</kbd>
• <kbd>Fedora 41</kbd>
<sub>We are also packaged in <kbd>Arch Linux</kbd>'s <a href="https://archlinux.org/packages/extra/x86_64/cockatrice">official extra repository</a>, courtesy of @FFY00.</sub>
<sub>General Linux support is available via a <kbd>flatpak</kbd> package at <a href="https://flathub.org/apps/io.github.Cockatrice.cockatrice">Flathub</a>!</sub>
</pre>
@@ -35,7 +40,7 @@ If you ever encounter a bug, have a suggestion or idea, or feel a need for a dev
For basic information related to the app and getting started, please take a look at our official site: **https://cockatrice.github.io**
If you'd like to help and contribute to Cockatrice in any way, check out our [README](https://github.com/Cockatrice/Cockatrice#get-involved-).
If you'd like to help and contribute to Cockatrice in any way, check out our [README](https://github.com/Cockatrice/Cockatrice#contribute).
We're always available to answer questions you may have on how the program works and how you can provide a meaningful contribution.

View File

@@ -7,32 +7,33 @@
<br>
# Contributing to Cockatrice #
First off, thanks for taking the time to contribute to our project! 🎉 ❤ ️✨
The following is a set of guidelines for contributing to Cockatrice. These are
mostly guidelines, not rules. Use your best judgment, and feel free to propose
changes to this document in a pull request.
First off, thanks for taking the time and considering to lend a helping hand to our project! 🎉 ❤ ️✨
> [!NOTE]
> The following is a set of guidelines for contributing to Cockatrice.
> These are mostly guidelines, not rules. Use your best judgment, and feel free to
> propose changes to this document in a pull request.
>
> [![Discord](
> https://img.shields.io/discord/314987288398659595?label=Discord&logo=discord&logoColor=white)](
> https://discord.gg/3Z9yzmA)
> If you'd like to ask questions, get advice, or just want to say "Hi",
> the Cockatrice Development Team uses [Discord](https://discord.gg/ZASRzKu)
> for communications and you can reach out in the `#dev` channel.
# Recommended Setups #
For those developers who like the Linux or MacOS environment, many of our
For those developers on **Linux** or **macOS** environment, many of our
developers like working with a nifty program called [CLion](
https://www.jetbrains.com/clion/). The program's a great asset and one of the
best tools you'll find on these systems, but you're welcomed to use any IDE
you most enjoy.
https://www.jetbrains.com/clion/). The program is a great asset and one of the
best tools you'll find on these systems.
Developers who like Windows development tend to find [Visual Studio](
Developers on **Windows** systems tend to find [Visual Studio](
https://www.visualstudio.com/) the best tool for the job.
[![Discord](https://img.shields.io/discord/314987288398659595?label=Discord&logo=discord&logoColor=white&color=7289da)](https://discord.gg/ZASRzKu)
[![Gitter Chat](https://img.shields.io/gitter/room/Cockatrice/Cockatrice.svg)](https://gitter.im/Cockatrice/Cockatrice)
If you'd like to ask questions, get advice, or just want to say hi,
the Cockatrice Development Team uses [Discord](https://discord.gg/ZASRzKu)
for communications in the #dev channel. If you're not into Discord, we also
have a [Gitter](https://gitter.im/Cockatrice/Cockatrice) channel available,
albeit slightly less active.
But you're welcomed to use any IDE you enjoy most of course!
# Code Style Guide #
@@ -54,7 +55,7 @@ The message will look like this:
*** Then commit and push those changes to this branch. ***
*** Check our CONTRIBUTING.md file for more details. ***
*** ***
*** Thank you ❤️ ***
*** Thank you ❤️ ***
*** ***
***********************************************************
```
@@ -64,7 +65,7 @@ information on our formatting guidelines.
### Compatibility ###
Cockatrice is currently compiled on all platforms using <kbd>C++11</kbd>.
Cockatrice is currently compiled on all platforms using <kbd>C++20</kbd>.
You'll notice <kbd>C++03</kbd> code throughout the codebase. Please feel free
to help convert it over!
@@ -78,11 +79,12 @@ or other appropriate conversion.
### Formatting ###
The handy tool `clang-format` can format your code for you, it is available for
almost any environment. A special `.clang-format` configuration file is
almost any environment. A special [`.clang-format`](
https://github.com/Cockatrice/Cockatrice/blob/master/.clang-format) configuration file is
included in the project and is used to format your code.
We've also included a bash script, `format.sh`, that will use clang-format to
format all files in your pr in one go. Use `./format.sh --help` to show a full
format all files in your PR in one go. Use `./format.sh --help` to show a full
help page.
To run clang-format on a single source file simply use the command
@@ -90,10 +92,10 @@ To run clang-format on a single source file simply use the command
clang-format with a specific version number appended,
`find /usr/bin -name clang-format*` should find it for you)
See [the clang-format documentation](
See the [clang-format documentation](
https://clang.llvm.org/docs/ClangFormat.html) for more information about the tool.
#### Header files ####
#### Header Files ####
Use header files with the extension `.h` and source files with the extension
`.cpp`.
@@ -168,10 +170,10 @@ braces around single line statements is preferred.
See the following example:
```c++
int main()
{ // function or class: own line
if (someCondition) { // control statement: same line
doSomething(); // single line statement, braces preferred
} else if (someOtherCondition1) { // else goes on the same line as a closing brace
{ // function or class: own line
if (someCondition) { // control statement: same line
doSomething(); // single line statement, braces preferred
} else if (someOtherCondition1) { // else goes on the same line as a closing brace
for (int i = 0; i < 100; i++) {
doSomethingElse();
}
@@ -234,7 +236,7 @@ mutating objects.)
When pointers can't be avoided, try to use a smart pointer of some sort, such
as `QScopedPointer`, or, less preferably, `QSharedPointer`.
### Database migrations ###
### Database Migrations ###
The servatrice database's schema can be found at `servatrice/servatrice.sql`.
Everytime the schema gets modified, some other steps are due:
@@ -255,7 +257,7 @@ Ensure that the migration produces the expected effects; e.g. if you add a
new column, make sure the migration places it in the same order as
servatrice.sql.
### Protocol buffer ###
### Protocol Buffer ###
Cockatrice and Servatrice exchange data using binary messages. The syntax of
these messages is defined in the `proto` files in the `common/pb` folder. These
@@ -268,6 +270,7 @@ new clients incompatible to the old server and vice versa.
You can find more information on how we use Protobuf on [our wiki!](
https://github.com/Cockatrice/Cockatrice/wiki/Client-server-protocol)
# Reviewing Pull Requests #
After you have finished your changes to the project you should put them on a
@@ -286,6 +289,7 @@ all changes have been approved your pull request will be squashed into a single
commit and merged into the master branch by a team member. Your change will then
be included in the next release 👍
# Translations #
Basic workflow for translations:
@@ -294,16 +298,16 @@ Basic workflow for translations:
3. Maintainer verifies and merges the change;
4. Transifex picks up the new files from GitHub automatically;
5. Translators translate the new untranslated strings on Transifex;
6. Before a release, a maintainer fetches the updated translations from Transifex.
6. Before a release, a maintainer fetches the newest translations from Transifex.
### Using Translations (for developers) ###
All user interface strings inside Cockatrice's source code must be written
in English (US).
Translations to other languages are managed using [Transifex](
https://www.transifex.com/projects/p/cockatrice/).
https://transifex.com/cockatrice/cockatrice/).
Adding a new string to translate is as easy as adding the string in the
Adding a new string for translation is as easy as adding the string in the
`tr("")` function, the string will be picked up as translatable automatically
and translated as needed.
For example, setting the text of a label in the way that the string
@@ -315,9 +319,9 @@ nameLabel.setText(tr("My name is:"));
To translate a string that would have plural forms you can add the amount to
the tr() call, also you can add an extra string as a hint for translators:
```c++
QString message = tr("Everyone draws %n cards", "pop up message", amount);
QString message = tr("Everyone draws %n cards", "english hint for translators", amount);
```
See [QT's wiki on translations](
See [Qt's wiki on translations](
https://doc.qt.io/qt-5/i18n-source-translation.html#handling-plurals)
If you're about to propose a change that adds or modifies any translatable
@@ -325,7 +329,7 @@ string in the code, you don't need to take care of adding the new strings to
the translation files.<br>
We have an automated process to update our language source files on a schedule
and provide the translators on Transifex with the new contents.<br>
Maintainers can also manually trigger this on demand.
Maintainers can also manually trigger this workflow on demand via GitHub Actions.
### Maintaining Translations (for maintainers) ###
@@ -389,27 +393,27 @@ Now you are ready to commit your changes and open a PR.
</details>
Once the changes get merged, Transifex will pick up the modified files
automatically (checked every few hours) and update their online editor where
automatically (checked every few hours) and update the web editor where
translators will be able to translate the new strings right in the browser.
### Releasing Translations (for maintainers) ###
Before rushing out a new release, a maintainer should fetch the most up to date
Before publishing a new release, a maintainer should fetch the most up to date
translations from Transifex and commit them into the Cockatrice source code.
This can be done manually from the Transifex web interface, but it's quite time
consuming.
As an alternative, you can install the Transifex CLI:
http://docs.transifex.com/developer/client/
We utilize the official GitHub integration to push all languages that are 100%
translated from Transifex to our GitHub repo automatically.
On top, it runs on a quarterly schedule to update changes for incomplete languages.
A synchronisation/update can also be triggered manually from the Transifex web interface
and a translation treshold can be set.
As an alternative, you can install the [Transifex CLI](https://developers.transifex.com/docs/cli).
You'll then be able to use a git-like cli command to push and pull translations
from Transifex to the source code and vice versa.
### Adding Translations (for translators) ###
As a translator you can help translate the new strings on [Transifex](
https://www.transifex.com/projects/p/cockatrice/).
As a translator, you can help to translate new strings on [Transifex](
https://www.transifex.com/projects/p/cockatrice/) to your native language.
Please have a look at the specific [FAQ for translators](
https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ).
@@ -419,9 +423,9 @@ https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ).
### Publishing A New Release ###
We use [GitHub Releases](https://github.com/Cockatrice/Cockatrice/releases) to
publish new stable versions and betas.
Whenever a git tag is pushed to the repository github will create a draft
release and upload binaries automatically.
publish new stable versions and beta releases.
Whenever a git tag is pushed to the repository, GitHub will create a draft
release and upload binaries from our CI automatically.
To create a tag, simply do the following:
```bash
@@ -433,18 +437,16 @@ git push $UPSTREAM $TAG_NAME
```
You should define the variables as such:
```
`$UPSTREAM` - the remote for git@github.com:Cockatrice/Cockatrice.git
`$TAG_NAME` should be formatted as:
- `YYYY-MM-DD-Release-MAJ.MIN.PATCH` for **stable releases**
- `YYYY-MM-DD-Development-MAJ.MIN.PATCH-beta.X` for **beta releases**<br>
With *MAJ.MIN.PATCH* being the NEXT release version!
```
- `$UPSTREAM`: the remote for `git@github.com:Cockatrice/Cockatrice.git`
- `$TAG_NAME` should be formatted as:
- `YYYY-MM-DD-Release-MAJ.MIN.PATCH` for **stable releases**
- `YYYY-MM-DD-Development-MAJ.MIN.PATCH-beta.X` for **beta releases**<br>
With <kbd>MAJ</kbd>.<kbd>MIN</kbd>.<kbd>PATCH</kbd> being the NEXT release version!
This will cause a tagged release to be established on the GitHub repository,
with the binaries being added to the release whenever they are ready.
The release is initially a draft, where the path notes can be edited and after
all is good and ready it can be published on GitHub.
with the binaries being added to the release whenever they are done building in CI.
The release is initially a draft, where the release notes can be edited and after
all is checked and ready, it can be published as GitHub release.
If you use a SemVer tag including "beta", the release that will be created at
GitHub will be marked as a "Pre-release" automatically.
The target of the `.../latest` URL will not be changed in that case, it always
@@ -457,7 +459,7 @@ revoke the tag by doing the following:
git push --delete upstream $TAG_NAME
git tag -d $TAG_NAME
```
You can also do this on GitHub, you'll also want to delete the new release.
You can also do this on GitHub, you'll also want to delete the false release.
In the first lines of [CMakeLists.txt](
https://github.com/Cockatrice/Cockatrice/blob/master/CMakeLists.txt)
@@ -468,25 +470,24 @@ coming from the tag title, it's good practice to increment the ones at CMake
after every full release to stress that master is ahead of the last stable
release.
The preferred flow of operation is:
* Just before a release, make sure the version number in CMakeLists.txt is set
to the same release version you are about to tag.
* This is also the time to change the pretty name in CMakeLists.txt called
GIT_TAG_RELEASENAME and commit and push these changes.
* Tag the release following the previously described syntax in order to get it
correctly built and deployed by CI.
* Wait for the configure step to create the release and update the patch
notes.
* Check on the github actions page for build progress which should be the top
listed [here](
- Just before a release, make sure the version number in CMakeLists.txt is set
to the same release version you are about to tag.
- This is also the time to change the pretty name in CMakeLists.txt called
`GIT_TAG_RELEASENAME` and commit and push these changes.
- Tag the release following the previously described syntax in order to get it
correctly built and deployed by CI.
- Wait for the configuration step to create the release and update the patch
notes.
- Check on the GitHub Actions page for build progress which should be the top
listed [here](
https://github.com/Cockatrice/Cockatrice/actions?query=event%3Apush+-branch%3Amaster
).
* When the build has been completed you can verify all uploaded files on the
release are in order and hit the publish button.
* After the release is complete, update the CMake version number again to the
next targeted beta version, typically increasing `PROJECT_VERSION_PATCH` by
one.
- When the build has been completed, you can verify if all uploaded files on the
draft release are included and hit the publish button.
- After the release is complete, update the CMake version number again to the
next targeted beta version, typically increasing `PROJECT_VERSION_PATCH` by
one.
When releasing a new stable version, all previous beta releases (and tags)
should be deleted. This is needed for Cockatrice to update users of the "Beta"
release channel correctly to the latest stable version as well.
should be deleted as well.
This can be done the same way as revoking tags, mentioned above.

View File

@@ -2,20 +2,31 @@
name: "🐛 Bug Report"
about: Report an issue encountered while using Cockatrice
title: ''
labels: 'Bug'
type: 'Bug'
labels: ''
assignees: ''
---
<!-- READ THIS BEFORE POSTING
Go to "Help → View Debug Log" in Cockatrice and copy all information at the
top (above the separation line) below "System Information" in this ticket!
In Cockatrice, go to "Help""View Debug Log" and copy all information displayed at the
top (above the separation line "----"), to below "System Information" section in this ticket!
If you can't start Cockatrice to access these details, make
sure to post your OS and the file name of the setup binary instead. -->
sure to post your OS and the file name of the setup binary instead.
-->
**System Information:**
<!-- Read the hint above on where to find the important information to provide here! -->
<details><summary>Debug Log:</summary>
<!--
In Cockatrice, go to "Help" → "View Debug Log", click the "Copy to clickboard" button and paste the output here.
-->
</details>
_______________________________________________________________________________________
<!-- Explain your issue in detail here! Please attach screenshots if possible. -->
@@ -25,7 +36,7 @@ ________________________________________________________________________________
_______________________________________________________________________________________
<!-- Describe the sequence of actions needed to experience the bug -->
<!-- Describe the sequence of actions needed to experience the bug. -->
**Steps to reproduce:**
- Do A

View File

@@ -1,8 +1,9 @@
---
name: "💡 Feature Request"
about: Request a new feature
about: Request a new feature for Cockatrice
title: ''
labels: 'Feature Request'
type: 'Feature'
labels: ''
assignees: ''
---

View File

@@ -9,6 +9,7 @@ on:
- 'webclient/**'
- '.github/workflows/web-*.yml'
- '.github/workflows/translations-*.yml'
- '.github/workflows/docker-release.yml'
tags:
- '*'
pull_request:
@@ -101,19 +102,14 @@ jobs:
package: DEB
- distro: Fedora
version: 40
version: 41
package: RPM
test: skip # Running tests on all distros is superfluous
- distro: Fedora
version: 41
version: 42
package: RPM
- distro: Ubuntu
version: 20.04
package: DEB
test: skip # Ubuntu 20.04 has a broken Qt for debug builds
- distro: Ubuntu
version: 22.04
package: DEB
@@ -132,37 +128,35 @@ jobs:
CACHE: /tmp/${{matrix.distro}}${{matrix.version}}-cache # ${{runner.temp}} does not work?
# Cache size over the entire repo is 10Gi:
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
CCACHE_SIZE: 200M
CCACHE_SIZE: 500M
CMAKE_GENERATOR: 'Ninja'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate cache timestamp
id: cache_timestamp
shell: bash
run: echo "timestamp=$(date -u '+%Y%m%d%H%M%S')" >>"$GITHUB_OUTPUT"
- name: Restore cache
uses: actions/cache@v4
env:
timestamp: ${{steps.cache_timestamp.outputs.timestamp}}
with:
path: ${{env.CACHE}}
key: docker-${{matrix.distro}}${{matrix.version}}-cache-${{env.timestamp}}
restore-keys: |
docker-${{matrix.distro}}${{matrix.version}}-cache-
- name: Build ${{matrix.distro}} ${{matrix.version}} Docker image
shell: bash
run: source .ci/docker.sh --build
- name: Restore compiler cache (ccache)
id: ccache_restore
uses: actions/cache/restore@v4
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
with:
path: ${{env.CACHE}}
key: ccache-${{matrix.distro}}${{matrix.version}}-${{env.BRANCH_NAME}}
restore-keys: ccache-${{matrix.distro}}${{matrix.version}}-
- name: Build debug and test
if: matrix.test != 'skip'
shell: bash
env:
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
run: |
source .ci/docker.sh
RUN --server --debug --test --ccache "$CCACHE_SIZE" --parallel 4
RUN --server --debug --test --ccache "$CCACHE_SIZE"
- name: Build release package
id: build
@@ -172,12 +166,20 @@ jobs:
BUILD_DIR: build
SUFFIX: '-${{matrix.distro}}${{matrix.version}}'
type: '${{matrix.package}}'
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
run: |
source .ci/docker.sh
RUN --server --release --package "$type" --dir "$BUILD_DIR" \
--ccache "$CCACHE_SIZE" --parallel 4
--ccache "$CCACHE_SIZE"
.ci/name_build.sh
- name: Save compiler cache (ccache)
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@v4
with:
path: ${{env.CACHE}}
key: ${{ steps.ccache_restore.outputs.cache-primary-key }}
- name: Upload artifact
if: matrix.package != 'skip'
uses: actions/upload-artifact@v4
@@ -206,7 +208,6 @@ jobs:
os: macos-13
xcode: "14.3.1"
type: Release
core_count: 4
make_package: 1
- target: 14
@@ -214,7 +215,6 @@ jobs:
os: macos-14
xcode: "15.4"
type: Release
core_count: 3
make_package: 1
- target: 15
@@ -222,7 +222,6 @@ jobs:
os: macos-15
xcode: "16.2"
type: Release
core_count: 3
make_package: 1
- target: 15
@@ -230,7 +229,6 @@ jobs:
os: macos-15
xcode: "16.2"
type: Debug
core_count: 3
name: macOS ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }}
needs: configure
@@ -239,6 +237,7 @@ jobs:
env:
DEVELOPER_DIR:
/Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer
CMAKE_GENERATOR: 'Ninja'
steps:
- name: Checkout
@@ -266,9 +265,7 @@ jobs:
MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
# macOS runner have 3 cores usually - only the macos-13 image has 4:
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
run: |
if [[ -n "$MACOS_CERTIFICATE_NAME" ]]
then
@@ -280,7 +277,7 @@ jobs:
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
fi
.ci/compile.sh --server --parallel ${{matrix.core_count}}
.ci/compile.sh --server
- name: Sign app bundle
if: matrix.make_package
@@ -330,7 +327,7 @@ jobs:
if: matrix.make_package
uses: actions/upload-artifact@v4
with:
name: macOS${{matrix.target}}${{ matrix.soc == 'Intel' && '_Intel' || '' }}${{ matrix.type == 'Debug' && '_Debug' || '' }}-dmg
name: macOS${{matrix.target}}${{ matrix.soc == 'Intel' && '_Intel' || '' }}${{ matrix.type == 'Debug' && '_Debug' || '' }}-package
path: ${{steps.build.outputs.path}}
if-no-files-found: error
@@ -380,20 +377,17 @@ jobs:
uses: jurplel/install-qt-action@v4
with:
cache: true
setup-python: false
setup-python: true
version: ${{matrix.qt_version}}
arch: win64_${{matrix.qt_arch}}
tools: ${{matrix.qt_tools}}
modules: ${{matrix.qt_modules}}
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
- name: Setup vcpkg cache
id: vcpkg-cache
uses: TAServers/vcpkg-cache@v3
with:
runVcpkgInstall: true
doNotCache: false
env:
VCPKG_DEFAULT_TRIPLET: 'x64-windows'
VCPKG_DISABLE_METRICS: 1
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Cockatrice
id: build
@@ -403,6 +397,8 @@ jobs:
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
CMAKE_GENERATOR_PLATFORM: 'x64'
QTDIR: '${{github.workspace}}\Qt\${{matrix.qt_version}}\win64_${{matrix.qt_arch}}'
VCPKG_DISABLE_METRICS: 1
VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite'
# No need for --parallel flag, MTT is added in the compile script to let cmake/msbuild manage core count,
# project and process parallelism: https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/
run: .ci/compile.sh --server --release --test --package

View File

@@ -7,6 +7,7 @@ on:
- 'webclient/**'
- '.github/workflows/web-*.yml'
- '.github/workflows/translations-*.yml'
- '.github/workflows/docker-release.yml'
jobs:
format:

71
.github/workflows/docker-release.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: Build Docker Image
on:
push:
tags:
- '*Release*'
branches:
- master
pull_request:
branches:
- master
paths:
- '.github/workflows/docker-release.yml'
- 'CMakeLists.txt'
- 'Dockerfile'
- 'servatrice/**'
- 'common/**'
- 'cmake/**'
- '!**.md'
jobs:
docker:
name: amd64 & arm64
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/cockatrice/servatrice
labels: |
org.opencontainers.image.title=Servatrice
org.opencontainers.image.url=https://cockatrice.github.io/
org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games
annotations: |
org.opencontainers.image.title=Servatrice
org.opencontainers.image.url=https://cockatrice.github.io/
org.opencontainers.image.description=Server for Cockatrice, a cross-platform virtual tabletop for multiplayer card games
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.ref_type == 'tag'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.ref_type == 'tag' }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@@ -74,11 +74,11 @@ endif()
# A project name is needed for CPack
# Version can be overriden by git tags, see cmake/getversion.cmake
project("Cockatrice" VERSION 2.10.0)
project("Cockatrice" VERSION 2.11.0)
# Set release name if not provided via env/cmake var
if(NOT DEFINED GIT_TAG_RELEASENAME)
set(GIT_TAG_RELEASENAME "Rings of the Wild")
set(GIT_TAG_RELEASENAME "Omenpath")
endif()
# Use c++20 for all targets

View File

@@ -16,7 +16,11 @@ RUN apt-get update && apt-get install -y\
qt6-tools-dev \
qt6-tools-dev-tools
COPY . /home/servatrice/code/
COPY ./CMakeLists.txt ./LICENSE ./README.md /home/servatrice/code/
COPY ./cmake /home/servatrice/code/cmake
COPY ./common /home/servatrice/code/common
COPY ./servatrice /home/servatrice/code/servatrice
WORKDIR /home/servatrice/code
WORKDIR build
@@ -26,6 +30,6 @@ RUN cmake .. -DWITH_SERVER=1 -DWITH_CLIENT=0 -DWITH_ORACLE=0 -DWITH_DBCONVERTER=
WORKDIR /home/servatrice
EXPOSE 4747 4748
EXPOSE 4748
ENTRYPOINT [ "servatrice", "--log-to-console" ]

211
README.md
View File

@@ -5,154 +5,155 @@
<p align='center'>
<a href="#cockatrice"><b>Cockatrice</b></a> <b>|</b>
<a href="#download-">Download</a> <b>|</b>
<a href="#get-involved-">Get Involved</a> <b>|</b>
<a href="#community-resources">Community</a> <b>|</b>
<a href="#translations-">Translations</a> <b>|</b>
<a href="#build--">Build</a> <b>|</b>
<a href="#run">Run</a> <b>|</b>
<a href="#license-">License</a>
<a href="#related-repositories">Related</a> <b>|</b>
<a href="#community-resources-">Community</a> <b>|</b>
<a href="#contribute">Contribute</a> <b>|</b>
<a href="#build---">Build</a> <b>|</b>
<a href="#run">Run</a>
</p>
---
<br><pre>
<b>To get started, &#8674; [view our webpage](https://cockatrice.github.io/)</b><br>
<b>To get support or suggest changes &#8674; [file an issue](https://github.com/Cockatrice/Cockatrice/issues) ([How?](https://github.com/Cockatrice/Cockatrice/wiki/How-to-Create-a-GitHub-Ticket-Regarding-Cockatrice))</b>
<b>To help with development, see how to [get involved](#get-involved-)</b>
</pre><br>
<br><pre><p align='center'>
<b>To get started with Cockatrice &#8674; [view our webpage](https://cockatrice.github.io/)</b><br>
<b>To get support, or suggest changes to the app &#8674; [file an issue](https://github.com/Cockatrice/Cockatrice/issues) ([How?](https://github.com/Cockatrice/Cockatrice/wiki/How-to-Create-a-GitHub-Ticket-Regarding-Cockatrice))</b>
<b>To help with development &#8674; learn [how to contribute](#contribute-)</b>
</pre><p><br>
# Cockatrice
Cockatrice is an open-source, multiplatform program for playing tabletop card games over a network. The program's server design prevents users from manipulating the game for unfair advantage. The client also provides a single-player mode, which allows users to brew while offline. This project uses C++ and the Qt5 libraries.<br>
Cockatrice is an open-source, multiplatform application for playing tabletop card games over a network. The program's server design prevents users from manipulating the game for unfair advantage. The client also provides a single-player mode, which allows users to brew while offline.<br><br>
This project uses <kbd>C++</kbd> and the <kbd>Qt</kbd> libraries.<br>
First work on a webclient with <kbd>Typescript</kbd> was started as well.<br>
# Download [![Cockatrice Eternal Download Count](https://img.shields.io/github/downloads/cockatrice/cockatrice/total.svg)](https://tooomm.github.io/github-release-stats/?username=Cockatrice&repository=Cockatrice)
# Download [![Cockatrice Eternal Download Count](https://img.shields.io/github/downloads/cockatrice/cockatrice/total.svg)](https://tooomm.github.io/github-release-stats/?username=Cockatrice&repository=Cockatrice&search=0)
Downloads are available for full releases and the current beta version in development. There is no strict release schedule for either of them.
Downloads are available for **stable releases** and the current **beta version** in development.
There is no strict release schedule for either of them.
<br><pre>
Latest <kbd>stable</kbd> release:
[![Download Stable Release](https://img.shields.io/github/release/cockatrice/cockatrice.svg?label=version&colorB=0d7ebf "Download Latest Stable Release")](https://github.com/cockatrice/cockatrice/releases/latest) ![](https://img.shields.io/github/release-date/Cockatrice/Cockatrice.svg?label=released&colorB=0d7ebf "Release Date") [![](https://img.shields.io/github/downloads/cockatrice/cockatrice/latest/total.svg?label=downloads&colorB=0d7ebf "Number of Downloads")](https://tooomm.github.io/github-release-stats/?username=Cockatrice&repository=Cockatrice&search=0)
</pre><pre>
Latest <kbd>beta</kbd> version:
[![Download Beta Release](https://img.shields.io/github/release/cockatrice/cockatrice/all.svg?label=version&colorB=f37f40 "Download Latest Beta Release")](https://github.com/cockatrice/cockatrice/releases) ![](https://img.shields.io/github/release-date-pre/Cockatrice/Cockatrice.svg?label=released&colorB=f37f40 "Release Date") [![](https://img.shields.io/github/downloads-pre/cockatrice/cockatrice/latest/total.svg?label=downloads&colorB=f37f40 "Number of Downloads")](https://tooomm.github.io/github-release-stats/?username=Cockatrice&repository=Cockatrice&search=0) [![](https://img.shields.io/github/commits-since/Cockatrice/Cockatrice/latest.svg?label=changes&colorB=f37f40 "Changes over Stable Release")](https://github.com/Cockatrice/Cockatrice/pulls?q=is%3Apr+is%3Aclosed)
<sub><i>While incorporating the latest fixes and features, beta builds may not be stable or contain new bugs!</i></sub>
<sub><b><i>Please report any findings and open new issues when testing them!</i></b></sub>
</pre>
- Latest `stable` release: [![Download from GitHub Releases](https://img.shields.io/github/release/cockatrice/cockatrice.svg)](https://github.com/cockatrice/cockatrice/releases/latest) [![DL Count on Latest Release](https://img.shields.io/github/downloads/cockatrice/cockatrice/latest/total.svg?label=downloads)](https://tooomm.github.io/github-release-stats/?username=Cockatrice&repository=Cockatrice)<br>
- Stable versions are checkpoints featuring major feature and UI enhancements.
- **Recommended for most users!**
# Related Repositories
- Latest `beta` release: [![Download from GitHub Pre-Releases](https://img.shields.io/github/release/cockatrice/cockatrice/all.svg)](https://github.com/cockatrice/cockatrice/releases) [![DL Count on Latest Pre-Release](https://img.shields.io/github/downloads-pre/cockatrice/cockatrice/latest/total.svg?label=downloads)](https://tooomm.github.io/github-release-stats/?username=Cockatrice&repository=Cockatrice)
- Beta versions include the most recently added features and bugfixes, but can be unstable.
- To be a Cockatrice Beta Tester, use this version. Find more information [here](https://github.com/Cockatrice/Cockatrice/wiki/Release-Channels)!
# Get Involved [![Discord](https://img.shields.io/discord/314987288398659595?label=Discord&logo=discord&logoColor=white)](https://discord.gg/3Z9yzmA)
Join our [Discord community](https://discord.gg/3Z9yzmA) to connect with the project, contributors or fellow users of the app. Come here to talk about the application, features, or just to hang out.<br>
For support regarding specific servers, please contact that server's admin or forum for support rather than asking here.<br>
To contribute code to the project, please review [the guidelines](https://github.com/Cockatrice/Cockatrice/blob/master/.github/CONTRIBUTING.md).
We maintain two tags for contributors to find issues to work on:
- [Good first issue](https://github.com/Cockatrice/Cockatrice/issues?utf8=%E2%9C%93&q=is%3Aopen%20is%3Aissue%20label%3A%22Good%20first%20issue%22%20): issues tagged in this way provide a simple way to get started. They don't require much experience to be worked on.
- [Help wanted](https://github.com/Cockatrice/Cockatrice/issues?utf8=%E2%9C%93&q=is%3Aopen%20is%3Aissue%20label%3A%22Help%20Wanted%22%20): This tag is used for issues that we are looking for a contributor to work on. Often this is for feature suggestions we are willing to accept, but don't have the time to work on ourselves.
For both tags, we're willing to provide help to contributors in showing them where and how they can make changes, as well as code review for changes they submit.
We try to be responsive to new issues. We'll provide advice on how best to implement a feature; alternately, we can show you where the codebase is doing something similar before you get too far along.
Cockatrice uses the [Google Developer Documentation Style Guide](https://developers.google.com/style/) to ensure consistent documentation. We encourage you to improve the documentation by suggesting edits based on this guide.
- [Magic-Token](https://github.com/Cockatrice/Magic-Token): MtG token data to use in Cockatrice
- [Magic-Spoiler](https://github.com/Cockatrice/Magic-Spoiler): Script to generate MtG spoiler data from [MTGJSON](https://github.com/mtgjson/mtgjson) to use in Cockatrice
- [cockatrice.github.io](https://github.com/Cockatrice/cockatrice.github.io): Code of the official webpage of the Cockatrice project
# Community Resources
# Community Resources [![Discord](https://img.shields.io/discord/314987288398659595?label=Discord&logo=discord&logoColor=white)](https://discord.gg/3Z9yzmA)
- [Cockatrice Official Site](https://cockatrice.github.io)
- [Cockatrice Official Wiki](https://github.com/Cockatrice/Cockatrice/wiki)
- [Cockatrice Official Discord](https://discord.gg/3Z9yzmA)
Join our [Discord community](https://discord.gg/3Z9yzmA) to connect with other projet contributors (`#dev` channel) or fellow users of the app. Come here to talk about the application, features, or just to hang out.
- [Official Website](https://cockatrice.github.io)
- [Official Wiki](https://github.com/Cockatrice/Cockatrice/wiki)
- [Official Discord](https://discord.gg/3Z9yzmA)
- [reddit r/Cockatrice](https://reddit.com/r/cockatrice)
# Translations [![Transifex Project](https://img.shields.io/badge/translate-on%20transifex-brightgreen)](https://transifex.com/cockatrice/cockatrice/)
Cockatrice uses Transifex for translations. You can help us bring Cockatrice, Oracle and Webatrice to your language or just adjust single wordings right from within your browser by visiting our [Transifex project page](https://transifex.com/cockatrice/cockatrice/).<br>
Check out our [Translator FAQ](https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ) for more information about contributing!<br>
>[!IMPORTANT]
>For support regarding specific servers, please contact that server's admin/mods and use their dedicated communication channels rather than contacting the team building the software.
# Build [![CI Desktop](https://github.com/Cockatrice/Cockatrice/actions/workflows/desktop-build.yml/badge.svg?branch=master&event=push)](https://github.com/Cockatrice/Cockatrice/actions/workflows/desktop-build.yml?query=branch%3Amaster+event%3Apush) [![CI Web](https://github.com/Cockatrice/Cockatrice/actions/workflows/web-build.yml/badge.svg?branch=master&event=push)](https://github.com/Cockatrice/Cockatrice/actions/workflows/web-build.yml?query=branch%3Amaster+event%3Apush)
# Contribute
**Detailed compiling instructions can be found on the Cockatrice wiki under [Compiling Cockatrice](https://github.com/Cockatrice/Cockatrice/wiki/Compiling-Cockatrice)**
### Code
Dependencies: *(for minimum requirements search our [CMake file](https://github.com/Cockatrice/Cockatrice/blob/master/CMakeLists.txt))*
To contribute code to the project, please review our [guidelines](https://github.com/Cockatrice/Cockatrice/blob/master/.github/CONTRIBUTING.md) first.<br>
We maintain two tags for contributors to easier find issues to potentially work on:
- [![Good first issue](https://img.shields.io/github/issues/cockatrice/cockatrice/Good%20First%20Issue)](https://github.com/Cockatrice/Cockatrice/issues?utf8=%E2%9C%93&q=is%3Aopen%20is%3Aissue%20label%3A%22Good%20first%20issue%22%20)<br>
Issues tagged in this way provide a simple way to get started. They don't require much experience to be worked on.
- [![Help wanted](https://img.shields.io/github/issues/cockatrice/cockatrice/Help%20Wanted)](https://github.com/Cockatrice/Cockatrice/issues?utf8=%E2%9C%93&q=is%3Aopen%20is%3Aissue%20label%3A%22Help%20Wanted%22%20)<br>
This tag is used for issues that we are looking for somebody to pick up. Often this is for feature suggestions we support, but don't have the time to work on ourselves.
For both tags, we're willing to provide help to contributors in showing them where and how they can make changes, as well as code reviews for submitted changes.<br>
We'll happily advice on how best to implement a feature, or we can show you where the codebase is doing something similar before you get too far along - put a note on an issue you want to discuss more on!
Cockatrice tries to use the [Google Developer Documentation Style Guide](https://developers.google.com/style/) to ensure consistent documentation. We encourage you to improve the documentation by suggesting edits based on this guide.
<details>
<summary><b>Kudos to our amazing contributors ❤️</b></summary>
<br>
<a href="https://github.com/Cockatrice/Cockatrice/graphs/contributors">
<img src="https://contrib.rocks/image?repo=Cockatrice/Cockatrice" />
</a><br>
<sub><i>Made with <a href="https://contrib.rocks">contrib.rocks</a></i></sub>
</details>
### Translations [![Transifex Project](https://img.shields.io/badge/translate-on%20transifex-brightgreen)](https://transifex.com/cockatrice/cockatrice/)
Cockatrice uses Transifex to manage translations. You can help us bring <kbd>Cockatrice</kbd>, <kbd>Oracle</kbd> and <kbd>Webatrice</kbd> to your language and just adjust single wordings right from within your browser by visiting our [Transifex project page](https://transifex.com/cockatrice/cockatrice/).<br>
Check out our [Translator FAQ](https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ) for more information about getting invovled, and join a group of hundreds of others!<br>
# Build [![CI Desktop](https://github.com/Cockatrice/Cockatrice/actions/workflows/desktop-build.yml/badge.svg?branch=master&event=push)](https://github.com/Cockatrice/Cockatrice/actions/workflows/desktop-build.yml?query=branch%3Amaster+event%3Apush) [![CI Docker](https://github.com/Cockatrice/Cockatrice/actions/workflows/docker-release.yml/badge.svg?branch=master&event=push)](https://github.com/Cockatrice/Cockatrice/actions/workflows/docker-release.yml?query=branch%3Amaster+event%3Apush) [![CI Web](https://github.com/Cockatrice/Cockatrice/actions/workflows/web-build.yml/badge.svg?branch=master&event=push)](https://github.com/Cockatrice/Cockatrice/actions/workflows/web-build.yml?query=branch%3Amaster+event%3Apush)
Dependencies: *(for minimum versions search our [CMake file](https://github.com/Cockatrice/Cockatrice/blob/master/CMakeLists.txt))*
- [Qt](https://www.qt.io/developers/)
- [protobuf](https://github.com/protocolbuffers/protobuf)
- [CMake](https://www.cmake.org/)
Oracle can optionally use zlib and xz to load compressed files:
Oracle can *optionally* use some packages to load compressed card files:
- [xz](https://tukaani.org/xz/)
- [zlib](https://www.zlib.net/)
To compile:
<br>
mkdir build
cd build
cmake ..
make
You can then run
**Basic compilation steps:**
```bash
mkdir build
cd build
cmake ..
make
```
You can then
- Create a Cockatrice installation inside the `release` folder:
```bash
make install
to get a cockatrice installation inside the `release` folder, or:
```
- Or make an installation package specific to your system:
```bash
make package
```
to create a system-specific installation package.
>[!NOTE]
>Detailed compiling instructions can be found in the Cockatrice wiki at [Compiling Cockatrice](https://github.com/Cockatrice/Cockatrice/wiki/Compiling-Cockatrice)
The following flags can be passed to `cmake`:
<br>
- `-DWITH_SERVER=1` Whether to build the server (default 0 = no).
- `-DWITH_CLIENT=0` Whether to build the client (default 1 = yes).
- `-DWITH_ORACLE=0` Whether to build oracle (default 1 = yes).
- `-DCMAKE_BUILD_TYPE=Debug` Compile in debug mode. Enables extra logging output, debug symbols, and much more verbose compiler warnings (default `Release`).
- `-DWARNING_AS_ERROR=0` Whether to treat compilation warnings as errors in debug mode (default 1 = yes).
- `-DUPDATE_TRANSLATIONS=1` Configure `make` to update the translation .ts files for new strings in the source code. Note: Running `make clean` will remove the .ts files (default 0 = no).
- `-DTEST=1` Enable regression tests (default 0 = no). Note: needs googletest, will be downloaded on the fly if unavailable. To run tests: ```make test```.
- `-DFORCE_USE_QT5=1` Skip looking for Qt6 before trying to find Qt5
The following flags (with their non-default values) can be passed to `cmake`:
| Flag | Description |
| --- | --- |
| `-DWITH_SERVER=1` | Build <kbd>Servatrice</kbd> server |
| `-DWITH_CLIENT=0` | Don't build <kbd>Cockatrice</kbd> client |
| `-DWITH_ORACLE=0` | Don't build <kbd>Oracle</kbd> card database tool |
| `-DCMAKE_BUILD_TYPE=Debug` | Compile in debug mode<br> Enables extra logging output, debug symbols, and much more verbose compiler warnings |
| `-DWARNING_AS_ERROR=0` | Don't treat compilation warnings as errors in debug mode |
| `-DUPDATE_TRANSLATIONS=1` | Configure `make` to update the translation .ts files for new strings in the source code<br> **Note:** `make clean` will remove the .ts files |
| `-DTEST=1` | Enable regression tests<br> **Note:** `make test` to run tests, *googletest* will be downloaded if not available |
| `-DFORCE_USE_QT5=1` | Skip looking for Qt6 before trying to find Qt5 |
# Run
`Cockatrice` is the game client<br>
`Oracle` fetches card data<br>
`Servatrice` is the server<br>
<kbd>Cockatrice</kbd> is the game client<br>
<kbd>Oracle</kbd> fetches card data<br>
<kbd>Servatrice</kbd> is the server<br>
**Servatrice Docker container**
#### Docker
You can run an instance of Servatrice (the Cockatrice server) using [Docker](https://www.docker.com/what-docker) and the Cockatrice Dockerfile.<br>
You can build an image & deploy a <kbd>Servatrice</kbd> (Cockatrice server) container using [Docker](https://www.docker.com/resources/what-container/) and our Dockerfile yourself.<br>
First, create an image from the Dockerfile<br>
`cd /path/to/Cockatrice-Repo/`
`docker build -t servatrice .`<br>
And then run it<br>
`docker run -i -p 4747:4747/tcp -t servatrice:latest`<br>
>Note: Running this command exposes the TCP port 4747 of the docker container<br>
to permit connections to the server.
Find more information on how to use Servatrice with Docker in our [wiki](https://github.com/Cockatrice/Cockatrice/wiki/Setting-up-Servatrice#using-docker).
**Docker compose**
There is also a docker-compose file available which will configure and run both a MySQL server and Servatrice. The docker-compose setup scripts can be found in the `servatrice/docker` folder and vary only slightly from the default sql and server .ini files. The setup scripts can either be modified in place, or docker-compose can mount alternative files into the images, as you prefer.
To run Servatrice via docker-compose, first install docker-compose following the [install instructions](https://docs.docker.com/compose/install/). Once installed, run the following from the root of the repository:
```bash
docker-compose build # Build the Servatrice image using the same Dockerfile as above.
docker-compose up # Setup and run both the MySQL server and Servatrice.
```
>Note: Similar to the above Docker setup, this will expose TCP ports 4747 and 4748.
>Note: The first time running the docker-compose setup, the MySQL server will take a little time to run the initial setup scripts. Due to this, the Servatrice instance may fail the first few attempts to connect to the database. Servatrice is set to `restart: always` in the docker-compose.yml, which will allow it to continue attempting to start up. Once the MySQL scripts have completed, Servatrice should then connect automatically on the next attempt.
**Docker compose in Windows**
A out of box working docker-compose file has been added to help setup in Windows.
Docker in Windows requires additional steps in form of using Docker Desktop to allow resource sharing from the drive the volumes are mapped from, as well as potential workarounds needed to get file sharing working in Windows. This [StackOverflow discussion sheds some light on it](https://stackoverflow.com/questions/42203488/settings-to-windows-firewall-to-allow-docker-for-windows-to-share-drive)
For more details, look into our wiki section on [Setting up Servatrice](https://github.com/Cockatrice/Cockatrice/wiki/Setting-up-Servatrice#using-docker).<br>
You'll also find more hints on our **pre-build image** there, or the **docker-compose** file which will configure and run both a MySQL server and Servatrice.
# License [![GPLv2 License](https://img.shields.io/github/license/Cockatrice/Cockatrice.svg)](https://github.com/Cockatrice/Cockatrice/blob/master/LICENSE)

View File

@@ -5,139 +5,45 @@
project(Cockatrice VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(cockatrice_SOURCES
src/game/cards/abstract_card_drag_item.cpp
src/game/cards/abstract_card_item.cpp
${VERSION_STRING_CPP}
# sort by alphabetical order, so that there is no debate about where to add new sources to the list
src/client/game_logic/abstract_client.cpp
src/game/board/abstract_counter.cpp
src/game/board/abstract_graphics_item.cpp
src/game/board/arrow_item.cpp
src/game/board/arrow_target.cpp
src/game/cards/card_database.cpp
src/game/cards/card_database_manager.cpp
src/game/cards/card_database_model.cpp
src/game/cards/card_database_parser/card_database_parser.cpp
src/game/cards/card_database_parser/cockatrice_xml_3.cpp
src/game/cards/card_database_parser/cockatrice_xml_4.cpp
src/game/cards/card_drag_item.cpp
src/game/filters/filter_card.cpp
src/client/ui/widgets/cards/card_info_frame_widget.cpp
src/client/ui/widgets/cards/card_info_picture_widget.cpp
src/client/ui/widgets/cards/card_info_text_widget.cpp
src/client/ui/widgets/cards/card_info_display_widget.cpp
src/client/ui/widgets/cards/card_size_widget.cpp
src/game/cards/card_item.cpp
src/game/cards/card_list.cpp
src/game/zones/card_zone.cpp
src/server/chat_view/chat_view.cpp
src/game/board/counter_general.cpp
src/deck/custom_line_edit.cpp
src/deck/deck_loader.cpp
src/deck/deck_list_model.cpp
src/deck/deck_stats_interface.cpp
src/dialogs/dlg_connect.cpp
src/dialogs/dlg_convert_deck_to_cod_format.cpp
src/dialogs/dlg_create_token.cpp
src/dialogs/dlg_create_game.cpp
src/dialogs/dlg_edit_avatar.cpp
src/dialogs/dlg_edit_password.cpp
src/dialogs/dlg_edit_tokens.cpp
src/dialogs/dlg_edit_user.cpp
src/dialogs/dlg_filter_games.cpp
src/dialogs/dlg_forgot_password_challenge.cpp
src/dialogs/dlg_forgot_password_request.cpp
src/dialogs/dlg_forgot_password_reset.cpp
src/dialogs/dlg_load_deck_from_clipboard.cpp
src/dialogs/dlg_load_remote_deck.cpp
src/dialogs/dlg_manage_sets.cpp
src/dialogs/dlg_move_top_cards_until.cpp
src/dialogs/dlg_register.cpp
src/dialogs/dlg_roll_dice.cpp
src/dialogs/dlg_settings.cpp
src/dialogs/dlg_tip_of_the_day.cpp
src/dialogs/dlg_update.cpp
src/dialogs/dlg_view_log.cpp
src/dialogs/dlg_load_deck.cpp
src/game/deckview/deck_view.cpp
src/game/deckview/deck_view_container.cpp
src/game/filters/filter_string.cpp
src/game/filters/filter_builder.cpp
src/game/filters/filter_tree.cpp
src/game/filters/filter_tree_model.cpp
src/client/ui/layouts/flow_layout.cpp
src/client/ui/widgets/general/layout_containers/flow_widget.cpp
src/game/game_scene.cpp
src/game/game_selector.cpp
src/game/games_model.cpp
src/game/game_view.cpp
src/client/get_text_with_max.cpp
src/game/hand_counter.cpp
src/server/handle_public_servers.cpp
src/game/zones/hand_zone.cpp
src/client/game_logic/key_signals.cpp
src/client/ui/line_edit_completer.cpp
src/server/local_client.cpp
src/server/local_server.cpp
src/server/local_server_interface.cpp
src/utility/logger.cpp
src/client/ui/widgets/cards/card_info_picture_enlarged_widget.cpp
src/client/ui/widgets/cards/card_info_picture_with_text_overlay_widget.cpp
src/client/ui/widgets/general/display/banner_widget.cpp
src/client/ui/widgets/general/display/labeled_input.cpp
src/client/ui/widgets/general/display/dynamic_font_size_label.cpp
src/client/ui/widgets/general/display/dynamic_font_size_push_button.cpp
src/client/ui/widgets/general/display/shadow_background_label.cpp
src/main.cpp
src/server/message_log_widget.cpp
src/client/ui/layouts/overlap_layout.cpp
src/client/ui/widgets/general/layout_containers/overlap_widget.cpp
src/client/ui/widgets/general/layout_containers/overlap_control_widget.cpp
src/server/pending_command.cpp
src/game/phase.cpp
src/client/ui/phases_toolbar.cpp
src/client/ui/picture_loader/picture_loader.cpp
src/client/ui/picture_loader/picture_loader_worker.cpp
src/client/ui/picture_loader/picture_to_load.cpp
src/game/zones/pile_zone.cpp
src/client/ui/pixel_map_generator.cpp
src/game/player/player.cpp
src/game/player/player_list_widget.cpp
src/game/player/player_target.cpp
src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.cpp
src/client/ui/widgets/printing_selector/card_amount_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_search_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_view_options_toolbar_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_view_options_widget.cpp
src/client/ui/widgets/printing_selector/set_name_and_collectors_number_display_widget.cpp
src/client/network/release_channel.cpp
src/client/get_text_with_max.cpp
src/client/menus/deck_editor/deck_editor_menu.cpp
src/client/network/client_update_checker.cpp
src/server/remote/remote_client.cpp
src/server/remote/remote_decklist_tree_widget.cpp
src/server/remote/remote_replay_list_tree_widget.cpp
src/client/network/release_channel.cpp
src/client/network/replay_timeline_widget.cpp
src/game/zones/select_zone.cpp
src/utility/sequence_edit.cpp
src/client/network/sets_model.cpp
src/settings/card_database_settings.cpp
src/settings/download_settings.cpp
src/settings/game_filters_settings.cpp
src/settings/layouts_settings.cpp
src/settings/message_settings.cpp
src/settings/recents_settings.cpp
src/settings/servers_settings.cpp
src/settings/settings_manager.cpp
src/settings/cache_settings.cpp
src/settings/shortcuts_settings.cpp
src/settings/shortcut_treeview.cpp
src/settings/card_override_settings.cpp
src/settings/debug_settings.cpp
src/client/sound_engine.cpp
src/client/network/spoiler_background_updater.cpp
src/game/zones/stack_zone.cpp
src/client/sound_engine.cpp
src/client/tabs/abstract_tab_deck_editor.cpp
src/client/tabs/api/edhrec/tab_edhrec.cpp
src/client/tabs/api/edhrec/tab_edhrec_main.cpp
src/client/tabs/api/edhrec/display/commander/edhrec_commander_api_response_display_widget.cpp
src/client/tabs/api/edhrec/display/commander/edhrec_commander_api_response_navigation_widget.cpp
src/client/tabs/api/edhrec/display/card_prices/edhrec_api_response_card_prices_display_widget.cpp
src/client/tabs/api/edhrec/display/cards/edhrec_api_response_card_details_display_widget.cpp
src/client/tabs/api/edhrec/display/cards/edhrec_api_response_card_inclusion_display_widget.cpp
src/client/tabs/api/edhrec/display/cards/edhrec_api_response_card_list_display_widget.cpp
src/client/tabs/api/edhrec/display/cards/edhrec_api_response_card_synergy_display_widget.cpp
src/client/tabs/api/edhrec/display/commander/edhrec_api_response_commander_details_display_widget.cpp
src/client/tabs/api/edhrec/display/top_cards/edhrec_top_cards_api_response_display_widget.cpp
src/client/tabs/api/edhrec/display/top_commander/edhrec_top_commanders_api_response_display_widget.cpp
src/client/tabs/api/edhrec/display/top_tags/edhrec_top_tags_api_response_display_widget.cpp
src/client/tabs/api/edhrec/api_response/archidekt_links/edhrec_api_response_archidekt_links.cpp
src/client/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response_average_deck_statistics.cpp
src/client/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_details.cpp
src/client/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_list.cpp
src/client/tabs/api/edhrec/api_response/cards/edhrec_api_response_card_container.cpp
src/client/tabs/api/edhrec/api_response/card_prices/edhrec_api_response_card_prices.cpp
src/client/tabs/api/edhrec/api_response/cards/edhrec_commander_api_response_commander_details.cpp
src/client/tabs/api/edhrec/api_response/commander/edhrec_commander_api_response.cpp
src/client/tabs/api/edhrec/api_response/average_deck/edhrec_average_deck_api_response.cpp
src/client/tabs/api/edhrec/api_response/average_deck/edhrec_deck_api_response.cpp
src/client/tabs/api/edhrec/api_response/top_cards/edhrec_top_cards_api_response.cpp
src/client/tabs/api/edhrec/api_response/top_commanders/edhrec_top_commanders_api_response.cpp
src/client/tabs/api/edhrec/api_response/top_tags/edhrec_top_tags_api_response.cpp
src/client/tabs/tab.cpp
src/client/tabs/tab_account.cpp
src/client/tabs/tab_admin.cpp
@@ -150,49 +56,197 @@ set(cockatrice_SOURCES
src/client/tabs/tab_room.cpp
src/client/tabs/tab_server.cpp
src/client/tabs/tab_supervisor.cpp
src/client/tabs/api/edhrec/tab_edhrec.cpp
src/client/tabs/api/edhrec/edhrec_commander_api_response_display_widget.cpp
src/client/tabs/api/edhrec/edhrec_commander_api_response_card_details_display_widget.cpp
src/client/tabs/api/edhrec/edhrec_commander_api_response_card_list_display_widget.cpp
src/client/tabs/api/edhrec/edhrec_commander_api_response_commander_details_display_widget.cpp
src/client/tabs/api/edhrec/api_response/edhrec_commander_api_response_archidekt_links.cpp
src/client/tabs/api/edhrec/api_response/edhrec_commander_api_response_average_deck_statistics.cpp
src/client/tabs/api/edhrec/api_response/edhrec_commander_api_response_card_details.cpp
src/client/tabs/api/edhrec/api_response/edhrec_commander_api_response_card_list.cpp
src/client/tabs/api/edhrec/api_response/edhrec_commander_api_response_card_container.cpp
src/client/tabs/api/edhrec/api_response/edhrec_commander_api_response_card_prices.cpp
src/client/tabs/api/edhrec/api_response/edhrec_commander_api_response_commander_details.cpp
src/client/tabs/api/edhrec/api_response/edhrec_commander_api_response.cpp
src/game/zones/table_zone.cpp
src/client/tabs/tab_visual_database_display.cpp
src/client/tabs/visual_deck_editor/tab_deck_editor_visual.cpp
src/client/tabs/visual_deck_editor/tab_deck_editor_visual_tab_widget.cpp
src/client/tabs/visual_deck_storage/tab_deck_storage_visual.cpp
src/client/tapped_out_interface.cpp
src/client/translate_counter_name.cpp
src/client/ui/layouts/flow_layout.cpp
src/client/ui/layouts/overlap_layout.cpp
src/client/ui/line_edit_completer.cpp
src/client/ui/phases_toolbar.cpp
src/client/ui/picture_loader/picture_loader.cpp
src/client/ui/picture_loader/picture_loader_worker.cpp
src/client/ui/picture_loader/picture_to_load.cpp
src/client/ui/pixel_map_generator.cpp
src/client/ui/theme_manager.cpp
src/client/ui/tip_of_the_day.cpp
src/client/translate_counter_name.cpp
src/client/update_downloader.cpp
src/server/user/user_context_menu.cpp
src/server/user/user_info_connection.cpp
src/server/user/user_info_box.cpp
src/server/user/user_list_manager.cpp
src/server/user/user_list_widget.cpp
src/client/ui/window_main.cpp
src/game/zones/view_zone_widget.cpp
src/game/zones/view_zone.cpp
src/client/tabs/visual_deck_storage/tab_deck_storage_visual.cpp
src/client/ui/widgets/cards/additional_info/color_identity_widget.cpp
src/client/ui/widgets/cards/additional_info/mana_cost_widget.cpp
src/client/ui/widgets/cards/additional_info/mana_symbol_widget.cpp
src/client/ui/widgets/cards/card_group_display_widgets/card_group_display_widget.cpp
src/client/ui/widgets/cards/card_group_display_widgets/flat_card_group_display_widget.cpp
src/client/ui/widgets/cards/card_group_display_widgets/overlapped_card_group_display_widget.cpp
src/client/ui/widgets/cards/card_info_display_widget.cpp
src/client/ui/widgets/cards/card_info_frame_widget.cpp
src/client/ui/widgets/cards/card_info_picture_enlarged_widget.cpp
src/client/ui/widgets/cards/card_info_picture_widget.cpp
src/client/ui/widgets/cards/card_info_picture_with_text_overlay_widget.cpp
src/client/ui/widgets/cards/card_info_text_widget.cpp
src/client/ui/widgets/cards/card_size_widget.cpp
src/client/ui/widgets/cards/deck_card_zone_display_widget.cpp
src/client/ui/widgets/cards/deck_preview_card_picture_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_color_identity_widget.cpp
src/client/ui/widgets/deck_analytics/deck_analytics_widget.cpp
src/client/ui/widgets/deck_analytics/mana_base_widget.cpp
src/client/ui/widgets/deck_analytics/mana_curve_widget.cpp
src/client/ui/widgets/deck_analytics/mana_devotion_widget.cpp
src/client/ui/widgets/deck_editor/deck_editor_card_info_dock_widget.cpp
src/client/ui/widgets/deck_editor/deck_editor_database_display_widget.cpp
src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.cpp
src/client/ui/widgets/deck_editor/deck_editor_filter_dock_widget.cpp
src/client/ui/widgets/deck_editor/deck_editor_printing_selector_dock_widget.cpp
src/client/ui/widgets/general/display/banner_widget.cpp
src/client/ui/widgets/general/display/bar_widget.cpp
src/client/ui/widgets/general/display/dynamic_font_size_label.cpp
src/client/ui/widgets/general/display/dynamic_font_size_push_button.cpp
src/client/ui/widgets/general/display/labeled_input.cpp
src/client/ui/widgets/general/display/percent_bar_widget.cpp
src/client/ui/widgets/general/display/shadow_background_label.cpp
src/client/ui/widgets/general/layout_containers/flow_widget.cpp
src/client/ui/widgets/general/layout_containers/overlap_control_widget.cpp
src/client/ui/widgets/general/layout_containers/overlap_widget.cpp
src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.cpp
src/client/ui/widgets/printing_selector/card_amount_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_search_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.cpp
src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.cpp
src/client/ui/widgets/printing_selector/set_name_and_collectors_number_display_widget.cpp
src/client/ui/widgets/quick_settings/settings_button_widget.cpp
src/client/ui/widgets/quick_settings/settings_popup_widget.cpp
src/client/ui/widgets/visual_database_display/visual_database_display_widget.cpp
src/client/ui/widgets/visual_database_display/visual_database_display_color_filter_widget.cpp
src/client/ui/widgets/visual_database_display/visual_database_display_sub_type_filter_widget.cpp
src/client/ui/widgets/visual_database_display/visual_database_display_name_filter_widget.cpp
src/client/ui/widgets/visual_database_display/visual_database_display_main_type_filter_widget.cpp
src/client/ui/widgets/visual_database_display/visual_database_display_set_filter_widget.cpp
src/client/ui/widgets/visual_database_display/visual_database_display_filter_save_load_widget.cpp
src/client/ui/widgets/visual_database_display/visual_database_filter_display_widget.cpp
src/client/ui/widgets/visual_deck_editor/visual_deck_editor_widget.cpp
src/client/ui/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_color_identity_filter_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_addition_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_display_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_dialog.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_item_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_addition_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_dialog.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_display_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_item_widget.cpp
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp
src/client/ui/widgets/visual_deck_storage/visual_deck_storage_widget.cpp
src/client/ui/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp
src/client/ui/widgets/visual_deck_storage/visual_deck_storage_quick_settings_widget.cpp
src/client/ui/widgets/visual_deck_storage/visual_deck_storage_search_widget.cpp
src/client/ui/widgets/visual_deck_storage/visual_deck_storage_sort_widget.cpp
src/client/ui/widgets/visual_deck_storage/visual_deck_storage_tag_filter_widget.cpp
${VERSION_STRING_CPP}
src/client/ui/widgets/visual_deck_storage/visual_deck_storage_widget.cpp
src/client/ui/window_main.cpp
src/client/update_downloader.cpp
src/deck/custom_line_edit.cpp
src/deck/deck_list_model.cpp
src/deck/deck_loader.cpp
src/deck/deck_stats_interface.cpp
src/dialogs/dlg_connect.cpp
src/dialogs/dlg_convert_deck_to_cod_format.cpp
src/dialogs/dlg_create_game.cpp
src/dialogs/dlg_create_token.cpp
src/dialogs/dlg_edit_avatar.cpp
src/dialogs/dlg_edit_password.cpp
src/dialogs/dlg_edit_tokens.cpp
src/dialogs/dlg_edit_user.cpp
src/dialogs/dlg_filter_games.cpp
src/dialogs/dlg_forgot_password_challenge.cpp
src/dialogs/dlg_forgot_password_request.cpp
src/dialogs/dlg_forgot_password_reset.cpp
src/dialogs/dlg_load_deck.cpp
src/dialogs/dlg_load_deck_from_clipboard.cpp
src/dialogs/dlg_load_remote_deck.cpp
src/dialogs/dlg_manage_sets.cpp
src/dialogs/dlg_move_top_cards_until.cpp
src/dialogs/dlg_register.cpp
src/dialogs/dlg_roll_dice.cpp
src/dialogs/dlg_settings.cpp
src/dialogs/dlg_tip_of_the_day.cpp
src/dialogs/dlg_update.cpp
src/dialogs/dlg_view_log.cpp
src/game/board/abstract_card_drag_item.cpp
src/game/board/abstract_card_item.cpp
src/game/board/abstract_counter.cpp
src/game/board/abstract_graphics_item.cpp
src/game/board/arrow_item.cpp
src/game/board/arrow_target.cpp
src/game/board/card_drag_item.cpp
src/game/board/card_item.cpp
src/game/board/card_list.cpp
src/game/board/counter_general.cpp
src/game/cards/card_completer_proxy_model.cpp
src/game/cards/card_database.cpp
src/game/cards/card_database_manager.cpp
src/game/cards/card_database_model.cpp
src/game/cards/card_database_parser/card_database_parser.cpp
src/game/cards/card_database_parser/cockatrice_xml_3.cpp
src/game/cards/card_database_parser/cockatrice_xml_4.cpp
src/game/cards/card_info.cpp
src/game/cards/card_search_model.cpp
src/game/deckview/deck_view.cpp
src/game/deckview/deck_view_container.cpp
src/game/filters/deck_filter_string.cpp
src/game/filters/filter_builder.cpp
src/game/filters/filter_card.cpp
src/game/filters/filter_string.cpp
src/game/filters/filter_tree.cpp
src/game/filters/filter_tree_model.cpp
src/game/filters/syntax_help.cpp
src/game/game_scene.cpp
src/game/game_selector.cpp
src/game/game_view.cpp
src/game/games_model.cpp
src/game/hand_counter.cpp
src/game/phase.cpp
src/game/player/player.cpp
src/game/player/player_list_widget.cpp
src/game/player/player_target.cpp
src/game/zones/card_zone.cpp
src/game/zones/hand_zone.cpp
src/game/zones/pile_zone.cpp
src/game/zones/select_zone.cpp
src/game/zones/stack_zone.cpp
src/game/zones/table_zone.cpp
src/game/zones/view_zone.cpp
src/game/zones/view_zone_widget.cpp
src/main.cpp
src/server/chat_view/chat_view.cpp
src/server/handle_public_servers.cpp
src/server/local_client.cpp
src/server/local_server.cpp
src/server/local_server_interface.cpp
src/server/message_log_widget.cpp
src/server/pending_command.cpp
src/server/remote/remote_client.cpp
src/server/remote/remote_decklist_tree_widget.cpp
src/server/remote/remote_replay_list_tree_widget.cpp
src/server/user/user_context_menu.cpp
src/server/user/user_info_box.cpp
src/server/user/user_info_connection.cpp
src/server/user/user_list_manager.cpp
src/server/user/user_list_widget.cpp
src/settings/cache_settings.cpp
src/settings/card_database_settings.cpp
src/settings/card_override_settings.cpp
src/settings/debug_settings.cpp
src/settings/download_settings.cpp
src/settings/game_filters_settings.cpp
src/settings/layouts_settings.cpp
src/settings/message_settings.cpp
src/settings/recents_settings.cpp
src/settings/servers_settings.cpp
src/settings/settings_manager.cpp
src/settings/shortcut_treeview.cpp
src/settings/shortcuts_settings.cpp
src/utility/card_info_comparator.cpp
src/utility/levenshtein.cpp
src/utility/logger.cpp
src/utility/sequence_edit.cpp
)
add_subdirectory(sounds)
@@ -338,6 +392,13 @@ if(APPLE)
PATTERN "tls/*.dylib"
)
install(
DIRECTORY "${CMAKE_BINARY_DIR}/cockatrice/"
DESTINATION ${qtconf_dest_dir}/
FILES_MATCHING
PATTERN "*.ini"
)
install(
CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]

View File

@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/" >
<qresource prefix="/">
<file>resources/cardback.svg</file>
<file>resources/cockatrice.svg</file>
<file>resources/hand.svg</file>
@@ -13,9 +13,12 @@
<file>resources/icons/arrow_top_green.svg</file>
<file>resources/icons/arrow_up_green.svg</file>
<file>resources/icons/clearsearch.svg</file>
<file>resources/icons/cogwheel.svg</file>
<file>resources/icons/conceded.svg</file>
<file>resources/icons/decrement.svg</file>
<file>resources/icons/delete.svg</file>
<file>resources/icons/dropdown_collapsed.svg</file>
<file>resources/icons/dropdown_expanded.svg</file>
<file>resources/icons/forgot_password.svg</file>
<file>resources/icons/increment.svg</file>
<file>resources/icons/info.svg</file>
@@ -24,7 +27,9 @@
<file>resources/icons/pencil.svg</file>
<file>resources/icons/player.svg</file>
<file>resources/icons/ready_start.svg</file>
<file>resources/icons/reload.svg</file>
<file>resources/icons/remove_row.svg</file>
<file>resources/icons/rename.svg</file>
<file>resources/icons/scales.svg</file>
<file>resources/icons/search.svg</file>
<file>resources/icons/settings.svg</file>
@@ -35,6 +40,12 @@
<file>resources/icons/update.png</file>
<file>resources/icons/view.svg</file>
<file>resources/icons/mana/B.svg</file>
<file>resources/icons/mana/G.svg</file>
<file>resources/icons/mana/R.svg</file>
<file>resources/icons/mana/U.svg</file>
<file>resources/icons/mana/W.svg</file>
<file>resources/config/general.svg</file>
<file>resources/config/appearance.svg</file>
<file>resources/config/interface.svg</file>
@@ -342,21 +353,32 @@
<!-- ADD TIP OF THE DAY IMAGES HERE -->
<file>resources/tips/images/accounts_tab.png</file>
<file>resources/tips/images/add_card.png</file>
<file>resources/tips/images/arrows.png</file>
<file>resources/tips/images/card_select.png</file>
<file>resources/tips/images/cockatrice_register.png</file>
<file>resources/tips/images/cockatrice_wiki.png</file>
<file>resources/tips/images/coin_flip.png</file>
<file>resources/tips/images/counter_expression.png</file>
<file>resources/tips/images/discord.png</file>
<file>resources/tips/images/edhrec.png</file>
<file>resources/tips/images/expand_card_view.png</file>
<file>resources/tips/images/face_down.png</file>
<file>resources/tips/images/filter_games.png</file>
<file>resources/tips/images/github_logo.png</file>
<file>resources/tips/images/highlight_cards.png</file>
<file>resources/tips/images/pawns.png</file>
<file>resources/tips/images/setpt.png</file>
<file>resources/tips/images/shortcuts.png</file>
<file>resources/tips/images/syntax_help.png</file>
<file>resources/tips/images/themes.png</file>
<file>resources/tips/images/tip_of_the_day.png</file>
<file>resources/tips/images/token.png</file>
<file>resources/tips/images/updates.png</file>
<file>resources/tips/images/visual_deck_tags.png</file>
<file>resources/tips/tips_of_the_day.xml</file>
<file>resources/help/search.md</file>
<file>resources/help/deck_search.md</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,9 @@
[Rules]
# Uncomment a rule to disable logging for that category
# The default log level is info
*.debug = false
# Uncomment a rule to disable logging for that category,
# or set .debug = true for that category to see debug level logs
# main = false
# qt_translator = false
@@ -23,6 +27,7 @@
# servers_settings = false
# shortcuts_settings = false
# local_client = false
# remote_client = false
# player = false
@@ -44,12 +49,17 @@
# cockatrice_xml.* = false
# cockatrice_xml.xml_3_parser = false
# cockatrice_xml.xml_4_parser = false
# card_info = false
# card_list = false
flow_layout.debug = false
flow_widget.debug = false
flow_widget.size.debug = false
#flow_layout = false
#flow_widget = false
#flow_widget.size = false
# card_info_picture_widget = false
# pixel_map_generator = false
# filter_string = false
# deck_filter_string = false
# filter_string = false
# syntax_help = false

View File

@@ -0,0 +1,26 @@
## Deck Search Syntax Help
-----
The search bar recognizes a set of special commands.<br>
In this list of examples below, each entry has an explanation and can be clicked to test the query. Note that all
searches are case insensitive.
<dl>
<dt>Filename:</dt>
<dd>[red deck wins](#red deck wins) <small>(Any deck filename containing the words red, deck, and wins)</small></dd>
<dd>["red deck wins"](#%22red deck wins%22) <small>(Any deck filename containing the exact phrase "red deck wins")</small></dd>
<dt>Deck Contents (Uses [card search expressions](#cardSearchSyntaxHelp)):</dt>
<dd><a href="#[[plains]]">[[plains]]</a> <small>(Any deck that contains at least one card with "plains" in its name)</small></dd>
<dd><a href="#[[t:legendary]]">[[t:legendary]]</a> <small>(Any deck that contains at least one legendary)</small></dd>
<dd><a href="#[[t:legendary]]>5">[[t:legendary]]>5</a> <small>(Any card that contains at least 5 legendaries)</small></dd>
<dd><a href="#[[]]:100">[[]]:100</a> <small>(Any deck that contains exactly 100 cards)</small></dd>
<dt>Negate:</dt>
<dd>[soldier -aggro](#soldier -aggro) <small>(Any deck filename that contains "soldier", but not "aggro")</small></dd>
<dt>Branching:</dt>
<dd>[t:aggro OR o:control](#t:aggro OR o:control) <small>(Any deck filename that contains either aggro or control)</small></dd>
<dt>Grouping:</dt>
<dd><a href="#red -([[]]:100 or aggro)">red -([[]]:100 or aggro)</a> <small>(Any deck that has red in its filename but is not 100 cards or has aggro in its filename)</small></dd>
</dl>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" width="102.5024mm" height="102.24421mm"
viewBox="0 0 102.5024 102.24421" version="1.1"
id="svg1"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)" sodipodi:docname="cog_wheel.svg"
xmlns="http://www.w3.org/2000/svg">
<sodipodi:namedview id="namedview1" pagecolor="#ffffff" bordercolor="#000000" borderopacity="0.25"
inkscape:showpageshadow="2" inkscape:pageopacity="0.0" inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" inkscape:zoom="0.66101291"
inkscape:cx="146.74449" inkscape:cy="193.64221" inkscape:window-width="1829"
inkscape:window-height="951" inkscape:window-x="0" inkscape:window-y="0"
inkscape:window-maximized="1" inkscape:current-layer="layer1"/>
<defs id="defs1"/>
<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(-66.148059,-97.377896)">
<g id="g1" transform="translate(-165.09777,-82.009607)">
<g id="g2" transform="matrix(0.26458333,0,0,0.26458333,64.983323,161.37858)">
<path style="fill:#333333;stroke-width:94.4882"
d="m 721.34301,94.413051 40.00966,29.763289 29.51933,-9.27053 14.63768,-46.840589 36.83817,0.48792 13.41787,46.108699 28.29952,9.5145 40.74155,-28.299519 29.0314,21.468599 -15.85748,47.08454 16.58937,23.66426 48.30432,-2.68358 12.93,34.88648 -41.71741,27.07971 -0.48792,29.27536 40.49763,26.10387 -10.2464,34.15459 -48.54834,-0.97584 -18.78502,23.42029 15.85749,45.37681 -28.29952,21.71256 -41.22947,-29.27536 -28.54348,9.75846 -13.66184,47.57246 -38.30194,-0.73188 -14.63768,-48.30435 -27.07971,-9.27054 -40.00966,29.27537 -30.25121,-20.49276 17.32125,-46.35266 -17.80918,-24.64009 -49.76812,3.17149 -11.22222,-34.64251 40.74155,-27.07971 0.48792,-30.00725 -41.71739,-27.32367 12.19807,-32.93479 48.30435,2.68358 20.24879,-24.6401 -17.32126,-47.08455 z"
id="path1"/>
<circle style="fill:#f9f9f9;stroke-width:72.1317" id="path2" cx="822.09906" cy="261.28262"
r="83.434792"/>
<circle style="fill:#4d4d4d;stroke-width:40.5147" id="circle2" cx="822.09906" cy="261.28262"
r="46.863361"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="460.5" height="531.74"
viewBox="0 0 460.5 531.74" overflow="visible" enable-background="new 0 0 460.5 531.74" xml:space="preserve">
<polygon fill="#918d8d" points="0.5,0.866 459.5,265.87 0.5,530.874 "/>
</svg>

After

Width:  |  Height:  |  Size: 657 B

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="531.74" height="460.5"
viewBox="0 0 531.74 460.5" overflow="visible" enable-background="new 0 0 531.74 460.5" xml:space="preserve">
<polygon fill="#918d8d" points="530.874,0.5 265.87,459.5 0.866,0.5 "/>
</svg>

After

Width:  |  Height:  |  Size: 657 B

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="169.34801mm"
height="169.34801mm"
viewBox="0 0 600 600"
version="1.1"
id="svg1"
sodipodi:docname="B.svg"
inkscape:export-filename="B.svg"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg">
<defs
id="defs1"/>
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:document-units="mm">
<inkscape:page
x="0"
y="0"
width="600"
height="600"
id="page2"
margin="0"
bleed="0"/>
</sodipodi:namedview>
<path
id="Selection"
fill="none"
stroke="#000000"
stroke-width="1"
d="m 275,0.21 c 0,0 42,0 42,0 0,0 19,1.51 19,1.51 29.13,3.58 56.99,10.83 84,22.43 33.64,14.45 59.89,32.91 86.91,57.41 17.38,15.76 34.67,37.56 47.14,57.44 22.78,36.31 37.1,74.56 43.22,117 1.28,8.88 2.72,19.08 2.73,28 0,0 0,34 0,34 0,0 -0.91,10 -0.91,10 -2.36,32.29 -11.93,67.59 -25.4,97 -27.01,58.98 -70.49,105.42 -126.69,137.57 -34.3,19.63 -79.56,33.64 -119,36.52 0,0 -12,0.91 -12,0.91 0,0 -34,0 -34,0 0,0 -10,-0.91 -10,-0.91 -26.57,-1.94 -53.09,-8.27 -78,-17.67 C 163.49,569.9 134.12,553.46 109,532.57 79.87,508.33 54.41,478.39 36.31,445 -5.08,368.65 -11.86,276.57 18.05,195 47.85,113.75 113.21,48.92 194,18.42 213.55,11.04 236.32,5.43 257,2.43 Z"
style="display:inline;fill:#ababab;fill-opacity:1"/>
<path
d="m 299.67889,84.945431 c -118.26949,0 -214.122988,83.892719 -214.122988,187.357619 0,58.63289 30.863828,110.90901 79.041488,145.28579 8.02961,5.77129 12.71356,15.13917 11.29165,25.0089 l -7.86234,55.37086 c -1.17098,8.02962 5.01851,15.22281 13.13176,15.22281 h 64.98968 v -46.83939 c 0,-3.68025 3.01111,-6.69135 6.69135,-6.69135 h 13.38268 c 3.68024,0 6.69135,3.0111 6.69135,6.69135 v 46.83939 h 53.53075 v -46.83939 c 0,-3.68025 3.01111,-6.69135 6.69134,-6.69135 h 13.38269 c 3.68023,0 6.69134,3.0111 6.69134,6.69135 v 46.83939 h 64.98967 c 8.11327,0 14.30275,-7.19319 13.13177,-15.22281 l -7.86234,-55.37086 c -1.4219,-9.78609 3.1784,-19.23761 11.29165,-25.0089 48.17767,-34.37678 79.0415,-86.6529 79.0415,-145.28579 0,-103.4649 -95.8535,-187.357619 -214.123,-187.357619 z M 219.38277,352.59917 c -29.52555,0 -53.53075,-24.0052 -53.53075,-53.53075 0,-29.52555 24.0052,-53.53075 53.53075,-53.53075 29.52555,0 53.53075,24.0052 53.53075,53.53075 0,29.52555 -24.0052,53.53075 -53.53075,53.53075 z m 160.59225,0 c -29.52555,0 -53.53075,-24.0052 -53.53075,-53.53075 0,-29.52555 24.0052,-53.53075 53.53075,-53.53075 29.52555,0 53.53075,24.0052 53.53075,53.53075 0,29.52555 -24.0052,53.53075 -53.53075,53.53075 z"
id="path1"
style="fill:#4d4d4d;fill-opacity:1;stroke:#000000;stroke-width:0.836419;stroke-opacity:1"/>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
width="169.34801mm"
height="169.34801mm"
viewBox="0 0 600 600"
version="1.1"
id="svg1"
sodipodi:docname="B.svg"
inkscape:export-filename="U.svg"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns="http://www.w3.org/2000/svg">
<defs
id="defs1"/>
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:document-units="mm">
<inkscape:page
x="0"
y="0"
width="600"
height="600"
id="page2"
margin="0"
bleed="0"/>
</sodipodi:namedview>
<path
id="Selection"
fill="none"
stroke="#000000"
stroke-width="1"
d="m 275,0.21 c 0,0 42,0 42,0 0,0 19,1.51 19,1.51 29.13,3.58 56.99,10.83 84,22.43 33.64,14.45 59.89,32.91 86.91,57.41 17.38,15.76 34.67,37.56 47.14,57.44 22.78,36.31 37.1,74.56 43.22,117 1.28,8.88 2.72,19.08 2.73,28 0,0 0,34 0,34 0,0 -0.91,10 -0.91,10 -2.36,32.29 -11.93,67.59 -25.4,97 -27.01,58.98 -70.49,105.42 -126.69,137.57 -34.3,19.63 -79.56,33.64 -119,36.52 0,0 -12,0.91 -12,0.91 0,0 -34,0 -34,0 0,0 -10,-0.91 -10,-0.91 -26.57,-1.94 -53.09,-8.27 -78,-17.67 C 163.49,569.9 134.12,553.46 109,532.57 79.87,508.33 54.41,478.39 36.31,445 -5.08,368.65 -11.86,276.57 18.05,195 47.85,113.75 113.21,48.92 194,18.42 213.55,11.04 236.32,5.43 257,2.43 Z"
style="display:inline;fill:#5f9f56;fill-opacity:1"/>
<path
d="m 488.52401,428.04591 -80.36527,-83.50228 h 30.81218 c 9.06362,0 17.08104,-4.61393 20.90363,-12.05153 3.82262,-7.41912 2.56521,-15.92714 -3.29949,-22.19282 l -78.59482,-83.87142 h 29.06188 c 9.15413,0 17.40291,-4.93688 20.98411,-12.55902 3.54092,-7.50219 1.87106,-16.23169 -4.26525,-22.22053 L 312.83499,83.240199 c -6.06588,-5.951919 -17.38282,-5.951919 -23.45873,0 L 178.44019,191.64831 c -6.13629,5.98884 -7.79612,14.71834 -4.26523,22.22053 3.58119,7.62214 11.84001,12.55902 20.99414,12.55902 h 29.06189 l -78.60489,83.88987 c -5.84454,6.25645 -7.10199,14.75525 -3.28944,22.18361 3.82262,7.42836 11.82996,12.04229 20.90363,12.04229 h 30.81222 l -80.36527,83.50228 c -6.03569,6.26567 -7.40379,14.84754 -3.58117,22.38663 3.7723,7.42839 12.07138,12.22682 21.13497,12.22682 h 129.63669 c 0,0 -36.12127,66.38546 0,62.75824 h 80.45578 c 33.50708,5.78651 0,-62.75824 0,-62.75824 h 129.63668 c 9.06361,0 17.36266,-4.79843 21.13499,-12.22682 3.82262,-7.53909 2.45452,-16.12096 -3.58117,-22.38663 z"
id="ENVIR"
style="fill:#3f6e3a;fill-opacity:1;stroke:#000000;stroke-width:1.09833;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
width="169.34801mm"
height="169.34801mm"
viewBox="0 0 600 600"
version="1.1"
id="svg1"
sodipodi:docname="B.svg"
inkscape:export-filename="B.svg"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns="http://www.w3.org/2000/svg">
<defs
id="defs1"/>
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:document-units="mm">
<inkscape:page
x="0"
y="0"
width="600"
height="600"
id="page2"
margin="0"
bleed="0"/>
</sodipodi:namedview>
<path
id="Selection"
fill="none"
stroke="#000000"
stroke-width="1"
d="m 275,0.21 c 0,0 42,0 42,0 0,0 19,1.51 19,1.51 29.13,3.58 56.99,10.83 84,22.43 33.64,14.45 59.89,32.91 86.91,57.41 17.38,15.76 34.67,37.56 47.14,57.44 22.78,36.31 37.1,74.56 43.22,117 1.28,8.88 2.72,19.08 2.73,28 0,0 0,34 0,34 0,0 -0.91,10 -0.91,10 -2.36,32.29 -11.93,67.59 -25.4,97 -27.01,58.98 -70.49,105.42 -126.69,137.57 -34.3,19.63 -79.56,33.64 -119,36.52 0,0 -12,0.91 -12,0.91 0,0 -34,0 -34,0 0,0 -10,-0.91 -10,-0.91 -26.57,-1.94 -53.09,-8.27 -78,-17.67 C 163.49,569.9 134.12,553.46 109,532.57 79.87,508.33 54.41,478.39 36.31,445 -5.08,368.65 -11.86,276.57 18.05,195 47.85,113.75 113.21,48.92 194,18.42 213.55,11.04 236.32,5.43 257,2.43 Z"
style="display:inline;fill:#c95e46;fill-opacity:1"/>
<path
style="display:inline;fill:#7e3525;fill-opacity:1;stroke:#000000;stroke-width:0.999129;stroke-dasharray:none;stroke-opacity:1"
d="m 278.25473,537.27772 c -22.36635,-1.29637 -48.78648,-8.31223 -69.74195,-18.51997 -47.30139,-23.04123 -75.19872,-59.72004 -85.45343,-112.35234 -2.77041,-14.21911 -2.51753,-48.32296 0.4755,-64.1246 4.84373,-25.57244 17.23939,-55.03329 30.65191,-72.85059 3.74877,-4.97991 16.33133,-18.11906 30.23479,-31.57223 13.09764,-12.67346 26.64745,-26.67202 30.11069,-31.10792 16.66894,-21.35045 26.46602,-44.71272 29.68313,-70.78286 1.93489,-15.67951 0.37962,-45.867231 -3.5802,-69.491071 -0.58906,-3.51428 0.36584,-3.52724 11.47726,-0.15583 36.51454,11.0792 67.37028,34.791071 89.32423,68.643431 9.96686,15.36862 20.07787,39.31263 24.78919,58.70364 2.23257,9.18886 2.53252,44.73878 0.46396,54.98571 -0.75708,3.75024 -1.10086,7.09425 -0.76396,7.43114 1.5021,1.5021 14.63666,-6.65479 21.98002,-13.65016 10.59844,-10.09621 14.32693,-17.61354 15.94714,-32.15254 l 1.16788,-10.47988 3.4626,3.95724 c 26.80954,30.6392 41.75268,56.11528 54.11775,92.26358 11.02075,32.21825 14.93902,62.79297 12.47422,97.33768 -1.88493,26.41774 -10.16486,50.6958 -24.95555,73.17369 -6.31625,9.59901 -30.86306,34.05172 -40.40914,40.25423 -23.44452,15.23295 -50.15355,25.25695 -77.26806,28.99903 -12.48732,1.72336 -38.04339,2.42637 -54.18798,1.49062 z m 48.34948,-30.34196 c 30.78066,-8.0491 53.53846,-30.12825 59.69792,-57.9177 2.48916,-11.23027 2.26087,-34.25269 -0.43747,-44.11787 -5.3998,-19.74181 -9.72931,-26.61651 -30.6237,-48.62658 -16.92925,-17.8332 -21.73398,-24.64464 -25.45673,-36.0889 -2.38622,-7.33554 -2.63126,-9.53814 -2.57644,-23.15876 0.0334,-8.27872 0.486,-17.4607 1.00593,-20.40441 0.75887,-4.29636 0.66928,-5.45812 -0.45409,-5.88919 -2.12997,-0.81736 -16.25071,4.45522 -21.90917,8.1807 -25.69349,16.91641 -42.62753,52.30879 -40.22917,84.07948 0.39046,5.17228 0.2831,8.79277 -0.26071,8.79277 -1.78935,0 -13.49435,-13.46378 -15.34792,-17.65406 -1.03171,-2.33236 -2.15967,-6.42651 -2.50657,-9.09812 -1.00143,-7.71233 -1.60778,-8.14619 -5.46339,-3.90915 -13.31687,14.63425 -24.58113,35.69359 -29.53283,55.21379 -11.75615,46.34414 2.14731,84.38956 37.55813,102.77397 16.56338,8.59931 29.2427,11.25369 51.26679,10.73261 12.58064,-0.29766 17.41119,-0.85366 25.26942,-2.90858 z"
id="path8"/>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
width="169.34801mm"
height="169.34801mm"
viewBox="0 0 600 600"
version="1.1"
id="svg1"
sodipodi:docname="U.svg"
inkscape:export-filename="U.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns="http://www.w3.org/2000/svg">
<defs
id="defs1"/>
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:document-units="mm">
<inkscape:page
x="0"
y="0"
width="600"
height="600"
id="page2"
margin="0"
bleed="0"/>
</sodipodi:namedview>
<path
id="Selection"
fill="none"
stroke="#000000"
stroke-width="1"
d="m 275,0.21 c 0,0 42,0 42,0 0,0 19,1.51 19,1.51 29.13,3.58 56.99,10.83 84,22.43 33.64,14.45 59.89,32.91 86.91,57.41 17.38,15.76 34.67,37.56 47.14,57.44 22.78,36.31 37.1,74.56 43.22,117 1.28,8.88 2.72,19.08 2.73,28 0,0 0,34 0,34 0,0 -0.91,10 -0.91,10 -2.36,32.29 -11.93,67.59 -25.4,97 -27.01,58.98 -70.49,105.42 -126.69,137.57 -34.3,19.63 -79.56,33.64 -119,36.52 0,0 -12,0.91 -12,0.91 0,0 -34,0 -34,0 0,0 -10,-0.91 -10,-0.91 -26.57,-1.94 -53.09,-8.27 -78,-17.67 C 163.49,569.9 134.12,553.46 109,532.57 79.87,508.33 54.41,478.39 36.31,445 -5.08,368.65 -11.86,276.57 18.05,195 47.85,113.75 113.21,48.92 194,18.42 213.55,11.04 236.32,5.43 257,2.43 Z"
style="display:inline;fill:#4a8fd8;fill-opacity:1"/>
<path
style="display:inline;fill:#3266af;fill-opacity:1;stroke:#000000;stroke-width:1.06525;stroke-opacity:1"
d="m 275.20608,536.5693 c -58.69596,-9.5447 -107.01545,-50.69962 -125.66779,-107.0344 -9.25532,-27.95342 -10.39669,-58.82111 -3.22092,-87.1088 5.31307,-20.94475 9.06296,-28.00552 81.87785,-154.17 38.54798,-66.79109 70.40461,-121.77997 70.79251,-122.19751 1.00535,-1.08215 140.3595,240.63696 145.26785,251.97682 8.6735,20.03855 12.6923,39.82747 12.6923,62.49805 0,44.25387 -16.70161,83.24077 -48.85852,114.0514 -21.46938,20.57055 -45.69209,33.39124 -76.46586,40.47213 -12.83139,2.95245 -42.64639,3.75165 -56.41742,1.51231 z"
id="path2"
sodipodi:nodetypes="ssssssssss"/>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="169.34801mm"
height="169.34801mm"
viewBox="0 0 600 600"
version="1.1"
id="svg1"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
sodipodi:docname="W.svg"
inkscape:export-filename="W.png"
xmlns="http://www.w3.org/2000/svg">
<defs
id="defs1"/>
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:document-units="mm">
<inkscape:page
x="0"
y="0"
width="600"
height="600"
id="page2"
margin="0"
bleed="0"/>
</sodipodi:namedview>
<path
id="Selection"
fill="none"
stroke="#000000"
stroke-width="1"
d="m 275,0.21 c 0,0 42,0 42,0 0,0 19,1.51 19,1.51 29.13,3.58 56.99,10.83 84,22.43 33.64,14.45 59.89,32.91 86.91,57.41 17.38,15.76 34.67,37.56 47.14,57.44 22.78,36.31 37.1,74.56 43.22,117 1.28,8.88 2.72,19.08 2.73,28 0,0 0,34 0,34 0,0 -0.91,10 -0.91,10 -2.36,32.29 -11.93,67.59 -25.4,97 -27.01,58.98 -70.49,105.42 -126.69,137.57 -34.3,19.63 -79.56,33.64 -119,36.52 0,0 -12,0.91 -12,0.91 0,0 -34,0 -34,0 0,0 -10,-0.91 -10,-0.91 -26.57,-1.94 -53.09,-8.27 -78,-17.67 C 163.49,569.9 134.12,553.46 109,532.57 79.87,508.33 54.41,478.39 36.31,445 -5.08,368.65 -11.86,276.57 18.05,195 47.85,113.75 113.21,48.92 194,18.42 213.55,11.04 236.32,5.43 257,2.43 Z"
style="display:inline;fill:#ffefb3;fill-opacity:1"/>
<path
id="circle8"
d="M 387.28106,302.711 A 85.962512,85.962512 0 0 1 301.31852,388.67353 85.962512,85.962512 0 0 1 215.35597,302.711 85.962512,85.962512 0 0 1 301.31852,216.74844 85.962512,85.962512 0 0 1 387.28106,302.711 Z M 191.75349,358.6114 143.05798,460.97151 245.4181,412.27601 A 121.73882,121.73882 0 0 1 191.75349,358.6114 Z M 178.33753,302.711 c 0,-13.16763 2.23687,-25.83857 5.96271,-38.01232 L 77.71657,302.711 184.30024,340.7233 a 119.25435,119.25435 0 0 1 -5.96271,-38.0123 z m 178.8814,109.56501 102.36011,48.6955 -48.6955,-102.36011 a 121.73882,121.73882 0 0 1 -53.66461,53.66461 z m -55.90041,13.41595 c -13.16762,0 -26.0869,-2.23687 -38.01232,-5.9627 l 38.01232,106.58368 38.01231,-106.58368 a 119.25435,119.25435 0 0 1 -38.01231,5.9627 z m 109.56502,-178.88139 48.6955,-102.36012 -102.36011,48.69551 a 122.98106,122.98106 0 0 1 53.66461,53.66461 z M 245.66643,193.14596 143.30658,144.45045 192.00209,246.81057 a 121.73882,121.73882 0 0 1 53.66434,-53.66461 z M 524.92046,302.711 418.33679,264.69868 a 119.25435,119.25435 0 0 1 0,76.02462 z M 301.31852,179.73 c 13.16761,0 26.0869,2.23688 38.01231,5.96271 L 301.31852,79.109036 263.3062,185.69271 A 119.25435,119.25435 0 0 1 301.31852,179.73 Z"
style="fill:#b4a35e;fill-opacity:1;stroke:#000000;stroke-width:1.09833;stroke-dasharray:none;stroke-opacity:1"/>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g><path d="M586.9,373.6l95.6-84.4c-49.6-39.2-129.4-79.1-198.2-79.1c-134.9,0-248.2,90.5-280.2,212.8L10.6,374.5C64.4,168.3,255.2,15.8,482.5,15.8c126.7,0,258.8,63.7,345.4,141.4l90.8-80.1L990,479.6L586.9,373.6z M317.5,710.8c49.6,39.2,129.4,79.1,198.2,79.1c134.9,0,248.2-90.5,280.2-212.8l193.5,48.5c-53.7,206.2-244.6,358.7-471.9,358.7c-126.7,0-258.8-63.7-345.4-141.4l-90.8,80.1L10,520.4l403.1,106L317.5,710.8z"/></g>
</svg>

After

Width:  |  Height:  |  Size: 797 B

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="1200pt" height="1200pt" version="1.1" viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg">
<path transform="scale(50)" d="m17 16h4v-8h-4" fill="none" stroke="#000" stroke-miterlimit="10" stroke-width="2"/>
<path transform="scale(50)" d="m12 8h-9v8h9" fill="none" stroke="#000" stroke-miterlimit="10" stroke-width="2"/>
<path transform="scale(50)" d="m6 12h5" fill="none" stroke="#000" stroke-miterlimit="10" stroke-width="2"/>
<path transform="scale(50)" d="m20 4h-2c-1.1 0-2 0.9-2 2v12c0 1.1 0.9 2 2 2h2" fill="none" stroke="#000"
stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"/>
<path transform="scale(50)" d="m12 20h2c1.1 0 2-0.9 2-2v-12c0-1.1-0.9-2-2-2h-2" fill="none" stroke="#000"
stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View File

@@ -1,99 +1,222 @@
<tips>
<tip>
<title>Tip of the Day</title>
<text>Tip of the Day is a new feature to Cockatrice that allows users to get information about the newest features of the program and some of the most commonly asked questions!</text>
<image>tip_of_the_day.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Suggesting New Tips</title>
<text>You can suggest new Tips of the Day by reaching out to the development team on &lt;a href="https://discord.gg/3Z9yzmA"&gt;Discord&lt;/a&gt;!</text>
<image>discord.png</image>
<date>2023-10-18</date>
</tip>
<tip>
<title>Reporting Bugs</title>
<text>If you encounter a bug while using Cockatrice, you can report the bug to the development team via &lt;a href="https://github.com/cockatrice/cockatrice/issues"&gt;GitHub&lt;a&gt;</text>
<image>github_logo.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>FAQ/Troubleshooting Wiki</title>
<text>You can find answers to the most common questions and some helpful Cockatrice toubleshooting over on the &lt;a href="https://github.com/cockatrice/cockatrice/wiki"&gt;GitHub wiki&lt;a&gt;</text>
<image>cockatrice_wiki.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Register for a Server</title>
<text>Click on either Cockatrice (Windows) or Actions (Mac) and then Register to server... When the dialogue appears, fill out the desired server information.</text>
<image>cockatrice_register.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Drawing Arrows</title>
<text>You can draw arrows of different color by holding a combination of keys!
Right Click: Red Arrow
Shift + Right Click: Green Arrow
Alt + Right Click: Blue Arrow
Cmd + Right Click: Yellow Arrow
</text>
<image>arrows.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Filtering Games</title>
<text>Don't see all the active games? Want to see a smaller selection? Use the Game Filters to change your horizon</text>
<image>filter_games.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Upload Custom Avatar</title>
<text>Want to show off your hippo avatar? Need to update your password? Check out the Accounts Tab for more info!</text>
<image>accounts_tab.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Common Shortcuts</title>
<text>You can find a full list of shortcuts &lt;a href="https://github.com/Cockatrice/Cockatrice/wiki/Custom-Keyboard-Shortcuts"&gt;on the wiki&lt;/a&gt;, but a short list:
&lt;br&gt;Roll a die: CTRL + I
&lt;br&gt;Mulligan: CTRL + M
&lt;br&gt;Draw a card: CTRL + D
&lt;br&gt;Undo a draw: CTRL + SHIFT + D
&lt;br&gt;View Sideboard: CTRL + F3
&lt;br&gt;Change Life: CTRL + L
&lt;br&gt;All shortcuts can be customized via Settings->Shortcuts!
</text>
<image>shortcuts.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Changing Themes</title>
<text>Did you know Cockatrice has custom themes? You can either &lt;a href="https://github.com/Cockatrice/Cockatrice/wiki/Themes"&gt;create one yourself&lt;/a&gt; or use one of the several pre-loaded ones! Go to Settings->Appearance and try them out!</text>
<image>themes.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Flip of the Coin</title>
<text>You can flip a coin instead of rolling a die by rolling a 2 sided die instead!</text>
<image>coin_flip.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Face Down Cards</title>
<text>You can hold Shift while dragging or clicking on a card to have it enter play face down</text>
<image>face_down.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Counter expressions</title>
<text>When setting a counter value, you can type a math expression in the box and the counter will be set to the result.&lt;br&gt;The "x" variable contains the current counter value.</text>
<image>counter_expression.png</image>
<date>2019-02-02</date>
</tip>
<tip>
<title>Power and Toughness</title>
<text>You can add and subtract to a creature's stats.&lt;br&gt;With a card selected, set the power and toughness ( default: ctrl + p ) and enter +3/-1 to increase power by three while decreasing toughness by one.&lt;br&gt;You can also reset it to the original value ( default: ctrl + alt + 0 ).</text>
<image>setpt.png</image>
<date>2019-03-02</date>
</tip>
<tip>
<title>Tip of the Day</title>
<text>Tip of the Day is a feature to Cockatrice that allows users to get information about the newest features of the program and some of the most commonly asked questions!
Check back in with major updates for new tips to be added or old tips to be updated as features are added or expanded upon!
</text>
<image>tip_of_the_day.png</image>
<date>2025-02-10</date>
</tip>
<tip>
<title>Join the Community</title>
<text>You can join the community to find games, interact with other players, suggest new 'Tips of the Day' and provide user feedback to the development or support teams on &lt;a href="https://discord.gg/3Z9yzmA"&gt;Discord&lt;/a&gt;!</text>
<image>discord.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>Reporting Bugs and Requesting Features</title>
<text>If you encounter a bug while using Cockatrice, you can report the bug to and request the feature from the development team via &lt;a href="https://github.com/cockatrice/cockatrice/issues"&gt;GitHub&lt;a&gt;</text>
<image>github_logo.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>FAQ/Troubleshooting Wiki</title>
<text>You can find answers to the most common questions and some helpful Cockatrice troubleshooting over on the &lt;a href="https://github.com/cockatrice/cockatrice/wiki"&gt;GitHub wiki&lt;a&gt;</text>
<image>cockatrice_wiki.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Register for a Server</title>
<text>Click on either Cockatrice (Windows) or Actions (Mac) and then Register to server... When the dialogue appears, fill out the desired server information.</text>
<image>cockatrice_register.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Filtering Games</title>
<text>Don't see an open game or want to see a smaller selection? Use the Game Filters to change your horizon!</text>
<image>filter_games.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>Common Shortcuts</title>
<text>You can find a full list of default shortcuts &lt;a href="https://github.com/Cockatrice/Cockatrice/wiki/Custom-Keyboard-Shortcuts"&gt;on the wiki&lt;/a&gt; or in Settings -> Shortcuts, but a short list:
&lt;ul&gt;
&lt;li&gt;Roll a die: CMD/CTRL + I&lt;/li&gt;
&lt;li&gt;Mulligan: CMD/CTRL + M&lt;/li&gt;
&lt;li&gt;Draw 1 / X card(s): CMD/CTRL + D / E&lt;/li&gt;
&lt;li&gt;Undo a draw: CMD/CTRL + SHIFT + D&lt;/li&gt;
&lt;li&gt;View Library / Sideboard: F3 / CMD/CTRL + F3&lt;/li&gt;
&lt;li&gt;Change Life: CMD/CTRL + L&lt;/li&gt;
&lt;li&gt;Show Card Info: Middle Mouse Click&lt;/li&gt;
&lt;/ul&gt;
All shortcuts can be customized via Cockatrice -> Settings -> Shortcuts!
</text>
<image>shortcuts.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>Power and Toughness</title>
<text>You can add and subtract to a creature's stats.
With a card selected, with the following keybindings:
&lt;ul&gt;
&lt;li&gt;Set P/T to any value: CTRL + P&lt;/li&gt;
&lt;li&gt;+1 or -1 to both to P/T: CMD/CTRL + ALT + '+' or '-'&lt;/li&gt;
&lt;li&gt;+1 or -1 to Power Only: CMD/CTRL + '+' or '-'&lt;/li&gt;
&lt;li&gt;+1 or -1 to Toughness Only: ALT + '+' or '-'&lt;/li&gt;
&lt;li&gt;Set P/T to Default: CMD/CTRL + ALT + 0&lt;/li&gt;
&lt;/ul&gt;
All shortcuts can be customized via Cockatrice -> Settings -> Shortcuts!
</text>
<image>setpt.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>Drawing Arrows</title>
<text>You can draw arrows of different color by holding a combination of keys!
&lt;ul&gt;
&lt;li&gt;Right Click: Red Arrow&lt;/li&gt;
&lt;li&gt;SHIFT + Right Click: Green Arrow&lt;/li&gt;
&lt;li&gt;ALT + Right Click: Blue Arrow&lt;/li&gt;
&lt;li&gt;CMD/CTRL + Right Click: Yellow Arrow&lt;/li&gt;
&lt;/ul&gt;
</text>
<image>arrows.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>General Etiquette</title>
<text>When playing on Cockatrice there are general "rules of engagement" for a better play experience for all players.
The following are some of the expectations a player should reasonably expect for how to operate smooth and enjoyable games:
&lt;ul&gt;
&lt;li&gt;Have a "Rule 0" conversation pre-game with your fellow players on the expectations of the game including deck strength, house rules (e.g. no take backs and "may is not must"), etc.&lt;/li&gt;
&lt;li&gt;When rolling your die for turn order, it is often best to create a token with the text of your roll (using CTRL + T and typing the number into "Name") and then tap this token when created to show that you have resolved your mulligans and are ready to start the game.&lt;/li&gt;
&lt;li&gt;Use the phases and steps trackers on the left of the client to show others where in the turn you are and announce when moving between them. (Double Click for the action of this button)&lt;/li&gt;
&lt;li&gt;When your turn is over leave it on your end step and DO NOT HIT PASS. Allow other players to respond if they can, and then if not, let the next player pass to themselves.&lt;/li&gt;
&lt;li&gt;Please treat others kindly and respect as per &lt;a href="https://cockatrice.us/terms.php"&gt;our Terms of Service&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</text>
<image>token.png</image>
<date>2025-02-10</date>
</tip>
<tip>
<title>Flip of the Coin</title>
<text>You can flip a coin instead of rolling a die by rolling a 2 sided die instead!</text>
<image>coin_flip.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Upload Custom Avatar</title>
<text>Want to show off your hippo avatar? Need to update your password? Check out the Accounts Tab for more info!</text>
<image>accounts_tab.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Player Icon Key</title>
<text>Besides your name is a player icon, this is a key for what they mean:
&lt;ul&gt;
&lt;li&gt;Flag: Country of Origin Player Selected&lt;/li&gt;
&lt;li&gt;Purple Heart: Donator (&lt;a href="https://cockatrice.us/donate"&gt;Help support us and donate here!&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Gold Star: VIP (Special Admin Given Role)&lt;/li&gt;
&lt;li&gt;Brown Gavel (Hammer): Judge / Rule's Lawyer&lt;/li&gt;
&lt;li&gt;Black/White Pawn: Moderator (Support for Client Issues)&lt;/li&gt;
&lt;li&gt;Red: Administrator (Sever Operators)&lt;/li&gt;
&lt;/ul&gt;
</text>
<image>pawns.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>Changing Themes</title>
<text>Did you know Cockatrice has custom themes? You can either &lt;a href="https://github.com/Cockatrice/Cockatrice/wiki/Themes"&gt;create one yourself&lt;/a&gt; or use one of the several preloaded ones! Go to Settings->Appearance and try them out!</text>
<image>themes.png</image>
<date>2018-03-01</date>
</tip>
<tip>
<title>Face Down Cards</title>
<text>You can hold Shift while dragging or clicking on a card to have it enter play face down.
You can also hold CTRL + SHIFT and click and drag from your library to move bottom card face down as well!
</text>
<image>face_down.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>Counter expressions</title>
<text>When setting a counter value, you can type a math expression in the box and the counter will be set to the result.&lt;br&gt;The "x" variable contains the current counter value.</text>
<image>counter_expression.png</image>
<date>2019-02-02</date>
</tip>
<tip>
<title>Select Multiple Cards</title>
<text>You can click and drag in any zone in order to highlight all cards within the created box.
You can also hold CMD/CTRL and clik or click and drag to maintain other previously selected cards while adding others!
You can move, alter and attach multiple highlighted cards at the same time!
Other useful multi-select keybindings:
&lt;ul&gt;
&lt;li&gt;Select All Cards in Zone: CMD/CTRL + A&lt;/li&gt;
&lt;li&gt;Select All Cards in Column: CMD/CTRL + SHIFT + C&lt;/li&gt;
&lt;li&gt;Select All Cards in Row: CMD/CTRL + SHIFT + X&lt;/li&gt;
&lt;/ul&gt;
</text>
<image>highlight_cards.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>Auto Cascade and Search Parameters</title>
<text>You can use the default keybind of CMD/CTRL + SHIFT + Y in order to perform auto cascade or similar effects from your library using Scryfall search syntax.
If you are unfamiliar with the syntax you may find it by opening a deck in deck editor and clicking the "i" next to the search bar in order to pull up a list of syntax commands.
This same syntax can be used in the deck editor search bar as well to help you find the best cards for your decks!
</text>
<image>syntax_help.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>Visual Deck Storage and Tags</title>
<text>You can now view your saved decks visually with integrated folder,tags and filter support!
Pro Tip: If you want to use emoji's press WinKey + '.' or CTRL + CMD + SPACE on Windows or Mac respectively!
</text>
<image>visual_deck_tags.png</image>
<date>2025-02-09</date>
</tip>
<tip>
<title>Card Selector And Card Preferences</title>
<text>Cockatrice's deck editor now has the ability for players to bling out their decks by selecting the arts for cards on a per-card basis!
You can also have multiple printings of the same card in your deck if you so choose!
Not only that, other players will see the arts you have chosen by default!
If you want to disable this feature for other players: Settings -> Appearance -> Select "Override all card art with personal set preference"
</text>
<image>card_select.png</image>
<date>2025-02-10</date>
</tip>
<tip>
<title>EDHREC Integration</title>
<text>We now have in-client integration for EDHREC, which allows you to right-click on any card name in the deck editor in order to bring up the contextual menu for the card.</text>
<image>edhrec.png</image>
<date>2025-02-10</date>
</tip>
<tip>
<title>Add Cards to Deck</title>
<text>You can now right-click anywhere on a card in any card info view in order to add it to any decks you have open in your tabs.</text>
<image>add_card.png</image>
<date>2025-02-10</date>
</tip>
<tip>
<title>Update Client and Card Database</title>
<text>You can update your client by going to Help and selecting whichever you wish to update.
Client Update: Updates the client (if available) for new features, fixes and changes.
Card Update: Updates card sources for spoilers and new card printings.
Updating your card sources can often fix issues of cards not working or displaying properly, if not, go to Cockatrice -> Settings -> Card Sources -> Update Spoilers
</text>
<image>updates.png</image>
<date>2025-02-10</date>
</tip>
<tip>
<title>Expand Card View Window</title>
<text>Double click on the title bar of the card view window to expand it! Double click again to shrink it back down.
You can configure the initial and expanded heights of the window in the settings, under "Appearance".
</text>
<image>expand_card_view.png</image>
<date>2025-02-27</date>
</tip>
</tips>

View File

@@ -0,0 +1,204 @@
#include "deck_editor_menu.h"
#include "../../../settings/cache_settings.h"
#include "../../../settings/shortcuts_settings.h"
DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), deckEditor(parent)
{
aNewDeck = new QAction(QString(), this);
connect(aNewDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actNewDeck);
aLoadDeck = new QAction(QString(), this);
connect(aLoadDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actLoadDeck);
loadRecentDeckMenu = new QMenu(this);
connect(&SettingsCache::instance().recents(), &RecentsSettings::recentlyOpenedDeckPathsChanged, this,
&DeckEditorMenu::updateRecentlyOpened);
aClearRecents = new QAction(QString(), this);
connect(aClearRecents, &QAction::triggered, this, &DeckEditorMenu::actClearRecents);
updateRecentlyOpened();
aSaveDeck = new QAction(QString(), this);
connect(aSaveDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actSaveDeck);
aSaveDeckAs = new QAction(QString(), this);
connect(aSaveDeckAs, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actSaveDeckAs);
aLoadDeckFromClipboard = new QAction(QString(), this);
connect(aLoadDeckFromClipboard, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actLoadDeckFromClipboard);
aEditDeckInClipboard = new QAction(QString(), this);
connect(aEditDeckInClipboard, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actEditDeckInClipboard);
aEditDeckInClipboardRaw = new QAction(QString(), this);
connect(aEditDeckInClipboardRaw, &QAction::triggered, deckEditor,
&AbstractTabDeckEditor::actEditDeckInClipboardRaw);
aSaveDeckToClipboard = new QAction(QString(), this);
connect(aSaveDeckToClipboard, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actSaveDeckToClipboard);
aSaveDeckToClipboardNoSetInfo = new QAction(QString(), this);
connect(aSaveDeckToClipboardNoSetInfo, &QAction::triggered, deckEditor,
&AbstractTabDeckEditor::actSaveDeckToClipboardNoSetInfo);
aSaveDeckToClipboardRaw = new QAction(QString(), this);
connect(aSaveDeckToClipboardRaw, &QAction::triggered, deckEditor,
&AbstractTabDeckEditor::actSaveDeckToClipboardRaw);
aSaveDeckToClipboardRawNoSetInfo = new QAction(QString(), this);
connect(aSaveDeckToClipboardRawNoSetInfo, &QAction::triggered, deckEditor,
&AbstractTabDeckEditor::actSaveDeckToClipboardRawNoSetInfo);
aPrintDeck = new QAction(QString(), this);
connect(aPrintDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actPrintDeck);
aExportDeckDecklist = new QAction(QString(), this);
connect(aExportDeckDecklist, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actExportDeckDecklist);
aExportDeckDecklistXyz = new QAction(QString(), this);
connect(aExportDeckDecklistXyz, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actExportDeckDecklistXyz);
aAnalyzeDeckDeckstats = new QAction(QString(), this);
connect(aAnalyzeDeckDeckstats, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actAnalyzeDeckDeckstats);
aAnalyzeDeckTappedout = new QAction(QString(), this);
connect(aAnalyzeDeckTappedout, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actAnalyzeDeckTappedout);
analyzeDeckMenu = new QMenu(this);
analyzeDeckMenu->addAction(aExportDeckDecklist);
analyzeDeckMenu->addAction(aExportDeckDecklistXyz);
analyzeDeckMenu->addSeparator();
analyzeDeckMenu->addAction(aAnalyzeDeckDeckstats);
analyzeDeckMenu->addAction(aAnalyzeDeckTappedout);
aClose = new QAction(QString(), this);
connect(aClose, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::closeRequest);
editDeckInClipboardMenu = new QMenu(this);
editDeckInClipboardMenu->addAction(aEditDeckInClipboard);
editDeckInClipboardMenu->addAction(aEditDeckInClipboardRaw);
saveDeckToClipboardMenu = new QMenu(this);
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboard);
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboardNoSetInfo);
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboardRaw);
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboardRawNoSetInfo);
addAction(aNewDeck);
addAction(aLoadDeck);
addMenu(loadRecentDeckMenu);
addAction(aSaveDeck);
addAction(aSaveDeckAs);
addSeparator();
addAction(aLoadDeckFromClipboard);
addMenu(editDeckInClipboardMenu);
addMenu(saveDeckToClipboardMenu);
addSeparator();
addAction(aPrintDeck);
addMenu(analyzeDeckMenu);
addSeparator();
addAction(deckEditor->filterDockWidget->aClearFilterOne);
addAction(deckEditor->filterDockWidget->aClearFilterAll);
addSeparator();
addAction(aClose);
retranslateUi();
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&DeckEditorMenu::refreshShortcuts);
refreshShortcuts();
}
void DeckEditorMenu::setSaveStatus(bool newStatus)
{
aSaveDeck->setEnabled(newStatus);
aSaveDeckAs->setEnabled(newStatus);
aSaveDeckToClipboard->setEnabled(newStatus);
aSaveDeckToClipboardNoSetInfo->setEnabled(newStatus);
aSaveDeckToClipboardRaw->setEnabled(newStatus);
aSaveDeckToClipboardRawNoSetInfo->setEnabled(newStatus);
saveDeckToClipboardMenu->setEnabled(newStatus);
aPrintDeck->setEnabled(newStatus);
analyzeDeckMenu->setEnabled(newStatus);
}
void DeckEditorMenu::updateRecentlyOpened()
{
loadRecentDeckMenu->clear();
for (const auto &deckPath : SettingsCache::instance().recents().getRecentlyOpenedDeckPaths()) {
QAction *aRecentlyOpenedDeck = new QAction(deckPath, this);
loadRecentDeckMenu->addAction(aRecentlyOpenedDeck);
connect(aRecentlyOpenedDeck, &QAction::triggered, deckEditor,
[=, this] { deckEditor->actOpenRecent(aRecentlyOpenedDeck->text()); });
}
loadRecentDeckMenu->addSeparator();
loadRecentDeckMenu->addAction(aClearRecents);
aClearRecents->setEnabled(SettingsCache::instance().recents().getRecentlyOpenedDeckPaths().length() > 0);
}
void DeckEditorMenu::actClearRecents()
{
SettingsCache::instance().recents().clearRecentlyOpenedDeckPaths();
}
void DeckEditorMenu::retranslateUi()
{
setTitle(tr("&Deck Editor"));
aNewDeck->setText(tr("&New deck"));
aLoadDeck->setText(tr("&Load deck..."));
loadRecentDeckMenu->setTitle(tr("Load recent deck..."));
aClearRecents->setText(tr("Clear"));
aSaveDeck->setText(tr("&Save deck"));
aSaveDeckAs->setText(tr("Save deck &as..."));
aLoadDeckFromClipboard->setText(tr("Load deck from cl&ipboard..."));
editDeckInClipboardMenu->setTitle(tr("Edit deck in clipboard"));
aEditDeckInClipboard->setText(tr("Annotated"));
aEditDeckInClipboardRaw->setText(tr("Not Annotated"));
saveDeckToClipboardMenu->setTitle(tr("Save deck to clipboard"));
aSaveDeckToClipboard->setText(tr("Annotated"));
aSaveDeckToClipboardNoSetInfo->setText(tr("Annotated (No set info)"));
aSaveDeckToClipboardRaw->setText(tr("Not Annotated"));
aSaveDeckToClipboardRawNoSetInfo->setText(tr("Not Annotated (No set info)"));
aPrintDeck->setText(tr("&Print deck..."));
analyzeDeckMenu->setTitle(tr("&Send deck to online service"));
aExportDeckDecklist->setText(tr("Create decklist (decklist.org)"));
aExportDeckDecklistXyz->setText(tr("Create decklist (decklist.xyz)"));
aAnalyzeDeckDeckstats->setText(tr("Analyze deck (deckstats.net)"));
aAnalyzeDeckTappedout->setText(tr("Analyze deck (tappedout.net)"));
aClose->setText(tr("&Close"));
}
void DeckEditorMenu::refreshShortcuts()
{
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
aNewDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aNewDeck"));
aLoadDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aLoadDeck"));
aSaveDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeck"));
aSaveDeckAs->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeckAs"));
aLoadDeckFromClipboard->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aLoadDeckFromClipboard"));
aEditDeckInClipboard->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aEditDeckInClipboard"));
aEditDeckInClipboardRaw->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aEditDeckInClipboardRaw"));
aPrintDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aPrintDeck"));
aExportDeckDecklist->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aExportDeckDecklist"));
aExportDeckDecklistXyz->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aExportDeckDecklistXyz"));
aAnalyzeDeckDeckstats->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aAnalyzeDeck"));
aAnalyzeDeckTappedout->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aAnalyzeDeckTappedout"));
aClose->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClose"));
aSaveDeckToClipboard->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeckToClipboard"));
aSaveDeckToClipboardNoSetInfo->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeckToClipboardNoSetInfo"));
aSaveDeckToClipboardRaw->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeckToClipboardRaw"));
aSaveDeckToClipboardRawNoSetInfo->setShortcuts(
shortcuts.getShortcut("TabDeckEditor/aSaveDeckToClipboardRawNoSetInfo"));
aClose->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClose"));
}

View File

@@ -0,0 +1,32 @@
#ifndef DECK_EDITOR_MENU_H
#define DECK_EDITOR_MENU_H
#include "../../tabs/abstract_tab_deck_editor.h"
#include <QMenu>
class AbstractTabDeckEditor;
class DeckEditorMenu : public QMenu
{
Q_OBJECT
public:
explicit DeckEditorMenu(AbstractTabDeckEditor *parent);
AbstractTabDeckEditor *deckEditor;
QAction *aNewDeck, *aLoadDeck, *aClearRecents, *aSaveDeck, *aSaveDeckAs, *aLoadDeckFromClipboard,
*aEditDeckInClipboard, *aEditDeckInClipboardRaw, *aSaveDeckToClipboard, *aSaveDeckToClipboardNoSetInfo,
*aSaveDeckToClipboardRaw, *aSaveDeckToClipboardRawNoSetInfo, *aPrintDeck, *aExportDeckDecklist,
*aExportDeckDecklistXyz, *aAnalyzeDeckDeckstats, *aAnalyzeDeckTappedout, *aClose;
QMenu *loadRecentDeckMenu, *analyzeDeckMenu, *editDeckInClipboardMenu, *saveDeckToClipboardMenu;
void setSaveStatus(bool newStatus);
public slots:
void updateRecentlyOpened();
void actClearRecents();
void retranslateUi();
void refreshShortcuts();
};
#endif

View File

@@ -11,6 +11,11 @@
#include <QSysInfo>
#include <QtGlobal>
#if defined(Q_OS_MACOS)
#include <sys/sysctl.h>
#include <sys/types.h>
#endif
#define STABLERELEASE_URL "https://api.github.com/repos/Cockatrice/Cockatrice/releases/latest"
#define STABLEMANUALDOWNLOAD_URL "https://github.com/Cockatrice/Cockatrice/releases/latest"
#define STABLETAG_URL "https://api.github.com/repos/Cockatrice/Cockatrice/git/refs/tags/"
@@ -33,31 +38,42 @@ ReleaseChannel::~ReleaseChannel()
void ReleaseChannel::checkForUpdates()
{
QString releaseChannelUrl = getReleaseChannelUrl();
qCDebug(ReleaseChannelLog) << "Searching for updates on the channel: " << releaseChannelUrl;
qCInfo(ReleaseChannelLog) << "Searching for updates on the channel: " << releaseChannelUrl;
response = netMan->get(QNetworkRequest(releaseChannelUrl));
connect(response, &QNetworkReply::finished, this, &ReleaseChannel::releaseListFinished);
}
// Different release channel checking functions for different operating systems
#if defined(Q_OS_MACOS)
bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
{
static QRegularExpression version_regex("macOS-(\\d+)\\.(\\d+)");
#if defined(Q_OS_MACOS)
static QRegularExpression version_regex("macOS(\\d+)");
auto match = version_regex.match(fileName);
if (!match.hasMatch()) {
return false;
}
auto getSystemVersion = [] {
// QSysInfo does not go through translation layers
// We need to use sysctl to reliably detect the underlying architecture
char arch[255];
size_t len = sizeof(arch);
if (sysctlbyname("machdep.cpu.brand_string", arch, &len, nullptr, 0) == 0) {
// Intel mac is only supported on macOS 13 versions
if (QString::fromUtf8(arch).contains("Intel")) {
return 13;
}
}
return QSysInfo::productVersion().split(".")[0].toInt();
};
// older(smaller) releases are compatible with a newer or the same system version
int sys_maj = QSysInfo::productVersion().split(".")[0].toInt();
int sys_min = QSysInfo::productVersion().split(".")[1].toInt();
int sys_maj = getSystemVersion();
int rel_maj = match.captured(1).toInt();
int rel_min = match.captured(2).toInt();
return rel_maj < sys_maj || (rel_maj == sys_maj && rel_min <= sys_min);
}
return rel_maj == sys_maj;
#elif defined(Q_OS_WIN)
bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
{
#if Q_PROCESSOR_WORDSIZE == 4
return fileName.contains("32bit");
#elif Q_PROCESSOR_WORDSIZE == 8
@@ -68,16 +84,15 @@ bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
return fileName.contains("Win10");
}
#else
Q_UNUSED(fileName);
return false;
#endif
#else // If the OS doesn't fit one of the above #defines, then it will never match
Q_UNUSED(fileName);
return false;
#endif
}
#else
bool ReleaseChannel::downloadMatchesCurrentOS(const QString &)
{
// If the OS doesn't fit one of the above #defines, then it will never match
return false;
}
#endif
QString StableReleaseChannel::getManualDownloadUrl() const
{
@@ -101,7 +116,7 @@ void StableReleaseChannel::releaseListFinished()
QJsonDocument jsonResponse = QJsonDocument::fromJson(reply->readAll(), &parseError);
reply->deleteLater();
if (parseError.error != QJsonParseError::NoError) {
qWarning() << "No reply received from the release update server.";
qCWarning(ReleaseChannelLog) << "No reply received from the release update server.";
emit error(tr("No reply received from the release update server."));
return;
}
@@ -109,7 +124,7 @@ void StableReleaseChannel::releaseListFinished()
QVariantMap resultMap = jsonResponse.toVariant().toMap();
if (!(resultMap.contains("name") && resultMap.contains("html_url") && resultMap.contains("tag_name") &&
resultMap.contains("published_at"))) {
qWarning() << "Invalid received from the release update server:" << resultMap;
qCWarning(ReleaseChannelLog) << "Invalid received from the release update server:" << resultMap;
emit error(tr("Invalid reply received from the release update server."));
return;
}
@@ -123,37 +138,29 @@ void StableReleaseChannel::releaseListFinished()
if (resultMap.contains("assets")) {
auto rawAssets = resultMap["assets"].toList();
// [(name, url)]
QVector<std::pair<QString, QString>> assets;
std::transform(rawAssets.begin(), rawAssets.end(), std::back_inserter(assets), [](QVariant _asset) {
QVariantMap asset = _asset.toMap();
for (const auto &rawAsset : rawAssets) {
QVariantMap asset = rawAsset.toMap();
QString name = asset["name"].toString();
QString url = asset["browser_download_url"].toString();
return std::make_pair(name, url);
});
auto _releaseAsset = std::find_if(assets.begin(), assets.end(), [](std::pair<QString, QString> nameAndUrl) {
return downloadMatchesCurrentOS(nameAndUrl.first);
});
if (_releaseAsset != assets.end()) {
std::pair<QString, QString> releaseAsset = *_releaseAsset;
auto releaseUrl = releaseAsset.second;
lastRelease->setDownloadUrl(releaseUrl);
if (downloadMatchesCurrentOS(name)) {
lastRelease->setDownloadUrl(url);
break;
}
}
}
QString shortHash = lastRelease->getCommitHash().left(GIT_SHORT_HASH_LEN);
QString myHash = QString(VERSION_COMMIT);
qCDebug(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
qCInfo(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
qCDebug(ReleaseChannelLog) << "Got reply from release server, name=" << lastRelease->getName()
<< "desc=" << lastRelease->getDescriptionUrl()
<< "date=" << lastRelease->getPublishDate() << "url=" << lastRelease->getDownloadUrl();
qCInfo(ReleaseChannelLog) << "Got reply from release server, name=" << lastRelease->getName()
<< "desc=" << lastRelease->getDescriptionUrl() << "date=" << lastRelease->getPublishDate()
<< "url=" << lastRelease->getDownloadUrl();
const QString &tagName = resultMap["tag_name"].toString();
QString url = QString(STABLETAG_URL) + tagName;
qCDebug(ReleaseChannelLog) << "Searching for commit hash corresponding to stable channel tag: " << tagName;
qCInfo(ReleaseChannelLog) << "Searching for commit hash corresponding to stable channel tag: " << tagName;
response = netMan->get(QNetworkRequest(url));
connect(response, &QNetworkReply::finished, this, &StableReleaseChannel::tagListFinished);
}
@@ -165,24 +172,24 @@ void StableReleaseChannel::tagListFinished()
QJsonDocument jsonResponse = QJsonDocument::fromJson(reply->readAll(), &parseError);
reply->deleteLater();
if (parseError.error != QJsonParseError::NoError) {
qWarning() << "No reply received from the tag update server.";
qCWarning(ReleaseChannelLog) << "No reply received from the tag update server.";
emit error(tr("No reply received from the tag update server."));
return;
}
QVariantMap resultMap = jsonResponse.toVariant().toMap();
if (!(resultMap.contains("object") && resultMap["object"].toMap().contains("sha"))) {
qWarning() << "Invalid received from the tag update server.";
qCWarning(ReleaseChannelLog) << "Invalid received from the tag update server.";
emit error(tr("Invalid reply received from the tag update server."));
return;
}
lastRelease->setCommitHash(resultMap["object"].toMap()["sha"].toString());
qCDebug(ReleaseChannelLog) << "Got reply from tag server, commit=" << lastRelease->getCommitHash();
qCInfo(ReleaseChannelLog) << "Got reply from tag server, commit=" << lastRelease->getCommitHash();
QString shortHash = lastRelease->getCommitHash().left(GIT_SHORT_HASH_LEN);
QString myHash = QString(VERSION_COMMIT);
qCDebug(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
qCInfo(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
const bool needToUpdate = (QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0);
emit finishedCheck(needToUpdate, lastRelease->isCompatibleVersionFound(), lastRelease);
@@ -225,7 +232,7 @@ void BetaReleaseChannel::releaseListFinished()
QVariantMap resultMap = array.at(0).toObject().toVariantMap();
if (array.empty() || resultMap.empty()) {
qWarning() << "No reply received from the release update server:" << QString(jsonData);
qCWarning(ReleaseChannelLog) << "No reply received from the release update server:" << QString(jsonData);
emit error(tr("No reply received from the release update server."));
return;
}
@@ -234,7 +241,7 @@ void BetaReleaseChannel::releaseListFinished()
if (!resultMap.contains("assets") || !resultMap.contains("author") || !resultMap.contains("tag_name") ||
!resultMap.contains("target_commitish") || !resultMap.contains("assets_url") ||
!resultMap.contains("published_at")) {
qWarning() << "Invalid received from the release update server:" << resultMap;
qCWarning(ReleaseChannelLog) << "Invalid received from the release update server:" << resultMap;
emit error(tr("Invalid reply received from the release update server."));
return;
}
@@ -249,13 +256,13 @@ void BetaReleaseChannel::releaseListFinished()
lastRelease->setName(QString("%1 (%2)").arg(resultMap["tag_name"].toString()).arg(shortHash));
lastRelease->setDescriptionUrl(QString(BETARELEASE_CHANGESURL).arg(VERSION_COMMIT, shortHash));
qCDebug(ReleaseChannelLog) << "Got reply from release server, size=" << resultMap.size()
<< "name=" << lastRelease->getName() << "desc=" << lastRelease->getDescriptionUrl()
<< "commit=" << lastRelease->getCommitHash() << "date=" << lastRelease->getPublishDate();
qCInfo(ReleaseChannelLog) << "Got reply from release server, size=" << resultMap.size()
<< "name=" << lastRelease->getName() << "desc=" << lastRelease->getDescriptionUrl()
<< "commit=" << lastRelease->getCommitHash() << "date=" << lastRelease->getPublishDate();
QString betaBuildDownloadUrl = resultMap["assets_url"].toString();
qCDebug(ReleaseChannelLog) << "Searching for a corresponding file on the beta channel: " << betaBuildDownloadUrl;
qCInfo(ReleaseChannelLog) << "Searching for a corresponding file on the beta channel: " << betaBuildDownloadUrl;
response = netMan->get(QNetworkRequest(betaBuildDownloadUrl));
connect(response, &QNetworkReply::finished, this, &BetaReleaseChannel::fileListFinished);
}
@@ -267,7 +274,7 @@ void BetaReleaseChannel::fileListFinished()
QJsonDocument jsonResponse = QJsonDocument::fromJson(reply->readAll(), &parseError);
reply->deleteLater();
if (parseError.error != QJsonParseError::NoError) {
qWarning() << "No reply received from the file update server.";
qCWarning(ReleaseChannelLog) << "No reply received from the file update server.";
emit error(tr("No reply received from the file update server."));
return;
}
@@ -275,7 +282,7 @@ void BetaReleaseChannel::fileListFinished()
QVariantList resultList = jsonResponse.toVariant().toList();
QString shortHash = lastRelease->getCommitHash().left(GIT_SHORT_HASH_LEN);
QString myHash = QString(VERSION_COMMIT);
qCDebug(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
qCInfo(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
bool needToUpdate = (QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0);
bool compatibleVersion = false;
@@ -292,7 +299,7 @@ void BetaReleaseChannel::fileListFinished()
if (downloadMatchesCurrentOS(*url)) {
compatibleVersion = true;
lastRelease->setDownloadUrl(*url);
qCDebug(ReleaseChannelLog) << "Found compatible version url=" << *url;
qCInfo(ReleaseChannelLog) << "Found compatible version url=" << *url;
break;
}
}

View File

@@ -28,7 +28,7 @@ SpoilerBackgroundUpdater::SpoilerBackgroundUpdater(QObject *apParent) : QObject(
// File exists means we're in spoiler season
startSpoilerDownloadProcess(SPOILERS_STATUS_URL, false);
} else {
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoilers Disabled";
qCInfo(SpoilerBackgroundUpdaterLog) << "Spoilers Disabled";
}
}
@@ -67,7 +67,7 @@ void SpoilerBackgroundUpdater::actDownloadFinishedSpoilersFile()
reply->deleteLater();
emit spoilerCheckerDone();
} else {
qCDebug(SpoilerBackgroundUpdaterLog) << "Error downloading spoilers file" << errorCode;
qCWarning(SpoilerBackgroundUpdaterLog) << "Error downloading spoilers file" << errorCode;
emit spoilerCheckerDone();
}
}
@@ -81,11 +81,11 @@ bool SpoilerBackgroundUpdater::deleteSpoilerFile()
// Delete the spoiler.xml file
if (file.exists() && file.remove()) {
qCDebug(SpoilerBackgroundUpdaterLog) << "Deleting spoiler.xml";
qCInfo(SpoilerBackgroundUpdaterLog) << "Deleting spoiler.xml";
return true;
}
qCDebug(SpoilerBackgroundUpdaterLog) << "Error: Spoiler.xml not found or not deleted";
qCInfo(SpoilerBackgroundUpdaterLog) << "Error: Spoiler.xml not found or not deleted";
return false;
}
@@ -101,24 +101,24 @@ void SpoilerBackgroundUpdater::actCheckIfSpoilerSeasonEnabled()
trayIcon->showMessage(tr("Spoilers season has ended"), tr("Deleting spoiler.xml. Please run Oracle"));
}
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Season Offline";
qCInfo(SpoilerBackgroundUpdaterLog) << "Spoiler Season Offline";
emit spoilerCheckerDone();
} else if (errorCode == QNetworkReply::NoError) {
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Service Online";
qCInfo(SpoilerBackgroundUpdaterLog) << "Spoiler Service Online";
startSpoilerDownloadProcess(SPOILERS_URL, true);
} else if (errorCode == QNetworkReply::HostNotFoundError) {
if (trayIcon) {
trayIcon->showMessage(tr("Spoilers download failed"), tr("No internet connection"));
}
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler download failed due to no internet connection";
qCWarning(SpoilerBackgroundUpdaterLog) << "Spoiler download failed due to no internet connection";
emit spoilerCheckerDone();
} else {
if (trayIcon) {
trayIcon->showMessage(tr("Spoilers download failed"), tr("Error") + " " + (short)errorCode);
}
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler download failed with reason" << errorCode;
qCWarning(SpoilerBackgroundUpdaterLog) << "Spoiler download failed with reason" << errorCode;
emit spoilerCheckerDone();
}
}
@@ -139,19 +139,19 @@ bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
trayIcon->showMessage(tr("Spoilers already up to date"), tr("No new spoilers added"));
}
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoilers Up to Date";
qCInfo(SpoilerBackgroundUpdaterLog) << "Spoilers Up to Date";
return false;
}
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly)) {
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Service Error: File open (w) failed for" << fileName;
qCWarning(SpoilerBackgroundUpdaterLog) << "Spoiler Service Error: File open (w) failed for" << fileName;
file.close();
return false;
}
if (file.write(data) == -1) {
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Service Error: File write (w) failed for" << fileName;
qCWarning(SpoilerBackgroundUpdaterLog) << "Spoiler Service Error: File write (w) failed for" << fileName;
file.close();
return false;
}
@@ -159,7 +159,7 @@ bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
file.close();
// Data written, so reload the card database
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Service Data Written";
qCInfo(SpoilerBackgroundUpdaterLog) << "Spoiler Service Data Written";
const auto reloadOk = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
// If the user has notifications enabled, let them know
@@ -202,12 +202,12 @@ QByteArray SpoilerBackgroundUpdater::getHash(const QString fileName)
QCryptographicHash hash(QCryptographicHash::Algorithm::Md5);
hash.addData(bytes);
qCDebug(SpoilerBackgroundUpdaterLog) << "File Hash =" << hash.result();
qCInfo(SpoilerBackgroundUpdaterLog) << "File Hash =" << hash.result();
file.close();
return hash.result();
} else {
qCDebug(SpoilerBackgroundUpdaterLog) << "getHash ReadOnly failed!";
qCWarning(SpoilerBackgroundUpdaterLog) << "getHash ReadOnly failed!";
file.close();
return QByteArray();
}
@@ -221,7 +221,7 @@ QByteArray SpoilerBackgroundUpdater::getHash(QByteArray data)
QCryptographicHash hash(QCryptographicHash::Algorithm::Md5);
hash.addData(bytes);
qCDebug(SpoilerBackgroundUpdaterLog) << "Data Hash =" << hash.result();
qCInfo(SpoilerBackgroundUpdaterLog) << "Data Hash =" << hash.result();
return hash.result();
}

View File

@@ -37,7 +37,7 @@ SoundEngine::~SoundEngine()
void SoundEngine::soundEnabledChanged()
{
if (SettingsCache::instance().getSoundEnabled()) {
qCDebug(SoundEngineLog) << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
qCInfo(SoundEngineLog) << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
if (!player) {
player = new QMediaPlayer;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
@@ -46,7 +46,7 @@ void SoundEngine::soundEnabledChanged()
#endif
}
} else {
qCDebug(SoundEngineLog) << "SoundEngine: disabling sound";
qCInfo(SoundEngineLog) << "SoundEngine: disabling sound";
if (player) {
player->stop();
player->deleteLater();
@@ -90,7 +90,7 @@ void SoundEngine::ensureThemeDirectoryExists()
{
if (SettingsCache::instance().getSoundThemeName().isEmpty() ||
!getAvailableThemes().contains(SettingsCache::instance().getSoundThemeName())) {
qCDebug(SoundEngineLog) << "Sounds theme name not set, setting default value";
qCInfo(SoundEngineLog) << "Sounds theme name not set, setting default value";
SettingsCache::instance().setSoundThemeName(DEFAULT_THEME_NAME);
}
}
@@ -131,7 +131,7 @@ QStringMap &SoundEngine::getAvailableThemes()
void SoundEngine::themeChangedSlot()
{
QString themeName = SettingsCache::instance().getSoundThemeName();
qCDebug(SoundEngineLog) << "Sound theme changed:" << themeName;
qCInfo(SoundEngineLog) << "Sound theme changed:" << themeName;
QDir dir = getAvailableThemes().value(themeName);

View File

@@ -0,0 +1,581 @@
#include "abstract_tab_deck_editor.h"
#include "../../client/game_logic/abstract_client.h"
#include "../../client/tapped_out_interface.h"
#include "../../client/ui/widgets/cards/card_info_frame_widget.h"
#include "../../deck/deck_stats_interface.h"
#include "../../dialogs/dlg_load_deck.h"
#include "../../dialogs/dlg_load_deck_from_clipboard.h"
#include "../../game/cards/card_database_manager.h"
#include "../../game/cards/card_database_model.h"
#include "../../server/pending_command.h"
#include "../../settings/cache_settings.h"
#include "../ui/picture_loader/picture_loader.h"
#include "../ui/pixel_map_generator.h"
#include "pb/command_deck_upload.pb.h"
#include "pb/response.pb.h"
#include "tab_supervisor.h"
#include "trice_limits.h"
#include <QAction>
#include <QApplication>
#include <QClipboard>
#include <QCloseEvent>
#include <QDebug>
#include <QDesktopServices>
#include <QDir>
#include <QFileDialog>
#include <QHeaderView>
#include <QLineEdit>
#include <QMenuBar>
#include <QMessageBox>
#include <QPrintPreviewDialog>
#include <QPrinter>
#include <QProcessEnvironment>
#include <QPushButton>
#include <QRegularExpression>
#include <QSplitter>
#include <QTextStream>
#include <QTreeView>
#include <QUrl>
AbstractTabDeckEditor::AbstractTabDeckEditor(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
{
setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks);
databaseDisplayDockWidget = new DeckEditorDatabaseDisplayWidget(this);
deckDockWidget = new DeckEditorDeckDockWidget(this);
cardInfoDockWidget = new DeckEditorCardInfoDockWidget(this);
filterDockWidget = new DeckEditorFilterDockWidget(this);
printingSelectorDockWidget = new DeckEditorPrintingSelectorDockWidget(this);
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckChanged, this, &AbstractTabDeckEditor::onDeckChanged);
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckModified, this, &AbstractTabDeckEditor::onDeckModified);
connect(deckDockWidget, &DeckEditorDeckDockWidget::cardChanged, this, &AbstractTabDeckEditor::updateCard);
connect(this, &AbstractTabDeckEditor::decrementCard, deckDockWidget, &DeckEditorDeckDockWidget::actDecrementCard);
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::cardChanged, this,
&AbstractTabDeckEditor::updateCard);
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::addCardToMainDeck, this,
&AbstractTabDeckEditor::actAddCard);
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::addCardToSideboard, this,
&AbstractTabDeckEditor::actAddCardToSideboard);
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::decrementCardFromMainDeck, this,
&AbstractTabDeckEditor::actDecrementCard);
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::decrementCardFromSideboard, this,
&AbstractTabDeckEditor::actDecrementCardFromSideboard);
connect(filterDockWidget, &DeckEditorFilterDockWidget::clearAllDatabaseFilters, databaseDisplayDockWidget,
&DeckEditorDatabaseDisplayWidget::clearAllDatabaseFilters);
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&AbstractTabDeckEditor::refreshShortcuts);
}
void AbstractTabDeckEditor::updateCard(CardInfoPtr _card)
{
cardInfoDockWidget->updateCard(_card);
printingSelectorDockWidget->printingSelector->setCard(_card, DECK_ZONE_MAIN);
}
void AbstractTabDeckEditor::onDeckChanged()
{
}
void AbstractTabDeckEditor::onDeckModified()
{
setModified(!isBlankNewDeck());
deckMenu->setSaveStatus(!isBlankNewDeck());
}
void AbstractTabDeckEditor::addCardHelper(const CardInfoPtr info, QString zoneName)
{
if (!info)
return;
if (info->getIsToken())
zoneName = DECK_ZONE_TOKENS;
QModelIndex newCardIndex = deckDockWidget->deckModel->addPreferredPrintingCard(info->getName(), zoneName, false);
// recursiveExpand(newCardIndex);
deckDockWidget->deckView->clearSelection();
deckDockWidget->deckView->setCurrentIndex(newCardIndex);
setModified(true);
databaseDisplayDockWidget->searchEdit->setSelection(0, databaseDisplayDockWidget->searchEdit->text().length());
}
void AbstractTabDeckEditor::actAddCard(CardInfoPtr info)
{
if (QApplication::keyboardModifiers() & Qt::ControlModifier)
actAddCardToSideboard(info);
else
addCardHelper(info, DECK_ZONE_MAIN);
deckMenu->setSaveStatus(true);
}
void AbstractTabDeckEditor::actAddCardToSideboard(CardInfoPtr info)
{
addCardHelper(info, DECK_ZONE_SIDE);
deckMenu->setSaveStatus(true);
}
void AbstractTabDeckEditor::actDecrementCard(CardInfoPtr info)
{
emit decrementCard(info, DECK_ZONE_MAIN);
}
void AbstractTabDeckEditor::actDecrementCardFromSideboard(CardInfoPtr info)
{
emit decrementCard(info, DECK_ZONE_SIDE);
}
void AbstractTabDeckEditor::actSwapCard(CardInfoPtr info, QString zoneName)
{
QString providerId = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getProperty("uuid");
QString collectorNumber = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getProperty("num");
QModelIndex foundCard = deckDockWidget->deckModel->findCard(info->getName(), zoneName, providerId, collectorNumber);
if (!foundCard.isValid()) {
foundCard = deckDockWidget->deckModel->findCard(info->getName(), zoneName);
}
deckDockWidget->swapCard(foundCard);
}
/**
* Opens the deck in this tab.
* @param deck The deck. Takes ownership of the object
*/
void AbstractTabDeckEditor::openDeck(DeckLoader *deck)
{
setDeck(deck);
if (!deck->getLastFileName().isEmpty()) {
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(deck->getLastFileName());
}
}
/**
* Sets the currently active deck for this tab
* @param _deck The deck. Takes ownership of the object
*/
void AbstractTabDeckEditor::setDeck(DeckLoader *_deck)
{
deckDockWidget->setDeck(_deck);
PictureLoader::cacheCardPixmaps(
CardDatabaseManager::getInstance()->getCardsByNameAndProviderId(getDeckList()->getCardListWithProviderId()));
setModified(false);
// If they load a deck, make the deck list appear
aDeckDockVisible->setChecked(true);
deckDockWidget->setVisible(aDeckDockVisible->isChecked());
}
DeckLoader *AbstractTabDeckEditor::getDeckList() const
{
return deckDockWidget->getDeckList();
}
void AbstractTabDeckEditor::setModified(bool _modified)
{
modified = _modified;
emit tabTextChanged(this, getTabText());
}
/**
* @brief Returns true if this tab is a blank newly opened tab, as if it was just created with the `New Deck` action.
*/
bool AbstractTabDeckEditor::isBlankNewDeck() const
{
DeckLoader *deck = getDeckList();
return !modified && deck->hasNotBeenLoaded();
}
void AbstractTabDeckEditor::actNewDeck()
{
auto deckOpenLocation = confirmOpen(false);
if (deckOpenLocation == CANCELLED) {
return;
}
if (deckOpenLocation == NEW_TAB) {
emit openDeckEditor(nullptr);
return;
}
cleanDeckAndResetModified();
}
void AbstractTabDeckEditor::cleanDeckAndResetModified()
{
deckMenu->setSaveStatus(false);
deckDockWidget->cleanDeck();
setModified(false);
}
/**
* @brief Displays the save confirmation dialogue that is shown before loading a deck, if required. Takes into
* account the `openDeckInNewTab` settting.
*
* @param openInSameTabIfBlank Open the deck in the same tab instead of a new tab if the current tab is completely
* blank. Only relevant when the `openDeckInNewTab` setting is enabled.
*
* @returns An enum that indicates if and where to load the deck
*/
AbstractTabDeckEditor::DeckOpenLocation AbstractTabDeckEditor::confirmOpen(const bool openInSameTabIfBlank)
{
// handle `openDeckInNewTab` setting
if (SettingsCache::instance().getOpenDeckInNewTab()) {
if (openInSameTabIfBlank && isBlankNewDeck()) {
return SAME_TAB;
} else {
return NEW_TAB;
}
}
// early return if deck is unmodified
if (!modified) {
return SAME_TAB;
}
// do the save confirmation dialogue
tabSupervisor->setCurrentWidget(this);
QMessageBox *msgBox = createSaveConfirmationWindow();
QPushButton *newTabButton = msgBox->addButton(tr("Open in new tab"), QMessageBox::ApplyRole);
int ret = msgBox->exec();
// `exec()` returns an opaque value if a non-standard button was clicked.
// Directly check if newTabButton was clicked before switching over the standard buttons.
if (msgBox->clickedButton() == newTabButton) {
return NEW_TAB;
}
switch (ret) {
case QMessageBox::Save:
return actSaveDeck() ? SAME_TAB : CANCELLED;
case QMessageBox::Discard:
return SAME_TAB;
default:
return CANCELLED;
}
}
/**
* @brief Creates the base save confirmation dialogue box.
*
* @returns A QMessageBox that can be further modified
*/
QMessageBox *AbstractTabDeckEditor::createSaveConfirmationWindow()
{
QMessageBox *msgBox = new QMessageBox(this);
msgBox->setIcon(QMessageBox::Warning);
msgBox->setWindowTitle(tr("Are you sure?"));
msgBox->setText(tr("The decklist has been modified.\nDo you want to save the changes?"));
msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
return msgBox;
}
void AbstractTabDeckEditor::actLoadDeck()
{
auto deckOpenLocation = confirmOpen();
if (deckOpenLocation == CANCELLED) {
return;
}
DlgLoadDeck dialog(this);
if (!dialog.exec())
return;
QString fileName = dialog.selectedFiles().at(0);
openDeckFromFile(fileName, deckOpenLocation);
deckDockWidget->updateBannerCardComboBox();
}
void AbstractTabDeckEditor::actOpenRecent(const QString &fileName)
{
auto deckOpenLocation = confirmOpen();
if (deckOpenLocation == CANCELLED) {
return;
}
openDeckFromFile(fileName, deckOpenLocation);
}
/**
* Actually opens the deck from file
* @param fileName The path of the deck to open
* @param deckOpenLocation Which tab to open the deck
*/
void AbstractTabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLocation deckOpenLocation)
{
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
auto *l = new DeckLoader;
if (l->loadFromFile(fileName, fmt, true)) {
if (deckOpenLocation == NEW_TAB) {
emit openDeckEditor(l);
l->deleteLater();
} else {
deckMenu->setSaveStatus(false);
openDeck(l);
}
} else {
l->deleteLater();
QMessageBox::critical(this, tr("Error"), tr("Could not open deck at %1").arg(fileName));
}
deckMenu->setSaveStatus(true);
}
bool AbstractTabDeckEditor::actSaveDeck()
{
DeckLoader *const deck = getDeckList();
if (deck->getLastRemoteDeckId() != -1) {
QString deckString = deck->writeToString_Native();
if (deckString.length() > MAX_FILE_LENGTH) {
QMessageBox::critical(this, tr("Error"), tr("Could not save remote deck"));
return false;
}
Command_DeckUpload cmd;
cmd.set_deck_id(static_cast<google::protobuf::uint32>(deck->getLastRemoteDeckId()));
cmd.set_deck_list(deckString.toStdString());
PendingCommand *pend = AbstractClient::prepareSessionCommand(cmd);
connect(pend, &PendingCommand::finished, this, &AbstractTabDeckEditor::saveDeckRemoteFinished);
tabSupervisor->getClient()->sendCommand(pend);
return true;
} else if (deck->getLastFileName().isEmpty())
return actSaveDeckAs();
else if (deck->saveToFile(deck->getLastFileName(), deck->getLastFileFormat())) {
setModified(false);
return true;
}
QMessageBox::critical(
this, tr("Error"),
tr("The deck could not be saved.\nPlease check that the directory is writable and try again."));
return false;
}
bool AbstractTabDeckEditor::actSaveDeckAs()
{
QFileDialog dialog(this, tr("Save deck"));
dialog.setDirectory(SettingsCache::instance().getDeckPath());
dialog.setAcceptMode(QFileDialog::AcceptSave);
dialog.setDefaultSuffix("cod");
dialog.setNameFilters(DeckLoader::FILE_NAME_FILTERS);
dialog.selectFile(getDeckList()->getName().trimmed());
if (!dialog.exec())
return false;
QString fileName = dialog.selectedFiles().at(0);
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
if (!getDeckList()->saveToFile(fileName, fmt)) {
QMessageBox::critical(
this, tr("Error"),
tr("The deck could not be saved.\nPlease check that the directory is writable and try again."));
return false;
}
setModified(false);
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(fileName);
return true;
}
void AbstractTabDeckEditor::saveDeckRemoteFinished(const Response &response)
{
if (response.response_code() != Response::RespOk)
QMessageBox::critical(this, tr("Error"), tr("The deck could not be saved."));
else
setModified(false);
}
void AbstractTabDeckEditor::actLoadDeckFromClipboard()
{
auto deckOpenLocation = confirmOpen();
if (deckOpenLocation == CANCELLED) {
return;
}
DlgLoadDeckFromClipboard dlg(this);
if (!dlg.exec())
return;
if (deckOpenLocation == NEW_TAB) {
emit openDeckEditor(dlg.getDeckList());
} else {
setDeck(dlg.getDeckList());
setModified(true);
}
deckMenu->setSaveStatus(true);
}
void AbstractTabDeckEditor::editDeckInClipboard(bool annotated)
{
DlgEditDeckInClipboard dlg(*getDeckList(), annotated, this);
if (!dlg.exec())
return;
setDeck(dlg.getDeckList());
setModified(true);
deckMenu->setSaveStatus(true);
}
void AbstractTabDeckEditor::actEditDeckInClipboard()
{
editDeckInClipboard(true);
}
void AbstractTabDeckEditor::actEditDeckInClipboardRaw()
{
editDeckInClipboard(false);
}
void AbstractTabDeckEditor::actSaveDeckToClipboard()
{
getDeckList()->saveToClipboard(true, true);
}
void AbstractTabDeckEditor::actSaveDeckToClipboardNoSetInfo()
{
getDeckList()->saveToClipboard(true, false);
}
void AbstractTabDeckEditor::actSaveDeckToClipboardRaw()
{
getDeckList()->saveToClipboard(false, true);
}
void AbstractTabDeckEditor::actSaveDeckToClipboardRawNoSetInfo()
{
getDeckList()->saveToClipboard(false, false);
}
void AbstractTabDeckEditor::actPrintDeck()
{
auto *dlg = new QPrintPreviewDialog(this);
connect(dlg, &QPrintPreviewDialog::paintRequested, deckDockWidget->deckModel, &DeckListModel::printDeckList);
dlg->exec();
}
void AbstractTabDeckEditor::exportToDecklistWebsite(DeckLoader::DecklistWebsite website)
{
// check if deck is not null
if (DeckLoader *const deck = getDeckList()) {
// Get the decklist url string from the deck loader class.
QString decklistUrlString = deck->exportDeckToDecklist(website);
// Check to make sure the string isn't empty.
if (QString::compare(decklistUrlString, "", Qt::CaseInsensitive) == 0) {
// Show an error if the deck is empty, and return.
QMessageBox::critical(this, tr("Error"), tr("There are no cards in your deck to be exported"));
return;
}
// Encode the string recieved from the model to make sure all characters are encoded.
// first we put it into a qurl object
QUrl decklistUrl = QUrl(decklistUrlString);
// we get the correctly encoded url.
decklistUrlString = decklistUrl.toEncoded();
// We open the url in the user's default browser
QDesktopServices::openUrl(decklistUrlString);
} else {
// if there's no deck loader object, return an error
QMessageBox::critical(this, tr("Error"), tr("No deck was selected to be exported."));
}
}
/**
* Exports the deck to www.decklist.org (the old website)
*/
void AbstractTabDeckEditor::actExportDeckDecklist()
{
exportToDecklistWebsite(DeckLoader::DecklistOrg);
}
/**
* Exports the deck to www.decklist.xyz (the new website)
*/
void AbstractTabDeckEditor::actExportDeckDecklistXyz()
{
exportToDecklistWebsite(DeckLoader::DecklistXyz);
}
void AbstractTabDeckEditor::actAnalyzeDeckDeckstats()
{
auto *interface = new DeckStatsInterface(*databaseDisplayDockWidget->databaseModel->getDatabase(),
this); // it deletes itself when done
interface->analyzeDeck(getDeckList());
}
void AbstractTabDeckEditor::actAnalyzeDeckTappedout()
{
auto *interface = new TappedOutInterface(*databaseDisplayDockWidget->databaseModel->getDatabase(),
this); // it deletes itself when done
interface->analyzeDeck(getDeckList());
}
void AbstractTabDeckEditor::filterTreeChanged(FilterTree *filterTree)
{
databaseDisplayDockWidget->setFilterTree(filterTree);
}
// Method uses to sync docks state with menu items state
bool AbstractTabDeckEditor::eventFilter(QObject *o, QEvent *e)
{
if (e->type() == QEvent::Close) {
if (o == cardInfoDockWidget) {
aCardInfoDockVisible->setChecked(false);
aCardInfoDockFloating->setEnabled(false);
} else if (o == deckDockWidget) {
aDeckDockVisible->setChecked(false);
aDeckDockFloating->setEnabled(false);
} else if (o == filterDockWidget) {
aFilterDockVisible->setChecked(false);
aFilterDockFloating->setEnabled(false);
} else if (o == printingSelectorDockWidget) {
aPrintingSelectorDockVisible->setChecked(false);
aPrintingSelectorDockFloating->setEnabled(false);
}
}
if (o == this && e->type() == QEvent::Hide) {
LayoutsSettings &layouts = SettingsCache::instance().layouts();
layouts.setDeckEditorLayoutState(saveState());
layouts.setDeckEditorGeometry(saveGeometry());
layouts.setDeckEditorCardSize(cardInfoDockWidget->size());
layouts.setDeckEditorFilterSize(filterDockWidget->size());
layouts.setDeckEditorDeckSize(deckDockWidget->size());
layouts.setDeckEditorPrintingSelectorSize(printingSelectorDockWidget->size());
}
return false;
}
bool AbstractTabDeckEditor::confirmClose()
{
if (modified) {
tabSupervisor->setCurrentWidget(this);
int ret = createSaveConfirmationWindow()->exec();
if (ret == QMessageBox::Save)
return actSaveDeck();
else if (ret == QMessageBox::Cancel)
return false;
}
return true;
}
void AbstractTabDeckEditor::closeRequest(bool forced)
{
if (!forced && !confirmClose()) {
return;
}
emit deckEditorClosing(this);
close();
}

View File

@@ -0,0 +1,158 @@
#ifndef TAB_GENERIC_DECK_EDITOR_H
#define TAB_GENERIC_DECK_EDITOR_H
#include "../../game/cards/card_info.h"
#include "../menus/deck_editor/deck_editor_menu.h"
#include "../ui/widgets/deck_editor/deck_editor_card_info_dock_widget.h"
#include "../ui/widgets/deck_editor/deck_editor_database_display_widget.h"
#include "../ui/widgets/deck_editor/deck_editor_deck_dock_widget.h"
#include "../ui/widgets/deck_editor/deck_editor_filter_dock_widget.h"
#include "../ui/widgets/deck_editor/deck_editor_printing_selector_dock_widget.h"
#include "../ui/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.h"
#include "tab.h"
class CardDatabaseModel;
class CardDatabaseDisplayModel;
class CardInfoFrameWidget;
class DeckLoader;
class DeckEditorMenu;
class DeckEditorCardInfoDockWidget;
class DeckEditorDatabaseDisplayWidget;
class DeckEditorDeckDockWidget;
class DeckEditorFilterDockWidget;
class DeckEditorPrintingSelectorDockWidget;
class DeckPreviewDeckTagsDisplayWidget;
class Response;
class FilterTreeModel;
class FilterBuilder;
class QTreeView;
class QTextEdit;
class QLabel;
class QComboBox;
class QGroupBox;
class QMessageBox;
class QHBoxLayout;
class QVBoxLayout;
class QPushButton;
class QDockWidget;
class QMenu;
class QAction;
class AbstractTabDeckEditor : public Tab
{
Q_OBJECT
friend class DeckEditorMenu;
public:
explicit AbstractTabDeckEditor(TabSupervisor *_tabSupervisor);
// UI and Navigation
virtual void createMenus() = 0;
[[nodiscard]] virtual QString getTabText() const override = 0;
bool confirmClose();
virtual void retranslateUi() override = 0;
// Deck Management
void openDeck(DeckLoader *deck);
DeckLoader *getDeckList() const;
void setModified(bool _windowModified);
// UI Elements
DeckEditorMenu *deckMenu;
DeckEditorDatabaseDisplayWidget *databaseDisplayDockWidget;
DeckEditorCardInfoDockWidget *cardInfoDockWidget;
DeckEditorDeckDockWidget *deckDockWidget;
DeckEditorFilterDockWidget *filterDockWidget;
DeckEditorPrintingSelectorDockWidget *printingSelectorDockWidget;
public slots:
virtual void onDeckChanged();
virtual void onDeckModified();
void updateCard(CardInfoPtr _card);
void actAddCard(CardInfoPtr info);
void actAddCardToSideboard(CardInfoPtr info);
void actDecrementCard(CardInfoPtr info);
void actDecrementCardFromSideboard(CardInfoPtr info);
void actOpenRecent(const QString &fileName);
void filterTreeChanged(FilterTree *filterTree);
void closeRequest(bool forced = false) override;
virtual void showPrintingSelector() = 0;
virtual void dockTopLevelChanged(bool topLevel) = 0;
signals:
void openDeckEditor(const DeckLoader *deckLoader);
void deckEditorClosing(AbstractTabDeckEditor *tab);
void decrementCard(CardInfoPtr card, QString zoneName);
protected slots:
// Deck Operations
virtual void actNewDeck();
void cleanDeckAndResetModified();
virtual void actLoadDeck();
bool actSaveDeck();
virtual bool actSaveDeckAs();
virtual void actLoadDeckFromClipboard();
void actEditDeckInClipboard();
void actEditDeckInClipboardRaw();
void actSaveDeckToClipboard();
void actSaveDeckToClipboardNoSetInfo();
void actSaveDeckToClipboardRaw();
void actSaveDeckToClipboardRawNoSetInfo();
void actPrintDeck();
void actExportDeckDecklist();
void actExportDeckDecklistXyz();
void actAnalyzeDeckDeckstats();
void actAnalyzeDeckTappedout();
// Remote Save
void saveDeckRemoteFinished(const Response &r);
// UI Layout Management
virtual void loadLayout() = 0;
virtual void restartLayout() = 0;
virtual void freeDocksSize() = 0;
virtual void refreshShortcuts() = 0;
bool eventFilter(QObject *o, QEvent *e) override;
virtual void dockVisibleTriggered() = 0;
virtual void dockFloatingTriggered() = 0;
private:
virtual void setDeck(DeckLoader *_deck);
void editDeckInClipboard(bool annotated);
void exportToDecklistWebsite(DeckLoader::DecklistWebsite website);
protected:
/**
* @brief Enum for selecting deck open location
*/
enum DeckOpenLocation
{
CANCELLED,
SAME_TAB,
NEW_TAB
};
DeckOpenLocation confirmOpen(bool openInSameTabIfBlank = true);
QMessageBox *createSaveConfirmationWindow();
bool isBlankNewDeck() const;
// Helper functions for card actions
void addCardHelper(CardInfoPtr info, QString zoneName);
void actSwapCard(CardInfoPtr info, QString zoneName);
virtual void openDeckFromFile(const QString &fileName, DeckOpenLocation deckOpenLocation);
// UI Menu Elements
QMenu *viewMenu, *cardInfoDockMenu, *deckDockMenu, *filterDockMenu, *printingSelectorDockMenu;
QAction *aResetLayout;
QAction *aCardInfoDockVisible, *aCardInfoDockFloating, *aDeckDockVisible, *aDeckDockFloating;
QAction *aFilterDockVisible, *aFilterDockFloating, *aPrintingSelectorDockVisible, *aPrintingSelectorDockFloating;
bool modified = false;
};
#endif // TAB_GENERIC_DECK_EDITOR_H

View File

@@ -1,11 +1,11 @@
#include "edhrec_commander_api_response_archidekt_links.h"
#include "edhrec_api_response_archidekt_links.h"
#include <QDebug>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
void EdhrecCommanderApiResponseArchidektLink::fromJson(const QJsonObject &json)
void EdhrecApiResponseArchidektLink::fromJson(const QJsonObject &json)
{
c = json.value("c").toString();
f = json.value("f").toInt(0);
@@ -13,7 +13,7 @@ void EdhrecCommanderApiResponseArchidektLink::fromJson(const QJsonObject &json)
u = json.value("u").toString();
}
void EdhrecCommanderApiResponseArchidektLink::debugPrint() const
void EdhrecApiResponseArchidektLink::debugPrint() const
{
qDebug() << " C:" << c;
qDebug() << " F:" << f;
@@ -27,7 +27,7 @@ void EdhrecCommanderApiResponseArchidektLinks::fromJson(const QJsonArray &json)
for (const QJsonValue &value : json) {
if (value.isObject()) {
QJsonObject entryJson = value.toObject();
EdhrecCommanderApiResponseArchidektLink entry;
EdhrecApiResponseArchidektLink entry;
entry.fromJson(entryJson);
entries.append(entry);
}

View File

@@ -7,7 +7,7 @@
#include <QVector>
// Represents a single Archidekt entry
class EdhrecCommanderApiResponseArchidektLink
class EdhrecApiResponseArchidektLink
{
public:
QString c;
@@ -23,7 +23,7 @@ public:
class EdhrecCommanderApiResponseArchidektLinks
{
public:
QVector<EdhrecCommanderApiResponseArchidektLink> entries;
QVector<EdhrecApiResponseArchidektLink> entries;
void fromJson(const QJsonArray &json);
void debugPrint() const;

View File

@@ -0,0 +1,47 @@
#include "edhrec_average_deck_api_response.h"
#include <QDebug>
#include <QJsonArray>
void EdhrecAverageDeckApiResponse::fromJson(const QJsonObject &json)
{
// Parse the collapsed DeckStatistics
deckStats.fromJson(json);
// Parse Archidekt section
QJsonArray archidektJson = json.value("archidekt").toArray();
archidekt.fromJson(archidektJson);
// Parse other fields
similar = json.value("similar").toObject();
header = json.value("header").toString();
panels = json.value("panels").toObject();
description = json.value("description").toString();
QJsonObject containerJson = json.value("container").toObject();
container.fromJson(containerJson);
QJsonArray cardsJson = json.value("deck").toArray();
deck.fromJson(cardsJson);
}
void EdhrecAverageDeckApiResponse::debugPrint() const
{
qDebug() << "Deck Statistics:";
qDebug() << " Creature:" << deckStats.creature;
qDebug() << " Instant:" << deckStats.instant;
qDebug() << " Sorcery:" << deckStats.sorcery;
qDebug() << " Artifact:" << deckStats.artifact;
qDebug() << " Enchantment:" << deckStats.enchantment;
qDebug() << " Battle:" << deckStats.battle;
qDebug() << " Planeswalker:" << deckStats.planeswalker;
qDebug() << " Land:" << deckStats.land;
qDebug() << " Basic:" << deckStats.basic;
qDebug() << " Nonbasic:" << deckStats.nonbasic;
archidekt.debugPrint();
qDebug() << "Similar:" << similar;
qDebug() << "Header:" << header;
qDebug() << "Panels:" << panels;
qDebug() << "Description:" << description;
container.debugPrint();
}

View File

@@ -0,0 +1,30 @@
#ifndef EDHREC_AVERAGE_DECK_API_RESPONSE_H
#define EDHREC_AVERAGE_DECK_API_RESPONSE_H
#include "../archidekt_links/edhrec_api_response_archidekt_links.h"
#include "../cards/edhrec_api_response_card_container.h"
#include "../commander/edhrec_commander_api_response_average_deck_statistics.h"
#include "edhrec_deck_api_response.h"
#include <QDebug>
#include <QJsonObject>
#include <QString>
// Represents the main structure of the JSON
class EdhrecAverageDeckApiResponse
{
public:
EdhrecCommanderApiResponseAverageDeckStatistics deckStats;
EdhrecCommanderApiResponseArchidektLinks archidekt;
QJsonObject similar;
QString header;
QJsonObject panels;
QString description;
EdhrecApiResponseCardContainer container;
EdhrecDeckApiResponse deck;
void fromJson(const QJsonObject &json);
void debugPrint() const;
};
#endif // EDHREC_AVERAGE_DECK_API_RESPONSE_H

View File

@@ -0,0 +1,27 @@
#include "edhrec_deck_api_response.h"
#include "../../../../../../deck/deck_loader.h"
#include <QApplication>
#include <QDebug>
#include <QJsonArray>
#include <QJsonObject>
#include <QMainWindow>
void EdhrecDeckApiResponse::fromJson(const QJsonArray &json)
{
QString deckList;
for (const QJsonValue &cardlistValue : json) {
deckList += cardlistValue.toString() + "\n";
}
deckLoader = new DeckLoader();
QTextStream stream(&deckList);
deckLoader->loadFromStream_Plain(stream, true);
}
void EdhrecDeckApiResponse::debugPrint() const
{
qDebug() << "Breadcrumb:";
}

View File

@@ -0,0 +1,27 @@
#ifndef EDHREC_DECK_API_RESPONSE_H
#define EDHREC_DECK_API_RESPONSE_H
#include "../../../../../../deck/deck_loader.h"
#include <QDebug>
#include <QJsonArray>
#include <QJsonObject>
#include <QString>
#include <QVector>
class EdhrecDeckApiResponse
{
public:
// Constructor
EdhrecDeckApiResponse() = default;
// Parse deck-related data from JSON
void fromJson(const QJsonArray &json);
// Debug method for logging
void debugPrint() const;
DeckLoader *deckLoader;
};
#endif // EDHREC_DECK_API_RESPONSE_H

View File

@@ -1,4 +1,4 @@
#include "edhrec_commander_api_response_card_prices.h"
#include "edhrec_api_response_card_prices.h"
#include <QDebug>
@@ -18,14 +18,14 @@ void CardPrices::fromJson(const QJsonObject &json)
void CardPrices::debugPrint() const
{
qDebug() << "Card Prices:";
qDebug() << "Cardhoarder:" << cardhoarder;
qDebug() << "Cardkingdom:" << cardkingdom;
qDebug() << "Cardmarket:" << cardmarket;
qDebug() << "Face2Face:" << face2face;
qDebug() << "Manapool:" << manapool;
qDebug() << "Mtgstocks:" << mtgstocks;
qDebug() << "SCG:" << scg;
qDebug() << "TCGL:" << tcgl;
qDebug() << "Tcgplayer:" << tcgplayer;
qInfo() << "Card Prices:";
qInfo() << "Cardhoarder:" << cardhoarder;
qInfo() << "Cardkingdom:" << cardkingdom;
qInfo() << "Cardmarket:" << cardmarket;
qInfo() << "Face2Face:" << face2face;
qInfo() << "Manapool:" << manapool;
qInfo() << "Mtgstocks:" << mtgstocks;
qInfo() << "SCG:" << scg;
qInfo() << "TCGL:" << tcgl;
qInfo() << "Tcgplayer:" << tcgplayer;
}

View File

@@ -1,10 +1,10 @@
#include "edhrec_commander_api_response_card_container.h"
#include "edhrec_api_response_card_container.h"
#include <QDebug>
#include <QJsonArray>
#include <QJsonObject>
void EdhrecCommanderApiResponseCardContainer::fromJson(const QJsonObject &json)
void EdhrecApiResponseCardContainer::fromJson(const QJsonObject &json)
{
// Parse breadcrumb
QJsonArray breadcrumbArray = json.value("breadcrumb").toArray();
@@ -20,7 +20,7 @@ void EdhrecCommanderApiResponseCardContainer::fromJson(const QJsonObject &json)
for (const QJsonValue &cardlistValue : cardlistsArray) {
QJsonObject cardlistObj = cardlistValue.toObject();
QJsonArray cardviewsArray = cardlistObj.value("cardviews").toArray();
EdhrecCommanderApiResponseCardList cardView;
EdhrecApiResponseCardList cardView;
cardView.fromJson(cardlistValue.toObject());
cardlists.push_back(cardView);
}
@@ -29,7 +29,7 @@ void EdhrecCommanderApiResponseCardContainer::fromJson(const QJsonObject &json)
title = json.value("title").toString();
}
void EdhrecCommanderApiResponseCardContainer::debugPrint() const
void EdhrecApiResponseCardContainer::debugPrint() const
{
qDebug() << "Breadcrumb:";
for (const auto &breadcrumbEntry : breadcrumb) {

View File

@@ -1,7 +1,7 @@
#ifndef CONTAINER_ENTRY_H
#define CONTAINER_ENTRY_H
#include "edhrec_commander_api_response_card_list.h"
#include "edhrec_api_response_card_list.h"
#include "edhrec_commander_api_response_commander_details.h"
#include <QDebug>
@@ -10,11 +10,11 @@
#include <QString>
#include <QVector>
class EdhrecCommanderApiResponseCardContainer
class EdhrecApiResponseCardContainer
{
public:
// Constructor
EdhrecCommanderApiResponseCardContainer() = default;
EdhrecApiResponseCardContainer() = default;
// Parse deck-related data from JSON
void fromJson(const QJsonObject &json);
@@ -35,7 +35,7 @@ public:
{
return card;
}
const QVector<EdhrecCommanderApiResponseCardList> &getCardlists() const
const QVector<EdhrecApiResponseCardList> &getCardlists() const
{
return cardlists;
}
@@ -52,7 +52,7 @@ private:
QString description;
QVector<QJsonObject> breadcrumb;
EdhrecCommanderApiResponseCommanderDetails card;
QVector<EdhrecCommanderApiResponseCardList> cardlists;
QVector<EdhrecApiResponseCardList> cardlists;
QString keywords;
QString title;
};

View File

@@ -1,13 +1,13 @@
#include "edhrec_commander_api_response_card_details.h"
#include "edhrec_api_response_card_details.h"
#include <QDebug>
EdhrecCommanderApiResponseCardDetails::EdhrecCommanderApiResponseCardDetails()
EdhrecApiResponseCardDetails::EdhrecApiResponseCardDetails()
: synergy(0.0), inclusion(0), numDecks(0), potentialDecks(0)
{
}
void EdhrecCommanderApiResponseCardDetails::fromJson(const QJsonObject &json)
void EdhrecApiResponseCardDetails::fromJson(const QJsonObject &json)
{
// Parse the fields from the JSON object
name = json.value("name").toString();
@@ -21,7 +21,7 @@ void EdhrecCommanderApiResponseCardDetails::fromJson(const QJsonObject &json)
potentialDecks = json.value("potential_decks").toInt(0);
}
void EdhrecCommanderApiResponseCardDetails::debugPrint() const
void EdhrecApiResponseCardDetails::debugPrint() const
{
// Print out all the fields for debugging
qDebug() << "Name:" << name;

View File

@@ -4,7 +4,7 @@
#include <QJsonObject>
#include <QString>
class EdhrecCommanderApiResponseCardDetails
class EdhrecApiResponseCardDetails
{
public:
QString name;
@@ -17,7 +17,7 @@ public:
int numDecks;
int potentialDecks;
EdhrecCommanderApiResponseCardDetails();
EdhrecApiResponseCardDetails();
// Method to populate the object from a JSON object
void fromJson(const QJsonObject &json);

View File

@@ -1,12 +1,12 @@
#include "edhrec_commander_api_response_card_list.h"
#include "edhrec_api_response_card_list.h"
#include <QDebug>
EdhrecCommanderApiResponseCardList::EdhrecCommanderApiResponseCardList()
EdhrecApiResponseCardList::EdhrecApiResponseCardList()
{
}
void EdhrecCommanderApiResponseCardList::fromJson(const QJsonObject &json)
void EdhrecApiResponseCardList::fromJson(const QJsonObject &json)
{
// Parse the header from the JSON object
header = json.value("header").toString();
@@ -15,19 +15,19 @@ void EdhrecCommanderApiResponseCardList::fromJson(const QJsonObject &json)
QJsonArray cardviewsArray = json.value("cardviews").toArray();
for (const QJsonValue &value : cardviewsArray) {
QJsonObject cardviewObj = value.toObject();
EdhrecCommanderApiResponseCardDetails cardView;
EdhrecApiResponseCardDetails cardView;
cardView.fromJson(cardviewObj);
cardViews.append(cardView);
}
}
void EdhrecCommanderApiResponseCardList::debugPrint() const
void EdhrecApiResponseCardList::debugPrint() const
{
// Print out the header
qDebug() << "Header:" << header;
// Print out all the CardView objects
for (const EdhrecCommanderApiResponseCardDetails &cardView : cardViews) {
for (const EdhrecApiResponseCardDetails &cardView : cardViews) {
cardView.debugPrint();
}
}

View File

@@ -1,21 +1,21 @@
#ifndef CARD_LIST_H
#define CARD_LIST_H
#include "edhrec_commander_api_response_card_details.h"
#include "edhrec_api_response_card_details.h"
#include <QJsonArray>
#include <QJsonObject>
#include <QList>
#include <QString>
class EdhrecCommanderApiResponseCardList
class EdhrecApiResponseCardList
{
public:
QString header;
QList<EdhrecCommanderApiResponseCardDetails> cardViews;
QList<EdhrecApiResponseCardDetails> cardViews;
// Default constructor
EdhrecCommanderApiResponseCardList();
EdhrecApiResponseCardList();
// Method to populate the object from a JSON object
void fromJson(const QJsonObject &json);

View File

@@ -1,7 +1,7 @@
#ifndef EDHREC_COMMANDER_API_RESPONSE_COMMANDER_DETAILS_H
#define EDHREC_COMMANDER_API_RESPONSE_COMMANDER_DETAILS_H
#include "edhrec_commander_api_response_card_prices.h"
#include "../card_prices/edhrec_api_response_card_prices.h"
#include <QJsonArray>
#include <QJsonObject>

View File

@@ -1,9 +1,9 @@
#ifndef DECKDATA_H
#define DECKDATA_H
#include "edhrec_commander_api_response_archidekt_links.h"
#include "../archidekt_links//edhrec_api_response_archidekt_links.h"
#include "../cards/edhrec_api_response_card_container.h"
#include "edhrec_commander_api_response_average_deck_statistics.h"
#include "edhrec_commander_api_response_card_container.h"
#include <QDebug>
#include <QJsonObject>
@@ -19,7 +19,7 @@ public:
QString header;
QJsonObject panels;
QString description;
EdhrecCommanderApiResponseCardContainer container;
EdhrecApiResponseCardContainer container;
void fromJson(const QJsonObject &json);
void debugPrint() const;

View File

@@ -0,0 +1,19 @@
#include "edhrec_top_cards_api_response.h"
#include <QDebug>
#include <QJsonArray>
void EdhrecTopCardsApiResponse::fromJson(const QJsonObject &json)
{
header = json.value("header").toString();
description = json.value("description").toString();
QJsonObject containerJson = json.value("container").toObject();
container.fromJson(containerJson);
}
void EdhrecTopCardsApiResponse::debugPrint() const
{
qDebug() << "Header:" << header;
qDebug() << "Description:" << description;
container.debugPrint();
}

View File

@@ -0,0 +1,20 @@
#ifndef EDHREC_TOP_CARDS_API_RESPONSE_H
#define EDHREC_TOP_CARDS_API_RESPONSE_H
#include "../cards/edhrec_api_response_card_container.h"
#include <QDebug>
#include <QString>
class EdhrecTopCardsApiResponse
{
public:
QString header;
QString description;
EdhrecApiResponseCardContainer container;
void fromJson(const QJsonObject &json);
void debugPrint() const;
};
#endif // EDHREC_TOP_CARDS_API_RESPONSE_H

View File

@@ -0,0 +1,19 @@
#include "edhrec_top_commanders_api_response.h"
#include <QDebug>
#include <QJsonArray>
void EdhrecTopCommandersApiResponse::fromJson(const QJsonObject &json)
{
header = json.value("header").toString();
description = json.value("description").toString();
QJsonObject containerJson = json.value("container").toObject();
container.fromJson(containerJson);
}
void EdhrecTopCommandersApiResponse::debugPrint() const
{
qDebug() << "Header:" << header;
qDebug() << "Description:" << description;
container.debugPrint();
}

View File

@@ -0,0 +1,20 @@
#ifndef EDHREC_TOP_COMMANDERS_API_RESPONSE_H
#define EDHREC_TOP_COMMANDERS_API_RESPONSE_H
#include "../cards/edhrec_api_response_card_container.h"
#include <QDebug>
#include <QString>
class EdhrecTopCommandersApiResponse
{
public:
QString header;
QString description;
EdhrecApiResponseCardContainer container;
void fromJson(const QJsonObject &json);
void debugPrint() const;
};
#endif // EDHREC_TOP_COMMANDERS_API_RESPONSE_H

View File

@@ -0,0 +1,19 @@
#include "edhrec_top_tags_api_response.h"
#include <QDebug>
#include <QJsonArray>
void EdhrecTopTagsApiResponse::fromJson(const QJsonObject &json)
{
header = json.value("header").toString();
description = json.value("description").toString();
QJsonObject containerJson = json.value("container").toObject();
container.fromJson(containerJson);
}
void EdhrecTopTagsApiResponse::debugPrint() const
{
qDebug() << "Header:" << header;
qDebug() << "Description:" << description;
container.debugPrint();
}

View File

@@ -0,0 +1,20 @@
#ifndef EDHREC_TOP_TAGS_API_RESPONSE_H
#define EDHREC_TOP_TAGS_API_RESPONSE_H
#include "../cards/edhrec_api_response_card_container.h"
#include <QDebug>
#include <QString>
class EdhrecTopTagsApiResponse
{
public:
QString header;
QString description;
EdhrecApiResponseCardContainer container;
void fromJson(const QJsonObject &json);
void debugPrint() const;
};
#endif // EDHREC_TOP_TAGS_API_RESPONSE_H

View File

@@ -0,0 +1,66 @@
#include "edhrec_api_response_card_prices_display_widget.h"
EdhrecApiResponseCardPricesDisplayWidget::EdhrecApiResponseCardPricesDisplayWidget(QWidget *parent,
const CardPrices &_cardPrices)
: QWidget(parent), cardPrices(_cardPrices)
{
layout = new QGridLayout(this);
setLayout(layout);
cardHoarderLabel = new QLabel(this);
cardHoarderPrice = new QLabel(QString::number(cardPrices.getCardhoarder().value("price").toDouble()), this);
cardKingdomLabel = new QLabel(this);
cardKingdomPrice = new QLabel(QString::number(cardPrices.getCardkingdom().value("price").toDouble()), this);
cardMarketLabel = new QLabel(this);
cardMarketPrice = new QLabel(QString::number(cardPrices.getCardmarket().value("price").toDouble()), this);
face2faceLabel = new QLabel(this);
face2facePrice = new QLabel(QString::number(cardPrices.getFace2face().value("price").toDouble()), this);
manaPoolLabel = new QLabel(this);
manaPoolPrice = new QLabel(QString::number(cardPrices.getManapool().value("price").toDouble()), this);
mtgStocksLabel = new QLabel(this);
mtgStocksPrice = new QLabel(QString::number(cardPrices.getMtgstocks().value("price").toDouble()), this);
scgLabel = new QLabel(this);
scgPrice = new QLabel(QString::number(cardPrices.getScg().value("price").toDouble()), this);
tcglLabel = new QLabel(this);
tcglPrice = new QLabel(QString::number(cardPrices.getTcgl().value("price").toDouble()), this);
tcgplayerLabel = new QLabel(this);
tcgplayerPrice = new QLabel(QString::number(cardPrices.getTcgplayer().value("price").toDouble()), this);
layout->addWidget(cardHoarderLabel, 0, 0);
layout->addWidget(cardHoarderPrice, 0, 1);
layout->addWidget(cardKingdomLabel, 0, 2);
layout->addWidget(cardKingdomPrice, 0, 3);
layout->addWidget(cardMarketLabel, 1, 0);
layout->addWidget(cardMarketPrice, 1, 1);
layout->addWidget(face2faceLabel, 1, 2);
layout->addWidget(face2facePrice, 1, 3);
layout->addWidget(manaPoolLabel, 2, 0);
layout->addWidget(manaPoolPrice, 2, 1);
layout->addWidget(mtgStocksLabel, 2, 2);
layout->addWidget(mtgStocksPrice, 2, 3);
layout->addWidget(scgLabel, 3, 0);
layout->addWidget(scgPrice, 3, 1);
layout->addWidget(tcglLabel, 3, 2);
layout->addWidget(tcglPrice, 3, 3);
layout->addWidget(tcgplayerLabel, 4, 0);
layout->addWidget(tcgplayerPrice, 4, 1);
retranslateUi();
}
void EdhrecApiResponseCardPricesDisplayWidget::retranslateUi()
{
cardHoarderLabel->setText(tr("Card Hoarder"));
cardKingdomLabel->setText(tr("Card Kingdom"));
cardMarketLabel->setText(tr("Card Market"));
face2faceLabel->setText(tr("Face 2-Face"));
manaPoolLabel->setText(tr("Mana Pool"));
mtgStocksLabel->setText(tr("MTG Stocks"));
scgLabel->setText(tr("Scg"));
tcglLabel->setText(tr("Tcgl"));
tcgplayerLabel->setText(tr("Tcgplayer"));
}

View File

@@ -0,0 +1,42 @@
#ifndef EDHREC_API_RESPONSE_CARD_PRICES_DISPLAY_WIDGET_H
#define EDHREC_API_RESPONSE_CARD_PRICES_DISPLAY_WIDGET_H
#include "../../api_response/card_prices/edhrec_api_response_card_prices.h"
#include <QGridLayout>
#include <QLabel>
#include <QWidget>
class EdhrecApiResponseCardPricesDisplayWidget : public QWidget
{
Q_OBJECT
public:
EdhrecApiResponseCardPricesDisplayWidget(QWidget *parent, const CardPrices &cardPrices);
public slots:
void retranslateUi();
private:
CardPrices cardPrices;
QGridLayout *layout;
QLabel *cardHoarderLabel;
QLabel *cardHoarderPrice;
QLabel *cardKingdomLabel;
QLabel *cardKingdomPrice;
QLabel *cardMarketLabel;
QLabel *cardMarketPrice;
QLabel *face2faceLabel;
QLabel *face2facePrice;
QLabel *manaPoolLabel;
QLabel *manaPoolPrice;
QLabel *mtgStocksLabel;
QLabel *mtgStocksPrice;
QLabel *scgLabel;
QLabel *scgPrice;
QLabel *tcglLabel;
QLabel *tcglPrice;
QLabel *tcgplayerLabel;
QLabel *tcgplayerPrice;
};
#endif // EDHREC_API_RESPONSE_CARD_PRICES_DISPLAY_WIDGET_H

View File

@@ -0,0 +1,54 @@
#include "edhrec_api_response_card_details_display_widget.h"
#include "../../../../../../game/cards/card_database_manager.h"
#include "../../tab_edhrec_main.h"
EdhrecApiResponseCardDetailsDisplayWidget::EdhrecApiResponseCardDetailsDisplayWidget(
QWidget *parent,
const EdhrecApiResponseCardDetails &_toDisplay)
: QWidget(parent), toDisplay(_toDisplay)
{
layout = new QVBoxLayout(this);
setLayout(layout);
cardPictureWidget = new CardInfoPictureWidget(this);
cardPictureWidget->setCard(CardDatabaseManager::getInstance()->guessCard(toDisplay.sanitized));
nameLabel = new QLabel(this);
nameLabel->setText(toDisplay.name);
nameLabel->setAlignment(Qt::AlignHCenter);
inclusionDisplayWidget = new EdhrecApiResponseCardInclusionDisplayWidget(this, toDisplay);
synergyDisplayWidget = new EdhrecApiResponseCardSynergyDisplayWidget(this, toDisplay);
layout->addWidget(nameLabel);
layout->addWidget(cardPictureWidget);
layout->addWidget(inclusionDisplayWidget);
layout->addWidget(synergyDisplayWidget);
QWidget *currentParent = parentWidget();
TabEdhRecMain *parentTab = nullptr;
while (currentParent) {
if ((parentTab = qobject_cast<TabEdhRecMain *>(currentParent))) {
break;
}
currentParent = currentParent->parentWidget();
}
if (parentTab) {
cardPictureWidget->setScaleFactor(parentTab->getCardSizeSlider()->getSlider()->value());
connect(cardPictureWidget, &CardInfoPictureWidget::cardClicked, this,
&EdhrecApiResponseCardDetailsDisplayWidget::actRequestPageNavigation);
connect(parentTab->getCardSizeSlider()->getSlider(), &QSlider::valueChanged, cardPictureWidget,
&CardInfoPictureWidget::setScaleFactor);
connect(this, &EdhrecApiResponseCardDetailsDisplayWidget::requestUrl, parentTab,
&TabEdhRecMain::actNavigatePage);
}
}
void EdhrecApiResponseCardDetailsDisplayWidget::actRequestPageNavigation()
{
emit requestUrl(toDisplay.url);
}

View File

@@ -0,0 +1,32 @@
#ifndef EDHREC_COMMANDER_API_RESPONSE_CARD_DETAILS_DISPLAY_WIDGET_H
#define EDHREC_COMMANDER_API_RESPONSE_CARD_DETAILS_DISPLAY_WIDGET_H
#include "../../../../../ui/widgets/cards/card_info_picture_widget.h"
#include "../../api_response/cards/edhrec_api_response_card_details.h"
#include "edhrec_api_response_card_inclusion_display_widget.h"
#include "edhrec_api_response_card_synergy_display_widget.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QWidget>
class EdhrecApiResponseCardDetailsDisplayWidget : public QWidget
{
Q_OBJECT
public:
explicit EdhrecApiResponseCardDetailsDisplayWidget(QWidget *parent, const EdhrecApiResponseCardDetails &_toDisplay);
public slots:
void actRequestPageNavigation();
signals:
void requestUrl(QString url);
private:
EdhrecApiResponseCardDetails toDisplay;
QVBoxLayout *layout;
CardInfoPictureWidget *cardPictureWidget;
QLabel *nameLabel;
EdhrecApiResponseCardInclusionDisplayWidget *inclusionDisplayWidget;
EdhrecApiResponseCardSynergyDisplayWidget *synergyDisplayWidget;
};
#endif // EDHREC_COMMANDER_API_RESPONSE_CARD_DETAILS_DISPLAY_WIDGET_H

View File

@@ -0,0 +1,41 @@
#include "edhrec_api_response_card_inclusion_display_widget.h"
EdhrecApiResponseCardInclusionDisplayWidget::EdhrecApiResponseCardInclusionDisplayWidget(
QWidget *parent,
const EdhrecApiResponseCardDetails &_toDisplay)
: QWidget(parent), toDisplay(_toDisplay)
{
layout = new QVBoxLayout(this);
setLayout(layout);
commanderLabel = new QLabel(this);
commanderLabel->setAlignment(Qt::AlignCenter);
amountLabel = new QLabel(this);
amountLabel->setAlignment(Qt::AlignCenter);
inclusionLabel = new QLabel(this);
inclusionLabel->setAlignment(Qt::AlignCenter);
percentBarWidget = new PercentBarWidget(this, toDisplay.inclusion / (toDisplay.potentialDecks / 100.0));
if (toDisplay.inclusion != 0 && toDisplay.potentialDecks != 0) {
layout->addWidget(amountLabel);
layout->addWidget(inclusionLabel);
layout->addWidget(percentBarWidget);
commanderLabel->hide();
} else {
amountLabel->hide();
inclusionLabel->hide();
percentBarWidget->hide();
layout->addWidget(commanderLabel);
}
retranslateUi();
}
void EdhrecApiResponseCardInclusionDisplayWidget::retranslateUi()
{
commanderLabel->setText(toDisplay.label);
amountLabel->setText(tr("In %1 decks").arg(QString::number(toDisplay.inclusion)));
inclusionLabel->setText(tr("%1% of %2 decks")
.arg(QString::number(toDisplay.inclusion / (toDisplay.potentialDecks / 100.0), 'f', 2),
QString::number(toDisplay.potentialDecks)));
}

View File

@@ -0,0 +1,27 @@
#ifndef EDHREC_API_RESPONSE_CARD_INCLUSION_DISPLAY_WIDGET_H
#define EDHREC_API_RESPONSE_CARD_INCLUSION_DISPLAY_WIDGET_H
#include "../../../../../ui/widgets/general/display/percent_bar_widget.h"
#include "../../api_response/cards/edhrec_api_response_card_details.h"
#include <QLabel>
#include <QVBoxLayout>
#include <QWidget>
class EdhrecApiResponseCardInclusionDisplayWidget : public QWidget
{
Q_OBJECT
public:
EdhrecApiResponseCardInclusionDisplayWidget(QWidget *parent, const EdhrecApiResponseCardDetails &_toDisplay);
void retranslateUi();
private:
QVBoxLayout *layout;
EdhrecApiResponseCardDetails toDisplay;
QLabel *commanderLabel;
QLabel *amountLabel;
QLabel *inclusionLabel;
PercentBarWidget *percentBarWidget;
};
#endif // EDHREC_API_RESPONSE_CARD_INCLUSION_DISPLAY_WIDGET_H

View File

@@ -0,0 +1,33 @@
#include "edhrec_api_response_card_list_display_widget.h"
#include "../../../../../ui/widgets/general/display/banner_widget.h"
#include "edhrec_api_response_card_details_display_widget.h"
#include <QLabel>
EdhrecApiResponseCardListDisplayWidget::EdhrecApiResponseCardListDisplayWidget(QWidget *parent,
EdhrecApiResponseCardList toDisplay)
: QWidget(parent)
{
layout = new QVBoxLayout(this);
setLayout(layout);
header = new BannerWidget(this, toDisplay.header);
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAlwaysOff);
header->setBuddy(flowWidget);
foreach (EdhrecApiResponseCardDetails card_detail, toDisplay.cardViews) {
auto widget = new EdhrecApiResponseCardDetailsDisplayWidget(flowWidget, card_detail);
flowWidget->addWidget(widget);
}
layout->addWidget(header);
layout->addWidget(flowWidget);
}
void EdhrecApiResponseCardListDisplayWidget::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
qDebug() << event->size();
}

View File

@@ -1,20 +1,19 @@
#ifndef EDHREC_COMMANDER_API_RESPONSE_CARD_LIST_DISPLAY_WIDGET_H
#define EDHREC_COMMANDER_API_RESPONSE_CARD_LIST_DISPLAY_WIDGET_H
#include "../../../ui/widgets/general/display/banner_widget.h"
#include "../../../ui/widgets/general/layout_containers/flow_widget.h"
#include "api_response/edhrec_commander_api_response_card_list.h"
#include "../../../../../ui/widgets/general/display/banner_widget.h"
#include "../../../../../ui/widgets/general/layout_containers/flow_widget.h"
#include "../../api_response/cards/edhrec_api_response_card_list.h"
#include <QResizeEvent>
#include <QVBoxLayout>
#include <QWidget>
class EdhrecCommanderApiResponseCardListDisplayWidget : public QWidget
class EdhrecApiResponseCardListDisplayWidget : public QWidget
{
Q_OBJECT
public:
explicit EdhrecCommanderApiResponseCardListDisplayWidget(QWidget *parent,
EdhrecCommanderApiResponseCardList toDisplay);
explicit EdhrecApiResponseCardListDisplayWidget(QWidget *parent, EdhrecApiResponseCardList toDisplay);
void resizeEvent(QResizeEvent *event) override;
[[nodiscard]] QString getBannerText() const
{

View File

@@ -0,0 +1,28 @@
#include "edhrec_api_response_card_synergy_display_widget.h"
EdhrecApiResponseCardSynergyDisplayWidget::EdhrecApiResponseCardSynergyDisplayWidget(
QWidget *parent,
const EdhrecApiResponseCardDetails &_toDisplay)
: QWidget(parent), toDisplay(_toDisplay)
{
layout = new QVBoxLayout(this);
setLayout(layout);
label = new QLabel(this);
label->setAlignment(Qt::AlignCenter);
percentBarWidget = new PercentBarWidget(this, toDisplay.synergy * 100.0);
if (toDisplay.synergy != 0) {
layout->addWidget(label);
layout->addWidget(percentBarWidget);
} else {
hide();
}
retranslateUi();
}
void EdhrecApiResponseCardSynergyDisplayWidget::retranslateUi()
{
label->setText(tr("%1% Synergy").arg(QString::number(toDisplay.synergy * 100.0, 'f', 1)));
}

View File

@@ -0,0 +1,25 @@
#ifndef EDHREC_API_RESPONSE_CARD_SYNERGY_DISPLAY_WIDGET_H
#define EDHREC_API_RESPONSE_CARD_SYNERGY_DISPLAY_WIDGET_H
#include "../../../../../ui/widgets/general/display/percent_bar_widget.h"
#include "../../api_response/cards/edhrec_api_response_card_details.h"
#include <QLabel>
#include <QVBoxLayout>
#include <QWidget>
class EdhrecApiResponseCardSynergyDisplayWidget : public QWidget
{
Q_OBJECT
public:
EdhrecApiResponseCardSynergyDisplayWidget(QWidget *parent, const EdhrecApiResponseCardDetails &_toDisplay);
void retranslateUi();
private:
QVBoxLayout *layout;
EdhrecApiResponseCardDetails toDisplay;
QLabel *label;
PercentBarWidget *percentBarWidget;
};
#endif // EDHREC_API_RESPONSE_CARD_SYNERGY_DISPLAY_WIDGET_H

View File

@@ -0,0 +1,60 @@
#include "edhrec_api_response_commander_details_display_widget.h"
#include "../../../../../../game/cards/card_database_manager.h"
#include "../../../../../ui/widgets/cards/card_info_picture_widget.h"
#include "../../tab_edhrec_main.h"
#include "../card_prices/edhrec_api_response_card_prices_display_widget.h"
EdhrecCommanderResponseCommanderDetailsDisplayWidget::EdhrecCommanderResponseCommanderDetailsDisplayWidget(
QWidget *parent,
const EdhrecCommanderApiResponseCommanderDetails &_commanderDetails,
QString baseUrl)
: QWidget(parent), commanderDetails(_commanderDetails)
{
layout = new QVBoxLayout(this);
setLayout(layout);
commanderPicture = new CardInfoPictureWidget(this);
commanderPicture->setCard(CardDatabaseManager::getInstance()->getCard(commanderDetails.getName()));
QWidget *currentParent = parentWidget();
TabEdhRecMain *parentTab = nullptr;
while (currentParent) {
if ((parentTab = qobject_cast<TabEdhRecMain *>(currentParent))) {
break;
}
currentParent = currentParent->parentWidget();
}
if (parentTab) {
connect(parentTab->getCardSizeSlider()->getSlider(), &QSlider::valueChanged, commanderPicture,
&CardInfoPictureWidget::setScaleFactor);
commanderPicture->setScaleFactor(parentTab->getCardSizeSlider()->getSlider()->value());
}
commanderDetails.debugPrint();
label = new QLabel(this);
label->setAlignment(Qt::AlignCenter);
salt = new QLabel(this);
salt->setAlignment(Qt::AlignCenter);
cardPricesDisplayWidget = new EdhrecApiResponseCardPricesDisplayWidget(this, commanderDetails.getPrices());
navigationWidget = new EdhrecCommanderApiResponseNavigationWidget(this, commanderDetails, baseUrl);
layout->addWidget(commanderPicture);
layout->addWidget(label);
layout->addWidget(salt);
layout->addWidget(cardPricesDisplayWidget);
layout->addWidget(navigationWidget);
retranslateUi();
}
void EdhrecCommanderResponseCommanderDetailsDisplayWidget::retranslateUi()
{
label->setText(commanderDetails.getLabel());
salt->setText(tr("Salt: ") + QString::number(commanderDetails.getSalt()));
}

View File

@@ -1,28 +1,34 @@
#ifndef EDHREC_COMMANDER_API_RESPONSE_COMMANDER_DETAILS_DISPLAY_WIDGET_H
#define EDHREC_COMMANDER_API_RESPONSE_COMMANDER_DETAILS_DISPLAY_WIDGET_H
#include "../../../ui/widgets/cards/card_info_picture_widget.h"
#include "api_response/edhrec_commander_api_response_commander_details.h"
#include "../../../../../ui/widgets/cards/card_info_picture_widget.h"
#include "../../api_response/cards/edhrec_commander_api_response_commander_details.h"
#include "../card_prices/edhrec_api_response_card_prices_display_widget.h"
#include "edhrec_commander_api_response_navigation_widget.h"
#include <QLabel>
#include <QVBoxLayout>
#include <QWidget>
class EdhrecCommanderApiResponseNavigationWidget;
class EdhrecCommanderResponseCommanderDetailsDisplayWidget : public QWidget
{
Q_OBJECT
public:
explicit EdhrecCommanderResponseCommanderDetailsDisplayWidget(
QWidget *parent,
const EdhrecCommanderApiResponseCommanderDetails &_commanderDetails);
const EdhrecCommanderApiResponseCommanderDetails &_commanderDetails,
QString baseUrl);
void retranslateUi();
private:
QLabel *label;
QLabel *salt;
EdhrecCommanderApiResponseCommanderDetails commanderDetails;
QVBoxLayout *layout;
CardInfoPictureWidget *commanderPicture;
EdhrecCommanderApiResponseCommanderDetails commanderDetails;
QLabel *label;
QLabel *salt;
EdhrecApiResponseCardPricesDisplayWidget *cardPricesDisplayWidget;
EdhrecCommanderApiResponseNavigationWidget *navigationWidget;
};
#endif // EDHREC_COMMANDER_API_RESPONSE_COMMANDER_DETAILS_DISPLAY_WIDGET_H

View File

@@ -1,9 +1,9 @@
#include "edhrec_commander_api_response_display_widget.h"
#include "../../../ui/widgets/cards/card_info_picture_widget.h"
#include "api_response/edhrec_commander_api_response.h"
#include "edhrec_commander_api_response_card_list_display_widget.h"
#include "edhrec_commander_api_response_commander_details_display_widget.h"
#include "../../../../../ui/widgets/cards/card_info_picture_widget.h"
#include "../../api_response/commander/edhrec_commander_api_response.h"
#include "../cards/edhrec_api_response_card_list_display_widget.h"
#include "edhrec_api_response_commander_details_display_widget.h"
#include <QListView>
#include <QResizeEvent>
@@ -12,7 +12,8 @@
#include <QStringListModel>
EdhrecCommanderApiResponseDisplayWidget::EdhrecCommanderApiResponseDisplayWidget(QWidget *parent,
EdhrecCommanderApiResponse response)
EdhrecCommanderApiResponse response,
QString baseUrl)
: QWidget(parent)
{
layout = new QHBoxLayout(this);
@@ -31,15 +32,15 @@ EdhrecCommanderApiResponseDisplayWidget::EdhrecCommanderApiResponseDisplayWidget
QStringList widgetNames;
// Add commander details
auto commanderPicture =
new EdhrecCommanderResponseCommanderDetailsDisplayWidget(this, response.container.getCommanderDetails());
auto commanderPicture = new EdhrecCommanderResponseCommanderDetailsDisplayWidget(
this, response.container.getCommanderDetails(), baseUrl);
cardDisplayLayout->addWidget(commanderPicture);
widgetNames.append("Commander Details");
// Add card list widgets
auto edhrec_commander_api_response_card_lists = response.container.getCardlists();
for (const EdhrecCommanderApiResponseCardList &card_list : edhrec_commander_api_response_card_lists) {
auto cardListDisplayWidget = new EdhrecCommanderApiResponseCardListDisplayWidget(this, card_list);
for (const EdhrecApiResponseCardList &card_list : edhrec_commander_api_response_card_lists) {
auto cardListDisplayWidget = new EdhrecApiResponseCardListDisplayWidget(this, card_list);
cardDisplayLayout->addWidget(cardListDisplayWidget);
widgetNames.append(cardListDisplayWidget->getBannerText());
}

View File

@@ -1,7 +1,7 @@
#ifndef EDHREC_COMMANDER_API_RESPONSE_DISPLAY_WIDGET_H
#define EDHREC_COMMANDER_API_RESPONSE_DISPLAY_WIDGET_H
#include "api_response/edhrec_commander_api_response.h"
#include "../../api_response/commander/edhrec_commander_api_response.h"
#include <QScrollArea>
#include <QVBoxLayout>
@@ -12,7 +12,9 @@ class EdhrecCommanderApiResponseDisplayWidget : public QWidget
Q_OBJECT
public:
explicit EdhrecCommanderApiResponseDisplayWidget(QWidget *parent, EdhrecCommanderApiResponse response);
explicit EdhrecCommanderApiResponseDisplayWidget(QWidget *parent,
EdhrecCommanderApiResponse response,
QString baseUrl);
void resizeEvent(QResizeEvent *event) override;
public slots:

View File

@@ -0,0 +1,174 @@
#include "edhrec_commander_api_response_navigation_widget.h"
#include "../../tab_edhrec_main.h"
EdhrecCommanderApiResponseNavigationWidget::EdhrecCommanderApiResponseNavigationWidget(
QWidget *parent,
const EdhrecCommanderApiResponseCommanderDetails &_commanderDetails,
QString baseUrl)
: QWidget(parent), commanderDetails(_commanderDetails)
{
layout = new QGridLayout(this);
setLayout(layout);
gameChangerLabel = new QLabel(this);
budgetLabel = new QLabel(this);
comboPushButton = new QPushButton(this);
averageDeckPushButton = new QPushButton(this);
layout->addWidget(comboPushButton, 0, 0, 1, 1);
layout->addWidget(averageDeckPushButton, 0, 1, 1, 1);
layout->addWidget(gameChangerLabel, 1, 0, 1, 2);
for (int i = 0; i < gameChangerOptions.length(); i++) {
QString option = gameChangerOptions.at(i);
QString label = option.isEmpty() ? "All" : option.at(0).toUpper() + option.mid(1);
QPushButton *optionButton = new QPushButton(label, this);
gameChangerButtons[option] = optionButton;
layout->addWidget(optionButton, 2, i);
connect(optionButton, &QPushButton::clicked, this, [=, this]() {
selectedGameChanger = option;
updateOptionButtonSelection(gameChangerButtons, option);
actRequestCommanderNavigation();
});
}
layout->addWidget(budgetLabel, 3, 0, 1, 2);
for (int i = 0; i < budgetOptions.length(); i++) {
QString option = budgetOptions.at(i);
QString label = option.isEmpty() ? "Any" : option.at(0).toUpper() + option.mid(1);
QPushButton *btn = new QPushButton(label, this);
budgetButtons[option] = btn;
layout->addWidget(btn, 4, i);
connect(btn, &QPushButton::clicked, this, [=, this]() {
selectedBudget = option;
updateOptionButtonSelection(budgetButtons, option);
actRequestCommanderNavigation();
});
}
updateOptionButtonSelection(gameChangerButtons, "");
updateOptionButtonSelection(budgetButtons, "");
QWidget *currentParent = parentWidget();
TabEdhRecMain *parentTab = nullptr;
while (currentParent) {
if ((parentTab = qobject_cast<TabEdhRecMain *>(currentParent))) {
break;
}
currentParent = currentParent->parentWidget();
}
if (parentTab) {
connect(comboPushButton, &QPushButton::clicked, this,
&EdhrecCommanderApiResponseNavigationWidget::actRequestComboNavigation);
connect(averageDeckPushButton, &QPushButton::clicked, this,
&EdhrecCommanderApiResponseNavigationWidget::actRequestAverageDeckNavigation);
connect(this, &EdhrecCommanderApiResponseNavigationWidget::requestUrl, parentTab,
&TabEdhRecMain::actNavigatePage);
}
retranslateUi();
applyOptionsFromUrl(baseUrl);
}
void EdhrecCommanderApiResponseNavigationWidget::retranslateUi()
{
comboPushButton->setText(tr("Combos"));
averageDeckPushButton->setText(tr("Average Deck"));
gameChangerLabel->setText(tr("Game Changers"));
budgetLabel->setText(tr("Budget"));
}
void EdhrecCommanderApiResponseNavigationWidget::applyOptionsFromUrl(const QString &url)
{
QString cleanedUrl = url;
// Remove base and file extension
if (cleanedUrl.startsWith("https://json.edhrec.com/pages/")) {
cleanedUrl = cleanedUrl.mid(QString("https://json.edhrec.com/pages/").length());
}
if (cleanedUrl.endsWith(".json")) {
cleanedUrl.chop(5);
}
// Expecting something like: "commanders/the-ur-dragon/core/expensive"
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList parts = cleanedUrl.split('/', Qt::SkipEmptyParts);
#else
QStringList parts = cleanedUrl.split('/', QString::SkipEmptyParts);
#endif
if (parts.size() < 2) {
return;
}
QString commanderName = parts[1];
QString gameChangerOpt, budgetOpt;
// Define valid sets
QSet<QString> validGameChangers = {"core", "upgraded", "optimized"};
QSet<QString> validBudgets = {"budget", "expensive"};
// Check remaining parts after commander
for (int i = 2; i < parts.size(); ++i) {
QString part = parts[i].toLower();
if (validGameChangers.contains(part)) {
gameChangerOpt = part;
} else if (validBudgets.contains(part)) {
budgetOpt = part;
}
}
// Validate and apply
if (!gameChangerButtons.contains(gameChangerOpt)) {
gameChangerOpt.clear();
}
if (!budgetButtons.contains(budgetOpt)) {
budgetOpt.clear();
}
selectedGameChanger = gameChangerOpt;
selectedBudget = budgetOpt;
updateOptionButtonSelection(gameChangerButtons, selectedGameChanger);
updateOptionButtonSelection(budgetButtons, selectedBudget);
}
void EdhrecCommanderApiResponseNavigationWidget::updateOptionButtonSelection(QMap<QString, QPushButton *> &buttons,
const QString &selectedKey)
{
for (auto it = buttons.begin(); it != buttons.end(); ++it) {
it.value()->setStyleSheet(it.key() == selectedKey ? "background-color: lightblue; font-weight: bold;" : "");
}
}
QString EdhrecCommanderApiResponseNavigationWidget::addNavigationOptionsToUrl(QString baseUrl)
{
if (!selectedGameChanger.isEmpty()) {
baseUrl += "/" + selectedGameChanger;
}
if (!selectedBudget.isEmpty()) {
baseUrl += "/" + selectedBudget;
}
return baseUrl;
}
void EdhrecCommanderApiResponseNavigationWidget::actRequestCommanderNavigation()
{
emit requestUrl(addNavigationOptionsToUrl("/commanders/" + commanderDetails.getSanitized()));
}
void EdhrecCommanderApiResponseNavigationWidget::actRequestComboNavigation()
{
emit requestUrl("/combos/" + commanderDetails.getSanitized());
}
void EdhrecCommanderApiResponseNavigationWidget::actRequestAverageDeckNavigation()
{
emit requestUrl(addNavigationOptionsToUrl("/average-decks/" + commanderDetails.getSanitized()));
}

View File

@@ -0,0 +1,54 @@
#ifndef EDHREC_COMMANDER_API_RESPONSE_NAVIGATION_WIDGET_H
#define EDHREC_COMMANDER_API_RESPONSE_NAVIGATION_WIDGET_H
#include "edhrec_api_response_commander_details_display_widget.h"
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QWidget>
class EdhrecCommanderApiResponseNavigationWidget : public QWidget
{
Q_OBJECT
public:
explicit EdhrecCommanderApiResponseNavigationWidget(
QWidget *parent,
const EdhrecCommanderApiResponseCommanderDetails &_commanderDetails,
QString baseUrl);
void retranslateUi();
void applyOptionsFromUrl(const QString &url);
public slots:
void actRequestCommanderNavigation();
void actRequestComboNavigation();
void actRequestAverageDeckNavigation();
signals:
void requestUrl(QString url);
private:
QGridLayout *layout;
QLabel *gameChangerLabel;
QLabel *budgetLabel;
QStringList gameChangerOptions = {"", "core", "upgraded", "optimized"};
QStringList budgetOptions = {"", "budget", "expensive"};
QString selectedGameChanger;
QString selectedBudget;
QMap<QString, QPushButton *> gameChangerButtons;
QMap<QString, QPushButton *> budgetButtons;
QPushButton *comboPushButton;
QPushButton *averageDeckPushButton;
EdhrecCommanderApiResponseCommanderDetails commanderDetails;
void updateOptionButtonSelection(QMap<QString, QPushButton *> &buttons, const QString &selectedKey);
QString addNavigationOptionsToUrl(QString baseUrl);
QString buildComboUrl() const;
};
#endif // EDHREC_COMMANDER_API_RESPONSE_NAVIGATION_WIDGET_H

View File

@@ -0,0 +1,45 @@
#include "edhrec_top_cards_api_response_display_widget.h"
#include "../../api_response/top_cards/edhrec_top_cards_api_response.h"
#include "../cards/edhrec_api_response_card_list_display_widget.h"
EdhrecTopCardsApiResponseDisplayWidget::EdhrecTopCardsApiResponseDisplayWidget(QWidget *parent,
EdhrecTopCardsApiResponse response)
: QWidget(parent)
{
layout = new QHBoxLayout(this);
setLayout(layout);
cardDisplayLayout = new QVBoxLayout(this);
// Add card list widgets
auto edhrec_commander_api_response_card_lists = response.container.getCardlists();
for (const EdhrecApiResponseCardList &card_list : edhrec_commander_api_response_card_lists) {
auto cardListDisplayWidget = new EdhrecApiResponseCardListDisplayWidget(this, card_list);
cardDisplayLayout->addWidget(cardListDisplayWidget);
}
// Create a QScrollArea to hold the card display widgets
scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// Set the cardDisplayLayout inside the scroll area
auto scrollWidget = new QWidget(scrollArea);
scrollWidget->setLayout(cardDisplayLayout);
scrollArea->setWidget(scrollWidget);
layout->addWidget(scrollArea);
}
void EdhrecTopCardsApiResponseDisplayWidget::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
layout->invalidate();
layout->activate();
layout->update();
if (scrollArea && scrollArea->widget()) {
scrollArea->widget()->resize(event->size());
}
}

View File

@@ -0,0 +1,25 @@
#ifndef EDHREC_TOP_CARDS_API_RESPONSE_DISPLAY_WIDGET_H
#define EDHREC_TOP_CARDS_API_RESPONSE_DISPLAY_WIDGET_H
#include "../../api_response/top_cards/edhrec_top_cards_api_response.h"
#include <QResizeEvent>
#include <QScrollArea>
#include <QVBoxLayout>
#include <QWidget>
class EdhrecTopCardsApiResponseDisplayWidget : public QWidget
{
Q_OBJECT
public:
explicit EdhrecTopCardsApiResponseDisplayWidget(QWidget *parent, EdhrecTopCardsApiResponse response);
void resizeEvent(QResizeEvent *event) override;
private:
QHBoxLayout *layout;
QVBoxLayout *cardDisplayLayout;
QScrollArea *scrollArea;
};
#endif // EDHREC_TOP_CARDS_API_RESPONSE_DISPLAY_WIDGET_H

Some files were not shown because too many files have changed in this diff Show More