mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-15 23:12:14 -07:00
fix: build on both qt < and >= 6.10.0
This commit is contained in:
parent
3ae4a7d8a7
commit
1a62ee2e57
8 changed files with 57 additions and 27 deletions
6
.github/workflows/desktop-build.yml
vendored
6
.github/workflows/desktop-build.yml
vendored
|
|
@ -278,7 +278,7 @@ jobs:
|
||||||
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
continue-on-error: ${{matrix.allow-failure == 'yes'}}
|
||||||
env:
|
env:
|
||||||
# Common parameters for all macOS builds
|
# Common parameters for all macOS builds
|
||||||
QT_VERSION: 6.6.*
|
QT_VERSION: 6.10.*
|
||||||
QT_ARCH: clang_64
|
QT_ARCH: clang_64
|
||||||
QT_MODULES: "qtimageformats qtmultimedia qtwebsockets"
|
QT_MODULES: "qtimageformats qtmultimedia qtwebsockets"
|
||||||
# Build-specific environment variables
|
# Build-specific environment variables
|
||||||
|
|
@ -425,8 +425,8 @@ jobs:
|
||||||
qt_arch: msvc2019_64
|
qt_arch: msvc2019_64
|
||||||
|
|
||||||
- target: 10
|
- target: 10
|
||||||
qt_version: 6.6.*
|
qt_version: 6.10.*
|
||||||
qt_arch: msvc2019_64
|
qt_arch: msvc2022_64
|
||||||
qt_modules: "qtimageformats qtmultimedia qtwebsockets"
|
qt_modules: "qtimageformats qtmultimedia qtwebsockets"
|
||||||
|
|
||||||
name: Windows ${{matrix.target}}
|
name: Windows ${{matrix.target}}
|
||||||
|
|
|
||||||
|
|
@ -286,101 +286,111 @@ GamesProxyModel::GamesProxyModel(QObject *parent, const UserListProxy *_userList
|
||||||
setDynamicSortFilter(true);
|
setDynamicSortFilter(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GamesProxyModel::applyFilterChange()
|
||||||
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
endFilterChange();
|
||||||
|
#else
|
||||||
|
invalidateFilter();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setHideBuddiesOnlyGames(bool _showBuddiesOnlyGames)
|
void GamesProxyModel::setHideBuddiesOnlyGames(bool _showBuddiesOnlyGames)
|
||||||
{
|
{
|
||||||
hideBuddiesOnlyGames = _showBuddiesOnlyGames;
|
hideBuddiesOnlyGames = _showBuddiesOnlyGames;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setHideIgnoredUserGames(bool _hideIgnoredUserGames)
|
void GamesProxyModel::setHideIgnoredUserGames(bool _hideIgnoredUserGames)
|
||||||
{
|
{
|
||||||
hideIgnoredUserGames = _hideIgnoredUserGames;
|
hideIgnoredUserGames = _hideIgnoredUserGames;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setHideFullGames(bool _showFullGames)
|
void GamesProxyModel::setHideFullGames(bool _showFullGames)
|
||||||
{
|
{
|
||||||
hideFullGames = _showFullGames;
|
hideFullGames = _showFullGames;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setHideGamesThatStarted(bool _showGamesThatStarted)
|
void GamesProxyModel::setHideGamesThatStarted(bool _showGamesThatStarted)
|
||||||
{
|
{
|
||||||
hideGamesThatStarted = _showGamesThatStarted;
|
hideGamesThatStarted = _showGamesThatStarted;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setHidePasswordProtectedGames(bool _showPasswordProtectedGames)
|
void GamesProxyModel::setHidePasswordProtectedGames(bool _showPasswordProtectedGames)
|
||||||
{
|
{
|
||||||
hidePasswordProtectedGames = _showPasswordProtectedGames;
|
hidePasswordProtectedGames = _showPasswordProtectedGames;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setHideNotBuddyCreatedGames(bool value)
|
void GamesProxyModel::setHideNotBuddyCreatedGames(bool value)
|
||||||
{
|
{
|
||||||
hideNotBuddyCreatedGames = value;
|
hideNotBuddyCreatedGames = value;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setHideOpenDecklistGames(bool _hideOpenDecklistGames)
|
void GamesProxyModel::setHideOpenDecklistGames(bool _hideOpenDecklistGames)
|
||||||
{
|
{
|
||||||
hideOpenDecklistGames = _hideOpenDecklistGames;
|
hideOpenDecklistGames = _hideOpenDecklistGames;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setGameNameFilter(const QString &_gameNameFilter)
|
void GamesProxyModel::setGameNameFilter(const QString &_gameNameFilter)
|
||||||
{
|
{
|
||||||
gameNameFilter = _gameNameFilter;
|
gameNameFilter = _gameNameFilter;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setCreatorNameFilter(const QString &_creatorNameFilter)
|
void GamesProxyModel::setCreatorNameFilter(const QString &_creatorNameFilter)
|
||||||
{
|
{
|
||||||
creatorNameFilter = _creatorNameFilter;
|
creatorNameFilter = _creatorNameFilter;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setGameTypeFilter(const QSet<int> &_gameTypeFilter)
|
void GamesProxyModel::setGameTypeFilter(const QSet<int> &_gameTypeFilter)
|
||||||
{
|
{
|
||||||
gameTypeFilter = _gameTypeFilter;
|
gameTypeFilter = _gameTypeFilter;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax)
|
void GamesProxyModel::setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax)
|
||||||
{
|
{
|
||||||
maxPlayersFilterMin = _maxPlayersFilterMin;
|
maxPlayersFilterMin = _maxPlayersFilterMin;
|
||||||
maxPlayersFilterMax = _maxPlayersFilterMax;
|
maxPlayersFilterMax = _maxPlayersFilterMax;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setMaxGameAge(const QTime &_maxGameAge)
|
void GamesProxyModel::setMaxGameAge(const QTime &_maxGameAge)
|
||||||
{
|
{
|
||||||
maxGameAge = _maxGameAge;
|
maxGameAge = _maxGameAge;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setShowOnlyIfSpectatorsCanWatch(bool _showOnlyIfSpectatorsCanWatch)
|
void GamesProxyModel::setShowOnlyIfSpectatorsCanWatch(bool _showOnlyIfSpectatorsCanWatch)
|
||||||
{
|
{
|
||||||
showOnlyIfSpectatorsCanWatch = _showOnlyIfSpectatorsCanWatch;
|
showOnlyIfSpectatorsCanWatch = _showOnlyIfSpectatorsCanWatch;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setShowSpectatorPasswordProtected(bool _showSpectatorPasswordProtected)
|
void GamesProxyModel::setShowSpectatorPasswordProtected(bool _showSpectatorPasswordProtected)
|
||||||
{
|
{
|
||||||
showSpectatorPasswordProtected = _showSpectatorPasswordProtected;
|
showSpectatorPasswordProtected = _showSpectatorPasswordProtected;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setShowOnlyIfSpectatorsCanChat(bool _showOnlyIfSpectatorsCanChat)
|
void GamesProxyModel::setShowOnlyIfSpectatorsCanChat(bool _showOnlyIfSpectatorsCanChat)
|
||||||
{
|
{
|
||||||
showOnlyIfSpectatorsCanChat = _showOnlyIfSpectatorsCanChat;
|
showOnlyIfSpectatorsCanChat = _showOnlyIfSpectatorsCanChat;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::setShowOnlyIfSpectatorsCanSeeHands(bool _showOnlyIfSpectatorsCanSeeHands)
|
void GamesProxyModel::setShowOnlyIfSpectatorsCanSeeHands(bool _showOnlyIfSpectatorsCanSeeHands)
|
||||||
{
|
{
|
||||||
showOnlyIfSpectatorsCanSeeHands = _showOnlyIfSpectatorsCanSeeHands;
|
showOnlyIfSpectatorsCanSeeHands = _showOnlyIfSpectatorsCanSeeHands;
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GamesProxyModel::getNumFilteredGames() const
|
int GamesProxyModel::getNumFilteredGames() const
|
||||||
|
|
@ -418,7 +428,7 @@ void GamesProxyModel::resetFilterParameters()
|
||||||
showOnlyIfSpectatorsCanChat = false;
|
showOnlyIfSpectatorsCanChat = false;
|
||||||
showOnlyIfSpectatorsCanSeeHands = false;
|
showOnlyIfSpectatorsCanSeeHands = false;
|
||||||
|
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GamesProxyModel::areFilterParametersSetToDefaults() const
|
bool GamesProxyModel::areFilterParametersSetToDefaults() const
|
||||||
|
|
@ -459,7 +469,7 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameTypes)
|
void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameTypes)
|
||||||
|
|
@ -577,5 +587,5 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow) const
|
||||||
|
|
||||||
void GamesProxyModel::refresh()
|
void GamesProxyModel::refresh()
|
||||||
{
|
{
|
||||||
invalidateFilter();
|
applyFilterChange();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,8 @@ private:
|
||||||
bool showOnlyIfSpectatorsCanWatch, showSpectatorPasswordProtected, showOnlyIfSpectatorsCanChat,
|
bool showOnlyIfSpectatorsCanWatch, showSpectatorPasswordProtected, showOnlyIfSpectatorsCanChat,
|
||||||
showOnlyIfSpectatorsCanSeeHands;
|
showOnlyIfSpectatorsCanSeeHands;
|
||||||
|
|
||||||
|
void applyFilterChange();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GamesProxyModel(QObject *parent = nullptr, const UserListProxy *_userListProxy = nullptr);
|
explicit GamesProxyModel(QObject *parent = nullptr, const UserListProxy *_userListProxy = nullptr);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 file for writing:" << filePath;
|
||||||
|
return;
|
||||||
|
}
|
||||||
f.write((const char *)_data.data(), _data.size());
|
f.write((const char *)_data.data(), _data.size());
|
||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ CardDatabaseLoader::~CardDatabaseLoader()
|
||||||
LoadStatus CardDatabaseLoader::loadFromFile(const QString &fileName)
|
LoadStatus CardDatabaseLoader::loadFromFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
file.open(QIODevice::ReadOnly);
|
const auto isOpen = file.open(QIODevice::ReadOnly);
|
||||||
if (!file.isOpen()) {
|
if (!isOpen) {
|
||||||
return FileError;
|
return FileError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,9 +188,16 @@ void CardDatabaseDisplayModel::clearFilterAll()
|
||||||
cardText.clear();
|
cardText.clear();
|
||||||
cardTypes.clear();
|
cardTypes.clear();
|
||||||
cardColors.clear();
|
cardColors.clear();
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
beginFilterChange();
|
||||||
|
#endif
|
||||||
if (filterTree != nullptr)
|
if (filterTree != nullptr)
|
||||||
filterTree->clear();
|
filterTree->clear();
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
|
||||||
|
endFilterChange();
|
||||||
|
#else
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardDatabaseDisplayModel::setFilterTree(FilterTree *_filterTree)
|
void CardDatabaseDisplayModel::setFilterTree(FilterTree *_filterTree)
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,11 @@ void Logger::openLogfileSession()
|
||||||
}
|
}
|
||||||
|
|
||||||
fileHandle.setFileName(LOGGER_FILENAME);
|
fileHandle.setFileName(LOGGER_FILENAME);
|
||||||
fileHandle.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
|
const auto result = fileHandle.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
|
||||||
|
if (!result) {
|
||||||
|
std::cerr << "Error: Failed to open log file: " << fileHandle.errorString().toStdString() << std::endl;
|
||||||
|
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;
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,11 @@ void ServerLogger::rotateLogs()
|
||||||
flushBuffer();
|
flushBuffer();
|
||||||
|
|
||||||
logFile->close();
|
logFile->close();
|
||||||
logFile->open(QIODevice::Append);
|
const auto result = logFile->open(QIODevice::Append);
|
||||||
|
if (!result) {
|
||||||
|
std::cerr << "ERROR: can't open() logfile." << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile *ServerLogger::logFile;
|
QFile *ServerLogger::logFile;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue