Add pricing from deckbrew.com

* the previous PriceUpdater class has become abstract
* BLPPriceUpdater inherits the old code for blacklotusproject.com
* DBPriceUpdater is a new implementation for deckbrew.com
* add a setting to choose between the two
This commit is contained in:
Fabio Bas 2014-06-29 23:30:32 +02:00
parent ec3690fd29
commit 922e98af67
7 changed files with 222 additions and 12 deletions

View file

@ -18,6 +18,7 @@
#include <QInputDialog>
#include <QSpinBox>
#include <QDialogButtonBox>
#include <QRadioButton>
#include <QDebug>
#include "carddatabase.h"
#include "dlg_settings.h"
@ -531,9 +532,27 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
priceTagsCheckBox = new QCheckBox;
priceTagsCheckBox->setChecked(settingsCache->getPriceTagFeature());
connect(priceTagsCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPriceTagFeature(int)));
priceTagSource0 = new QRadioButton;
priceTagSource1 = new QRadioButton;
switch(settingsCache->getPriceTagSource())
{
case 0:
priceTagSource0->setChecked(true);
break;
case 1:
priceTagSource1->setChecked(true);
break;
}
connect(priceTagSource0, SIGNAL(toggled(bool)), this, SLOT(radioPriceTagSourceClicked(bool)));
connect(priceTagSource1, SIGNAL(toggled(bool)), this, SLOT(radioPriceTagSourceClicked(bool)));
QGridLayout *generalGrid = new QGridLayout;
generalGrid->addWidget(priceTagsCheckBox, 0, 0);
generalGrid->addWidget(priceTagSource0, 1, 0);
generalGrid->addWidget(priceTagSource1, 2, 0);
generalGroupBox = new QGroupBox;
generalGroupBox->setLayout(generalGrid);
@ -546,10 +565,26 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
void DeckEditorSettingsPage::retranslateUi()
{
priceTagsCheckBox->setText(tr("Enable &price tag feature (using data from blacklotusproject.com)"));
priceTagsCheckBox->setText(tr("Enable &price tag feature"));
priceTagSource0->setText(tr("using data from blacklotusproject.com"));
priceTagSource1->setText(tr("using data from deckbrew.com"));
generalGroupBox->setTitle(tr("General"));
}
void DeckEditorSettingsPage::radioPriceTagSourceClicked(bool checked)
{
if(!checked)
return;
int source=0;
if(priceTagSource0->isChecked())
source=0;
if(priceTagSource1->isChecked())
source=1;
QMetaObject::invokeMethod( settingsCache, "setPriceTagSource", Qt::QueuedConnection, Q_ARG(int, source));
}
MessagesSettingsPage::MessagesSettingsPage()
{
aAdd = new QAction(this);