From 8d5421d9da323eb0600c9d621c1d8fed7fadd949 Mon Sep 17 00:00:00 2001 From: Zach H Date: Sun, 20 Oct 2024 23:35:34 -0400 Subject: [PATCH] Add backwards support Qt6.7's checkStateChanged on QCheckBoxes (#5137) --- .../network/spoiler_background_updater.cpp | 4 + cockatrice/src/dialogs/dlg_connect.cpp | 6 +- cockatrice/src/dialogs/dlg_connect.h | 3 +- cockatrice/src/dialogs/dlg_create_game.cpp | 5 +- cockatrice/src/dialogs/dlg_create_game.h | 4 +- cockatrice/src/dialogs/dlg_settings.cpp | 95 +++++++++++-------- cockatrice/src/dialogs/dlg_settings.h | 6 +- cockatrice/src/game/games_model.cpp | 11 ++- .../src/game/zones/view_zone_widget.cpp | 15 +-- cockatrice/src/game/zones/view_zone_widget.h | 8 +- cockatrice/src/main.h | 2 + cockatrice/src/settings/cache_settings.cpp | 56 +++++------ cockatrice/src/settings/cache_settings.h | 57 +++++------ cockatrice/src/utility/macros.h | 17 ++++ dbconverter/src/mocks.cpp | 68 +++++++------ dbconverter/src/mocks.h | 1 + tests/carddatabase/mocks.cpp | 68 +++++++------ tests/carddatabase/mocks.h | 1 + 18 files changed, 251 insertions(+), 176 deletions(-) create mode 100644 cockatrice/src/utility/macros.h diff --git a/cockatrice/src/client/network/spoiler_background_updater.cpp b/cockatrice/src/client/network/spoiler_background_updater.cpp index 58b182bf2..bc696dd31 100644 --- a/cockatrice/src/client/network/spoiler_background_updater.cpp +++ b/cockatrice/src/client/network/spoiler_background_updater.cpp @@ -172,7 +172,11 @@ bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data) timeStamp.chop(6); // Remove " (UTC)" auto utcTime = QLocale().toDateTime(timeStamp, "ddd, MMM dd yyyy, hh:mm:ss"); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + utcTime.setTimeZone(QTimeZone::UTC); +#else utcTime.setTimeSpec(Qt::UTC); +#endif QString localTime = utcTime.toLocalTime().toString("MMM d, hh:mm"); diff --git a/cockatrice/src/dialogs/dlg_connect.cpp b/cockatrice/src/dialogs/dlg_connect.cpp index a4b097efc..d618d3ae4 100644 --- a/cockatrice/src/dialogs/dlg_connect.cpp +++ b/cockatrice/src/dialogs/dlg_connect.cpp @@ -2,6 +2,7 @@ #include "../server/user/user_info_connection.h" #include "../settings/cache_settings.h" +#include "../utility/macros.h" #include "trice_limits.h" #include @@ -79,7 +80,8 @@ DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent) autoConnectCheckBox->setEnabled(false); } - connect(savePasswordCheckBox, SIGNAL(stateChanged(int)), this, SLOT(passwordSaved(int))); + connect(savePasswordCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), this, + SLOT(passwordSaved(QT_STATE_CHANGED_T))); serverIssuesLabel = new QLabel(tr("If you have any trouble connecting or registering then contact the server staff for help!")); @@ -292,7 +294,7 @@ void DlgConnect::newHostSelected(bool state) } } -void DlgConnect::passwordSaved(int state) +void DlgConnect::passwordSaved(QT_STATE_CHANGED_T state) { Q_UNUSED(state); if (savePasswordCheckBox->isChecked()) { diff --git a/cockatrice/src/dialogs/dlg_connect.h b/cockatrice/src/dialogs/dlg_connect.h index c48875290..d91b1cc93 100644 --- a/cockatrice/src/dialogs/dlg_connect.h +++ b/cockatrice/src/dialogs/dlg_connect.h @@ -3,6 +3,7 @@ #include "../server/handle_public_servers.h" #include "../server/user/user_info_connection.h" +#include "../utility/macros.h" #include #include @@ -54,7 +55,7 @@ public slots: private slots: void actOk(); - void passwordSaved(int state); + void passwordSaved(QT_STATE_CHANGED_T state); void previousHostSelected(bool state); void newHostSelected(bool state); void actForgotPassword(); diff --git a/cockatrice/src/dialogs/dlg_create_game.cpp b/cockatrice/src/dialogs/dlg_create_game.cpp index ab7698856..536077de2 100644 --- a/cockatrice/src/dialogs/dlg_create_game.cpp +++ b/cockatrice/src/dialogs/dlg_create_game.cpp @@ -81,7 +81,8 @@ void DlgCreateGame::sharedCtor() spectatorsAllowedCheckBox = new QCheckBox(tr("&Spectators can watch")); spectatorsAllowedCheckBox->setChecked(true); - connect(spectatorsAllowedCheckBox, SIGNAL(stateChanged(int)), this, SLOT(spectatorsAllowedChanged(int))); + connect(spectatorsAllowedCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), this, + SLOT(spectatorsAllowedChanged(QT_STATE_CHANGED_T))); spectatorsNeedPasswordCheckBox = new QCheckBox(tr("Spectators &need a password to watch")); spectatorsCanTalkCheckBox = new QCheckBox(tr("Spectators can &chat")); spectatorsSeeEverythingCheckBox = new QCheckBox(tr("Spectators can see &hands")); @@ -277,7 +278,7 @@ void DlgCreateGame::checkResponse(const Response &response) } } -void DlgCreateGame::spectatorsAllowedChanged(int state) +void DlgCreateGame::spectatorsAllowedChanged(QT_STATE_CHANGED_T state) { spectatorsNeedPasswordCheckBox->setEnabled(state); spectatorsCanTalkCheckBox->setEnabled(state); diff --git a/cockatrice/src/dialogs/dlg_create_game.h b/cockatrice/src/dialogs/dlg_create_game.h index 90e3ba2b0..4eb5a9e8e 100644 --- a/cockatrice/src/dialogs/dlg_create_game.h +++ b/cockatrice/src/dialogs/dlg_create_game.h @@ -1,6 +1,8 @@ #ifndef DLG_CREATEGAME_H #define DLG_CREATEGAME_H +#include "../utility/macros.h" + #include #include @@ -26,7 +28,7 @@ private slots: void actOK(); void actReset(); void checkResponse(const Response &response); - void spectatorsAllowedChanged(int state); + void spectatorsAllowedChanged(QT_STATE_CHANGED_T state); private: TabRoom *room; diff --git a/cockatrice/src/dialogs/dlg_settings.cpp b/cockatrice/src/dialogs/dlg_settings.cpp index c18ef6711..410c6d45c 100644 --- a/cockatrice/src/dialogs/dlg_settings.cpp +++ b/cockatrice/src/dialogs/dlg_settings.cpp @@ -73,8 +73,10 @@ GeneralSettingsPage::GeneralSettingsPage() connect(&languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int))); connect(&updateReleaseChannelBox, SIGNAL(currentIndexChanged(int)), &settings, SLOT(setUpdateReleaseChannel(int))); - connect(&updateNotificationCheckBox, SIGNAL(stateChanged(int)), &settings, SLOT(setNotifyAboutUpdate(int))); - connect(&newVersionOracleCheckBox, SIGNAL(stateChanged(int)), &settings, SLOT(setNotifyAboutNewVersion(int))); + connect(&updateNotificationCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &settings, + SLOT(setNotifyAboutUpdate(QT_STATE_CHANGED_T))); + connect(&newVersionOracleCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &settings, + SLOT(setNotifyAboutNewVersion(QT_STATE_CHANGED_T))); connect(&showTipsOnStartup, SIGNAL(clicked(bool)), &settings, SLOT(setShowTipsOnStartup(bool))); auto *personalGrid = new QGridLayout; @@ -321,10 +323,12 @@ AppearanceSettingsPage::AppearanceSettingsPage() themeGroupBox->setLayout(themeGrid); displayCardNamesCheckBox.setChecked(settings.getDisplayCardNames()); - connect(&displayCardNamesCheckBox, SIGNAL(stateChanged(int)), &settings, SLOT(setDisplayCardNames(int))); + connect(&displayCardNamesCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &settings, + SLOT(setDisplayCardNames(QT_STATE_CHANGED_T))); cardScalingCheckBox.setChecked(settings.getScaleCards()); - connect(&cardScalingCheckBox, SIGNAL(stateChanged(int)), &settings, SLOT(setCardScaling(int))); + connect(&cardScalingCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &settings, + SLOT(setCardScaling(QT_STATE_CHANGED_T))); verticalCardOverlapPercentBox.setValue(settings.getStackCardOverlapPercent()); verticalCardOverlapPercentBox.setRange(0, 80); @@ -341,10 +345,12 @@ AppearanceSettingsPage::AppearanceSettingsPage() cardsGroupBox->setLayout(cardsGrid); horizontalHandCheckBox.setChecked(settings.getHorizontalHand()); - connect(&horizontalHandCheckBox, SIGNAL(stateChanged(int)), &settings, SLOT(setHorizontalHand(int))); + connect(&horizontalHandCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &settings, + SLOT(setHorizontalHand(QT_STATE_CHANGED_T))); leftJustifiedHandCheckBox.setChecked(settings.getLeftJustified()); - connect(&leftJustifiedHandCheckBox, SIGNAL(stateChanged(int)), &settings, SLOT(setLeftJustified(int))); + connect(&leftJustifiedHandCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &settings, + SLOT(setLeftJustified(QT_STATE_CHANGED_T))); auto *handGrid = new QGridLayout; handGrid->addWidget(&horizontalHandCheckBox, 0, 0, 1, 2); @@ -354,8 +360,8 @@ AppearanceSettingsPage::AppearanceSettingsPage() handGroupBox->setLayout(handGrid); invertVerticalCoordinateCheckBox.setChecked(settings.getInvertVerticalCoordinate()); - connect(&invertVerticalCoordinateCheckBox, SIGNAL(stateChanged(int)), &settings, - SLOT(setInvertVerticalCoordinate(int))); + connect(&invertVerticalCoordinateCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &settings, + SLOT(setInvertVerticalCoordinate(QT_STATE_CHANGED_T))); minPlayersForMultiColumnLayoutEdit.setMinimum(2); minPlayersForMultiColumnLayoutEdit.setValue(settings.getMinPlayersForMultiColumnLayout()); @@ -434,35 +440,37 @@ void AppearanceSettingsPage::retranslateUi() UserInterfaceSettingsPage::UserInterfaceSettingsPage() { notificationsEnabledCheckBox.setChecked(SettingsCache::instance().getNotificationsEnabled()); - connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), - SLOT(setNotificationsEnabled(int))); - connect(¬ificationsEnabledCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setNotificationEnabled(int))); + connect(¬ificationsEnabledCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setNotificationsEnabled(QT_STATE_CHANGED_T))); + connect(¬ificationsEnabledCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), this, + SLOT(setNotificationEnabled(QT_STATE_CHANGED_T))); specNotificationsEnabledCheckBox.setChecked(SettingsCache::instance().getSpectatorNotificationsEnabled()); specNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().getNotificationsEnabled()); - connect(&specNotificationsEnabledCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), - SLOT(setSpectatorNotificationsEnabled(int))); + connect(&specNotificationsEnabledCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setSpectatorNotificationsEnabled(QT_STATE_CHANGED_T))); buddyConnectNotificationsEnabledCheckBox.setChecked( SettingsCache::instance().getBuddyConnectNotificationsEnabled()); buddyConnectNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().getNotificationsEnabled()); - connect(&buddyConnectNotificationsEnabledCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), - SLOT(setBuddyConnectNotificationsEnabled(int))); + connect(&buddyConnectNotificationsEnabledCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), + &SettingsCache::instance(), SLOT(setBuddyConnectNotificationsEnabled(QT_STATE_CHANGED_T))); doubleClickToPlayCheckBox.setChecked(SettingsCache::instance().getDoubleClickToPlay()); - connect(&doubleClickToPlayCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), - SLOT(setDoubleClickToPlay(int))); + connect(&doubleClickToPlayCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setDoubleClickToPlay(QT_STATE_CHANGED_T))); playToStackCheckBox.setChecked(SettingsCache::instance().getPlayToStack()); - connect(&playToStackCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setPlayToStack(int))); + connect(&playToStackCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setPlayToStack(QT_STATE_CHANGED_T))); annotateTokensCheckBox.setChecked(SettingsCache::instance().getAnnotateTokens()); - connect(&annotateTokensCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), - SLOT(setAnnotateTokens(int))); + connect(&annotateTokensCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setAnnotateTokens(QT_STATE_CHANGED_T))); useTearOffMenusCheckBox.setChecked(SettingsCache::instance().getUseTearOffMenus()); - connect(&useTearOffMenusCheckBox, &QCheckBox::stateChanged, &SettingsCache::instance(), - [](int state) { SettingsCache::instance().setUseTearOffMenus(state == Qt::Checked); }); + connect(&useTearOffMenusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(), + [](QT_STATE_CHANGED_T state) { SettingsCache::instance().setUseTearOffMenus(state == Qt::Checked); }); auto *generalGrid = new QGridLayout; generalGrid->addWidget(&doubleClickToPlayCheckBox, 0, 0); @@ -482,7 +490,8 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage() notificationsGroupBox->setLayout(notificationsGrid); tapAnimationCheckBox.setChecked(SettingsCache::instance().getTapAnimation()); - connect(&tapAnimationCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setTapAnimation(int))); + connect(&tapAnimationCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setTapAnimation(QT_STATE_CHANGED_T))); auto *animationGrid = new QGridLayout; animationGrid->addWidget(&tapAnimationCheckBox, 0, 0); @@ -527,7 +536,8 @@ void UserInterfaceSettingsPage::retranslateUi() DeckEditorSettingsPage::DeckEditorSettingsPage() { picDownloadCheckBox.setChecked(SettingsCache::instance().getPicDownload()); - connect(&picDownloadCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setPicDownload(int))); + connect(&picDownloadCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setPicDownload(QT_STATE_CHANGED_T))); urlLinkLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse); urlLinkLabel.setOpenExternalLinks(true); @@ -825,27 +835,30 @@ void DeckEditorSettingsPage::retranslateUi() MessagesSettingsPage::MessagesSettingsPage() { chatMentionCheckBox.setChecked(SettingsCache::instance().getChatMention()); - connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setChatMention(int))); + connect(&chatMentionCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setChatMention(QT_STATE_CHANGED_T))); chatMentionCompleterCheckbox.setChecked(SettingsCache::instance().getChatMentionCompleter()); - connect(&chatMentionCompleterCheckbox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), - SLOT(setChatMentionCompleter(int))); + connect(&chatMentionCompleterCheckbox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setChatMentionCompleter(QT_STATE_CHANGED_T))); explainMessagesLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse); explainMessagesLabel.setOpenExternalLinks(true); ignoreUnregUsersMainChat.setChecked(SettingsCache::instance().getIgnoreUnregisteredUsers()); ignoreUnregUserMessages.setChecked(SettingsCache::instance().getIgnoreUnregisteredUserMessages()); - connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), &SettingsCache::instance(), - SLOT(setIgnoreUnregisteredUsers(int))); - connect(&ignoreUnregUserMessages, SIGNAL(stateChanged(int)), &SettingsCache::instance(), - SLOT(setIgnoreUnregisteredUserMessages(int))); + connect(&ignoreUnregUsersMainChat, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T))); + connect(&ignoreUnregUserMessages, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T))); invertMentionForeground.setChecked(SettingsCache::instance().getChatMentionForeground()); - connect(&invertMentionForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextColor(int))); + connect(&invertMentionForeground, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), this, + SLOT(updateTextColor(QT_STATE_CHANGED_T))); invertHighlightForeground.setChecked(SettingsCache::instance().getChatHighlightForeground()); - connect(&invertHighlightForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextHighlightColor(int))); + connect(&invertHighlightForeground, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), this, + SLOT(updateTextHighlightColor(QT_STATE_CHANGED_T))); mentionColor = new QLineEdit(); mentionColor->setText(SettingsCache::instance().getChatMentionColor()); @@ -853,13 +866,16 @@ MessagesSettingsPage::MessagesSettingsPage() connect(mentionColor, SIGNAL(textChanged(QString)), this, SLOT(updateColor(QString))); messagePopups.setChecked(SettingsCache::instance().getShowMessagePopup()); - connect(&messagePopups, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setShowMessagePopups(int))); + connect(&messagePopups, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setShowMessagePopups(QT_STATE_CHANGED_T))); mentionPopups.setChecked(SettingsCache::instance().getShowMentionPopup()); - connect(&mentionPopups, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setShowMentionPopups(int))); + connect(&mentionPopups, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setShowMentionPopups(QT_STATE_CHANGED_T))); roomHistory.setChecked(SettingsCache::instance().getRoomHistory()); - connect(&roomHistory, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setRoomHistory(int))); + connect(&roomHistory, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setRoomHistory(QT_STATE_CHANGED_T))); customAlertString = new QLineEdit(); customAlertString->setPlaceholderText(tr("Word1 Word2 Word3")); @@ -970,13 +986,13 @@ void MessagesSettingsPage::updateHighlightColor(const QString &value) } } -void MessagesSettingsPage::updateTextColor(int value) +void MessagesSettingsPage::updateTextColor(QT_STATE_CHANGED_T value) { SettingsCache::instance().setChatMentionForeground(value); updateMentionPreview(); } -void MessagesSettingsPage::updateTextHighlightColor(int value) +void MessagesSettingsPage::updateTextHighlightColor(QT_STATE_CHANGED_T value) { SettingsCache::instance().setChatHighlightForeground(value); updateHighlightPreview(); @@ -1061,7 +1077,8 @@ void MessagesSettingsPage::retranslateUi() SoundSettingsPage::SoundSettingsPage() { soundEnabledCheckBox.setChecked(SettingsCache::instance().getSoundEnabled()); - connect(&soundEnabledCheckBox, SIGNAL(stateChanged(int)), &SettingsCache::instance(), SLOT(setSoundEnabled(int))); + connect(&soundEnabledCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(), + SLOT(setSoundEnabled(QT_STATE_CHANGED_T))); QString themeName = SettingsCache::instance().getSoundThemeName(); diff --git a/cockatrice/src/dialogs/dlg_settings.h b/cockatrice/src/dialogs/dlg_settings.h index 1856c5e8c..1ab65f9e4 100644 --- a/cockatrice/src/dialogs/dlg_settings.h +++ b/cockatrice/src/dialogs/dlg_settings.h @@ -1,6 +1,8 @@ #ifndef DLG_SETTINGS_H #define DLG_SETTINGS_H +#include "../utility/macros.h" + #include #include #include @@ -187,8 +189,8 @@ private slots: void actRemove(); void updateColor(const QString &value); void updateHighlightColor(const QString &value); - void updateTextColor(int value); - void updateTextHighlightColor(int value); + void updateTextColor(QT_STATE_CHANGED_T value); + void updateTextHighlightColor(QT_STATE_CHANGED_T value); private: QListWidget *messageList; diff --git a/cockatrice/src/game/games_model.cpp b/cockatrice/src/game/games_model.cpp index e65be140e..dd3332e84 100644 --- a/cockatrice/src/game/games_model.cpp +++ b/cockatrice/src/game/games_model.cpp @@ -11,6 +11,7 @@ #include #include #include +#include enum GameListColumn { @@ -93,7 +94,11 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const case CREATED: { switch (role) { case Qt::DisplayRole: { - QDateTime then = QDateTime::fromSecsSinceEpoch(gameentry.start_time(), Qt::UTC); +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + auto then = QDateTime::fromSecsSinceEpoch(gameentry.start_time(), QTimeZone::UTC); +#else + auto then = QDateTime::fromSecsSinceEpoch(gameentry.start_time(), Qt::UTC); +#endif int secs = then.secsTo(QDateTime::currentDateTimeUtc()); return getGameCreatedString(secs); } @@ -487,7 +492,9 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & /*sour bool GamesProxyModel::filterAcceptsRow(int sourceRow) const { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + static const QDate epochDate = QDateTime::fromSecsSinceEpoch(0, QTimeZone::UTC).date(); +#elif (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) static const QDate epochDate = QDateTime::fromSecsSinceEpoch(0, Qt::UTC).date(); #else static const QDate epochDate = QDateTime::fromTime_t(0, Qt::UTC).date(); diff --git a/cockatrice/src/game/zones/view_zone_widget.cpp b/cockatrice/src/game/zones/view_zone_widget.cpp index 4cb8d9b83..974073a88 100644 --- a/cockatrice/src/game/zones/view_zone_widget.cpp +++ b/cockatrice/src/game/zones/view_zone_widget.cpp @@ -96,9 +96,12 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, // numberCard is the num of cards we want to reveal from an area. Ex: scry the top 3 cards. // If the number is < 0 then it means that we can make the area sorted and we dont care about the order. if (numberCards < 0) { - connect(&sortByNameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByName(int))); - connect(&sortByTypeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByType(int))); - connect(&pileViewCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSetPileView(int))); + connect(&sortByNameCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), this, + SLOT(processSortByName(QT_STATE_CHANGED_T))); + connect(&sortByTypeCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), this, + SLOT(processSortByType(QT_STATE_CHANGED_T))); + connect(&pileViewCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), this, + SLOT(processSetPileView(QT_STATE_CHANGED_T))); sortByNameCheckBox.setChecked(SettingsCache::instance().getZoneViewSortByName()); sortByTypeCheckBox.setChecked(SettingsCache::instance().getZoneViewSortByType()); pileViewCheckBox.setChecked(SettingsCache::instance().getZoneViewPileView()); @@ -114,7 +117,7 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, zone->initializeCards(cardList); } -void ZoneViewWidget::processSortByType(int value) +void ZoneViewWidget::processSortByType(QT_STATE_CHANGED_T value) { pileViewCheckBox.setEnabled(value); SettingsCache::instance().setZoneViewSortByType(value); @@ -122,13 +125,13 @@ void ZoneViewWidget::processSortByType(int value) zone->setSortByType(value); } -void ZoneViewWidget::processSortByName(int value) +void ZoneViewWidget::processSortByName(QT_STATE_CHANGED_T value) { SettingsCache::instance().setZoneViewSortByName(value); zone->setSortByName(value); } -void ZoneViewWidget::processSetPileView(int value) +void ZoneViewWidget::processSetPileView(QT_STATE_CHANGED_T value) { SettingsCache::instance().setZoneViewPileView(value); zone->setPileView(value); diff --git a/cockatrice/src/game/zones/view_zone_widget.h b/cockatrice/src/game/zones/view_zone_widget.h index 78cadb4b8..43e92f425 100644 --- a/cockatrice/src/game/zones/view_zone_widget.h +++ b/cockatrice/src/game/zones/view_zone_widget.h @@ -1,6 +1,8 @@ #ifndef ZONEVIEWWIDGET_H #define ZONEVIEWWIDGET_H +#include "../../utility/macros.h" + #include #include #include @@ -50,9 +52,9 @@ private: signals: void closePressed(ZoneViewWidget *zv); private slots: - void processSortByType(int value); - void processSortByName(int value); - void processSetPileView(int value); + void processSortByType(QT_STATE_CHANGED_T value); + void processSortByName(QT_STATE_CHANGED_T value); + void processSetPileView(QT_STATE_CHANGED_T value); void resizeToZoneContents(); void handleScrollBarChange(int value); void zoneDeleted(); diff --git a/cockatrice/src/main.h b/cockatrice/src/main.h index d34e82b4c..1d04b30ce 100644 --- a/cockatrice/src/main.h +++ b/cockatrice/src/main.h @@ -1,6 +1,8 @@ #ifndef MAIN_H #define MAIN_H +#include "utility/macros.h" + class CardDatabase; class QString; class QSystemTrayIcon; diff --git a/cockatrice/src/settings/cache_settings.cpp b/cockatrice/src/settings/cache_settings.cpp index 7ec09740d..3d89286d2 100644 --- a/cockatrice/src/settings/cache_settings.cpp +++ b/cockatrice/src/settings/cache_settings.cpp @@ -321,14 +321,14 @@ void SettingsCache::setMasterVolume(int _masterVolume) emit masterVolumeChanged(masterVolume); } -void SettingsCache::setLeftJustified(const int _leftJustified) +void SettingsCache::setLeftJustified(const QT_STATE_CHANGED_T _leftJustified) { leftJustified = (bool)_leftJustified; settings->setValue("interface/leftjustified", leftJustified); emit handJustificationChanged(); } -void SettingsCache::setCardScaling(const int _scaleCards) +void SettingsCache::setCardScaling(const QT_STATE_CHANGED_T _scaleCards) { scaleCards = (bool)_scaleCards; settings->setValue("cards/scaleCards", scaleCards); @@ -340,19 +340,19 @@ void SettingsCache::setStackCardOverlapPercent(const int _verticalCardOverlapPer settings->setValue("cards/verticalCardOverlapPercent", verticalCardOverlapPercent); } -void SettingsCache::setShowMessagePopups(const int _showMessagePopups) +void SettingsCache::setShowMessagePopups(const QT_STATE_CHANGED_T _showMessagePopups) { showMessagePopups = (bool)_showMessagePopups; settings->setValue("chat/showmessagepopups", showMessagePopups); } -void SettingsCache::setShowMentionPopups(const int _showMentionPopus) +void SettingsCache::setShowMentionPopups(const QT_STATE_CHANGED_T _showMentionPopus) { showMentionPopups = (bool)_showMentionPopus; settings->setValue("chat/showmentionpopups", showMentionPopups); } -void SettingsCache::setRoomHistory(const int _roomHistory) +void SettingsCache::setRoomHistory(const QT_STATE_CHANGED_T _roomHistory) { roomHistory = (bool)_roomHistory; settings->setValue("chat/roomhistory", roomHistory); @@ -448,38 +448,38 @@ void SettingsCache::setThemeName(const QString &_themeName) emit themeChanged(); } -void SettingsCache::setPicDownload(int _picDownload) +void SettingsCache::setPicDownload(QT_STATE_CHANGED_T _picDownload) { picDownload = static_cast(_picDownload); settings->setValue("personal/picturedownload", picDownload); emit picDownloadChanged(); } -void SettingsCache::setNotificationsEnabled(int _notificationsEnabled) +void SettingsCache::setNotificationsEnabled(QT_STATE_CHANGED_T _notificationsEnabled) { notificationsEnabled = static_cast(_notificationsEnabled); settings->setValue("interface/notificationsenabled", notificationsEnabled); } -void SettingsCache::setSpectatorNotificationsEnabled(int _spectatorNotificationsEnabled) +void SettingsCache::setSpectatorNotificationsEnabled(QT_STATE_CHANGED_T _spectatorNotificationsEnabled) { spectatorNotificationsEnabled = static_cast(_spectatorNotificationsEnabled); settings->setValue("interface/specnotificationsenabled", spectatorNotificationsEnabled); } -void SettingsCache::setBuddyConnectNotificationsEnabled(int _buddyConnectNotificationsEnabled) +void SettingsCache::setBuddyConnectNotificationsEnabled(QT_STATE_CHANGED_T _buddyConnectNotificationsEnabled) { buddyConnectNotificationsEnabled = static_cast(_buddyConnectNotificationsEnabled); settings->setValue("interface/buddyconnectnotificationsenabled", buddyConnectNotificationsEnabled); } -void SettingsCache::setDoubleClickToPlay(int _doubleClickToPlay) +void SettingsCache::setDoubleClickToPlay(QT_STATE_CHANGED_T _doubleClickToPlay) { doubleClickToPlay = static_cast(_doubleClickToPlay); settings->setValue("interface/doubleclicktoplay", doubleClickToPlay); } -void SettingsCache::setPlayToStack(int _playToStack) +void SettingsCache::setPlayToStack(QT_STATE_CHANGED_T _playToStack) { playToStack = static_cast(_playToStack); settings->setValue("interface/playtostack", playToStack); @@ -491,7 +491,7 @@ void SettingsCache::setStartingHandSize(int _startingHandSize) settings->setValue("interface/startinghandsize", startingHandSize); } -void SettingsCache::setAnnotateTokens(int _annotateTokens) +void SettingsCache::setAnnotateTokens(QT_STATE_CHANGED_T _annotateTokens) { annotateTokens = static_cast(_annotateTokens); settings->setValue("interface/annotatetokens", annotateTokens); @@ -503,21 +503,21 @@ void SettingsCache::setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSi settings->setValue("interface/tabgame_splittersizes", tabGameSplitterSizes); } -void SettingsCache::setDisplayCardNames(int _displayCardNames) +void SettingsCache::setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames) { displayCardNames = static_cast(_displayCardNames); settings->setValue("cards/displaycardnames", displayCardNames); emit displayCardNamesChanged(); } -void SettingsCache::setHorizontalHand(int _horizontalHand) +void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand) { horizontalHand = static_cast(_horizontalHand); settings->setValue("hand/horizontal", horizontalHand); emit horizontalHandChanged(); } -void SettingsCache::setInvertVerticalCoordinate(int _invertVerticalCoordinate) +void SettingsCache::setInvertVerticalCoordinate(QT_STATE_CHANGED_T _invertVerticalCoordinate) { invertVerticalCoordinate = static_cast(_invertVerticalCoordinate); settings->setValue("table/invert_vertical", invertVerticalCoordinate); @@ -531,32 +531,32 @@ void SettingsCache::setMinPlayersForMultiColumnLayout(int _minPlayersForMultiCol emit minPlayersForMultiColumnLayoutChanged(); } -void SettingsCache::setTapAnimation(int _tapAnimation) +void SettingsCache::setTapAnimation(QT_STATE_CHANGED_T _tapAnimation) { tapAnimation = static_cast(_tapAnimation); settings->setValue("cards/tapanimation", tapAnimation); } -void SettingsCache::setChatMention(int _chatMention) +void SettingsCache::setChatMention(QT_STATE_CHANGED_T _chatMention) { chatMention = static_cast(_chatMention); settings->setValue("chat/mention", chatMention); } -void SettingsCache::setChatMentionCompleter(const int _enableMentionCompleter) +void SettingsCache::setChatMentionCompleter(const QT_STATE_CHANGED_T _enableMentionCompleter) { chatMentionCompleter = (bool)_enableMentionCompleter; settings->setValue("chat/mentioncompleter", chatMentionCompleter); emit chatMentionCompleterChanged(); } -void SettingsCache::setChatMentionForeground(int _chatMentionForeground) +void SettingsCache::setChatMentionForeground(QT_STATE_CHANGED_T _chatMentionForeground) { chatMentionForeground = static_cast(_chatMentionForeground); settings->setValue("chat/mentionforeground", chatMentionForeground); } -void SettingsCache::setChatHighlightForeground(int _chatHighlightForeground) +void SettingsCache::setChatHighlightForeground(QT_STATE_CHANGED_T _chatHighlightForeground) { chatHighlightForeground = static_cast(_chatHighlightForeground); settings->setValue("chat/highlightforeground", chatHighlightForeground); @@ -574,25 +574,25 @@ void SettingsCache::setChatHighlightColor(const QString &_chatHighlightColor) settings->setValue("chat/highlightcolor", chatHighlightColor); } -void SettingsCache::setZoneViewSortByName(int _zoneViewSortByName) +void SettingsCache::setZoneViewSortByName(QT_STATE_CHANGED_T _zoneViewSortByName) { zoneViewSortByName = static_cast(_zoneViewSortByName); settings->setValue("zoneview/sortbyname", zoneViewSortByName); } -void SettingsCache::setZoneViewSortByType(int _zoneViewSortByType) +void SettingsCache::setZoneViewSortByType(QT_STATE_CHANGED_T _zoneViewSortByType) { zoneViewSortByType = static_cast(_zoneViewSortByType); settings->setValue("zoneview/sortbytype", zoneViewSortByType); } -void SettingsCache::setZoneViewPileView(int _zoneViewPileView) +void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T _zoneViewPileView) { zoneViewPileView = static_cast(_zoneViewPileView); settings->setValue("zoneview/pileview", zoneViewPileView); } -void SettingsCache::setSoundEnabled(int _soundEnabled) +void SettingsCache::setSoundEnabled(QT_STATE_CHANGED_T _soundEnabled) { soundEnabled = static_cast(_soundEnabled); settings->setValue("sound/enabled", soundEnabled); @@ -606,13 +606,13 @@ void SettingsCache::setSoundThemeName(const QString &_soundThemeName) emit soundThemeChanged(); } -void SettingsCache::setIgnoreUnregisteredUsers(int _ignoreUnregisteredUsers) +void SettingsCache::setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T _ignoreUnregisteredUsers) { ignoreUnregisteredUsers = static_cast(_ignoreUnregisteredUsers); settings->setValue("chat/ignore_unregistered", ignoreUnregisteredUsers); } -void SettingsCache::setIgnoreUnregisteredUserMessages(int _ignoreUnregisteredUserMessages) +void SettingsCache::setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignoreUnregisteredUserMessages) { ignoreUnregisteredUserMessages = static_cast(_ignoreUnregisteredUserMessages); settings->setValue("chat/ignore_unregistered_messages", ignoreUnregisteredUserMessages); @@ -985,13 +985,13 @@ void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings) settings->setValue("game/remembergamesettings", rememberGameSettings); } -void SettingsCache::setNotifyAboutUpdate(int _notifyaboutupdate) +void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate) { notifyAboutUpdates = static_cast(_notifyaboutupdate); settings->setValue("personal/updatenotification", notifyAboutUpdates); } -void SettingsCache::setNotifyAboutNewVersion(int _notifyaboutnewversion) +void SettingsCache::setNotifyAboutNewVersion(QT_STATE_CHANGED_T _notifyaboutnewversion) { notifyAboutNewVersion = static_cast(_notifyaboutnewversion); settings->setValue("personal/newversionnotification", notifyAboutNewVersion); diff --git a/cockatrice/src/settings/cache_settings.h b/cockatrice/src/settings/cache_settings.h index 3c7dd8e37..7742de3e8 100644 --- a/cockatrice/src/settings/cache_settings.h +++ b/cockatrice/src/settings/cache_settings.h @@ -1,6 +1,7 @@ #ifndef SETTINGSCACHE_H #define SETTINGSCACHE_H +#include "../utility/macros.h" #include "card_database_settings.h" #include "download_settings.h" #include "game_filters_settings.h" @@ -523,39 +524,39 @@ public slots: void setThemeName(const QString &_themeName); void setChatMentionColor(const QString &_chatMentionColor); void setChatHighlightColor(const QString &_chatHighlightColor); - void setPicDownload(int _picDownload); - void setNotificationsEnabled(int _notificationsEnabled); - void setSpectatorNotificationsEnabled(int _spectatorNotificationsEnabled); - void setBuddyConnectNotificationsEnabled(int _buddyConnectNotificationsEnabled); - void setDoubleClickToPlay(int _doubleClickToPlay); - void setPlayToStack(int _playToStack); + void setPicDownload(QT_STATE_CHANGED_T _picDownload); + void setNotificationsEnabled(QT_STATE_CHANGED_T _notificationsEnabled); + void setSpectatorNotificationsEnabled(QT_STATE_CHANGED_T _spectatorNotificationsEnabled); + void setBuddyConnectNotificationsEnabled(QT_STATE_CHANGED_T _buddyConnectNotificationsEnabled); + void setDoubleClickToPlay(QT_STATE_CHANGED_T _doubleClickToPlay); + void setPlayToStack(QT_STATE_CHANGED_T _playToStack); void setStartingHandSize(int _startingHandSize); - void setAnnotateTokens(int _annotateTokens); + void setAnnotateTokens(QT_STATE_CHANGED_T _annotateTokens); void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes); - void setDisplayCardNames(int _displayCardNames); - void setHorizontalHand(int _horizontalHand); - void setInvertVerticalCoordinate(int _invertVerticalCoordinate); + void setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames); + void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand); + void setInvertVerticalCoordinate(QT_STATE_CHANGED_T _invertVerticalCoordinate); void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout); - void setTapAnimation(int _tapAnimation); - void setChatMention(int _chatMention); - void setChatMentionCompleter(int _chatMentionCompleter); - void setChatMentionForeground(int _chatMentionForeground); - void setChatHighlightForeground(int _chatHighlightForeground); - void setZoneViewSortByName(int _zoneViewSortByName); - void setZoneViewSortByType(int _zoneViewSortByType); - void setZoneViewPileView(int _zoneViewPileView); - void setSoundEnabled(int _soundEnabled); + void setTapAnimation(QT_STATE_CHANGED_T _tapAnimation); + void setChatMention(QT_STATE_CHANGED_T _chatMention); + void setChatMentionCompleter(QT_STATE_CHANGED_T _chatMentionCompleter); + void setChatMentionForeground(QT_STATE_CHANGED_T _chatMentionForeground); + void setChatHighlightForeground(QT_STATE_CHANGED_T _chatHighlightForeground); + void setZoneViewSortByName(QT_STATE_CHANGED_T _zoneViewSortByName); + void setZoneViewSortByType(QT_STATE_CHANGED_T _zoneViewSortByType); + void setZoneViewPileView(QT_STATE_CHANGED_T _zoneViewPileView); + void setSoundEnabled(QT_STATE_CHANGED_T _soundEnabled); void setSoundThemeName(const QString &_soundThemeName); - void setIgnoreUnregisteredUsers(int _ignoreUnregisteredUsers); - void setIgnoreUnregisteredUserMessages(int _ignoreUnregisteredUserMessages); + void setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T _ignoreUnregisteredUsers); + void setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignoreUnregisteredUserMessages); void setPixmapCacheSize(const int _pixmapCacheSize); void setNetworkCacheSizeInMB(const int _networkCacheSize); - void setCardScaling(const int _scaleCards); + void setCardScaling(const QT_STATE_CHANGED_T _scaleCards); void setStackCardOverlapPercent(const int _verticalCardOverlapPercent); - void setShowMessagePopups(const int _showMessagePopups); - void setShowMentionPopups(const int _showMentionPopups); - void setRoomHistory(const int _roomHistory); - void setLeftJustified(const int _leftJustified); + void setShowMessagePopups(const QT_STATE_CHANGED_T _showMessagePopups); + void setShowMentionPopups(const QT_STATE_CHANGED_T _showMentionPopups); + void setRoomHistory(const QT_STATE_CHANGED_T _roomHistory); + void setLeftJustified(const QT_STATE_CHANGED_T _leftJustified); void setMasterVolume(const int _masterVolume); void setCardInfoViewMode(const int _viewMode); void setHighlightWords(const QString &_highlightWords); @@ -570,8 +571,8 @@ public slots: void setSpectatorsCanSeeEverything(const bool _spectatorsCanSeeEverything); void setCreateGameAsSpectator(const bool _createGameAsSpectator); void setRememberGameSettings(const bool _rememberGameSettings); - void setNotifyAboutUpdate(int _notifyaboutupdate); - void setNotifyAboutNewVersion(int _notifyaboutnewversion); + void setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate); + void setNotifyAboutNewVersion(QT_STATE_CHANGED_T _notifyaboutnewversion); void setUpdateReleaseChannel(int _updateReleaseChannel); void setMaxFontSize(int _max); }; diff --git a/cockatrice/src/utility/macros.h b/cockatrice/src/utility/macros.h new file mode 100644 index 000000000..1d7d6d632 --- /dev/null +++ b/cockatrice/src/utility/macros.h @@ -0,0 +1,17 @@ +#ifndef COCKATRICE_MACROS_H +#define COCKATRICE_MACROS_H + +#include + +// Qt6.7 changed how stateChanged functionality +// of QCheckBoxes work. +// See https://doc.qt.io/qt-6/qcheckbox.html#checkStateChanged +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) +#define QT_STATE_CHANGED checkStateChanged +#define QT_STATE_CHANGED_T Qt::CheckState +#else +#define QT_STATE_CHANGED stateChanged +#define QT_STATE_CHANGED_T int +#endif + +#endif // COCKATRICE_MACROS_H diff --git a/dbconverter/src/mocks.cpp b/dbconverter/src/mocks.cpp index 199e9f4d3..16c47f0a1 100644 --- a/dbconverter/src/mocks.cpp +++ b/dbconverter/src/mocks.cpp @@ -5,9 +5,15 @@ CardDatabaseSettings::CardDatabaseSettings(QString settingPath, QObject *parent) : SettingsManager(settingPath + "cardDatabase.ini", parent) { } -void CardDatabaseSettings::setSortKey(QString /* shortName */, unsigned int /* sortKey */){}; -void CardDatabaseSettings::setEnabled(QString /* shortName */, bool /* enabled */){}; -void CardDatabaseSettings::setIsKnown(QString /* shortName */, bool /* isknown */){}; +void CardDatabaseSettings::setSortKey(QString /* shortName */, unsigned int /* sortKey */) +{ +} +void CardDatabaseSettings::setEnabled(QString /* shortName */, bool /* enabled */) +{ +} +void CardDatabaseSettings::setIsKnown(QString /* shortName */, bool /* isknown */) +{ +} unsigned int CardDatabaseSettings::getSortKey(QString /* shortName */) { return 0; @@ -61,22 +67,22 @@ void SettingsCache::setHighlightWords(const QString & /* _highlightWords */) void SettingsCache::setMasterVolume(int /* _masterVolume */) { } -void SettingsCache::setLeftJustified(const int /* _leftJustified */) +void SettingsCache::setLeftJustified(const QT_STATE_CHANGED_T /* _leftJustified */) { } -void SettingsCache::setCardScaling(const int /* _scaleCards */) +void SettingsCache::setCardScaling(const QT_STATE_CHANGED_T /* _scaleCards */) { } void SettingsCache::setStackCardOverlapPercent(const int /* _verticalCardOverlapPercent */) { } -void SettingsCache::setShowMessagePopups(const int /* _showMessagePopups */) +void SettingsCache::setShowMessagePopups(const QT_STATE_CHANGED_T /* _showMessagePopups */) { } -void SettingsCache::setShowMentionPopups(const int /* _showMentionPopus */) +void SettingsCache::setShowMentionPopups(const QT_STATE_CHANGED_T /* _showMentionPopus */) { } -void SettingsCache::setRoomHistory(const int /* _roomHistory */) +void SettingsCache::setRoomHistory(const QT_STATE_CHANGED_T /* _roomHistory */) { } void SettingsCache::setLang(const QString & /* _lang */) @@ -115,58 +121,58 @@ void SettingsCache::setTokenDatabasePath(const QString & /* _tokenDatabasePath * void SettingsCache::setThemeName(const QString & /* _themeName */) { } -void SettingsCache::setPicDownload(int /* _picDownload */) +void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */) { } -void SettingsCache::setNotificationsEnabled(int /* _notificationsEnabled */) +void SettingsCache::setNotificationsEnabled(QT_STATE_CHANGED_T /* _notificationsEnabled */) { } -void SettingsCache::setSpectatorNotificationsEnabled(int /* _spectatorNotificationsEnabled */) +void SettingsCache::setSpectatorNotificationsEnabled(QT_STATE_CHANGED_T /* _spectatorNotificationsEnabled */) { } -void SettingsCache::setBuddyConnectNotificationsEnabled(int /* _buddyConnectNotificationsEnabled */) +void SettingsCache::setBuddyConnectNotificationsEnabled(QT_STATE_CHANGED_T /* _buddyConnectNotificationsEnabled */) { } -void SettingsCache::setDoubleClickToPlay(int /* _doubleClickToPlay */) +void SettingsCache::setDoubleClickToPlay(QT_STATE_CHANGED_T /* _doubleClickToPlay */) { } -void SettingsCache::setPlayToStack(int /* _playToStack */) +void SettingsCache::setPlayToStack(QT_STATE_CHANGED_T /* _playToStack */) { } void SettingsCache::setStartingHandSize(int /* _startingHandSize */) { } -void SettingsCache::setAnnotateTokens(int /* _annotateTokens */) +void SettingsCache::setAnnotateTokens(QT_STATE_CHANGED_T /* _annotateTokens */) { } void SettingsCache::setTabGameSplitterSizes(const QByteArray & /* _tabGameSplitterSizes */) { } -void SettingsCache::setDisplayCardNames(int /* _displayCardNames */) +void SettingsCache::setDisplayCardNames(QT_STATE_CHANGED_T /* _displayCardNames */) { } -void SettingsCache::setHorizontalHand(int /* _horizontalHand */) +void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T /* _horizontalHand */) { } -void SettingsCache::setInvertVerticalCoordinate(int /* _invertVerticalCoordinate */) +void SettingsCache::setInvertVerticalCoordinate(QT_STATE_CHANGED_T /* _invertVerticalCoordinate */) { } void SettingsCache::setMinPlayersForMultiColumnLayout(int /* _minPlayersForMultiColumnLayout */) { } -void SettingsCache::setTapAnimation(int /* _tapAnimation */) +void SettingsCache::setTapAnimation(QT_STATE_CHANGED_T /* _tapAnimation */) { } -void SettingsCache::setChatMention(int /* _chatMention */) +void SettingsCache::setChatMention(QT_STATE_CHANGED_T /* _chatMention */) { } -void SettingsCache::setChatMentionCompleter(const int /* _enableMentionCompleter */) +void SettingsCache::setChatMentionCompleter(const QT_STATE_CHANGED_T /* _enableMentionCompleter */) { } -void SettingsCache::setChatMentionForeground(int /* _chatMentionForeground */) +void SettingsCache::setChatMentionForeground(QT_STATE_CHANGED_T /* _chatMentionForeground */) { } -void SettingsCache::setChatHighlightForeground(int /* _chatHighlightForeground */) +void SettingsCache::setChatHighlightForeground(QT_STATE_CHANGED_T /* _chatHighlightForeground */) { } void SettingsCache::setChatMentionColor(const QString & /* _chatMentionColor */) @@ -175,25 +181,25 @@ void SettingsCache::setChatMentionColor(const QString & /* _chatMentionColor */) void SettingsCache::setChatHighlightColor(const QString & /* _chatHighlightColor */) { } -void SettingsCache::setZoneViewSortByName(int /* _zoneViewSortByName */) +void SettingsCache::setZoneViewSortByName(QT_STATE_CHANGED_T /* _zoneViewSortByName */) { } -void SettingsCache::setZoneViewSortByType(int /* _zoneViewSortByType */) +void SettingsCache::setZoneViewSortByType(QT_STATE_CHANGED_T /* _zoneViewSortByType */) { } -void SettingsCache::setZoneViewPileView(int /* _zoneViewPileView */) +void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T /* _zoneViewPileView */) { } -void SettingsCache::setSoundEnabled(int /* _soundEnabled */) +void SettingsCache::setSoundEnabled(QT_STATE_CHANGED_T /* _soundEnabled */) { } void SettingsCache::setSoundThemeName(const QString & /* _soundThemeName */) { } -void SettingsCache::setIgnoreUnregisteredUsers(int /* _ignoreUnregisteredUsers */) +void SettingsCache::setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T /* _ignoreUnregisteredUsers */) { } -void SettingsCache::setIgnoreUnregisteredUserMessages(int /* _ignoreUnregisteredUserMessages */) +void SettingsCache::setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T /* _ignoreUnregisteredUserMessages */) { } void SettingsCache::setMainWindowGeometry(const QByteArray & /* _mainWindowGeometry */) @@ -255,10 +261,10 @@ void SettingsCache::setCreateGameAsSpectator(const bool /* _createGameAsSpectato void SettingsCache::setRememberGameSettings(const bool /* _rememberGameSettings */) { } -void SettingsCache::setNotifyAboutUpdate(int /* _notifyaboutupdate */) +void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T /* _notifyaboutupdate */) { } -void SettingsCache::setNotifyAboutNewVersion(int /* _notifyaboutnewversion */) +void SettingsCache::setNotifyAboutNewVersion(QT_STATE_CHANGED_T /* _notifyaboutnewversion */) { } void SettingsCache::setDownloadSpoilerStatus(bool /* _spoilerStatus */) diff --git a/dbconverter/src/mocks.h b/dbconverter/src/mocks.h index d513ca03b..bcbaf0342 100644 --- a/dbconverter/src/mocks.h +++ b/dbconverter/src/mocks.h @@ -12,6 +12,7 @@ #include "../cockatrice/src/game/cards/card_database.h" #include "../cockatrice/src/settings/cache_settings.h" +#include "../cockatrice/src/utility/macros.h" extern SettingsCache *settingsCache; diff --git a/tests/carddatabase/mocks.cpp b/tests/carddatabase/mocks.cpp index fddee9b8c..c3b41037d 100644 --- a/tests/carddatabase/mocks.cpp +++ b/tests/carddatabase/mocks.cpp @@ -5,9 +5,15 @@ CardDatabaseSettings::CardDatabaseSettings(QString settingPath, QObject *parent) : SettingsManager(settingPath + "cardDatabase.ini", parent) { } -void CardDatabaseSettings::setSortKey(QString /* shortName */, unsigned int /* sortKey */){}; -void CardDatabaseSettings::setEnabled(QString /* shortName */, bool /* enabled */){}; -void CardDatabaseSettings::setIsKnown(QString /* shortName */, bool /* isknown */){}; +void CardDatabaseSettings::setSortKey(QString /* shortName */, unsigned int /* sortKey */) +{ +} +void CardDatabaseSettings::setEnabled(QString /* shortName */, bool /* enabled */) +{ +} +void CardDatabaseSettings::setIsKnown(QString /* shortName */, bool /* isknown */) +{ +} unsigned int CardDatabaseSettings::getSortKey(QString /* shortName */) { return 0; @@ -65,22 +71,22 @@ void SettingsCache::setHighlightWords(const QString & /* _highlightWords */) void SettingsCache::setMasterVolume(int /* _masterVolume */) { } -void SettingsCache::setLeftJustified(const int /* _leftJustified */) +void SettingsCache::setLeftJustified(const QT_STATE_CHANGED_T /* _leftJustified */) { } -void SettingsCache::setCardScaling(const int /* _scaleCards */) +void SettingsCache::setCardScaling(const QT_STATE_CHANGED_T /* _scaleCards */) { } void SettingsCache::setStackCardOverlapPercent(const int /* _verticalCardOverlapPercent */) { } -void SettingsCache::setShowMessagePopups(const int /* _showMessagePopups */) +void SettingsCache::setShowMessagePopups(const QT_STATE_CHANGED_T /* _showMessagePopups */) { } -void SettingsCache::setShowMentionPopups(const int /* _showMentionPopus */) +void SettingsCache::setShowMentionPopups(const QT_STATE_CHANGED_T /* _showMentionPopus */) { } -void SettingsCache::setRoomHistory(const int /* _roomHistory */) +void SettingsCache::setRoomHistory(const QT_STATE_CHANGED_T /* _roomHistory */) { } void SettingsCache::setLang(const QString & /* _lang */) @@ -119,58 +125,58 @@ void SettingsCache::setTokenDatabasePath(const QString & /* _tokenDatabasePath * void SettingsCache::setThemeName(const QString & /* _themeName */) { } -void SettingsCache::setPicDownload(int /* _picDownload */) +void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */) { } -void SettingsCache::setNotificationsEnabled(int /* _notificationsEnabled */) +void SettingsCache::setNotificationsEnabled(QT_STATE_CHANGED_T /* _notificationsEnabled */) { } -void SettingsCache::setSpectatorNotificationsEnabled(int /* _spectatorNotificationsEnabled */) +void SettingsCache::setSpectatorNotificationsEnabled(QT_STATE_CHANGED_T /* _spectatorNotificationsEnabled */) { } -void SettingsCache::setBuddyConnectNotificationsEnabled(int /* _buddyConnectNotificationsEnabled */) +void SettingsCache::setBuddyConnectNotificationsEnabled(QT_STATE_CHANGED_T /* _buddyConnectNotificationsEnabled */) { } -void SettingsCache::setDoubleClickToPlay(int /* _doubleClickToPlay */) +void SettingsCache::setDoubleClickToPlay(QT_STATE_CHANGED_T /* _doubleClickToPlay */) { } -void SettingsCache::setPlayToStack(int /* _playToStack */) +void SettingsCache::setPlayToStack(QT_STATE_CHANGED_T /* _playToStack */) { } void SettingsCache::setStartingHandSize(int /* _startingHandSize */) { } -void SettingsCache::setAnnotateTokens(int /* _annotateTokens */) +void SettingsCache::setAnnotateTokens(QT_STATE_CHANGED_T /* _annotateTokens */) { } void SettingsCache::setTabGameSplitterSizes(const QByteArray & /* _tabGameSplitterSizes */) { } -void SettingsCache::setDisplayCardNames(int /* _displayCardNames */) +void SettingsCache::setDisplayCardNames(QT_STATE_CHANGED_T /* _displayCardNames */) { } -void SettingsCache::setHorizontalHand(int /* _horizontalHand */) +void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T /* _horizontalHand */) { } -void SettingsCache::setInvertVerticalCoordinate(int /* _invertVerticalCoordinate */) +void SettingsCache::setInvertVerticalCoordinate(QT_STATE_CHANGED_T /* _invertVerticalCoordinate */) { } void SettingsCache::setMinPlayersForMultiColumnLayout(int /* _minPlayersForMultiColumnLayout */) { } -void SettingsCache::setTapAnimation(int /* _tapAnimation */) +void SettingsCache::setTapAnimation(QT_STATE_CHANGED_T /* _tapAnimation */) { } -void SettingsCache::setChatMention(int /* _chatMention */) +void SettingsCache::setChatMention(QT_STATE_CHANGED_T /* _chatMention */) { } -void SettingsCache::setChatMentionCompleter(const int /* _enableMentionCompleter */) +void SettingsCache::setChatMentionCompleter(const QT_STATE_CHANGED_T /* _enableMentionCompleter */) { } -void SettingsCache::setChatMentionForeground(int /* _chatMentionForeground */) +void SettingsCache::setChatMentionForeground(QT_STATE_CHANGED_T /* _chatMentionForeground */) { } -void SettingsCache::setChatHighlightForeground(int /* _chatHighlightForeground */) +void SettingsCache::setChatHighlightForeground(QT_STATE_CHANGED_T /* _chatHighlightForeground */) { } void SettingsCache::setChatMentionColor(const QString & /* _chatMentionColor */) @@ -179,25 +185,25 @@ void SettingsCache::setChatMentionColor(const QString & /* _chatMentionColor */) void SettingsCache::setChatHighlightColor(const QString & /* _chatHighlightColor */) { } -void SettingsCache::setZoneViewSortByName(int /* _zoneViewSortByName */) +void SettingsCache::setZoneViewSortByName(QT_STATE_CHANGED_T /* _zoneViewSortByName */) { } -void SettingsCache::setZoneViewSortByType(int /* _zoneViewSortByType */) +void SettingsCache::setZoneViewSortByType(QT_STATE_CHANGED_T /* _zoneViewSortByType */) { } -void SettingsCache::setZoneViewPileView(int /* _zoneViewPileView */) +void SettingsCache::setZoneViewPileView(QT_STATE_CHANGED_T /* _zoneViewPileView */) { } -void SettingsCache::setSoundEnabled(int /* _soundEnabled */) +void SettingsCache::setSoundEnabled(QT_STATE_CHANGED_T /* _soundEnabled */) { } void SettingsCache::setSoundThemeName(const QString & /* _soundThemeName */) { } -void SettingsCache::setIgnoreUnregisteredUsers(int /* _ignoreUnregisteredUsers */) +void SettingsCache::setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T /* _ignoreUnregisteredUsers */) { } -void SettingsCache::setIgnoreUnregisteredUserMessages(int /* _ignoreUnregisteredUserMessages */) +void SettingsCache::setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T /* _ignoreUnregisteredUserMessages */) { } void SettingsCache::setMainWindowGeometry(const QByteArray & /* _mainWindowGeometry */) @@ -259,10 +265,10 @@ void SettingsCache::setCreateGameAsSpectator(const bool /* _createGameAsSpectato void SettingsCache::setRememberGameSettings(const bool /* _rememberGameSettings */) { } -void SettingsCache::setNotifyAboutUpdate(int /* _notifyaboutupdate */) +void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T /* _notifyaboutupdate */) { } -void SettingsCache::setNotifyAboutNewVersion(int /* _notifyaboutnewversion */) +void SettingsCache::setNotifyAboutNewVersion(QT_STATE_CHANGED_T /* _notifyaboutnewversion */) { } void SettingsCache::setDownloadSpoilerStatus(bool /* _spoilerStatus */) diff --git a/tests/carddatabase/mocks.h b/tests/carddatabase/mocks.h index 50b8616e2..88a8d2d8a 100644 --- a/tests/carddatabase/mocks.h +++ b/tests/carddatabase/mocks.h @@ -12,6 +12,7 @@ #include "../../cockatrice/src/game/cards/card_database.h" #include "../../cockatrice/src/settings/cache_settings.h" +#include "../cockatrice/src/utility/macros.h" extern SettingsCache *settingsCache;