diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp
index 17b18a8a..88db009b 100644
--- a/cockatrice/src/carddatabase.cpp
+++ b/cockatrice/src/carddatabase.cpp
@@ -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("");
}
diff --git a/cockatrice/src/dlg_settings.cpp b/cockatrice/src/dlg_settings.cpp
index 254c1e78..4faf5cb8 100644
--- a/cockatrice/src/dlg_settings.cpp
+++ b/cockatrice/src/dlg_settings.cpp
@@ -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("" + tr("Linking FAQ") + ""));
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);
diff --git a/cockatrice/src/dlg_settings.h b/cockatrice/src/dlg_settings.h
index c949ed6d..002d40b1 100644
--- a/cockatrice/src/dlg_settings.h
+++ b/cockatrice/src/dlg_settings.h
@@ -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;
};
diff --git a/cockatrice/src/settingscache.h b/cockatrice/src/settingscache.h
index 0aa459bb..cc273792 100644
--- a/cockatrice/src/settingscache.h
+++ b/cockatrice/src/settingscache.h
@@ -4,9 +4,9 @@
#include
#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