From b5fbebc883826b7830fd2727c29adc7d42661f6b Mon Sep 17 00:00:00 2001 From: Gavin Bises Date: Wed, 28 Jan 2015 11:57:17 -0500 Subject: [PATCH 1/9] Add country code to user info box. People might not know all the flags --- cockatrice/src/userinfobox.cpp | 5 ++++- cockatrice/src/userinfobox.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/userinfobox.cpp b/cockatrice/src/userinfobox.cpp index a733f5bcf..4472ada6d 100644 --- a/cockatrice/src/userinfobox.cpp +++ b/cockatrice/src/userinfobox.cpp @@ -31,6 +31,7 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _fullInfo, QWidget *paren mainLayout->addWidget(&genderLabel2, 3, 1, 1, 2); mainLayout->addWidget(&countryLabel1, 4, 0, 1, 1); mainLayout->addWidget(&countryLabel2, 4, 1, 1, 2); + mainLayout->addWidget(&countryLabel3, 4, 2, 1, 1); mainLayout->addWidget(&userLevelLabel1, 5, 0, 1, 1); mainLayout->addWidget(&userLevelLabel2, 5, 1, 1, 1); mainLayout->addWidget(&userLevelLabel3, 5, 2, 1, 1); @@ -65,7 +66,9 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user) nameLabel.setText(QString::fromStdString(user.name())); realNameLabel2.setText(QString::fromStdString(user.real_name())); genderLabel2.setPixmap(GenderPixmapGenerator::generatePixmap(15, user.gender())); - countryLabel2.setPixmap(CountryPixmapGenerator::generatePixmap(15, QString::fromStdString(user.country()))); + QString country = QString::fromStdString(user.country()); + countryLabel2.setPixmap(CountryPixmapGenerator::generatePixmap(15, country)); + countryLabel3.setText(QString("(%1)").arg(country)); userLevelLabel2.setPixmap(UserLevelPixmapGenerator::generatePixmap(15, userLevel)); QString userLevelText; if (userLevel.testFlag(ServerInfo_User::IsAdmin)) diff --git a/cockatrice/src/userinfobox.h b/cockatrice/src/userinfobox.h index b64e29afd..e144cd4c9 100644 --- a/cockatrice/src/userinfobox.h +++ b/cockatrice/src/userinfobox.h @@ -14,8 +14,8 @@ class UserInfoBox : public QWidget { private: AbstractClient *client; bool fullInfo; - QLabel avatarLabel, nameLabel, realNameLabel1, realNameLabel2, genderLabel1, genderLabel2, countryLabel1, - countryLabel2, userLevelLabel1, userLevelLabel2, userLevelLabel3, accountAgeLebel1, accountAgeLabel2; + QLabel avatarLabel, nameLabel, realNameLabel1, realNameLabel2, genderLabel1, genderLabel2, countryLabel1, + countryLabel2, countryLabel3, userLevelLabel1, userLevelLabel2, userLevelLabel3, accountAgeLebel1, accountAgeLabel2; public: UserInfoBox(AbstractClient *_client, bool fullInfo, QWidget *parent = 0, Qt::WindowFlags flags = 0); void retranslateUi(); From 1af6486d74958222e9a24182d2faff78fad708da Mon Sep 17 00:00:00 2001 From: Gavin Bises Date: Wed, 28 Jan 2015 19:03:08 -0500 Subject: [PATCH 2/9] Capitalize country code in user info box --- cockatrice/src/userinfobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/userinfobox.cpp b/cockatrice/src/userinfobox.cpp index 4472ada6d..aa245b3f1 100644 --- a/cockatrice/src/userinfobox.cpp +++ b/cockatrice/src/userinfobox.cpp @@ -66,7 +66,7 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user) nameLabel.setText(QString::fromStdString(user.name())); realNameLabel2.setText(QString::fromStdString(user.real_name())); genderLabel2.setPixmap(GenderPixmapGenerator::generatePixmap(15, user.gender())); - QString country = QString::fromStdString(user.country()); + QString country = QString::fromStdString(user.country()).toUpper(); countryLabel2.setPixmap(CountryPixmapGenerator::generatePixmap(15, country)); countryLabel3.setText(QString("(%1)").arg(country)); userLevelLabel2.setPixmap(UserLevelPixmapGenerator::generatePixmap(15, userLevel)); From 7893ab086f4d050d899bac35b7cabc51d809b9e0 Mon Sep 17 00:00:00 2001 From: Gavin Bises Date: Thu, 29 Jan 2015 13:32:17 -0500 Subject: [PATCH 3/9] Fix broken cmc parsing from cards.xml I don't know why this even compiled --- cockatrice/src/carddatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index f798b1e1e..31344a8fc 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -751,7 +751,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens) else if (xml.name() == "manacost") manacost = xml.readElementText(); else if (xml.name() == "cmc") - cmc = xml.readElementText().toInt(); + cmc = xml.readElementText(); else if (xml.name() == "type") type = xml.readElementText(); else if (xml.name() == "pt") From 6fa34c6c040681100b6e6715acad0310502bcca4 Mon Sep 17 00:00:00 2001 From: Gavin Bises Date: Thu, 29 Jan 2015 13:33:06 -0500 Subject: [PATCH 4/9] Add cmc to card db filter model --- cockatrice/src/cardfilter.cpp | 2 ++ cockatrice/src/cardfilter.h | 1 + cockatrice/src/filtertree.cpp | 31 ++++++++++++++----------------- cockatrice/src/filtertree.h | 1 + 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/cockatrice/src/cardfilter.cpp b/cockatrice/src/cardfilter.cpp index fb59adcf5..06a41ca9e 100644 --- a/cockatrice/src/cardfilter.cpp +++ b/cockatrice/src/cardfilter.cpp @@ -31,6 +31,8 @@ const char *CardFilter::attrName(Attr a) return "set"; case AttrManaCost: return "mana cost"; + case AttrCmc: + return "cmc"; default: return ""; } diff --git a/cockatrice/src/cardfilter.h b/cockatrice/src/cardfilter.h index e5f881233..4b7debb20 100644 --- a/cockatrice/src/cardfilter.h +++ b/cockatrice/src/cardfilter.h @@ -22,6 +22,7 @@ public: AttrText, AttrSet, AttrManaCost, + AttrCmc, AttrEnd }; diff --git a/cockatrice/src/filtertree.cpp b/cockatrice/src/filtertree.cpp index 5fc516f39..c33e94bec 100644 --- a/cockatrice/src/filtertree.cpp +++ b/cockatrice/src/filtertree.cpp @@ -199,34 +199,31 @@ bool FilterItem::acceptManaCost(const CardInfo *info) const return (info->getManaCost() == term); } +bool FilterItem::acceptCmc(const CardInfo *info) const +{ + return (info->getCmc() == term); +} + bool FilterItem::acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const { - bool status; - switch (attr) { case CardFilter::AttrName: - status = acceptName(info); - break; + return acceptName(info); case CardFilter::AttrType: - status = acceptType(info); - break; + return acceptType(info); case CardFilter::AttrColor: - status = acceptColor(info); - break; + return acceptColor(info); case CardFilter::AttrText: - status = acceptText(info); - break; + return acceptText(info); case CardFilter::AttrSet: - status = acceptSet(info); - break; + return acceptSet(info); case CardFilter::AttrManaCost: - status = acceptManaCost(info); - break; + return acceptManaCost(info); + case CardFilter::AttrCmc: + return acceptCmc(info); default: - status = true; /* ignore this attribute */ + return true; /* ignore this attribute */ } - - return status; } /* need to define these here to make QT happy, otherwise diff --git a/cockatrice/src/filtertree.h b/cockatrice/src/filtertree.h index 68f8fafb1..6ee58a7ee 100644 --- a/cockatrice/src/filtertree.h +++ b/cockatrice/src/filtertree.h @@ -117,6 +117,7 @@ public: bool acceptText(const CardInfo *info) const; bool acceptSet(const CardInfo *info) const; bool acceptManaCost(const CardInfo *info) const; + bool acceptCmc(const CardInfo *info) const; bool acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const; }; From de336384cd384e302331f49a9fa18f88777846ac Mon Sep 17 00:00:00 2001 From: tooomm Date: Thu, 29 Jan 2015 22:34:53 +0100 Subject: [PATCH 5/9] add oracle name at the end of installer --- cmake/NSIS.template.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index 2e1910f5c..8548d3dae 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -16,7 +16,7 @@ InstallDir "$PROGRAMFILES\Cockatrice" !define MUI_HEADERIMAGE_UNBITMAP "${NSIS_SOURCE_PATH}\cmake\headerimage.bmp" !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Cockatrice.$\r$\n$\r$\nClick Next to continue." !define MUI_FINISHPAGE_RUN "$INSTDIR/oracle.exe" -!define MUI_FINISHPAGE_RUN_TEXT "Run card database downloader now" +!define MUI_FINISHPAGE_RUN_TEXT "Run "Oracle" now to update your card database" !define MUI_FINISHPAGE_RUN_PARAMETERS "-dlsets" !insertmacro MUI_PAGE_WELCOME From acb9bc20c4e45cc89af60de45616ae6e8343324f Mon Sep 17 00:00:00 2001 From: Gavin Bises Date: Thu, 29 Jan 2015 17:09:14 -0500 Subject: [PATCH 6/9] Fix #640 - don't add muid-0 cards to splitCards map --- oracle/src/oracleimporter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/oracle/src/oracleimporter.cpp b/oracle/src/oracleimporter.cpp index ba47b61cd..f792829b4 100644 --- a/oracle/src/oracleimporter.cpp +++ b/oracle/src/oracleimporter.cpp @@ -187,6 +187,7 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data) // add first card's data cardName = card1->contains("name") ? card1->value("name").toString() : QString(""); cardCost = card1->contains("manaCost") ? card1->value("manaCost").toString() : QString(""); + cmc = card1->contains("cmc") ? card1->value("cmc").toString() : QString(""); cardType = card1->contains("type") ? card1->value("type").toString() : QString(""); cardPT = card1->contains("power") || card1->contains("toughness") ? card1->value("power").toString() + QString('/') + card1->value("toughness").toString() : QString(""); cardText = card1->contains("text") ? card1->value("text").toString() : QString(""); @@ -199,8 +200,10 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data) cardPT += card2->contains("power") || card2->contains("toughness") ? QString(" // ") + card2->value("power").toString() + QString('/') + card2->value("toughness").toString() : QString(""); cardText += card2->contains("text") ? QString("\n\n---\n\n") + card2->value("text").toString() : QString(""); } else { - // first card od a pair; enqueue for later merging - splitCards.insert(cardId, map); + // first card of a pair; enqueue for later merging + // Conditional on cardId because promo prints have no muid - see #640 + if (cardId) + splitCards.insert(cardId, map); continue; } } else { From 6f50266931da1ac0485383871482b6f137b12c9e Mon Sep 17 00:00:00 2001 From: Gavin Bises Date: Thu, 29 Jan 2015 20:01:48 -0500 Subject: [PATCH 7/9] Uppercase country code for text display, not flag filename generation --- cockatrice/src/userinfobox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/userinfobox.cpp b/cockatrice/src/userinfobox.cpp index aa245b3f1..6c33bbf72 100644 --- a/cockatrice/src/userinfobox.cpp +++ b/cockatrice/src/userinfobox.cpp @@ -66,9 +66,9 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user) nameLabel.setText(QString::fromStdString(user.name())); realNameLabel2.setText(QString::fromStdString(user.real_name())); genderLabel2.setPixmap(GenderPixmapGenerator::generatePixmap(15, user.gender())); - QString country = QString::fromStdString(user.country()).toUpper(); + QString country = QString::fromStdString(user.country()); countryLabel2.setPixmap(CountryPixmapGenerator::generatePixmap(15, country)); - countryLabel3.setText(QString("(%1)").arg(country)); + countryLabel3.setText(QString("(%1)").arg(country.toUpper())); userLevelLabel2.setPixmap(UserLevelPixmapGenerator::generatePixmap(15, userLevel)); QString userLevelText; if (userLevel.testFlag(ServerInfo_User::IsAdmin)) From d0f4d96d17b9699eed3aa8e2be962393ed366b95 Mon Sep 17 00:00:00 2001 From: Gavin Bises Date: Thu, 29 Jan 2015 19:51:16 -0500 Subject: [PATCH 8/9] Don't store shuffle zone check - always check it It doesn't make any sense to store that particular setting --- cockatrice/src/settingscache.cpp | 6 ------ cockatrice/src/settingscache.h | 8 +------- cockatrice/src/zoneviewwidget.cpp | 6 ++---- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 8bfbeb2dd..a0044976a 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -49,7 +49,6 @@ SettingsCache::SettingsCache() zoneViewSortByName = settings->value("zoneview/sortbyname", true).toBool(); zoneViewSortByType = settings->value("zoneview/sortbytype", true).toBool(); zoneViewPileView = settings->value("zoneview/pileview", true).toBool(); - zoneViewShuffle = settings->value("zoneview/shuffle", true).toBool(); soundEnabled = settings->value("sound/enabled", false).toBool(); soundPath = settings->value("sound/path").toString(); @@ -261,11 +260,6 @@ void SettingsCache::setZoneViewPileView(int _zoneViewPileView){ settings->setValue("zoneview/pileview", zoneViewPileView); } -void SettingsCache::setZoneViewShuffle(int _zoneViewShuffle) { - zoneViewShuffle = _zoneViewShuffle; - settings->setValue("zoneview/shuffle", zoneViewShuffle); -} - void SettingsCache::setSoundEnabled(int _soundEnabled) { soundEnabled = _soundEnabled; diff --git a/cockatrice/src/settingscache.h b/cockatrice/src/settingscache.h index b4d6e9bf1..084feaafa 100644 --- a/cockatrice/src/settingscache.h +++ b/cockatrice/src/settingscache.h @@ -57,7 +57,7 @@ private: int minPlayersForMultiColumnLayout; bool tapAnimation; bool chatMention; - bool zoneViewSortByName, zoneViewSortByType, zoneViewPileView, zoneViewShuffle; + bool zoneViewSortByName, zoneViewSortByType, zoneViewPileView; bool soundEnabled; QString soundPath; bool priceTagFeature; @@ -103,11 +103,6 @@ public: @return zoneViewPileView if the view should be sorted into pile view. */ bool getZoneViewPileView() const { return zoneViewPileView; } - /** - Returns if the view should be shuffled on closing. - @return zoneViewShuffle if the view should be shuffled on closing. - */ - bool getZoneViewShuffle() const { return zoneViewShuffle; } bool getSoundEnabled() const { return soundEnabled; } QString getSoundPath() const { return soundPath; } bool getPriceTagFeature() const { return priceTagFeature; } @@ -149,7 +144,6 @@ public slots: void setZoneViewSortByName(int _zoneViewSortByName); void setZoneViewSortByType(int _zoneViewSortByType); void setZoneViewPileView(int _zoneViewPileView); - void setZoneViewShuffle(int _zoneViewShuffle); void setSoundEnabled(int _soundEnabled); void setSoundPath(const QString &_soundPath); void setPriceTagFeature(int _priceTagFeature); diff --git a/cockatrice/src/zoneviewwidget.cpp b/cockatrice/src/zoneviewwidget.cpp index 13fb69627..dab5f862b 100644 --- a/cockatrice/src/zoneviewwidget.cpp +++ b/cockatrice/src/zoneviewwidget.cpp @@ -101,7 +101,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberC } if (_origZone->getIsShufflable() && (numberCards == -1)) { - shuffleCheckBox.setChecked(settingsCache->getZoneViewShuffle()); + shuffleCheckBox.setChecked(true); QGraphicsProxyWidget *shuffleProxy = new QGraphicsProxyWidget; shuffleProxy->setWidget(&shuffleCheckBox); vbox->addItem(shuffleProxy); @@ -225,10 +225,8 @@ void ZoneViewWidget::closeEvent(QCloseEvent *event) cmd.set_zone_name(zone->getName().toStdString()); player->sendGameCommand(cmd); } - if (shuffleCheckBox.isChecked()) + if (shuffleCheckBox.isChecked()) player->sendGameCommand(Command_Shuffle()); - if (canBeShuffled) - settingsCache->setZoneViewShuffle(shuffleCheckBox.isChecked()); emit closePressed(this); deleteLater(); event->accept(); From d065236ce9d89f46546119f1c5c8812f0936a7b6 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Fri, 30 Jan 2015 13:57:16 +0100 Subject: [PATCH 9/9] Added separator Its been annoying me for a long time. --- cockatrice/src/window_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index 82f0cab13..ebc457544 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -344,6 +344,7 @@ void MainWindow::createMenus() cockatriceMenu = menuBar()->addMenu(QString()); cockatriceMenu->addAction(aConnect); cockatriceMenu->addAction(aDisconnect); + cockatriceMenu->addSeparator(); cockatriceMenu->addAction(aSinglePlayer); cockatriceMenu->addAction(aWatchReplay); cockatriceMenu->addSeparator();