Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 38d9805150 | |||
| d760bc2f83 | |||
| 0ebf7e07a7 | |||
| 52ef710cd7 | |||
| 4b2026e96b | |||
| 4c0c566ff9 | |||
| 6cfadfc4b6 |
@@ -1,43 +0,0 @@
|
|||||||
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
|
|
||||||
profiledialog.h profiledialog.cpp profiledialog.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})
|
|
||||||
4
README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# minecraft-launcher
|
||||||
|
|
||||||
|
Первая итерация самописного лаунчера для запуска сборок Minecraft
|
||||||
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
This is a UI file (.ui.qml) that is intended to be edited in Qt Design Studio only.
|
|
||||||
It is supposed to be strictly declarative and only uses a subset of QML. If you edit
|
|
||||||
this file manually, you might introduce QML code that is not supported by Qt Design Studio.
|
|
||||||
Check out https://doc.qt.io/qtcreator/creator-quick-ui-forms.html for details on .ui.qml files.
|
|
||||||
*/
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import UntitledProject1
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: rectangle
|
|
||||||
width: Constants.width
|
|
||||||
height: Constants.height
|
|
||||||
color: "#2e2e2e"
|
|
||||||
radius: 0
|
|
||||||
border.color: "#1a1a1a"
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: kishkaProfileIdle
|
|
||||||
x: 40
|
|
||||||
y: 239
|
|
||||||
source: "Profile Box/Kishka Profile Idle.svg"
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
}
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: kishkaVerIdle
|
|
||||||
x: 165
|
|
||||||
y: 239
|
|
||||||
source: "Version box/Kishka Ver idle.svg"
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: folderbutt
|
|
||||||
x: 130
|
|
||||||
y: 304
|
|
||||||
width: 70
|
|
||||||
height: 40
|
|
||||||
visible: true
|
|
||||||
text: qsTr("Button")
|
|
||||||
topPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
leftPadding: 0
|
|
||||||
icon.width: 335
|
|
||||||
icon.source: "Folder/Folder Idle.svg"
|
|
||||||
icon.height: 170
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
flat: true
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
bottomPadding: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: playbutt
|
|
||||||
x: 40
|
|
||||||
y: 57
|
|
||||||
width: 335
|
|
||||||
height: 170
|
|
||||||
visible: true
|
|
||||||
text: qsTr("Button")
|
|
||||||
icon.cache: false
|
|
||||||
rightPadding: 0
|
|
||||||
bottomPadding: 0
|
|
||||||
leftPadding: 0
|
|
||||||
topPadding: 0
|
|
||||||
flat: true
|
|
||||||
icon.height: 170
|
|
||||||
icon.width: 335
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
icon.source: "Play Button/Play Idle.svg"
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: optionsbut
|
|
||||||
x: 215
|
|
||||||
y: 304
|
|
||||||
width: 70
|
|
||||||
height: 40
|
|
||||||
visible: true
|
|
||||||
text: qsTr("Button")
|
|
||||||
topPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
leftPadding: 0
|
|
||||||
icon.width: 335
|
|
||||||
icon.source: "Options/Options Idle.svg"
|
|
||||||
icon.height: 170
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
icon.cache: false
|
|
||||||
flat: true
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
bottomPadding: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
name: "clicked"
|
|
||||||
when: playbutt.pressed
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: playbutt
|
|
||||||
x: 40
|
|
||||||
y: 55
|
|
||||||
rightPadding: 0
|
|
||||||
bottomPadding: 0
|
|
||||||
leftPadding: 0
|
|
||||||
topPadding: 0
|
|
||||||
icon.source: "Play Button/Play pressed.svg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
State {
|
|
||||||
name: "Hover"
|
|
||||||
when: playbutt.hovered
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: playbutt
|
|
||||||
flat: true
|
|
||||||
icon.source: "Play Button/Play Active.svg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "Folder Pressed"
|
|
||||||
when: folderbutt.pressed
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: folderbutt
|
|
||||||
icon.source: "Folder/Folder Pressed.svg"
|
|
||||||
icon.height: 170
|
|
||||||
icon.width: 335
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
State {
|
|
||||||
name: "Folder Hover"
|
|
||||||
when: folderbutt.hovered
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: rectangle
|
|
||||||
color: "#2e2e2e"
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: folderbutt
|
|
||||||
x: 130
|
|
||||||
y: 304
|
|
||||||
icon.height: 170
|
|
||||||
icon.width: 335
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
icon.source: "Folder/Folder Active.svg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "Option Pressed"
|
|
||||||
when: optionsbut.pressed
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: optionsbut
|
|
||||||
icon.source: "Options/Options active.svg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "OptionHover"
|
|
||||||
when: optionsbut.hovered
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: optionsbut
|
|
||||||
icon.source: "Options/Options Pressed.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
This is a UI file (.ui.qml) that is intended to be edited in Qt Design Studio only.
|
|
||||||
It is supposed to be strictly declarative and only uses a subset of QML. If you edit
|
|
||||||
this file manually, you might introduce QML code that is not supported by Qt Design Studio.
|
|
||||||
Check out https://doc.qt.io/qtcreator/creator-quick-ui-forms.html for details on .ui.qml files.
|
|
||||||
*/
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import UntitledProject1
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: rectangle
|
|
||||||
width: Constants.width
|
|
||||||
height: Constants.height
|
|
||||||
color: "#2e2e2e"
|
|
||||||
radius: 0
|
|
||||||
border.color: "#1a1a1a"
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: kishkaProfileIdle
|
|
||||||
x: 40
|
|
||||||
y: 239
|
|
||||||
source: "Profile Box/Kishka Profile Idle.svg"
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
}
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: kishkaVerIdle
|
|
||||||
x: 165
|
|
||||||
y: 239
|
|
||||||
source: "Version box/Kishka Ver idle.svg"
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: folderbutt
|
|
||||||
x: 130
|
|
||||||
y: 304
|
|
||||||
width: 70
|
|
||||||
height: 40
|
|
||||||
visible: true
|
|
||||||
text: qsTr("Button")
|
|
||||||
topPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
leftPadding: 0
|
|
||||||
icon.width: 335
|
|
||||||
icon.source: "Folder/Folder Idle.svg"
|
|
||||||
icon.height: 170
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
flat: true
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
bottomPadding: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: playbutt
|
|
||||||
x: 40
|
|
||||||
y: 57
|
|
||||||
width: 335
|
|
||||||
height: 170
|
|
||||||
visible: true
|
|
||||||
text: qsTr("Button")
|
|
||||||
icon.cache: false
|
|
||||||
rightPadding: 0
|
|
||||||
bottomPadding: 0
|
|
||||||
leftPadding: 0
|
|
||||||
topPadding: 0
|
|
||||||
flat: true
|
|
||||||
icon.height: 170
|
|
||||||
icon.width: 335
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
icon.source: "Play Button/Play Idle.svg"
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: optionsbut
|
|
||||||
x: 215
|
|
||||||
y: 304
|
|
||||||
width: 70
|
|
||||||
height: 40
|
|
||||||
visible: true
|
|
||||||
text: qsTr("Button")
|
|
||||||
topPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
leftPadding: 0
|
|
||||||
icon.width: 335
|
|
||||||
icon.source: "Options/Options Idle.svg"
|
|
||||||
icon.height: 170
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
icon.cache: false
|
|
||||||
flat: true
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
bottomPadding: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
name: "clicked"
|
|
||||||
when: playbutt.pressed
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: playbutt
|
|
||||||
x: 40
|
|
||||||
y: 55
|
|
||||||
rightPadding: 0
|
|
||||||
bottomPadding: 0
|
|
||||||
leftPadding: 0
|
|
||||||
topPadding: 0
|
|
||||||
icon.source: "Play Button/Play pressed.svg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
State {
|
|
||||||
name: "Hover"
|
|
||||||
when: playbutt.hovered
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: playbutt
|
|
||||||
flat: true
|
|
||||||
icon.source: "Play Button/Play Active.svg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "Folder Pressed"
|
|
||||||
when: folderbutt.pressed
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: folderbutt
|
|
||||||
icon.source: "Folder/Folder Pressed.svg"
|
|
||||||
icon.height: 170
|
|
||||||
icon.width: 335
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
State {
|
|
||||||
name: "Folder Hover"
|
|
||||||
when: folderbutt.hovered
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: rectangle
|
|
||||||
color: "#2e2e2e"
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: folderbutt
|
|
||||||
x: 130
|
|
||||||
y: 304
|
|
||||||
icon.height: 170
|
|
||||||
icon.width: 335
|
|
||||||
icon.color: "#0026282a"
|
|
||||||
icon.source: "Folder/Folder Active.svg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "Option Pressed"
|
|
||||||
when: optionsbut.pressed
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: optionsbut
|
|
||||||
icon.source: "Options/Options active.svg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "OptionHover"
|
|
||||||
when: optionsbut.hovered
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: optionsbut
|
|
||||||
icon.source: "Options/Options Pressed.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 743 B |
@@ -1,22 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 743 B |
@@ -1,22 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 743 B |
@@ -1,26 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 978 B |
@@ -1,26 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 978 B |
@@ -1,26 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 978 B |
@@ -1,27 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,27 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,27 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,23 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 618 B |
@@ -1,23 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 618 B |
@@ -1,23 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 618 B |
@@ -1,14 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 395 B |
@@ -1,14 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 397 B |
@@ -1,23 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 612 B |
@@ -1,23 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 612 B |
@@ -1,23 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 612 B |
10
main.cpp
@@ -1,10 +0,0 @@
|
|||||||
#include "mainwindow.h"
|
|
||||||
#include <QApplication>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
QApplication a(argc, argv);
|
|
||||||
MainWindow w;
|
|
||||||
w.show();
|
|
||||||
return a.exec();
|
|
||||||
}
|
|
||||||
467
mainwindow.cpp
@@ -1,467 +0,0 @@
|
|||||||
#include "mainwindow.h"
|
|
||||||
#include "ui_mainwindow.h" // Подключаем сгенерированный заголовочный файл
|
|
||||||
#include "settingsdialog.h"
|
|
||||||
#include "profiledialog.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
|
|
||||||
#include <QUuid> // Для генерации ID профиля
|
|
||||||
#include <QStandardPaths> // Для поиска папки с данными
|
|
||||||
|
|
||||||
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)));
|
|
||||||
// Загружаем профили при старте
|
|
||||||
profilesPath = "/launcher_profiles.json";
|
|
||||||
loadProfiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
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::loadProfiles()
|
|
||||||
{
|
|
||||||
QFile profilesFile(profilesPath);
|
|
||||||
if (profilesFile.exists() && profilesFile.open(QIODevice::ReadOnly)) {
|
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(profilesFile.readAll());
|
|
||||||
profilesData = doc.object();
|
|
||||||
profilesFile.close();
|
|
||||||
} else {
|
|
||||||
// Создаем базовую структуру, если файла нет
|
|
||||||
profilesData = QJsonObject({{"profiles", QJsonObject()}});
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonObject profiles = profilesData["profiles"].toObject();
|
|
||||||
ui->profileComboBox->clear();
|
|
||||||
|
|
||||||
if (profiles.isEmpty()) {
|
|
||||||
// Если профилей нет, принудительно открываем диалог создания
|
|
||||||
QMessageBox::information(this, "Настройка", "Не найдено ни одного профиля. Давайте создадим новый.");
|
|
||||||
createNewProfile();
|
|
||||||
return; // createNewProfile вызовет loadProfiles() повторно
|
|
||||||
}
|
|
||||||
|
|
||||||
// Заполняем ComboBox
|
|
||||||
for (const QString &key : profiles.keys()) {
|
|
||||||
QJsonObject profile = profiles[key].toObject();
|
|
||||||
ui->profileComboBox->addItem(profile["name"].toString(), key); // Имя и UUID
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::saveProfiles()
|
|
||||||
{
|
|
||||||
QFile profilesFile(profilesPath);
|
|
||||||
if (profilesFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
|
||||||
QJsonDocument doc(profilesData);
|
|
||||||
profilesFile.write(doc.toJson(QJsonDocument::Indented));
|
|
||||||
profilesFile.close();
|
|
||||||
} else {
|
|
||||||
QMessageBox::critical(this, "Ошибка", "Не удалось сохранить файл профилей: " + profilesFile.errorString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_editProfileButton_clicked()
|
|
||||||
{
|
|
||||||
// 1. Проверяем, выбран ли профиль
|
|
||||||
QString currentProfileId = ui->profileComboBox->currentData().toString();
|
|
||||||
if (currentProfileId.isEmpty()) {
|
|
||||||
QMessageBox::warning(this, "Нет профиля", "Пожалуйста, выберите профиль для редактирования.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Получаем данные текущего профиля
|
|
||||||
QJsonObject profiles = profilesData["profiles"].toObject();
|
|
||||||
QJsonObject currentProfile = profiles[currentProfileId].toObject();
|
|
||||||
|
|
||||||
// 3. Создаем диалог и заполняем его данными
|
|
||||||
ProfileDialog dialog(this);
|
|
||||||
dialog.setWindowTitle("Редактирование профиля");
|
|
||||||
dialog.setProfileName(currentProfile["name"].toString());
|
|
||||||
dialog.setJavaPath(currentProfile["javaDir"].toString());
|
|
||||||
|
|
||||||
// 4. Показываем диалог и обрабатываем результат
|
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
|
||||||
if (dialog.profileName().isEmpty() || dialog.javaPath().isEmpty()) {
|
|
||||||
QMessageBox::warning(this, "Ошибка", "Имя профиля и путь к Java не могут быть пустыми.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 5. Обновляем данные в нашем JSON объекте
|
|
||||||
currentProfile["name"] = dialog.profileName();
|
|
||||||
currentProfile["javaDir"] = dialog.javaPath();
|
|
||||||
|
|
||||||
// 6. Записываем обновленный профиль обратно
|
|
||||||
profiles[currentProfileId] = currentProfile;
|
|
||||||
profilesData["profiles"] = profiles;
|
|
||||||
|
|
||||||
// 7. Сохраняем и перезагружаем список
|
|
||||||
saveProfiles();
|
|
||||||
|
|
||||||
// Сохраняем ID, чтобы восстановить выбор после перезагрузки
|
|
||||||
QString previouslySelectedId = currentProfileId;
|
|
||||||
loadProfiles();
|
|
||||||
int indexToSelect = ui->profileComboBox->findData(previouslySelectedId);
|
|
||||||
if (indexToSelect != -1) {
|
|
||||||
ui->profileComboBox->setCurrentIndex(indexToSelect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::createNewProfile()
|
|
||||||
{
|
|
||||||
ProfileDialog dialog(this);
|
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
|
||||||
if (dialog.profileName().isEmpty() || dialog.javaPath().isEmpty()) {
|
|
||||||
QMessageBox::warning(this, "Ошибка", "Имя профиля и путь к Java не могут быть пустыми.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString uuid = QUuid::createUuid().toString(QUuid::WithoutBraces);
|
|
||||||
QJsonObject newProfile;
|
|
||||||
newProfile["name"] = dialog.profileName();
|
|
||||||
newProfile["javaDir"] = dialog.javaPath();
|
|
||||||
newProfile["lastVersionId"] = "";
|
|
||||||
newProfile["created"] = QDateTime::currentDateTime().toString(Qt::ISODate);
|
|
||||||
newProfile["lastUsed"] = QDateTime::currentDateTime().toString(Qt::ISODate);
|
|
||||||
newProfile["icon"] = "Bedrock";
|
|
||||||
newProfile["type"] = "custom";
|
|
||||||
|
|
||||||
QJsonObject profiles = profilesData["profiles"].toObject();
|
|
||||||
profiles[uuid] = newProfile;
|
|
||||||
profilesData["profiles"] = profiles;
|
|
||||||
|
|
||||||
saveProfiles();
|
|
||||||
loadProfiles(); // Перезагружаем список профилей
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_addProfileButton_clicked()
|
|
||||||
{
|
|
||||||
createNewProfile();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_profileComboBox_currentIndexChanged(int index)
|
|
||||||
{
|
|
||||||
// Пока ничего не делаем, но слот полезен для будущего
|
|
||||||
Q_UNUSED(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_launchButton_clicked()
|
|
||||||
{
|
|
||||||
QString currentProfileId = ui->profileComboBox->currentData().toString();
|
|
||||||
if (currentProfileId.isEmpty()) {
|
|
||||||
QMessageBox::critical(this, "Ошибка", "Не выбран профиль для запуска!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QJsonObject profile = profilesData["profiles"].toObject()[currentProfileId].toObject();
|
|
||||||
QString javaPath = profile["javaDir"].toString();
|
|
||||||
if (!QFileInfo::exists(javaPath)) {
|
|
||||||
QMessageBox::critical(this, "Ошибка", "Не найден исполняемый файл Java, указанный в профиле:\n" + javaPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// --- 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;
|
|
||||||
}
|
|
||||||
52
mainwindow.h
@@ -1,52 +0,0 @@
|
|||||||
#ifndef MAINWINDOW_H
|
|
||||||
#define MAINWINDOW_H
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QJsonObject> // Важно: добавить для хранения данных профилей
|
|
||||||
|
|
||||||
// Предварительное объявление класса, сгенерированного из 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();
|
|
||||||
void on_addProfileButton_clicked(); // Слот для кнопки "Новый..."
|
|
||||||
void on_editProfileButton_clicked(); // <-- ДОБАВЬТЕ ЭТОТ СЛОТ
|
|
||||||
void on_profileComboBox_currentIndexChanged(int index); // Слот для смены профиля
|
|
||||||
|
|
||||||
// Слоты для QProcess (подключаются вручную)
|
|
||||||
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|
||||||
void onProcessError(QProcess::ProcessError error);
|
|
||||||
void readProcessOutput();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString getMinecraftPath();
|
|
||||||
|
|
||||||
// Новые методы для работы с профилями
|
|
||||||
void loadProfiles();
|
|
||||||
void saveProfiles();
|
|
||||||
void createNewProfile();
|
|
||||||
QString profilesPath; // Путь к launcher_profiles.json
|
|
||||||
QJsonObject profilesData; // JSON данные из файла
|
|
||||||
|
|
||||||
Ui::MainWindow *ui; // Указатель на объект интерфейса
|
|
||||||
QProcess *process;
|
|
||||||
QSettings *settings;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Профиль:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="profileComboBox"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addProfileButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Новый...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="editProfileButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Редактировать...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<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>
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
#include "profiledialog.h"
|
|
||||||
#include "ui_profiledialog.h"
|
|
||||||
#include <QFileDialog>
|
|
||||||
|
|
||||||
ProfileDialog::ProfileDialog(QWidget *parent) :
|
|
||||||
QDialog(parent),
|
|
||||||
ui(new Ui::ProfileDialog)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProfileDialog::~ProfileDialog()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ProfileDialog::profileName() const
|
|
||||||
{
|
|
||||||
return ui->profileNameEdit->text();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ProfileDialog::javaPath() const
|
|
||||||
{
|
|
||||||
return ui->javaPathEdit->text();
|
|
||||||
}
|
|
||||||
// === РЕАЛИЗАЦИЯ НОВЫХ ФУНКЦИЙ ===
|
|
||||||
void ProfileDialog::setProfileName(const QString &name)
|
|
||||||
{
|
|
||||||
ui->profileNameEdit->setText(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProfileDialog::setJavaPath(const QString &path)
|
|
||||||
{
|
|
||||||
ui->javaPathEdit->setText(path);
|
|
||||||
}
|
|
||||||
// ===============================
|
|
||||||
|
|
||||||
void ProfileDialog::on_browseButton_clicked()
|
|
||||||
{
|
|
||||||
QString filter = "Исполняемый файл (java.exe)";
|
|
||||||
#if !defined(Q_OS_WIN)
|
|
||||||
filter = "Все файлы (*)";
|
|
||||||
#endif
|
|
||||||
QString path = QFileDialog::getOpenFileName(this, "Выберите java.exe", QDir::homePath(), filter);
|
|
||||||
if (!path.isEmpty()) {
|
|
||||||
ui->javaPathEdit->setText(QDir::toNativeSeparators(path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#ifndef PROFILEDIALOG_H
|
|
||||||
#define PROFILEDIALOG_H
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class ProfileDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ProfileDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit ProfileDialog(QWidget *parent = nullptr);
|
|
||||||
~ProfileDialog();
|
|
||||||
|
|
||||||
QString profileName() const;
|
|
||||||
QString javaPath() const;
|
|
||||||
// === НОВЫЕ ФУНКЦИИ ===
|
|
||||||
void setProfileName(const QString &name);
|
|
||||||
void setJavaPath(const QString &path);
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_browseButton_clicked();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::ProfileDialog *ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // PROFILEDIALOG_H
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ProfileDialog</class>
|
|
||||||
<widget class="QDialog" name="ProfileDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>450</width>
|
|
||||||
<height>150</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Настройка профиля</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Имя профиля:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="profileNameEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Путь к Java:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="javaPathEdit"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="browseButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</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>ProfileDialog</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>ProfileDialog</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>
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#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(); // Вызываем базовую реализацию, которая закрывает диалог
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#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
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
<?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>
|
|
||||||