mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-16 07:22:16 -07:00
Address some comments.
This commit is contained in:
parent
6426f3c86c
commit
fcbdefab4c
12 changed files with 111 additions and 94 deletions
|
|
@ -61,20 +61,20 @@ void TabDeckEditorVisual::createCentralFrame()
|
||||||
centralFrame = new QVBoxLayout;
|
centralFrame = new QVBoxLayout;
|
||||||
centralWidget->setLayout(centralFrame);
|
centralWidget->setLayout(centralFrame);
|
||||||
|
|
||||||
tabContainer = new TabDeckEditorVisualTabWidget(centralWidget, this, this->deckDockWidget->deckModel,
|
tabContainer = new TabDeckEditorVisualTabWidget(centralWidget, this, deckDockWidget->deckModel,
|
||||||
this->databaseDisplayDockWidget->databaseModel,
|
databaseDisplayDockWidget->databaseModel,
|
||||||
this->databaseDisplayDockWidget->databaseDisplayModel);
|
databaseDisplayDockWidget->databaseDisplayModel);
|
||||||
connect(tabContainer, &TabDeckEditorVisualTabWidget::cardChanged, this,
|
connect(tabContainer, &TabDeckEditorVisualTabWidget::cardChanged, this,
|
||||||
&TabDeckEditorVisual::changeModelIndexAndCardInfo);
|
&TabDeckEditorVisual::changeModelIndexAndCardInfo);
|
||||||
connect(tabContainer, &TabDeckEditorVisualTabWidget::cardChangedDatabaseDisplay, this,
|
connect(tabContainer, &TabDeckEditorVisualTabWidget::cardChangedDatabaseDisplay, this,
|
||||||
&AbstractTabDeckEditor::updateCard);
|
&AbstractTabDeckEditor::updateCard);
|
||||||
connect(tabContainer, SIGNAL(mainboardCardClicked(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)), this,
|
connect(tabContainer, &TabDeckEditorVisualTabWidget::mainboardCardClicked, this,
|
||||||
SLOT(processMainboardCardClick(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
&TabDeckEditorVisual::processMainboardCardClick);
|
||||||
connect(tabContainer, SIGNAL(sideboardCardClicked(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)), this,
|
connect(tabContainer, &TabDeckEditorVisualTabWidget::sideboardCardClicked, this,
|
||||||
SLOT(processSideboardCardClick(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
&TabDeckEditorVisual::processSideboardCardClick);
|
||||||
|
|
||||||
connect(tabContainer, SIGNAL(cardClickedDatabaseDisplay(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)),
|
connect(tabContainer, &TabDeckEditorVisualTabWidget::cardClickedDatabaseDisplay, this,
|
||||||
this, SLOT(processCardClickDatabaseDisplay(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
&TabDeckEditorVisual::processCardClickDatabaseDisplay);
|
||||||
centralFrame->addWidget(tabContainer);
|
centralFrame->addWidget(tabContainer);
|
||||||
|
|
||||||
setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
|
|
@ -83,7 +83,7 @@ void TabDeckEditorVisual::createCentralFrame()
|
||||||
|
|
||||||
void TabDeckEditorVisual::createMenus()
|
void TabDeckEditorVisual::createMenus()
|
||||||
{
|
{
|
||||||
deckMenu = new DeckEditorMenu(this, this);
|
deckMenu = new DeckEditorMenu(this);
|
||||||
addTabMenu(deckMenu);
|
addTabMenu(deckMenu);
|
||||||
|
|
||||||
viewMenu = new QMenu(this);
|
viewMenu = new QMenu(this);
|
||||||
|
|
@ -371,7 +371,7 @@ void TabDeckEditorVisual::openDeckFromFile(const QString &fileName, DeckOpenLoca
|
||||||
TabDeckEditorVisual::setDeck(l);
|
TabDeckEditorVisual::setDeck(l);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delete l;
|
l->deleteLater();
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not open deck at %1").arg(fileName));
|
QMessageBox::critical(this, tr("Error"), tr("Could not open deck at %1").arg(fileName));
|
||||||
}
|
}
|
||||||
deckMenu->setSaveStatus(true);
|
deckMenu->setSaveStatus(true);
|
||||||
|
|
|
||||||
|
|
@ -21,32 +21,30 @@ TabDeckEditorVisualTabWidget::TabDeckEditorVisualTabWidget(QWidget *parent,
|
||||||
visualDeckView = new VisualDeckEditorWidget(this, deckModel);
|
visualDeckView = new VisualDeckEditorWidget(this, deckModel);
|
||||||
visualDeckView->setObjectName("visualDeckView");
|
visualDeckView->setObjectName("visualDeckView");
|
||||||
visualDeckView->updateDisplay();
|
visualDeckView->updateDisplay();
|
||||||
connect(visualDeckView, SIGNAL(activeCardChanged(CardInfoPtr)), this, SLOT(onCardChanged(CardInfoPtr)));
|
connect(visualDeckView, &VisualDeckEditorWidget::activeCardChanged, this,
|
||||||
connect(visualDeckView, SIGNAL(mainboardCardClicked(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)), this,
|
&TabDeckEditorVisualTabWidget::onCardChanged);
|
||||||
SLOT(onMainboardCardClickedDeckEditor(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
connect(visualDeckView, &VisualDeckEditorWidget::mainboardCardClicked, this,
|
||||||
connect(visualDeckView, SIGNAL(sideboardCardClicked(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)), this,
|
&TabDeckEditorVisualTabWidget::onMainboardCardClickedDeckEditor);
|
||||||
SLOT(onSideboardCardClickedDeckEditor(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
connect(visualDeckView, &VisualDeckEditorWidget::sideboardCardClicked, this,
|
||||||
|
&TabDeckEditorVisualTabWidget::onSideboardCardClickedDeckEditor);
|
||||||
|
|
||||||
visualDatabaseDisplay =
|
visualDatabaseDisplay =
|
||||||
new VisualDatabaseDisplayWidget(this, deckEditor, cardDatabaseModel, cardDatabaseDisplayModel);
|
new VisualDatabaseDisplayWidget(this, deckEditor, cardDatabaseModel, cardDatabaseDisplayModel);
|
||||||
visualDatabaseDisplay->setObjectName("visualDatabaseView");
|
visualDatabaseDisplay->setObjectName("visualDatabaseView");
|
||||||
connect(visualDatabaseDisplay, SIGNAL(cardHoveredDatabaseDisplay(CardInfoPtr)), this,
|
connect(visualDatabaseDisplay, &VisualDatabaseDisplayWidget::cardHoveredDatabaseDisplay, this,
|
||||||
SLOT(onCardChangedDatabaseDisplay(CardInfoPtr)));
|
&TabDeckEditorVisualTabWidget::onCardChangedDatabaseDisplay);
|
||||||
connect(visualDatabaseDisplay,
|
connect(visualDatabaseDisplay, &VisualDatabaseDisplayWidget::cardClickedDatabaseDisplay, this,
|
||||||
SIGNAL(cardClickedDatabaseDisplay(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)), this,
|
&TabDeckEditorVisualTabWidget::onCardClickedDatabaseDisplay);
|
||||||
SLOT(onCardClickedDatabaseDisplay(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
|
||||||
|
|
||||||
deckAnalytics = new DeckAnalyticsWidget(this, deckModel);
|
deckAnalytics = new DeckAnalyticsWidget(this, deckModel);
|
||||||
deckAnalytics->setObjectName("deckAnalytics");
|
deckAnalytics->setObjectName("deckAnalytics");
|
||||||
|
|
||||||
sampleHandWidget = new VisualDeckEditorSampleHandWidget(this, deckModel);
|
sampleHandWidget = new VisualDeckEditorSampleHandWidget(this, deckModel);
|
||||||
|
|
||||||
// printingSelector = new PrintingSelector(this, this->deckModel);
|
this->addNewTab(visualDeckView, tr("Visual Deck View"));
|
||||||
|
this->addNewTab(visualDatabaseDisplay, tr("Visual Database Display"));
|
||||||
this->addNewTab(visualDeckView, "Visual Deck View");
|
this->addNewTab(deckAnalytics, tr("Deck Analytics"));
|
||||||
this->addNewTab(visualDatabaseDisplay, "Visual Database Display");
|
this->addNewTab(sampleHandWidget, tr("Sample Hand"));
|
||||||
this->addNewTab(deckAnalytics, "Deck Analytics");
|
|
||||||
this->addNewTab(sampleHandWidget, "Sample Hand");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditorVisualTabWidget::onCardChanged(CardInfoPtr activeCard)
|
void TabDeckEditorVisualTabWidget::onCardChanged(CardInfoPtr activeCard)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
//
|
|
||||||
// Created by ascor on 11/12/24.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef OVERLAPPED_CARD_GROUP_DISPLAY_WIDGET_H
|
#ifndef OVERLAPPED_CARD_GROUP_DISPLAY_WIDGET_H
|
||||||
#define OVERLAPPED_CARD_GROUP_DISPLAY_WIDGET_H
|
#define OVERLAPPED_CARD_GROUP_DISPLAY_WIDGET_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,21 @@ ManaBaseWidget::ManaBaseWidget(QWidget *parent, DeckListModel *_deckListModel)
|
||||||
layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
bannerWidget = new BannerWidget(this, "Mana Base", Qt::Vertical, 100);
|
bannerWidget = new BannerWidget(this, tr("Mana Base"), Qt::Vertical, 100);
|
||||||
bannerWidget->setMaximumHeight(100);
|
bannerWidget->setMaximumHeight(100);
|
||||||
layout->addWidget(bannerWidget);
|
layout->addWidget(bannerWidget);
|
||||||
|
|
||||||
barLayout = new QHBoxLayout();
|
barLayout = new QHBoxLayout(this);
|
||||||
layout->addLayout(barLayout);
|
layout->addLayout(barLayout);
|
||||||
|
|
||||||
connect(deckListModel, &DeckListModel::dataChanged, this, &ManaBaseWidget::analyzeManaBase);
|
connect(deckListModel, &DeckListModel::dataChanged, this, &ManaBaseWidget::analyzeManaBase);
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManaBaseWidget::retranslateUi()
|
||||||
|
{
|
||||||
|
bannerWidget->setText(tr("Mana Base"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManaBaseWidget::setDeckModel(DeckListModel *deckModel)
|
void ManaBaseWidget::setDeckModel(DeckListModel *deckModel)
|
||||||
|
|
@ -35,7 +42,35 @@ void ManaBaseWidget::setDeckModel(DeckListModel *deckModel)
|
||||||
analyzeManaBase();
|
analyzeManaBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_map<char, int> ManaBaseWidget::analyzeManaBase()
|
void ManaBaseWidget::updateDisplay()
|
||||||
|
{
|
||||||
|
// Clear the layout first
|
||||||
|
QLayoutItem *item;
|
||||||
|
while ((item = barLayout->takeAt(0)) != nullptr) {
|
||||||
|
item->widget()->deleteLater();
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalSum = 0;
|
||||||
|
for (auto entry : manaBaseMap) {
|
||||||
|
totalSum += entry.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define color mapping for mana types
|
||||||
|
std::unordered_map<QString, QColor> manaColors = {{"W", QColor(248, 231, 185)}, {"U", QColor(14, 104, 171)},
|
||||||
|
{"B", QColor(21, 11, 0)}, {"R", QColor(211, 32, 42)},
|
||||||
|
{"G", QColor(0, 115, 62)}, {"C", QColor(150, 150, 150)}};
|
||||||
|
|
||||||
|
for (auto entry : manaBaseMap) {
|
||||||
|
QColor barColor = manaColors.count(entry.first) ? manaColors[entry.first] : Qt::gray;
|
||||||
|
BarWidget *barWidget = new BarWidget(QString(entry.first), entry.second, totalSum, barColor, this);
|
||||||
|
barLayout->addWidget(barWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unordered_map<QString, int> ManaBaseWidget::analyzeManaBase()
|
||||||
{
|
{
|
||||||
manaBaseMap.clear();
|
manaBaseMap.clear();
|
||||||
InnerDecklistNode *listRoot = deckListModel->getDeckList()->getRoot();
|
InnerDecklistNode *listRoot = deckListModel->getDeckList()->getRoot();
|
||||||
|
|
@ -60,38 +95,10 @@ std::unordered_map<char, int> ManaBaseWidget::analyzeManaBase()
|
||||||
return manaBaseMap;
|
return manaBaseMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManaBaseWidget::updateDisplay()
|
std::unordered_map<QString, int> ManaBaseWidget::determineManaProduction(const QString &rulesText)
|
||||||
{
|
|
||||||
// Clear the layout first
|
|
||||||
QLayoutItem *item;
|
|
||||||
while ((item = barLayout->takeAt(0)) != nullptr) {
|
|
||||||
delete item->widget();
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
|
|
||||||
int totalSum = 0;
|
|
||||||
for (auto entry : manaBaseMap) {
|
|
||||||
totalSum += entry.second;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define color mapping for mana types
|
|
||||||
std::unordered_map<char, QColor> manaColors = {{'W', QColor(248, 231, 185)}, {'U', QColor(14, 104, 171)},
|
|
||||||
{'B', QColor(21, 11, 0)}, {'R', QColor(211, 32, 42)},
|
|
||||||
{'G', QColor(0, 115, 62)}, {'C', QColor(150, 150, 150)}};
|
|
||||||
|
|
||||||
for (auto entry : manaBaseMap) {
|
|
||||||
QColor barColor = manaColors.count(entry.first) ? manaColors[entry.first] : Qt::gray;
|
|
||||||
BarWidget *barWidget = new BarWidget(QString(entry.first), entry.second, totalSum, barColor, this);
|
|
||||||
barLayout->addWidget(barWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unordered_map<char, int> ManaBaseWidget::determineManaProduction(const QString &rulesText)
|
|
||||||
{
|
{
|
||||||
// Initialize mana counts
|
// Initialize mana counts
|
||||||
std::unordered_map<char, int> manaCounts = {{'W', 0}, {'U', 0}, {'B', 0}, {'R', 0}, {'G', 0}, {'C', 0}};
|
std::unordered_map<QString, int> manaCounts = {{"W", 0}, {"U", 0}, {"B", 0}, {"R", 0}, {"G", 0}, {"C", 0}};
|
||||||
|
|
||||||
// Define regex patterns for different mana production rules
|
// Define regex patterns for different mana production rules
|
||||||
QRegularExpression tapAddColorless(R"(\{T\}:\s*Add\s*\{C\}|Add\s*one\s*colorless\s*mana)");
|
QRegularExpression tapAddColorless(R"(\{T\}:\s*Add\s*\{C\}|Add\s*one\s*colorless\s*mana)");
|
||||||
|
|
@ -102,15 +109,15 @@ std::unordered_map<char, int> ManaBaseWidget::determineManaProduction(const QStr
|
||||||
|
|
||||||
// Check for mana production rules in the text
|
// Check for mana production rules in the text
|
||||||
if (tapAddColorless.match(rulesText).hasMatch()) {
|
if (tapAddColorless.match(rulesText).hasMatch()) {
|
||||||
manaCounts['C'] += 1; // Adds colorless mana
|
manaCounts["C"] += 1; // Adds colorless mana
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tapAddAnyColor.match(rulesText).hasMatch()) {
|
if (tapAddAnyColor.match(rulesText).hasMatch()) {
|
||||||
manaCounts['W'] += 1; // Assumes at least 1 of any color can be produced
|
manaCounts["W"] += 1; // Assumes at least 1 of any color can be produced
|
||||||
manaCounts['U'] += 1;
|
manaCounts["U"] += 1;
|
||||||
manaCounts['B'] += 1;
|
manaCounts["B"] += 1;
|
||||||
manaCounts['R'] += 1;
|
manaCounts["R"] += 1;
|
||||||
manaCounts['G'] += 1;
|
manaCounts["G"] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for specific color production
|
// Check for specific color production
|
||||||
|
|
@ -118,25 +125,17 @@ std::unordered_map<char, int> ManaBaseWidget::determineManaProduction(const QStr
|
||||||
auto match = specificColorRegex.match(rulesText);
|
auto match = specificColorRegex.match(rulesText);
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
QString color = match.captured(1);
|
QString color = match.captured(1);
|
||||||
if (color == "W")
|
manaCounts[color] += 1;
|
||||||
manaCounts['W'] += 1;
|
|
||||||
else if (color == "U")
|
|
||||||
manaCounts['U'] += 1;
|
|
||||||
else if (color == "B")
|
|
||||||
manaCounts['B'] += 1;
|
|
||||||
else if (color == "R")
|
|
||||||
manaCounts['R'] += 1;
|
|
||||||
else if (color == "G")
|
|
||||||
manaCounts['G'] += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return manaCounts;
|
return manaCounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManaBaseWidget::mergeManaCounts(std::unordered_map<char, int> &manaCounts1,
|
void ManaBaseWidget::mergeManaCounts(std::unordered_map<QString, int> &manaCounts1,
|
||||||
const std::unordered_map<char, int> &manaCounts2)
|
const std::unordered_map<QString, int> &manaCounts2)
|
||||||
{
|
{
|
||||||
for (const auto &pair : manaCounts2) {
|
for (const auto &pair : manaCounts2) {
|
||||||
manaCounts1[pair.first] += pair.second; // Add values for matching keys
|
manaCounts1[pair.first] += pair.second; // Add values for matching keys
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,19 +15,21 @@ class ManaBaseWidget : public QWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ManaBaseWidget(QWidget *parent, DeckListModel *deckListModel);
|
explicit ManaBaseWidget(QWidget *parent, DeckListModel *deckListModel);
|
||||||
std::unordered_map<char, int> analyzeManaBase();
|
std::unordered_map<QString, int> analyzeManaBase();
|
||||||
void updateDisplay();
|
void updateDisplay();
|
||||||
|
|
||||||
std::unordered_map<char, int> determineManaProduction(const QString &manaString);
|
std::unordered_map<QString, int> determineManaProduction(const QString &manaString);
|
||||||
void mergeManaCounts(std::unordered_map<char, int> &manaCounts1, const std::unordered_map<char, int> &manaCounts2);
|
void mergeManaCounts(std::unordered_map<QString, int> &manaCounts1,
|
||||||
|
const std::unordered_map<QString, int> &manaCounts2);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setDeckModel(DeckListModel *deckModel);
|
void setDeckModel(DeckListModel *deckModel);
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeckListModel *deckListModel;
|
DeckListModel *deckListModel;
|
||||||
BannerWidget *bannerWidget;
|
BannerWidget *bannerWidget;
|
||||||
std::unordered_map<char, int> manaBaseMap;
|
std::unordered_map<QString, int> manaBaseMap;
|
||||||
QVBoxLayout *layout;
|
QVBoxLayout *layout;
|
||||||
QHBoxLayout *barLayout;
|
QHBoxLayout *barLayout;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ ManaCurveWidget::ManaCurveWidget(QWidget *parent, DeckListModel *_deckListModel)
|
||||||
layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
bannerWidget = new BannerWidget(this, "Mana Curve", Qt::Vertical, 100);
|
bannerWidget = new BannerWidget(this, tr("Mana Curve"), Qt::Vertical, 100);
|
||||||
bannerWidget->setMaximumHeight(100);
|
bannerWidget->setMaximumHeight(100);
|
||||||
layout->addWidget(bannerWidget);
|
layout->addWidget(bannerWidget);
|
||||||
|
|
||||||
|
|
@ -24,6 +24,13 @@ ManaCurveWidget::ManaCurveWidget(QWidget *parent, DeckListModel *_deckListModel)
|
||||||
layout->addLayout(barLayout);
|
layout->addLayout(barLayout);
|
||||||
|
|
||||||
connect(deckListModel, &DeckListModel::dataChanged, this, &ManaCurveWidget::analyzeManaCurve);
|
connect(deckListModel, &DeckListModel::dataChanged, this, &ManaCurveWidget::analyzeManaCurve);
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManaCurveWidget::retranslateUi()
|
||||||
|
{
|
||||||
|
bannerWidget->setText(tr("Mana Curve"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManaCurveWidget::setDeckModel(DeckListModel *deckModel)
|
void ManaCurveWidget::setDeckModel(DeckListModel *deckModel)
|
||||||
|
|
@ -65,7 +72,7 @@ void ManaCurveWidget::updateDisplay()
|
||||||
if (barLayout != nullptr) {
|
if (barLayout != nullptr) {
|
||||||
QLayoutItem *item;
|
QLayoutItem *item;
|
||||||
while ((item = barLayout->takeAt(0)) != nullptr) {
|
while ((item = barLayout->takeAt(0)) != nullptr) {
|
||||||
delete item->widget();
|
item->widget()->deleteLater();
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void setDeckModel(DeckListModel *deckModel);
|
void setDeckModel(DeckListModel *deckModel);
|
||||||
std::unordered_map<int, int> analyzeManaCurve();
|
std::unordered_map<int, int> analyzeManaCurve();
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeckListModel *deckListModel;
|
DeckListModel *deckListModel;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ ManaDevotionWidget::ManaDevotionWidget(QWidget *parent, DeckListModel *_deckList
|
||||||
layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
bannerWidget = new BannerWidget(this, "Mana Devotion", Qt::Vertical, 100);
|
bannerWidget = new BannerWidget(this, tr("Mana Devotion"), Qt::Vertical, 100);
|
||||||
bannerWidget->setMaximumHeight(100);
|
bannerWidget->setMaximumHeight(100);
|
||||||
layout->addWidget(bannerWidget);
|
layout->addWidget(bannerWidget);
|
||||||
|
|
||||||
|
|
@ -27,6 +27,13 @@ ManaDevotionWidget::ManaDevotionWidget(QWidget *parent, DeckListModel *_deckList
|
||||||
layout->addLayout(barLayout);
|
layout->addLayout(barLayout);
|
||||||
|
|
||||||
connect(deckListModel, &DeckListModel::dataChanged, this, &ManaDevotionWidget::analyzeManaDevotion);
|
connect(deckListModel, &DeckListModel::dataChanged, this, &ManaDevotionWidget::analyzeManaDevotion);
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManaDevotionWidget::retranslateUi()
|
||||||
|
{
|
||||||
|
bannerWidget->setText(tr("Mana Devotion"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManaDevotionWidget::setDeckModel(DeckListModel *deckModel)
|
void ManaDevotionWidget::setDeckModel(DeckListModel *deckModel)
|
||||||
|
|
@ -66,7 +73,7 @@ void ManaDevotionWidget::updateDisplay()
|
||||||
// Clear the layout first
|
// Clear the layout first
|
||||||
QLayoutItem *item;
|
QLayoutItem *item;
|
||||||
while ((item = barLayout->takeAt(0)) != nullptr) {
|
while ((item = barLayout->takeAt(0)) != nullptr) {
|
||||||
delete item->widget();
|
item->widget()->deleteLater();
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void setDeckModel(DeckListModel *deckModel);
|
void setDeckModel(DeckListModel *deckModel);
|
||||||
std::unordered_map<char, int> analyzeManaDevotion();
|
std::unordered_map<char, int> analyzeManaDevotion();
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeckListModel *deckListModel;
|
DeckListModel *deckListModel;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *pare
|
||||||
layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
resetButton = new QPushButton("Reset");
|
resetButton = new QPushButton(this);
|
||||||
connect(resetButton, SIGNAL(clicked()), this, SLOT(updateDisplay()));
|
connect(resetButton, SIGNAL(clicked()), this, SLOT(updateDisplay()));
|
||||||
layout->addWidget(resetButton);
|
layout->addWidget(resetButton);
|
||||||
|
|
||||||
|
|
@ -26,6 +26,11 @@ VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *pare
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VisualDeckEditorSampleHandWidget::retranslateUi()
|
||||||
|
{
|
||||||
|
resetButton->setText(tr("Reset"));
|
||||||
|
}
|
||||||
|
|
||||||
void VisualDeckEditorSampleHandWidget::setDeckModel(DeckListModel *deckModel)
|
void VisualDeckEditorSampleHandWidget::setDeckModel(DeckListModel *deckModel)
|
||||||
{
|
{
|
||||||
deckListModel = deckModel;
|
deckListModel = deckModel;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void updateDisplay();
|
void updateDisplay();
|
||||||
void setDeckModel(DeckListModel *deckModel);
|
void setDeckModel(DeckListModel *deckModel);
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeckListModel *deckListModel;
|
DeckListModel *deckListModel;
|
||||||
|
|
|
||||||
|
|
@ -93,13 +93,13 @@ void VisualDeckEditorWidget::updateDisplay()
|
||||||
zoneContainerLayout = new QVBoxLayout(zoneContainer);
|
zoneContainerLayout = new QVBoxLayout(zoneContainer);
|
||||||
|
|
||||||
DeckCardZoneDisplayWidget *mainBoardWidget =
|
DeckCardZoneDisplayWidget *mainBoardWidget =
|
||||||
new DeckCardZoneDisplayWidget(zoneContainer, sortCards(mainDeckCards), "Mainboard", 20, 10);
|
new DeckCardZoneDisplayWidget(zoneContainer, sortCards(mainDeckCards), tr("Mainboard"), 20, 10);
|
||||||
connect(mainBoardWidget, SIGNAL(cardHovered(CardInfoPtr)), this, SLOT(onHover(CardInfoPtr)));
|
connect(mainBoardWidget, SIGNAL(cardHovered(CardInfoPtr)), this, SLOT(onHover(CardInfoPtr)));
|
||||||
connect(mainBoardWidget, SIGNAL(cardClicked(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)), this,
|
connect(mainBoardWidget, SIGNAL(cardClicked(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)), this,
|
||||||
SLOT(onMainboardClick(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
SLOT(onMainboardClick(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
||||||
|
|
||||||
DeckCardZoneDisplayWidget *sideBoardWidget =
|
DeckCardZoneDisplayWidget *sideBoardWidget =
|
||||||
new DeckCardZoneDisplayWidget(zoneContainer, sortCards(sideboardCards), "Sideboard", 40, 30);
|
new DeckCardZoneDisplayWidget(zoneContainer, sortCards(sideboardCards), tr("Sideboard"), 40, 30);
|
||||||
connect(sideBoardWidget, SIGNAL(cardHovered(CardInfoPtr)), this, SLOT(onHover(CardInfoPtr)));
|
connect(sideBoardWidget, SIGNAL(cardHovered(CardInfoPtr)), this, SLOT(onHover(CardInfoPtr)));
|
||||||
connect(sideBoardWidget, SIGNAL(cardClicked(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)), this,
|
connect(sideBoardWidget, SIGNAL(cardClicked(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)), this,
|
||||||
SLOT(onSideboardClick(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
SLOT(onSideboardClick(QMouseEvent *, CardInfoPictureWithTextOverlayWidget *)));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue