mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
Merge branch 'master' into ci/delete-merged-caches
This commit is contained in:
commit
0eea029484
5 changed files with 30 additions and 26 deletions
1
.github/workflows/desktop-build.yml
vendored
1
.github/workflows/desktop-build.yml
vendored
|
|
@ -142,7 +142,6 @@ jobs:
|
||||||
- distro: Ubuntu
|
- distro: Ubuntu
|
||||||
version: 22.04
|
version: 22.04
|
||||||
package: DEB
|
package: DEB
|
||||||
test: skip # Running tests on all distros is superfluous
|
|
||||||
|
|
||||||
- distro: Ubuntu
|
- distro: Ubuntu
|
||||||
version: 24.04
|
version: 24.04
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ CardInfoDisplayWidget::CardInfoDisplayWidget(const CardRef &cardRef, QWidget *pa
|
||||||
layout->addWidget(text, 0, Qt::AlignCenter);
|
layout->addWidget(text, 0, Qt::AlignCenter);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
setFrameStyle(QFrame::Panel | QFrame::Raised);
|
setFrameStyle(static_cast<int>(QFrame::Panel) | QFrame::Raised);
|
||||||
|
|
||||||
int pixmapHeight = QGuiApplication::primaryScreen()->geometry().height() / 3;
|
int pixmapHeight = QGuiApplication::primaryScreen()->geometry().height() / 3;
|
||||||
int pixmapWidth = static_cast<int>(pixmapHeight / aspectRatio);
|
int pixmapWidth = static_cast<int>(pixmapHeight / aspectRatio);
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
QTimer::singleShot(100, this, &DeckEditorDeckDockWidget::updateBannerCardComboBox);
|
QTimer::singleShot(100, this, &DeckEditorDeckDockWidget::updateBannerCardComboBox);
|
||||||
});
|
});
|
||||||
connect(deckModel, &DeckListModel::cardAddedAt, this, &DeckEditorDeckDockWidget::recursiveExpand);
|
connect(deckModel, &DeckListModel::cardAddedAt, this, &DeckEditorDeckDockWidget::recursiveExpand);
|
||||||
connect(deckModel, &DeckListModel::deckReplaced, this, &DeckEditorDeckDockWidget::expandAll);
|
connect(deckModel, &DeckListModel::modelReset, this, &DeckEditorDeckDockWidget::expandAll);
|
||||||
|
|
||||||
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
&DeckEditorDeckDockWidget::setBannerCard);
|
&DeckEditorDeckDockWidget::setBannerCard);
|
||||||
|
|
|
||||||
|
|
@ -178,22 +178,6 @@ QVariant DeckListModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckListModel::emitBackgroundUpdates(const QModelIndex &parent)
|
|
||||||
{
|
|
||||||
int rows = rowCount(parent);
|
|
||||||
if (rows == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QModelIndex topLeft = index(0, 0, parent);
|
|
||||||
QModelIndex bottomRight = index(rows - 1, columnCount() - 1, parent);
|
|
||||||
emit dataChanged(topLeft, bottomRight, {Qt::BackgroundRole});
|
|
||||||
|
|
||||||
for (int r = 0; r < rows; ++r) {
|
|
||||||
QModelIndex child = index(r, 0, parent);
|
|
||||||
emitBackgroundUpdates(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant DeckListModel::headerData(const int section, const Qt::Orientation orientation, const int role) const
|
QVariant DeckListModel::headerData(const int section, const Qt::Orientation orientation, const int role) const
|
||||||
{
|
{
|
||||||
if ((role != Qt::DisplayRole) || (orientation != Qt::Horizontal)) {
|
if ((role != Qt::DisplayRole) || (orientation != Qt::Horizontal)) {
|
||||||
|
|
@ -252,6 +236,22 @@ Qt::ItemFlags DeckListModel::flags(const QModelIndex &index) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeckListModel::emitBackgroundUpdates(const QModelIndex &parent)
|
||||||
|
{
|
||||||
|
int rows = rowCount(parent);
|
||||||
|
if (rows == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QModelIndex topLeft = index(0, 0, parent);
|
||||||
|
QModelIndex bottomRight = index(rows - 1, columnCount() - 1, parent);
|
||||||
|
emit dataChanged(topLeft, bottomRight, {Qt::BackgroundRole});
|
||||||
|
|
||||||
|
for (int r = 0; r < rows; ++r) {
|
||||||
|
QModelIndex child = index(r, 0, parent);
|
||||||
|
emitBackgroundUpdates(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DeckListModel::emitRecursiveUpdates(const QModelIndex &index)
|
void DeckListModel::emitRecursiveUpdates(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (!index.isValid()) {
|
if (!index.isValid()) {
|
||||||
|
|
@ -294,7 +294,6 @@ bool DeckListModel::setData(const QModelIndex &index, const QVariant &value, con
|
||||||
deckList->refreshDeckHash();
|
deckList->refreshDeckHash();
|
||||||
emit deckHashChanged();
|
emit deckHashChanged();
|
||||||
|
|
||||||
emit dataChanged(index, index);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -269,12 +269,6 @@ public:
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||||
bool removeRows(int row, int count, const QModelIndex &parent) override;
|
bool removeRows(int row, int count, const QModelIndex &parent) override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursively emits the dataChanged signal for all child nodes.
|
|
||||||
* @param parent The parent node
|
|
||||||
*/
|
|
||||||
void emitBackgroundUpdates(const QModelIndex &parent);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Finds a card by name, zone, and optional identifiers.
|
* @brief Finds a card by name, zone, and optional identifiers.
|
||||||
* @param cardName The card's name.
|
* @param cardName The card's name.
|
||||||
|
|
@ -389,7 +383,19 @@ private:
|
||||||
const QString &providerId = "",
|
const QString &providerId = "",
|
||||||
const QString &cardNumber = "") const;
|
const QString &cardNumber = "") const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Recursively emits the dataChanged signal with role as Qt::BackgroundRole for all indices that are children
|
||||||
|
* of the given node. This is used to update the background color when changing formats.
|
||||||
|
* @param parent The parent node
|
||||||
|
*/
|
||||||
|
void emitBackgroundUpdates(const QModelIndex &parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Recursively emits the dataChanged signal for the given node and all parent nodes.
|
||||||
|
* @param index The parent node
|
||||||
|
*/
|
||||||
void emitRecursiveUpdates(const QModelIndex &index);
|
void emitRecursiveUpdates(const QModelIndex &index);
|
||||||
|
|
||||||
void sortHelper(InnerDecklistNode *node, Qt::SortOrder order);
|
void sortHelper(InnerDecklistNode *node, Qt::SortOrder order);
|
||||||
|
|
||||||
template <typename T> T getNode(const QModelIndex &index) const
|
template <typename T> T getNode(const QModelIndex &index) const
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue