update deprecated methods in qt5.14 and protobuf 3.4 (#3906)
This commit is contained in:
parent
361833e023
commit
a80c756dcb
11 changed files with 74 additions and 37 deletions
|
@ -573,7 +573,7 @@ QStringList CardDatabase::getAllMainCardTypes() const
|
||||||
while (cardIterator.hasNext()) {
|
while (cardIterator.hasNext()) {
|
||||||
types.insert(cardIterator.next().value()->getMainCardType());
|
types.insert(cardIterator.next().value()->getMainCardType());
|
||||||
}
|
}
|
||||||
return types.toList();
|
return types.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardDatabase::checkUnknownSets()
|
void CardDatabase::checkUnknownSets()
|
||||||
|
|
|
@ -103,7 +103,11 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
|
||||||
chooseTokenFromDeckRadioButton->setDisabled(true); // No tokens in deck = no need for option
|
chooseTokenFromDeckRadioButton->setDisabled(true); // No tokens in deck = no need for option
|
||||||
} else {
|
} else {
|
||||||
chooseTokenFromDeckRadioButton->setChecked(true);
|
chooseTokenFromDeckRadioButton->setChecked(true);
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>(predefinedTokens.begin(), predefinedTokens.end()));
|
||||||
|
#else
|
||||||
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>::fromList(predefinedTokens));
|
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>::fromList(predefinedTokens));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QVBoxLayout *tokenChooseLayout = new QVBoxLayout;
|
QVBoxLayout *tokenChooseLayout = new QVBoxLayout;
|
||||||
|
@ -182,14 +186,20 @@ void DlgCreateToken::updateSearch(const QString &search)
|
||||||
|
|
||||||
void DlgCreateToken::actChooseTokenFromAll(bool checked)
|
void DlgCreateToken::actChooseTokenFromAll(bool checked)
|
||||||
{
|
{
|
||||||
if (checked)
|
if (checked) {
|
||||||
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>());
|
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgCreateToken::actChooseTokenFromDeck(bool checked)
|
void DlgCreateToken::actChooseTokenFromDeck(bool checked)
|
||||||
{
|
{
|
||||||
if (checked)
|
if (checked) {
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>(predefinedTokens.begin(), predefinedTokens.end()));
|
||||||
|
#else
|
||||||
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>::fromList(predefinedTokens));
|
cardDatabaseDisplayModel->setCardNameSet(QSet<QString>::fromList(predefinedTokens));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgCreateToken::actOk()
|
void DlgCreateToken::actOk()
|
||||||
|
|
|
@ -41,17 +41,15 @@ DlgTipOfTheDay::DlgTipOfTheDay(QWidget *parent) : QDialog(parent)
|
||||||
tipNumber = new QLabel();
|
tipNumber = new QLabel();
|
||||||
tipNumber->setAlignment(Qt::AlignCenter);
|
tipNumber->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
if (settingsCache->getSeenTips().size() != tipDatabase->rowCount()) {
|
QList<int> seenTips = settingsCache->getSeenTips();
|
||||||
newTipsAvailable = true;
|
newTipsAvailable = false;
|
||||||
QList<int> rangeToMaxTips;
|
currentTip = 0;
|
||||||
for (int i = 0; i < tipDatabase->rowCount(); i++) {
|
for (int i = 0; i < tipDatabase->rowCount(); i++) {
|
||||||
rangeToMaxTips.append(i);
|
if (!seenTips.contains(i)) {
|
||||||
|
newTipsAvailable = true;
|
||||||
|
currentTip = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
QSet<int> unseenTips = rangeToMaxTips.toSet() - settingsCache->getSeenTips().toSet();
|
|
||||||
currentTip = *std::min_element(unseenTips.begin(), unseenTips.end());
|
|
||||||
} else {
|
|
||||||
newTipsAvailable = false;
|
|
||||||
currentTip = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(this, SIGNAL(newTipRequested(int)), this, SLOT(updateTip(int)));
|
connect(this, SIGNAL(newTipRequested(int)), this, SLOT(updateTip(int)));
|
||||||
|
|
|
@ -334,8 +334,11 @@ void RemoteClient::websocketMessageReceived(const QByteArray &message)
|
||||||
|
|
||||||
void RemoteClient::sendCommandContainer(const CommandContainer &cont)
|
void RemoteClient::sendCommandContainer(const CommandContainer &cont)
|
||||||
{
|
{
|
||||||
|
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||||
auto size = static_cast<unsigned int>(cont.ByteSize());
|
unsigned int size = cont.ByteSizeLong();
|
||||||
|
#else
|
||||||
|
unsigned int size = cont.ByteSize();
|
||||||
|
#endif
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
qDebug() << "OUT" << size << QString::fromStdString(cont.ShortDebugString());
|
qDebug() << "OUT" << size << QString::fromStdString(cont.ShortDebugString());
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,7 +73,7 @@ void StackZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
||||||
void StackZone::reorganizeCards()
|
void StackZone::reorganizeCards()
|
||||||
{
|
{
|
||||||
if (!cards.isEmpty()) {
|
if (!cards.isEmpty()) {
|
||||||
QList<ArrowItem *> arrowsToUpdate;
|
QSet<ArrowItem *> arrowsToUpdate;
|
||||||
|
|
||||||
const int cardCount = cards.size();
|
const int cardCount = cards.size();
|
||||||
qreal totalWidth = boundingRect().width();
|
qreal totalWidth = boundingRect().width();
|
||||||
|
@ -95,12 +95,16 @@ void StackZone::reorganizeCards()
|
||||||
c->setPos(x, ((qreal)i) * cardHeight + (totalHeight - cardCount * cardHeight) / 2);
|
c->setPos(x, ((qreal)i) * cardHeight + (totalHeight - cardCount * cardHeight) / 2);
|
||||||
c->setRealZValue(i);
|
c->setRealZValue(i);
|
||||||
|
|
||||||
arrowsToUpdate.append(c->getArrowsFrom());
|
for (ArrowItem *item : c->getArrowsFrom()) {
|
||||||
arrowsToUpdate.append(c->getArrowsTo());
|
arrowsToUpdate.insert(item);
|
||||||
|
}
|
||||||
|
for (ArrowItem *item : c->getArrowsTo()) {
|
||||||
|
arrowsToUpdate.insert(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ArrowItem *item : arrowsToUpdate) {
|
||||||
|
item->updatePath();
|
||||||
}
|
}
|
||||||
QSetIterator<ArrowItem *> arrowIterator(QSet<ArrowItem *>::fromList(arrowsToUpdate));
|
|
||||||
while (arrowIterator.hasNext())
|
|
||||||
arrowIterator.next()->updatePath();
|
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,7 +344,7 @@ void TabSupervisor::addCloseButtonToTab(Tab *tab, int tabIndex)
|
||||||
(QTabBar::ButtonPosition)tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tabBar());
|
(QTabBar::ButtonPosition)tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tabBar());
|
||||||
CloseButton *closeButton = new CloseButton;
|
CloseButton *closeButton = new CloseButton;
|
||||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeButtonPressed()));
|
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeButtonPressed()));
|
||||||
closeButton->setProperty("tab", qVariantFromValue((QObject *)tab));
|
closeButton->setProperty("tab", QVariant::fromValue((QObject *)tab));
|
||||||
tabBar()->setTabButton(tabIndex, closeSide, closeButton);
|
tabBar()->setTabButton(tabIndex, closeSide, closeButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ void TableZone::handleDropEventByGrid(const QList<CardDragItem *> &dragItems,
|
||||||
|
|
||||||
void TableZone::reorganizeCards()
|
void TableZone::reorganizeCards()
|
||||||
{
|
{
|
||||||
QList<ArrowItem *> arrowsToUpdate;
|
QSet<ArrowItem *> arrowsToUpdate;
|
||||||
|
|
||||||
// Calculate card stack widths so mapping functions work properly
|
// Calculate card stack widths so mapping functions work properly
|
||||||
computeCardStackWidths();
|
computeCardStackWidths();
|
||||||
|
@ -185,18 +185,24 @@ void TableZone::reorganizeCards()
|
||||||
qreal childY = y + 5;
|
qreal childY = y + 5;
|
||||||
attachedCard->setPos(childX, childY);
|
attachedCard->setPos(childX, childY);
|
||||||
attachedCard->setRealZValue((childY + CARD_HEIGHT) * 100000 + (childX + 1) * 100);
|
attachedCard->setRealZValue((childY + CARD_HEIGHT) * 100000 + (childX + 1) * 100);
|
||||||
|
for (ArrowItem *item : attachedCard->getArrowsFrom()) {
|
||||||
arrowsToUpdate.append(attachedCard->getArrowsFrom());
|
arrowsToUpdate.insert(item);
|
||||||
arrowsToUpdate.append(attachedCard->getArrowsTo());
|
}
|
||||||
|
for (ArrowItem *item : attachedCard->getArrowsTo()) {
|
||||||
|
arrowsToUpdate.insert(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arrowsToUpdate.append(cards[i]->getArrowsFrom());
|
for (ArrowItem *item : cards[i]->getArrowsFrom()) {
|
||||||
arrowsToUpdate.append(cards[i]->getArrowsTo());
|
arrowsToUpdate.insert(item);
|
||||||
|
}
|
||||||
|
for (ArrowItem *item : cards[i]->getArrowsTo()) {
|
||||||
|
arrowsToUpdate.insert(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ArrowItem *item : arrowsToUpdate) {
|
||||||
|
item->updatePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSetIterator<ArrowItem *> arrowIterator(QSet<ArrowItem *>::fromList(arrowsToUpdate));
|
|
||||||
while (arrowIterator.hasNext())
|
|
||||||
arrowIterator.next()->updatePath();
|
|
||||||
|
|
||||||
resizeToContents();
|
resizeToContents();
|
||||||
update();
|
update();
|
||||||
|
|
|
@ -704,7 +704,7 @@ QStringList DeckList::getCardList() const
|
||||||
{
|
{
|
||||||
QSet<QString> result;
|
QSet<QString> result;
|
||||||
getCardListHelper(root, result);
|
getCardListHelper(root, result);
|
||||||
return result.toList();
|
return result.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DeckList::getSideboardSize() const
|
int DeckList::getSideboardSize() const
|
||||||
|
|
|
@ -261,7 +261,11 @@ void IslInterface::catchSocketError(QAbstractSocket::SocketError socketError)
|
||||||
void IslInterface::transmitMessage(const IslMessage &item)
|
void IslInterface::transmitMessage(const IslMessage &item)
|
||||||
{
|
{
|
||||||
QByteArray buf;
|
QByteArray buf;
|
||||||
|
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||||
|
unsigned int size = item.ByteSizeLong();
|
||||||
|
#else
|
||||||
unsigned int size = item.ByteSize();
|
unsigned int size = item.ByteSize();
|
||||||
|
#endif
|
||||||
buf.resize(size + 4);
|
buf.resize(size + 4);
|
||||||
item.SerializeToArray(buf.data() + 4, size);
|
item.SerializeToArray(buf.data() + 4, size);
|
||||||
buf.data()[3] = (unsigned char)size;
|
buf.data()[3] = (unsigned char)size;
|
||||||
|
|
|
@ -804,7 +804,11 @@ void Servatrice_DatabaseInterface::storeGameInformation(const QString &roomName,
|
||||||
QVariantList replayIds, replayGameIds, replayDurations, replayBlobs;
|
QVariantList replayIds, replayGameIds, replayDurations, replayBlobs;
|
||||||
for (int i = 0; i < replayList.size(); ++i) {
|
for (int i = 0; i < replayList.size(); ++i) {
|
||||||
QByteArray blob;
|
QByteArray blob;
|
||||||
|
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||||
|
const unsigned int size = replayList[i]->ByteSizeLong();
|
||||||
|
#else
|
||||||
const unsigned int size = replayList[i]->ByteSize();
|
const unsigned int size = replayList[i]->ByteSize();
|
||||||
|
#endif
|
||||||
blob.resize(size);
|
blob.resize(size);
|
||||||
replayList[i]->SerializeToArray(blob.data(), size);
|
replayList[i]->SerializeToArray(blob.data(), size);
|
||||||
|
|
||||||
|
|
|
@ -1553,7 +1553,11 @@ void TcpServerSocketInterface::flushOutputQueue()
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
|
||||||
QByteArray buf;
|
QByteArray buf;
|
||||||
|
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||||
|
unsigned int size = item.ByteSizeLong();
|
||||||
|
#else
|
||||||
unsigned int size = item.ByteSize();
|
unsigned int size = item.ByteSize();
|
||||||
|
#endif
|
||||||
buf.resize(size + 4);
|
buf.resize(size + 4);
|
||||||
item.SerializeToArray(buf.data() + 4, size);
|
item.SerializeToArray(buf.data() + 4, size);
|
||||||
buf.data()[3] = (unsigned char)size;
|
buf.data()[3] = (unsigned char)size;
|
||||||
|
@ -1747,7 +1751,11 @@ void WebsocketServerSocketInterface::flushOutputQueue()
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
|
||||||
QByteArray buf;
|
QByteArray buf;
|
||||||
|
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||||
|
unsigned int size = item.ByteSizeLong();
|
||||||
|
#else
|
||||||
unsigned int size = item.ByteSize();
|
unsigned int size = item.ByteSize();
|
||||||
|
#endif
|
||||||
buf.resize(size);
|
buf.resize(size);
|
||||||
item.SerializeToArray(buf.data(), size);
|
item.SerializeToArray(buf.data(), size);
|
||||||
// In case socket->write() calls catchSocketError(), the mutex must not be locked during this call.
|
// In case socket->write() calls catchSocketError(), the mutex must not be locked during this call.
|
||||||
|
|
Loading…
Reference in a new issue