mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 11:03:54 -07:00
[GDE/VDE] More granular modification signals. (#5927)
* More granular modification signals. * Bruh. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
033c8b269d
commit
9cf979d154
5 changed files with 25 additions and 8 deletions
|
|
@ -50,6 +50,7 @@ AbstractTabDeckEditor::AbstractTabDeckEditor(TabSupervisor *_tabSupervisor) : Ta
|
||||||
printingSelectorDockWidget = new DeckEditorPrintingSelectorDockWidget(this);
|
printingSelectorDockWidget = new DeckEditorPrintingSelectorDockWidget(this);
|
||||||
|
|
||||||
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckChanged, this, &AbstractTabDeckEditor::onDeckChanged);
|
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckChanged, this, &AbstractTabDeckEditor::onDeckChanged);
|
||||||
|
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckModified, this, &AbstractTabDeckEditor::onDeckModified);
|
||||||
connect(deckDockWidget, &DeckEditorDeckDockWidget::cardChanged, this, &AbstractTabDeckEditor::updateCard);
|
connect(deckDockWidget, &DeckEditorDeckDockWidget::cardChanged, this, &AbstractTabDeckEditor::updateCard);
|
||||||
connect(this, &AbstractTabDeckEditor::decrementCard, deckDockWidget, &DeckEditorDeckDockWidget::actDecrementCard);
|
connect(this, &AbstractTabDeckEditor::decrementCard, deckDockWidget, &DeckEditorDeckDockWidget::actDecrementCard);
|
||||||
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::cardChanged, this,
|
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::cardChanged, this,
|
||||||
|
|
@ -77,6 +78,10 @@ void AbstractTabDeckEditor::updateCard(CardInfoPtr _card)
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractTabDeckEditor::onDeckChanged()
|
void AbstractTabDeckEditor::onDeckChanged()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractTabDeckEditor::onDeckModified()
|
||||||
{
|
{
|
||||||
setModified(!isBlankNewDeck());
|
setModified(!isBlankNewDeck());
|
||||||
deckMenu->setSaveStatus(!isBlankNewDeck());
|
deckMenu->setSaveStatus(!isBlankNewDeck());
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void onDeckChanged();
|
virtual void onDeckChanged();
|
||||||
|
virtual void onDeckModified();
|
||||||
void updateCard(CardInfoPtr _card);
|
void updateCard(CardInfoPtr _card);
|
||||||
void actAddCard(CardInfoPtr info);
|
void actAddCard(CardInfoPtr info);
|
||||||
void actAddCardToSideboard(CardInfoPtr info);
|
void actAddCardToSideboard(CardInfoPtr info);
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ void TabDeckEditorVisual::createCentralFrame()
|
||||||
|
|
||||||
void TabDeckEditorVisual::onDeckChanged()
|
void TabDeckEditorVisual::onDeckChanged()
|
||||||
{
|
{
|
||||||
AbstractTabDeckEditor::onDeckChanged();
|
AbstractTabDeckEditor::onDeckModified();
|
||||||
tabContainer->visualDeckView->decklistDataChanged(QModelIndex(), QModelIndex());
|
tabContainer->visualDeckView->decklistDataChanged(QModelIndex(), QModelIndex());
|
||||||
tabContainer->deckAnalytics->refreshDisplays(deckDockWidget->deckModel);
|
tabContainer->deckAnalytics->refreshDisplays(deckDockWidget->deckModel);
|
||||||
tabContainer->sampleHandWidget->setDeckModel(deckDockWidget->deckModel);
|
tabContainer->sampleHandWidget->setDeckModel(deckDockWidget->deckModel);
|
||||||
|
|
|
||||||
|
|
@ -228,19 +228,22 @@ void DeckEditorDeckDockWidget::updateCard(const QModelIndex /*¤t*/, const
|
||||||
void DeckEditorDeckDockWidget::updateName(const QString &name)
|
void DeckEditorDeckDockWidget::updateName(const QString &name)
|
||||||
{
|
{
|
||||||
deckModel->getDeckList()->setName(name);
|
deckModel->getDeckList()->setName(name);
|
||||||
emit deckChanged();
|
emit nameChanged();
|
||||||
|
emit deckModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorDeckDockWidget::updateComments()
|
void DeckEditorDeckDockWidget::updateComments()
|
||||||
{
|
{
|
||||||
deckModel->getDeckList()->setComments(commentsEdit->toPlainText());
|
deckModel->getDeckList()->setComments(commentsEdit->toPlainText());
|
||||||
emit deckChanged();
|
emit commentsChanged();
|
||||||
|
emit deckModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorDeckDockWidget::updateHash()
|
void DeckEditorDeckDockWidget::updateHash()
|
||||||
{
|
{
|
||||||
hashLabel->setText(deckModel->getDeckList()->getDeckHash());
|
hashLabel->setText(deckModel->getDeckList()->getDeckHash());
|
||||||
emit deckChanged();
|
emit hashChanged();
|
||||||
|
emit deckModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorDeckDockWidget::updateBannerCardComboBox()
|
void DeckEditorDeckDockWidget::updateBannerCardComboBox()
|
||||||
|
|
@ -318,7 +321,7 @@ void DeckEditorDeckDockWidget::setBannerCard(int /* changedIndex */)
|
||||||
QVariantMap itemData = bannerCardComboBox->itemData(bannerCardComboBox->currentIndex()).toMap();
|
QVariantMap itemData = bannerCardComboBox->itemData(bannerCardComboBox->currentIndex()).toMap();
|
||||||
deckModel->getDeckList()->setBannerCard(
|
deckModel->getDeckList()->setBannerCard(
|
||||||
QPair<QString, QString>(itemData["name"].toString(), itemData["uuid"].toString()));
|
QPair<QString, QString>(itemData["name"].toString(), itemData["uuid"].toString()));
|
||||||
emit deckChanged();
|
emit deckModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorDeckDockWidget::updateShowBannerCardComboBox(const bool visible)
|
void DeckEditorDeckDockWidget::updateShowBannerCardComboBox(const bool visible)
|
||||||
|
|
@ -366,8 +369,12 @@ void DeckEditorDeckDockWidget::cleanDeck()
|
||||||
{
|
{
|
||||||
deckModel->cleanList();
|
deckModel->cleanList();
|
||||||
nameEdit->setText(QString());
|
nameEdit->setText(QString());
|
||||||
|
emit nameChanged();
|
||||||
commentsEdit->setText(QString());
|
commentsEdit->setText(QString());
|
||||||
|
emit commentsChanged();
|
||||||
hashLabel->setText(QString());
|
hashLabel->setText(QString());
|
||||||
|
emit hashChanged();
|
||||||
|
emit deckModified();
|
||||||
emit deckChanged();
|
emit deckChanged();
|
||||||
updateBannerCardComboBox();
|
updateBannerCardComboBox();
|
||||||
deckTagsDisplayWidget->connectDeckList(deckModel->getDeckList());
|
deckTagsDisplayWidget->connectDeckList(deckModel->getDeckList());
|
||||||
|
|
@ -426,7 +433,7 @@ void DeckEditorDeckDockWidget::actSwapCard()
|
||||||
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
if (isModified) {
|
if (isModified) {
|
||||||
emit deckChanged();
|
emit deckModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
@ -521,7 +528,7 @@ void DeckEditorDeckDockWidget::actRemoveCard()
|
||||||
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
if (isModified) {
|
if (isModified) {
|
||||||
emit deckChanged();
|
emit deckModified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -539,7 +546,7 @@ void DeckEditorDeckDockWidget::offsetCountAtIndex(const QModelIndex &idx, int of
|
||||||
else
|
else
|
||||||
deckModel->setData(numberIndex, new_count, Qt::EditRole);
|
deckModel->setData(numberIndex, new_count, Qt::EditRole);
|
||||||
|
|
||||||
emit deckChanged();
|
emit deckModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorDeckDockWidget::decklistCustomMenu(QPoint point)
|
void DeckEditorDeckDockWidget::decklistCustomMenu(QPoint point)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,11 @@ public slots:
|
||||||
void offsetCountAtIndex(const QModelIndex &idx, int offset);
|
void offsetCountAtIndex(const QModelIndex &idx, int offset);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void nameChanged();
|
||||||
|
void commentsChanged();
|
||||||
|
void hashChanged();
|
||||||
void deckChanged();
|
void deckChanged();
|
||||||
|
void deckModified();
|
||||||
void cardChanged(CardInfoPtr _card);
|
void cardChanged(CardInfoPtr _card);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue