improve readme readability

This commit is contained in:
thezephyrsong
2026-06-17 15:59:19 +10:00
parent 24f1c3f3ec
commit 8ce99085ea
4 changed files with 66 additions and 94 deletions
+55 -10
View File
@@ -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
+9 -3
View File
@@ -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)
@@ -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 }}
+2 -2
View File
@@ -162,12 +162,12 @@ ApplicationWindow {
text: "Author: woblight - minor update by Zae"
}
Label {
text: "Source code: <a href=\"https://github.com/thezephyrsong/GitAddonsManager/\">GitLab</a>"
text: "Source code: <a href=\"https://github.com/thezephyrsong/GitAddonsManager/\">GitHub</a>"
onLinkActivated: Qt.openUrlExternally(link)
textFormat: Text.RichText
}
Label {
text: "Report an issue: <a href=\"https://github.com/thezephyrsong/GitAddonsManager/issues/\">GitLab</a>"
text: "Report an issue: <a href=\"https://github.com/thezephyrsong/GitAddonsManager/issues/\">GitHub</a>"
onLinkActivated: Qt.openUrlExternally(link)
textFormat: Text.RichText
}