mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-08 11:03:25 -08:00
Merge branch 'master' into tooomm-qt5
This commit is contained in:
commit
94b85b8940
266 changed files with 11392 additions and 930 deletions
|
|
@ -31,8 +31,6 @@ set(oracle_SOURCES
|
|||
../cockatrice/src/interface/pixel_map_generator.cpp
|
||||
../cockatrice/src/interface/theme_config.cpp
|
||||
../cockatrice/src/interface/theme_manager.cpp
|
||||
../cockatrice/src/interface/widgets/quick_settings/settings_button_widget.cpp
|
||||
../cockatrice/src/interface/widgets/quick_settings/settings_popup_widget.cpp
|
||||
${VERSION_STRING_CPP}
|
||||
)
|
||||
|
||||
|
|
@ -122,10 +120,14 @@ target_link_libraries(
|
|||
oracle
|
||||
PUBLIC libcockatrice_card
|
||||
PUBLIC libcockatrice_settings
|
||||
PUBLIC libcockatrice_network
|
||||
PUBLIC libcockatrice_protocol
|
||||
PUBLIC ${QT_MODULES_ORACLE}
|
||||
)
|
||||
|
||||
# Only user_level.h is needed from the network headers (pulled in transitively
|
||||
# by pixel_map_generator.h); nothing from the network libraries is linked.
|
||||
target_include_directories(oracle PRIVATE ${CMAKE_SOURCE_DIR}/libcockatrice_network)
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
target_link_libraries(oracle PUBLIC ${ZLIB_LIBRARIES})
|
||||
endif()
|
||||
|
|
@ -212,10 +214,19 @@ if(WIN32) # Windows (including 64bit)
|
|||
list(APPEND libSearchDirs ${QT_LIBRARY_DIR})
|
||||
|
||||
install(
|
||||
DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE}/"
|
||||
DIRECTORY "$<TARGET_FILE_DIR:oracle>/"
|
||||
DESTINATION ./
|
||||
FILES_MATCHING
|
||||
PATTERN "*.dll"
|
||||
PATTERN "*.pdb" EXCLUDE
|
||||
PATTERN "*.dir*" EXCLUDE
|
||||
PATTERN "*_autogen*" EXCLUDE
|
||||
PATTERN "*.tlog*" EXCLUDE
|
||||
PATTERN "CMakeFiles*" EXCLUDE
|
||||
PATTERN "x64*" EXCLUDE
|
||||
PATTERN ".qt*" EXCLUDE
|
||||
PATTERN ".qsb*" EXCLUDE
|
||||
PATTERN ".lupdate*" EXCLUDE
|
||||
)
|
||||
|
||||
# Qt plugins: iconengines, platforms, styles, tls (Qt6)
|
||||
|
|
@ -287,6 +298,18 @@ if(Qt6LinguistTools_FOUND)
|
|||
elseif(WIN32) # Windows (including 64bit)
|
||||
install(FILES ${oracle_QM} DESTINATION ${ORACLE_WIN32_QM_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
# Qt attaches the .qm files to the default build target only, so building the executable on its own
|
||||
# (CLion, --target oracle) leaves it without any translations: nothing is translated and the
|
||||
# language selector in the wizard stays empty.
|
||||
# Depend on Qt's own lrelease target instead of attaching the .qm custom commands to a second
|
||||
# target: two independent targets owning the same outputs race on MSBuild/Makefiles and are an
|
||||
# error on Xcode. Older Qt versions already add this dependency themselves.
|
||||
foreach(_lrelease_target Oracle_lrelease oracle_lrelease)
|
||||
if(TARGET ${_lrelease_target})
|
||||
add_dependencies(oracle ${_lrelease_target})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
qt6_finalize_target(oracle)
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QIcon>
|
||||
#include <QLibraryInfo>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <libcockatrice/utility/translation_loader.h>
|
||||
|
||||
QTranslator *translator, *qtTranslator;
|
||||
ThemeManager *themeManager;
|
||||
|
|
@ -24,24 +24,13 @@ void installNewTranslator()
|
|||
{
|
||||
QString lang = SettingsCache::instance().personal().getLang();
|
||||
|
||||
QString qtNameHint = "qt_" + lang;
|
||||
QString qtTranslationPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||
|
||||
bool qtTranslationLoaded = qtTranslator->load(qtNameHint, qtTranslationPath);
|
||||
if (!qtTranslationLoaded) {
|
||||
qDebug() << "Unable to load qt translation" << qtNameHint << "at" << qtTranslationPath;
|
||||
} else {
|
||||
qDebug() << "Loaded qt translation" << qtNameHint << "at" << qtTranslationPath;
|
||||
}
|
||||
// Qt's own strings and ours need a translator each: QTranslator discards its previous contents
|
||||
// on every load, so loading both files into one translator silently drops the first of them.
|
||||
TranslationLoader::loadQt(*qtTranslator, lang);
|
||||
qApp->installTranslator(qtTranslator);
|
||||
|
||||
QString appNameHint = translationPrefix + "_" + lang;
|
||||
bool appTranslationLoaded = qtTranslator->load(appNameHint, translationPath);
|
||||
if (!appTranslationLoaded) {
|
||||
qDebug() << "Unable to load" << translationPrefix << "translation" << appNameHint << "at" << translationPath;
|
||||
} else {
|
||||
qDebug() << "Loaded" << translationPrefix << "translation" << appNameHint << "at" << translationPath;
|
||||
}
|
||||
TranslationLoader::loadApplication(*translator, translationPrefix, lang,
|
||||
TranslationLoader::applicationTranslationPaths(translationPath));
|
||||
qApp->installTranslator(translator);
|
||||
}
|
||||
|
||||
|
|
@ -82,8 +71,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
QIcon icon("theme:appicon.svg");
|
||||
wizard.setWindowIcon(icon);
|
||||
// set name of the app desktop file; used by wayland to load the window icon
|
||||
QGuiApplication::setDesktopFileName("Oracle");
|
||||
// Base name of the installed oracle.desktop; wayland reads the window icon from it and
|
||||
// xdg-desktop-portal registers it as the app ID, so the case has to match the file name.
|
||||
QGuiApplication::setDesktopFileName("oracle");
|
||||
|
||||
wizard.show();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <QtGui>
|
||||
#include <cstdio>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <libcockatrice/utility/translation_loader.h>
|
||||
|
||||
#ifdef HAS_LZMA
|
||||
#include "lzma/decompress.h"
|
||||
|
|
@ -212,21 +213,18 @@ void IntroPage::initializePage()
|
|||
|
||||
QStringList IntroPage::findQmFiles()
|
||||
{
|
||||
QDir dir(translationPath);
|
||||
QStringList fileNames = dir.entryList(QStringList(translationPrefix + "_*.qm"), QDir::Files, QDir::Name);
|
||||
fileNames.replaceInStrings(QRegularExpression(translationPrefix + "_(.*)\\.qm"), "\\1");
|
||||
return fileNames;
|
||||
return TranslationLoader::availableLanguages(translationPrefix,
|
||||
TranslationLoader::applicationTranslationPaths(translationPath));
|
||||
}
|
||||
|
||||
QString IntroPage::languageName(const QString &lang)
|
||||
{
|
||||
QTranslator qTranslator;
|
||||
|
||||
QString appNameHint = translationPrefix + "_" + lang;
|
||||
bool appTranslationLoaded = qTranslator.load(appNameHint, translationPath);
|
||||
if (!appTranslationLoaded) {
|
||||
qDebug() << "Unable to load" << translationPrefix << "translation" << appNameHint << "at" << translationPath;
|
||||
}
|
||||
// Only the language name is needed here, so the file is loaded without logging a line per
|
||||
// language: findQmFiles() asked for languages whose files exist in the first place.
|
||||
TranslationLoader::loadFrom(qTranslator, translationPrefix + "_" + lang,
|
||||
TranslationLoader::applicationTranslationPaths(translationPath));
|
||||
|
||||
return qTranslator.translate("i18n", DEFAULT_LANG_NAME);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ bool SimpleDownloadFilePage::validatePage()
|
|||
return false;
|
||||
}
|
||||
|
||||
progressLabel->setText(tr("Downloading (0MB)"));
|
||||
progressLabel->setText(tr("Downloading (0 MB)"));
|
||||
// show an infinite progressbar
|
||||
progressBar->setMaximum(0);
|
||||
progressBar->setMinimum(0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue