mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
Be a lot saner about some signals/slots, as in, individual Deck Editor widgets now internally determine their CardInfo and then simply communicate this to the DeckEditor
This commit is contained in:
parent
cf9b32a6f0
commit
f3e5786075
13 changed files with 307 additions and 274 deletions
|
|
@ -50,6 +50,18 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor) : TabGenericDeckEdit
|
|||
filterDockWidget = new DeckEditorFilterDockWidget(this, this);
|
||||
printingSelectorDockWidget = new DeckEditorPrintingSelectorDockWidget(this, this);
|
||||
|
||||
connect(deckDockWidget, &DeckEditorDeckDockWidget::cardChanged, this, &TabGenericDeckEditor::updateCard);
|
||||
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::cardChanged, this,
|
||||
&TabGenericDeckEditor::updateCard);
|
||||
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::addCardToMainDeck, this,
|
||||
&TabGenericDeckEditor::actAddCard);
|
||||
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::addCardToSideboard, this,
|
||||
&TabGenericDeckEditor::actAddCardToSideboard);
|
||||
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::decrementCardFromMainDeck, this,
|
||||
&TabGenericDeckEditor::actDecrementCard);
|
||||
connect(databaseDisplayDockWidget, &DeckEditorDatabaseDisplayWidget::decrementCardFromSideboard, this,
|
||||
&TabGenericDeckEditor::actDecrementCardFromSideboard);
|
||||
|
||||
TabDeckEditor::createMenus();
|
||||
|
||||
installEventFilter(this);
|
||||
|
|
@ -120,71 +132,6 @@ QString TabDeckEditor::getTabText() const
|
|||
return result;
|
||||
}
|
||||
|
||||
void TabDeckEditor::actNewDeck()
|
||||
{
|
||||
auto deckOpenLocation = confirmOpen(false);
|
||||
|
||||
if (deckOpenLocation == CANCELLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (deckOpenLocation == NEW_TAB) {
|
||||
emit openDeckEditor(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
deckDockWidget->cleanDeck();
|
||||
setModified(false);
|
||||
deckMenu->setSaveStatus(false);
|
||||
}
|
||||
|
||||
void TabDeckEditor::actLoadDeck()
|
||||
{
|
||||
auto deckOpenLocation = confirmOpen();
|
||||
|
||||
if (deckOpenLocation == CANCELLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
DlgLoadDeck dialog(this);
|
||||
if (!dialog.exec())
|
||||
return;
|
||||
|
||||
QString fileName = dialog.selectedFiles().at(0);
|
||||
TabDeckEditor::openDeckFromFile(fileName, deckOpenLocation);
|
||||
deckDockWidget->updateBannerCardComboBox();
|
||||
}
|
||||
|
||||
void TabDeckEditor::actLoadDeckFromClipboard()
|
||||
{
|
||||
TabGenericDeckEditor::actLoadDeckFromClipboard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually opens the deck from file
|
||||
* @param fileName The path of the deck to open
|
||||
* @param deckOpenLocation Which tab to open the deck
|
||||
*/
|
||||
void TabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLocation deckOpenLocation)
|
||||
{
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
|
||||
|
||||
auto *l = new DeckLoader;
|
||||
if (l->loadFromFile(fileName, fmt, true)) {
|
||||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(fileName);
|
||||
if (deckOpenLocation == NEW_TAB) {
|
||||
emit openDeckEditor(l);
|
||||
} else {
|
||||
deckMenu->setSaveStatus(false);
|
||||
setDeck(l);
|
||||
}
|
||||
} else {
|
||||
delete l;
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open deck at %1").arg(fileName));
|
||||
}
|
||||
deckMenu->setSaveStatus(true);
|
||||
}
|
||||
|
||||
void TabDeckEditor::retranslateUi()
|
||||
{
|
||||
deckMenu->retranslateUi();
|
||||
|
|
|
|||
|
|
@ -16,11 +16,8 @@ class DeckLoader;
|
|||
class TabDeckEditor : public TabGenericDeckEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
protected slots:
|
||||
void actNewDeck() override;
|
||||
void actLoadDeck() override;
|
||||
void actLoadDeckFromClipboard() override;
|
||||
|
||||
protected slots:
|
||||
void loadLayout() override;
|
||||
void restartLayout() override;
|
||||
void freeDocksSize() override;
|
||||
|
|
@ -31,9 +28,6 @@ protected slots:
|
|||
void dockFloatingTriggered() override;
|
||||
void dockTopLevelChanged(bool topLevel) override;
|
||||
|
||||
protected:
|
||||
void openDeckFromFile(const QString &fileName, TabGenericDeckEditor::DeckOpenLocation deckOpenLocation) override;
|
||||
|
||||
public:
|
||||
explicit TabDeckEditor(TabSupervisor *_tabSupervisor);
|
||||
void retranslateUi() override;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "../../client/tapped_out_interface.h"
|
||||
#include "../../client/ui/widgets/cards/card_info_frame_widget.h"
|
||||
#include "../../deck/deck_stats_interface.h"
|
||||
#include "../../dialogs/dlg_load_deck.h"
|
||||
#include "../../dialogs/dlg_load_deck_from_clipboard.h"
|
||||
#include "../../game/cards/card_database_manager.h"
|
||||
#include "../../game/cards/card_database_model.h"
|
||||
|
|
@ -41,91 +42,10 @@ TabGenericDeckEditor::TabGenericDeckEditor(TabSupervisor *_tabSupervisor) : Tab(
|
|||
{
|
||||
}
|
||||
|
||||
// Method uses to sync docks state with menu items state
|
||||
bool TabGenericDeckEditor::eventFilter(QObject *o, QEvent *e)
|
||||
void TabGenericDeckEditor::updateCard(CardInfoPtr _card)
|
||||
{
|
||||
if (e->type() == QEvent::Close) {
|
||||
if (o == cardInfoDockWidget) {
|
||||
aCardInfoDockVisible->setChecked(false);
|
||||
aCardInfoDockFloating->setEnabled(false);
|
||||
} else if (o == deckDockWidget) {
|
||||
aDeckDockVisible->setChecked(false);
|
||||
aDeckDockFloating->setEnabled(false);
|
||||
} else if (o == filterDockWidget) {
|
||||
aFilterDockVisible->setChecked(false);
|
||||
aFilterDockFloating->setEnabled(false);
|
||||
} else if (o == printingSelectorDockWidget) {
|
||||
aPrintingSelectorDockVisible->setChecked(false);
|
||||
aPrintingSelectorDockFloating->setEnabled(false);
|
||||
}
|
||||
}
|
||||
if (o == this && e->type() == QEvent::Hide) {
|
||||
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||
layouts.setDeckEditorLayoutState(saveState());
|
||||
layouts.setDeckEditorGeometry(saveGeometry());
|
||||
layouts.setDeckEditorCardSize(cardInfoDockWidget->size());
|
||||
layouts.setDeckEditorFilterSize(filterDockWidget->size());
|
||||
layouts.setDeckEditorDeckSize(deckDockWidget->size());
|
||||
layouts.setDeckEditorPrintingSelectorSize(printingSelectorDockWidget->size());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::updateCardInfo(CardInfoPtr _card)
|
||||
{
|
||||
cardInfoDockWidget->cardInfo->setCard(_card);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::updateCardInfoLeft(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
||||
{
|
||||
cardInfoDockWidget->cardInfo->setCard(current.sibling(current.row(), 0).data().toString());
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::updateCardInfoRight(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
||||
{
|
||||
if (!current.isValid())
|
||||
return;
|
||||
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
|
||||
cardInfoDockWidget->cardInfo->setCard(current.sibling(current.row(), 1).data().toString(),
|
||||
current.sibling(current.row(), 4).data().toString());
|
||||
}
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::updatePrintingSelectorDatabase(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
||||
{
|
||||
const QString cardName = current.sibling(current.row(), 0).data().toString();
|
||||
const QString cardProviderID = CardDatabaseManager::getInstance()->getPreferredPrintingProviderIdForCard(cardName);
|
||||
|
||||
if (!current.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
|
||||
printingSelectorDockWidget->printingSelector->setCard(
|
||||
CardDatabaseManager::getInstance()->getCardByNameAndProviderId(cardName, cardProviderID), DECK_ZONE_MAIN);
|
||||
}
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::updatePrintingSelectorDeckView(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
||||
{
|
||||
const QString cardName = current.sibling(current.row(), 1).data().toString();
|
||||
const QString cardProviderID = current.sibling(current.row(), 4).data().toString();
|
||||
const QModelIndex gparent = current.parent().parent();
|
||||
|
||||
if (!gparent.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QString zoneName = gparent.sibling(gparent.row(), 1).data(Qt::EditRole).toString();
|
||||
|
||||
if (!current.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
|
||||
printingSelectorDockWidget->printingSelector->setCard(
|
||||
CardDatabaseManager::getInstance()->getCardByNameAndProviderId(cardName, cardProviderID), zoneName);
|
||||
}
|
||||
cardInfoDockWidget->updateCard(_card);
|
||||
printingSelectorDockWidget->printingSelector->setCard(_card, DECK_ZONE_MAIN);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::decklistCustomMenu(QPoint point)
|
||||
|
|
@ -163,6 +83,29 @@ void TabGenericDeckEditor::closeRequest(bool forced)
|
|||
close();
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actNewDeck()
|
||||
{
|
||||
auto deckOpenLocation = confirmOpen(false);
|
||||
|
||||
if (deckOpenLocation == CANCELLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (deckOpenLocation == NEW_TAB) {
|
||||
emit openDeckEditor(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
cleanDeckAndResetModified();
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::cleanDeckAndResetModified()
|
||||
{
|
||||
deckMenu->setSaveStatus(false);
|
||||
deckDockWidget->cleanDeck();
|
||||
setModified(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Displays the save confirmation dialogue that is shown before loading a deck, if required. Takes into
|
||||
* account the `openDeckInNewTab` settting.
|
||||
|
|
@ -227,6 +170,23 @@ QMessageBox *TabGenericDeckEditor::createSaveConfirmationWindow()
|
|||
return msgBox;
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actLoadDeck()
|
||||
{
|
||||
auto deckOpenLocation = confirmOpen();
|
||||
|
||||
if (deckOpenLocation == CANCELLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
DlgLoadDeck dialog(this);
|
||||
if (!dialog.exec())
|
||||
return;
|
||||
|
||||
QString fileName = dialog.selectedFiles().at(0);
|
||||
openDeckFromFile(fileName, deckOpenLocation);
|
||||
deckDockWidget->updateBannerCardComboBox();
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actOpenRecent(const QString &fileName)
|
||||
{
|
||||
auto deckOpenLocation = confirmOpen();
|
||||
|
|
@ -238,12 +198,29 @@ void TabGenericDeckEditor::actOpenRecent(const QString &fileName)
|
|||
openDeckFromFile(fileName, deckOpenLocation);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::saveDeckRemoteFinished(const Response &response)
|
||||
/**
|
||||
* Actually opens the deck from file
|
||||
* @param fileName The path of the deck to open
|
||||
* @param deckOpenLocation Which tab to open the deck
|
||||
*/
|
||||
void TabGenericDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLocation deckOpenLocation)
|
||||
{
|
||||
if (response.response_code() != Response::RespOk)
|
||||
QMessageBox::critical(this, tr("Error"), tr("The deck could not be saved."));
|
||||
else
|
||||
setModified(false);
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
|
||||
|
||||
auto *l = new DeckLoader;
|
||||
if (l->loadFromFile(fileName, fmt, true)) {
|
||||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(fileName);
|
||||
if (deckOpenLocation == NEW_TAB) {
|
||||
emit openDeckEditor(l);
|
||||
} else {
|
||||
deckMenu->setSaveStatus(false);
|
||||
setDeck(l);
|
||||
}
|
||||
} else {
|
||||
delete l;
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open deck at %1").arg(fileName));
|
||||
}
|
||||
deckMenu->setSaveStatus(true);
|
||||
}
|
||||
|
||||
bool TabGenericDeckEditor::actSaveDeck()
|
||||
|
|
@ -305,6 +282,14 @@ bool TabGenericDeckEditor::actSaveDeckAs()
|
|||
return true;
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::saveDeckRemoteFinished(const Response &response)
|
||||
{
|
||||
if (response.response_code() != Response::RespOk)
|
||||
QMessageBox::critical(this, tr("Error"), tr("The deck could not be saved."));
|
||||
else
|
||||
setModified(false);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actLoadDeckFromClipboard()
|
||||
{
|
||||
auto deckOpenLocation = confirmOpen();
|
||||
|
|
@ -429,11 +414,6 @@ void TabGenericDeckEditor::addCardHelper(const CardInfoPtr info, QString zoneNam
|
|||
databaseDisplayDockWidget->searchEdit->setSelection(0, databaseDisplayDockWidget->searchEdit->text().length());
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actAddCardFromDatabase()
|
||||
{
|
||||
actAddCard(databaseDisplayDockWidget->currentCardInfo());
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actAddCard(CardInfoPtr info)
|
||||
{
|
||||
if (QApplication::keyboardModifiers() & Qt::ControlModifier)
|
||||
|
|
@ -443,12 +423,6 @@ void TabGenericDeckEditor::actAddCard(CardInfoPtr info)
|
|||
deckMenu->setSaveStatus(true);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actAddCardToSideboardFromDatabase()
|
||||
{
|
||||
addCardHelper(databaseDisplayDockWidget->currentCardInfo(), DECK_ZONE_SIDE);
|
||||
deckMenu->setSaveStatus(true);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actAddCardToSideboard(CardInfoPtr info)
|
||||
{
|
||||
addCardHelper(info, DECK_ZONE_SIDE);
|
||||
|
|
@ -488,26 +462,15 @@ void TabGenericDeckEditor::actDecrementCard(CardInfoPtr info)
|
|||
decrementCardHelper(info, DECK_ZONE_MAIN);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actDecrementCardFromDatabase()
|
||||
{
|
||||
decrementCardHelper(databaseDisplayDockWidget->currentCardInfo(), DECK_ZONE_MAIN);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actDecrementCardFromSideboard(CardInfoPtr info)
|
||||
{
|
||||
decrementCardHelper(info, DECK_ZONE_SIDE);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::actDecrementCardFromSideboardFromDatabase()
|
||||
{
|
||||
decrementCardHelper(databaseDisplayDockWidget->currentCardInfo(), DECK_ZONE_SIDE);
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::setDeck(DeckLoader *_deck)
|
||||
{
|
||||
deckDockWidget->setDeck(_deck);
|
||||
PictureLoader::cacheCardPixmaps(
|
||||
CardDatabaseManager::getInstance()->getCards(deckDockWidget->deckModel->getDeckList()->getCardList()));
|
||||
PictureLoader::cacheCardPixmaps(CardDatabaseManager::getInstance()->getCards(getDeckList()->getCardList()));
|
||||
setModified(false);
|
||||
|
||||
// If they load a deck, make the deck list appear
|
||||
|
|
@ -515,6 +478,11 @@ void TabGenericDeckEditor::setDeck(DeckLoader *_deck)
|
|||
deckDockWidget->setVisible(aDeckDockVisible->isChecked());
|
||||
}
|
||||
|
||||
DeckLoader *TabGenericDeckEditor::getDeckList() const
|
||||
{
|
||||
return deckDockWidget->getDeckList();
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::setModified(bool _modified)
|
||||
{
|
||||
modified = _modified;
|
||||
|
|
@ -526,11 +494,41 @@ void TabGenericDeckEditor::setModified(bool _modified)
|
|||
*/
|
||||
bool TabGenericDeckEditor::isBlankNewDeck() const
|
||||
{
|
||||
DeckLoader *const deck = deckDockWidget->deckModel->getDeckList();
|
||||
return !modified && deck->getLastFileName().isEmpty() && deck->getLastRemoteDeckId() == -1;
|
||||
DeckLoader *deck = getDeckList();
|
||||
return !modified && deck->hasNotBeenLoaded();
|
||||
}
|
||||
|
||||
void TabGenericDeckEditor::filterTreeChanged(FilterTree *filterTree)
|
||||
{
|
||||
databaseDisplayDockWidget->setFilterTree(filterTree);
|
||||
}
|
||||
|
||||
// Method uses to sync docks state with menu items state
|
||||
bool TabGenericDeckEditor::eventFilter(QObject *o, QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::Close) {
|
||||
if (o == cardInfoDockWidget) {
|
||||
aCardInfoDockVisible->setChecked(false);
|
||||
aCardInfoDockFloating->setEnabled(false);
|
||||
} else if (o == deckDockWidget) {
|
||||
aDeckDockVisible->setChecked(false);
|
||||
aDeckDockFloating->setEnabled(false);
|
||||
} else if (o == filterDockWidget) {
|
||||
aFilterDockVisible->setChecked(false);
|
||||
aFilterDockFloating->setEnabled(false);
|
||||
} else if (o == printingSelectorDockWidget) {
|
||||
aPrintingSelectorDockVisible->setChecked(false);
|
||||
aPrintingSelectorDockFloating->setEnabled(false);
|
||||
}
|
||||
}
|
||||
if (o == this && e->type() == QEvent::Hide) {
|
||||
LayoutsSettings &layouts = SettingsCache::instance().layouts();
|
||||
layouts.setDeckEditorLayoutState(saveState());
|
||||
layouts.setDeckEditorGeometry(saveGeometry());
|
||||
layouts.setDeckEditorCardSize(cardInfoDockWidget->size());
|
||||
layouts.setDeckEditorFilterSize(filterDockWidget->size());
|
||||
layouts.setDeckEditorDeckSize(deckDockWidget->size());
|
||||
layouts.setDeckEditorPrintingSelectorSize(printingSelectorDockWidget->size());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -11,19 +11,14 @@
|
|||
#include "../ui/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.h"
|
||||
#include "tab.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
class CardDatabaseModel;
|
||||
class CardDatabaseDisplayModel;
|
||||
|
||||
class QTreeView;
|
||||
|
||||
class DeckEditorMenu;
|
||||
|
||||
class CardInfoFrameWidget;
|
||||
class QTextEdit;
|
||||
class QLabel;
|
||||
class DeckLoader;
|
||||
class DeckEditorMenu;
|
||||
class DeckEditorCardInfoDockWidget;
|
||||
class DeckEditorDatabaseDisplayWidget;
|
||||
class DeckEditorDeckDockWidget;
|
||||
|
|
@ -33,6 +28,10 @@ class DeckPreviewDeckTagsDisplayWidget;
|
|||
class Response;
|
||||
class FilterTreeModel;
|
||||
class FilterBuilder;
|
||||
|
||||
class QTreeView;
|
||||
class QTextEdit;
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
class QGroupBox;
|
||||
class QMessageBox;
|
||||
|
|
@ -40,19 +39,58 @@ class QHBoxLayout;
|
|||
class QVBoxLayout;
|
||||
class QPushButton;
|
||||
class QDockWidget;
|
||||
class QMenu;
|
||||
class QAction;
|
||||
|
||||
class TabGenericDeckEditor : public Tab
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TabGenericDeckEditor(TabSupervisor *_tabSupervisor);
|
||||
|
||||
// UI and Navigation
|
||||
virtual void retranslateUi() override = 0;
|
||||
[[nodiscard]] virtual QString getTabText() const override = 0;
|
||||
|
||||
// Deck Management
|
||||
virtual void setDeck(DeckLoader *_deckLoader);
|
||||
DeckLoader *getDeckList() const;
|
||||
void setModified(bool _windowModified);
|
||||
bool confirmClose();
|
||||
virtual void createMenus() = 0;
|
||||
|
||||
// UI Elements
|
||||
DeckEditorMenu *deckMenu;
|
||||
DeckEditorDatabaseDisplayWidget *databaseDisplayDockWidget;
|
||||
DeckEditorCardInfoDockWidget *cardInfoDockWidget;
|
||||
DeckEditorDeckDockWidget *deckDockWidget;
|
||||
DeckEditorFilterDockWidget *filterDockWidget;
|
||||
DeckEditorPrintingSelectorDockWidget *printingSelectorDockWidget;
|
||||
|
||||
public slots:
|
||||
void updateCard(CardInfoPtr _card);
|
||||
void actAddCard(CardInfoPtr info);
|
||||
void actAddCardToSideboard(CardInfoPtr info);
|
||||
void actDecrementCard(CardInfoPtr info);
|
||||
void actDecrementCardFromSideboard(CardInfoPtr info);
|
||||
void actOpenRecent(const QString &fileName);
|
||||
void filterTreeChanged(FilterTree *filterTree);
|
||||
void closeRequest(bool forced = false) override;
|
||||
virtual void showPrintingSelector() = 0;
|
||||
virtual void dockTopLevelChanged(bool topLevel) = 0;
|
||||
|
||||
signals:
|
||||
void openDeckEditor(const DeckLoader *deckLoader);
|
||||
void deckEditorClosing(TabGenericDeckEditor *tab);
|
||||
|
||||
protected slots:
|
||||
void updateCardInfoLeft(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void updateCardInfoRight(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void updatePrintingSelectorDatabase(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void updatePrintingSelectorDeckView(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void decklistCustomMenu(QPoint point);
|
||||
|
||||
virtual void actNewDeck() = 0;
|
||||
virtual void actLoadDeck() = 0;
|
||||
// Deck Operations
|
||||
virtual void actNewDeck();
|
||||
void cleanDeckAndResetModified();
|
||||
virtual void actLoadDeck();
|
||||
bool actSaveDeck();
|
||||
bool actSaveDeckAs();
|
||||
virtual void actLoadDeckFromClipboard();
|
||||
|
|
@ -65,8 +103,10 @@ protected slots:
|
|||
void actAnalyzeDeckDeckstats();
|
||||
void actAnalyzeDeckTappedout();
|
||||
|
||||
// Remote Save
|
||||
void saveDeckRemoteFinished(const Response &r);
|
||||
|
||||
// UI Layout Management
|
||||
virtual void loadLayout() = 0;
|
||||
virtual void restartLayout() = 0;
|
||||
virtual void freeDocksSize() = 0;
|
||||
|
|
@ -78,7 +118,7 @@ protected slots:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* @brief Which tab to open the new deck in
|
||||
* @brief Enum for selecting deck open location
|
||||
*/
|
||||
enum DeckOpenLocation
|
||||
{
|
||||
|
|
@ -86,59 +126,25 @@ protected:
|
|||
SAME_TAB,
|
||||
NEW_TAB
|
||||
};
|
||||
DeckOpenLocation confirmOpen(const bool openInSameTabIfBlank = true);
|
||||
QMessageBox *createSaveConfirmationWindow();
|
||||
|
||||
DeckOpenLocation confirmOpen(bool openInSameTabIfBlank = true);
|
||||
QMessageBox *createSaveConfirmationWindow();
|
||||
bool isBlankNewDeck() const;
|
||||
|
||||
// Helper functions for card actions
|
||||
void addCardHelper(CardInfoPtr info, QString zoneName);
|
||||
void decrementCardHelper(CardInfoPtr info, QString zoneName);
|
||||
void actSwapCard(CardInfoPtr info, QString zoneName);
|
||||
virtual void openDeckFromFile(const QString &fileName, DeckOpenLocation deckOpenLocation) = 0;
|
||||
virtual void openDeckFromFile(const QString &fileName, DeckOpenLocation deckOpenLocation);
|
||||
|
||||
// UI Menu Elements
|
||||
QMenu *viewMenu, *cardInfoDockMenu, *deckDockMenu, *filterDockMenu, *printingSelectorDockMenu;
|
||||
|
||||
QAction *aResetLayout;
|
||||
QAction *aCardInfoDockVisible, *aCardInfoDockFloating, *aDeckDockVisible, *aDeckDockFloating, *aFilterDockVisible,
|
||||
*aFilterDockFloating, *aPrintingSelectorDockVisible, *aPrintingSelectorDockFloating;
|
||||
QAction *aCardInfoDockVisible, *aCardInfoDockFloating, *aDeckDockVisible, *aDeckDockFloating;
|
||||
QAction *aFilterDockVisible, *aFilterDockFloating, *aPrintingSelectorDockVisible, *aPrintingSelectorDockFloating;
|
||||
|
||||
bool modified;
|
||||
|
||||
public:
|
||||
explicit TabGenericDeckEditor(TabSupervisor *_tabSupervisor);
|
||||
virtual void retranslateUi() override = 0;
|
||||
[[nodiscard]] virtual QString getTabText() const override = 0;
|
||||
virtual void setDeck(DeckLoader *_deckLoader);
|
||||
void setModified(bool _windowModified);
|
||||
bool confirmClose();
|
||||
virtual void createMenus() = 0;
|
||||
void updateCardInfo(CardInfoPtr _card);
|
||||
void addCardHelper(CardInfoPtr info, QString zoneName);
|
||||
void actAddCardFromDatabase();
|
||||
DeckEditorMenu *deckMenu;
|
||||
DeckEditorDatabaseDisplayWidget *databaseDisplayDockWidget;
|
||||
DeckEditorCardInfoDockWidget *cardInfoDockWidget;
|
||||
DeckEditorDeckDockWidget *deckDockWidget;
|
||||
DeckEditorFilterDockWidget *filterDockWidget;
|
||||
DeckEditorPrintingSelectorDockWidget *printingSelectorDockWidget;
|
||||
|
||||
public slots:
|
||||
void actAddCard(CardInfoPtr info);
|
||||
void actAddCardToSideboardFromDatabase();
|
||||
void actAddCardToSideboard(CardInfoPtr info);
|
||||
void actDecrementCard(CardInfoPtr info);
|
||||
void actDecrementCardFromDatabase();
|
||||
void actDecrementCardFromSideboard(CardInfoPtr info);
|
||||
void actDecrementCardFromSideboardFromDatabase();
|
||||
void actOpenRecent(const QString &fileName);
|
||||
|
||||
void filterTreeChanged(FilterTree *filterTree);
|
||||
|
||||
void closeRequest(bool forced = false) override;
|
||||
virtual void showPrintingSelector() = 0;
|
||||
virtual void dockTopLevelChanged(bool topLevel) = 0;
|
||||
signals:
|
||||
void openDeckEditor(const DeckLoader *deckLoader);
|
||||
void deckEditorClosing(TabGenericDeckEditor *tab);
|
||||
};
|
||||
|
||||
#endif // TAB_GENERIC_DECK_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -308,14 +308,14 @@ QMenu *CardInfoPictureWidget::createAddToOpenDeckMenu()
|
|||
|
||||
QAction *addCard = addCardMenu->addAction(tr("Mainboard"));
|
||||
connect(addCard, &QAction::triggered, this, [this, deckEditorTab] {
|
||||
deckEditorTab->updateCardInfo(info);
|
||||
deckEditorTab->addCardHelper(info, DECK_ZONE_MAIN);
|
||||
deckEditorTab->updateCard(info);
|
||||
deckEditorTab->actAddCard(info);
|
||||
});
|
||||
|
||||
QAction *addCardSideboard = addCardMenu->addAction(tr("Sideboard"));
|
||||
connect(addCardSideboard, &QAction::triggered, this, [this, deckEditorTab] {
|
||||
deckEditorTab->updateCardInfo(info);
|
||||
deckEditorTab->addCardHelper(info, DECK_ZONE_SIDE);
|
||||
deckEditorTab->updateCard(info);
|
||||
deckEditorTab->actAddCardToSideboard(info);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@ void DeckEditorCardInfoDockWidget::createCardInfoDock()
|
|||
connect(this, &QDockWidget::topLevelChanged, deckEditor, &TabGenericDeckEditor::dockTopLevelChanged);
|
||||
}
|
||||
|
||||
void DeckEditorCardInfoDockWidget::updateCard(CardInfoPtr _card)
|
||||
{
|
||||
cardInfo->setCard(_card);
|
||||
}
|
||||
|
||||
void DeckEditorCardInfoDockWidget::retranslateUi()
|
||||
{
|
||||
setWindowTitle(tr("Card Info"));
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ public:
|
|||
|
||||
TabGenericDeckEditor *deckEditor;
|
||||
CardInfoFrameWidget *cardInfo;
|
||||
|
||||
public slots:
|
||||
void updateCard(CardInfoPtr _card);
|
||||
};
|
||||
|
||||
#endif // DECK_EDITOR_CARD_INFO_DOCK_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -42,18 +42,18 @@ DeckEditorDatabaseDisplayWidget::DeckEditorDatabaseDisplayWidget(QWidget *parent
|
|||
|
||||
searchKeySignals.setObjectName("searchKeySignals");
|
||||
connect(searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateSearch(const QString &)));
|
||||
connect(&searchKeySignals, &KeySignals::onEnter, deckEditor, &TabGenericDeckEditor::actAddCardFromDatabase);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltEqual, deckEditor, &TabGenericDeckEditor::actAddCardFromDatabase);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltRBracket, deckEditor,
|
||||
&TabGenericDeckEditor::actAddCardToSideboardFromDatabase);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltMinus, deckEditor,
|
||||
&TabGenericDeckEditor::actDecrementCardFromDatabase);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltLBracket, deckEditor,
|
||||
&TabGenericDeckEditor::actDecrementCardFromSideboardFromDatabase);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltEnter, deckEditor,
|
||||
&TabGenericDeckEditor::actAddCardToSideboardFromDatabase);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlEnter, deckEditor,
|
||||
&TabGenericDeckEditor::actAddCardToSideboardFromDatabase);
|
||||
connect(&searchKeySignals, &KeySignals::onEnter, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltEqual, this,
|
||||
&DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltRBracket, this,
|
||||
&DeckEditorDatabaseDisplayWidget::actAddCardToSideboard);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltMinus, this,
|
||||
&DeckEditorDatabaseDisplayWidget::actDecrementCardFromMainDeck);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltLBracket, this,
|
||||
&DeckEditorDatabaseDisplayWidget::actDecrementCardFromSideboard);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlAltEnter, this,
|
||||
&DeckEditorDatabaseDisplayWidget::actAddCardToSideboard);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlEnter, this, &DeckEditorDatabaseDisplayWidget::actAddCardToSideboard);
|
||||
connect(&searchKeySignals, &KeySignals::onCtrlC, this, &DeckEditorDatabaseDisplayWidget::copyDatabaseCellContents);
|
||||
connect(help, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::showSearchSyntaxHelp);
|
||||
|
||||
|
|
@ -75,11 +75,9 @@ DeckEditorDatabaseDisplayWidget::DeckEditorDatabaseDisplayWidget(QWidget *parent
|
|||
databaseView->setModel(databaseDisplayModel);
|
||||
databaseView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(databaseView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(databaseCustomMenu(QPoint)));
|
||||
connect(databaseView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)),
|
||||
deckEditor, SLOT(updateCardInfoLeft(const QModelIndex &, const QModelIndex &)));
|
||||
connect(databaseView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)),
|
||||
deckEditor, SLOT(updatePrintingSelectorDatabase(const QModelIndex &, const QModelIndex &)));
|
||||
connect(databaseView, &QTreeView::doubleClicked, deckEditor, &TabGenericDeckEditor::actAddCardFromDatabase);
|
||||
connect(databaseView->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
|
||||
&DeckEditorDatabaseDisplayWidget::updateCard);
|
||||
connect(databaseView, &QTreeView::doubleClicked, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
|
||||
|
||||
QByteArray dbHeaderState = SettingsCache::instance().layouts().getDeckEditorDbHeaderState();
|
||||
if (dbHeaderState.isNull()) {
|
||||
|
|
@ -94,14 +92,13 @@ DeckEditorDatabaseDisplayWidget::DeckEditorDatabaseDisplayWidget(QWidget *parent
|
|||
|
||||
aAddCard = new QAction(QString(), this);
|
||||
aAddCard->setIcon(QPixmap("theme:icons/arrow_right_green"));
|
||||
connect(aAddCard, &QAction::triggered, deckEditor, &TabGenericDeckEditor::actAddCardFromDatabase);
|
||||
connect(aAddCard, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
|
||||
auto *tbAddCard = new QToolButton(this);
|
||||
tbAddCard->setDefaultAction(aAddCard);
|
||||
|
||||
aAddCardToSideboard = new QAction(QString(), this);
|
||||
aAddCardToSideboard->setIcon(QPixmap("theme:icons/arrow_right_blue"));
|
||||
connect(aAddCardToSideboard, &QAction::triggered, deckEditor,
|
||||
&TabGenericDeckEditor::actAddCardToSideboardFromDatabase);
|
||||
connect(aAddCardToSideboard, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToSideboard);
|
||||
auto *tbAddCardToSideboard = new QToolButton(this);
|
||||
tbAddCardToSideboard->setDefaultAction(aAddCardToSideboard);
|
||||
|
||||
|
|
@ -126,6 +123,41 @@ void DeckEditorDatabaseDisplayWidget::updateSearch(const QString &search)
|
|||
QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::updateCard(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
||||
{
|
||||
const QString cardName = current.sibling(current.row(), 0).data().toString();
|
||||
const QString cardProviderID = CardDatabaseManager::getInstance()->getPreferredPrintingProviderIdForCard(cardName);
|
||||
|
||||
if (!current.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
|
||||
CardInfoPtr card = CardDatabaseManager::getInstance()->getCardByNameAndProviderId(cardName, cardProviderID);
|
||||
emit cardChanged(card);
|
||||
}
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck()
|
||||
{
|
||||
emit addCardToMainDeck(currentCardInfo());
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::actAddCardToSideboard()
|
||||
{
|
||||
emit addCardToSideboard(currentCardInfo());
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::actDecrementCardFromMainDeck()
|
||||
{
|
||||
emit decrementCardFromMainDeck(currentCardInfo());
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::actDecrementCardFromSideboard()
|
||||
{
|
||||
emit decrementCardFromSideboard(currentCardInfo());
|
||||
}
|
||||
|
||||
CardInfoPtr DeckEditorDatabaseDisplayWidget::currentCardInfo() const
|
||||
{
|
||||
const QModelIndex currentIndex = databaseView->selectionModel()->currentIndex();
|
||||
|
|
@ -156,9 +188,8 @@ void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point)
|
|||
}
|
||||
edhRecCard = menu.addAction(tr("Show on EDHREC (Card)"));
|
||||
|
||||
connect(addToDeck, &QAction::triggered, deckEditor, &TabGenericDeckEditor::actAddCardFromDatabase);
|
||||
connect(addToSideboard, &QAction::triggered, deckEditor,
|
||||
&TabGenericDeckEditor::actAddCardToSideboardFromDatabase);
|
||||
connect(addToDeck, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
|
||||
connect(addToSideboard, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToSideboard);
|
||||
connect(selectPrinting, &QAction::triggered, this, [this, info] { deckEditor->showPrintingSelector(); });
|
||||
connect(edhRecCard, &QAction::triggered, this,
|
||||
[this, info] { deckEditor->getTabSupervisor()->addEdhrecTab(info); });
|
||||
|
|
|
|||
|
|
@ -25,6 +25,13 @@ public slots:
|
|||
CardInfoPtr currentCardInfo() const;
|
||||
void setFilterTree(FilterTree *filterTree);
|
||||
|
||||
signals:
|
||||
void addCardToMainDeck(CardInfoPtr card);
|
||||
void addCardToSideboard(CardInfoPtr card);
|
||||
void decrementCardFromMainDeck(CardInfoPtr card);
|
||||
void decrementCardFromSideboard(CardInfoPtr card);
|
||||
void cardChanged(CardInfoPtr _card);
|
||||
|
||||
private:
|
||||
KeySignals searchKeySignals;
|
||||
QTreeView *databaseView;
|
||||
|
|
@ -37,6 +44,11 @@ private slots:
|
|||
void showSearchSyntaxHelp();
|
||||
void retranslateUi();
|
||||
void updateSearch(const QString &search);
|
||||
void updateCard(const QModelIndex ¤t, const QModelIndex &);
|
||||
void actAddCardToMainDeck();
|
||||
void actAddCardToSideboard();
|
||||
void actDecrementCardFromMainDeck();
|
||||
void actDecrementCardFromSideboard();
|
||||
void databaseCustomMenu(QPoint point);
|
||||
void copyDatabaseCellContents();
|
||||
void saveDbHeaderState();
|
||||
|
|
|
|||
|
|
@ -39,10 +39,8 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
deckView->installEventFilter(&deckViewKeySignals);
|
||||
deckView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), deckEditor,
|
||||
SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &)));
|
||||
connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), deckEditor,
|
||||
SLOT(updatePrintingSelectorDeckView(const QModelIndex &, const QModelIndex &)));
|
||||
connect(deckView->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
|
||||
&DeckEditorDeckDockWidget::updateCard);
|
||||
connect(deckView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actSwapCard()));
|
||||
connect(deckView, SIGNAL(customContextMenuRequested(QPoint)), deckEditor, SLOT(decklistCustomMenu(QPoint)));
|
||||
connect(&deckViewKeySignals, SIGNAL(onShiftS()), this, SLOT(actSwapCard()));
|
||||
|
|
@ -166,6 +164,30 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
retranslateUi();
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::updateCard(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
||||
{
|
||||
if (!current.isValid())
|
||||
return;
|
||||
const QString cardName = current.sibling(current.row(), 1).data().toString();
|
||||
const QString cardProviderID = current.sibling(current.row(), 4).data().toString();
|
||||
const QModelIndex gparent = current.parent().parent();
|
||||
|
||||
if (!gparent.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QString zoneName = gparent.sibling(gparent.row(), 1).data(Qt::EditRole).toString();
|
||||
|
||||
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
|
||||
QString cardName = current.sibling(current.row(), 1).data().toString();
|
||||
QString providerId = current.sibling(current.row(), 4).data().toString();
|
||||
if (CardInfoPtr selectedCard =
|
||||
CardDatabaseManager::getInstance()->getCardByNameAndProviderId(cardName, providerId)) {
|
||||
emit cardChanged(selectedCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::updateName(const QString &name)
|
||||
{
|
||||
deckModel->getDeckList()->setName(name);
|
||||
|
|
@ -274,6 +296,11 @@ void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
|
|||
deckTagsDisplayWidget->connectDeckList(deckModel->getDeckList());
|
||||
}
|
||||
|
||||
DeckLoader *DeckEditorDeckDockWidget::getDeckList()
|
||||
{
|
||||
return deckModel->getDeckList();
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::cleanDeck()
|
||||
{
|
||||
deckModel->cleanList();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public slots:
|
|||
void cleanDeck();
|
||||
void updateBannerCardComboBox();
|
||||
void setDeck(DeckLoader *_deck);
|
||||
DeckLoader *getDeckList();
|
||||
void actIncrement();
|
||||
bool swapCard(const QModelIndex &idx);
|
||||
void actSwapCard();
|
||||
|
|
@ -45,6 +46,9 @@ public slots:
|
|||
void actRemoveCard();
|
||||
void offsetCountAtIndex(const QModelIndex &idx, int offset);
|
||||
|
||||
signals:
|
||||
void cardChanged(CardInfoPtr _card);
|
||||
|
||||
private:
|
||||
TabGenericDeckEditor *deckEditor;
|
||||
KeySignals deckViewKeySignals;
|
||||
|
|
@ -63,6 +67,7 @@ private:
|
|||
QModelIndexList getSelectedCardNodes() const;
|
||||
|
||||
private slots:
|
||||
void updateCard(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void updateName(const QString &name);
|
||||
void updateComments();
|
||||
void setBannerCard(int);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void PrintingSelectorCardOverlayWidget::enterEvent(QEvent *event)
|
|||
#endif
|
||||
{
|
||||
QWidget::enterEvent(event);
|
||||
deckEditor->updateCardInfo(setCard);
|
||||
deckEditor->updateCard(setCard);
|
||||
|
||||
// Check if either mainboard or sideboard amount is greater than 0
|
||||
if (allZonesCardAmountWidget->getMainboardAmount() > 0 || allZonesCardAmountWidget->getSideboardAmount() > 0) {
|
||||
|
|
@ -199,7 +199,7 @@ void PrintingSelectorCardOverlayWidget::customMenu(QPoint point)
|
|||
const QString &relatedCardName = rel->getName();
|
||||
QAction *relatedCard = relatedMenu->addAction(relatedCardName);
|
||||
connect(relatedCard, &QAction::triggered, deckEditor, [this, relatedCardName] {
|
||||
deckEditor->updateCardInfo(CardDatabaseManager::getInstance()->getCard(relatedCardName));
|
||||
deckEditor->updateCard(CardDatabaseManager::getInstance()->getCard(relatedCardName));
|
||||
deckEditor->showPrintingSelector();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ public:
|
|||
return lastRemoteDeckId;
|
||||
}
|
||||
|
||||
bool hasNotBeenLoaded() const
|
||||
{
|
||||
return getLastFileName().isEmpty() && getLastRemoteDeckId() == -1;
|
||||
}
|
||||
|
||||
void clearSetNamesAndNumbers();
|
||||
static FileFormat getFormatFromName(const QString &fileName);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue