fix qt 6.10 debug build (#6271)

* fix qt 6.10 build

* fix games model parameter order and correct parameter names

* add missing include for qt5
This commit is contained in:
ebbit1q 2025-11-05 12:10:36 +01:00 committed by GitHub
parent 1c209b3320
commit d914667238
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 89 additions and 160 deletions

View file

@ -155,22 +155,13 @@ void GameSelector::actSetFilter()
if (!dlg.exec()) if (!dlg.exec())
return; return;
gameListProxyModel->setHideBuddiesOnlyGames(dlg.getHideBuddiesOnlyGames()); gameListProxyModel->setGameFilters(
gameListProxyModel->setHideFullGames(dlg.getHideFullGames()); dlg.getHideBuddiesOnlyGames(), dlg.getHideIgnoredUserGames(), dlg.getHideFullGames(),
gameListProxyModel->setHideGamesThatStarted(dlg.getHideGamesThatStarted()); dlg.getHideGamesThatStarted(), dlg.getHidePasswordProtectedGames(), dlg.getHideNotBuddyCreatedGames(),
gameListProxyModel->setHidePasswordProtectedGames(dlg.getHidePasswordProtectedGames()); dlg.getHideOpenDecklistGames(), dlg.getGameNameFilter(), dlg.getCreatorNameFilter(), dlg.getGameTypeFilter(),
gameListProxyModel->setHideIgnoredUserGames(dlg.getHideIgnoredUserGames()); dlg.getMaxPlayersFilterMin(), dlg.getMaxPlayersFilterMax(), dlg.getMaxGameAge(),
gameListProxyModel->setHideNotBuddyCreatedGames(dlg.getHideNotBuddyCreatedGames()); dlg.getShowOnlyIfSpectatorsCanWatch(), dlg.getShowSpectatorPasswordProtected(),
gameListProxyModel->setHideOpenDecklistGames(dlg.getHideOpenDecklistGames()); dlg.getShowOnlyIfSpectatorsCanChat(), dlg.getShowOnlyIfSpectatorsCanSeeHands());
gameListProxyModel->setGameNameFilter(dlg.getGameNameFilter());
gameListProxyModel->setCreatorNameFilter(dlg.getCreatorNameFilter());
gameListProxyModel->setGameTypeFilter(dlg.getGameTypeFilter());
gameListProxyModel->setMaxPlayersFilter(dlg.getMaxPlayersFilterMin(), dlg.getMaxPlayersFilterMax());
gameListProxyModel->setMaxGameAge(dlg.getMaxGameAge());
gameListProxyModel->setShowOnlyIfSpectatorsCanWatch(dlg.getShowOnlyIfSpectatorsCanWatch());
gameListProxyModel->setShowSpectatorPasswordProtected(dlg.getShowSpectatorPasswordProtected());
gameListProxyModel->setShowOnlyIfSpectatorsCanChat(dlg.getShowOnlyIfSpectatorsCanChat());
gameListProxyModel->setShowOnlyIfSpectatorsCanSeeHands(dlg.getShowOnlyIfSpectatorsCanSeeHands());
gameListProxyModel->saveFilterParameters(gameTypeMap); gameListProxyModel->saveFilterParameters(gameTypeMap);
clearFilterButton->setEnabled(!gameListProxyModel->areFilterParametersSetToDefaults()); clearFilterButton->setEnabled(!gameListProxyModel->areFilterParametersSetToDefaults());

View file

@ -286,101 +286,49 @@ GamesProxyModel::GamesProxyModel(QObject *parent, const UserListProxy *_userList
setDynamicSortFilter(true); setDynamicSortFilter(true);
} }
void GamesProxyModel::setHideBuddiesOnlyGames(bool _showBuddiesOnlyGames) void GamesProxyModel::setGameFilters(bool _hideBuddiesOnlyGames,
{ bool _hideIgnoredUserGames,
hideBuddiesOnlyGames = _showBuddiesOnlyGames; bool _hideFullGames,
invalidateFilter(); bool _hideGamesThatStarted,
} bool _hidePasswordProtectedGames,
bool _hideNotBuddyCreatedGames,
void GamesProxyModel::setHideIgnoredUserGames(bool _hideIgnoredUserGames) bool _hideOpenDecklistGames,
const QString &_gameNameFilter,
const QString &_creatorNameFilter,
const QSet<int> &_gameTypeFilter,
int _maxPlayersFilterMin,
int _maxPlayersFilterMax,
const QTime &_maxGameAge,
bool _showOnlyIfSpectatorsCanWatch,
bool _showSpectatorPasswordProtected,
bool _showOnlyIfSpectatorsCanChat,
bool _showOnlyIfSpectatorsCanSeeHands)
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0))
beginFilterChange();
#endif
hideBuddiesOnlyGames = _hideBuddiesOnlyGames;
hideIgnoredUserGames = _hideIgnoredUserGames; hideIgnoredUserGames = _hideIgnoredUserGames;
invalidateFilter(); hideFullGames = _hideFullGames;
} hideGamesThatStarted = _hideGamesThatStarted;
hidePasswordProtectedGames = _hidePasswordProtectedGames;
void GamesProxyModel::setHideFullGames(bool _showFullGames) hideNotBuddyCreatedGames = _hideNotBuddyCreatedGames;
{
hideFullGames = _showFullGames;
invalidateFilter();
}
void GamesProxyModel::setHideGamesThatStarted(bool _showGamesThatStarted)
{
hideGamesThatStarted = _showGamesThatStarted;
invalidateFilter();
}
void GamesProxyModel::setHidePasswordProtectedGames(bool _showPasswordProtectedGames)
{
hidePasswordProtectedGames = _showPasswordProtectedGames;
invalidateFilter();
}
void GamesProxyModel::setHideNotBuddyCreatedGames(bool value)
{
hideNotBuddyCreatedGames = value;
invalidateFilter();
}
void GamesProxyModel::setHideOpenDecklistGames(bool _hideOpenDecklistGames)
{
hideOpenDecklistGames = _hideOpenDecklistGames; hideOpenDecklistGames = _hideOpenDecklistGames;
invalidateFilter();
}
void GamesProxyModel::setGameNameFilter(const QString &_gameNameFilter)
{
gameNameFilter = _gameNameFilter; gameNameFilter = _gameNameFilter;
invalidateFilter();
}
void GamesProxyModel::setCreatorNameFilter(const QString &_creatorNameFilter)
{
creatorNameFilter = _creatorNameFilter; creatorNameFilter = _creatorNameFilter;
invalidateFilter();
}
void GamesProxyModel::setGameTypeFilter(const QSet<int> &_gameTypeFilter)
{
gameTypeFilter = _gameTypeFilter; gameTypeFilter = _gameTypeFilter;
invalidateFilter();
}
void GamesProxyModel::setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax)
{
maxPlayersFilterMin = _maxPlayersFilterMin; maxPlayersFilterMin = _maxPlayersFilterMin;
maxPlayersFilterMax = _maxPlayersFilterMax; maxPlayersFilterMax = _maxPlayersFilterMax;
invalidateFilter();
}
void GamesProxyModel::setMaxGameAge(const QTime &_maxGameAge)
{
maxGameAge = _maxGameAge; maxGameAge = _maxGameAge;
invalidateFilter();
}
void GamesProxyModel::setShowOnlyIfSpectatorsCanWatch(bool _showOnlyIfSpectatorsCanWatch)
{
showOnlyIfSpectatorsCanWatch = _showOnlyIfSpectatorsCanWatch; showOnlyIfSpectatorsCanWatch = _showOnlyIfSpectatorsCanWatch;
invalidateFilter();
}
void GamesProxyModel::setShowSpectatorPasswordProtected(bool _showSpectatorPasswordProtected)
{
showSpectatorPasswordProtected = _showSpectatorPasswordProtected; showSpectatorPasswordProtected = _showSpectatorPasswordProtected;
invalidateFilter();
}
void GamesProxyModel::setShowOnlyIfSpectatorsCanChat(bool _showOnlyIfSpectatorsCanChat)
{
showOnlyIfSpectatorsCanChat = _showOnlyIfSpectatorsCanChat; showOnlyIfSpectatorsCanChat = _showOnlyIfSpectatorsCanChat;
invalidateFilter();
}
void GamesProxyModel::setShowOnlyIfSpectatorsCanSeeHands(bool _showOnlyIfSpectatorsCanSeeHands)
{
showOnlyIfSpectatorsCanSeeHands = _showOnlyIfSpectatorsCanSeeHands; showOnlyIfSpectatorsCanSeeHands = _showOnlyIfSpectatorsCanSeeHands;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0))
endFilterChange(QSortFilterProxyModel::Direction::Rows);
#else
invalidateFilter(); invalidateFilter();
#endif
} }
int GamesProxyModel::getNumFilteredGames() const int GamesProxyModel::getNumFilteredGames() const
@ -400,25 +348,8 @@ int GamesProxyModel::getNumFilteredGames() const
void GamesProxyModel::resetFilterParameters() void GamesProxyModel::resetFilterParameters()
{ {
hideFullGames = false; setGameFilters(false, false, false, false, false, false, false, QString(), QString(), {}, DEFAULT_MAX_PLAYERS_MIN,
hideGamesThatStarted = false; DEFAULT_MAX_PLAYERS_MAX, DEFAULT_MAX_GAME_AGE, false, false, false, false);
hidePasswordProtectedGames = false;
hideBuddiesOnlyGames = false;
hideIgnoredUserGames = false;
hideNotBuddyCreatedGames = false;
hideOpenDecklistGames = false;
gameNameFilter = QString();
creatorNameFilter = QString();
gameTypeFilter.clear();
maxPlayersFilterMin = DEFAULT_MAX_PLAYERS_MIN;
maxPlayersFilterMax = DEFAULT_MAX_PLAYERS_MAX;
maxGameAge = DEFAULT_MAX_GAME_AGE;
showOnlyIfSpectatorsCanWatch = false;
showSpectatorPasswordProtected = false;
showOnlyIfSpectatorsCanChat = false;
showOnlyIfSpectatorsCanSeeHands = false;
invalidateFilter();
} }
bool GamesProxyModel::areFilterParametersSetToDefaults() const bool GamesProxyModel::areFilterParametersSetToDefaults() const
@ -434,32 +365,24 @@ bool GamesProxyModel::areFilterParametersSetToDefaults() const
void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameTypes) void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameTypes)
{ {
GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters(); GameFiltersSettings &gameFilters = SettingsCache::instance().gameFilters();
hideFullGames = gameFilters.isHideFullGames();
hideGamesThatStarted = gameFilters.isHideGamesThatStarted();
hidePasswordProtectedGames = gameFilters.isHidePasswordProtectedGames();
hideIgnoredUserGames = gameFilters.isHideIgnoredUserGames();
hideBuddiesOnlyGames = gameFilters.isHideBuddiesOnlyGames();
hideNotBuddyCreatedGames = gameFilters.isHideNotBuddyCreatedGames();
hideOpenDecklistGames = gameFilters.isHideOpenDecklistGames();
gameNameFilter = gameFilters.getGameNameFilter();
creatorNameFilter = gameFilters.getCreatorNameFilter();
maxPlayersFilterMin = gameFilters.getMinPlayers();
maxPlayersFilterMax = gameFilters.getMaxPlayers();
maxGameAge = gameFilters.getMaxGameAge();
showOnlyIfSpectatorsCanWatch = gameFilters.isShowOnlyIfSpectatorsCanWatch();
showSpectatorPasswordProtected = gameFilters.isShowSpectatorPasswordProtected();
showOnlyIfSpectatorsCanChat = gameFilters.isShowOnlyIfSpectatorsCanChat();
showOnlyIfSpectatorsCanSeeHands = gameFilters.isShowOnlyIfSpectatorsCanSeeHands();
QSet<int> newGameTypeFilter;
QMapIterator<int, QString> gameTypesIterator(allGameTypes); QMapIterator<int, QString> gameTypesIterator(allGameTypes);
while (gameTypesIterator.hasNext()) { while (gameTypesIterator.hasNext()) {
gameTypesIterator.next(); gameTypesIterator.next();
if (gameFilters.isGameTypeEnabled(gameTypesIterator.value())) { if (gameFilters.isGameTypeEnabled(gameTypesIterator.value())) {
gameTypeFilter.insert(gameTypesIterator.key()); newGameTypeFilter.insert(gameTypesIterator.key());
} }
} }
invalidateFilter(); setGameFilters(gameFilters.isHideBuddiesOnlyGames(), gameFilters.isHideIgnoredUserGames(),
gameFilters.isHideFullGames(), gameFilters.isHideGamesThatStarted(),
gameFilters.isHidePasswordProtectedGames(), gameFilters.isHideNotBuddyCreatedGames(),
gameFilters.isHideOpenDecklistGames(), gameFilters.getGameNameFilter(),
gameFilters.getCreatorNameFilter(), newGameTypeFilter, gameFilters.getMinPlayers(),
gameFilters.getMaxPlayers(), gameFilters.getMaxGameAge(),
gameFilters.isShowOnlyIfSpectatorsCanWatch(), gameFilters.isShowSpectatorPasswordProtected(),
gameFilters.isShowOnlyIfSpectatorsCanChat(), gameFilters.isShowOnlyIfSpectatorsCanSeeHands());
} }
void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameTypes) void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameTypes)
@ -577,5 +500,9 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow) const
void GamesProxyModel::refresh() void GamesProxyModel::refresh()
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0))
endFilterChange(QSortFilterProxyModel::Direction::Rows);
#else
invalidateFilter(); invalidateFilter();
#endif
} }

View file

@ -102,52 +102,42 @@ public:
{ {
return hideBuddiesOnlyGames; return hideBuddiesOnlyGames;
} }
void setHideBuddiesOnlyGames(bool _showBuddiesOnlyGames);
bool getHideIgnoredUserGames() const bool getHideIgnoredUserGames() const
{ {
return hideIgnoredUserGames; return hideIgnoredUserGames;
} }
void setHideIgnoredUserGames(bool _hideIgnoredUserGames);
bool getHideFullGames() const bool getHideFullGames() const
{ {
return hideFullGames; return hideFullGames;
} }
void setHideFullGames(bool _showFullGames);
bool getHideGamesThatStarted() const bool getHideGamesThatStarted() const
{ {
return hideGamesThatStarted; return hideGamesThatStarted;
} }
void setHideGamesThatStarted(bool _showGamesThatStarted);
bool getHidePasswordProtectedGames() const bool getHidePasswordProtectedGames() const
{ {
return hidePasswordProtectedGames; return hidePasswordProtectedGames;
} }
void setHidePasswordProtectedGames(bool _showPasswordProtectedGames);
bool getHideNotBuddyCreatedGames() const bool getHideNotBuddyCreatedGames() const
{ {
return hideNotBuddyCreatedGames; return hideNotBuddyCreatedGames;
} }
void setHideNotBuddyCreatedGames(bool value);
bool getHideOpenDecklistGames() const bool getHideOpenDecklistGames() const
{ {
return hideOpenDecklistGames; return hideOpenDecklistGames;
} }
void setHideOpenDecklistGames(bool _hideOpenDecklistGames);
QString getGameNameFilter() const QString getGameNameFilter() const
{ {
return gameNameFilter; return gameNameFilter;
} }
void setGameNameFilter(const QString &_gameNameFilter);
QString getCreatorNameFilter() const QString getCreatorNameFilter() const
{ {
return creatorNameFilter; return creatorNameFilter;
} }
void setCreatorNameFilter(const QString &_creatorNameFilter);
QSet<int> getGameTypeFilter() const QSet<int> getGameTypeFilter() const
{ {
return gameTypeFilter; return gameTypeFilter;
} }
void setGameTypeFilter(const QSet<int> &_gameTypeFilter);
int getMaxPlayersFilterMin() const int getMaxPlayersFilterMin() const
{ {
return maxPlayersFilterMin; return maxPlayersFilterMin;
@ -156,32 +146,43 @@ public:
{ {
return maxPlayersFilterMax; return maxPlayersFilterMax;
} }
void setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax);
const QTime &getMaxGameAge() const const QTime &getMaxGameAge() const
{ {
return maxGameAge; return maxGameAge;
} }
void setMaxGameAge(const QTime &_maxGameAge);
bool getShowOnlyIfSpectatorsCanWatch() const bool getShowOnlyIfSpectatorsCanWatch() const
{ {
return showOnlyIfSpectatorsCanWatch; return showOnlyIfSpectatorsCanWatch;
} }
void setShowOnlyIfSpectatorsCanWatch(bool _showOnlyIfSpectatorsCanWatch);
bool getShowSpectatorPasswordProtected() const bool getShowSpectatorPasswordProtected() const
{ {
return showSpectatorPasswordProtected; return showSpectatorPasswordProtected;
} }
void setShowSpectatorPasswordProtected(bool _showSpectatorPasswordProtected);
bool getShowOnlyIfSpectatorsCanChat() const bool getShowOnlyIfSpectatorsCanChat() const
{ {
return showOnlyIfSpectatorsCanChat; return showOnlyIfSpectatorsCanChat;
} }
void setShowOnlyIfSpectatorsCanChat(bool _showOnlyIfSpectatorsCanChat);
bool getShowOnlyIfSpectatorsCanSeeHands() const bool getShowOnlyIfSpectatorsCanSeeHands() const
{ {
return showOnlyIfSpectatorsCanSeeHands; return showOnlyIfSpectatorsCanSeeHands;
} }
void setShowOnlyIfSpectatorsCanSeeHands(bool _showOnlyIfSpectatorsCanSeeHands); void setGameFilters(bool _hideBuddiesOnlyGames,
bool _hideIgnoredUserGames,
bool _hideFullGames,
bool _hideGamesThatStarted,
bool _hidePasswordProtectedGames,
bool _hideNotBuddyCreatedGames,
bool _hideOpenDecklistGames,
const QString &_gameNameFilter,
const QString &_creatorNameFilter,
const QSet<int> &_gameTypeFilter,
int _maxPlayersFilterMin,
int _maxPlayersFilterMax,
const QTime &_maxGameAge,
bool _showOnlyIfSpectatorsCanWatch,
bool _showSpectatorPasswordProtected,
bool _showOnlyIfSpectatorsCanChat,
bool _showOnlyIfSpectatorsCanSeeHands);
int getNumFilteredGames() const; int getNumFilteredGames() const;
void resetFilterParameters(); void resetFilterParameters();

View file

@ -440,7 +440,10 @@ void TabReplays::downloadFinished(const Response &r,
const std::string &_data = resp.replay_data(); const std::string &_data = resp.replay_data();
QFile f(filePath); QFile f(filePath);
f.open(QIODevice::WriteOnly); if (!f.open(QIODevice::WriteOnly)) {
qWarning() << "failed to open" << filePath << "for writing after downloading replay";
return;
}
f.write((const char *)_data.data(), _data.size()); f.write((const char *)_data.data(), _data.size());
f.close(); f.close();
} }

View file

@ -36,8 +36,7 @@ CardDatabaseLoader::~CardDatabaseLoader()
LoadStatus CardDatabaseLoader::loadFromFile(const QString &fileName) LoadStatus CardDatabaseLoader::loadFromFile(const QString &fileName)
{ {
QFile file(fileName); QFile file(fileName);
file.open(QIODevice::ReadOnly); if (!file.open(QIODevice::ReadOnly)) {
if (!file.isOpen()) {
return FileError; return FileError;
} }

View file

@ -184,13 +184,20 @@ bool CardDatabaseDisplayModel::rowMatchesCardName(CardInfoPtr info) const
void CardDatabaseDisplayModel::clearFilterAll() void CardDatabaseDisplayModel::clearFilterAll()
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0))
beginFilterChange();
#endif
cardName.clear(); cardName.clear();
cardText.clear(); cardText.clear();
cardTypes.clear(); cardTypes.clear();
cardColors.clear(); cardColors.clear();
if (filterTree != nullptr) if (filterTree != nullptr)
filterTree->clear(); filterTree->clear();
#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0))
endFilterChange(QSortFilterProxyModel::Direction::Rows);
#else
invalidateFilter(); invalidateFilter();
#endif
} }
void CardDatabaseDisplayModel::setFilterTree(FilterTree *_filterTree) void CardDatabaseDisplayModel::setFilterTree(FilterTree *_filterTree)

View file

@ -22,7 +22,6 @@ public:
bool isHidePasswordProtectedGames(); bool isHidePasswordProtectedGames();
bool isHideIgnoredUserGames(); bool isHideIgnoredUserGames();
bool isHideNotBuddyCreatedGames(); bool isHideNotBuddyCreatedGames();
void setHideOpenDecklistGames(bool hide);
bool isHideOpenDecklistGames(); bool isHideOpenDecklistGames();
QString getGameNameFilter(); QString getGameNameFilter();
QString getCreatorNameFilter(); QString getCreatorNameFilter();
@ -37,6 +36,7 @@ public:
void setHideBuddiesOnlyGames(bool hide); void setHideBuddiesOnlyGames(bool hide);
void setHideIgnoredUserGames(bool hide); void setHideIgnoredUserGames(bool hide);
void setHideOpenDecklistGames(bool hide);
void setHideFullGames(bool hide); void setHideFullGames(bool hide);
void setHideGamesThatStarted(bool hide); void setHideGamesThatStarted(bool hide);
void setHidePasswordProtectedGames(bool hide); void setHidePasswordProtectedGames(bool hide);
@ -52,9 +52,6 @@ public:
void setShowSpectatorPasswordProtected(bool show); void setShowSpectatorPasswordProtected(bool show);
void setShowOnlyIfSpectatorsCanChat(bool show); void setShowOnlyIfSpectatorsCanChat(bool show);
void setShowOnlyIfSpectatorsCanSeeHands(bool show); void setShowOnlyIfSpectatorsCanSeeHands(bool show);
signals:
public slots:
private: private:
explicit GameFiltersSettings(const QString &settingPath, QObject *parent = nullptr); explicit GameFiltersSettings(const QString &settingPath, QObject *parent = nullptr);

View file

@ -4,6 +4,7 @@
#include <QApplication> #include <QApplication>
#include <QDateTime> #include <QDateTime>
#include <QDebug>
#include <QLocale> #include <QLocale>
#include <QSysInfo> #include <QSysInfo>
#include <iostream> #include <iostream>
@ -51,7 +52,10 @@ void Logger::openLogfileSession()
} }
fileHandle.setFileName(LOGGER_FILENAME); fileHandle.setFileName(LOGGER_FILENAME);
fileHandle.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text); if (!fileHandle.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
qWarning() << "Logger failed to open" << LOGGER_FILENAME << "for writing";
return;
}
fileStream.setDevice(&fileHandle); fileStream.setDevice(&fileHandle);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << Qt::endl; fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << Qt::endl;