diff --git a/Fk/ModMaker/ModInit.qml b/Fk/ModMaker/ModInit.qml index c8a2ad3e..7d369a61 100644 --- a/Fk/ModMaker/ModInit.qml +++ b/Fk/ModMaker/ModInit.qml @@ -45,7 +45,28 @@ Item { ListView { anchors.fill: parent model: modConfig.modList - delegate: Text { text: modelData } + delegate: SwipeDelegate { + width: root.width + text: modelData + + swipe.right: Label { + id: deleteLabel + text: qsTr("Delete") + color: "white" + verticalAlignment: Label.AlignVCenter + padding: 12 + height: parent.height + anchors.right: parent.right + opacity: swipe.complete ? 1 : 0 + Behavior on opacity { NumberAnimation { } } + + SwipeDelegate.onClicked: deleteMod(modelData); + + background: Rectangle { + color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato" + } + } + } } } @@ -110,4 +131,9 @@ Item { ModBackend.commitChanges(name, "Initial commit", modConfig.userName, modConfig.email); modConfig.addMod(name); } + + function deleteMod(name) { + ModBackend.removeMod(name); + modConfig.removeMod(name); + } } diff --git a/Fk/Pages/Init.qml b/Fk/Pages/Init.qml index 47a1f70d..8763af0c 100644 --- a/Fk/Pages/Init.qml +++ b/Fk/Pages/Init.qml @@ -158,7 +158,7 @@ Item { anchors.bottom: parent.bottom anchors.leftMargin: 12 anchors.bottomMargin: 12 - text: "FreeKill " + FkVersion + text: qsTr("FreeKill") + " v" + FkVersion font.pixelSize: 16 font.bold: true } @@ -188,6 +188,7 @@ Item { text: qsTr("Mod Making") anchors.right: parent.right anchors.bottom: parent.bottom + visible: Debugging onClicked: { mainStack.push(modMaker); } diff --git a/lang/zh_CN.ts b/lang/zh_CN.ts index eb2d51c7..aad5f756 100644 --- a/lang/zh_CN.ts +++ b/lang/zh_CN.ts @@ -59,6 +59,10 @@ Init + + FreeKill + 新月杀 + Username 用户名 @@ -227,6 +231,10 @@ ModMaker 新月杀Mod制作器 - 首页 + + Delete + 删除 + config is incomplete diff --git a/lib/android/libgit2.so b/lib/android/libgit2.so old mode 100644 new mode 100755 index 1f2e4f40..0cb084f1 Binary files a/lib/android/libgit2.so and b/lib/android/libgit2.so differ diff --git a/lib/android/libssh2.so b/lib/android/libssh2.so new file mode 100755 index 00000000..679be0f6 Binary files /dev/null and b/lib/android/libssh2.so differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cd1da7a0..3f97f135 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,10 +49,11 @@ elseif (ANDROID) set(SQLITE3_LIB ${PROJECT_SOURCE_DIR}/lib/android/libsqlite3.so) set(CRYPTO_LIB ${PROJECT_SOURCE_DIR}/lib/android/libcrypto.so) set(SSL_LIB ${PROJECT_SOURCE_DIR}/lib/android/libssl.so) + set(SSH_LIB ${PROJECT_SOURCE_DIR}/lib/android/libssh2.so) set(GIT_LIB ${PROJECT_SOURCE_DIR}/lib/android/libgit2.so) set_target_properties(FreeKill PROPERTIES QT_ANDROID_PACKAGE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/android - QT_ANDROID_EXTRA_LIBS "${LUA_LIB};${SQLITE3_LIB};${CRYPTO_LIB};${SSL_LIB};${GIT_LIB}" + QT_ANDROID_EXTRA_LIBS "${LUA_LIB};${SQLITE3_LIB};${CRYPTO_LIB};${SSL_LIB};${SSH_LIB};${GIT_LIB}" ) list(REMOVE_ITEM QT_LIB Qt6::QuickControls2) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten") @@ -88,6 +89,7 @@ target_link_libraries(FreeKill PRIVATE ${SSL_LIB} ${READLINE_LIB} ${QT_LIB} + ${SSH_LIB} ${GIT_LIB} ${IDBFS_LIB} ) diff --git a/src/server/server.cpp b/src/server/server.cpp index 1c2f68da..b5942485 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -8,6 +8,8 @@ #include #include +#include + #include "client_socket.h" #include "packman.h" #include "player.h" diff --git a/src/ui/mod.cpp b/src/ui/mod.cpp index 3271a92e..eb27f8fa 100644 --- a/src/ui/mod.cpp +++ b/src/ui/mod.cpp @@ -125,6 +125,10 @@ void ModMaker::createMod(const QString &name) { init(name); } +void ModMaker::removeMod(const QString &name) { + QDir("mymod/" + name).removeRecursively(); +} + void ModMaker::commitChanges(const QString &name, const QString &msg, const QString &user, const QString &email) { diff --git a/src/ui/mod.h b/src/ui/mod.h index 9e21679c..6bbe6abe 100644 --- a/src/ui/mod.h +++ b/src/ui/mod.h @@ -16,6 +16,7 @@ public: Q_INVOKABLE void saveToFile(const QString &fileName, const QString &content); Q_INVOKABLE void createMod(const QString &name); + Q_INVOKABLE void removeMod(const QString &name); Q_INVOKABLE void stageFiles(const QString &name) { add(name); } Q_INVOKABLE void commitChanges(const QString &name, const QString &msg, const QString &user, const QString &email);