diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c4ebaf..553a0d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. diff --git a/Main.qml b/Main.qml index a10fb30..de6892a 100644 --- a/Main.qml +++ b/Main.qml @@ -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 { diff --git a/images/Trash.svg b/images/Trash.svg new file mode 100644 index 0000000..d38395d --- /dev/null +++ b/images/Trash.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/launcherbackend.cpp b/launcherbackend.cpp index def6a30..b8b61c5 100644 --- a/launcherbackend.cpp +++ b/launcherbackend.cpp @@ -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()) { diff --git a/launcherbackend.h b/launcherbackend.h index b8ad4e6..5035c8f 100644 --- a/launcherbackend.h +++ b/launcherbackend.h @@ -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: