diff --git a/CMakeLists.txt b/CMakeLists.txt index 46f2e51..1244e07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,24 +1,10 @@ cmake_minimum_required(VERSION 3.20) -# C нужен для эталонного zlib: см. блок про установщики Forge ниже. project(Minecraft_launcher VERSION 0.1 LANGUAGES CXX C) set(CMAKE_CXX_STANDARD_REQUIRED ON) - -# CorePrivate нужен ради QZipReader — им распаковываются нативные библиотеки LWJGL. -# Про привязку к версии Qt из-за него предупреждать не нужно: это осознанный выбор. set(QT_NO_PRIVATE_MODULE_WARNING ON) find_package(Qt6 REQUIRED COMPONENTS Quick QuickControls2 Core CorePrivate Gui Network) - -# ── Qt WebEngine: окно входа в аккаунт Microsoft ──────────────────────────── -# -# Модуль необязательный, и это принципиально: он ставится отдельной галочкой в -# установщике Qt и тянет за собой WebChannel с Positioning, которых в типовой -# установке нет. Если сделать его обязательным, у любого, кто их не поставил, -# проект перестаёт конфигурироваться целиком — вместе с офлайном и Ely.by. -# -# Без модуля лаунчер собирается и работает как раньше, только вход через -# Microsoft сообщает, что эта сборка его не умеет. find_package(Qt6 QUIET COMPONENTS WebEngineQuick) if(Qt6WebEngineQuick_FOUND) message(STATUS "Qt WebEngine найден: вход через аккаунт Microsoft будет доступен") @@ -33,11 +19,56 @@ endif() qt_standard_project_setup(REQUIRES 6.8) -qt_add_executable(appMinecraft_launcher +# Иконку самого файла приложения (то, что видно до запуска) каждая система берёт +# по-своему: Windows — из ресурса, вкомпилированного в .exe, macOS — из .icns +# внутри бандла. На Linux такого механизма нет, там иконку даёт .desktop-файл, +# который ставится ниже вместе с темой hicolor. +# +# Растры и .icns/.ico собираются из одного исходника скриптом icons/generate_icons.sh: +# у macOS арт по сетке Apple занимает 824 из 1024 точек холста, у Windows и Linux +# идёт без полей. Правки иконки вносятся в icons/master/icon_master.png с +# последующим перезапуском скрипта, а не в отдельные файлы размеров. +set(LAUNCHER_ICON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/icons") + +if(WIN32) + set(LAUNCHER_APP_ICON "${LAUNCHER_ICON_DIR}/icon.rc") +elseif(APPLE) + set(LAUNCHER_APP_ICON "${LAUNCHER_ICON_DIR}/icon.icns") + set_source_files_properties(${LAUNCHER_APP_ICON} PROPERTIES + MACOSX_PACKAGE_LOCATION "Resources") +else() + set(LAUNCHER_APP_ICON "") +endif() + +qt_add_executable(BiLauncher main.cpp + ${LAUNCHER_APP_ICON} ) -qt_add_qml_module(appMinecraft_launcher +# Иконка окна выставляется в main.cpp через setWindowIcon() и обязана быть +# доступна на всех платформах, поэтому лежит в отдельном ресурсе, а не в +# ресурсах QML-модуля: путь :/icons/... не зависит от URI модуля. +# Размеры 24, 48 и 64 нужны панели задач Windows и значкам рабочих столов Linux. +qt_add_resources(BiLauncher "appicon" + PREFIX "/icons" + BASE "icons" + FILES + icons/icon_16x16.png + icons/icon_16x16@2x.png + icons/icon_24x24.png + icons/icon_32x32.png + icons/icon_32x32@2x.png + icons/icon_48x48.png + icons/icon_64x64.png + icons/icon_128x128.png + icons/icon_128x128@2x.png + icons/icon_256x256.png + icons/icon_256x256@2x.png + icons/icon_512x512.png + icons/icon_512x512@2x.png +) + +qt_add_qml_module(BiLauncher URI Minecraft_launcher SOURCES localization.h @@ -93,44 +124,35 @@ qt_add_qml_module(appMinecraft_launcher ProgressPanel.qml ${LAUNCHER_MSA_QML_FILES} RESOURCES images/Folder/Folder_Active.svg images/Folder/Folder_Idle.svg images/Folder/Folder_Pressed.svg images/Options/Options_active.svg images/Options/Options_Idle.svg images/Options/Options_Pressed.svg images/Play_Button/Play_Active.svg images/Play_Button/Play_Idle.svg images/Play_Button/Play_pressed.svg images/Profile_Box/Asset_23.jpg images/Profile_Box/Asset_23.svg images/Profile_Box/Asset_24.jpg images/Profile_Box/Asset_24.svg images/Profile_Box/Kishka_Profile_Active.svg images/Profile_Box/Kishka_Profile_Idle.svg images/Profile_Box/Kishka_Profile_open.svg images/Scroll/Scroll_Lever.svg images/Scroll/Scroll_palka.svg images/Version_box/Kishka_Profile_Open.svg images/Version_box/Kishka_Ver_Active.svg images/Version_box/Kishka_Ver_idle.svg images/Trash.svg images/Pencil.svg images/GovuztTW8AAHqBf.jpeg images/photo_2025-12-16_15-04-17.jpg images/photo_2025-12-21_02-30-09.jpg i18n/translations.json + RESOURCES images/launcherBackground.png + RESOURCES images/launcherBackground2.mp4 images/launcherBackground2static.jpg ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # If you are developing for iOS or macOS you should consider setting an # explicit, fixed bundle identifier manually though. -set_target_properties(appMinecraft_launcher PROPERTIES -# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appMinecraft_launcher +set_target_properties(BiLauncher PROPERTIES +# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.BiLauncher MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + # Попадает в CFBundleIconFile сгенерированного Info.plist — только имя + # файла, без пути: сам .icns кладётся в Contents/Resources выше. + MACOSX_BUNDLE_ICON_FILE icon.icns MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) -target_link_libraries(appMinecraft_launcher +target_link_libraries(BiLauncher PRIVATE Qt6::Quick Qt6::QuickControls2 Qt6::Core Qt6::CorePrivate Qt6::Gui Qt6::Network ) if(Qt6WebEngineQuick_FOUND) - target_link_libraries(appMinecraft_launcher PRIVATE Qt6::WebEngineQuick) - target_compile_definitions(appMinecraft_launcher PRIVATE LAUNCHER_HAS_WEBENGINE) + target_link_libraries(BiLauncher PRIVATE Qt6::WebEngineQuick) + target_compile_definitions(BiLauncher PRIVATE LAUNCHER_HAS_WEBENGINE) endif() include(GNUInstallDirs) -# ── Эталонный zlib для установщиков Forge и NeoForge ──────────────────────── -# -# Установщик Forge сверяет sha1 каждого jar, который сам же и собирает, с -# эталоном из install_profile.json. Эталон посчитан на обычном zlib, а -# дистрибутивы вроде CachyOS и Fedora подставляют вместо него zlib-ng: сжатие -# корректное, но побайтово другое, поэтому установка падает на любой версии -# игры («Processor failed, invalid outputs»). Сменить Java не выйдет — сборки -# OpenJDK под Linux берут libz.so.1 из системы. -# -# Поэтому собираем обычный zlib из zlib/ — его исходники лежат в репозитории, -# чтобы сборка не зависела от сети, а версия была зафиксирована: от неё зависит -# побайтовый результат сжатия. Готовую библиотеку подсовываем через LD_PRELOAD -# только процессу установщика. Сам лаунчер с ней не линкуется, системный -# zlib-ng остаётся на месте. if(UNIX AND NOT APPLE) set(LAUNCHER_ZLIB_DIR "${CMAKE_INSTALL_LIBDIR}/galeonLauncher") set(LAUNCHER_ZLIB_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/zlib") @@ -153,28 +175,37 @@ if(UNIX AND NOT APPLE) ${LAUNCHER_ZLIB_SOURCES}/zutil.c ) target_include_directories(launcher_zlib_reference PRIVATE ${LAUNCHER_ZLIB_SOURCES}) - # То же, что выставляет собственный configure zlib: без этого gz*-часть не - # видит unistd.h и не собирается. + target_compile_definitions(launcher_zlib_reference PRIVATE HAVE_UNISTD_H=1 HAVE_STDARG_H=1 _LARGEFILE64_SOURCE=1) - # SONAME libz.so.1 обязателен: с ним ld.so считает предзагруженный объект - # закрывающим зависимость, и системный zlib-ng в процессе java не появится. + set_target_properties(launcher_zlib_reference PROPERTIES OUTPUT_NAME z VERSION 1.3.1 SOVERSION 1 C_VISIBILITY_PRESET default - LIBRARY_OUTPUT_DIRECTORY $/zlib + LIBRARY_OUTPUT_DIRECTORY $/zlib ) - add_dependencies(appMinecraft_launcher launcher_zlib_reference) + add_dependencies(BiLauncher launcher_zlib_reference) - target_compile_definitions(appMinecraft_launcher PRIVATE + target_compile_definitions(BiLauncher PRIVATE LAUNCHER_ZLIB_INSTALL_DIR="${CMAKE_INSTALL_FULL_LIBDIR}/galeonLauncher" ) install(TARGETS launcher_zlib_reference LIBRARY DESTINATION ${LAUNCHER_ZLIB_DIR}) + + # Рабочие столы ищут иконку не по имени файла, а по имени из ключа Icon= + # .desktop-файла, перебирая размеры в теме hicolor, — отсюда переименование. + foreach(icon_size IN ITEMS 16 24 32 48 64 128 256 512) + install(FILES "${LAUNCHER_ICON_DIR}/icon_${icon_size}x${icon_size}.png" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${icon_size}x${icon_size}/apps" + RENAME bilauncher.png) + endforeach() + + install(FILES "${LAUNCHER_ICON_DIR}/bilauncher.desktop" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") endif() -install(TARGETS appMinecraft_launcher +install(TARGETS BiLauncher BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/Main.qml b/Main.qml index d35fc50..86701f9 100644 --- a/Main.qml +++ b/Main.qml @@ -87,10 +87,8 @@ Window { // ── Background ───────────────────────────────────────────────────────── Image { id: image - opacity: 0.296 anchors.fill: parent - source: "images/GovuztTW8AAHqBf.jpeg" - fillMode: Image.Stretch + source: "images/launcherBackground.png" } // ── Status toast ─────────────────────────────────────────────────────── diff --git a/doc/.DS_Store b/doc/.DS_Store index 3953cb1..f61d26f 100644 Binary files a/doc/.DS_Store and b/doc/.DS_Store differ diff --git a/i18n/translations.json b/i18n/translations.json index 46a3913..c78f951 100644 --- a/i18n/translations.json +++ b/i18n/translations.json @@ -32,20 +32,20 @@ }, "strings": { "app.title": { - "ru": "Minecraft Launcher", - "en": "Minecraft Launcher" + "ru": "BiLauncher", + "en": "BiLauncher" }, "app.tooltip.openMods": { - "ru": "Открыть папку с модами Minecraft", - "en": "Open the Minecraft mods folder" + "ru": "Открыть папку с модами", + "en": "Open mods folder" }, "app.tooltip.seasonal": { - "ru": "Готовые сборки с сервера: моды, конфиги и Java одной кнопкой", - "en": "Ready-made builds from the server: mods, configs and Java in one click" + "ru": "Сезонные сборки от команды Мельника", + "en": "Seasonal builds from Galeon team" }, "app.tooltip.settings": { - "ru": "Настройки запуска: Java, память, папка игры", - "en": "Launch settings: Java, memory, game folder" + "ru": "Настройки запуска", + "en": "Launch settings" }, "auth.ely.error.enterCode": { "ru": "Введите код двухфакторной аутентификации", diff --git a/icons/bilauncher.desktop b/icons/bilauncher.desktop new file mode 100644 index 0000000..f667c59 --- /dev/null +++ b/icons/bilauncher.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Name=BiLauncher +GenericName=Minecraft Launcher +Comment=Launcher for Minecraft +Exec=BiLauncher +Icon=bilauncher +Terminal=false +Categories=Game;ActionGame; +StartupNotify=true diff --git a/icons/icon.icns b/icons/icon.icns new file mode 100644 index 0000000..aa36736 Binary files /dev/null and b/icons/icon.icns differ diff --git a/icons/icon.ico b/icons/icon.ico new file mode 100644 index 0000000..39c97a5 Binary files /dev/null and b/icons/icon.ico differ diff --git a/icons/icon.rc b/icons/icon.rc new file mode 100644 index 0000000..a841e99 --- /dev/null +++ b/icons/icon.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON "icon.ico" diff --git a/icons/icon_128x128.png b/icons/icon_128x128.png new file mode 100644 index 0000000..87a1fae Binary files /dev/null and b/icons/icon_128x128.png differ diff --git a/icons/icon_128x128@2x.png b/icons/icon_128x128@2x.png new file mode 100644 index 0000000..73118ad Binary files /dev/null and b/icons/icon_128x128@2x.png differ diff --git a/icons/icon_16x16.png b/icons/icon_16x16.png new file mode 100644 index 0000000..29d783e Binary files /dev/null and b/icons/icon_16x16.png differ diff --git a/icons/icon_16x16@2x.png b/icons/icon_16x16@2x.png new file mode 100644 index 0000000..ec867f2 Binary files /dev/null and b/icons/icon_16x16@2x.png differ diff --git a/icons/icon_24x24.png b/icons/icon_24x24.png new file mode 100644 index 0000000..d968943 Binary files /dev/null and b/icons/icon_24x24.png differ diff --git a/icons/icon_256x256.png b/icons/icon_256x256.png new file mode 100644 index 0000000..73118ad Binary files /dev/null and b/icons/icon_256x256.png differ diff --git a/icons/icon_256x256@2x.png b/icons/icon_256x256@2x.png new file mode 100644 index 0000000..7f1e278 Binary files /dev/null and b/icons/icon_256x256@2x.png differ diff --git a/icons/icon_32x32.png b/icons/icon_32x32.png new file mode 100644 index 0000000..ec867f2 Binary files /dev/null and b/icons/icon_32x32.png differ diff --git a/icons/icon_32x32@2x.png b/icons/icon_32x32@2x.png new file mode 100644 index 0000000..f458828 Binary files /dev/null and b/icons/icon_32x32@2x.png differ diff --git a/icons/icon_48x48.png b/icons/icon_48x48.png new file mode 100644 index 0000000..d9c4f1b Binary files /dev/null and b/icons/icon_48x48.png differ diff --git a/icons/icon_512x512.png b/icons/icon_512x512.png new file mode 100644 index 0000000..7f1e278 Binary files /dev/null and b/icons/icon_512x512.png differ diff --git a/icons/icon_512x512@2x.png b/icons/icon_512x512@2x.png new file mode 100644 index 0000000..c82b68b Binary files /dev/null and b/icons/icon_512x512@2x.png differ diff --git a/icons/icon_64x64.png b/icons/icon_64x64.png new file mode 100644 index 0000000..f458828 Binary files /dev/null and b/icons/icon_64x64.png differ diff --git a/icons/master/icon_master.png b/icons/master/icon_master.png new file mode 100644 index 0000000..2ef651c Binary files /dev/null and b/icons/master/icon_master.png differ diff --git a/images/launcherBackground.png b/images/launcherBackground.png new file mode 100644 index 0000000..77835d0 Binary files /dev/null and b/images/launcherBackground.png differ diff --git a/images/launcherBackground2.mp4 b/images/launcherBackground2.mp4 new file mode 100644 index 0000000..4b4767e Binary files /dev/null and b/images/launcherBackground2.mp4 differ diff --git a/images/launcherBackground2static.jpg b/images/launcherBackground2static.jpg new file mode 100644 index 0000000..c29bbdc Binary files /dev/null and b/images/launcherBackground2static.jpg differ diff --git a/main.cpp b/main.cpp index feb8ccd..721ab81 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,7 @@ #include "localization.h" #include +#include #include #include @@ -19,6 +20,27 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); + // Иконка окна и панели задач. Отдаём все размеры сразу: оконный менеджер + // сам выберет подходящий, а готовый растр всегда чётче, чем полученный + // масштабированием одной большой картинки. + // + // На macOS этого делать нельзя: setWindowIcon подменяет иконку в доке + // растром во весь холст, и лаунчер выглядит заметно крупнее соседей. Там + // иконку берут из icon.icns внутри бандла — он нарисован по сетке Apple, + // с полями вокруг арта. +#ifndef Q_OS_MACOS + QIcon appIcon; + for (int size : {16, 24, 32, 48, 64, 128, 256, 512}) + appIcon.addFile(QStringLiteral(":/icons/icon_%1x%1.png").arg(size)); + for (int size : {16, 32, 128, 256, 512}) + appIcon.addFile(QStringLiteral(":/icons/icon_%1x%1@2x.png").arg(size)); + QGuiApplication::setWindowIcon(appIcon); +#endif + + // На Wayland окно связывается с установленным .desktop-файлом только по + // этому имени; без него композитор покажет иконку по умолчанию. + QGuiApplication::setDesktopFileName(QStringLiteral("bilauncher")); + // Язык интерфейса нужно знать до того, как QML вычислит первую привязку, // поэтому каталог читается здесь, а не в LauncherBackend: тот появляется // только вместе с движком. Каталог лежит в ресурсах — не прочитался, значит