mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-28 03:43:10 -07:00
add an isEmpty method to printing info (#6805)
no reason, I just find it easier to understand
This commit is contained in:
@@ -62,7 +62,7 @@ void CardInfoTextWidget::setCard(const ExactCard &exactCard)
|
|||||||
text += QString("<tr><td>%1</td><td width=\"5\"></td><td>%2</td></tr>")
|
text += QString("<tr><td>%1</td><td width=\"5\"></td><td>%2</td></tr>")
|
||||||
.arg(tr("Name:"), card->getName().toHtmlEscaped());
|
.arg(tr("Name:"), card->getName().toHtmlEscaped());
|
||||||
|
|
||||||
if (exactCard.getPrinting() != PrintingInfo()) {
|
if (!exactCard.getPrinting().isEmpty()) {
|
||||||
QString setShort = exactCard.getPrinting().getSet()->getShortName().toHtmlEscaped();
|
QString setShort = exactCard.getPrinting().getSet()->getShortName().toHtmlEscaped();
|
||||||
QString cardNum = exactCard.getPrinting().getProperty("num").toHtmlEscaped();
|
QString cardNum = exactCard.getPrinting().getProperty("num").toHtmlEscaped();
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ ExactCard CardDatabaseQuerier::getRandomCard() const
|
|||||||
ExactCard CardDatabaseQuerier::getCardFromSameSet(const QString &cardName, const PrintingInfo &otherPrinting) const
|
ExactCard CardDatabaseQuerier::getCardFromSameSet(const QString &cardName, const PrintingInfo &otherPrinting) const
|
||||||
{
|
{
|
||||||
// The source card does not have a printing defined, which means we can't get a card from the same set.
|
// The source card does not have a printing defined, which means we can't get a card from the same set.
|
||||||
if (otherPrinting == PrintingInfo()) {
|
if (otherPrinting.isEmpty()) {
|
||||||
return getCard({cardName});
|
return getCard({cardName});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,4 +360,4 @@ QMap<QString, int> CardDatabaseQuerier::getAllFormatsWithCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
return formatCounts;
|
return formatCounts;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,16 @@ public:
|
|||||||
return this->set == other.set && this->properties == other.properties;
|
return this->set == other.set && this->properties == other.properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief check if the info is empty, as if default constructed.
|
||||||
|
*
|
||||||
|
* @return True if both set and properties are empty, otherwise false.
|
||||||
|
*/
|
||||||
|
bool isEmpty() const
|
||||||
|
{
|
||||||
|
return set == nullptr && properties.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CardSetPtr set; ///< The set this variation belongs to.
|
CardSetPtr set; ///< The set this variation belongs to.
|
||||||
QVariantHash properties; ///< Key-value store for variation-specific attributes.
|
QVariantHash properties; ///< Key-value store for variation-specific attributes.
|
||||||
|
|||||||
Reference in New Issue
Block a user