added a new feature to delete existing version\profile
This commit is contained in:
+2
-2
@@ -19,8 +19,8 @@ qt_add_qml_module(appMinecraft_launcher
|
||||
launcherbackend.cpp
|
||||
QML_FILES
|
||||
Main.qml
|
||||
RESOURCES images/Folder/Folder_Active.svg images/Folder/Folder_Idle.svg images/Folder/Folder_Pressed.svg images/Options/Options_active.svg images/Options/Options_Idle.svg images/Options/Options_Pressed.svg images/Play_Button/Play_Active.svg images/Play_Button/Play_Idle.svg images/Play_Button/Play_pressed.svg images/Profile_Box/Asset_23.svg images/Profile_Box/Asset_24.svg images/Profile_Box/Kishka_Profile_Active.svg images/Profile_Box/Kishka_Profile_Idle.svg images/Profile_Box/Kishka_Profile_open.svg images/Scroll/Scroll_Lever.svg images/Scroll/Scroll_palka.svg images/Version_box/Kishka_Profile_Open.svg images/Version_box/Kishka_Ver_Active.svg images/Version_box/Kishka_Ver_idle.svg images/GovuztTW8AAHqBf.jpeg images/photo_2025-12-16_15-04-17.jpg images/photo_2025-12-21_02-30-09.jpg
|
||||
RESOURCES images/Folder/Folder_Active.svg images/Folder/Folder_Idle.svg images/Folder/Folder_Pressed.svg images/Options/Options_active.svg images/Options/Options_Idle.svg images/Options/Options_Pressed.svg images/Play_Button/Play_Active.svg images/Play_Button/Play_Idle.svg images/Play_Button/Play_pressed.svg images/Profile_Box/Asset_23.jpg images/Profile_Box/Asset_23.svg images/Profile_Box/Asset_24.jpg images/Profile_Box/Asset_24.svg images/Profile_Box/Kishka_Profile_Active.svg images/Profile_Box/Kishka_Profile_Idle.svg images/Profile_Box/Kishka_Profile_open.svg images/Scroll/Scroll_Lever.svg images/Scroll/Scroll_palka.svg images/Version_box/Kishka_Profile_Open.svg images/Version_box/Kishka_Ver_Active.svg images/Version_box/Kishka_Ver_idle.svg images/GovuztTW8AAHqBf.jpeg images/photo_2025-12-16_15-04-17.jpg images/photo_2025-12-21_02-30-09.jpg
|
||||
RESOURCES images/Folder/Folder_Active.svg images/Folder/Folder_Idle.svg images/Folder/Folder_Pressed.svg images/Options/Options_active.svg images/Options/Options_Idle.svg images/Options/Options_Pressed.svg images/Play_Button/Play_Active.svg images/Play_Button/Play_Idle.svg images/Play_Button/Play_pressed.svg images/Profile_Box/Asset_23.svg images/Profile_Box/Asset_24.svg images/Profile_Box/Kishka_Profile_Active.svg images/Profile_Box/Kishka_Profile_Idle.svg images/Profile_Box/Kishka_Profile_open.svg images/Scroll/Scroll_Lever.svg images/Scroll/Scroll_palka.svg images/Version_box/Kishka_Profile_Open.svg images/Version_box/Kishka_Ver_Active.svg images/Version_box/Kishka_Ver_idle.svg images/Trash.svg images/GovuztTW8AAHqBf.jpeg images/photo_2025-12-16_15-04-17.jpg images/photo_2025-12-21_02-30-09.jpg
|
||||
RESOURCES images/Folder/Folder_Active.svg images/Folder/Folder_Idle.svg images/Folder/Folder_Pressed.svg images/Options/Options_active.svg images/Options/Options_Idle.svg images/Options/Options_Pressed.svg images/Play_Button/Play_Active.svg images/Play_Button/Play_Idle.svg images/Play_Button/Play_pressed.svg images/Profile_Box/Asset_23.jpg images/Profile_Box/Asset_23.svg images/Profile_Box/Asset_24.jpg images/Profile_Box/Asset_24.svg images/Profile_Box/Kishka_Profile_Active.svg images/Profile_Box/Kishka_Profile_Idle.svg images/Profile_Box/Kishka_Profile_open.svg images/Scroll/Scroll_Lever.svg images/Scroll/Scroll_palka.svg images/Version_box/Kishka_Profile_Open.svg images/Version_box/Kishka_Ver_Active.svg images/Version_box/Kishka_Ver_idle.svg images/Trash.svg images/GovuztTW8AAHqBf.jpeg images/photo_2025-12-16_15-04-17.jpg images/photo_2025-12-21_02-30-09.jpg
|
||||
)
|
||||
|
||||
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
||||
|
||||
@@ -190,6 +190,7 @@ Window {
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
leftPadding: 8
|
||||
rightPadding: 36
|
||||
}
|
||||
background: Rectangle {
|
||||
color: (profileBox.currentIndex === profileItem.index || profileItem.hovered)
|
||||
@@ -200,6 +201,28 @@ Window {
|
||||
profileBox.currentIndex = profileItem.index
|
||||
profileBox.popup.close()
|
||||
}
|
||||
|
||||
// ── Корзина — видна при наведении на строку ─────
|
||||
Image {
|
||||
id: profileTrash
|
||||
width: 16; height: 16
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: profileItem.hovered
|
||||
opacity: profileTrashArea.containsMouse ? 1.0 : 0.7
|
||||
source: "images/Trash.svg"
|
||||
sourceSize.width: 16; sourceSize.height: 16
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
MouseArea {
|
||||
id: profileTrashArea
|
||||
anchors.fill: parent
|
||||
anchors.margins: -6
|
||||
hoverEnabled: true
|
||||
onClicked: backend.removeProfile(profileItem.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollIndicator.vertical: ScrollIndicator {
|
||||
@@ -331,6 +354,7 @@ Window {
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
leftPadding: 8
|
||||
rightPadding: 36
|
||||
}
|
||||
background: Rectangle {
|
||||
color: (versionBox.currentIndex === versionItem.index || versionItem.hovered)
|
||||
@@ -341,6 +365,28 @@ Window {
|
||||
versionBox.currentIndex = versionItem.index
|
||||
versionBox.popup.close()
|
||||
}
|
||||
|
||||
// ── Корзина — видна при наведении на строку ─────
|
||||
Image {
|
||||
id: versionTrash
|
||||
width: 16; height: 16
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: versionItem.hovered
|
||||
opacity: versionTrashArea.containsMouse ? 1.0 : 0.7
|
||||
source: "images/Trash.svg"
|
||||
sourceSize.width: 16; sourceSize.height: 16
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
MouseArea {
|
||||
id: versionTrashArea
|
||||
anchors.fill: parent
|
||||
anchors.margins: -6
|
||||
hoverEnabled: true
|
||||
onClicked: backend.removeVersion(versionItem.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollIndicator.vertical: ScrollIndicator {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<polyline points="3 6 5 6 21 6"/>
|
||||
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
|
||||
<line x1="10" y1="11" x2="10" y2="17"/>
|
||||
<line x1="14" y1="11" x2="14" y2="17"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 374 B |
@@ -46,6 +46,24 @@ void LauncherBackend::addVersion(const QString &name, const QString &serverUrl)
|
||||
emit versionsChanged();
|
||||
}
|
||||
|
||||
void LauncherBackend::removeProfile(int index)
|
||||
{
|
||||
if (index < 0 || index >= m_profiles.size())
|
||||
return;
|
||||
m_profiles.removeAt(index);
|
||||
saveProfiles();
|
||||
emit profilesChanged();
|
||||
}
|
||||
|
||||
void LauncherBackend::removeVersion(int index)
|
||||
{
|
||||
if (index < 0 || index >= m_versions.size())
|
||||
return;
|
||||
m_versions.removeAt(index);
|
||||
saveVersions();
|
||||
emit versionsChanged();
|
||||
}
|
||||
|
||||
void LauncherBackend::launchGame(int profileIndex, int versionIndex)
|
||||
{
|
||||
if (profileIndex < 0 || profileIndex >= m_profiles.size()) {
|
||||
|
||||
@@ -20,6 +20,8 @@ public:
|
||||
|
||||
Q_INVOKABLE void addProfile(const QString &name, const QString &login, const QString &password);
|
||||
Q_INVOKABLE void addVersion(const QString &name, const QString &serverUrl);
|
||||
Q_INVOKABLE void removeProfile(int index);
|
||||
Q_INVOKABLE void removeVersion(int index);
|
||||
Q_INVOKABLE void launchGame(int profileIndex, int versionIndex);
|
||||
|
||||
signals:
|
||||
|
||||
Reference in New Issue
Block a user