mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
Clean up inter-library dependencies with interfaces (#6280)
* Have CardDatabase::getPreferredPrintingInfo respect card provider ID overrides (pinned printings)
Took 13 minutes
Took 37 seconds
Took 10 seconds
Took 10 seconds
# Commit time for manual adjustment:
# Took 30 seconds
Took 15 seconds
Took 8 minutes
Took 21 seconds
* Move settings cache and settings card preference provider out of libcockatrice_settings and into cockatrice
Took 52 minutes
Took 9 minutes
Took 1 minute
* Temp cache.
Took 16 minutes
* Dependency Injection for SettingsCache
* Turn SettingsCache into a QSharedPointer.
* Implement interfaces for settings that need it
Took 2 hours 38 minutes
* Adjust oracle.
Took 5 minutes
* Move abstract/noop interfaces to libcockatrice_interfaces so they can be linked against independently.
Took 52 minutes
* Clean up some links.
Took 3 minutes
* Cleanup two includes.
Took 3 minutes
* More fixes.
Took 7 minutes
* More includes that slipped past.
Took 3 minutes
* Stop mocking and start injecting for tests.
Took 15 minutes
* I don't know why remote_client was including main.
Took 4 minutes
* Include.
Took 3 minutes
* Lint.
Took 2 minutes
* Don't use Qt pointers.
Took 1 hour 7 minutes
* Make parser use CardSettingsInterface
Took 13 minutes
* Also adjust constructor lol.
Took 8 minutes
* Lint.
Took 32 minutes
* Revert "Lint."
This reverts commit ecb596c39e.
Took 3 minutes
* Test.
Took 3 minutes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
fb30515f72
commit
a8a3fca8c9
152 changed files with 609 additions and 750 deletions
|
|
@ -1,10 +1,11 @@
|
|||
#include "abstract_card_drag_item.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
|
||||
#include <QCursor>
|
||||
#include <QDebug>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
static const float CARD_WIDTH_HALF = CARD_WIDTH / 2;
|
||||
static const float CARD_HEIGHT_HALF = CARD_HEIGHT / 2;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "abstract_card_item.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
||||
#include "../game_scene.h"
|
||||
|
||||
|
|
@ -10,7 +11,6 @@
|
|||
#include <algorithm>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, Player *_owner, int _id)
|
||||
: ArrowTarget(_owner, parent), id(_id), cardRef(cardRef), tapped(false), facedown(false), tapAngle(0),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "abstract_counter.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../player/player.h"
|
||||
#include "translate_counter_name.h"
|
||||
|
|
@ -14,7 +15,6 @@
|
|||
#include <QString>
|
||||
#include <libcockatrice/protocol/pb/command_inc_counter.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
#include <libcockatrice/utility/expression.h>
|
||||
|
||||
AbstractCounter::AbstractCounter(Player *_player,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#define _USE_MATH_DEFINES
|
||||
#include "arrow_item.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../player/player.h"
|
||||
#include "../player/player_target.h"
|
||||
#include "../zones/card_zone.h"
|
||||
|
|
@ -15,7 +16,6 @@
|
|||
#include <libcockatrice/protocol/pb/command_attach_card.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_create_arrow.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_delete_arrow.pb.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
#include <libcockatrice/utility/color.h>
|
||||
|
||||
ArrowItem::ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &_color)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "card_item.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../game_scene.h"
|
||||
#include "../player/player.h"
|
||||
|
|
@ -10,14 +11,13 @@
|
|||
#include "arrow_item.h"
|
||||
#include "card_drag_item.h"
|
||||
|
||||
#include <../../client/settings/card_counter_settings.h>
|
||||
#include <QApplication>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
#include <libcockatrice/settings/card_counter_settings.h>
|
||||
|
||||
CardItem::CardItem(Player *_owner, QGraphicsItem *parent, const CardRef &cardRef, int _cardid, CardZoneLogic *_zone)
|
||||
: AbstractCardItem(parent, cardRef, _owner, _cardid), zone(_zone), attacking(false), destroyOnZoneChange(false),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "deck_view.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/theme_manager.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
|
@ -10,7 +11,6 @@
|
|||
#include <libcockatrice/card/card_info.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <libcockatrice/deck_list/deck_list_card_node.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
DeckViewCardDragItem::DeckViewCardDragItem(DeckViewCard *_item,
|
||||
const QPointF &_hotSpot,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "deck_view_container.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
||||
#include "../../interface/widgets/dialogs/dlg_load_deck.h"
|
||||
#include "../../interface/widgets/dialogs/dlg_load_deck_from_clipboard.h"
|
||||
|
|
@ -22,7 +23,6 @@
|
|||
#include <libcockatrice/protocol/pb/command_set_sideboard_plan.pb.h>
|
||||
#include <libcockatrice/protocol/pb/response_deck_download.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
#include <libcockatrice/utility/trice_limits.h>
|
||||
|
||||
ToggleButton::ToggleButton(QWidget *parent) : QPushButton(parent), state(false)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "dlg_create_token.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/widgets/cards/card_info_picture_widget.h"
|
||||
#include "../../main.h"
|
||||
|
||||
|
|
@ -20,7 +21,6 @@
|
|||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <libcockatrice/models/database/card_database_model.h>
|
||||
#include <libcockatrice/models/database/token/token_display_model.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
#include <libcockatrice/utility/trice_limits.h>
|
||||
|
||||
DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent)
|
||||
|
|
@ -199,16 +199,7 @@ void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QMo
|
|||
annotationEdit->setText("");
|
||||
}
|
||||
|
||||
const auto &cardProviderId =
|
||||
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardInfo->getName());
|
||||
if (!cardProviderId.isEmpty()) {
|
||||
CardRef ref;
|
||||
ref.name = cardInfo->getName();
|
||||
ref.providerId = cardProviderId;
|
||||
pic->setCard(CardDatabaseManager::query()->getCard(ref));
|
||||
} else {
|
||||
pic->setCard(CardDatabaseManager::query()->getPreferredCard(cardInfo));
|
||||
}
|
||||
pic->setCard(CardDatabaseManager::query()->getPreferredCard(cardInfo));
|
||||
}
|
||||
|
||||
void DlgCreateToken::updateSearchFieldWithoutUpdatingFilter(const QString &newValue) const
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "game_scene.h"
|
||||
|
||||
#include "../client/settings/cache_settings.h"
|
||||
#include "board/card_item.h"
|
||||
#include "phases_toolbar.h"
|
||||
#include "player/player.h"
|
||||
|
|
@ -14,7 +15,6 @@
|
|||
#include <QGraphicsView>
|
||||
#include <QSet>
|
||||
#include <QtMath>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
#include <numeric>
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include "game_view.h"
|
||||
|
||||
#include "../client/settings/cache_settings.h"
|
||||
#include "game_scene.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QResizeEvent>
|
||||
#include <QRubberBand>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, parent), rubberBand(0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
#include "../player/player.h"
|
||||
#include "../zones/card_zone.h"
|
||||
|
||||
#include <../../client/settings/card_counter_settings.h>
|
||||
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
||||
#include <libcockatrice/protocol/pb/context_mulligan.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||
#include <libcockatrice/settings/card_counter_settings.h>
|
||||
#include <utility>
|
||||
|
||||
static const QString TABLE_ZONE_NAME = "table";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "card_menu.h"
|
||||
|
||||
#include "../../../client/settings/card_counter_settings.h"
|
||||
#include "../../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../../board/card_item.h"
|
||||
#include "../../zones/logic/view_zone_logic.h"
|
||||
|
|
@ -11,7 +12,6 @@
|
|||
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/card/relation/card_relation.h>
|
||||
#include <libcockatrice/settings/card_counter_settings.h>
|
||||
|
||||
CardMenu::CardMenu(Player *_player, const CardItem *_card, bool _shortcutsActive)
|
||||
: player(_player), card(_card), shortcutsActive(_shortcutsActive)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "hand_menu.h"
|
||||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../abstract_game.h"
|
||||
#include "../../zones/hand_zone.h"
|
||||
#include "../player.h"
|
||||
|
|
@ -7,8 +9,6 @@
|
|||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
#include <libcockatrice/settings/shortcuts_settings.h>
|
||||
|
||||
HandMenu::HandMenu(Player *_player, PlayerActions *actions, QWidget *parent) : TearOffMenu(parent), player(_player)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "library_menu.h"
|
||||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../interface/widgets/tabs/tab_game.h"
|
||||
#include "../../abstract_game.h"
|
||||
#include "../player.h"
|
||||
|
|
@ -7,8 +9,6 @@
|
|||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
#include <libcockatrice/settings/shortcuts_settings.h>
|
||||
|
||||
LibraryMenu::LibraryMenu(Player *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include "say_menu.h"
|
||||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../player.h"
|
||||
#include "../player_actions.h"
|
||||
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
SayMenu::SayMenu(Player *_player) : player(_player)
|
||||
{
|
||||
connect(&SettingsCache::instance().messages(), &MessageSettings::messageMacrosChanged, this, &SayMenu::initSayMenu);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "hand_zone.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/theme_manager.h"
|
||||
#include "../board/card_drag_item.h"
|
||||
#include "../board/card_item.h"
|
||||
|
|
@ -7,7 +8,6 @@
|
|||
|
||||
#include <QPainter>
|
||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
HandZone::HandZone(HandZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent)
|
||||
: SelectZone(_logic, parent), zoneHeight(_zoneHeight)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
#include "view_zone_logic.h"
|
||||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../board/card_item.h"
|
||||
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
/**
|
||||
* @param _player the player that the cards are revealed to.
|
||||
* @param _origZone the zone the cards were revealed from.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include "select_zone.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../board/card_item.h"
|
||||
#include "../game_scene.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
qreal divideCardSpaceInZone(qreal index, int cardCount, qreal totalHeight, qreal cardHeight, bool reverse)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "stack_zone.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/theme_manager.h"
|
||||
#include "../board/arrow_item.h"
|
||||
#include "../board/card_drag_item.h"
|
||||
|
|
@ -10,7 +11,6 @@
|
|||
#include <QPainter>
|
||||
#include <QSet>
|
||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
StackZone::StackZone(StackZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent)
|
||||
: SelectZone(_logic, parent), zoneHeight(_zoneHeight)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "table_zone.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../interface/theme_manager.h"
|
||||
#include "../board/arrow_item.h"
|
||||
#include "../board/card_drag_item.h"
|
||||
|
|
@ -13,7 +14,6 @@
|
|||
#include <libcockatrice/card/card_info.h>
|
||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
const QColor TableZone::BACKGROUND_COLOR = QColor(100, 100, 100);
|
||||
const QColor TableZone::FADE_MASK = QColor(0, 0, 0, 80);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "view_zone_widget.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../filters/syntax_help.h"
|
||||
#include "../../interface/pixel_map_generator.h"
|
||||
#include "../board/card_item.h"
|
||||
|
|
@ -17,7 +18,6 @@
|
|||
#include <QStyleOption>
|
||||
#include <QStyleOptionTitleBar>
|
||||
#include <libcockatrice/protocol/pb/command_shuffle.pb.h>
|
||||
#include <libcockatrice/settings/cache_settings.h>
|
||||
|
||||
/**
|
||||
* @param _player the player the cards were revealed to.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue