diff --git a/cockatrice/src/client/tabs/tab_deck_editor.cpp b/cockatrice/src/client/tabs/tab_deck_editor.cpp index bc309c9b5..056b4eb83 100644 --- a/cockatrice/src/client/tabs/tab_deck_editor.cpp +++ b/cockatrice/src/client/tabs/tab_deck_editor.cpp @@ -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, diff --git a/cockatrice/src/client/tabs/tab_generic_deck_editor.cpp b/cockatrice/src/client/tabs/tab_generic_deck_editor.cpp index f9e8e793c..604b2af55 100644 --- a/cockatrice/src/client/tabs/tab_generic_deck_editor.cpp +++ b/cockatrice/src/client/tabs/tab_generic_deck_editor.cpp @@ -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) diff --git a/cockatrice/src/client/tabs/tab_generic_deck_editor.h b/cockatrice/src/client/tabs/tab_generic_deck_editor.h index 90642a709..6c129fd93 100644 --- a/cockatrice/src/client/tabs/tab_generic_deck_editor.h +++ b/cockatrice/src/client/tabs/tab_generic_deck_editor.h @@ -67,6 +67,7 @@ public: DeckEditorPrintingSelectorDockWidget *printingSelectorDockWidget; public slots: + void onDeckChanged(); void updateCard(CardInfoPtr _card); void actAddCard(CardInfoPtr info); void actAddCardToSideboard(CardInfoPtr info); diff --git a/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.cpp b/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.cpp index e2eee1aaa..f42bfb29f 100644 --- a/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.cpp +++ b/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.cpp @@ -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) diff --git a/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.h b/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.h index bae0d6247..8c53ad227 100644 --- a/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.h +++ b/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.h @@ -49,6 +49,7 @@ public slots: void offsetCountAtIndex(const QModelIndex &idx, int offset); signals: + void deckChanged(); void cardChanged(CardInfoPtr _card); private: