mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
DeckDock now notifies the deck editor on deck change, instead of individually modifying menu items and modification status.
This commit is contained in:
parent
e44ba3235b
commit
73533ce4bc
5 changed files with 13 additions and 10 deletions
|
|
@ -50,6 +50,7 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor) : TabGenericDeckEdit
|
|||
filterDockWidget = new DeckEditorFilterDockWidget(this, this);
|
||||
printingSelectorDockWidget = new DeckEditorPrintingSelectorDockWidget(this, this);
|
||||
|
||||
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckChanged, this, &TabGenericDeckEditor::onDeckChanged);
|
||||
connect(deckDockWidget, &DeckEditorDeckDockWidget::cardChanged, this, &TabGenericDeckEditor::updateCard);
|
||||
connect(this, &TabGenericDeckEditor::decrementCard, deckDockWidget, &DeckEditorDeckDockWidget::actDecrementCard);
|
||||
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::cardChanged, this,
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@ void TabGenericDeckEditor::updateCard(CardInfoPtr _card)
|
|||
printingSelectorDockWidget->printingSelector->setCard(_card, DECK_ZONE_MAIN);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::onDeckChanged()
|
||||
{
|
||||
setModified(true);
|
||||
deckMenu->setSaveStatus(!getDeckList()->isEmpty());
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::addCardHelper(const CardInfoPtr info, QString zoneName)
|
||||
{
|
||||
if (!info)
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public:
|
|||
DeckEditorPrintingSelectorDockWidget *printingSelectorDockWidget;
|
||||
|
||||
public slots:
|
||||
void onDeckChanged();
|
||||
void updateCard(CardInfoPtr _card);
|
||||
void actAddCard(CardInfoPtr info);
|
||||
void actAddCardToSideboard(CardInfoPtr info);
|
||||
|
|
|
|||
|
|
@ -371,9 +371,7 @@ void DeckEditorDeckDockWidget::actSwapCard()
|
|||
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
if (isModified) {
|
||||
// TODO Hook up to deck editor
|
||||
// setModified(true);
|
||||
// setSaveStatus(true);
|
||||
emit deckChanged();
|
||||
}
|
||||
|
||||
update();
|
||||
|
|
@ -468,11 +466,7 @@ void DeckEditorDeckDockWidget::actRemoveCard()
|
|||
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
if (isModified) {
|
||||
DeckLoader *const deck = deckModel->getDeckList();
|
||||
// TODO: Hook up to DeckEditor
|
||||
Q_UNUSED(deck);
|
||||
// setSaveStatus(!deck->isEmpty());
|
||||
// setModified(true);
|
||||
emit deckChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -489,8 +483,8 @@ void DeckEditorDeckDockWidget::offsetCountAtIndex(const QModelIndex &idx, int of
|
|||
deckModel->removeRow(idx.row(), idx.parent());
|
||||
else
|
||||
deckModel->setData(numberIndex, new_count, Qt::EditRole);
|
||||
// TODO Hook up to deck editor
|
||||
// setModified(true);
|
||||
|
||||
emit deckChanged();
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::decklistCustomMenu(QPoint point)
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ public slots:
|
|||
void offsetCountAtIndex(const QModelIndex &idx, int offset);
|
||||
|
||||
signals:
|
||||
void deckChanged();
|
||||
void cardChanged(CardInfoPtr _card);
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue