mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 12:54:10 -07:00
Deck loader is a gui class.
Took 31 minutes Took 3 minutes
This commit is contained in:
parent
4d652210dc
commit
919c9f0095
30 changed files with 69 additions and 54 deletions
|
|
@ -19,6 +19,7 @@ set(cockatrice_SOURCES
|
||||||
src/client/settings/card_counter_settings.cpp
|
src/client/settings/card_counter_settings.cpp
|
||||||
src/client/settings/shortcut_treeview.cpp
|
src/client/settings/shortcut_treeview.cpp
|
||||||
src/client/settings/shortcuts_settings.cpp
|
src/client/settings/shortcuts_settings.cpp
|
||||||
|
src/interface/deck_loader/deck_loader.cpp
|
||||||
src/interface/widgets/dialogs/dlg_connect.cpp
|
src/interface/widgets/dialogs/dlg_connect.cpp
|
||||||
src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.cpp
|
src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.cpp
|
||||||
src/interface/widgets/dialogs/dlg_create_game.cpp
|
src/interface/widgets/dialogs/dlg_create_game.cpp
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,10 @@
|
||||||
|
|
||||||
#ifndef INTERFACE_JSON_DECK_PARSER_H
|
#ifndef INTERFACE_JSON_DECK_PARSER_H
|
||||||
#define INTERFACE_JSON_DECK_PARSER_H
|
#define INTERFACE_JSON_DECK_PARSER_H
|
||||||
|
#include "../../../interface/deck_loader/deck_loader.h"
|
||||||
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
class IJsonDeckParser
|
class IJsonDeckParser
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "../../client/settings/cache_settings.h"
|
#include "../../client/settings/cache_settings.h"
|
||||||
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
||||||
|
#include "../../interface/deck_loader/deck_loader.h"
|
||||||
#include "../../interface/widgets/dialogs/dlg_load_deck.h"
|
#include "../../interface/widgets/dialogs/dlg_load_deck.h"
|
||||||
#include "../../interface/widgets/dialogs/dlg_load_deck_from_clipboard.h"
|
#include "../../interface/widgets/dialogs/dlg_load_deck_from_clipboard.h"
|
||||||
#include "../../interface/widgets/dialogs/dlg_load_deck_from_website.h"
|
#include "../../interface/widgets/dialogs/dlg_load_deck_from_website.h"
|
||||||
|
|
@ -16,7 +17,6 @@
|
||||||
#include <google/protobuf/descriptor.h>
|
#include <google/protobuf/descriptor.h>
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <libcockatrice/protocol/pb/command_deck_select.pb.h>
|
#include <libcockatrice/protocol/pb/command_deck_select.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_ready_start.pb.h>
|
#include <libcockatrice/protocol/pb/command_ready_start.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_set_sideboard_lock.pb.h>
|
#include <libcockatrice/protocol/pb/command_set_sideboard_lock.pb.h>
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@
|
||||||
#ifndef DECK_VIEW_CONTAINER_H
|
#ifndef DECK_VIEW_CONTAINER_H
|
||||||
#define DECK_VIEW_CONTAINER_H
|
#define DECK_VIEW_CONTAINER_H
|
||||||
|
|
||||||
|
#include "../../interface/deck_loader/deck_loader.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
class AbstractCardItem;
|
class AbstractCardItem;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#ifndef COCKATRICE_PLAYER_INFO_H
|
#ifndef COCKATRICE_PLAYER_INFO_H
|
||||||
#define COCKATRICE_PLAYER_INFO_H
|
#define COCKATRICE_PLAYER_INFO_H
|
||||||
|
|
||||||
|
#include "../../interface/deck_loader/deck_loader.h"
|
||||||
#include "../zones/hand_zone.h"
|
#include "../zones/hand_zone.h"
|
||||||
#include "../zones/pile_zone.h"
|
#include "../zones/pile_zone.h"
|
||||||
#include "../zones/stack_zone.h"
|
#include "../zones/stack_zone.h"
|
||||||
|
|
@ -14,7 +15,6 @@
|
||||||
#include "player_target.h"
|
#include "player_target.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||||
|
|
||||||
class PlayerInfo : public QObject
|
class PlayerInfo : public QObject
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "mana_base_widget.h"
|
#include "mana_base_widget.h"
|
||||||
|
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../general/display/banner_widget.h"
|
#include "../general/display/banner_widget.h"
|
||||||
#include "../general/display/bar_widget.h"
|
#include "../general/display/bar_widget.h"
|
||||||
|
|
||||||
|
|
@ -8,7 +9,6 @@
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
ManaBaseWidget::ManaBaseWidget(QWidget *parent, DeckListModel *_deckListModel)
|
ManaBaseWidget::ManaBaseWidget(QWidget *parent, DeckListModel *_deckListModel)
|
||||||
: QWidget(parent), deckListModel(_deckListModel)
|
: QWidget(parent), deckListModel(_deckListModel)
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
#include "mana_curve_widget.h"
|
#include "mana_curve_widget.h"
|
||||||
|
|
||||||
#include "../../../main.h"
|
#include "../../../main.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../general/display/banner_widget.h"
|
#include "../general/display/banner_widget.h"
|
||||||
#include "../general/display/bar_widget.h"
|
#include "../general/display/bar_widget.h"
|
||||||
|
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
ManaCurveWidget::ManaCurveWidget(QWidget *parent, DeckListModel *_deckListModel)
|
ManaCurveWidget::ManaCurveWidget(QWidget *parent, DeckListModel *_deckListModel)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "mana_devotion_widget.h"
|
#include "mana_devotion_widget.h"
|
||||||
|
|
||||||
#include "../../../main.h"
|
#include "../../../main.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../general/display/banner_widget.h"
|
#include "../general/display/banner_widget.h"
|
||||||
#include "../general/display/bar_widget.h"
|
#include "../general/display/bar_widget.h"
|
||||||
|
|
||||||
|
|
@ -8,7 +9,6 @@
|
||||||
#include <libcockatrice/card/database/card_database.h>
|
#include <libcockatrice/card/database/card_database.h>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "deck_editor_deck_dock_widget.h"
|
#include "deck_editor_deck_dock_widget.h"
|
||||||
|
|
||||||
#include "../../../client/settings/cache_settings.h"
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
|
|
@ -366,7 +367,11 @@ void DeckEditorDeckDockWidget::syncBannerCardComboBoxSelectionWithDeck()
|
||||||
*/
|
*/
|
||||||
void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
|
void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
|
||||||
{
|
{
|
||||||
deckModel->setDeckList(_deck);
|
deckLoader = _deck;
|
||||||
|
|
||||||
|
deckModel->setDeckList(qobject_cast<DeckList *>(_deck));
|
||||||
|
connect(_deck, &DeckLoader::deckLoaded, deckModel, &DeckListModel::rebuildTree);
|
||||||
|
connect(_deck, &DeckLoader::deckHashChanged, deckModel, &DeckListModel::deckHashChanged);
|
||||||
|
|
||||||
nameEdit->setText(deckModel->getDeckList()->getName());
|
nameEdit->setText(deckModel->getDeckList()->getName());
|
||||||
commentsEdit->setText(deckModel->getDeckList()->getComments());
|
commentsEdit->setText(deckModel->getDeckList()->getComments());
|
||||||
|
|
@ -383,11 +388,16 @@ void DeckEditorDeckDockWidget::setDeck(DeckLoader *_deck)
|
||||||
emit deckChanged();
|
emit deckChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckLoader *DeckEditorDeckDockWidget::getDeckList()
|
DeckList *DeckEditorDeckDockWidget::getDeckList()
|
||||||
{
|
{
|
||||||
return deckModel->getDeckList();
|
return deckModel->getDeckList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeckLoader *DeckEditorDeckDockWidget::getDeckLoader()
|
||||||
|
{
|
||||||
|
return deckLoader;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the tab to the state for a blank new tab.
|
* Resets the tab to the state for a blank new tab.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ class DeckEditorDeckDockWidget : public QDockWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DeckEditorDeckDockWidget(AbstractTabDeckEditor *parent);
|
explicit DeckEditorDeckDockWidget(AbstractTabDeckEditor *parent);
|
||||||
|
DeckLoader *deckLoader;
|
||||||
DeckListModel *deckModel;
|
DeckListModel *deckModel;
|
||||||
QTreeView *deckView;
|
QTreeView *deckView;
|
||||||
QComboBox *bannerCardComboBox;
|
QComboBox *bannerCardComboBox;
|
||||||
|
|
@ -50,7 +51,8 @@ public slots:
|
||||||
void cleanDeck();
|
void cleanDeck();
|
||||||
void updateBannerCardComboBox();
|
void updateBannerCardComboBox();
|
||||||
void setDeck(DeckLoader *_deck);
|
void setDeck(DeckLoader *_deck);
|
||||||
DeckLoader *getDeckList();
|
DeckList *getDeckList();
|
||||||
|
DeckLoader *getDeckLoader();
|
||||||
void actIncrement();
|
void actIncrement();
|
||||||
bool swapCard(const QModelIndex &idx);
|
bool swapCard(const QModelIndex &idx);
|
||||||
void actDecrementCard(const ExactCard &card, QString zoneName);
|
void actDecrementCard(const ExactCard &card, QString zoneName);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#include "dlg_load_deck.h"
|
#include "dlg_load_deck.h"
|
||||||
|
|
||||||
#include "../../../client/settings/cache_settings.h"
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
DlgLoadDeck::DlgLoadDeck(QWidget *parent) : QFileDialog(parent, tr("Load Deck"))
|
DlgLoadDeck::DlgLoadDeck(QWidget *parent) : QFileDialog(parent, tr("Load Deck"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "dlg_load_deck_from_clipboard.h"
|
#include "dlg_load_deck_from_clipboard.h"
|
||||||
|
|
||||||
#include "../../../client/settings/cache_settings.h"
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "dlg_settings.h"
|
#include "dlg_settings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
@ -12,7 +13,6 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the main layout and connects the signals that are common to all versions of this window
|
* Creates the main layout and connects the signals that are common to all versions of this window
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "dlg_select_set_for_cards.h"
|
#include "dlg_select_set_for_cards.h"
|
||||||
|
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../interface/widgets/cards/card_info_picture_widget.h"
|
#include "../interface/widgets/cards/card_info_picture_widget.h"
|
||||||
#include "../interface/widgets/general/layout_containers/flow_widget.h"
|
#include "../interface/widgets/general/layout_containers/flow_widget.h"
|
||||||
#include "dlg_select_set_for_cards.h"
|
#include "dlg_select_set_for_cards.h"
|
||||||
|
|
@ -16,7 +17,6 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <qdrag.h>
|
#include <qdrag.h>
|
||||||
#include <qevent.h>
|
#include <qevent.h>
|
||||||
|
|
||||||
|
|
@ -162,14 +162,14 @@ void DlgSelectSetForCards::actOK()
|
||||||
|
|
||||||
void DlgSelectSetForCards::actClear()
|
void DlgSelectSetForCards::actClear()
|
||||||
{
|
{
|
||||||
model->getDeckList()->clearSetNamesAndNumbers();
|
qobject_cast<DeckLoader *>(model->getDeckList())->clearSetNamesAndNumbers();
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgSelectSetForCards::actSetAllToPreferred()
|
void DlgSelectSetForCards::actSetAllToPreferred()
|
||||||
{
|
{
|
||||||
model->getDeckList()->clearSetNamesAndNumbers();
|
qobject_cast<DeckLoader *>(model->getDeckList())->clearSetNamesAndNumbers();
|
||||||
model->getDeckList()->setProviderIdToPreferredPrinting();
|
qobject_cast<DeckLoader *>(model->getDeckList())->setProviderIdToPreferredPrinting();
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@
|
||||||
|
|
||||||
#ifndef ALL_ZONES_CARD_AMOUNT_WIDGET_H
|
#ifndef ALL_ZONES_CARD_AMOUNT_WIDGET_H
|
||||||
#define ALL_ZONES_CARD_AMOUNT_WIDGET_H
|
#define ALL_ZONES_CARD_AMOUNT_WIDGET_H
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "card_amount_widget.h"
|
#include "card_amount_widget.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
class AllZonesCardAmountWidget : public QWidget
|
class AllZonesCardAmountWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#define CARD_AMOUNT_WIDGET_H
|
#define CARD_AMOUNT_WIDGET_H
|
||||||
|
|
||||||
#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h"
|
#include "../../../interface/widgets/tabs/abstract_tab_deck_editor.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../general/display/dynamic_font_size_push_button.h"
|
#include "../general/display/dynamic_font_size_push_button.h"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
@ -18,7 +19,6 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <libcockatrice/card/card_info.h>
|
#include <libcockatrice/card/card_info.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
class CardAmountWidget : public QWidget
|
class CardAmountWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -217,11 +217,16 @@ void AbstractTabDeckEditor::setDeck(DeckLoader *_deck)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Returns the currently loaded deck. */
|
/** @brief Returns the currently loaded deck. */
|
||||||
DeckLoader *AbstractTabDeckEditor::getDeckList() const
|
DeckList *AbstractTabDeckEditor::getDeckList() const
|
||||||
{
|
{
|
||||||
return deckDockWidget->getDeckList();
|
return deckDockWidget->getDeckList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeckLoader *AbstractTabDeckEditor::getDeckLoader() const
|
||||||
|
{
|
||||||
|
return deckDockWidget->getDeckLoader();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the modified state of the tab.
|
* @brief Sets the modified state of the tab.
|
||||||
* @param _modified True if tab is modified, false otherwise.
|
* @param _modified True if tab is modified, false otherwise.
|
||||||
|
|
@ -237,7 +242,7 @@ void AbstractTabDeckEditor::setModified(bool _modified)
|
||||||
*/
|
*/
|
||||||
bool AbstractTabDeckEditor::isBlankNewDeck() const
|
bool AbstractTabDeckEditor::isBlankNewDeck() const
|
||||||
{
|
{
|
||||||
DeckLoader *deck = getDeckList();
|
DeckLoader *deck = deckDockWidget->getDeckLoader();
|
||||||
return !modified && deck->isBlankDeck() && deck->hasNotBeenLoaded();
|
return !modified && deck->isBlankDeck() && deck->hasNotBeenLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -377,7 +382,7 @@ void AbstractTabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLo
|
||||||
*/
|
*/
|
||||||
bool AbstractTabDeckEditor::actSaveDeck()
|
bool AbstractTabDeckEditor::actSaveDeck()
|
||||||
{
|
{
|
||||||
DeckLoader *const deck = getDeckList();
|
DeckLoader *const deck = getDeckLoader();
|
||||||
if (deck->getLastRemoteDeckId() != -1) {
|
if (deck->getLastRemoteDeckId() != -1) {
|
||||||
QString deckString = deck->writeToString_Native();
|
QString deckString = deck->writeToString_Native();
|
||||||
if (deckString.length() > MAX_FILE_LENGTH) {
|
if (deckString.length() > MAX_FILE_LENGTH) {
|
||||||
|
|
@ -426,7 +431,7 @@ bool AbstractTabDeckEditor::actSaveDeckAs()
|
||||||
QString fileName = dialog.selectedFiles().at(0);
|
QString fileName = dialog.selectedFiles().at(0);
|
||||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
|
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
|
||||||
|
|
||||||
if (!getDeckList()->saveToFile(fileName, fmt)) {
|
if (!getDeckLoader()->saveToFile(fileName, fmt)) {
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
this, tr("Error"),
|
this, tr("Error"),
|
||||||
tr("The deck could not be saved.\nPlease check that the directory is writable and try again."));
|
tr("The deck could not be saved.\nPlease check that the directory is writable and try again."));
|
||||||
|
|
@ -480,7 +485,7 @@ void AbstractTabDeckEditor::actLoadDeckFromClipboard()
|
||||||
*/
|
*/
|
||||||
void AbstractTabDeckEditor::editDeckInClipboard(bool annotated)
|
void AbstractTabDeckEditor::editDeckInClipboard(bool annotated)
|
||||||
{
|
{
|
||||||
DlgEditDeckInClipboard dlg(*getDeckList(), annotated, this);
|
DlgEditDeckInClipboard dlg(*getDeckLoader(), annotated, this);
|
||||||
if (!dlg.exec())
|
if (!dlg.exec())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -504,25 +509,25 @@ void AbstractTabDeckEditor::actEditDeckInClipboardRaw()
|
||||||
/** @brief Saves deck to clipboard with set info and annotation. */
|
/** @brief Saves deck to clipboard with set info and annotation. */
|
||||||
void AbstractTabDeckEditor::actSaveDeckToClipboard()
|
void AbstractTabDeckEditor::actSaveDeckToClipboard()
|
||||||
{
|
{
|
||||||
getDeckList()->saveToClipboard(true, true);
|
getDeckLoader()->saveToClipboard(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Saves deck to clipboard with annotation, without set info. */
|
/** @brief Saves deck to clipboard with annotation, without set info. */
|
||||||
void AbstractTabDeckEditor::actSaveDeckToClipboardNoSetInfo()
|
void AbstractTabDeckEditor::actSaveDeckToClipboardNoSetInfo()
|
||||||
{
|
{
|
||||||
getDeckList()->saveToClipboard(true, false);
|
getDeckLoader()->saveToClipboard(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Saves deck to clipboard without annotations, with set info. */
|
/** @brief Saves deck to clipboard without annotations, with set info. */
|
||||||
void AbstractTabDeckEditor::actSaveDeckToClipboardRaw()
|
void AbstractTabDeckEditor::actSaveDeckToClipboardRaw()
|
||||||
{
|
{
|
||||||
getDeckList()->saveToClipboard(false, true);
|
getDeckLoader()->saveToClipboard(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Saves deck to clipboard without annotations or set info. */
|
/** @brief Saves deck to clipboard without annotations or set info. */
|
||||||
void AbstractTabDeckEditor::actSaveDeckToClipboardRawNoSetInfo()
|
void AbstractTabDeckEditor::actSaveDeckToClipboardRawNoSetInfo()
|
||||||
{
|
{
|
||||||
getDeckList()->saveToClipboard(false, false);
|
getDeckLoader()->saveToClipboard(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Prints the deck using a QPrintPreviewDialog. */
|
/** @brief Prints the deck using a QPrintPreviewDialog. */
|
||||||
|
|
@ -562,7 +567,7 @@ void AbstractTabDeckEditor::actLoadDeckFromWebsite()
|
||||||
*/
|
*/
|
||||||
void AbstractTabDeckEditor::exportToDecklistWebsite(DeckLoader::DecklistWebsite website)
|
void AbstractTabDeckEditor::exportToDecklistWebsite(DeckLoader::DecklistWebsite website)
|
||||||
{
|
{
|
||||||
if (DeckLoader *const deck = getDeckList()) {
|
if (DeckLoader *const deck = getDeckLoader()) {
|
||||||
QString decklistUrlString = deck->exportDeckToDecklist(website);
|
QString decklistUrlString = deck->exportDeckToDecklist(website);
|
||||||
// Check to make sure the string isn't empty.
|
// Check to make sure the string isn't empty.
|
||||||
if (decklistUrlString.isEmpty()) {
|
if (decklistUrlString.isEmpty()) {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,8 @@ public:
|
||||||
void openDeck(DeckLoader *deck);
|
void openDeck(DeckLoader *deck);
|
||||||
|
|
||||||
/** @brief Returns the currently active deck. */
|
/** @brief Returns the currently active deck. */
|
||||||
DeckLoader *getDeckList() const;
|
DeckList *getDeckList() const;
|
||||||
|
DeckLoader *getDeckLoader() const;
|
||||||
|
|
||||||
/** @brief Sets the modified state of the tab.
|
/** @brief Sets the modified state of the tab.
|
||||||
* @param _windowModified Whether the tab is modified.
|
* @param _windowModified Whether the tab is modified.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
#include "edhrec_deck_api_response.h"
|
#include "edhrec_deck_api_response.h"
|
||||||
|
|
||||||
|
#include "../../../../../../deck_loader/deck_loader.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
void EdhrecDeckApiResponse::fromJson(const QJsonArray &json)
|
void EdhrecDeckApiResponse::fromJson(const QJsonArray &json)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,13 @@
|
||||||
#ifndef EDHREC_DECK_API_RESPONSE_H
|
#ifndef EDHREC_DECK_API_RESPONSE_H
|
||||||
#define EDHREC_DECK_API_RESPONSE_H
|
#define EDHREC_DECK_API_RESPONSE_H
|
||||||
|
|
||||||
|
#include "../../../../../../deck_loader/deck_loader.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
class EdhrecDeckApiResponse
|
class EdhrecDeckApiResponse
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "tab_deck_storage.h"
|
#include "tab_deck_storage.h"
|
||||||
|
|
||||||
#include "../../../client/settings/cache_settings.h"
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../interface/widgets/server/remote/remote_decklist_tree_widget.h"
|
#include "../interface/widgets/server/remote/remote_decklist_tree_widget.h"
|
||||||
#include "../interface/widgets/utility/get_text_with_max.h"
|
#include "../interface/widgets/utility/get_text_with_max.h"
|
||||||
|
|
||||||
|
|
@ -19,7 +20,6 @@
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <libcockatrice/protocol/pb/command_deck_del.pb.h>
|
#include <libcockatrice/protocol/pb/command_deck_del.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_deck_del_dir.pb.h>
|
#include <libcockatrice/protocol/pb/command_deck_del_dir.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/command_deck_download.pb.h>
|
#include <libcockatrice/protocol/pb/command_deck_download.pb.h>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#ifndef TAB_SUPERVISOR_H
|
#ifndef TAB_SUPERVISOR_H
|
||||||
#define TAB_SUPERVISOR_H
|
#define TAB_SUPERVISOR_H
|
||||||
|
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../interface/widgets/server/user/user_list_proxy.h"
|
#include "../interface/widgets/server/user/user_list_proxy.h"
|
||||||
#include "abstract_tab_deck_editor.h"
|
#include "abstract_tab_deck_editor.h"
|
||||||
#include "api/edhrec/tab_edhrec.h"
|
#include "api/edhrec/tab_edhrec.h"
|
||||||
|
|
@ -23,7 +24,6 @@
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QProxyStyle>
|
#include <QProxyStyle>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
inline Q_LOGGING_CATEGORY(TabSupervisorLog, "tab_supervisor");
|
inline Q_LOGGING_CATEGORY(TabSupervisorLog, "tab_supervisor");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#include "visual_deck_editor_sample_hand_widget.h"
|
#include "visual_deck_editor_sample_hand_widget.h"
|
||||||
|
|
||||||
#include "../../../client/settings/cache_settings.h"
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../cards/card_info_picture_widget.h"
|
#include "../cards/card_info_picture_widget.h"
|
||||||
|
|
||||||
#include <libcockatrice/card/database/card_database_manager.h>
|
#include <libcockatrice/card/database/card_database_manager.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *parent, DeckListModel *_deckListModel)
|
VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *parent, DeckListModel *_deckListModel)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "visual_deck_editor_widget.h"
|
#include "visual_deck_editor_widget.h"
|
||||||
|
|
||||||
#include "../../../main.h"
|
#include "../../../main.h"
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../../layouts/overlap_layout.h"
|
#include "../../layouts/overlap_layout.h"
|
||||||
#include "../cards/card_info_picture_with_text_overlay_widget.h"
|
#include "../cards/card_info_picture_with_text_overlay_widget.h"
|
||||||
#include "../cards/deck_card_zone_display_widget.h"
|
#include "../cards/deck_card_zone_display_widget.h"
|
||||||
|
|
@ -22,7 +23,6 @@
|
||||||
#include <libcockatrice/models/database/card/card_search_model.h>
|
#include <libcockatrice/models/database/card/card_search_model.h>
|
||||||
#include <libcockatrice/models/database/card_database_model.h>
|
#include <libcockatrice/models/database/card_database_model.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
#include <qscrollarea.h>
|
#include <qscrollarea.h>
|
||||||
|
|
||||||
VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, DeckListModel *_deckListModel)
|
VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, DeckListModel *_deckListModel)
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
#ifndef DECK_PREVIEW_DECK_TAGS_DISPLAY_WIDGET_H
|
#ifndef DECK_PREVIEW_DECK_TAGS_DISPLAY_WIDGET_H
|
||||||
#define DECK_PREVIEW_DECK_TAGS_DISPLAY_WIDGET_H
|
#define DECK_PREVIEW_DECK_TAGS_DISPLAY_WIDGET_H
|
||||||
|
|
||||||
|
#include "../../../deck_loader/deck_loader.h"
|
||||||
#include "deck_preview_widget.h"
|
#include "deck_preview_widget.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
inline bool confirmOverwriteIfExists(QWidget *parent, const QString &filePath);
|
inline bool confirmOverwriteIfExists(QWidget *parent, const QString &filePath);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#ifndef DECK_PREVIEW_WIDGET_H
|
#ifndef DECK_PREVIEW_WIDGET_H
|
||||||
#define DECK_PREVIEW_WIDGET_H
|
#define DECK_PREVIEW_WIDGET_H
|
||||||
|
|
||||||
|
#include "../../../deck_loader/deck_loader.h"
|
||||||
#include "../../cards/additional_info/color_identity_widget.h"
|
#include "../../cards/additional_info/color_identity_widget.h"
|
||||||
#include "../../cards/deck_preview_card_picture_widget.h"
|
#include "../../cards/deck_preview_card_picture_widget.h"
|
||||||
#include "../visual_deck_storage_widget.h"
|
#include "../visual_deck_storage_widget.h"
|
||||||
|
|
@ -18,7 +19,6 @@
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <libcockatrice/models/deck_list/deck_loader.h>
|
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class VisualDeckStorageWidget;
|
class VisualDeckStorageWidget;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#ifndef VISUAL_DECK_STORAGE_WIDGET_H
|
#ifndef VISUAL_DECK_STORAGE_WIDGET_H
|
||||||
#define VISUAL_DECK_STORAGE_WIDGET_H
|
#define VISUAL_DECK_STORAGE_WIDGET_H
|
||||||
|
|
||||||
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "../cards/card_size_widget.h"
|
#include "../cards/card_size_widget.h"
|
||||||
#include "../general/layout_containers/flow_widget.h"
|
#include "../general/layout_containers/flow_widget.h"
|
||||||
#include "../quick_settings/settings_button_widget.h"
|
#include "../quick_settings/settings_button_widget.h"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
#include "deck_list_model.h"
|
#include "deck_list_model.h"
|
||||||
|
|
||||||
#include "deck_loader.h"
|
|
||||||
|
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
|
|
@ -15,10 +13,8 @@
|
||||||
DeckListModel::DeckListModel(QObject *parent)
|
DeckListModel::DeckListModel(QObject *parent)
|
||||||
: QAbstractItemModel(parent), lastKnownColumn(1), lastKnownOrder(Qt::AscendingOrder)
|
: QAbstractItemModel(parent), lastKnownColumn(1), lastKnownOrder(Qt::AscendingOrder)
|
||||||
{
|
{
|
||||||
deckList = new DeckLoader;
|
deckList = new DeckList;
|
||||||
deckList->setParent(this);
|
deckList->setParent(this);
|
||||||
connect(deckList, &DeckLoader::deckLoaded, this, &DeckListModel::rebuildTree);
|
|
||||||
connect(deckList, &DeckLoader::deckHashChanged, this, &DeckListModel::deckHashChanged);
|
|
||||||
root = new InnerDecklistNode;
|
root = new InnerDecklistNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -528,19 +524,17 @@ void DeckListModel::setActiveGroupCriteria(DeckListModelGroupCriteria newCriteri
|
||||||
|
|
||||||
void DeckListModel::cleanList()
|
void DeckListModel::cleanList()
|
||||||
{
|
{
|
||||||
setDeckList(new DeckLoader);
|
setDeckList(new DeckList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _deck The deck. Takes ownership of the object
|
* @param _deck The deck. Takes ownership of the object
|
||||||
*/
|
*/
|
||||||
void DeckListModel::setDeckList(DeckLoader *_deck)
|
void DeckListModel::setDeckList(DeckList *_deck)
|
||||||
{
|
{
|
||||||
deckList->deleteLater();
|
deckList->deleteLater();
|
||||||
deckList = _deck;
|
deckList = _deck;
|
||||||
deckList->setParent(this);
|
deckList->setParent(this);
|
||||||
connect(deckList, &DeckLoader::deckLoaded, this, &DeckListModel::rebuildTree);
|
|
||||||
connect(deckList, &DeckLoader::deckHashChanged, this, &DeckListModel::deckHashChanged);
|
|
||||||
rebuildTree();
|
rebuildTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
#include <libcockatrice/deck_list/deck_list.h>
|
#include <libcockatrice/deck_list/deck_list.h>
|
||||||
#include <libcockatrice/deck_list/deck_list_card_node.h>
|
#include <libcockatrice/deck_list/deck_list_card_node.h>
|
||||||
|
|
||||||
class DeckLoader;
|
|
||||||
class CardDatabase;
|
class CardDatabase;
|
||||||
class QPrinter;
|
class QPrinter;
|
||||||
class QTextCursor;
|
class QTextCursor;
|
||||||
|
|
@ -124,7 +123,8 @@ public:
|
||||||
class DeckListModel : public QAbstractItemModel
|
class DeckListModel : public QAbstractItemModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private slots:
|
|
||||||
|
public slots:
|
||||||
/**
|
/**
|
||||||
* @brief Rebuilds the model tree from the underlying DeckLoader.
|
* @brief Rebuilds the model tree from the underlying DeckLoader.
|
||||||
*
|
*
|
||||||
|
|
@ -132,8 +132,6 @@ private slots:
|
||||||
* state of the deck.
|
* state of the deck.
|
||||||
*/
|
*/
|
||||||
void rebuildTree();
|
void rebuildTree();
|
||||||
|
|
||||||
public slots:
|
|
||||||
/**
|
/**
|
||||||
* @brief Prints the decklist to the provided QPrinter.
|
* @brief Prints the decklist to the provided QPrinter.
|
||||||
* @param printer The printer to render the decklist to.
|
* @param printer The printer to render the decklist to.
|
||||||
|
|
@ -222,11 +220,11 @@ public:
|
||||||
* @brief Removes all cards and resets the model.
|
* @brief Removes all cards and resets the model.
|
||||||
*/
|
*/
|
||||||
void cleanList();
|
void cleanList();
|
||||||
DeckLoader *getDeckList() const
|
DeckList *getDeckList() const
|
||||||
{
|
{
|
||||||
return deckList;
|
return deckList;
|
||||||
}
|
}
|
||||||
void setDeckList(DeckLoader *_deck);
|
void setDeckList(DeckList *_deck);
|
||||||
|
|
||||||
QList<ExactCard> getCards() const;
|
QList<ExactCard> getCards() const;
|
||||||
QList<ExactCard> getCardsForZone(const QString &zoneName) const;
|
QList<ExactCard> getCardsForZone(const QString &zoneName) const;
|
||||||
|
|
@ -239,7 +237,7 @@ public:
|
||||||
void setActiveGroupCriteria(DeckListModelGroupCriteria newCriteria);
|
void setActiveGroupCriteria(DeckListModelGroupCriteria newCriteria);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeckLoader *deckList; /**< Pointer to the deck loader providing the underlying data. */
|
DeckList *deckList; /**< Pointer to the deck loader providing the underlying data. */
|
||||||
InnerDecklistNode *root; /**< Root node of the model tree. */
|
InnerDecklistNode *root; /**< Root node of the model tree. */
|
||||||
DeckListModelGroupCriteria activeGroupCriteria = DeckListModelGroupCriteria::MAIN_TYPE;
|
DeckListModelGroupCriteria activeGroupCriteria = DeckListModelGroupCriteria::MAIN_TYPE;
|
||||||
int lastKnownColumn; /**< Last column used for sorting. */
|
int lastKnownColumn; /**< Last column used for sorting. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue