Notify deck editor when price feature setting is changed

Ref #112
This commit is contained in:
Daenyth 2014-06-22 21:19:53 -04:00
parent 951f08dd11
commit e5d15e8dbc
5 changed files with 14 additions and 5 deletions

View file

@ -27,7 +27,7 @@ void PriceUpdater::updatePrices()
QString q = "http://blacklotusproject.com/json/?cards="; QString q = "http://blacklotusproject.com/json/?cards=";
QStringList cards = deck->getCardList(); QStringList cards = deck->getCardList();
for (int i = 0; i < cards.size(); ++i) { for (int i = 0; i < cards.size(); ++i) {
q += cards[i] + "|"; q += cards[i].toLower() + "|";
} }
QUrl url(q.replace(' ', '+')); QUrl url(q.replace(' ', '+'));

View file

@ -242,6 +242,7 @@ void SettingsCache::setPriceTagFeature(int _priceTagFeature)
{ {
priceTagFeature = _priceTagFeature; priceTagFeature = _priceTagFeature;
settings->setValue("deckeditor/pricetags", priceTagFeature); settings->setValue("deckeditor/pricetags", priceTagFeature);
emit priceTagFeatureChanged(priceTagFeature);
} }
void SettingsCache::setIgnoreUnregisteredUsers(bool _ignoreUnregisteredUsers) void SettingsCache::setIgnoreUnregisteredUsers(bool _ignoreUnregisteredUsers)

View file

@ -28,10 +28,11 @@ signals:
void minPlayersForMultiColumnLayoutChanged(); void minPlayersForMultiColumnLayoutChanged();
void soundEnabledChanged(); void soundEnabledChanged();
void soundPathChanged(); void soundPathChanged();
void priceTagFeatureChanged(int enabled);
void ignoreUnregisteredUsersChanged(); void ignoreUnregisteredUsersChanged();
private: private:
QSettings *settings; QSettings *settings;
QByteArray mainWindowGeometry; QByteArray mainWindowGeometry;
QString lang; QString lang;
QString deckPath, replaysPath, picsPath, cardDatabasePath, tokenDatabasePath; QString deckPath, replaysPath, picsPath, cardDatabasePath, tokenDatabasePath;

View file

@ -172,6 +172,7 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
connect(aUpdatePrices, SIGNAL(triggered()), this, SLOT(actUpdatePrices())); connect(aUpdatePrices, SIGNAL(triggered()), this, SLOT(actUpdatePrices()));
if (!settingsCache->getPriceTagFeature()) if (!settingsCache->getPriceTagFeature())
aUpdatePrices->setVisible(false); aUpdatePrices->setVisible(false);
connect(settingsCache, SIGNAL(priceTagFeatureChanged(int)), this, SLOT(setPriceTagFeatureEnabled(int)));
QToolBar *deckToolBar = new QToolBar; QToolBar *deckToolBar = new QToolBar;
deckToolBar->setOrientation(Qt::Vertical); deckToolBar->setOrientation(Qt::Vertical);
@ -182,7 +183,7 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
deckToolbarLayout->addStretch(); deckToolbarLayout->addStretch();
deckToolbarLayout->addWidget(deckToolBar); deckToolbarLayout->addWidget(deckToolBar);
deckToolbarLayout->addStretch(); deckToolbarLayout->addStretch();
QVBoxLayout *rightFrame = new QVBoxLayout; QVBoxLayout *rightFrame = new QVBoxLayout;
rightFrame->addLayout(grid); rightFrame->addLayout(grid);
rightFrame->addWidget(deckView, 10); rightFrame->addWidget(deckView, 10);
@ -193,7 +194,7 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
mainLayout->addLayout(middleFrame); mainLayout->addLayout(middleFrame);
mainLayout->addLayout(rightFrame); mainLayout->addLayout(rightFrame);
setLayout(mainLayout); setLayout(mainLayout);
aNewDeck = new QAction(QString(), this); aNewDeck = new QAction(QString(), this);
aNewDeck->setShortcuts(QKeySequence::New); aNewDeck->setShortcuts(QKeySequence::New);
connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck())); connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck()));
@ -635,6 +636,11 @@ void TabDeckEditor::actDecrement()
offsetCountAtIndex(currentIndex, -1); offsetCountAtIndex(currentIndex, -1);
} }
void TabDeckEditor::setPriceTagFeatureEnabled(int enabled)
{
aUpdatePrices->setVisible(enabled);
}
void TabDeckEditor::actUpdatePrices() void TabDeckEditor::actUpdatePrices()
{ {
aUpdatePrices->setDisabled(true); aUpdatePrices->setDisabled(true);

View file

@ -50,7 +50,7 @@ private slots:
void actEditSets(); void actEditSets();
void actEditTokens(); void actEditTokens();
void actClearSearch(); void actClearSearch();
void actAddCard(); void actAddCard();
@ -67,6 +67,7 @@ private slots:
void saveDeckRemoteFinished(const Response &r); void saveDeckRemoteFinished(const Response &r);
void filterViewCustomContextMenu(const QPoint &point); void filterViewCustomContextMenu(const QPoint &point);
void filterRemove(QAction *action); void filterRemove(QAction *action);
void setPriceTagFeatureEnabled(int enabled);
private: private:
CardInfo *currentCardInfo() const; CardInfo *currentCardInfo() const;
void addCardHelper(QString zoneName); void addCardHelper(QString zoneName);