Commit graph

29 commits

Author SHA1 Message Date
ebbit1q
18a07274d4
clangify everything with the new header sorting (#3908) 2020-03-18 17:36:02 -04:00
ctrlaltca
b6df5a4ac3 Deal with recent Qt methods deprecation (#3801)
* Deal with recent Qt methods deprecation

 * Use std::sort, std::less instead of qSort/qLess
 * Use QFontMetrics::horizontalAdvance instead of ::width
 * Use qApp->primaryScreen() instead of QDesktopWidget
 * use lambas instead of QSignalMapper
 * Use QTreeWidgetItem::setForeground instead of ::setTextColor
 * Use QDir::setPath instead of operator=(QString)
 * Use QList::swapItemsAt instead of ::swap

* fix error
2019-08-27 20:06:54 -04:00
ebbit1q
9073cb53a8 add !sflang! property for card image urls (#3670)
update translations
add translation for the sflang property to supported languages
2019-04-18 13:01:50 -04:00
Rob Blanckaert
e68305d7bf - CardItems have dummy CardInfos if they arent in the database (#3589)
- If a CardInfo has no sets, add a dummy one to try to download it by non-set specific templates.
2019-02-23 19:52:38 -05:00
ctrlaltca
ed70099e36 Rework of the card database, xml format and oracle parser (#3511)
* CardDB: merge all card properties in a new structure

* Pre Json parser changes

 * Cockatrice: use qt's builtin json support
 * Move qt-json src dir from cockatrice to oracle
 * Add dummy cockatricexml4 parser (yet to be implemented)

* Implement a new parser and xml format

 * cockatricexml4: new xml parser following the "generic properties hash" pattern;
 * oracleimporter: refactor the parsing code to better adapt to cockatricexml4; rewrote split cards parsing
 * carddb: change "colors" from a stringlist to a string
 * carddb: move the getMainCardType() method to the cockatricexml3 parser
 *

* CardInfo: show all properties (stil missing: nice name + translation)

* Rework the "add related card" feature so that it doesn't change the card name in the carddb

Also, fix token count display

* Picture loader: Added support for transform cards

* Fix side information for flip cards

Mtgjson uses side a/b for flip cards, while scryfall doesn't

* Pictureloader: dynamic tag resolution from card properties

Examples old => new
* !cardid! => !set:muid!
* !uuid!   => !set:uuid!
* !collectornumber! => !set:num!
New examples:
 * !prop:type!
 * !prop:manacost!

* Start moving mtg-related property names to a specific file

* Clangify

* Fix tests

* Make gcc an happy puppy

* Revert "Make gcc an happy puppy"

This reverts commit 446ec5f27516c4d3b32dbfc79557f4827c5c5bdf.

* Some gcc fixes

* Share set list between different db parsers, so they won't overwrite one each other

* All glory to the hypnoclangifier!

* Fix test compilation

* Cleanup edited files in the prior PR. (#3519)

* Cleanup edited files in the prior PR.

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Fix includes

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Update carddatabase.h
2019-01-23 18:17:10 -05:00
Zach H
b0e643ecc0
Several download URLs have arrived! (#3494)
* Cockatrice Picture loader uses better defined URLs now
URLs are defined on the Card Management tab
Instead of Primary/Backup, you can now define a list of URLs
List of URLs can be drag/dropped for priority ordering
Oracle now uses scryfallId > mtgjsonUUID for !uuid!

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Simplify to QStringList and remove metacall

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* fix issues brought up by Dae. Also fix how the defaults load to account for first time users.

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* clangify

* Fix save settings on row moved (#3495)

* merge model fix, and reclangify

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Sources > Resources

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>
2019-01-08 15:18:06 -05:00
Zach H
ab1c4cb1d7
Use scryfall urls (#3474) 2018-12-20 18:49:53 -05:00
ctrlaltca
65f41e520e [WIP] Basic mtgjsonv4 support (#3458)
* Basic mtgjsonv4 support

* Fix set type

* [WIP] Oracle: use zx instead of zip

* clanfigy fixes

* Fix reading last block of xz

* Added back zip support

* [WIP] adding xz on ci + fixes

* typo

* resolve conflict

* Make gcc an happy puppy

* test appveyor build

* appveyor maybe

* Appveyor: add  xz bindir

* Update ssl version (the old one is not available anymore)

* Windows is a really shitty platform to code on.

* test vcpkg

* again

* gosh

* nowarn

* warning 2

* static

* Maybe

* cmake fix

* fsck this pain

* FindWin32SslRuntime: add vcpkg path

* Appveyor: cache support, force usable of openssl from vcpkg

* updated as suggested

* ouch

* Import card uuids and expose this property as !uuid! for card image download

* Minor style fixes

* address changed URL
2018-12-20 18:05:03 -05:00
Andrew Zwicky
ed01752cb4 [WIP] Card image loading: Fallback on 404 (#3367)
* 2479: Running clang-format

Reformatting files to be in line with style guidelines.

* 2479: Updates to remove set/url indices

This change removes set and Url indices in favor
of check for empty lists and removing items from them
instead.

* 2479: TransformUrl will now error on missing fields

If transformUrl is called with a template, and the card/set
is missing something required by that template, it will now
return an empty string, instead of the template with an empty
string substituted in.

* 2479: clang-format updates

* 2479: Fixing omission of ! from two properties

* 2479: Adding prefix on debug messages

Adding PictureLoader: to the front of each debug message
from this file, so that it can be more easily filtered out
by grep in the log of a running application.

* 2479: Remove outdated comment

* 2479: Remove unused method from intermediate work

* 2479: Updating QDebug messages to be more consistent

* 2479: clang-format updates

* 2479: Remove repeated code, replace with call to nextUrl

This removes some redundant code that is better replaced with a call
to nextUrl, in case the code needed to populate the nextUrl changes
significantly.

* 2479: Adding more detailed comments

* 2479: Refactor transformUrl

Refactor transformUrl to do everything in a single loop instead
of two almost identical loops.  set information is populated if
present, but is added with empty strings if absent.
2018-08-22 09:52:38 +02:00
Zach H
e341337ce0
Revert "[WIP] Fallback on 404" (#3364) 2018-08-11 09:06:18 -04:00
Andrew Zwicky
cbd430555f 2479: Working Url traversal
Url checking is now working as expected.  In set order,
starting with custom sets, then going in priority
order by url template order, Urls will checked, and the
first successful one will be used.
2018-08-09 23:50:01 -05:00
Andrew Zwicky
8239539946 2479:
Initial work on downloading cards through fallback URLs.

This change will add in the ability to proceed to the next URL
should the first one fail.  First trial shows that it's working,
but needs more refinement.
2018-08-08 22:42:22 -05:00
Andrew Zwicky
846b426a7c 2497: Start to implement fallback on card image urls
Return a list instead of a single url.  This is the start
of getting many possible urls instead of one.  Functionally
identical except that the primary url will be attempted for
cards without a muid.
2018-08-05 16:21:53 -05:00
ctrlaltca
517420cccb Replace CardInfo* and Carset* with smart pointers (#3053)
* Replace CardInfo* and Carset* with smart pointers

* fixes to help memory & c++11 stuff
2018-02-02 12:52:47 -05:00
ctrlaltca
b29bd9e070
Clang-format (#3028)
* 1/3 Add .clang-format file and travis compilation check

* 2/3 Run clang-format

* 3/3 Fix compilation problems due to include reordering

* 3bis/3 AfterControlStatement: false
2018-01-27 10:41:32 +01:00
Psithief
bfcc48f5bf Check for .xlhq (CCGHQ naming scheme) files (#2778) 2017-06-22 22:59:33 -04:00
ctrlaltca
8ad448a23c fix #2600 (#2638) 2017-04-25 00:29:32 -04:00
Zach H
e0636db60d Recursively search CUSTOM folder for images (i.e. subdirectories) (#2251) 2016-12-08 11:00:44 +01:00
Jeff
a2f4fa916e Adds !corrected_name! and !corrected_name_lower! to customURL (#2255) 2016-11-01 00:13:39 -04:00
ctrlaltca
b808d3824b don't use corrected name when downloading card (#2164) 2016-10-22 19:07:58 -04:00
Fabio Bas
ae456a5bc3 Renamed !setnumber! to !collectornumber! 2016-08-20 10:27:23 +02:00
Fabio Bas
8c17e2d12a Implemented !setnumber!
fix #1741
2016-04-08 22:22:22 +02:00
Fabio Bas
1e3fb6c6e1 Rework "paths" settings loading and card database loading
* main.cpp: removed path checking and db loading
 * card database: merge card loading methods into a single one
 * settings cache: take care of returning safe paths for decks,
replays, etc..
 * main window: if db loading fails (eg. first run), propose to run
oracle

NSIS: propose to run cockatrice instead of oracle

Rework card database loading

 * Move carddatabase-related method out of deckeditor tab
 * Load cards in another thread and render them progressively
 * Optimize database reload after enabled sets change

Fix deck editor column width

 * removed the noCard hack.
 * getCard() no more creates cards instead of just returning existing
ones
 * Fix the “edit tokens” dialog.
 * PictureLoader: avoid trying to download twice the same card
 * PictureLoader: correct return of card background
 * AbstractCardItem: avoid recalculating card color at every paint

Use a different file to save custom tokens

Misc required improvements

 * Use nullptr;
 * Refactor CardInfoWidget to use CardInfoPicture and CardInfoText
instead of duplicating code;
 * Added CardInfo::getColorChar()
 * Fixed some potential crashes
 * removed dead code related to CardInfoWidget
 * Don't require a restart after adding a new custom sets file
 * Bump CMake requirements to 3.1
2016-03-15 22:27:55 +01:00
Fabio Bas
133693d9ce Fix pixmap usage in pictureloader
fix #1765
2016-01-23 11:00:10 +01:00
Fabio Bas
e721280bc0 Implemented proposed changes 2015-12-26 16:40:17 +01:00
Fabio Bas
4d7795ca3a Split pictuloader out of carddatabase 2015-12-26 16:40:17 +01:00
Zach
d5adec53a2 Revert "Reimplemented PictureLoader as a singleton" 2015-09-23 03:17:33 -04:00
Fabio Bas
e0383af6dd workaround "Signals are protected in qt4" 2015-09-22 23:57:39 +02:00
Fabio Bas
f6c7f3355f Reimplemented PictureLoader as a singleton
* Removed remaining picture handling from card database and cardinfo
 * removed the “noCard object” hack
2015-09-22 23:09:53 +02:00