mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
* 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>
71 lines
2.2 KiB
C++
71 lines
2.2 KiB
C++
#include "game_view.h"
|
|
|
|
#include "../client/settings/cache_settings.h"
|
|
#include "game_scene.h"
|
|
|
|
#include <QAction>
|
|
#include <QResizeEvent>
|
|
#include <QRubberBand>
|
|
|
|
GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, parent), rubberBand(0)
|
|
{
|
|
setBackgroundBrush(QBrush(QColor(0, 0, 0)));
|
|
setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing);
|
|
setFocusPolicy(Qt::ClickFocus);
|
|
setViewportUpdateMode(BoundingRectViewportUpdate);
|
|
|
|
connect(scene, &GameScene::sceneRectChanged, this, &GameView::updateSceneRect);
|
|
|
|
connect(scene, &GameScene::sigStartRubberBand, this, &GameView::startRubberBand);
|
|
connect(scene, &GameScene::sigResizeRubberBand, this, &GameView::resizeRubberBand);
|
|
connect(scene, &GameScene::sigStopRubberBand, this, &GameView::stopRubberBand);
|
|
|
|
aCloseMostRecentZoneView = new QAction(this);
|
|
|
|
connect(aCloseMostRecentZoneView, &QAction::triggered, scene, &GameScene::closeMostRecentZoneView);
|
|
addAction(aCloseMostRecentZoneView);
|
|
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
|
&GameView::refreshShortcuts);
|
|
refreshShortcuts();
|
|
rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
|
|
}
|
|
|
|
void GameView::resizeEvent(QResizeEvent *event)
|
|
{
|
|
QGraphicsView::resizeEvent(event);
|
|
|
|
GameScene *s = dynamic_cast<GameScene *>(scene());
|
|
if (s)
|
|
s->processViewSizeChange(event->size());
|
|
|
|
updateSceneRect(scene()->sceneRect());
|
|
}
|
|
|
|
void GameView::updateSceneRect(const QRectF &rect)
|
|
{
|
|
fitInView(rect, Qt::KeepAspectRatio);
|
|
}
|
|
|
|
void GameView::startRubberBand(const QPointF &_selectionOrigin)
|
|
{
|
|
selectionOrigin = _selectionOrigin;
|
|
rubberBand->setGeometry(QRect(mapFromScene(selectionOrigin), QSize(0, 0)));
|
|
rubberBand->show();
|
|
}
|
|
|
|
void GameView::resizeRubberBand(const QPointF &cursorPoint)
|
|
{
|
|
if (rubberBand)
|
|
rubberBand->setGeometry(QRect(mapFromScene(selectionOrigin), cursorPoint.toPoint()).normalized());
|
|
}
|
|
|
|
void GameView::stopRubberBand()
|
|
{
|
|
rubberBand->hide();
|
|
}
|
|
|
|
void GameView::refreshShortcuts()
|
|
{
|
|
aCloseMostRecentZoneView->setShortcuts(
|
|
SettingsCache::instance().shortcuts().getShortcut("Player/aCloseMostRecentZoneView"));
|
|
}
|