Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
45c2e6f6
Commit
45c2e6f6
authored
Jun 15, 2015
by
Zach H
Browse files
Allow Custom HQ URL
parent
50b908c7
Changes
4
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/carddatabase.cpp
View file @
45c2e6f6
...
...
@@ -337,16 +337,26 @@ QString PictureLoader::getPicUrl()
picUrl
=
picDownloadHq
?
settingsCache
->
getPicUrlHqFallback
()
:
settingsCache
->
getPicUrlFallback
();
picUrl
.
replace
(
"!name!"
,
QUrl
::
toPercentEncoding
(
card
->
getCorrectedName
()));
picUrl
.
replace
(
"!name_lower!"
,
QUrl
::
toPercentEncoding
(
card
->
getCorrectedName
().
toLower
()));
picUrl
.
replace
(
"!cardid!"
,
QUrl
::
toPercentEncoding
(
QString
::
number
(
muid
)));
if
(
set
)
{
if
(
set
)
{
picUrl
.
replace
(
"!setcode!"
,
QUrl
::
toPercentEncoding
(
set
->
getShortName
()));
picUrl
.
replace
(
"!setcode_lower!"
,
QUrl
::
toPercentEncoding
(
set
->
getShortName
().
toLower
()));
picUrl
.
replace
(
"!setname!"
,
QUrl
::
toPercentEncoding
(
set
->
getLongName
()));
picUrl
.
replace
(
"!setname_lower!"
,
QUrl
::
toPercentEncoding
(
set
->
getLongName
().
toLower
()));
}
if
(
picUrl
.
contains
(
"!name!"
)
||
picUrl
.
contains
(
"!setcode!"
)
||
picUrl
.
contains
(
"!setname!"
)
||
picUrl
.
contains
(
"!cardid!"
))
{
if
(
picUrl
.
contains
(
"!name!"
)
||
picUrl
.
contains
(
"!name_lower!"
)
||
picUrl
.
contains
(
"!setcode!"
)
||
picUrl
.
contains
(
"!setcode_lower!"
)
||
picUrl
.
contains
(
"!setname!"
)
||
picUrl
.
contains
(
"!setname_lower!"
)
||
picUrl
.
contains
(
"!cardid!"
)
)
{
qDebug
()
<<
"Insufficient card data to download"
<<
card
->
getName
()
<<
"Url:"
<<
picUrl
;
return
QString
(
""
);
}
...
...
cockatrice/src/dlg_settings.cpp
View file @
45c2e6f6
...
...
@@ -51,12 +51,17 @@ GeneralSettingsPage::GeneralSettingsPage()
pixmapCacheEdit
.
setSuffix
(
" MB"
);
picDownloadHqCheckBox
.
setChecked
(
settingsCache
->
getPicDownloadHq
());
picDownloadCheckBox
.
setChecked
(
settingsCache
->
getPicDownload
());
highQualityURLEdit
=
new
QLineEdit
(
settingsCache
->
getPicUrlHq
());
highQualityURLEdit
->
setEnabled
(
settingsCache
->
getPicDownloadHq
());
connect
(
&
clearDownloadedPicsButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
clearDownloadedPicsButtonClicked
()));
connect
(
&
languageBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
languageBoxChanged
(
int
)));
connect
(
&
picDownloadCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setPicDownload
(
int
)));
connect
(
&
picDownloadHqCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setPicDownloadHq
(
int
)));
connect
(
&
pixmapCacheEdit
,
SIGNAL
(
valueChanged
(
int
)),
settingsCache
,
SLOT
(
setPixmapCacheSize
(
int
)));
connect
(
&
picDownloadHqCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
setEnabledStatus
(
bool
)));
connect
(
highQualityURLEdit
,
SIGNAL
(
textChanged
(
QString
)),
settingsCache
,
SLOT
(
setPicUrlHq
(
QString
)));
QGridLayout
*
personalGrid
=
new
QGridLayout
;
personalGrid
->
addWidget
(
&
languageLabel
,
0
,
0
);
...
...
@@ -66,6 +71,12 @@ GeneralSettingsPage::GeneralSettingsPage()
personalGrid
->
addWidget
(
&
picDownloadCheckBox
,
2
,
0
,
1
,
2
);
personalGrid
->
addWidget
(
&
picDownloadHqCheckBox
,
3
,
0
,
1
,
2
);
personalGrid
->
addWidget
(
&
clearDownloadedPicsButton
,
4
,
0
,
1
,
1
);
personalGrid
->
addWidget
(
&
highQualityURLLabel
,
5
,
0
,
1
,
1
);
personalGrid
->
addWidget
(
highQualityURLEdit
,
5
,
1
,
1
,
1
);
personalGrid
->
addWidget
(
&
highQualityURLLinkLabel
,
6
,
1
,
1
,
1
);
highQualityURLLinkLabel
.
setTextInteractionFlags
(
Qt
::
LinksAccessibleByMouse
);
highQualityURLLinkLabel
.
setOpenExternalLinks
(
true
);
personalGroupBox
=
new
QGroupBox
;
personalGroupBox
->
setLayout
(
personalGrid
);
...
...
@@ -229,9 +240,16 @@ void GeneralSettingsPage::retranslateUi()
cardDatabasePathLabel
.
setText
(
tr
(
"Card database:"
));
tokenDatabasePathLabel
.
setText
(
tr
(
"Token database:"
));
pixmapCacheLabel
.
setText
(
tr
(
"Picture cache size:"
));
highQualityURLLabel
.
setText
(
tr
(
"High Quality Source URL:"
));
highQualityURLLinkLabel
.
setText
(
QString
(
"<a href='https://github.com/Cockatrice/Cockatrice/wiki/Custom-Download-HQ-URLs'>"
+
tr
(
"Linking FAQ"
)
+
"</a>"
));
clearDownloadedPicsButton
.
setText
(
tr
(
"Reset/Clear Downloaded Pictures"
));
}
void
GeneralSettingsPage
::
setEnabledStatus
(
bool
status
)
{
highQualityURLEdit
->
setEnabled
(
status
);
}
AppearanceSettingsPage
::
AppearanceSettingsPage
()
{
QIcon
deleteIcon
(
":/resources/icon_delete.svg"
);
...
...
@@ -511,7 +529,7 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
//priceTagsCheckBox.setChecked(settingsCache->getPriceTagFeature());
//connect(&priceTagsCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPriceTagFeature(int)));
connect
(
this
,
SIGNAL
(
priceTagSourceChanged
(
int
)),
settingsCache
,
SLOT
(
setPriceTagSource
(
int
)));
//
connect(this, SIGNAL(priceTagSourceChanged(int)), settingsCache, SLOT(setPriceTagSource(int)));
QGridLayout
*
generalGrid
=
new
QGridLayout
;
//generalGrid->addWidget(&priceTagsCheckBox, 0, 0);
...
...
cockatrice/src/dlg_settings.h
View file @
45c2e6f6
...
...
@@ -44,6 +44,7 @@ private slots:
void
cardDatabasePathButtonClicked
();
void
tokenDatabasePathButtonClicked
();
void
languageBoxChanged
(
int
index
);
void
setEnabledStatus
(
bool
);
private:
QStringList
findQmFiles
();
QString
languageName
(
const
QString
&
qmFile
);
...
...
@@ -52,6 +53,7 @@ private:
QLineEdit
*
picsPathEdit
;
QLineEdit
*
cardDatabasePathEdit
;
QLineEdit
*
tokenDatabasePathEdit
;
QLineEdit
*
highQualityURLEdit
;
QSpinBox
pixmapCacheEdit
;
QGroupBox
*
personalGroupBox
;
QGroupBox
*
pathsGroupBox
;
...
...
@@ -65,6 +67,8 @@ private:
QLabel
picsPathLabel
;
QLabel
cardDatabasePathLabel
;
QLabel
tokenDatabasePathLabel
;
QLabel
highQualityURLLabel
;
QLabel
highQualityURLLinkLabel
;
QPushButton
clearDownloadedPicsButton
;
};
...
...
cockatrice/src/settingscache.h
View file @
45c2e6f6
...
...
@@ -4,9 +4,9 @@
#include
<QObject>
#define PIC_URL_DEFAULT "http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!&type=card"
#define PIC_URL_FALLBACK "http://
mtgimage.com/set/!setcode!/!name!.jpg
"
#define PIC_URL_HQ_DEFAULT "http://
mtgimage.com/
multiverseid
/
!cardid!
.jpg
"
#define PIC_URL_HQ_FALLBACK "http://
mtgimage.com/set/!setcode!/!name!.jpg
"
#define PIC_URL_FALLBACK "http://
gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!&type=card
"
#define PIC_URL_HQ_DEFAULT "http://
gatherer.wizards.com/Handlers/Image.ashx?
multiverseid
=
!cardid!
&type=card
"
#define PIC_URL_HQ_FALLBACK "http://
gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!&type=card
"
// size should be a multiple of 64
#define PIXMAPCACHE_SIZE_DEFAULT 2047
#define PIXMAPCACHE_SIZE_MIN 64
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment