Compare commits

...

10 Commits

43 changed files with 1004 additions and 506 deletions

Binary file not shown.

View File

@@ -1,41 +0,0 @@
{
"Version": 1,
"WorkspaceRootPath": "G:\\Documents\\The Grand Archives\\Projects VS\\minecraft-launcher\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{0E29BAEF-96E1-4395-89C1-81BB639C431F}|minecraft-launcher.vcxproj|G:\\Documents\\The Grand Archives\\Projects VS\\minecraft-launcher\\minecraft-launcher.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{0E29BAEF-96E1-4395-89C1-81BB639C431F}|minecraft-launcher.vcxproj|solutionrelative:minecraft-launcher.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "minecraft-launcher.cpp",
"DocumentMoniker": "G:\\Documents\\The Grand Archives\\Projects VS\\minecraft-launcher\\minecraft-launcher.cpp",
"RelativeDocumentMoniker": "minecraft-launcher.cpp",
"ToolTip": "G:\\Documents\\The Grand Archives\\Projects VS\\minecraft-launcher\\minecraft-launcher.cpp",
"RelativeToolTip": "minecraft-launcher.cpp",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2025-09-02T19:13:50.154Z",
"EditorCaption": ""
}
]
}
]
}
]
}

43
CMakeLists.txt Normal file
View File

@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.19)
project(minecraft-launcher LANGUAGES CXX)
find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets)
qt_standard_project_setup()
qt_add_executable(minecraft-launcher
WIN32 MACOSX_BUNDLE
main.cpp
mainwindow.h mainwindow.cpp
settingsdialog.h settingsdialog.cpp
settingsdialog.ui
mainwindow.ui
)
target_link_libraries(minecraft-launcher
PRIVATE
Qt::Core
Qt::Widgets
)
include(GNUInstallDirs)
install(TARGETS minecraft-launcher
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
qt_generate_deploy_app_script(
TARGET minecraft-launcher
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})

View File

@@ -1,3 +0,0 @@
# minecraft-launcher
Первая итерация самописного лаунчера для запуска сборок Minecraft

View File

@@ -1,30 +0,0 @@
//{{NO_DEPENDENCIES}}
// Включаемый файл, созданный в Microsoft Visual C++.
// Используется minecraft-launcher.rc
#define IDS_APP_TITLE 103
#define IDR_MAINFRAME 128
#define IDD_MINECRAFTLAUNCHER_DIALOG 102
#define IDD_ABOUTBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_MINECRAFTLAUNCHER 107
#define IDI_SMALL 108
#define IDC_MINECRAFTLAUNCHER 109
#define IDC_MYICON 2
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
// Следующие стандартные значения для новых объектов
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 130
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 40">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-2 {
fill: #637a10;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<path class="cls-2" d="m67.66,40H2.34c-1.29,0-2.34-1.05-2.34-2.36V2.36C0,1.05,1.05,0,2.34,0h65.32c1.29,0,2.34,1.05,2.34,2.36v35.29c0,1.3-1.05,2.36-2.34,2.36Z"/>
<path class="cls-1" d="m40.18,9.72c-2.6,0-4.9,1.28-6.32,3.25h-10.36c-.97,0-1.75.79-1.75,1.76v13.8c0,.97.78,1.76,1.75,1.76h23c.97,0,1.75-.79,1.75-1.76V11.48c0-.97-.78-1.76-1.75-1.76h-6.32Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 743 B

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 40">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-2 {
fill: #232323;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<path class="cls-2" d="m67.66,40H2.34c-1.29,0-2.34-1.05-2.34-2.36V2.36C0,1.05,1.05,0,2.34,0h65.32c1.29,0,2.34,1.05,2.34,2.36v35.29c0,1.3-1.05,2.36-2.34,2.36Z"/>
<path class="cls-1" d="m40.18,9.72c-2.6,0-4.9,1.28-6.32,3.25h-10.36c-.97,0-1.75.79-1.75,1.76v13.8c0,.97.78,1.76,1.75,1.76h23c.97,0,1.75-.79,1.75-1.76V11.48c0-.97-.78-1.76-1.75-1.76h-6.32Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 743 B

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 40">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-2 {
fill: #232323;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<path class="cls-1" d="m67.66,40H2.34c-1.29,0-2.34-1.05-2.34-2.36V2.36C0,1.05,1.05,0,2.34,0h65.32c1.29,0,2.34,1.05,2.34,2.36v35.29c0,1.3-1.05,2.36-2.34,2.36Z"/>
<path class="cls-2" d="m40.18,9.72c-2.6,0-4.9,1.28-6.32,3.25h-10.36c-.97,0-1.75.79-1.75,1.76v13.8c0,.97.78,1.76,1.75,1.76h23c.97,0,1.75-.79,1.75-1.76V11.48c0-.97-.78-1.76-1.75-1.76h-6.32Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 743 B

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 69.88 39.72">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-2 {
fill: #232323;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-2" width="69.88" height="39.72" rx="2.34" ry="2.34"/>
<g>
<path class="cls-1" d="m46.69,9.71h-23.51c-1.03,0-1.87.83-1.87,1.85h0c0,1.02.84,1.85,1.87,1.85h23.51c1.03,0,1.87-.83,1.87-1.85h0c0-1.02-.84-1.85-1.87-1.85Z"/>
<path class="cls-1" d="m46.69,18.01h-23.51c-1.03,0-1.87.83-1.87,1.85h0c0,1.02.84,1.85,1.87,1.85h23.51c1.03,0,1.87-.83,1.87-1.85h0c0-1.02-.84-1.85-1.87-1.85Z"/>
<path class="cls-1" d="m46.69,26.32h-23.51c-1.03,0-1.87.83-1.87,1.85h0c0,1.02.84,1.85,1.87,1.85h23.51c1.03,0,1.87-.83,1.87-1.85h0c0-1.02-.84-1.85-1.87-1.85Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 978 B

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 69.88 39.72">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-2 {
fill: #637a10;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-2" width="69.88" height="39.72" rx="2.34" ry="2.34"/>
<g>
<path class="cls-1" d="m46.69,9.71h-23.51c-1.03,0-1.87.83-1.87,1.85h0c0,1.02.84,1.85,1.87,1.85h23.51c1.03,0,1.87-.83,1.87-1.85h0c0-1.02-.84-1.85-1.87-1.85Z"/>
<path class="cls-1" d="m46.69,18.01h-23.51c-1.03,0-1.87.83-1.87,1.85h0c0,1.02.84,1.85,1.87,1.85h23.51c1.03,0,1.87-.83,1.87-1.85h0c0-1.02-.84-1.85-1.87-1.85Z"/>
<path class="cls-1" d="m46.69,26.32h-23.51c-1.03,0-1.87.83-1.87,1.85h0c0,1.02.84,1.85,1.87,1.85h23.51c1.03,0,1.87-.83,1.87-1.85h0c0-1.02-.84-1.85-1.87-1.85Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 978 B

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 69.88 39.72">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-2 {
fill: #232323;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" width="69.88" height="39.72" rx="2.34" ry="2.34"/>
<g>
<path class="cls-2" d="m46.69,9.71h-23.51c-1.03,0-1.87.83-1.87,1.85h0c0,1.02.84,1.85,1.87,1.85h23.51c1.03,0,1.87-.83,1.87-1.85h0c0-1.02-.84-1.85-1.87-1.85Z"/>
<path class="cls-2" d="m46.69,18.01h-23.51c-1.03,0-1.87.83-1.87,1.85h0c0,1.02.84,1.85,1.87,1.85h23.51c1.03,0,1.87-.83,1.87-1.85h0c0-1.02-.84-1.85-1.87-1.85Z"/>
<path class="cls-2" d="m46.69,26.32h-23.51c-1.03,0-1.87.83-1.87,1.85h0c0,1.02.84,1.85,1.87,1.85h23.51c1.03,0,1.87-.83,1.87-1.85h0c0-1.02-.84-1.85-1.87-1.85Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 978 B

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 335 170">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-2 {
fill: #637a10;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-2" width="335" height="170" rx="10.7" ry="10.7"/>
<g>
<path class="cls-1" d="m72.38,98.02v26.54h-24.73V39.35h49.34c5.87,0,9.94,4.38,9.94,10.59v37.37c0,6.21-4.06,10.71-9.94,10.71h-24.62Zm0-21.3h9.82v-15.95h-9.82v15.95Z"/>
<path class="cls-1" d="m114.83,39.35h24.62v63.91h24.84v21.3h-49.46V39.35Z"/>
<path class="cls-1" d="m219.84,39.35l11.07,74.62v10.59h-24.73l-1.47-17.16h-10.84l-1.58,17.16h-24.62v-10.59l11.07-74.62h41.1Zm-16.94,46.75l-2.26-25.32h-2.71l-2.26,25.32h7.23Z"/>
<path class="cls-1" d="m227.51,49.94v-10.59h24.73l5.98,33.11h1.81l6.1-33.11h24.62v10.59l-19.31,51.37v23.25h-24.62v-23.25l-19.31-51.37Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 335 170">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-2 {
fill: #91b315;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-2" width="335" height="170" rx="10.7" ry="10.7"/>
<g>
<path class="cls-1" d="m72.38,98.02v26.54h-24.73V39.35h49.34c5.87,0,9.94,4.38,9.94,10.59v37.37c0,6.21-4.06,10.71-9.94,10.71h-24.62Zm0-21.3h9.82v-15.95h-9.82v15.95Z"/>
<path class="cls-1" d="m114.83,39.35h24.62v63.91h24.84v21.3h-49.46V39.35Z"/>
<path class="cls-1" d="m219.84,39.35l11.07,74.62v10.59h-24.73l-1.47-17.16h-10.84l-1.58,17.16h-24.62v-10.59l11.07-74.62h41.1Zm-16.94,46.75l-2.26-25.32h-2.71l-2.26,25.32h7.23Z"/>
<path class="cls-1" d="m227.51,49.94v-10.59h24.73l5.98,33.11h1.81l6.1-33.11h24.62v10.59l-19.31,51.37v23.25h-24.62v-23.25l-19.31-51.37Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 335 170">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-2 {
fill: #91b315;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" width="335" height="170" rx="10.7" ry="10.7"/>
<g>
<path class="cls-2" d="m72.38,98.02v26.54h-24.73V39.35h49.34c5.87,0,9.94,4.38,9.94,10.59v37.37c0,6.21-4.06,10.71-9.94,10.71h-24.62Zm0-21.3h9.82v-15.95h-9.82v15.95Z"/>
<path class="cls-2" d="m114.83,39.35h24.62v63.91h24.84v21.3h-49.46V39.35Z"/>
<path class="cls-2" d="m219.84,39.35l11.07,74.62v10.59h-24.73l-1.47-17.16h-10.84l-1.58,17.16h-24.62v-10.59l11.07-74.62h41.1Zm-16.94,46.75l-2.26-25.32h-2.71l-2.26,25.32h7.23Z"/>
<path class="cls-2" d="m227.51,49.94v-10.59h24.73l5.98,33.11h1.81l6.1-33.11h24.62v10.59l-19.31,51.37v23.25h-24.62v-23.25l-19.31-51.37Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 118.83 45">
<defs>
<style>
.cls-1 {
fill: #637a10;
stroke-width: 0px;
}
.cls-2 {
fill: none;
stroke: #e6e6e6;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.18px;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" width="118.83" height="45" rx="5.27" ry="5.27"/>
<polyline class="cls-2" points="15.36 24.93 20.41 20.07 25.47 24.93"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 618 B

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 118.83 45">
<defs>
<style>
.cls-1 {
fill: #232323;
stroke-width: 0px;
}
.cls-2 {
fill: none;
stroke: #e6e6e6;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.18px;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" width="118.83" height="45" rx="5.27" ry="5.27"/>
<polyline class="cls-2" points="15.36 24.93 20.41 20.07 25.47 24.93"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 618 B

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 118.83 45">
<defs>
<style>
.cls-1 {
fill: #232323;
stroke-width: 0px;
}
.cls-2 {
fill: none;
stroke: #e6e6e6;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.18px;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" width="118.83" height="45" rx="5.27" ry="5.27"/>
<polyline class="cls-2" points="15.36 20.07 20.41 24.93 25.47 20.07"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 618 B

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3.41 39.95">
<defs>
<style>
.cls-1 {
fill: #e6e6e6;
stroke-width: 0px;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" x="0" y="0" width="3.41" height="39.95" rx="1.56" ry="1.56"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 395 B

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3.41 161.66">
<defs>
<style>
.cls-1 {
fill: #637a10;
stroke-width: 0px;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" x="0" y="0" width="3.41" height="161.66" rx="1.56" ry="1.56"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 397 B

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 210 45">
<defs>
<style>
.cls-1 {
fill: #232323;
stroke-width: 0px;
}
.cls-2 {
fill: none;
stroke: #e6e6e6;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.18px;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" width="210" height="45" rx="5.24" ry="5.24"/>
<polyline class="cls-2" points="16.58 20.07 21.63 24.93 26.69 20.07"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 612 B

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 210 45">
<defs>
<style>
.cls-1 {
fill: #637a10;
stroke-width: 0px;
}
.cls-2 {
fill: none;
stroke: #e6e6e6;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.18px;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" width="210" height="45" rx="5.24" ry="5.24"/>
<polyline class="cls-2" points="16.58 24.93 21.63 20.07 26.69 24.93"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 612 B

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 210 45">
<defs>
<style>
.cls-1 {
fill: #232323;
stroke-width: 0px;
}
.cls-2 {
fill: none;
stroke: #e6e6e6;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.18px;
}
</style>
</defs>
<g id="Layer_1-2" data-name="Layer 1">
<rect class="cls-1" width="210" height="45" rx="5.24" ry="5.24"/>
<polyline class="cls-2" points="16.58 24.93 21.63 20.07 26.69 24.93"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 612 B

View File

@@ -1,15 +0,0 @@
// header.h: включаемый файл для стандартных системных включаемых файлов
// или включаемые файлы для конкретного проекта
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Исключите редко используемые компоненты из заголовков Windows
// Файлы заголовков Windows
#include <windows.h>
// Файлы заголовков среды выполнения C
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>

10
main.cpp Normal file
View File

@@ -0,0 +1,10 @@
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}

323
mainwindow.cpp Normal file
View File

@@ -0,0 +1,323 @@
#include "mainwindow.h"
#include "ui_mainwindow.h" // Подключаем сгенерированный заголовочный файл
#include "settingsdialog.h"
#include <QMessageBox>
#include <QDesktopServices>
#include <QUrl>
#include <QDir>
#include <QInputDialog> // Для диалога выбора
#include <QFileInfo> // Для проверки файла
#include <QJsonDocument> // Для работы с JSON
#include <QJsonObject> // Для работы с JSON
#include <QJsonArray> // Для работы с JSON
#include <QJsonValue> // Для работы с JSON
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow) // Инициализируем указатель на UI
{
ui->setupUi(this); // Загружаем интерфейс из .ui файла
// Начальная настройка виджетов
ui->progressBar->setRange(0, 0); // Неопределенный прогресс-бар
ui->progressBar->setVisible(false);
// Инициализация логики
settings = new QSettings("GaleonDev", "MinecraftLauncher", this);
process = new QProcess(this);
// Подключаем сигналы от процесса (это делается вручную)
connect(process, &QProcess::readyReadStandardOutput, this, &MainWindow::readProcessOutput);
connect(process, &QProcess::readyReadStandardError, this, &MainWindow::readProcessOutput);
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(onProcessFinished(int, QProcess::ExitStatus)));
connect(process, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(onProcessError(QProcess::ProcessError)));
}
MainWindow::~MainWindow()
{
delete ui; // Освобождаем память от объекта UI
}
// Вспомогательная функция для проверки правил OS
bool checkRules(const QJsonObject &item) {
if (!item.contains("rules")) {
return true; // Нет правил - разрешено для всех.
}
// Если правила есть, по умолчанию запрещаем, пока не найдем разрешающее правило.
bool isAllowed = false;
QString currentOs;
#if defined(Q_OS_WIN)
currentOs = "windows";
#elif defined(Q_OS_MAC)
currentOs = "osx";
#elif defined(Q_OS_LINUX)
currentOs = "linux";
#endif
QJsonArray rules = item["rules"].toArray();
for (const QJsonValue &value : rules) {
QJsonObject rule = value.toObject();
QString action = rule["action"].toString();
bool conditionMet = false;
if (rule.contains("os")) {
QJsonObject osRule = rule["os"].toObject();
if (osRule.contains("name") && osRule["name"].toString() == currentOs) {
conditionMet = true;
}
} else {
// Правило без указания ОС применяется ко всем системам.
conditionMet = true;
}
if (conditionMet) {
if (action == "allow") {
isAllowed = true;
} else if (action == "disallow") {
isAllowed = false;
}
}
}
return isAllowed;
}
void MainWindow::on_launchButton_clicked()
{
// --- 1. Выбор версии (остается без изменений) ---
QString minecraftPath = getMinecraftPath();
if (minecraftPath.isEmpty()) {
QMessageBox::warning(this, "Ошибка", "Не удалось найти директорию .minecraft.");
return;
}
QString versionsPath = QDir::toNativeSeparators(minecraftPath + "/versions");
QDir versionsDir(versionsPath);
if (!versionsDir.exists()) {
QMessageBox::warning(this, "Ошибка", "Папка 'versions' не найдена!");
return;
}
QStringList versionList = versionsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
if (versionList.isEmpty()) {
QMessageBox::warning(this, "Ошибка", "Не найдено ни одной установленной версии Minecraft.");
return;
}
bool ok;
QString selectedVersion = QInputDialog::getItem(this, "Выбор версии",
"Выберите версию Minecraft для запуска:",
versionList, 0, false, &ok);
if (!ok || selectedVersion.isEmpty()) {
return; // Пользователь отменил выбор
}
// --- 2. Чтение и парсинг JSON файла версии ---
QString jsonPath = QDir::toNativeSeparators(versionsPath + "/" + selectedVersion + "/" + selectedVersion + ".json");
QFile jsonFile(jsonPath);
if (!jsonFile.open(QIODevice::ReadOnly)) {
QMessageBox::critical(this, "Ошибка", "Не удалось открыть .json файл для версии " + selectedVersion);
return;
}
QByteArray jsonData = jsonFile.readAll();
jsonFile.close();
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
if (jsonDoc.isNull()) {
QMessageBox::critical(this, "Ошибка", "Некорректный .json файл для версии " + selectedVersion);
return;
}
QJsonObject rootObj = jsonDoc.object();
// --- 3. Формирование Classpath ---
QStringList classpathEntries;
QString librariesPath = QDir::toNativeSeparators(minecraftPath + "/libraries");
QJsonArray libraries = rootObj["libraries"].toArray();
for (const QJsonValue &value : libraries) {
QJsonObject library = value.toObject();
if (!checkRules(library)) {
continue; // Пропускаем библиотеку, если она не для этой ОС
}
QJsonObject downloads = library["downloads"].toObject();
if(downloads.isEmpty()){ // Для Fabric Loader и некоторых других
QString name = library["name"].toString();
QStringList parts = name.split(':');
QString path = parts[0].replace('.', '/') + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + ".jar";
classpathEntries << QDir::toNativeSeparators(librariesPath + "/" + path);
} else {
QJsonObject artifact = downloads["artifact"].toObject();
QString path = artifact["path"].toString();
classpathEntries << QDir::toNativeSeparators(librariesPath + "/" + path);
}
}
// Добавляем сам .jar файл игры в classpath
classpathEntries << QDir::toNativeSeparators(versionsPath + "/" + selectedVersion + "/" + selectedVersion + ".jar");
// Определяем разделитель для classpath в зависимости от ОС
QString pathSeparator;
#if defined(Q_OS_WIN)
pathSeparator = ";";
#else
pathSeparator = ":";
#endif
QString classpath = classpathEntries.join(pathSeparator);
// --- 4. Сборка аргументов ---
QStringList jvmArgs;
QStringList gameArgs;
// Аргументы для JVM
QJsonObject argumentsObj = rootObj["arguments"].toObject();
QJsonArray jvmArgsArray = argumentsObj["jvm"].toArray();
for (const QJsonValue &value : jvmArgsArray) {
if (value.isString()) {
jvmArgs << value.toString();
} else if (value.isObject()) {
if (checkRules(value.toObject())) {
QJsonArray values = value.toObject()["values"].toArray();
for(const QJsonValue &v : values){
jvmArgs << v.toString();
}
}
}
}
// Аргументы для игры
QJsonArray gameArgsArray = argumentsObj["game"].toArray();
for (const QJsonValue &value : gameArgsArray) {
if (value.isString()) {
gameArgs << value.toString();
} else if (value.isObject()) {
if (checkRules(value.toObject())) {
QJsonArray values = value.toObject()["values"].toArray();
for(const QJsonValue &v : values){
gameArgs << v.toString();
}
}
}
}
// --- 5. Подстановка значений в плейсхолдеры ---
QString nativesPath = QDir::toNativeSeparators(versionsPath + "/" + selectedVersion + "/natives");
QDir(nativesPath).mkpath("."); // Создаем папку для нативных библиотек, если ее нет
// Заменители для JVM аргументов
for (QString &arg : jvmArgs) {
arg.replace("${natives_directory}", nativesPath);
arg.replace("${launcher_name}", "CustomLauncher");
arg.replace("${launcher_version}", "1.0");
arg.replace("${classpath}", classpath);
}
// Заменители для игровых аргументов (используем базовые значения)
for (QString &arg : gameArgs) {
arg.replace("${auth_player_name}", "Player");
arg.replace("${version_name}", selectedVersion);
arg.replace("${game_directory}", minecraftPath);
arg.replace("${assets_root}", QDir::toNativeSeparators(minecraftPath + "/assets"));
arg.replace("${assets_index_name}", rootObj["assetIndex"].toObject()["id"].toString());
arg.replace("${auth_uuid}", "00000000-0000-0000-0000-000000000000");
arg.replace("${auth_access_token}", "0");
arg.replace("${clientid}", "N/A");
arg.replace("${auth_xuid}", "N/A");
arg.replace("${user_type}", "msa");
arg.replace("${version_type}", rootObj["type"].toString());
}
// --- 6. Финальная сборка и запуск ---
QString mainClass = rootObj["mainClass"].toString();
QString javaPath = "java";
QStringList finalArguments;
finalArguments << jvmArgs << mainClass << gameArgs;
ui->logOutput->appendPlainText("Запуск Minecraft версии: " + selectedVersion);
ui->logOutput->appendPlainText("Главный класс: " + mainClass);
// Для отладки можно вывести всю команду
ui->logOutput->appendPlainText("Команда: " + javaPath + " " + finalArguments.join(" "));
process->start(javaPath, finalArguments);
ui->progressBar->setVisible(true);
}
void MainWindow::on_modsFolderButton_clicked()
{
QString minecraftPath = getMinecraftPath();
if (minecraftPath.isEmpty()) {
QMessageBox::warning(this, "Ошибка", "Не удалось найти директорию .minecraft.");
return;
}
QString modsPath = minecraftPath + "/mods";
QDesktopServices::openUrl(QUrl::fromLocalFile(modsPath));
}
void MainWindow::on_settingsButton_clicked()
{
SettingsDialog dialog(this);
dialog.exec();
}
void MainWindow::on_updateModsButton_clicked()
{
QString gitRepoUrl = settings->value("gitRepoUrl").toString();
if (gitRepoUrl.isEmpty()) {
QMessageBox::information(this, "Настройки", "Пожалуйста, укажите URL Git-репозитория в настройках.");
return;
}
QString minecraftPath = getMinecraftPath();
if (minecraftPath.isEmpty()) {
QMessageBox::warning(this, "Ошибка", "Не удалось найти директорию .minecraft.");
return;
}
QString modsPath = minecraftPath + "/mods";
QDir modsDir(modsPath);
if (!modsDir.exists(".git")) {
ui->logOutput->appendPlainText("Клонирование модов из " + gitRepoUrl);
process->start("git", QStringList() << "clone" << gitRepoUrl << modsPath);
} else {
ui->logOutput->appendPlainText("Обновление модов...");
process->setWorkingDirectory(modsPath);
process->start("git", QStringList() << "pull");
}
ui->progressBar->setVisible(true);
}
void MainWindow::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
ui->progressBar->setVisible(false);
if (exitStatus == QProcess::CrashExit) {
ui->logOutput->appendPlainText("Процесс завершился с ошибкой.");
} else {
ui->logOutput->appendPlainText("Процесс успешно завершен с кодом " + QString::number(exitCode));
}
}
void MainWindow::onProcessError(QProcess::ProcessError error)
{
ui->progressBar->setVisible(false);
ui->logOutput->appendPlainText("Ошибка запуска процесса: " + process->errorString());
}
void MainWindow::readProcessOutput()
{
ui->logOutput->appendPlainText(process->readAllStandardOutput());
ui->logOutput->appendPlainText(process->readAllStandardError());
}
QString MainWindow::getMinecraftPath()
{
QString path;
#if defined(Q_OS_WIN)
path = QDir::homePath() + "/AppData/Roaming/.minecraft";
#elif defined(Q_OS_MAC)
path = QDir::homePath() + "/Library/Application Support/minecraft";
#else
path = QDir::homePath() + "/.minecraft";
#endif
return path;
}

41
mainwindow.h Normal file
View File

@@ -0,0 +1,41 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QProcess>
#include <QSettings>
// Предварительное объявление класса, сгенерированного из mainwindow.ui
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
// Слоты для кнопок (автоматически подключаются по имени: on_<имя_объекта>_<сигнал>)
void on_launchButton_clicked();
void on_modsFolderButton_clicked();
void on_updateModsButton_clicked();
void on_settingsButton_clicked();
// Слоты для QProcess (подключаются вручную)
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void onProcessError(QProcess::ProcessError error);
void readProcessOutput();
private:
QString getMinecraftPath();
Ui::MainWindow *ui; // Указатель на объект интерфейса
QProcess *process;
QSettings *settings;
};
#endif // MAINWINDOW_H

68
mainwindow.ui Normal file
View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Minecraft Лаунчер</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="launchButton">
<property name="text">
<string>Запустить Minecraft</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="modsFolderButton">
<property name="text">
<string>Открыть папку с модами</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="updateModsButton">
<property name="text">
<string>Обновить моды из Git</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="settingsButton">
<property name="text">
<string>Настройки</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="logOutput">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,180 +0,0 @@
// minecraft-launcher.cpp : Определяет точку входа для приложения.
//
#include "framework.h"
#include "minecraft-launcher.h"
#define MAX_LOADSTRING 100
// Глобальные переменные:
HINSTANCE hInst; // текущий экземпляр
WCHAR szTitle[MAX_LOADSTRING]; // Текст строки заголовка
WCHAR szWindowClass[MAX_LOADSTRING]; // имя класса главного окна
// Отправить объявления функций, включенных в этот модуль кода:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Разместите код здесь.
// Инициализация глобальных строк
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_MINECRAFTLAUNCHER, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// Выполнить инициализацию приложения:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_MINECRAFTLAUNCHER));
MSG msg;
// Цикл основного сообщения:
while (GetMessage(&msg, nullptr, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
//
// ФУНКЦИЯ: MyRegisterClass()
//
// ЦЕЛЬ: Регистрирует класс окна.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MINECRAFTLAUNCHER));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_MINECRAFTLAUNCHER);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassExW(&wcex);
}
//
// ФУНКЦИЯ: InitInstance(HINSTANCE, int)
//
// ЦЕЛЬ: Сохраняет маркер экземпляра и создает главное окно
//
// КОММЕНТАРИИ:
//
// В этой функции маркер экземпляра сохраняется в глобальной переменной, а также
// создается и выводится главное окно программы.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // Сохранить маркер экземпляра в глобальной переменной
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
//
// ФУНКЦИЯ: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// ЦЕЛЬ: Обрабатывает сообщения в главном окне.
//
// WM_COMMAND - обработать меню приложения
// WM_PAINT - Отрисовка главного окна
// WM_DESTROY - отправить сообщение о выходе и вернуться
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Разобрать выбор в меню:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// TODO: Добавьте сюда любой код прорисовки, использующий HDC...
EndPaint(hWnd, &ps);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Обработчик сообщений для окна "О программе".
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}

View File

@@ -1,3 +0,0 @@
#pragma once
#include "resource.h"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

View File

@@ -1,31 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36414.22 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minecraft-launcher", "minecraft-launcher.vcxproj", "{0E29BAEF-96E1-4395-89C1-81BB639C431F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0E29BAEF-96E1-4395-89C1-81BB639C431F}.Debug|x64.ActiveCfg = Debug|x64
{0E29BAEF-96E1-4395-89C1-81BB639C431F}.Debug|x64.Build.0 = Debug|x64
{0E29BAEF-96E1-4395-89C1-81BB639C431F}.Debug|x86.ActiveCfg = Debug|Win32
{0E29BAEF-96E1-4395-89C1-81BB639C431F}.Debug|x86.Build.0 = Debug|Win32
{0E29BAEF-96E1-4395-89C1-81BB639C431F}.Release|x64.ActiveCfg = Release|x64
{0E29BAEF-96E1-4395-89C1-81BB639C431F}.Release|x64.Build.0 = Release|x64
{0E29BAEF-96E1-4395-89C1-81BB639C431F}.Release|x86.ActiveCfg = Release|Win32
{0E29BAEF-96E1-4395-89C1-81BB639C431F}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {469A934A-1B3E-4697-8277-75EB382B41E8}
EndGlobalSection
EndGlobal

View File

@@ -1,144 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{0e29baef-96e1-4395-89c1-81bb639c431f}</ProjectGuid>
<RootNamespace>minecraftlauncher</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="minecraft-launcher.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="minecraft-launcher.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="minecraft-launcher.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="minecraft-launcher.ico" />
<Image Include="small.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Исходные файлы">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Файлы заголовков">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Файлы ресурсов">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="minecraft-launcher.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="minecraft-launcher.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="minecraft-launcher.rc">
<Filter>Файлы ресурсов</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="small.ico">
<Filter>Файлы ресурсов</Filter>
</Image>
<Image Include="minecraft-launcher.ico">
<Filter>Файлы ресурсов</Filter>
</Image>
</ItemGroup>
</Project>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

27
settingsdialog.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
SettingsDialog::SettingsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SettingsDialog)
{
ui->setupUi(this);
settings = new QSettings("MyCompany", "MinecraftLauncher", this);
ui->gitRepoEdit->setText(settings->value("gitRepoUrl").toString());
// Сигналы от кнопок (OK, Cancel) автоматически подключены к слотам accept() и reject()
// благодаря QDialogButtonBox и .ui файлу
}
SettingsDialog::~SettingsDialog()
{
delete ui;
}
// Эта функция будет вызвана при нажатии кнопки "OK"
void SettingsDialog::accept()
{
settings->setValue("gitRepoUrl", ui->gitRepoEdit->text());
QDialog::accept(); // Вызываем базовую реализацию, которая закрывает диалог
}

27
settingsdialog.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include <QDialog>
#include <QSettings>
namespace Ui {
class SettingsDialog;
}
class SettingsDialog : public QDialog
{
Q_OBJECT
public:
explicit SettingsDialog(QWidget *parent = nullptr);
~SettingsDialog();
private slots:
void accept(); // Переопределяем слот, чтобы сохранить настройки
private:
Ui::SettingsDialog *ui;
QSettings *settings;
};
#endif // SETTINGSDIALOG_H

74
settingsdialog.ui Normal file
View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsDialog</class>
<widget class="QDialog" name="SettingsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>120</height>
</rect>
</property>
<property name="windowTitle">
<string>Настройки</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>URL Git-репозитория с модами:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="gitRepoEdit"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SettingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SettingsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

BIN
small.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -1,6 +0,0 @@
#pragma once
// // При включении SDKDDKVer.h будет задана самая новая из доступных платформ Windows.
// Если вы планируете сборку приложения для предыдущей версии платформы Windows, включите WinSDKVer.h и
// задайте желаемую платформу в макросе _WIN32_WINNT, прежде чем включать SDKDDKVer.h.
#include <SDKDDKVer.h>