mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
price tag feature by Marcio Ribeiro
This commit is contained in:
parent
9f85074ca3
commit
6226e381de
12 changed files with 184 additions and 23 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include "dlg_load_deck_from_clipboard.h"
|
||||
#include "main.h"
|
||||
#include "settingscache.h"
|
||||
#include "priceupdater.h"
|
||||
|
||||
void SearchLineEdit::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
|
|
@ -113,15 +114,37 @@ WndDeckEditor::WndDeckEditor(QWidget *parent)
|
|||
commentsEdit->setMaximumHeight(70);
|
||||
commentsLabel->setBuddy(commentsEdit);
|
||||
connect(commentsEdit, SIGNAL(textChanged()), this, SLOT(updateComments()));
|
||||
|
||||
QGridLayout *grid = new QGridLayout;
|
||||
grid->addWidget(nameLabel, 0, 0);
|
||||
grid->addWidget(nameEdit, 0, 1);
|
||||
|
||||
grid->addWidget(commentsLabel, 1, 0);
|
||||
grid->addWidget(commentsEdit, 1, 1);
|
||||
|
||||
// Update price
|
||||
aUpdatePrices = new QAction(tr("&Update prices"), this);
|
||||
aUpdatePrices->setShortcut(tr("Ctrl+U"));
|
||||
aUpdatePrices->setIcon(QIcon(":/resources/icon_update.png"));
|
||||
connect(aUpdatePrices, SIGNAL(triggered()), this, SLOT(actUpdatePrices()));
|
||||
if (!settingsCache->getPriceTagFeature())
|
||||
aUpdatePrices->setVisible(false);
|
||||
|
||||
QToolBar *deckToolBar = new QToolBar;
|
||||
deckToolBar->setOrientation(Qt::Vertical);
|
||||
deckToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
deckToolBar->setIconSize(QSize(24, 24));
|
||||
deckToolBar->addAction(aUpdatePrices);
|
||||
QHBoxLayout *deckToolbarLayout = new QHBoxLayout;
|
||||
deckToolbarLayout->addStretch();
|
||||
deckToolbarLayout->addWidget(deckToolBar);
|
||||
deckToolbarLayout->addStretch();
|
||||
|
||||
|
||||
QVBoxLayout *rightFrame = new QVBoxLayout;
|
||||
rightFrame->addLayout(grid);
|
||||
rightFrame->addWidget(deckView);
|
||||
rightFrame->addLayout(deckToolbarLayout);
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
mainLayout->addLayout(leftFrame, 10);
|
||||
|
|
@ -456,6 +479,21 @@ void WndDeckEditor::actDecrement()
|
|||
setWindowModified(true);
|
||||
}
|
||||
|
||||
void WndDeckEditor::actUpdatePrices()
|
||||
{
|
||||
aUpdatePrices->setDisabled(true);
|
||||
PriceUpdater *up = new PriceUpdater(deckModel->getDeckList());
|
||||
connect(up, SIGNAL(finishedUpdate()), this, SLOT(finishedUpdatingPrices()));
|
||||
up->updatePrices();
|
||||
}
|
||||
|
||||
void WndDeckEditor::finishedUpdatingPrices()
|
||||
{
|
||||
deckModel->pricesUpdated();
|
||||
setWindowModified(true);
|
||||
aUpdatePrices->setDisabled(false);
|
||||
}
|
||||
|
||||
void WndDeckEditor::setDeck(DeckList *_deck, const QString &_lastFileName, DeckList::FileFormat _lastFileFormat)
|
||||
{
|
||||
deckModel->setDeckList(_deck);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue