Commit graph

4600 commits

Author SHA1 Message Date
tooomm
45a5296013
CI: Fix versions before deprecation (#4798)
* fix deprecation warning

* fix deprecation warning
2023-04-30 13:51:09 +02:00
SlightlyCircuitous
5f0ab2a177
CPack DMG Installer with Background Image (#4787)
* Set some CPack variables

WIP for DMG background image

* Use a .tif for background

* Add Background image and DS_Store script

Script is from https://www.kitware.com//creating-mac-os-x-packages-with-cmake/ with cmake.app changed to cockatrice.app

* Add position for all icons

* Adjust background size and icon position

This draws dbconverter off the screen as a hack to hide it, so hopefully it doesn't break.

* Add files via upload

* Change Icon Position

Icon position is probably relative to the window edge, not the edge of the screen so the numbers should be lower.

* Adjust Icon Position and Window Boundaries

Applescript seems to use the center of the icon rather than the left corner so the coordinates need to be adjusted by 64 px. 

The finder window counts the 22 px of the title bar in the window size so 22 must be added to the fourth coord of position to fit the entire image.

* Fix spelling of Servatrice

* Satifsfy Code Style

* Use vector format (eps)

* Delete background.tif

* Use vector format (eps)

* Use the right file extention in the script

* Point to svg

* Use svg

* Add svg for background image

* Delete background.eps

* Use plain SVG, adjust text

* Move applescript to /cmake

* Move background to /cmake

* Point CPack to /cmake

background and applescript now reside there

* Revert to .tif

* Use compressed .tif

* Use more specific file name

* Script expects .background:background.tif
2023-04-29 23:13:01 -04:00
ebbit1q
70ab02987a
save sets dialog size (#4791)
* save sets dialog size

* reset sorting when restoring

* add to gitignore
2023-04-29 23:10:59 -04:00
ebbit1q
421da882d8
qt 6.5 compatibility (#4796)
* remove metatypes definitions

* deprecation of QApplication::setActiveWindow
2023-04-29 23:09:26 -04:00
SlightlyCircuitous
1a40102f71
Remove Debian 10 "Buster" Build (#4789)
* Drop Debian 10 Support

EOL September 10 2022

* Drop Debian 10 Support

EOL September 10, 2022

* Drop Debian 10 Support

EOL September 10, 2022
2023-04-19 23:04:35 +02:00
SlightlyCircuitous
1fbc10cd77
Add Ubuntu 23.04 Lunar Lobster Build (#4784)
* Create Lunar Dockerfile

Note that qt6-svg-dev and qt6-websockets-dev are renamed replacements for libqt6svg6-dev and libqt6websockets6-dev, respectively.

* Add Ubuntu Lunar

* Add Ubuntu Lunar to Template
2023-04-12 22:31:39 +02:00
skwerlman
87462398d8
show deck hash even when its invalid (#4595)
* show deck hash even when its invalid

* remove invalid deck hashes entirely

---------

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2023-04-10 22:29:29 +02:00
dependabot[bot]
b33246b29f
Bump loader-utils from 2.0.3 to 2.0.4 in /webclient (#4707)
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 2.0.3 to 2.0.4.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v2.0.4/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v2.0.3...v2.0.4)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-01 22:31:44 -04:00
transifex-integration[bot]
dbffe30f63
Translate /webclient/src/i18n-default.json in es (#4657)
translation completed for the source file '/webclient/src/i18n-default.json'
on the 'es' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-01 22:30:59 -04:00
ebbit1q
9ce450d0b0
add _substr_[pos]_[len] to picture download templates (#4762) 2023-04-01 22:29:57 -04:00
ebbit1q
f5f8acf1fd
save downloaded xmls (#4736) 2023-04-01 22:19:57 -04:00
tooomm
304ed3cd60
UI: User info dialog updates (#4533) 2023-04-01 21:50:49 -04:00
dependabot[bot]
07248692ce
Bump webpack from 5.74.0 to 5.76.1 in /webclient (#4774)
Bumps [webpack](https://github.com/webpack/webpack) from 5.74.0 to 5.76.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.74.0...v5.76.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-15 23:46:50 -04:00
Brent Clark
cef99cba71
Add left nav (#4705)
* Automated translation update ( bf08a04cda )

* Add Layout component wip

* finish layout implementation

* convert header to left nav

* better nav item spacing

* return source files to original glory

* lint fix

* Remove height limit on login screen

* fix top spacing on 3-panel layout

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Brent Clark <brent@backboneiq.com>
2023-03-15 23:45:55 -04:00
SlightlyCircuitous
cab5f29b57
Add 'persistent' as valid attribute of related (#4771) 2023-03-10 02:36:17 +01:00
Basile Clement
55a2f75d16
Make cards rounded (#4765)
* Make cards rounded

Magic cards have rounded corners, and playing cards tend to have rounded
corners as well, but Cockatrice currently displays rectangular cards.

This can cause visual glitches when using image scans where the border
does not extend in the corner, and for this reason Cockatrice always
draws a (rectangular) border around the card to try and make it look a
bit better.

In this patch I take a different approach: rather than try to make
rounded pegs, er, cards, go into a square hole, the hole is now rounded.
More precisely, the AbstractCardItem now has a rounded rectangular shape
(with a corner of 5% of the width of the card, identical to that of
modern M:TG physical cards).

As a side effect, the card drawing gets a bit simplified by getting rid
of transformPainter() when drawing the card outline and using the
QPainter::drawPixmap overloads that takes a target QRectF instead.  This
means we no longer have to bother about card rotation when painting
since that's taken care of by the Graphics View framework (which
transformPainter() undoes).

* format

* Also give PileZone rounded corners

* Forgot untap status + bits of CardDragItem

* fix deckviewcard calculations

* Rounded CardInfoPicture
2023-03-07 01:41:08 +01:00
ebbit1q
a416ee8f2b
set target to sha in release creation (#4763) 2023-03-03 11:40:16 -05:00
Basile Clement
c14936c63c
PictureLoader: Replace downloadedPics cache with QNetworkCache (#4756)
* PictureLoader: Replace downloadedPics cache with QNetworkCache

Currently when the "Download card pictures on the fly" option is
enabled, Cockatrice stores downloaded pictures into a downloadedPics
sub-folder, keyed on set and card name. If a picture is found in that
folder, we never try to download a picture for that card ever again
(until it is reprinted in a more recent set, I guess).

This has the unfortunate consequence that if you change the URLs for
downloading card images, the changes are not applied to cards that
already have their picture downloaded. In particular, if you use
localized card pictures (through !sflang!), you get a mix of cards in
different languages depending on the currently configured language at
the time each card was downloaded.

This patch removes that mechanism in favor of setting a
QNetworkDiskCache on the QNetworkAccessManager used by the PictureLoader
to download pictures. The QNetworkDiskCache caches the picture keyed on
their URL: if the URL changes, a new request will be made. In
particular, if you use picture URLs with !sflang! and change the
language, pictures for the current language will be downloaded even for
cards that already have a picture. The QNetworkDiskCache is configured
with a maximum size of 4GB, which should be enough to hold one
high-quality JPEG for each M:TG card in existence.

Note that this does not affect the existing mechanism for defining
custom card art, either through the CUSTOM directory or the set-based
one.  Cockatrice will still read existing cards in the downloadedPics
directory as before, it will just no longer write into that directory
(since pictures are cached by the QNetworkDiskCache instead). To fully
switch to the new cache, users should use the "Delete Downloaded Images"
button in the settings: it will clear the QNetworkDiskCache but also
remove the downloadedPics directory.

* Do not use system cache dir for portable installs

* Add settings for network cache size

* Delete corrupted cache entries

* Use old-style connect() syntax (Qt5 build failure)

* Add setNetworkCacheSizeInMB to test mocks

* setTransferTimeout was added in Qt 5.15

* Improve logging messages

We now have the following messages

 - "Trying to download picture from url: URL" before loading a picture
   when picture download is enabled
 - "Trying to load picture from cache: URL" before loading a picture
   when picture download is disabled (i.e. cache-only offline mode)
 - "Removing corrupted cache file for url URL and retrying (ERR)" when
   when we fail to load a picture from the cache. Usually, this should
   be due to the timeout, in which case ERR will be "Operation
   Canceled".
 - "Download failed for url URL (ERR)" when there was an error
   downloading a picture from the network (ERR is the error message)
 - "Following redirect to URL" and "Following cached redirect to URL"
   when following a redirect (from network/from cache)
 - "Image successfully downloaded from URL" and "Image successfully
   loaded from cached url at URL" on success
 - "Possible cached/downloaded picture at URL could not be loaded" on
   ImageReader error

* Clarify that network cache is on disk

Also migrate "Delete Downloaded Image" to a "Clear" button right next to
the network cache size.

* Remove qPrintable

* Move pixmap cache settings to card sources

* qDebug().nospace()

* some formatting on debug messages

* format

* inverted condition

---------

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2023-03-03 16:55:17 +01:00
Basile Clement
42e7a8b423
Better support Double-Faced Cards (#4753)
* Better support Double-Faced Cards

This patch allows cards to be (virtually) transformed into other cards
while preserving their state, essentially implemeting the MTG mechanic
of the same name.

On the server side, this is implemented by allowing cards to be "stashed
away". A card that is stashed away is not in any zone, but is instead
owned by another card. When a token is destroyed due to a zone change,
if it had a card stashed away, that card is placed in the target zone
instead of the token.

On the database side, `attach="transform"` is used on `<reverse>` and
`<reverse-related>` to indicate that the created token should be
transformed this way.

Old servers ignore the new field in `Command_CreateToken` and will
perform a regular attachment, as currently.

* Address review comments

* Prevent tokens from being stashed

* format.sh
2023-03-03 16:54:51 +01:00
ebbit1q
4558b1c7ef
set the target in the created release (#4758)
the target needs to be the current short commit hash because it is being
compared to by the updater, the default is "master" which breaks the
updater.
2023-02-23 01:11:41 +01:00
SlightlyCircuitous
f444ba9665
Corrected edition search syntax (#4752)
* Replaced "e:lea,leb" with "e:lea or e:leb"
* Removed "e:lea,leb -(e:lea e:leb) (Cards that appear in Alpha or Beta but not in both editions)" as this does not produce results in Cockatrice (even when using "or" instead of "," as above)
2023-02-16 12:08:00 +01:00
ebbit1q
787c8d740b
replace github release actions with the gh tool in bash (#4746)
* replace github release actions with the gh tool in bash

* set macos 10.15 qt version to 6.2 LTS
2023-02-10 03:33:48 -05:00
Basile Clement
ef38a8bb2b
Re-add missing '/' separator in <pt> after b282df2e27 (#4747)
In b282df2e27 (#4728) the logic for
creating <pt> values was updated to avoid adding a final slash after an
existing power value and missing toughness value. This works by setting
the ptSeparator to an empty string when either the power or the
toughness is undefined. However, due to the ptSeparator variable being
scoped out of the `for` loop, this causes all remaining cards to have an
empty string as a separator, ending up with <pt> values of e.g. 21
instead of 2/1.

Moreover, the implementation from #4728 is ambiguous in the case of a
card having a toughness value but no power value: in that situation, it
creates a <pt> entry with the toughness value and no separator, which is
not a good idea since it is not possible to know if <pt>2</pt> means
power 2 and no toughness, or no power and toughness 2 (Cockatrice takes
the first interpretation).

To avoid ambiguities, the <pt> value is now one of:

 1. A regular P/T value when the card has power and toughness
 2. A simplified P value when the card has power but no toughness
 3. A simplified /T value when the card has toughness but no power
 4. Absent when the card has neither power nor toughness

Note that, as far as I can tell, Cockatrice seems to (incorrectly, IMO)
ignore the initial slash if present in Player::parsePT, and treat /T as
a power value. However that is a separate issue: this patch is concerned
with Oracle and ensuring proper values in cards.xml, not with how
Cockatrice interprets those values.
2023-02-08 19:59:14 +01:00
Jeremy Letto
b5d35d346a
Add architecture image to webclient README (#4745) 2023-02-08 18:04:23 +01:00
Basile Clement
9a7b15d19b
Allow revealing specific cards from hand and library (#4743)
Currently Cockatrice allows revealing the whole hand, or one card at
random from the hand. Sometimes, a player needs to reveal a specific
card from their hand instead, which is not supported. To achieve a
similar effect, players usually move the corresponding card (or cards)
to a public zone, then back to their hand. While this works, it is
unsatisfactory (compared to a regular reveal, you can't keep the
"revealed" window around, for one) and somewhat unintuitive.

This patch adds a "Reveal to..." menu to cards and card selections in
the player's hand or in custom zones (this includes looking at the
player's library). This menu allows revealing a card or set of cards to
any given player, or to all players.

To implement this functionality at the protocol level, the existing
RevealCards command is extended to support revealing multiple specific
cards. This is done by making `card_id` a non-packed repeated field in
the `Command_RevealCards` and `Event_RevealCards` protobufs.  Using a
non-packed repeated fields allows maintaining backwards compatibility:
an empty optional field is encoded the same way as an empty non-packed
list, an optional field with a value is encoded the same way as a
one-element non-packed list, and when decoding a multi-elements
non-packed list as an optional, only the last item in the list is read.

Since the RevealCards command already exists, and due to the compatible
encodings, a new client connecting to an old server can reveal a single
specific card from their hand. When trying to reveal multiple cards at
once, the old server will only see the request for one of the cards to
be revealed, and the player will have to reveal each card separately.

On the other hand, `Event_RevealedCards` already has an explicit list of
cards revealed by the server, and the `card_id` field is only used when
exactly one card has been revealed: thus, old and new clients will
behave identically when receiving a new `Event_RevealedCards`. In
particular, if a player using a new client reveals multiple cards from
their hand on a new server, another player using an old client will
correctly see all the revealed cards.

The approach used to build the "Reveal to..." menu is slightly different
from the approach used to build other player selection menus. Because
the "Reveal to..." menu is specific to each card, but must also be
updated whenever a player is added to or removed from the game, I chose
to re-create it on the fly whenever a card is clicked, as that seemed
the safest way to avoid both memory leaks and inconsistent state given
my understanding of the code.
2023-02-07 17:12:04 -05:00
Zach H
ba35a11e82
Find OpenSSL on Windows (#4730) 2023-02-07 16:47:50 -05:00
Basile Clement
00c9efe541
Enable buttons for current game when receiving server response (#4737)
* Enable buttons for current game when receiving server response

Previously, upon joining a game, we were unconditionally re-enabling the
"Join" button in the lobby, even if it was not enabled in the first
place, causing #4698. This could also lead to issues where if the user
selects a different game after joining (which they can do in case of
e.g. network connectivity issues), the "Join as spectator" button could
get incorrectly disabled.

This fixes #4698 by re-enabling the buttons based on the state of the
currently selected game at the time the response is received. This also
avoids inconsistencies if a different game has been selected in between
joining and receiving a response from the server.

* Typo: enable gameButton in enableButtons

The "create game" button was incorrectly being disabled in enableButtons
whereas (as the name indicates) it should have been enabled

* Remove misleading comment about race conditions
2023-02-06 13:49:45 +01:00
cajun
44d1ab348b
Add Oracle support for persistent & Fix persistent on reverse-related (#4742)
* fix persistent reverse-related

* create relations from spellbook property

* run format.sh
2023-02-06 07:00:54 -05:00
Zach H
f25e4785ae
FIX #4665: Address missing sound on Qt5 Builds (#4733)
* FIX #4665: Address missing sound on Qt5 Builds

* FIX #4665: Address missing sound on Qt5 Builds

* Include both engines
2023-02-05 22:05:47 -05:00
Zach H
4c290aec57
Fix #4706: don't replace ampersands when loading from plain text (#4734)
* Fix #4706: Exit linting early if a card with the exact name is found first

* Remove ampersand conversion

* put back

* Update tests

* Format

* don't use qsizetype

---------

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2023-01-30 00:37:28 +01:00
tooomm
42d1d66d9b
CI: macOS-10.15 environment is deprecated (#4664)
* macOS-10.15 environment is deprecated

Build for 10.14 has to be dropped.
Build for 10.15 can be preserved via 11.

* update xcode versions

* Xcode 13.0 doesn't work for us on Big Sur

* [skip ci] update list of binaries
2023-01-29 12:47:42 -05:00
ebbit1q
06c25301a5
update build dockerfiles (#4732) 2023-01-23 18:14:35 -05:00
transifex-integration[bot]
43dbb45cc6
Translate /webclient/src/i18n-default.json in it (#4718)
translation completed updated for the source file '/webclient/src/i18n-default.json'
on the 'it' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-23 02:26:24 -05:00
dependabot[bot]
9fb62de5cb
Bump json5 from 1.0.1 to 1.0.2 in /webclient (#4729)
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 02:26:12 -05:00
PakhomCh
b282df2e27
Fixed ptSeparation oracle issue (#4728)
* Fixed psTeparation oracle issue

* Update oracle/src/oracleimporter.cpp

Co-authored-by: PakhomCh <pakhomch@gmail.com>
2023-01-16 13:30:19 -05:00
ebbit1q
da8f57f397
remove link to google doc roadmap from readme (#4727) 2023-01-02 22:07:18 -05:00
SlightlyCircuitous
e9f1992c7f
Add URL to explain message macros (#4712)
* Add URL Link to Explain Message Macros

* Add URL Link to Explain Message Macros

* Revert custom shortcuts wiki link

* Conform to formatting guidelines
2022-12-11 23:54:06 +01:00
transifex-integration[bot]
2c94a6a64e
Apply translations in it (#4714)
translation completed for the source file '/cockatrice/cockatrice_en@source.ts'
on the 'it' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-12-11 23:42:51 +01:00
SlightlyCircuitous
6a5e0a8501
Display Welcome Message as Most Recent Message (#4720)
* Move Join Message Block

- Moves Join Message code block to after the for loop that gets old chat message, which makes the Join Message the most recent message in the chat box instead of the oldest
-Only the rc.enqueuePostResponseItem() line really needs to move for functionality, but I have moved the whole block for readability

* Comply with formatting guide

-Remove offending white space
2022-12-11 23:40:47 +01:00
Jeremy Letto
26d7fe2ff0
Webatrice: update deps (#4700)
* save work

* fix reset styling

* fix toast reducer

* update non-react deps

* update react libraries

* remove jquery, use sanitize-html instead

* add missing change

* fix deps and dev deps

* update workflow to target Node 16

* run @mui/codemod to remove @mui/styles

* add default body font size

* update react 17 to 18

* declare enum before use

* add rel attr to links

* fix font sizing issue

* trailing commas

* refactor deep destructuring

Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
2022-11-01 12:41:42 -05:00
ebbit1q
5854a635ca
fix deprecated usage of set-output (#4699) 2022-10-31 23:26:26 +01:00
ebbit1q
3d4858b840
use qt6 in arch builds (#4691)
* use qt6 in arch builds

* fix 6.4.0 deprecations
2022-10-31 23:26:13 +01:00
ebbit1q
dec2a252fa
remove dependency on deprecated qt5 libraries for qt6 (#4692)
* remove dependency on deprecated qt5 libraries for qt6

removes the use of qt6-5compat for builds
replaces use of QRegExp with QRegularExpression
fixes incorrect usage of QRegExp
removes use of QTextCodec
fixes incorrect usage of QTextCodec
sets qtlinguist as a required component for qt6

* fix anchoredPattern not existing in qt 5.11
2022-10-31 23:24:11 +01:00
Jeremy Letto
f619ef23fd
Upgrade to MUI 5 (#4606)
* save work

* fix perf issue on i18n rollup

* fix reset styling

* move body line-height from reset

Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
2022-10-29 20:17:03 -05:00
Antoine Dahan
72743e834e
Selecting game already open in a tab brings user to that tab. (#4653)
* When trying to join a game from GameSelector that's already been joined by you, navigate to its game tab.

* return immediately, do not change button states

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2022-10-29 15:46:50 +02:00
Tobyclark
8e4ddf366c
Added hint when drawing 0 cards (#4697)
* Logging a player drawing 0 cards will now result in the message "player had no cards left to draw."

* Added hint when drawing when deck is empty

* Added hint when drawing when deck is empty

* Added hint when drawing when deck is empty

* Update cockatrice/src/messagelogwidget.cpp

update log message to present tense

Co-authored-by: ebbit1q <ebbit1q@gmail.com>

* added deckIsEmpty parameter to messagelogwidget::logDrawCards

* run format

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2022-10-29 15:46:29 +02:00
ebbit1q
b99bd0176a
update deprecated workflow actions (#4690) 2022-10-17 23:55:07 -04:00
ebbit1q
a68b98b245
update vcpkg submodule (#4689) 2022-10-17 18:23:39 -04:00
transifex-integration[bot]
a69d6ff1b4
Translate /oracle/oracle_en@source.ts in it (#4688)
translation completed for the source file '/oracle/oracle_en@source.ts'
on the 'it' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-10-17 16:43:31 -04:00
transifex-integration[bot]
ec679e95fd
Translate /webclient/src/i18n-default.json in fr (#4678)
translation completed updated for the source file '/webclient/src/i18n-default.json'
on the 'fr' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-10-17 16:43:14 -04:00