From 8ce99085ead3ea51ea1ba77ae62b755c3e3c4ba8 Mon Sep 17 00:00:00 2001 From: thezephyrsong <116720216+thezephyrsong@users.noreply.github.com> Date: Wed, 17 Jun 2026 15:59:19 +1000 Subject: [PATCH] improve readme readability --- AddonsPanel.qml | 65 ++++++++++++--- CMakeLists.txt | 12 ++- .../release.yml | 79 ------------------- main.qml | 4 +- 4 files changed, 66 insertions(+), 94 deletions(-) delete mode 100644 enc_temp_folder/7c482c60c881a4c411652a88a66db3c8/release.yml diff --git a/AddonsPanel.qml b/AddonsPanel.qml index 9447360..ff14e0d 100644 --- a/AddonsPanel.qml +++ b/AddonsPanel.qml @@ -263,26 +263,71 @@ Page { parent: window.overlay x: (parent.width - width) / 2 y: (parent.height - height) / 2 + width: Math.min(800, parent.width * 0.75) + height: Math.min(600, parent.height * 0.75) title: addon?qsTr("%1 Readme").arg(addon.name):"" standardButtons: Dialog.Close - ScrollView{ + ScrollView { anchors.fill: parent - TextArea { - text: readmeDialog.addon?readmeDialog.addon.readme:"" - readOnly: true - anchors.fill: parent - wrapMode: Text.NoWrap - font.family: "Hack" + contentWidth: parent.width + ColumnLayout { + width: parent.width + Label { + id: readmeLabel + Layout.fillWidth: true + width: parent.width + wrapMode: Text.WordWrap + textFormat: Text.MarkdownText + + Layout.maximumWidth: parent.width + + font.pixelSize: 14 + + topPadding: 15 + bottomPadding: 15 + leftPadding: 10 + rightPadding: 10 + + text: { + let rawText = readmeDialog.addon ? readmeDialog.addon.readme : ""; + return rawText.replace(/<[^>]*>/g, ''); + let listText = cleanText.replace(/\|(.*)\|(.*)\|/g, (match, p1, p2) => { + if (p1.includes("---")) return ""; + return "• **" + p1.trim() + "**: " + p2.trim(); + }); + return listText; + } + + baseUrl: { + if (readmeDialog.addon) { + // 1. Remove the ".git" from the end of the repository URL + let cleanUrl = readmeDialog.addon.getUrl().toString().replace(".git", ""); + + // 2. Get the current branch (e.g., "master" or "main") + let branch = readmeDialog.addon.currentBranch; + if (branch === "") branch = "master"; // Fallback + + // 3. Construct the GitHub raw content link + // Result: https://github.com/user/repo/raw/master/ + return cleanUrl + "/raw/" + branch + "/"; + } + return ""; + } + + onLinkActivated: function(link) { Qt.openUrlExternally(link) } + + } } - } - } + } +} Dialog { property Addon addon property alias newUrlText: urlInput.text id: urlDialog parent: window.overlay - x: (parent.width - width) / 1.5 + x: (parent.width - width) / 2 y: (parent.height - height) / 2 + width: Math.min(500, parent.width * 0.75) title: addon ? qsTr("Change URL for %1").arg(addon.name) : "" standardButtons: Dialog.Save | Dialog.Cancel diff --git a/CMakeLists.txt b/CMakeLists.txt index 59d84c3..9d35416 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,12 @@ if(GIT_EXECUTABLE) ) endif() +string(REGEX REPLACE "^v" "" CLEAN_APP_VERSION "${RAW_GIT_VERSION}") + +if(NOT CLEAN_APP_VERSION) + set(CLEAN_APP_VERSION "1.0.0") +endif() + if (NOT WIN32) find_package(PkgConfig REQUIRED) pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2) @@ -174,11 +180,11 @@ if(NOT WIN32) endif() include(InstallRequiredSystemLibraries) -set(CPACK_GENERATOR "NSIS") # or "ZIP" for a simple zip +set(CPACK_GENERATOR "NSIS") set(CPACK_PACKAGE_NAME "GitAddonsManager") -set(CPACK_PACKAGE_VERSION "1.0.0") +set(CPACK_PACKAGE_VERSION "{CLEAN_APP_VERSION}") set(CPACK_PACKAGE_EXECUTABLES "GitAddonsManager" "GitAddonsManager") -set(CPACK_PACKAGE_FILE_NAME "GitAddonsManager_Setup") +set(CPACK_PACKAGE_FILE_NAME "GitAddonsManager-${CLEAN_APP_VERSION}") include(CPack) qt_finalize_executable(GitAddonsManager) diff --git a/enc_temp_folder/7c482c60c881a4c411652a88a66db3c8/release.yml b/enc_temp_folder/7c482c60c881a4c411652a88a66db3c8/release.yml deleted file mode 100644 index b9bd641..0000000 --- a/enc_temp_folder/7c482c60c881a4c411652a88a66db3c8/release.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Build and Release - -on: - release: - types: [published] - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - name: Set up MSVC (Visual Studio Compiler) - uses: ilammy/msvc-dev-cmd@v1 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Cache Qt - id: cache-qt - uses: actions/cache@v4 - with: - path: ${{ github.workspace }}/Qt - key: qt-6.8.3-msvc2022_64 - - - name: Install Qt via aqtinstall - if: steps.cache-qt.outputs.cache-hit != 'true' - run: | - python -m pip install --upgrade pip - pip install aqtinstall - python -m aqt install-qt windows desktop 6.8.3 win64_msvc2022_64 --outputdir ${{ github.workspace }}/Qt - - - name: Add Qt to PATH - run: | - echo "${{ github.workspace }}/Qt/6.8.3/msvc2022_64/bin" >> $GITHUB_PATH - - - name: Install libgit2 via vcpkg - run: | - vcpkg install libgit2:x64-windows - - - name: Configure CMake - run: | - $version = "${{ github.ref_name }}" -replace '^v', '' - cmake -B build -S . ` - -DCMAKE_BUILD_TYPE=Release ` - -DCMAKE_PREFIX_PATH="${{ github.workspace }}/Qt/6.8.3/msvc2022_64" ` - -DLIBGIT2_INCLUDE_DIR="C:/vcpkg/installed/x64-windows/include" ` - -DLIBGIT2_LIBRARY="C:/vcpkg/installed/x64-windows/lib/git2.lib" ` - -DCPACK_PACKAGE_VERSION="$version" - - - name: Build Project - run: | - cmake --build build --config Release - - - name: Install NSIS - run: choco install nsis -y - - - name: Run CPack (Generate Installer) - working-directory: build - run: | - cpack -C Release - - - name: Upload build artifacts on failure - if: failure() - uses: actions/upload-artifact@v4 - with: - name: build-logs - path: build/ - - - name: Upload Artifacts to Release - uses: softprops/action-gh-release@v2 - with: - files: build/GitAddonsManager_Setup.exe - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/main.qml b/main.qml index 7cd60c1..50942f2 100644 --- a/main.qml +++ b/main.qml @@ -162,12 +162,12 @@ ApplicationWindow { text: "Author: woblight - minor update by Zae" } Label { - text: "Source code: GitLab" + text: "Source code: GitHub" onLinkActivated: Qt.openUrlExternally(link) textFormat: Text.RichText } Label { - text: "Report an issue: GitLab" + text: "Report an issue: GitHub" onLinkActivated: Qt.openUrlExternally(link) textFormat: Text.RichText }