Compare commits
98 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f16cf7dac8 | |||
| 471d1f2538 | |||
| dc52105868 | |||
| 1b8dc5f410 | |||
| 26d5d019cc | |||
| 6dd7c2d926 | |||
| 47796e183a | |||
| ddf5ffcd89 | |||
| 7d718bb9a0 | |||
| d949e6eb8c | |||
| dbda958261 | |||
| d691489165 | |||
| 202ea38e40 | |||
| 86dafcb576 | |||
| f416c2a97e | |||
| 7426fedba3 | |||
| 027050c7e7 | |||
| fc948ad963 | |||
| 24d075b64c | |||
| f914f91e77 | |||
| fe03a0f643 | |||
| a7ad0278a6 | |||
| f517489421 | |||
| c8fa1c9fa4 | |||
| d85aff0c0f | |||
| 96b8e4b19c | |||
| 9760288db6 | |||
| eeaa059a77 | |||
| fa334d34a4 | |||
| 9664ff54ea | |||
| be0da461bd | |||
| 8c557a7f29 | |||
| 413e13a38c | |||
| 87f9f40e91 | |||
| 43fb34f852 | |||
| d6251c901e | |||
| c0ba961fb3 | |||
| 56f5a09737 | |||
| b5eebb2123 | |||
| 7bf395afab | |||
| 93baa00d00 | |||
| 6a7ae44ce5 | |||
| 89131a21a3 | |||
| 0b79dfd149 | |||
| 72178714fd | |||
| c7e236cd48 | |||
| fb769b884c | |||
| 2ae9ec87bb | |||
| 76d311cb35 | |||
| b016cc9f54 | |||
| 526e39e909 | |||
| d781105dfd | |||
| f6b93c6b71 | |||
| 61319bbbd6 | |||
| 1b522c251b | |||
| acfdab77fa | |||
| 8e327448cc | |||
| 7a8cee0ce6 | |||
| 82b8e7947e | |||
| e542a05d3f | |||
| 0b337a1514 | |||
| 48fec1db98 | |||
| 31f946426b | |||
| efa74dd0f5 | |||
| 703797bb97 | |||
| ef75ee736a | |||
| 15e623ac5f | |||
| df82a1125d | |||
| 7edc2e0241 | |||
| 55ae3fc3c6 | |||
| 2f72e6164c | |||
| e40f9c6b72 | |||
| ef261a7afd | |||
| 1550944011 | |||
| 32733187b8 | |||
| 79542edd3b | |||
| 9e0ec69c61 | |||
| 2e0a1a55e3 | |||
| 308f2ea838 | |||
| 9a9a5446cf | |||
| 0f8d835a1b | |||
| 663336a7bc | |||
| 4fab90d5b9 | |||
| f67df92f0e | |||
| 7e2c2cccf8 | |||
| 2d4f968348 | |||
| 6f669e1074 | |||
| 0b91318749 | |||
| 1ba97c7e92 | |||
| cd09fc0d32 | |||
| 924fe082fb | |||
| ad37b0f9a5 | |||
| fedc1cb092 | |||
| 5f318e09c8 | |||
| 27afeaefe2 | |||
| ab2f933fdf | |||
| 7f718f672f | |||
| 9ec02bc088 |
@@ -0,0 +1,112 @@
|
||||
name: Test Windows VS2026 migration
|
||||
|
||||
# Ce workflow vérifie que le build QElectroTech fonctionne sur l'image
|
||||
# windows-2025-vs2026, avant la migration forcée du 8 juin 2026.
|
||||
# Il peut être supprimé une fois la migration confirmée OK.
|
||||
|
||||
on:
|
||||
workflow_dispatch: # déclenchement manuel uniquement
|
||||
schedule:
|
||||
- cron: '0 4 * * 1' # chaque lundi à 4h00 UTC (optionnel)
|
||||
|
||||
jobs:
|
||||
test-vs2026:
|
||||
name: Build on windows-2025-vs2026
|
||||
runs-on: windows-2025-vs2026 # <-- image avec VS 2026
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install MSYS2 + dependencies
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: UCRT64
|
||||
update: false
|
||||
install: >-
|
||||
mingw-w64-ucrt-x86_64-gcc
|
||||
mingw-w64-ucrt-x86_64-cmake
|
||||
mingw-w64-ucrt-x86_64-ninja
|
||||
mingw-w64-ucrt-x86_64-qt5-base
|
||||
mingw-w64-ucrt-x86_64-qt5-svg
|
||||
mingw-w64-ucrt-x86_64-qt5-tools
|
||||
mingw-w64-ucrt-x86_64-qt5-translations
|
||||
mingw-w64-ucrt-x86_64-sqlite3
|
||||
mingw-w64-ucrt-x86_64-pkgconf
|
||||
mingw-w64-ucrt-x86_64-extra-cmake-modules
|
||||
mingw-w64-ucrt-x86_64-kwidgetsaddons-qt5
|
||||
mingw-w64-ucrt-x86_64-kcoreaddons-qt5
|
||||
mingw-w64-ucrt-x86_64-nsis
|
||||
mingw-w64-ucrt-x86_64-ccache
|
||||
mingw-w64-ucrt-x86_64-7zip
|
||||
git
|
||||
|
||||
- name: Force Qt5 (remove Qt6 interference)
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
rm -rf /ucrt64/lib/cmake/Qt6 || true
|
||||
pacman -R --noconfirm mingw-w64-ucrt-x86_64-qt6-tools 2>/dev/null || true
|
||||
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: C:\Users\runneradmin\AppData\Local\ccache
|
||||
key: ccache-vs2026-${{ runner.os }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
ccache-vs2026-${{ runner.os }}-
|
||||
|
||||
- name: Configure (CMake)
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cmake -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DQt5_DIR=/ucrt64/lib/cmake/Qt5 \
|
||||
-DQT_VERSION_MAJOR=5 \
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Qt6=ON \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_FLAGS="-DQET_EXPORT_PROJECT_DB" \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=/ucrt64/bin/ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=/ucrt64/bin/ccache \
|
||||
-DSQLite3_INCLUDE_DIR=/ucrt64/include \
|
||||
-DSQLite3_LIBRARY=/ucrt64/lib/libsqlite3.dll.a \
|
||||
|
||||
- name: Build
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cmake --build build --parallel $(nproc)
|
||||
|
||||
- name: Verify executable
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
EXE=$(find build -name "qelectrotech.exe" | head -1)
|
||||
if [ -z "$EXE" ]; then
|
||||
echo "ERROR: qelectrotech.exe introuvable après le build"
|
||||
exit 1
|
||||
fi
|
||||
SIZE=$(stat -c%s "$EXE")
|
||||
echo "Executable trouvé : $EXE ($SIZE octets)"
|
||||
if [ "$SIZE" -lt 100000 ]; then
|
||||
echo "ERROR: exe trop petit ($SIZE octets), build probablement incomplet"
|
||||
exit 1
|
||||
fi
|
||||
echo "BUILD VS2026 : OK ✓"
|
||||
|
||||
- name: Summary
|
||||
if: always()
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
echo "=== Résumé de compatibilité VS2026 ==="
|
||||
gcc --version
|
||||
cmake --version
|
||||
ninja --version
|
||||
echo "Image runner : windows-2025-vs2026"
|
||||
echo "Date du test : $(date -u)"
|
||||
@@ -1,11 +1,9 @@
|
||||
name: Windows Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 2 * * 1' # Every Monday at 2:00 UTC
|
||||
workflow_dispatch: # Manual trigger available at any time
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
@@ -316,11 +314,30 @@ jobs:
|
||||
nsis_root/files/bin/
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: Zip portable (readytouse)
|
||||
id: zip_portable
|
||||
shell: pwsh
|
||||
run: |
|
||||
$version = "${{ steps.qet_version.outputs.base_version }}"
|
||||
$head = "${{ steps.qet_version.outputs.head }}"
|
||||
$zipName = "qelectrotech-${version}+git${head}-x86-win64-readytouse.zip"
|
||||
$src = "$env:GITHUB_WORKSPACE\nsis_root\files"
|
||||
$dst = "$env:GITHUB_WORKSPACE\dist\$zipName"
|
||||
$7z = "C:\Program Files\7-Zip\7z.exe"
|
||||
|
||||
New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\dist" | Out-Null
|
||||
& $7z a -tzip -mx=5 -mmt=on $dst "$src\*"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
$sizeMB = [math]::Round((Get-Item $dst).Length / 1MB, 1)
|
||||
Write-Output "ZIP created: $zipName ($sizeMB MB)"
|
||||
"zip_name=$zipName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
|
||||
- name: Upload portable (files/ without installer)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qelectrotech-${{ steps.qet_version.outputs.base_version }}+git${{ steps.qet_version.outputs.head }}-x86-win64-readytouse
|
||||
path: nsis_root/files/
|
||||
path: dist/${{ steps.zip_portable.outputs.zip_name }}
|
||||
retention-days: 14
|
||||
|
||||
- name: Upload NSIS installer
|
||||
@@ -330,6 +347,13 @@ jobs:
|
||||
path: dist/Installer_*.exe
|
||||
retention-days: 14
|
||||
|
||||
- name: Upload portable (nom fixe pour le workflow MSI)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qelectrotech-windows-portable
|
||||
path: nsis_root/files/
|
||||
retention-days: 14
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Job 2 : Publie une release nightly + page GitHub Pages
|
||||
# Ne tourne que sur push master (pas sur les PRs)
|
||||
@@ -342,11 +366,13 @@ jobs:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout gh-pages branch
|
||||
- name: Checkout master (for build-aux scripts)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: gh-pages
|
||||
path: gh-pages
|
||||
ref: master
|
||||
path: source
|
||||
sparse-checkout: build-aux/generate-page.py
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Download installer artifact
|
||||
uses: actions/download-artifact@v4
|
||||
@@ -354,6 +380,27 @@ jobs:
|
||||
name: qelectrotech-windows-installer
|
||||
path: downloaded/installer/
|
||||
|
||||
- name: Download portable artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: qelectrotech-*-readytouse
|
||||
path: downloaded/portable/
|
||||
merge-multiple: true
|
||||
|
||||
- name: Delete old nightly assets (.exe and .zip)
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
# Fetch existing .exe and .zip asset names and delete them
|
||||
gh release view nightly --repo "$REPO" --json assets \
|
||||
--jq '.assets[] | select(.name | test("\\.(exe|zip)$")) | .name' \
|
||||
| while read -r name; do
|
||||
echo "Deleting old asset: $name"
|
||||
gh release delete-asset nightly "$name" --repo "$REPO" --yes
|
||||
done
|
||||
echo "Old .exe and .zip assets deleted."
|
||||
|
||||
- name: Update nightly release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
@@ -368,190 +415,14 @@ jobs:
|
||||
| **Run** | https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
|
||||
| **Date** | ${{ github.event.head_commit.timestamp }} |
|
||||
|
||||
> ⚠️ This release is overwritten on every push to `master`.
|
||||
> ⚠️ This is a development version; it introduces new features you want, but may cause bugs that have not yet been identified yet.
|
||||
> For stable releases, see the [Releases page](https://github.com/${{ github.repository }}/releases).
|
||||
prerelease: true
|
||||
make_latest: false
|
||||
files: downloaded/installer/*.exe
|
||||
files: |
|
||||
downloaded/installer/*.exe
|
||||
downloaded/portable/*.zip
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Generate download page (index.html)
|
||||
run: |
|
||||
DATE=$(date -u '+%Y-%m-%d %H:%M UTC')
|
||||
SHORT="${{ github.sha }}"
|
||||
SHORT="${SHORT:0:7}"
|
||||
REPO="${{ github.repository }}"
|
||||
RUN_URL="https://github.com/$REPO/actions/runs/${{ github.run_id }}"
|
||||
EXE_NAME=$(ls downloaded/installer/*.exe | xargs -I{} basename {})
|
||||
INSTALLER_URL="https://github.com/$REPO/releases/download/nightly/$EXE_NAME"
|
||||
|
||||
mkdir -p gh-pages
|
||||
cat > gh-pages/index.html << HTMLEOF
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>QElectroTech – Nightly Builds</title>
|
||||
<style>
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
background: #f0f4f8;
|
||||
color: #2d3748;
|
||||
min-height: 100vh;
|
||||
}
|
||||
header {
|
||||
background: linear-gradient(135deg, #1a365d 0%, #2b6cb0 100%);
|
||||
color: white;
|
||||
padding: 48px 24px 40px;
|
||||
text-align: center;
|
||||
}
|
||||
header h1 { font-size: 2.2em; letter-spacing: -0.5px; margin-bottom: 8px; }
|
||||
header p { opacity: 0.8; font-size: 1.05em; }
|
||||
main {
|
||||
max-width: 680px;
|
||||
margin: 40px auto;
|
||||
padding: 0 20px 60px;
|
||||
}
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 28px;
|
||||
margin-bottom: 24px;
|
||||
box-shadow: 0 2px 12px rgba(0,0,0,0.08);
|
||||
}
|
||||
.card h2 {
|
||||
font-size: 1em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
color: #718096;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.meta {
|
||||
font-size: 0.875em;
|
||||
color: #4a5568;
|
||||
line-height: 1.8;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.meta a { color: #2b6cb0; text-decoration: none; }
|
||||
.meta a:hover { text-decoration: underline; }
|
||||
.badge {
|
||||
display: inline-block;
|
||||
background: #ebf8ff;
|
||||
color: #2b6cb0;
|
||||
border-radius: 4px;
|
||||
font-size: 0.8em;
|
||||
font-weight: 600;
|
||||
padding: 2px 8px;
|
||||
margin-left: 6px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.warning {
|
||||
background: #fffbeb;
|
||||
border-left: 4px solid #f6ad55;
|
||||
border-radius: 4px;
|
||||
padding: 12px 16px;
|
||||
font-size: 0.875em;
|
||||
color: #744210;
|
||||
margin-bottom: 24px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.warning a { color: #c05621; }
|
||||
.downloads { display: flex; flex-direction: column; gap: 12px; }
|
||||
.btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 20px;
|
||||
border-radius: 8px;
|
||||
font-size: 0.95em;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
transition: transform 0.1s, box-shadow 0.1s;
|
||||
}
|
||||
.btn:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
}
|
||||
.btn-primary { background: #2b6cb0; color: white; }
|
||||
.btn-secondary { background: #edf2f7; color: #2d3748; }
|
||||
.btn-icon { font-size: 1.3em; }
|
||||
.btn-text small {
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
font-size: 0.8em;
|
||||
opacity: 0.75;
|
||||
margin-top: 1px;
|
||||
}
|
||||
footer {
|
||||
text-align: center;
|
||||
font-size: 0.8em;
|
||||
color: #a0aec0;
|
||||
padding: 32px 0 0;
|
||||
}
|
||||
footer a { color: #718096; text-decoration: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>⚡ QElectroTech</h1>
|
||||
<p>Nightly Windows Builds</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div class="card">
|
||||
<h2>Build info</h2>
|
||||
<div class="meta">
|
||||
📅 <strong>$DATE</strong><br>
|
||||
🔀 Commit <a href="https://github.com/$REPO/commit/${{ github.sha }}"><code>$SHORT</code></a><br>
|
||||
🔧 <a href="$RUN_URL">CI Run #${{ github.run_number }}</a>
|
||||
<span class="badge">nightly</span>
|
||||
</div>
|
||||
<div class="warning">
|
||||
⚠️ These builds are generated automatically on every commit to <code>master</code>
|
||||
and may be unstable or incomplete.
|
||||
For production use, download a
|
||||
<a href="https://github.com/$REPO/releases">stable release</a>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>🪟 Windows — x86_64</h2>
|
||||
<div class="downloads">
|
||||
<a class="btn btn-primary" href="$INSTALLER_URL">
|
||||
<span class="btn-icon">⬇</span>
|
||||
<span class="btn-text">
|
||||
Windows Installer
|
||||
<small>.exe — recommended, includes all dependencies</small>
|
||||
</span>
|
||||
</a>
|
||||
<a class="btn btn-secondary" href="https://github.com/$REPO/releases/tag/nightly">
|
||||
<span class="btn-icon">📦</span>
|
||||
<span class="btn-text">
|
||||
All nightly files on GitHub
|
||||
<small>Release page with checksums</small>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
Auto-generated by GitHub Actions ·
|
||||
<a href="https://github.com/$REPO">Source on GitHub</a> ·
|
||||
<a href="https://qelectrotech.org">qelectrotech.org</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
HTMLEOF
|
||||
|
||||
- name: Commit and push to gh-pages
|
||||
run: |
|
||||
cd gh-pages
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add index.html
|
||||
git diff --staged --quiet \
|
||||
|| git commit -m "nightly: build #${{ github.run_number }} (${{ github.sha }})"
|
||||
git push origin gh-pages
|
||||
# GitHub Pages is generated and deployed by windows-msi.yml
|
||||
# after the MSI upload, so that all 3 URLs (exe, zip, msi) are known.
|
||||
|
||||
@@ -0,0 +1,366 @@
|
||||
name: Windows MSI (WiX v7)
|
||||
|
||||
on:
|
||||
# Triggered automatically after a successful Windows build on master
|
||||
workflow_run:
|
||||
workflows: ["Windows Build"]
|
||||
types: [completed]
|
||||
branches: [master]
|
||||
# Manual trigger still available (e.g. for a specific run_id)
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run_id:
|
||||
description: "Run ID of 'Windows Build' (leave empty for automatic)"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
build-msi:
|
||||
name: Build MSI with WiX v7
|
||||
runs-on: windows-latest
|
||||
|
||||
# Only runs if Windows Build succeeded (or triggered manually)
|
||||
if: >
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
github.event.workflow_run.conclusion == 'success'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 1. Checkout (to retrieve QElectroTech.wxs and sources)
|
||||
# ----------------------------------------------------------------
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 2. Download the portable artifact from the main build
|
||||
# ----------------------------------------------------------------
|
||||
- name: Download portable artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: qelectrotech-windows-portable
|
||||
path: artifact\files
|
||||
run-id: ${{ github.event.workflow_run.id || github.event.inputs.run_id || github.run_id }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repository: ${{ github.repository }}
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 3. Extract version from sources
|
||||
# ----------------------------------------------------------------
|
||||
- name: Extract version
|
||||
id: version
|
||||
shell: pwsh
|
||||
run: |
|
||||
$src = Get-Content "sources\qetversion.cpp" -Raw -ErrorAction SilentlyContinue
|
||||
if ($src -match 'return QVersionNumber\{([^}]+)\}') {
|
||||
$ver = $Matches[1] -replace '\s','' -replace ',','.'
|
||||
} else {
|
||||
$cmake = Get-Content "CMakeLists.txt" -Raw
|
||||
if ($cmake -match 'project\s*\([^)]*VERSION\s+([\d]+\.[\d]+\.[\d]+)') {
|
||||
$ver = $Matches[1]
|
||||
} else {
|
||||
$ver = "0.0.0"
|
||||
}
|
||||
}
|
||||
$verMsi = "$ver.0"
|
||||
$sha = git rev-parse --short HEAD 2>$null
|
||||
if (-not $sha) { $sha = "unknown" }
|
||||
$count = git rev-list HEAD --count 2>$null
|
||||
$rev = [int]$count + 473
|
||||
$verDisplay = "${ver}-r${rev}-${sha}_x86_64-win64"
|
||||
# Generate a unique ProductCode GUID from the commit SHA
|
||||
# This ensures MajorUpgrade always triggers, even for same-version builds
|
||||
$fullSha = git rev-parse HEAD 2>$null
|
||||
if (-not $fullSha) { $fullSha = [System.Guid]::NewGuid().ToString() }
|
||||
$bytes = [System.Text.Encoding]::UTF8.GetBytes($fullSha)
|
||||
$md5 = [System.Security.Cryptography.MD5]::Create().ComputeHash($bytes)
|
||||
$guidBytes = [byte[]]$md5[0..15]
|
||||
$productGuid = [System.Guid]::new($guidBytes).ToString().ToUpper()
|
||||
|
||||
echo "VERSION_MSI=$verMsi" >> $env:GITHUB_OUTPUT
|
||||
echo "VERSION_DISPLAY=$verDisplay" >> $env:GITHUB_OUTPUT
|
||||
echo "PRODUCT_GUID=$productGuid" >> $env:GITHUB_OUTPUT
|
||||
Write-Host "Version MSI : $verMsi"
|
||||
Write-Host "Version display : $verDisplay"
|
||||
Write-Host "Product GUID : $productGuid"
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 4. Install WiX v7, accept EULA and install WixUI extension
|
||||
# ----------------------------------------------------------------
|
||||
- name: Install WiX v7
|
||||
shell: pwsh
|
||||
run: |
|
||||
dotnet tool install --global wix --version 7.0.0
|
||||
$toolsPath = [System.IO.Path]::Combine($env:USERPROFILE, '.dotnet', 'tools')
|
||||
$env:PATH = "$toolsPath;$env:PATH"
|
||||
echo $toolsPath >> $env:GITHUB_PATH
|
||||
wix eula accept wix7
|
||||
wix extension add WixToolset.UI.wixext/7.0.0
|
||||
wix extension add WixToolset.Util.wixext/7.0.0
|
||||
Write-Host "WiX v7 installed, EULA accepted, UI extension added."
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 5. Check that the WXS file exists in the repository
|
||||
# ----------------------------------------------------------------
|
||||
- name: Check WXS file
|
||||
shell: pwsh
|
||||
run: |
|
||||
$wxs = "build-aux\windows\QElectroTech.wxs"
|
||||
if (-not (Test-Path $wxs)) {
|
||||
Write-Error "WXS file not found: $wxs"
|
||||
exit 1
|
||||
}
|
||||
Write-Host "WXS found: $wxs"
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 6. Check the artifact structure and locate files/
|
||||
# ----------------------------------------------------------------
|
||||
- name: Check artifact structure
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "=== Contents of artifact\files (2 levels) ==="
|
||||
Get-ChildItem -Path "artifact\files" -Depth 2 |
|
||||
Select-Object FullName | Format-Table -AutoSize
|
||||
|
||||
$exe = Get-ChildItem -Path "artifact\files" -Filter "qelectrotech.exe" -Recurse | Select-Object -First 1
|
||||
if (-not $exe) {
|
||||
$exe = Get-ChildItem -Path "artifact\files" -Filter "QElectroTech.exe" -Recurse | Select-Object -First 1
|
||||
}
|
||||
if (-not $exe) {
|
||||
Write-Error "qelectrotech.exe not found in artifact"
|
||||
exit 1
|
||||
}
|
||||
Write-Host "Executable: $($exe.FullName) ($([math]::Round($exe.Length/1MB,1)) MB)"
|
||||
$binDir = $exe.Directory.FullName
|
||||
$filesDir = Split-Path $binDir -Parent
|
||||
echo "FILES_DIR=$filesDir" >> $env:GITHUB_ENV
|
||||
Write-Host "FILES_DIR: $filesDir"
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 7. Convert LICENSE (GPL-2) to RTF for the WixUI licence screen
|
||||
# ----------------------------------------------------------------
|
||||
- name: Convert LICENSE to RTF
|
||||
shell: pwsh
|
||||
run: |
|
||||
$licSrc = "LICENSE"
|
||||
$licRtf = "$env:TEMP\License.rtf"
|
||||
if (-not (Test-Path $licSrc)) {
|
||||
Write-Error "LICENSE file not found in repository root"
|
||||
exit 1
|
||||
}
|
||||
$lines = Get-Content $licSrc -Encoding UTF8
|
||||
$rtf = New-Object System.Text.StringBuilder
|
||||
[void]$rtf.AppendLine('{\rtf1\ansi\ansicpg1252\deff0')
|
||||
[void]$rtf.AppendLine('{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}}')
|
||||
[void]$rtf.AppendLine('{\colortbl;\red0\green0\blue0;}')
|
||||
[void]$rtf.AppendLine('\f0\fs18\cf1')
|
||||
foreach ($line in $lines) {
|
||||
$escaped = $line `
|
||||
-replace '\\', '\\\\' `
|
||||
-replace '\{', '\{' `
|
||||
-replace '\}', '\}'
|
||||
[void]$rtf.AppendLine("$escaped\par")
|
||||
}
|
||||
[void]$rtf.AppendLine('}')
|
||||
[System.IO.File]::WriteAllText($licRtf, $rtf.ToString(), [System.Text.Encoding]::ASCII)
|
||||
echo "LICENSE_RTF=$licRtf" >> $env:GITHUB_ENV
|
||||
Write-Host "License.rtf generated: $licRtf ($([math]::Round((Get-Item $licRtf).Length/1KB,1)) KB)"
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 8. Remove Lancer QET.bat from the artifact
|
||||
# The MSI does not use the .bat: shortcuts point directly to
|
||||
# qelectrotech.exe, and elements\ is set read-only via a
|
||||
# CustomAction in QElectroTech.wxs.
|
||||
# The .bat is kept as-is in the ZIP portable build.
|
||||
# ----------------------------------------------------------------
|
||||
- name: Remove Lancer QET.bat from artifact
|
||||
shell: pwsh
|
||||
run: |
|
||||
$bat = "$env:FILES_DIR\Lancer QET.bat"
|
||||
if (Test-Path $bat) {
|
||||
Remove-Item $bat -Force
|
||||
Write-Host "Lancer QET.bat removed from artifact (MSI uses direct exe shortcut)."
|
||||
} else {
|
||||
Write-Host "Lancer QET.bat not found in artifact (already absent)."
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 9. Build the MSI
|
||||
# ----------------------------------------------------------------
|
||||
- name: Build MSI
|
||||
shell: pwsh
|
||||
run: |
|
||||
$version = "${{ steps.version.outputs.VERSION_MSI }}"
|
||||
$verDisplay = "${{ steps.version.outputs.VERSION_DISPLAY }}"
|
||||
$filesDir = $env:FILES_DIR
|
||||
$licRtf = $env:LICENSE_RTF
|
||||
$wxs = "build-aux\windows\QElectroTech.wxs"
|
||||
$outputName = "QElectroTech-${verDisplay}.msi"
|
||||
|
||||
New-Item -ItemType Directory -Force -Path "dist" | Out-Null
|
||||
|
||||
Write-Host "=== wix build ==="
|
||||
Write-Host " WXS : $wxs"
|
||||
Write-Host " Version : $version"
|
||||
Write-Host " FilesDir : $filesDir"
|
||||
Write-Host " LicenseRtf : $licRtf"
|
||||
Write-Host " Output : dist\$outputName"
|
||||
|
||||
$productGuid = "${{ steps.version.outputs.PRODUCT_GUID }}"
|
||||
|
||||
wix build $wxs `
|
||||
-arch x64 `
|
||||
-d "Version=$version" `
|
||||
-d "ProductVersion=$verDisplay" `
|
||||
-d "ProductCode=$productGuid" `
|
||||
-d "FilesDir=$filesDir" `
|
||||
-d "LicenseRtf=$licRtf" `
|
||||
-ext WixToolset.UI.wixext `
|
||||
-ext WixToolset.Util.wixext `
|
||||
-o "dist\$outputName"
|
||||
|
||||
if (-not (Test-Path "dist\$outputName")) {
|
||||
Write-Error "MSI not generated: dist\$outputName"
|
||||
exit 1
|
||||
}
|
||||
$size = [math]::Round((Get-Item "dist\$outputName").Length / 1MB, 1)
|
||||
Write-Host "MSI generated: dist\$outputName ($size MB) ✓"
|
||||
echo "MSI_NAME=$outputName" >> $env:GITHUB_ENV
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 10. Sign the MSI with SignPath
|
||||
# ----------------------------------------------------------------
|
||||
- name: Install SignPath PowerShell module
|
||||
shell: pwsh
|
||||
run: |
|
||||
Install-Module -Name SignPath -Force -Scope CurrentUser
|
||||
|
||||
- name: Sign MSI with SignPath
|
||||
shell: pwsh
|
||||
run: |
|
||||
$msi = Get-ChildItem "$env:GITHUB_WORKSPACE\dist\*.msi" | Select-Object -First 1
|
||||
if (-not $msi) {
|
||||
Write-Error "No .msi found in dist/"
|
||||
exit 1
|
||||
}
|
||||
Write-Host "Signing: $($msi.FullName)"
|
||||
Submit-SigningRequest `
|
||||
-InputArtifactPath $msi.FullName `
|
||||
-ApiToken "${{ secrets.SIGNPATH_API_TOKEN }}" `
|
||||
-OrganizationId "${{ secrets.SIGNPATH_ORGANIZATION_ID }}" `
|
||||
-ProjectSlug "MSI" `
|
||||
-SigningPolicySlug "test-signing" `
|
||||
-OutputArtifactPath $msi.FullName `
|
||||
-Force `
|
||||
-WaitForCompletion
|
||||
Write-Host "Signing complete: $($msi.Name)"
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 11. Upload the MSI artifact
|
||||
# ----------------------------------------------------------------
|
||||
- name: Upload MSI artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qelectrotech-windows-msi
|
||||
path: dist\*.msi
|
||||
retention-days: 14
|
||||
if-no-files-found: error
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 11. Delete old .msi asset then upload new MSI to nightly release
|
||||
# ----------------------------------------------------------------
|
||||
- name: Delete old nightly .msi asset
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
gh release view nightly --repo "$REPO" --json assets \
|
||||
--jq '.assets[] | select(.name | test("\\.msi$")) | .name' \
|
||||
| while read -r name; do
|
||||
echo "Deleting old asset: $name"
|
||||
gh release delete-asset nightly "$name" --repo "$REPO" --yes
|
||||
done
|
||||
echo "Old .msi assets deleted."
|
||||
shell: bash
|
||||
|
||||
- name: Upload MSI to nightly release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: nightly
|
||||
files: dist/*.msi
|
||||
fail_on_unmatched_files: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 12. Summary
|
||||
# ----------------------------------------------------------------
|
||||
- name: Summary
|
||||
if: always()
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "=== MSI build summary ==="
|
||||
Write-Host "Version : ${{ steps.version.outputs.VERSION_DISPLAY }}"
|
||||
Write-Host "WiX : v7.0.0"
|
||||
Write-Host "Runner image : ${{ runner.os }} / ${{ runner.arch }}"
|
||||
if (Test-Path "dist\$env:MSI_NAME") {
|
||||
$size = [math]::Round((Get-Item "dist\$env:MSI_NAME").Length / 1MB, 1)
|
||||
Write-Host "MSI : $env:MSI_NAME ($size MB) ✓"
|
||||
} else {
|
||||
Write-Host "MSI : FAILED ✗"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 13. Generate and deploy the GitHub Pages download page
|
||||
# ----------------------------------------------------------------
|
||||
- name: Checkout (for generate-page.py)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
path: source
|
||||
sparse-checkout: build-aux/generate-page.py
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Generate download page (index.html)
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
REPO="${{ github.repository }}"
|
||||
ASSETS=$(gh release view nightly --repo "$REPO" --json assets --jq '.assets[].name')
|
||||
EXE_NAME=$(echo "$ASSETS" | grep '\.exe$' | head -1)
|
||||
ZIP_NAME=$(echo "$ASSETS" | grep '\.zip$' | head -1)
|
||||
MSI_NAME=$(echo "$ASSETS" | grep '\.msi$' | head -1 || echo "")
|
||||
BASE="https://github.com/$REPO/releases/download/nightly"
|
||||
INSTALLER_URL="$BASE/$EXE_NAME"
|
||||
PORTABLE_URL="$BASE/$ZIP_NAME"
|
||||
MSI_URL=""
|
||||
[ -n "$MSI_NAME" ] && MSI_URL="$BASE/$MSI_NAME"
|
||||
SHA="${{ github.event.workflow_run.head_sha || github.sha }}"
|
||||
SHORT="${SHA:0:7}"
|
||||
DATE=$(date -u '+%Y-%m-%d %H:%M UTC')
|
||||
RUN_URL="https://github.com/$REPO/actions/runs/${{ github.run_id }}"
|
||||
RUN_NUMBER="${{ github.run_number }}"
|
||||
export DATE SHORT REPO SHA RUN_URL RUN_NUMBER
|
||||
export INSTALLER_URL PORTABLE_URL MSI_URL
|
||||
python3 source/build-aux/generate-page.py
|
||||
|
||||
- name: Add .nojekyll
|
||||
shell: bash
|
||||
run: touch gh-pages/.nojekyll
|
||||
|
||||
- name: Upload GitHub Pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: gh-pages/
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: actions/deploy-pages@v4
|
||||
@@ -14,12 +14,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
include(cmake/hoto_update_cmake_message.cmake)
|
||||
|
||||
cmake_minimum_required(VERSION 3.14...3.19 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.5...4.2)
|
||||
|
||||
project(qelectrotech
|
||||
VERSION 0.9.0
|
||||
VERSION 0.100.0
|
||||
DESCRIPTION "QET is a CAD/CAE editor focusing on schematics drawing features."
|
||||
HOMEPAGE_URL "https://qelectrotech.org/"
|
||||
LANGUAGES CXX)
|
||||
@@ -27,9 +25,16 @@ project(qelectrotech
|
||||
include(cmake/copyright_message.cmake)
|
||||
|
||||
set(QET_DIR ${PROJECT_SOURCE_DIR})
|
||||
include(cmake/qet_compilation_vars.cmake)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS ${QET_COMPONENTS})
|
||||
qt_standard_project_setup()
|
||||
|
||||
# Add sub directories
|
||||
option(PACKAGE_TESTS "Build the tests" ON)
|
||||
option(PACKAGE_TESTS "Build the tests" NO)
|
||||
if(PACKAGE_TESTS)
|
||||
message("Add sub directory tests")
|
||||
add_subdirectory(tests)
|
||||
@@ -43,42 +48,16 @@ include(cmake/git_last_commit_sha.cmake)
|
||||
include(cmake/fetch_kdeaddons.cmake)
|
||||
include(cmake/fetch_singleapplication.cmake)
|
||||
include(cmake/fetch_pugixml.cmake)
|
||||
include(cmake/qet_compilation_vars.cmake)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
SET(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(
|
||||
QT
|
||||
NAMES
|
||||
Qt5
|
||||
COMPONENTS
|
||||
${QET_COMPONENTS}
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
find_package(
|
||||
Qt${QT_VERSION_MAJOR}
|
||||
COMPONENTS
|
||||
${QET_COMPONENTS}
|
||||
REQUIRED)
|
||||
find_package(SQLite3 REQUIRED)
|
||||
|
||||
set(CMAKE_AUTOUIC_SEARCH_PATHS ${QET_DIR}/sources/ui)
|
||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${QET_DIR}/lang")
|
||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
||||
|
||||
# als laatse
|
||||
include(cmake/define_definitions.cmake)
|
||||
|
||||
add_executable(
|
||||
qt_add_executable(
|
||||
${PROJECT_NAME}
|
||||
${QET_RES_FILES}
|
||||
${QET_SRC_FILES}
|
||||
@@ -86,6 +65,16 @@ add_executable(
|
||||
${QET_DIR}/qelectrotech.qrc
|
||||
)
|
||||
|
||||
if(QMFILES_AS_RESOURCE)
|
||||
qt_add_translations(${PROJECT_NAME} TS_FILES ${TS_FILES} RESOURCE_PREFIX "/lang")
|
||||
else()
|
||||
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${QET_DIR}/lang")
|
||||
qt_add_translation(QM_FILES ${TS_FILES})
|
||||
endif()
|
||||
|
||||
find_package(SQLite3 REQUIRED)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PUBLIC
|
||||
@@ -93,7 +82,7 @@ target_link_libraries(
|
||||
pugixml::pugixml
|
||||
SingleApplication::SingleApplication
|
||||
SQLite::SQLite3
|
||||
${KF5_PRIVATE_LIBRARIES}
|
||||
${KF6_PRIVATE_LIBRARIES}
|
||||
${QET_PRIVATE_LIBRARIES}
|
||||
)
|
||||
|
||||
@@ -126,11 +115,11 @@ target_include_directories(
|
||||
${QET_DIR}/sources/NameList
|
||||
${QET_DIR}/sources/NameList/ui
|
||||
${QET_DIR}/sources/utils
|
||||
${QET_DIR}/pugixml/src
|
||||
${QET_DIR}/sources/dataBase
|
||||
${QET_DIR}/sources/dataBase/ui
|
||||
${QET_DIR}/sources/factory/ui
|
||||
${QET_DIR}/sources/print
|
||||
${QET_DIR}/sources/svg
|
||||
)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME})
|
||||
@@ -150,6 +139,7 @@ install(FILES LICENSE ELEMENTS.LICENSE CREDIT README ChangeLog DESTINATION share
|
||||
install(FILES misc/org.qelectrotech.qelectrotech.desktop DESTINATION share/applications)
|
||||
install(FILES misc/qelectrotech.xml DESTINATION share/mime/packages)
|
||||
install(FILES misc/qelectrotech.appdata.xml DESTINATION ${QET_APPDATA_PATH})
|
||||
install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})
|
||||
|
||||
if(NOT QMFILES_AS_RESOURCE)
|
||||
install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -59,6 +59,9 @@ Here are the technical choices made for the software development:
|
||||
|
||||
If you wish to be informed of the latest developments, browse the [archive](https://listengine.tuxfamily.org/lists.tuxfamily.org/qet/) of the project mailing list where all commits (changes) are registered. This archive is publicly available, you don't need any account to access it.
|
||||
|
||||
### Build QElectroTech under Windows
|
||||
To build QElectroTech under microsoft Windows, please follow [these instructions (french)](md/fr/fr_window_build_summary.md)
|
||||
|
||||
|
||||
# Features
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
generate-page.py — Generates gh-pages/index.html for QElectroTech nightly builds.
|
||||
Called from windows-build.yml deploy-pages job.
|
||||
Environment variables required:
|
||||
DATE, SHORT, REPO, SHA, RUN_URL, RUN_NUMBER,
|
||||
INSTALLER_URL, PORTABLE_URL, MSI_URL (optional)
|
||||
"""
|
||||
import os
|
||||
|
||||
date = os.environ.get("DATE", "")
|
||||
short = os.environ.get("SHORT", "")
|
||||
repo = os.environ.get("REPO", "")
|
||||
sha = os.environ.get("SHA", "")
|
||||
run_url = os.environ.get("RUN_URL", "")
|
||||
run_number = os.environ.get("RUN_NUMBER", "")
|
||||
installer_url = os.environ.get("INSTALLER_URL", "")
|
||||
portable_url = os.environ.get("PORTABLE_URL", "")
|
||||
msi_url = os.environ.get("MSI_URL", "")
|
||||
|
||||
msi_block = ""
|
||||
if msi_url:
|
||||
msi_block = f"""
|
||||
<a class="btn btn-msi" href="{msi_url}">
|
||||
<span class="btn-icon">⬇</span>
|
||||
<span class="btn-text">Windows Installer .msi<small>.msi — for enterprise / GPO deployment</small></span>
|
||||
</a>"""
|
||||
|
||||
html = f"""<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>QElectroTech – Nightly Builds</title>
|
||||
<style>
|
||||
*,*::before,*::after{{box-sizing:border-box;margin:0;padding:0}}
|
||||
body{{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;background:#f0f4f8;color:#2d3748;min-height:100vh}}
|
||||
header{{background:linear-gradient(135deg,#1a365d 0%,#2b6cb0 100%);color:white;padding:48px 24px 40px;text-align:center}}
|
||||
header h1{{font-size:2.2em;letter-spacing:-0.5px;margin-bottom:8px}}
|
||||
header p{{opacity:.8;font-size:1.05em}}
|
||||
main{{max-width:680px;margin:40px auto;padding:0 20px 60px}}
|
||||
.card{{background:white;border-radius:12px;padding:28px;margin-bottom:24px;box-shadow:0 2px 12px rgba(0,0,0,.08)}}
|
||||
.card h2{{font-size:1em;text-transform:uppercase;letter-spacing:.06em;color:#718096;margin-bottom:16px}}
|
||||
.meta{{font-size:.875em;color:#4a5568;line-height:1.8;margin-bottom:20px}}
|
||||
.meta a{{color:#2b6cb0;text-decoration:none}}
|
||||
.meta a:hover{{text-decoration:underline}}
|
||||
.badge{{display:inline-block;background:#ebf8ff;color:#2b6cb0;border-radius:4px;font-size:.8em;font-weight:600;padding:2px 8px;margin-left:6px;vertical-align:middle}}
|
||||
.warning{{background:#fffbeb;border-left:4px solid #f6ad55;border-radius:4px;padding:12px 16px;font-size:.875em;color:#744210;margin-bottom:24px;line-height:1.5}}
|
||||
.warning a{{color:#c05621}}
|
||||
.downloads{{display:flex;flex-direction:column;gap:12px}}
|
||||
.btn{{display:flex;align-items:center;gap:12px;padding:14px 20px;border-radius:8px;font-size:.95em;font-weight:600;text-decoration:none;transition:transform .1s,box-shadow .1s}}
|
||||
.btn:hover{{transform:translateY(-1px);box-shadow:0 4px 12px rgba(0,0,0,.15)}}
|
||||
.btn-primary{{background:#2b6cb0;color:white}}
|
||||
.btn-msi{{background:#6b46c1;color:white}}
|
||||
.btn-secondary{{background:#edf2f7;color:#2d3748}}
|
||||
.btn-icon{{font-size:1.3em}}
|
||||
.btn-text small{{display:block;font-weight:400;font-size:.8em;opacity:.75;margin-top:1px}}
|
||||
footer{{text-align:center;font-size:.8em;color:#a0aec0;padding:32px 0 0}}
|
||||
footer a{{color:#718096;text-decoration:none}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>⚡ QElectroTech</h1>
|
||||
<p>Nightly Windows Builds</p>
|
||||
</header>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h2>Build info</h2>
|
||||
<div class="meta">
|
||||
📅 <strong>{date}</strong><br>
|
||||
🔀 Commit <a href="https://github.com/{repo}/commit/{sha}"><code>{short}</code></a><br>
|
||||
🔧 <a href="{run_url}">CI Run #{run_number}</a>
|
||||
<span class="badge">nightly</span>
|
||||
</div>
|
||||
<div class="warning">
|
||||
⚠️ This is a development version; it introduces new features you want,
|
||||
but may cause bugs that have not yet been identified yet in <code>master</code>.
|
||||
For production use, download a <a href="https://github.com/{repo}/releases">stable release</a>.
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h2>🏹 Windows — x86_64</h2>
|
||||
<div class="downloads">
|
||||
<a class="btn btn-primary" href="{installer_url}">
|
||||
<span class="btn-icon">⬇</span>
|
||||
<span class="btn-text">Windows Installer<small>.exe — recommended, includes all dependencies</small></span>
|
||||
</a>
|
||||
{msi_block}
|
||||
<a class="btn btn-secondary" href="{portable_url}">
|
||||
<span class="btn-icon">📦</span>
|
||||
<span class="btn-text">Windows Portable<small>.zip — no installation required, extract and run "Lancer QET.bat"</small></span>
|
||||
</a>
|
||||
<a class="btn btn-secondary" href="https://github.com/{repo}/releases/tag/nightly">
|
||||
<span class="btn-icon">📦</span>
|
||||
<span class="btn-text">All nightly files on GitHub<small>Release page with checksums</small></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Auto-generated by GitHub Actions ·
|
||||
<a href="https://github.com/{repo}">Source on GitHub</a> ·
|
||||
<a href="https://qelectrotech.org">qelectrotech.org</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
os.makedirs("gh-pages", exist_ok=True)
|
||||
with open("gh-pages/index.html", "w", encoding="utf-8") as f:
|
||||
f.write(html)
|
||||
print("index.html written OK")
|
||||
@@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
QElectroTech.wxs - WiX v7 installer definition
|
||||
Generates a self-contained x64 MSI for QElectroTech (MSYS2/UCRT64 build).
|
||||
|
||||
Variables passed from the wix build command line:
|
||||
-d FilesDir=<absolute path to artifact\files>
|
||||
-d Version=<numeric version e.g. 0.100.1.0>
|
||||
-d ProductVersion=<display version e.g. 0.100.1-r8770-abc1234_x86_64-win64>
|
||||
-d LicenseRtf=<absolute path to License.rtf>
|
||||
-->
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
||||
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
|
||||
|
||||
<Package
|
||||
Name="QElectroTech"
|
||||
Manufacturer="QElectroTech Team"
|
||||
Version="$(var.Version)"
|
||||
ProductCode="$(var.ProductCode)"
|
||||
UpgradeCode="A1B2C3D4-E5F6-7890-ABCD-EF1234567890"
|
||||
Language="1033"
|
||||
Codepage="1252"
|
||||
InstallerVersion="500"
|
||||
Scope="perMachine">
|
||||
|
||||
<!-- Embed all cabinet files inside the MSI (self-contained installer) -->
|
||||
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
|
||||
|
||||
<!-- In-place upgrade: automatically uninstalls the previous version -->
|
||||
<MajorUpgrade
|
||||
DowngradeErrorMessage="A newer version of QElectroTech is already installed."
|
||||
AllowSameVersionUpgrades="yes"
|
||||
Schedule="afterInstallInitialize" />
|
||||
|
||||
<!-- Installation directory -->
|
||||
<StandardDirectory Id="ProgramFiles64Folder">
|
||||
<Directory Id="INSTALLDIR" Name="QElectroTech" />
|
||||
</StandardDirectory>
|
||||
|
||||
<!-- ============================================================
|
||||
All application files harvested in one pass from files\**
|
||||
(Lancer QET.bat has been removed from the artifact before
|
||||
this build — see windows-msi.yml step "Remove Lancer QET.bat")
|
||||
============================================================ -->
|
||||
<ComponentGroup Id="CG_AllFiles" Directory="INSTALLDIR">
|
||||
<Files Include="$(var.FilesDir)\**" />
|
||||
</ComponentGroup>
|
||||
|
||||
<!-- ============================================================
|
||||
Desktop + Start Menu shortcuts
|
||||
Point directly to qelectrotech.exe with all required arguments.
|
||||
No .bat wrapper needed.
|
||||
============================================================ -->
|
||||
<ComponentGroup Id="CG_Shortcuts" Directory="INSTALLDIR">
|
||||
|
||||
<Component Id="C_ShortcutDesktop" Guid="F1A2B3C4-D5E6-7890-5678-012345678901">
|
||||
<Shortcut Id="DesktopShortcut"
|
||||
Directory="DesktopFolder"
|
||||
Name="QElectroTech"
|
||||
Target="[INSTALLDIR]bin\qelectrotech.exe"
|
||||
Arguments="--common-elements-dir="[INSTALLDIR]elements/" --common-tbt-dir="[INSTALLDIR]titleblocks/" --lang-dir="[INSTALLDIR]lang/" -style windowsvista"
|
||||
Icon="qet.ico"
|
||||
WorkingDirectory="INSTALLDIR" />
|
||||
<RegistryValue Root="HKCU"
|
||||
Key="Software\QElectroTech"
|
||||
Name="DesktopShortcut"
|
||||
Type="integer" Value="1"
|
||||
KeyPath="yes" />
|
||||
</Component>
|
||||
|
||||
<Component Id="C_ShortcutStartMenu" Guid="A2B3C4D5-E6F7-8901-6789-123456789012">
|
||||
<Shortcut Id="StartMenuShortcut"
|
||||
Directory="ProgramMenuFolder"
|
||||
Name="QElectroTech"
|
||||
Target="[INSTALLDIR]bin\qelectrotech.exe"
|
||||
Arguments="--common-elements-dir="[INSTALLDIR]elements/" --common-tbt-dir="[INSTALLDIR]titleblocks/" --lang-dir="[INSTALLDIR]lang/" -style windowsvista"
|
||||
Icon="qet.ico"
|
||||
WorkingDirectory="INSTALLDIR" />
|
||||
<RegistryValue Root="HKCU"
|
||||
Key="Software\QElectroTech"
|
||||
Name="StartMenuShortcut"
|
||||
Type="integer" Value="1"
|
||||
KeyPath="yes" />
|
||||
</Component>
|
||||
|
||||
</ComponentGroup>
|
||||
|
||||
<!-- ============================================================
|
||||
.qet file association
|
||||
============================================================ -->
|
||||
<ComponentGroup Id="CG_FileAssoc" Directory="INSTALLDIR">
|
||||
<Component Id="C_FileAssoc" Guid="B3C4D5E6-F7A8-9012-7890-234567890123">
|
||||
<RegistryValue Root="HKCR" Key=".qet" Type="string" Value="QElectroTech.Document" KeyPath="yes" />
|
||||
<RegistryValue Root="HKCR" Key="QElectroTech.Document" Type="string" Value="QElectroTech Project" />
|
||||
<RegistryValue Root="HKCR" Key="QElectroTech.Document\DefaultIcon" Type="string"
|
||||
Value="[INSTALLDIR]ico\qelectrotech.ico" />
|
||||
<RegistryValue Root="HKCR" Key="QElectroTech.Document\shell\open\command" Type="string"
|
||||
Value=""[INSTALLDIR]bin\qelectrotech.exe" "%1"" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
|
||||
<!-- ============================================================
|
||||
Icon for shortcuts
|
||||
============================================================ -->
|
||||
<Icon Id="qet.ico" SourceFile="$(var.FilesDir)\ico\qelectrotech.ico" />
|
||||
|
||||
<!-- ============================================================
|
||||
CustomAction: set elements\ subtree read-only after install
|
||||
|
||||
Pattern used: two-step SetProperty + Exec
|
||||
1. CA_ResolveElementsPath (immediate, SetProperty):
|
||||
copies the runtime value of INSTALLDIR into the property
|
||||
ELEMENTS_READONLY_CMD, building the full powershell command.
|
||||
2. CA_SetElementsReadOnly (deferred, Execute="deferred"):
|
||||
runs the command stored in ELEMENTS_READONLY_CMD.
|
||||
|
||||
This is the correct WiX v4/v7 pattern for passing a
|
||||
directory path (resolved at runtime) to a deferred CA.
|
||||
============================================================ -->
|
||||
|
||||
<!-- Step 1: build the powershell command with the resolved INSTALLDIR -->
|
||||
<CustomAction Id="CA_ResolveElementsPath"
|
||||
Property="CA_SetElementsReadOnly"
|
||||
Value="powershell.exe -NonInteractive -NoProfile -WindowStyle Hidden -Command "Get-ChildItem -LiteralPath '[INSTALLDIR]elements' -Recurse -File | ForEach-Object { `$_.IsReadOnly = `$true }"" />
|
||||
|
||||
<!-- Step 2: deferred execution of the powershell command -->
|
||||
<CustomAction Id="CA_SetElementsReadOnly"
|
||||
BinaryRef="Wix4UtilCA_X86"
|
||||
DllEntry="WixQuietExec"
|
||||
Execute="deferred"
|
||||
Impersonate="no"
|
||||
Return="ignore" />
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="CA_ResolveElementsPath" After="InstallFiles" Condition="NOT Installed AND NOT REMOVE" />
|
||||
<Custom Action="CA_SetElementsReadOnly" After="CA_ResolveElementsPath" Condition="NOT Installed AND NOT REMOVE" />
|
||||
</InstallExecuteSequence>
|
||||
|
||||
<!-- ============================================================
|
||||
Main feature (everything included)
|
||||
============================================================ -->
|
||||
<Feature Id="ProductFeature" Title="QElectroTech" Level="1">
|
||||
<ComponentGroupRef Id="CG_AllFiles" />
|
||||
<ComponentGroupRef Id="CG_Shortcuts" />
|
||||
<ComponentGroupRef Id="CG_FileAssoc" />
|
||||
</Feature>
|
||||
|
||||
<!-- WixUI_Minimal with QElectroTech GPL-2 license -->
|
||||
<ui:WixUI Id="WixUI_Minimal" />
|
||||
|
||||
<!-- WixVariable without ui: namespace, at Package level -->
|
||||
<WixVariable Id="WixUILicenseRtf" Value="$(var.LicenseRtf)" />
|
||||
|
||||
<!-- Properties shown in Programs and Features -->
|
||||
<Property Id="ARPPRODUCTICON" Value="qet.ico" />
|
||||
<Property Id="ARPHELPLINK" Value="https://qelectrotech.org" />
|
||||
<Property Id="ARPURLINFOABOUT" Value="https://qelectrotech.org" />
|
||||
<Property Id="ARPCOMMENTS" Value="Free electrical schematic editor" />
|
||||
|
||||
</Package>
|
||||
</Wix>
|
||||
@@ -62,10 +62,15 @@ message("PROJECT_SOURCE_DIR :" ${PROJECT_SOURCE_DIR})
|
||||
message("QET_DIR :" ${QET_DIR})
|
||||
message("GIT_COMMIT_SHA :" ${GIT_COMMIT_SHA})
|
||||
|
||||
if(BUILD_WITH_KF5)
|
||||
message("KF5_GIT_TAG :" ${KF5_GIT_TAG})
|
||||
else()
|
||||
add_definitions(-DBUILD_WITHOUT_KF5)
|
||||
if(BUILD_WITH_KF6 AND BUILD_KF6)
|
||||
message("KF6_GIT_TAG :" ${KF6_GIT_TAG})
|
||||
endif()
|
||||
if(NOT BUILD_WITH_KF6)
|
||||
add_definitions(-DBUILD_WITHOUT_KF6)
|
||||
endif()
|
||||
message("QET_COMPONENTS :" ${QET_COMPONENTS})
|
||||
message("QT_VERSION_MAJOR :" ${QT_VERSION_MAJOR})
|
||||
message("Qt version :" ${Qt6_VERSION})
|
||||
|
||||
if(QMFILES_AS_RESOURCE)
|
||||
add_definitions(-DQMFILES_AS_RESOURCE)
|
||||
endif()
|
||||
|
||||
@@ -31,5 +31,8 @@ add_definitions(-DQT_MESSAGELOGCONTEXT)
|
||||
# In order to do so, uncomment the following line.
|
||||
#add_definitions(-DTODO_LIST)
|
||||
|
||||
# Build with KF5
|
||||
option(BUILD_WITH_KF5 "Build with KF5" ON)
|
||||
# Build with KF6
|
||||
option(BUILD_WITH_KF6 "Build with KF6" ON)
|
||||
|
||||
# Use translations as a Qt resource
|
||||
option(QMFILES_AS_RESOURCE "Use .qm files as Qt resource" ON)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2006 The QElectroTech Team
|
||||
# Copyright 2006-2026 The QElectroTech Team
|
||||
# This file is part of QElectroTech.
|
||||
#
|
||||
# QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -14,54 +14,42 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
message(" - fetch_kdeaddons")
|
||||
option(BUILD_KF6 "Build KF6 libraries, use system ones otherwise" OFF)
|
||||
if(BUILD_KF6)
|
||||
block(PROPAGATE KF6_GIT_TAG)
|
||||
message(STATUS " - fetch_kdeaddons")
|
||||
set(KDE_SKIP_TEST_SETTINGS ON)
|
||||
set(KCOREADDONS_USE_QML OFF)
|
||||
set(KWIDGETSADDONS_USE_QML OFF)
|
||||
set(BUILD_TESTING OFF)
|
||||
set(BUILD_DESIGNERPLUGIN OFF)
|
||||
set(BUILD_QCH OFF)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
if(DEFINED BUILD_WITH_KF5)
|
||||
Include(FetchContent)
|
||||
Include(FetchContent)
|
||||
|
||||
option(BUILD_KF5 "Build KF5 libraries, use system ones otherwise" YES)
|
||||
|
||||
if(BUILD_KF5)
|
||||
|
||||
if(NOT DEFINED KF5_GIT_TAG)
|
||||
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
|
||||
set(KF5_GIT_TAG v5.77.0)
|
||||
if(NOT DEFINED KF6_GIT_TAG)
|
||||
set(KF6_GIT_TAG v6.22.0)
|
||||
endif()
|
||||
|
||||
# Fix stop the run autotests of kcoreaddons
|
||||
# see
|
||||
# https://invent.kde.org/frameworks/kcoreaddons/-/blob/master/CMakeLists.txt#L98
|
||||
# issue:
|
||||
# CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:89 (add_executable):
|
||||
# Cannot find source file:
|
||||
# see
|
||||
# https://qelectrotech.org/forum/viewtopic.php?pid=13929#p13929
|
||||
set(KDE_SKIP_TEST_SETTINGS "TRUE")
|
||||
set(BUILD_TESTING "0")
|
||||
FetchContent_Declare(
|
||||
ecm
|
||||
GIT_REPOSITORY https://invent.kde.org/frameworks/extra-cmake-modules.git
|
||||
GIT_TAG ${KF5_GIT_TAG})
|
||||
FetchContent_MakeAvailable(ecm)
|
||||
|
||||
FetchContent_Declare(
|
||||
kcoreaddons
|
||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kcoreaddons.git
|
||||
GIT_TAG ${KF5_GIT_TAG})
|
||||
GIT_TAG ${KF6_GIT_TAG})
|
||||
FetchContent_MakeAvailable(kcoreaddons)
|
||||
|
||||
FetchContent_Declare(
|
||||
kwidgetsaddons
|
||||
GIT_REPOSITORY https://invent.kde.org/frameworks/kwidgetsaddons.git
|
||||
GIT_TAG ${KF5_GIT_TAG})
|
||||
GIT_TAG ${KF6_GIT_TAG})
|
||||
FetchContent_MakeAvailable(kwidgetsaddons)
|
||||
else()
|
||||
find_package(KF5CoreAddons REQUIRED)
|
||||
find_package(KF5WidgetsAddons REQUIRED)
|
||||
endif()
|
||||
|
||||
set(KF5_PRIVATE_LIBRARIES
|
||||
KF5::WidgetsAddons
|
||||
KF5::CoreAddons
|
||||
)
|
||||
endblock()
|
||||
else()
|
||||
find_package(KF6CoreAddons REQUIRED)
|
||||
find_package(KF6WidgetsAddons REQUIRED)
|
||||
endif()
|
||||
|
||||
set(KF6_PRIVATE_LIBRARIES
|
||||
KF6::CoreAddons
|
||||
KF6::WidgetsAddons
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2006 The QElectroTech Team
|
||||
# Copyright 2006-2026 The QElectroTech Team
|
||||
# This file is part of QElectroTech.
|
||||
#
|
||||
# QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -14,18 +14,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
message(" - fetch_pugixml")
|
||||
|
||||
Include(FetchContent)
|
||||
|
||||
option(BUILD_PUGIXML "Build pugixml library, use system one otherwise" YES)
|
||||
|
||||
option(BUILD_PUGIXML "Build pugixml library, use system one otherwise" OFF)
|
||||
if(BUILD_PUGIXML)
|
||||
|
||||
Include(FetchContent)
|
||||
message(" - fetch pugixml")
|
||||
FetchContent_Declare(
|
||||
pugixml
|
||||
GIT_REPOSITORY https://github.com/zeux/pugixml.git
|
||||
GIT_TAG v1.11.4)
|
||||
GIT_TAG v1.15)
|
||||
|
||||
FetchContent_MakeAvailable(pugixml)
|
||||
else()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2006 The QElectroTech Team
|
||||
# Copyright 2006-2026 The QElectroTech Team
|
||||
# This file is part of QElectroTech.
|
||||
#
|
||||
# QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
message(" - fetch_singleapplication")
|
||||
|
||||
# https://github.com/itay-grudev/SingleApplication/issues/18
|
||||
#qmake
|
||||
#DEFINES += QAPPLICATION_CLASS=QGuiApplication
|
||||
set(QAPPLICATION_CLASS QApplication)
|
||||
|
||||
Include(FetchContent)
|
||||
@@ -26,6 +23,6 @@ Include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
SingleApplication
|
||||
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
||||
GIT_TAG v3.2.0)
|
||||
GIT_TAG v3.5.4)
|
||||
|
||||
FetchContent_MakeAvailable(SingleApplication)
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# Copyright 2006 The QElectroTech Team
|
||||
# This file is part of QElectroTech.
|
||||
#
|
||||
# QElectroTech is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# QElectroTech is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.14)
|
||||
message(
|
||||
"_____________________________________________________________________")
|
||||
message("to update Cmake on linux:")
|
||||
message("https://github.com/Kitware/CMake/")
|
||||
message("linux => cmake-3.19.1-Linux-x86_64.sh")
|
||||
message(" sudo ./cmake.sh --prefix=/usr/local/ --exclude-subdir")
|
||||
message("windows good luck :)")
|
||||
endif()
|
||||
@@ -17,6 +17,8 @@
|
||||
message(" - qet_compilation_vars")
|
||||
|
||||
set(QET_COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
LinguistTools
|
||||
PrintSupport
|
||||
Xml
|
||||
@@ -110,6 +112,12 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/borderproperties.h
|
||||
${QET_DIR}/sources/bordertitleblock.cpp
|
||||
${QET_DIR}/sources/bordertitleblock.h
|
||||
# ${QET_DIR}/sources/colorbutton.cpp
|
||||
# ${QET_DIR}/sources/colorbutton.h
|
||||
# ${QET_DIR}/sources/colorcombobox.cpp
|
||||
# ${QET_DIR}/sources/colorcombobox.h
|
||||
# ${QET_DIR}/sources/colorcomboboxdelegate.cpp
|
||||
# ${QET_DIR}/sources/colorcomboboxdelegate.h
|
||||
${QET_DIR}/sources/conductorautonumerotation.cpp
|
||||
${QET_DIR}/sources/conductorautonumerotation.h
|
||||
${QET_DIR}/sources/conductornumexport.cpp
|
||||
@@ -418,10 +426,6 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.cpp
|
||||
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.h
|
||||
|
||||
${QET_DIR}/pugixml/src/pugiconfig.hpp
|
||||
${QET_DIR}/pugixml/src/pugixml.cpp
|
||||
${QET_DIR}/pugixml/src/pugixml.hpp
|
||||
|
||||
${QET_DIR}/sources/qetgraphicsitem/conductor.cpp
|
||||
${QET_DIR}/sources/qetgraphicsitem/conductor.h
|
||||
${QET_DIR}/sources/qetgraphicsitem/conductortextitem.cpp
|
||||
@@ -500,6 +504,9 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/SearchAndReplace/ui/searchandreplacewidget.cpp
|
||||
${QET_DIR}/sources/SearchAndReplace/ui/searchandreplacewidget.h
|
||||
|
||||
${QET_DIR}/sources/svg/qetsvg.cpp
|
||||
${QET_DIR}/sources/svg/qetsvg.h
|
||||
|
||||
${QET_DIR}/sources/titleblock/dimension.cpp
|
||||
${QET_DIR}/sources/titleblock/dimension.h
|
||||
${QET_DIR}/sources/titleblock/dimensionwidget.cpp
|
||||
@@ -713,6 +720,8 @@ set(QET_SRC_FILES
|
||||
|
||||
${QET_DIR}/sources/xml/terminalstripitemxml.cpp
|
||||
${QET_DIR}/sources/xml/terminalstripitemxml.h
|
||||
${QET_DIR}/sources/xml/terminalstriplayoutpatternxml.cpp
|
||||
${QET_DIR}/sources/xml/terminalstriplayoutpatternxml.h
|
||||
)
|
||||
|
||||
set(TS_FILES
|
||||
@@ -733,19 +742,17 @@ set(TS_FILES
|
||||
${QET_DIR}/lang/qet_mn.ts
|
||||
${QET_DIR}/lang/qet_nb.ts
|
||||
${QET_DIR}/lang/qet_nl.ts
|
||||
${QET_DIR}/lang/qet_nl_BE.ts
|
||||
${QET_DIR}/lang/qet_nl_BE.ts
|
||||
${QET_DIR}/lang/qet_no.ts
|
||||
${QET_DIR}/lang/qet_pl.ts
|
||||
${QET_DIR}/lang/qet_pt.ts
|
||||
${QET_DIR}/lang/qet_pt_BR.ts
|
||||
${QET_DIR}/lang/qet_ro.ts
|
||||
${QET_DIR}/lang/qet_rs.ts
|
||||
${QET_DIR}/lang/qet_ru.ts
|
||||
${QET_DIR}/lang/qet_sk.ts
|
||||
${QET_DIR}/lang/qet_sl.ts
|
||||
${QET_DIR}/lang/qet_sr.ts
|
||||
${QET_DIR}/lang/qet_sv.ts
|
||||
${QET_DIR}/lang/qet_tr.ts
|
||||
${QET_DIR}/lang/qet_uk.ts
|
||||
${QET_DIR}/lang/qet_zh.ts
|
||||
)
|
||||
|
||||
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 49 KiB |
@@ -0,0 +1,101 @@
|
||||
Compiler QElectroTech sous microsoft Windows 10 et 11 avec MSYS2
|
||||
================================
|
||||
Ce document décrit les étapes nécessaire afin de compilé QElectroTech sous Windows avec Qt6 et cmake en utilisant MSYS2.
|
||||
|
||||
# MSYS2
|
||||
L'ensemble des outils nécessaire au développement et à la compilation de QElectroTech sous Windows sera installé par l’intermédiaire de [MSYS2](https://www.msys2.org/). Cela comprend entre autre le framework [Qt6](https://www.qt.io/development/qt-framework/qt6), les outils cmake, les dépendances ([kde framework](https://develop.kde.org/docs/), [sqlite](https://sqlite.org/), [pugixml](https://pugixml.org/)), les outils de compilation [minGW](https://www.mingw-w64.org/)...
|
||||
|
||||
>Il sera nécessaire d'utiliser [winget](https://learn.microsoft.com/fr-fr/windows/package-manager/winget/), celui-ci est présent par défaut sous Windows 11, dans le cas de Windows 10, winget peut necessité d'être activé manuellement
|
||||
|
||||
# Installer GIT et MSYS2 avec winget
|
||||
Avec power shell.
|
||||
```
|
||||
winget install Git.Git
|
||||
```
|
||||
puis
|
||||
```
|
||||
winget install MSYS2.MSYS2
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Mise à jour de MSYS2
|
||||
Lors de la première utilisation de MSYS2 il est nécessaire de mettre celui-ci à jour.
|
||||
|
||||
Lancer "MSYS2 MSYS" depuis le menu démarré de Windows.
|
||||
Une fenêtre avec un shell s'ouvre, dans celui-ci lancer la commande :
|
||||
```
|
||||
pacman -Syu
|
||||
```
|
||||
A la fin de la mise à jour MSYS2 MSYS se fermera automatiquement. Ouvrez le à nouveau et relancé la commande
|
||||
```
|
||||
pacman -Syu
|
||||
```
|
||||
|
||||
## Installation des outils de devellopement
|
||||
Toujours dans le shell MSYS2 MSYS lancer la commande suivante.
|
||||
```
|
||||
pacman -S mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-qt6-svg mingw-w64-ucrt-x86_64-qt6-base mingw-w64-ucrt-x86_64-sqlite3 mingw-w64-ucrt-x86_64-pugixml mingw-w64-ucrt-x86_64-kcoreaddons mingw-w64-ucrt-x86_64-kwidgetsaddons mingw-w64-ucrt-x86_64-extra-cmake-modules mingw-w64-ucrt-x86_64-gdb mingw-w64-ucrt-x86_64-qt6-translations mingw-w64-ucrt-x86_64-qt6-tools
|
||||
```
|
||||
> La quantité de paquets à installer est conséquent, en fonction de votre connexion internet cela peut prendre plusieurs dizaine de minute
|
||||
|
||||
L'ensemble des outils est mantenant installé 😀
|
||||
|
||||
# Installer Qt creator
|
||||
Télécharger [l'installateur online de Qt](https://www.qt.io/development/download-qt-installer-oss) et lancer l'installation en suivant les indications de ce dernier.
|
||||
|
||||
>Dans le cas où vous comptez utilisé Qt Creator uniquement pour développez QElectroTech, lors de l'installation choisissez l'option "installation personnalisée" puis dans la page suivante sélectionné uniquement Qt Creator.
|
||||
|
||||
## Configurer Qt creator
|
||||
Ouvrir Qt creator puis rendez vous dans "édition -> préférence -> kit"
|
||||
|
||||
### Versions de Qt
|
||||
|
||||
- Cliquer sur _ajouter_
|
||||
- Renseigner _Chemin de qmake_ (exemple C:\\msys64\\ucrt64\\bin\\qmake.exe).
|
||||
- Dans le champ _Nom :_ ajouter (msys2).
|
||||
|
||||

|
||||
|
||||
### Compilateurs
|
||||
- Cliquer sur _ajouter_ puis choisir _MinGW_.
|
||||
- Renseigner _Emplacement du compilateur C_ (exemple C:\\msys64\\ucrt64\\bin\\g++.exe).
|
||||
- Dans le champ _Nom :_ ajouter (msys2).
|
||||
|
||||

|
||||
|
||||
### Débogueurs
|
||||
- Cliquer sur _ajouter_
|
||||
- Renseigner _Chemin :_ (exemple C:\\msys64\\ucrt64\\bin\\gdb.exe).
|
||||
- Dans le champ _Nom :_ ajouter (msys2).
|
||||
|
||||

|
||||
|
||||
### cmake
|
||||
- Outils -> _Ajouter_
|
||||
- Renseigner _Chemin :_ (exemple C:\\msys64\\ucrt64\\bin\\cmake.exe).
|
||||
- Dans le champ _Nom :_ ajouter (msys2).
|
||||
|
||||

|
||||
|
||||
### KIT
|
||||
Maintenant que tous les prérequis sont fait nous allons crée un kit utilisant les outils fournis par MSYS2. Cliquer sur _Ajouter_, un nouveau kit _manuel_ apparaît, nommer celui-ci par exemple _Qt6 msys2_ puis renseigner le compilateur, le débogueur, la version de Qt et Outils CMake en choisissant à chaque fois ceux que nous venons de créer.
|
||||
puis cliquer sur _appliquer_.
|
||||
|
||||

|
||||
|
||||
Bravo 🥳🥳 vous avez terminé l'installation de la totalité des outils de développement.
|
||||
|
||||
# Clonez le dépôts de QElectrotech
|
||||
Clonez le dépôt de QElectroTech comme vous le faite habituellement, sinon utilisez les commandes suivante dans power shell.
|
||||
|
||||
Crée et/ou se rendre dans le dossier dans lequel vous voulez clonez le dépôt (dans l'exemple nous allons crée un dossier QElectroTech dans C:)
|
||||
|
||||
```
|
||||
mkdir C:\QElectroTech
|
||||
cd C:\QElectroTech
|
||||
|
||||
git clone --recursive https://github.com/qelectrotech/qelectrotech-source-mirror.git
|
||||
```
|
||||
|
||||
Une fois le dépôt cloné lancer Qt creator puis choisir d'ouvrir un projet existant, en choisissant le _CMakeLists.txt_ se trouvant à la racine du projet QElectroTech, enfin dans l'assistant de création de projet choisir comme kit le kit que nous avons créer précédemment.
|
||||
@@ -0,0 +1,13 @@
|
||||
Compiler QElectroTech sous microsoft Windows 10 et 11
|
||||
================================
|
||||
Compiler QElectroTech pour et/ou sous Windows peut être effectué avec plusieurs méthode différente.
|
||||
Ce document énumère uniquement les différentes méthode possible
|
||||
|
||||
N'est mentionné que les étapes nécessaire afin de compilé QElectroTech sous Windows avec Qt6 et cmake. Ce document ne traite pas la compilation avec Qt5 et qmake.
|
||||
|
||||
>QElectroTech 0.100 est la dernière version à utiliser Qt5. Les version suivante sont développé avec Qt6 et utilise cmake au lieu de qmake.
|
||||
|
||||
Il existe deux méthodes pour cela :
|
||||
|
||||
1. [Utiliser msys2 (méthode recommandé)](fr_window_build_msys2.md)
|
||||
2. Télécharger et compiler l'ensemble des dépendances (non rédigé)
|
||||
@@ -16,7 +16,6 @@
|
||||
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
# Need homebrew and coreutils installed see <http://brew.sh>.
|
||||
|
||||
|
||||
#Force MacOSX12.3.sdk
|
||||
#see: https://www.downtowndougbrown.com/2023/08/how-to-create-a-qt-5-arm-intel-universal-binary-for-mac/
|
||||
|
||||
@@ -26,14 +25,20 @@ export DEVELOPER_DIR=/Applications/Xcode_14.01.app/Contents/Developer
|
||||
APPNAME='qelectrotech'
|
||||
BUNDLE=$APPNAME.app
|
||||
APPBIN="$BUNDLE/Contents/MacOS/$APPNAME"
|
||||
IDENTITY="Developer ID Application: Laurent TRINQUES (Y73WZ6WZ5X)"
|
||||
|
||||
# Emplacement du script
|
||||
# Temp paths
|
||||
RW_DMG="/tmp/qet_rw.dmg"
|
||||
MOUNT_POINT="/tmp/qet_dmg_mount"
|
||||
STAGING="/tmp/qet_dmg_staging"
|
||||
|
||||
# Script location
|
||||
current_dir=$(dirname "$0")
|
||||
|
||||
# On se remet au depart
|
||||
# Go back to repo root
|
||||
cd "${current_dir}/../"
|
||||
|
||||
# Emplacement courant
|
||||
# Current directory
|
||||
current_dir=$(PWD)
|
||||
|
||||
|
||||
@@ -46,11 +51,11 @@ echo "Please see the \"Deploying an Application on Qt/Mac\""
|
||||
echo "page in the Qt documentation for more information."
|
||||
echo
|
||||
echo "This script :"
|
||||
echo "\t - up date the git depot"
|
||||
echo "\t - built the application bundle,"
|
||||
echo "\t - update the git depot"
|
||||
echo "\t - build the application bundle,"
|
||||
echo "\t - copy over required Qt frameworks,"
|
||||
echo "\t - copy additional files: translations, titleblocks and elements,"
|
||||
echo "\t - create image disk."
|
||||
echo "\t - notarize the .app, then create a signed DMG."
|
||||
echo
|
||||
echo "Enjoy ;-)"
|
||||
echo
|
||||
@@ -70,25 +75,23 @@ echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Run GIT:"
|
||||
|
||||
# Fait une mise à jour
|
||||
git submodule init
|
||||
git submodule update
|
||||
git pull --recurse-submodules
|
||||
git pull
|
||||
#git checkout foliolist_position
|
||||
|
||||
# recupere le numero de la nouvelle revision
|
||||
|
||||
# Get revision number and version
|
||||
GITCOMMIT=$(git rev-parse --short HEAD)
|
||||
A=$(git rev-list HEAD --count)
|
||||
HEAD=$(($A+473))
|
||||
|
||||
|
||||
VERSION=$(cat sources/qetversion.cpp | grep "return QVersionNumber{"| head -n 1| awk -F "{" '{ print $2 }' | awk -F "}" '{ print $1 }' | sed -e 's/,/./g' -e 's/ //g')
|
||||
#VERSION=$(cat sources/qetversion.cpp | grep "return QVersionNumber{ 0, "| head -n 1| cut -c32-40| sed -e 's/,/./g' -e 's/ //g') #Find major, minor, and micro version numbers in sources/qetversion.cp
|
||||
|
||||
# Tarball de la dernière revision déjà créé
|
||||
if [ -e "build-aux/mac-osx/${APPNAME}-$VERSION-r$HEAD-arm64.zip" ] ; then
|
||||
DMG_NAME="${APPNAME}-$VERSION-r$HEAD-arm64.dmg"
|
||||
DMG_PATH="build-aux/mac-osx/$DMG_NAME"
|
||||
|
||||
# Check if already built
|
||||
if [ -e "$DMG_PATH" ] ; then
|
||||
echo "There are not new updates, make disk image can"
|
||||
echo "take a lot of time (5 min). Can you continu?"
|
||||
echo "[y/n]"
|
||||
@@ -108,28 +111,27 @@ echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Run make install:"
|
||||
|
||||
# pour effacer l’ancienne compilation
|
||||
# Remove old bundle
|
||||
if [ -d $BUNDLE ] ; then
|
||||
echo "Removing hold bundle..."
|
||||
echo "Removing old bundle..."
|
||||
rm -rf $BUNDLE
|
||||
fi
|
||||
if [ -e Makefile ] ; then
|
||||
echo "Removing hold Makefile..."
|
||||
echo "Removing old Makefile..."
|
||||
rm .qmake.stash
|
||||
make clean
|
||||
fi
|
||||
|
||||
# genere le Makefile
|
||||
# Generate Makefile
|
||||
echo "Generating new makefile..."
|
||||
qmake -spec macx-clang
|
||||
qmake -spec macx-clang
|
||||
|
||||
# compilation
|
||||
# Compile
|
||||
if [ -e Makefile.Release ] ; then
|
||||
START_TIME=$SECONDS
|
||||
|
||||
# arret du script si erreur de compilation
|
||||
START_TIME=$SECONDS
|
||||
|
||||
testSuccessBuild () {
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? -ne 0 ]; then
|
||||
cleanVerionTag
|
||||
ELAPSED_TIME=$(($SECONDS - $START_TIME))
|
||||
echo
|
||||
@@ -138,19 +140,18 @@ if [ -e Makefile.Release ] ; then
|
||||
fi
|
||||
}
|
||||
|
||||
# utilise tout les coeurs pour une compilation plus rapide
|
||||
coeur=$(sysctl hw.ncpu | awk '{print $2}')
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $? -ne 0 ]; then
|
||||
make -f Makefile.Release
|
||||
testSuccessBuild
|
||||
else
|
||||
make -j$(($coeur + 1)) -f Makefile.Release
|
||||
testSuccessBuild
|
||||
fi
|
||||
|
||||
|
||||
ELAPSED_TIME=$(($SECONDS - $START_TIME))
|
||||
echo
|
||||
echo "The time of compilation is $(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
|
||||
echo
|
||||
echo "The time of compilation is $(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
|
||||
else
|
||||
echo "ERROR: Makefile not found. This script requires the macx-clang makespec"
|
||||
exit
|
||||
@@ -158,8 +159,7 @@ fi
|
||||
|
||||
cp -R ${current_dir}/misc/Info.plist qelectrotech.app/Contents/
|
||||
cp -R ${current_dir}/ico/mac_icon/*.icns qelectrotech.app/Contents/Resources/
|
||||
# On rajoute le numero de version pour "cmd + i"
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION r$HEAD" "qelectrotech.app/Contents/Info.plist" # Version number
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION r$HEAD" "qelectrotech.app/Contents/Info.plist"
|
||||
|
||||
|
||||
### copy over frameworks ############################################
|
||||
@@ -168,70 +168,58 @@ echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Copy Qt libraries and private frameworks:"
|
||||
|
||||
echo "Processing Mac deployment tool..."
|
||||
echo "Processing Mac deployment tool..."
|
||||
if [ ! -d $BUNDLE ] ; then
|
||||
echo "ERROR: cannot find application bundle \"$BUNDLE\" in current directory"
|
||||
exit
|
||||
fi
|
||||
#~/Qt/5.5/clang_64/bin/macdeployqt $BUNDLE
|
||||
macdeployqt $BUNDLE
|
||||
|
||||
### add file missing #######################################
|
||||
### add missing files ###############################################
|
||||
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Copy file missing:"
|
||||
echo "Copy missing files:"
|
||||
|
||||
# Dossier à ajouter
|
||||
QET_ELMT_DIR="${current_dir}/elements/"
|
||||
QET_TBT_DIR="${current_dir}/titleblocks/"
|
||||
QET_LANG_DIR="${current_dir}/lang/"
|
||||
QET_EXAMPLES_DIR="${current_dir}/examples/"
|
||||
QET_FONTS_DIR="${current_dir}/fonts/"
|
||||
QET_LICENSES_DIR="${current_dir}/licenses/"
|
||||
|
||||
|
||||
# Add new folder for Qt dialog translation see
|
||||
## see <https://download.tuxfamily.org/qet/Qt_lang/>.
|
||||
|
||||
LANG_DIR="${current_dir}/lang1/"
|
||||
|
||||
if [ -d "${QET_ELMT_DIR}" ]; then
|
||||
echo "Copying add elements in the bundle..."
|
||||
#mkdir $BUNDLE/Contents/Resources/elements
|
||||
echo "Copying elements in the bundle..."
|
||||
cp -R ${QET_ELMT_DIR} $BUNDLE/Contents/Resources/elements
|
||||
fi
|
||||
|
||||
if [ -d "${QET_TBT_DIR}" ]; then
|
||||
echo "Copying titleblocks in the bundle..."
|
||||
#mkdir $BUNDLE/Contents/Resources/titleblocks
|
||||
cp -R ${QET_TBT_DIR} $BUNDLE/Contents/Resources/titleblocks
|
||||
fi
|
||||
|
||||
if [ -d "${QET_LANG_DIR}" ]; then
|
||||
echo "Copying translations in the bundle... "
|
||||
echo "Copying translations in the bundle..."
|
||||
mkdir $BUNDLE/Contents/Resources/lang
|
||||
cp ${current_dir}/lang/*.qm $BUNDLE/Contents/Resources/lang
|
||||
fi
|
||||
|
||||
if [ -d "${LANG_DIR}" ]; then
|
||||
echo "Copying translations in the bundle... "
|
||||
cp ${current_dir}/lang1/*.qm $BUNDLE/Contents/Resources/lang
|
||||
|
||||
echo "Copying extra translations in the bundle..."
|
||||
cp ${current_dir}/lang1/*.qm $BUNDLE/Contents/Resources/lang
|
||||
fi
|
||||
|
||||
if [ -d "${QET_EXAMPLES_DIR}" ]; then
|
||||
echo "Copying examples in the bundle... "
|
||||
mkdir $BUNDLE/Contents/Resources/examples
|
||||
cp ${current_dir}/examples/*.qet $BUNDLE/Contents/Resources/examples
|
||||
|
||||
echo "Copying examples in the bundle..."
|
||||
mkdir $BUNDLE/Contents/Resources/examples
|
||||
cp ${current_dir}/examples/*.qet $BUNDLE/Contents/Resources/examples
|
||||
fi
|
||||
|
||||
if [ -d "${QET_FONTS_DIR}" ]; then
|
||||
echo "Copying fonts in the bundle... "
|
||||
mkdir $BUNDLE/Contents/Resources/fonts
|
||||
cp ${current_dir}/fonts/*.ttf $BUNDLE/Contents/Resources/fonts
|
||||
|
||||
echo "Copying fonts in the bundle..."
|
||||
mkdir $BUNDLE/Contents/Resources/fonts
|
||||
cp ${current_dir}/fonts/*.ttf $BUNDLE/Contents/Resources/fonts
|
||||
fi
|
||||
|
||||
if [ -d "${QET_LICENSES_DIR}" ]; then
|
||||
@@ -240,98 +228,282 @@ if [ -d "${QET_LICENSES_DIR}" ]; then
|
||||
cp -R -L ${QET_LICENSES_DIR} $BUNDLE/Contents/Resources/licenses
|
||||
fi
|
||||
|
||||
codesign --force --deep --sign --timestamp -s "Developer ID Application: Laurent TRINQUES (Y73WZ6WZ5X)" --options=runtime $BUNDLE
|
||||
### create zip tarball ###############################################
|
||||
### Sign the bundle #################################################
|
||||
# Sign in correct order: all dylibs first (including flat libs copied
|
||||
# by macdeployqt from Homebrew), then frameworks, plugins, bundle last.
|
||||
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Create zip tarball:"
|
||||
echo "Code signing (dylibs -> frameworks -> plugins -> bundle):"
|
||||
|
||||
/usr/bin/ditto -c -k --keepParent $BUNDLE "build-aux/mac-osx/${APPNAME}-$VERSION-r$HEAD-arm64.zip"
|
||||
# 1. Sign all flat .dylib files in Frameworks/
|
||||
echo "-- Signing dylibs in Frameworks/..."
|
||||
find "$BUNDLE/Contents/Frameworks" -name "*.dylib" | while read lib; do
|
||||
echo " $(basename $lib)"
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$lib"
|
||||
done
|
||||
|
||||
### notarize zip tarball ###############################################
|
||||
echo -e "\033[1;31mWould you like to upload for Notarize packages "${APPNAME}"-"$VERSION"-"r$HEAD-arm64.zip", n/Y?.\033[m"
|
||||
# 2. Sign .framework bundles
|
||||
echo "-- Signing .framework bundles..."
|
||||
find "$BUNDLE/Contents/Frameworks" -maxdepth 1 -name "*.framework" | while read fw; do
|
||||
echo " $(basename $fw)"
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$fw"
|
||||
done
|
||||
|
||||
# 3. Sign plugins
|
||||
echo "-- Signing plugins..."
|
||||
find "$BUNDLE/Contents/PlugIns" \( -name "*.dylib" -o -name "*.so" \) | while read lib; do
|
||||
echo " $(basename $lib)"
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$lib"
|
||||
done
|
||||
|
||||
# 4. Sign any dylibs in MacOS/
|
||||
echo "-- Signing dylibs in MacOS/..."
|
||||
find "$BUNDLE/Contents/MacOS" -name "*.dylib" | while read lib; do
|
||||
echo " $(basename $lib)"
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$lib"
|
||||
done
|
||||
|
||||
# 5. Sign the main executable explicitly
|
||||
echo "-- Signing main executable..."
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime \
|
||||
"$BUNDLE/Contents/MacOS/$APPNAME"
|
||||
|
||||
# 6. Sign the bundle itself last
|
||||
echo "-- Signing bundle..."
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$BUNDLE"
|
||||
|
||||
# 7. Verify
|
||||
echo
|
||||
echo "Verifying bundle signature..."
|
||||
codesign --verify --deep --strict --verbose=2 "$BUNDLE"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: bundle signature verification failed, aborting."
|
||||
exit 1
|
||||
fi
|
||||
spctl -a -vv "$BUNDLE"
|
||||
echo "Bundle signature OK."
|
||||
|
||||
### Notarize the .app (via temporary ZIP) ###########################
|
||||
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Create temporary ZIP for notarization:"
|
||||
|
||||
NOTARIZE_ZIP="/tmp/${APPNAME}-$VERSION-r$HEAD-arm64-notarize.zip"
|
||||
/usr/bin/ditto -c -k --keepParent "$BUNDLE" "$NOTARIZE_ZIP"
|
||||
|
||||
echo -e "\033[1;31mWould you like to notarize the .app \"${APPNAME}-${VERSION}-r${HEAD}\", n/Y?\033[m"
|
||||
read a
|
||||
if [[ $a == "Y" || $a == "y" ]]; then
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Notarize zip tarball:"
|
||||
|
||||
xcrun notarytool submit build-aux/mac-osx/${APPNAME}-$VERSION-r$HEAD-arm64.zip --keychain-profile "org.qelectrotech" --wait
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Notarizing .app:"
|
||||
xcrun notarytool submit "$NOTARIZE_ZIP" --keychain-profile "org.qelectrotech" --wait
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: notarization failed. Check the log with:"
|
||||
echo " xcrun notarytool log <submission-id> --keychain-profile org.qelectrotech"
|
||||
rm -f "$NOTARIZE_ZIP"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "\033[1;33mExit.\033[m"
|
||||
|
||||
echo -e "\033[1;33mExit.\033[m"
|
||||
fi
|
||||
|
||||
### The end, process is done ##########################################
|
||||
echo "Cleaning up temporary notarization ZIP..."
|
||||
rm -f "$NOTARIZE_ZIP"
|
||||
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "The process of creating deployable application zip is done."
|
||||
echo The disque image is in the folder \'build-aux/mac-osx\'.
|
||||
# Affiche les mise à jour depuis l'ancienne revision
|
||||
#if [ ! $(($HEAD - $revAv)) -eq 0 ] ; then
|
||||
# echo
|
||||
# echo "There are new updates. This numero of revision is $HEAD."
|
||||
# svn log -l $(($HEAD - $revAv))
|
||||
#else
|
||||
# echo
|
||||
# echo "There are not new updates. This numero of revision is $HEAD."
|
||||
# fi
|
||||
# echo
|
||||
### Staple the .app #################################################
|
||||
|
||||
# La version en local n'est pas conforme à la dernière version svn
|
||||
# svnversion | grep -q '[MS:]' ; if [ $? -eq 0 ] ; then
|
||||
# echo Please note that the latest \local version is $(svnversion).
|
||||
# echo This is not the same version as the deposit.
|
||||
# echo You can use \'svn diff\' to see the differences.
|
||||
# echo And use \'svn revert \<fichier\>\' to delete the difference.
|
||||
# echo To go back, you can use svn update -r 360
|
||||
# echo to go to revision number 360.
|
||||
# echo
|
||||
#fi
|
||||
|
||||
# Clean up disk folder
|
||||
echo 'Cleaning up... '
|
||||
rm "build-aux/mac-osx/${APPNAME}-$VERSION-r$HEAD-arm64.zip"
|
||||
|
||||
# staple the app
|
||||
echo -e "\033[1;31mWould you like to staple the app MacOS packages "${APPNAME}"-"$VERSION"-"r$HEAD", n/Y?.\033[m"
|
||||
echo -e "\033[1;31mWould you like to staple the .app \"${APPNAME}-${VERSION}-r${HEAD}\", n/Y?\033[m"
|
||||
read a
|
||||
if [[ $a == "Y" || $a == "y" ]]; then
|
||||
xcrun stapler staple -v $BUNDLE
|
||||
xcrun stapler staple -v "$BUNDLE"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: stapling .app failed."
|
||||
exit 1
|
||||
fi
|
||||
echo "Verifying staple on .app..."
|
||||
xcrun stapler validate -v "$BUNDLE"
|
||||
spctl -a -vv "$BUNDLE"
|
||||
echo ".app stapled OK."
|
||||
else
|
||||
echo -e "\033[1;33mExit.\033[m"
|
||||
|
||||
echo -e "\033[1;33mExit.\033[m"
|
||||
fi
|
||||
|
||||
### Create staging folder with Applications symlink #################
|
||||
# The staging folder contains the .app and a symlink to /Applications
|
||||
# so the user can drag-and-drop to install directly from the DMG.
|
||||
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Re Create zip tarball:"
|
||||
echo "Preparing DMG staging folder:"
|
||||
|
||||
/usr/bin/ditto -c -k --sequesterRsrc --keepParent $BUNDLE "build-aux/mac-osx/${APPNAME}-$VERSION-r$HEAD-arm64.zip"
|
||||
rm -rf "$STAGING"
|
||||
mkdir -p "$STAGING"
|
||||
cp -R "$BUNDLE" "$STAGING/"
|
||||
ln -s /Applications "$STAGING/Applications"
|
||||
echo "Staging folder ready: $STAGING"
|
||||
|
||||
### Create writable DMG (UDRW) ######################################
|
||||
# We use a writable DMG first so we can re-sign the .app inside
|
||||
# after hdiutil copies it (hdiutil can invalidate Sealed Resources
|
||||
# during the copy, so we must re-sign inside the mounted volume).
|
||||
|
||||
# Clean up disk folder
|
||||
echo 'Cleaning up... '
|
||||
rm -rf $BUNDLE
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Create writable DMG (UDRW) and re-sign .app inside:"
|
||||
|
||||
rm -f "$RW_DMG"
|
||||
hdiutil create \
|
||||
-volname "QElectroTech $VERSION" \
|
||||
-srcfolder "$STAGING" \
|
||||
-ov \
|
||||
-format UDRW \
|
||||
-fs HFS+ \
|
||||
"$RW_DMG"
|
||||
|
||||
#rsync to TF DMG builds
|
||||
echo -e "\033[1;31mWould you like to upload MacOS packages "${APPNAME}"-"$VERSION"-"r$HEAD-arm64.zip", n/Y?.\033[m"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: hdiutil failed to create writable DMG."
|
||||
rm -rf "$STAGING"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Mount the writable DMG
|
||||
rm -rf "$MOUNT_POINT"
|
||||
mkdir -p "$MOUNT_POINT"
|
||||
hdiutil attach "$RW_DMG" -mountpoint "$MOUNT_POINT" -nobrowse -noverify
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: failed to mount writable DMG."
|
||||
rm -f "$RW_DMG"
|
||||
rm -rf "$STAGING"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Re-sign all binaries inside the mounted DMG
|
||||
echo "-- Re-signing dylibs inside DMG..."
|
||||
find "$MOUNT_POINT/$BUNDLE/Contents/Frameworks" -name "*.dylib" | while read lib; do
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$lib"
|
||||
done
|
||||
|
||||
find "$MOUNT_POINT/$BUNDLE/Contents/Frameworks" -maxdepth 1 -name "*.framework" | while read fw; do
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$fw"
|
||||
done
|
||||
|
||||
find "$MOUNT_POINT/$BUNDLE/Contents/PlugIns" \( -name "*.dylib" -o -name "*.so" \) | while read lib; do
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$lib"
|
||||
done
|
||||
|
||||
echo "-- Re-signing main executable inside DMG..."
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime \
|
||||
"$MOUNT_POINT/$BUNDLE/Contents/MacOS/$APPNAME"
|
||||
|
||||
echo "-- Re-signing bundle inside DMG..."
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime \
|
||||
"$MOUNT_POINT/$BUNDLE"
|
||||
|
||||
# Verify signature inside the mounted DMG
|
||||
echo "Verifying bundle signature inside DMG..."
|
||||
codesign --verify --deep --strict --verbose=2 "$MOUNT_POINT/$BUNDLE"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: bundle signature invalid inside DMG, aborting."
|
||||
hdiutil detach "$MOUNT_POINT"
|
||||
rm -f "$RW_DMG"
|
||||
rm -rf "$STAGING" "$MOUNT_POINT"
|
||||
exit 1
|
||||
fi
|
||||
echo "Bundle signature inside DMG OK."
|
||||
|
||||
# Detach the writable DMG
|
||||
hdiutil detach "$MOUNT_POINT"
|
||||
|
||||
### Convert UDRW to final compressed UDZO ###########################
|
||||
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Convert to final compressed DMG (UDZO):"
|
||||
|
||||
mkdir -p "build-aux/mac-osx"
|
||||
rm -f "$DMG_PATH"
|
||||
|
||||
hdiutil convert "$RW_DMG" \
|
||||
-format UDZO \
|
||||
-o "$DMG_PATH"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: hdiutil convert failed."
|
||||
rm -f "$RW_DMG"
|
||||
rm -rf "$STAGING" "$MOUNT_POINT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f "$RW_DMG"
|
||||
rm -rf "$STAGING" "$MOUNT_POINT"
|
||||
|
||||
### Sign the final DMG ##############################################
|
||||
|
||||
echo "Signing final DMG..."
|
||||
codesign --sign "$IDENTITY" --timestamp "$DMG_PATH"
|
||||
|
||||
### Notarize and staple the final DMG ###############################
|
||||
|
||||
echo -e "\033[1;31mWould you like to notarize the DMG \"${DMG_NAME}\", n/Y?\033[m"
|
||||
read a
|
||||
if [[ $a == "Y" || $a == "y" ]]; then
|
||||
cp -Rf "build-aux/mac-osx/${APPNAME}-$VERSION-r$HEAD-arm64.zip" /Users/laurent/MAC_OS_X/
|
||||
rsync -e ssh -av --delete-after --no-owner --no-g --chmod=g+w --progress --exclude='.DS_Store' /Users/laurent/MAC_OS_X/ server:download.qelectrotech.org/qet/builds/MAC_OS_X/arm64/
|
||||
if [ $? != 0 ]; then
|
||||
{
|
||||
echo "RSYNC ERROR: problem syncing ${APPNAME}-$VERSION-r$HEAD-arm64.zip"
|
||||
rsync -e ssh -av --delete-after --no-owner --no-g --chmod=g+w --progress --exclude='.DS_Store' /Users/laurent/MAC_OS_X/ server:download.qelectrotech.org/qet/builds/MAC_OS_X/arm64/
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "Notarizing DMG:"
|
||||
xcrun notarytool submit "$DMG_PATH" --keychain-profile "org.qelectrotech" --wait
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: DMG notarization failed. Check the log with:"
|
||||
echo " xcrun notarytool log <submission-id> --keychain-profile org.qelectrotech"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
} fi
|
||||
echo "Stapling DMG..."
|
||||
xcrun stapler staple "$DMG_PATH"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: stapling DMG failed."
|
||||
exit 1
|
||||
fi
|
||||
echo "DMG notarized and stapled OK."
|
||||
|
||||
echo "Verifying final DMG..."
|
||||
spctl -a -vv "$DMG_PATH"
|
||||
else
|
||||
echo -e "\033[1;33mExit.\033[m"
|
||||
|
||||
echo -e "\033[1;33mExit.\033[m"
|
||||
fi
|
||||
|
||||
### Clean up bundle #################################################
|
||||
|
||||
echo "Cleaning up bundle..."
|
||||
rm -rf "$BUNDLE"
|
||||
|
||||
### The end #########################################################
|
||||
|
||||
echo
|
||||
echo "______________________________________________________________"
|
||||
echo "The process is done."
|
||||
echo "DMG is in the folder 'build-aux/mac-osx'."
|
||||
|
||||
### Upload via rsync ################################################
|
||||
|
||||
echo -e "\033[1;31mWould you like to upload MacOS package \"${DMG_NAME}\", n/Y?\033[m"
|
||||
read a
|
||||
if [[ $a == "Y" || $a == "y" ]]; then
|
||||
cp -Rf "$DMG_PATH" /Users/laurent/MAC_OS_X/
|
||||
rsync -e ssh -av --delete-after --no-owner --no-g --chmod=g+w \
|
||||
--progress --exclude='.DS_Store' \
|
||||
/Users/laurent/MAC_OS_X/ \
|
||||
server:download.qelectrotech.org/qet/builds/MAC_OS_X/arm64/
|
||||
if [ $? != 0 ]; then
|
||||
echo "RSYNC ERROR: problem syncing ${DMG_NAME}, retrying..."
|
||||
rsync -e ssh -av --delete-after --no-owner --no-g --chmod=g+w \
|
||||
--progress --exclude='.DS_Store' \
|
||||
/Users/laurent/MAC_OS_X/ \
|
||||
server:download.qelectrotech.org/qet/builds/MAC_OS_X/arm64/
|
||||
fi
|
||||
else
|
||||
echo -e "\033[1;33mExit.\033[m"
|
||||
fi
|
||||
|
||||
@@ -26,12 +26,7 @@
|
||||
#include "xmlprojectelementcollectionitem.h"
|
||||
|
||||
#include <QFutureWatcher>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
#include <QtConcurrentMap>
|
||||
#else
|
||||
#include <QtConcurrentRun>
|
||||
#endif
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionModel::ElementsCollectionModel
|
||||
Constructor
|
||||
@@ -294,14 +289,14 @@ void ElementsCollectionModel::loadCollections(bool common_collection,
|
||||
connect(watcher, &QFutureWatcher<void>::progressRangeChanged,
|
||||
this, &ElementsCollectionModel::loadingProgressRangeChanged);
|
||||
connect(watcher, &QFutureWatcher<void>::finished,
|
||||
this, &ElementsCollectionModel::loadingFinished);
|
||||
connect(watcher, &QFutureWatcher<void>::finished, watcher, &QFutureWatcher<void>::deleteLater);
|
||||
this, &ElementsCollectionModel::loadingFinished);
|
||||
connect(
|
||||
watcher,
|
||||
&QFutureWatcher<void>::finished,
|
||||
watcher,
|
||||
&QFutureWatcher<void>::deleteLater);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
m_future = QtConcurrent::map(m_items_list_to_setUp, setUpData);
|
||||
#else
|
||||
qDebug() << "Help code for QT 6 or later";
|
||||
#endif
|
||||
watcher->setFuture(m_future);
|
||||
}
|
||||
|
||||
|
||||
@@ -835,14 +835,8 @@ void ElementsCollectionWidget::search()
|
||||
}
|
||||
|
||||
hideCollection(true);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||
const QStringList text_list = text.split("+", QString::SkipEmptyParts);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||
#endif
|
||||
|
||||
const QStringList text_list = text.split("+", Qt::SkipEmptyParts);
|
||||
#endif
|
||||
QModelIndexList match_index;
|
||||
for (QString txt : text_list) {
|
||||
match_index << m_model->match(m_showed_index.isValid()
|
||||
|
||||
@@ -803,13 +803,13 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const
|
||||
QString path_ = collectionPath(false);
|
||||
QRegularExpression rx("^(.*)/(.*\\.elmt)$");
|
||||
|
||||
if (rx.exactMatch(path_))
|
||||
if (auto regex_match = rx.match(path_); regex_match.hasMatch())
|
||||
{
|
||||
return project()
|
||||
->embeddedElementCollection()
|
||||
->addElementDefinition(
|
||||
rx.cap(1),
|
||||
rx.cap(2),
|
||||
regex_match.captured(1),
|
||||
regex_match.captured(2),
|
||||
xml_document.documentElement());
|
||||
}
|
||||
else
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "../NameList/nameslist.h"
|
||||
#include "../diagramcontext.h"
|
||||
#include "pugixml/src/pugixml.hpp"
|
||||
#include "pugixml.hpp"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
|
||||
@@ -87,11 +87,7 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
||||
{
|
||||
if (! location.exist()) return;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
QDrag* drag = new QDrag(this);
|
||||
#else
|
||||
QScopedPointer<QDrag> drag(new QDrag(this));
|
||||
#endif
|
||||
auto drag = new QDrag{this};
|
||||
|
||||
QString location_str = location.toString();
|
||||
QMimeData *mime_data = new QMimeData();
|
||||
|
||||
@@ -361,7 +361,7 @@ void FileElementCollectionItem::setUpIcon()
|
||||
setIcon(QET::Icons::Folder);
|
||||
} else {
|
||||
if (m_path.endsWith(".qetmak")) {
|
||||
setIcon(QIcon());
|
||||
setIcon(QET::Icons::PartRectangle);
|
||||
} else {
|
||||
ElementsLocation loc(collectionPath());
|
||||
setIcon(loc.icon());
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
#ifndef NAMES_LIST_H
|
||||
#define NAMES_LIST_H
|
||||
#include "pugixml/src/pugixml.hpp"
|
||||
#include "pugixml.hpp"
|
||||
|
||||
#include <QtXml>
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "terminalstripdrawer.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QHash>
|
||||
|
||||
namespace TerminalStripDrawer {
|
||||
|
||||
|
||||
@@ -130,12 +130,7 @@ bool PhysicalTerminal::setLevelOf(const QSharedPointer<RealTerminal> &terminal,
|
||||
const int i = m_real_terminal.indexOf(terminal);
|
||||
if (i >= 0)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
|
||||
m_real_terminal.swapItemsAt(i, std::min(level, m_real_terminal.size()-1));
|
||||
#else
|
||||
auto j = std::min(level, m_real_terminal.size()-1);
|
||||
std::swap(m_real_terminal.begin()[i], m_real_terminal.begin()[j]);
|
||||
#endif
|
||||
m_real_terminal.swapItemsAt(i, std::min(static_cast<qsizetype>(level), m_real_terminal.size()-1));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -64,11 +64,8 @@ bool TerminalStripData::fromXml(const QDomElement &xml_element)
|
||||
"due to wrong tag name. Expected " << this->xmlTagName() << " used " << xml_element.tagName();
|
||||
return false;
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
|
||||
m_uuid = QUuid::fromString(xml_element.attribute(QStringLiteral("uuid")));
|
||||
#else
|
||||
m_uuid = QUuid(xml_element.attribute(QStringLiteral("uuid")));
|
||||
#endif
|
||||
|
||||
for (auto &xml_info :
|
||||
QETXML::findInDomElement(xml_element.firstChildElement(QStringLiteral("informations")),
|
||||
|
||||
@@ -35,11 +35,7 @@ TerminalStripTreeDockWidget::TerminalStripTreeDockWidget(QETProject *project, QW
|
||||
ui->setupUi(this);
|
||||
setProject(project);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
||||
#else
|
||||
ui->m_tree_view->expandAll();
|
||||
#endif
|
||||
}
|
||||
|
||||
TerminalStripTreeDockWidget::~TerminalStripTreeDockWidget()
|
||||
@@ -93,11 +89,7 @@ void TerminalStripTreeDockWidget::reload()
|
||||
|
||||
buildTree();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
||||
#else
|
||||
ui->m_tree_view->expandAll();
|
||||
#endif
|
||||
|
||||
//Reselect the tree widget item of the current edited strip
|
||||
auto item = m_item_strip_H.key(current_);
|
||||
|
||||
@@ -55,11 +55,7 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) :
|
||||
m_titleblock_template_renderer = new TitleBlockTemplateRenderer(this);
|
||||
m_titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
|
||||
|
||||
// disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes
|
||||
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0) // ### Qt 6: remove
|
||||
#else
|
||||
m_titleblock_template_renderer -> setUseCache(false);
|
||||
#endif
|
||||
|
||||
// dimensions par defaut du schema
|
||||
importBorder(BorderProperties());
|
||||
|
||||
@@ -72,14 +72,7 @@ bool ConductorNumExport::toCsv()
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
QTextStream stream(&file);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
||||
stream << wiresNum() << endl;
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 5.15 or later")
|
||||
#endif
|
||||
stream << wiresNum() << &Qt::endl(stream);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
||||
@@ -811,14 +811,7 @@ void ConductorProperties::readStyle(const QString &style_string) {
|
||||
if (style_string.isEmpty()) return;
|
||||
|
||||
// recupere la liste des couples style / valeur
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||
QStringList styles = style_string.split(";", QString::SkipEmptyParts);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code QString::SkipEmptyParts for QT 5.14 or later")
|
||||
#endif
|
||||
QStringList styles = style_string.split(";", Qt::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
QRegularExpression Rx("^(?<name>[a-z-]+): (?<value>[a-z-]+)$");
|
||||
if (!Rx.isValid())
|
||||
|
||||
@@ -47,14 +47,8 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
|
||||
m_button_group.addButton(ui->m_coil_cb, 4);
|
||||
m_button_group.addButton(ui->m_protection_cb, 5);
|
||||
m_button_group.addButton(ui->m_thumbnail_cb, 6);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 5.15 or later")
|
||||
#endif
|
||||
|
||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked), [this](int id)
|
||||
#endif
|
||||
{
|
||||
auto check_box = static_cast<QCheckBox *>(m_button_group.button(0));
|
||||
if (id == 0)
|
||||
|
||||
@@ -1514,14 +1514,6 @@ bool Diagram::fromXml(QDomElement &document,
|
||||
if (content_ptr) {
|
||||
content_ptr -> m_elements = added_elements;
|
||||
content_ptr -> m_conductors_to_move = added_conductors;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||
content_ptr -> m_text_fields = added_texts.toSet();
|
||||
content_ptr -> m_images = added_images.toSet();
|
||||
content_ptr -> m_shapes = added_shapes.toSet();
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||
#endif
|
||||
content_ptr -> m_text_fields = QSet<IndependentTextItem *>(
|
||||
added_texts.begin(),
|
||||
added_texts.end());
|
||||
@@ -1532,7 +1524,6 @@ bool Diagram::fromXml(QDomElement &document,
|
||||
added_shapes.begin(),
|
||||
added_shapes.end());
|
||||
content_ptr->m_terminal_strip.swap(added_strips);
|
||||
#endif
|
||||
content_ptr->m_tables.swap(added_tables);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
#ifndef DIAGRAM_CONTEXT_H
|
||||
#define DIAGRAM_CONTEXT_H
|
||||
#include "pugixml/src/pugixml.hpp"
|
||||
#include "pugixml.hpp"
|
||||
|
||||
#include <QDomElement>
|
||||
#include <QHash>
|
||||
|
||||
@@ -210,17 +210,10 @@ void DiagramView::handleElementDrop(QDropEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
QPointF drop_pos;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
drop_pos = mapToScene(event->pos());
|
||||
#else
|
||||
drop_pos = event->position();
|
||||
#endif
|
||||
|
||||
if (location.path().endsWith(".qetmak")) {
|
||||
diagram()->setEventInterface(new DiagramEventAddMacro(location, diagram(), drop_pos));
|
||||
diagram()->setEventInterface(new DiagramEventAddMacro(location, diagram(), event->position()));
|
||||
} else {
|
||||
diagram()->setEventInterface(new DiagramEventAddElement(location, diagram(), drop_pos));
|
||||
diagram()->setEventInterface(new DiagramEventAddElement(location, diagram(), event->position()));
|
||||
}
|
||||
|
||||
//Set focus to the view to get event
|
||||
@@ -290,17 +283,8 @@ void DiagramView::handleTextDrop(QDropEvent *e) {
|
||||
iti -> setHtml (e -> mimeData() -> text());
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
|
||||
m_diagram->undoStack().push(new AddGraphicsObjectCommand(
|
||||
iti, m_diagram, mapToScene(e->pos())));
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
m_diagram->undoStack().push(new AddGraphicsObjectCommand(
|
||||
iti, m_diagram, e->position()));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -458,14 +442,7 @@ void DiagramView::mousePressEvent(QMouseEvent *e)
|
||||
if (m_event_interface && m_event_interface->mousePressEvent(e)) return;
|
||||
|
||||
//Start drag view when hold the middle button
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
m_drag_last_pos = e->pos();
|
||||
viewport()->setCursor(Qt::ClosedHandCursor);
|
||||
@@ -515,14 +492,7 @@ void DiagramView::mouseMoveEvent(QMouseEvent *e)
|
||||
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
|
||||
|
||||
// Drag the view
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||
if (e->buttons() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->buttons() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
QScrollBar *h = horizontalScrollBar();
|
||||
QScrollBar *v = verticalScrollBar();
|
||||
@@ -583,14 +553,7 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
||||
if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return;
|
||||
|
||||
// Stop drag view
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
viewport()->setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
@@ -624,14 +587,7 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
||||
QMenu *menu = new QMenu(this);
|
||||
menu->addAction(act);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
menu->popup(e->globalPos());
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
menu->popup(e->pos());
|
||||
#endif
|
||||
}
|
||||
|
||||
m_free_rubberbanding = false;
|
||||
@@ -1355,7 +1311,6 @@ void DiagramView::createTemplateFromSelection()
|
||||
QFile file(full_path);
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream out(&file);
|
||||
out.setCodec("UTF-8");
|
||||
out << macro_doc.toString(4);
|
||||
file.close();
|
||||
qDebug() << "Template successfully saved to:" << full_path;
|
||||
|
||||
@@ -276,14 +276,7 @@ void ChangeZValueCommand::applyRaise(const QList<QGraphicsItem *> &items_list) {
|
||||
for (int i = my_items_list.count() - 2 ; i >= 0 ; -- i) {
|
||||
if (my_items_list[i] -> isSelected()) {
|
||||
if (!my_items_list[i +1] -> isSelected()) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
||||
my_items_list.swap(i, i + 1);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 5.13 or later")
|
||||
#endif
|
||||
my_items_list.swapItemsAt(i, i + 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -301,14 +294,7 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
|
||||
for (int i = 1 ; i < my_items_list.count() ; ++ i) {
|
||||
if (my_items_list[i] -> isSelected()) {
|
||||
if (!my_items_list[i - 1] -> isSelected()) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
||||
my_items_list.swap(i, i - 1);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 5.13 or later")
|
||||
#endif
|
||||
my_items_list.swapItemsAt(i, i - 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,14 +372,7 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
||||
*/
|
||||
void ElementView::mousePressEvent(QMouseEvent* e)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
setCursor( (Qt::ClosedHandCursor));
|
||||
reference_view_ = e->pos();
|
||||
@@ -394,14 +387,7 @@ void ElementView::mousePressEvent(QMouseEvent* e)
|
||||
*/
|
||||
void ElementView::mouseMoveEvent(QMouseEvent* e)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||
if (e->buttons() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->buttons() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
QScrollBar *h = horizontalScrollBar();
|
||||
QScrollBar *v = verticalScrollBar();
|
||||
@@ -420,14 +406,7 @@ void ElementView::mouseMoveEvent(QMouseEvent* e)
|
||||
*/
|
||||
void ElementView::mouseReleaseEvent(QMouseEvent* e)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
setCursor(Qt::ArrowCursor);
|
||||
adjustSceneRect();
|
||||
|
||||
@@ -519,14 +519,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
|
||||
resetStyles();
|
||||
|
||||
//Get the list of pair style/value
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||
QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||
#endif
|
||||
QStringList styles = qde.attribute("style").split(";", Qt::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
//Check each pair of style
|
||||
QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
||||
|
||||
@@ -220,7 +220,7 @@ void DynamicTextFieldEditor::fillInfoComboBox()
|
||||
QStringList strl;
|
||||
auto type = elementEditor()->elementScene()->elementData().m_type;
|
||||
|
||||
if(type & ElementData::AllReport) {
|
||||
if((type & ElementData::AllReport) || (type == ElementData::ConductorDefinition)) {
|
||||
strl = QETInformation::folioReportInfoKeys();
|
||||
}
|
||||
else {
|
||||
@@ -365,7 +365,8 @@ void DynamicTextFieldEditor::on_m_text_from_cb_activated(int index) {
|
||||
void DynamicTextFieldEditor::on_m_composite_text_pb_clicked()
|
||||
{
|
||||
bool isReport = false;
|
||||
if (elementEditor()->elementScene()->elementData().m_type & ElementData::AllReport) {
|
||||
auto type = elementEditor()->elementScene()->elementData().m_type;
|
||||
if ((type & ElementData::AllReport) || (type == ElementData::ConductorDefinition)) {
|
||||
isReport = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ void ElementPropertiesEditorWidget::setUpInterface()
|
||||
ui->m_base_type_cb->addItem (tr("Renvoi de folio précédent"), ElementData::PreviousReport);
|
||||
ui->m_base_type_cb->addItem (tr("Bornier"), ElementData::Terminal);
|
||||
ui->m_base_type_cb->addItem (tr("Vignette"), ElementData::Thumbnail);
|
||||
ui->m_base_type_cb->addItem (tr("Définition de conducteur"), ElementData::ConductorDefinition);
|
||||
|
||||
// Slave option
|
||||
ui->m_state_cb->addItem(tr("Normalement ouvert"), ElementData::NO);
|
||||
@@ -188,6 +189,9 @@ void ElementPropertiesEditorWidget::updateTree()
|
||||
case ElementData::PreviousReport:
|
||||
ui->m_tree->setDisabled(true);
|
||||
break;
|
||||
case ElementData::ConductorDefinition:
|
||||
ui->m_tree->setDisabled(true);
|
||||
break;
|
||||
case ElementData::Master:
|
||||
ui->m_tree->setEnabled(true);
|
||||
break;
|
||||
@@ -287,11 +291,9 @@ void ElementPropertiesEditorWidget::on_m_base_type_cb_currentIndexChanged(int in
|
||||
ui->m_master_gb->setVisible(master);
|
||||
ui->m_terminal_gb->setVisible(terminal);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
ui->tabWidget->setTabVisible(1,
|
||||
(type_ == ElementData::Simple ||
|
||||
type_ == ElementData::Master));
|
||||
#endif
|
||||
|
||||
updateTree();
|
||||
}
|
||||
|
||||
@@ -736,40 +736,62 @@ bool QETElementEditor::checkElement()
|
||||
QList<QETWarning> warnings;
|
||||
QList<QETWarning> errors;
|
||||
|
||||
// Warning #1: Element haven't got terminal
|
||||
// (except for report, because report must have one terminal and this checking is do below)
|
||||
// Warning #1: Element haven't got terminal
|
||||
// (except for report and conductor definition, because they must have one terminal and this checking is done below)
|
||||
if (!m_elmt_scene -> containsTerminals() &&
|
||||
!(m_elmt_scene->elementData().m_type & ElementData::AllReport)) {
|
||||
!(m_elmt_scene->elementData().m_type & ElementData::AllReport) &&
|
||||
m_elmt_scene->elementData().m_type != ElementData::ConductorDefinition) {
|
||||
warnings << qMakePair(
|
||||
tr("Absence de borne", "warning title"),
|
||||
tr(
|
||||
"<br>En l'absence de borne, l'élément ne pourra être"
|
||||
" relié à d'autres éléments par l'intermédiaire de conducteurs.",
|
||||
"warning description"
|
||||
)
|
||||
);
|
||||
}
|
||||
tr("Absence de borne", "warning title"),
|
||||
tr(
|
||||
"<br>En l'absence de borne, l'élément ne pourra être"
|
||||
" relié à d'autres éléments par l'intermédiaire de conducteurs.",
|
||||
"warning description"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Check folio report element
|
||||
if (m_elmt_scene->elementData().m_type & ElementData::AllReport)
|
||||
{
|
||||
int terminal =0;
|
||||
if (m_elmt_scene->elementData().m_type & ElementData::AllReport)
|
||||
{
|
||||
int terminal =0;
|
||||
|
||||
for(auto qgi : m_elmt_scene -> items()) {
|
||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||
terminal ++;
|
||||
for(auto qgi : m_elmt_scene -> items()) {
|
||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||
terminal ++;
|
||||
}
|
||||
}
|
||||
|
||||
//Error folio report must have only one terminal
|
||||
if (terminal != 1) {
|
||||
errors << qMakePair (tr("Absence de borne"),
|
||||
tr("<br><b>Erreur</b> :"
|
||||
"<br>Les reports de folio doivent posséder une seul borne."
|
||||
"<br><b>Solution</b> :"
|
||||
"<br>Verifier que l'élément ne possède qu'une seul borne"));
|
||||
}
|
||||
}
|
||||
|
||||
//Error folio report must have only one terminal
|
||||
if (terminal != 1) {
|
||||
errors << qMakePair (tr("Absence de borne"),
|
||||
tr("<br><b>Erreur</b> :"
|
||||
"<br>Les reports de folio doivent posséder une seul borne."
|
||||
"<br><b>Solution</b> :"
|
||||
"<br>Verifier que l'élément ne possède qu'une seul borne"));
|
||||
// Check conductor definition element
|
||||
if (m_elmt_scene->elementData().m_type == ElementData::ConductorDefinition)
|
||||
{
|
||||
int terminal =0;
|
||||
|
||||
for(auto qgi : m_elmt_scene -> items()) {
|
||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||
terminal ++;
|
||||
}
|
||||
}
|
||||
|
||||
// Error: Conductor definition must have exactly one terminal
|
||||
if (terminal != 1) {
|
||||
errors << qMakePair (tr("Nombre de bornes incorrect"),
|
||||
tr("<br><b>Erreur</b> :"
|
||||
"<br>Les définitions de conducteur ne peuvent posséder qu'une seule borne."
|
||||
"<br><b>Solution</b> :"
|
||||
"<br>Vérifier que l'élément ne possède qu'une seule borne"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!errors.count() && !warnings.count()) {
|
||||
return(true);
|
||||
|
||||
@@ -61,7 +61,7 @@ void TerminalEditor::updateForm()
|
||||
ui->m_y_dsb->setValue(m_part->property("y").toReal());
|
||||
ui->m_orientation_cb->setCurrentIndex(ui->m_orientation_cb->findData(m_part->property("orientation")));
|
||||
ui->m_name_le->setText(m_part->terminalName());
|
||||
ui->m_type_cb->setCurrentIndex(ui->m_orientation_cb->findData(m_part->terminalType()));
|
||||
ui->m_type_cb->setCurrentIndex(ui->m_type_cb->findData(m_part->terminalType()));
|
||||
|
||||
activeConnections(true);
|
||||
}
|
||||
@@ -122,6 +122,9 @@ void TerminalEditor::init()
|
||||
ui->m_type_cb->addItem(tr("Générique"), TerminalData::Generic);
|
||||
ui->m_type_cb->addItem(tr("Bornier intérieur"), TerminalData::Inner);
|
||||
ui->m_type_cb->addItem(tr("Bornier extérieur"), TerminalData::Outer);
|
||||
ui->m_type_cb->addItem(tr("NO (contact SW)"), TerminalData::No);
|
||||
ui->m_type_cb->addItem(tr("NC (contact SW)"), TerminalData::Nc);
|
||||
ui->m_type_cb->addItem(tr("Commun (contact SW)"), TerminalData::Common);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -335,6 +335,7 @@ void TextEditor::setUpWidget(QWidget *parent)
|
||||
|
||||
m_size_sb = new QSpinBox(parent);
|
||||
m_size_sb->setObjectName(QString::fromUtf8("m_size_sb"));
|
||||
m_size_sb->setMinimum(4);
|
||||
|
||||
gridLayout->addWidget(m_size_sb, 2, 1, 1, 1);
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "qeticons.h"
|
||||
#include "qetproject.h"
|
||||
#include "titleblock/templatescollection.h"
|
||||
#include <QApplication>
|
||||
|
||||
/*
|
||||
Lorsque le flag ENABLE_PANEL_DND_CHECKS est defini, le panel d'elements
|
||||
@@ -42,7 +43,7 @@ ElementsPanel::ElementsPanel(QWidget *parent) :
|
||||
first_reload_(true)
|
||||
{
|
||||
// selection unique
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setColumnCount(1);
|
||||
setExpandsOnDoubleClick(true);
|
||||
setMouseTracking(true);
|
||||
@@ -299,11 +300,14 @@ void ElementsPanel::reload()
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsPanel::slot_clicked
|
||||
handle click on qtwi
|
||||
@param qtwi item that was clickerd on
|
||||
*/
|
||||
* @brief ElementsPanel::slot_clicked
|
||||
* handle click on qtwi
|
||||
* @param qtwi item that was clickerd on
|
||||
*/
|
||||
void ElementsPanel::slot_clicked(QTreeWidgetItem *clickedItem, int) {
|
||||
if (QApplication::keyboardModifiers() & (Qt::ShiftModifier | Qt::ControlModifier)) {
|
||||
return;
|
||||
}
|
||||
|
||||
requestForItem(clickedItem);
|
||||
}
|
||||
@@ -553,3 +557,20 @@ void ElementsPanel::keyPressEvent(QKeyEvent *event)
|
||||
QTreeView::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementsPanel::selectedDiagrams
|
||||
* @return A list of all currently selected diagrams in the panel.
|
||||
*/
|
||||
QList<Diagram *> ElementsPanel::selectedDiagrams() const
|
||||
{
|
||||
QList<Diagram *> diagrams;
|
||||
foreach (QTreeWidgetItem *item, selectedItems()) {
|
||||
if (item->type() == QET::Diagram) {
|
||||
if (Diagram *diagram = valueForItem<Diagram *>(item)) {
|
||||
diagrams.append(diagram);
|
||||
}
|
||||
}
|
||||
}
|
||||
return diagrams;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ class ElementsPanel : public GenericPanel {
|
||||
// methods used to get what is represented by a particular visual item
|
||||
QString dirPathForItem(QTreeWidgetItem *);
|
||||
QString filePathForItem(QTreeWidgetItem *);
|
||||
QList<Diagram *> selectedDiagrams() const;
|
||||
|
||||
signals:
|
||||
void requestForProject(QETProject *);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "qetproject.h"
|
||||
#include "titleblock/templatedeleter.h"
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
/*
|
||||
When the ENABLE_PANEL_WIDGET_DND_CHECKS flag is set, the panel
|
||||
@@ -242,85 +243,134 @@ void ElementsPanelWidget::newDiagram()
|
||||
}
|
||||
|
||||
/**
|
||||
Emet le signal requestForDiagramDeletion avec le schema selectionne
|
||||
*/
|
||||
* Emet le signal requestForDiagramsDeletion avec les schemas selectionnes
|
||||
*/
|
||||
void ElementsPanelWidget::deleteDiagram()
|
||||
{
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramDeletion(selected_diagram));
|
||||
elements_panel->reload();
|
||||
QList<Diagram *> diagrams_to_delete = elements_panel->selectedDiagrams();
|
||||
|
||||
if (diagrams_to_delete.isEmpty()) return;
|
||||
|
||||
emit(requestForDiagramsDeletion(diagrams_to_delete));
|
||||
|
||||
elements_panel->reload();
|
||||
}
|
||||
/**
|
||||
* Emits the requestForDiagramMoveUpTop signal with all selected diagrams.
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramUpTop() {
|
||||
QList<Diagram *> diagrams_to_move = elements_panel->selectedDiagrams();
|
||||
if (diagrams_to_move.isEmpty()) return;
|
||||
|
||||
// Emit the entire list at once
|
||||
emit requestForDiagramMoveUpTop(diagrams_to_move);
|
||||
|
||||
// Clear messy tree selection caused by moving items, then restore clean selection
|
||||
elements_panel->clearSelection();
|
||||
for (Diagram *d : diagrams_to_move) {
|
||||
if (auto item = elements_panel->getItemForDiagram(d)) item->setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Emet le signal requestForDiagramMoveUpTop avec le schema selectionne
|
||||
+*/
|
||||
void ElementsPanelWidget::moveDiagramUpTop()
|
||||
{
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramMoveUpTop(selected_diagram));
|
||||
}
|
||||
}
|
||||
* Emits the requestForDiagramMoveUp signal with all selected diagrams.
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramUp() {
|
||||
QList<Diagram *> diagrams_to_move = elements_panel->selectedDiagrams();
|
||||
if (diagrams_to_move.isEmpty()) return;
|
||||
|
||||
// Emit the entire list at once
|
||||
emit requestForDiagramMoveUp(diagrams_to_move);
|
||||
|
||||
|
||||
/**
|
||||
Emet le signal requestForDiagramMoveUp avec le schema selectionne
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramUp()
|
||||
{
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramMoveUp(selected_diagram));
|
||||
// Clear messy tree selection caused by moving items, then restore clean selection
|
||||
elements_panel->clearSelection();
|
||||
for (Diagram *d : diagrams_to_move) {
|
||||
if (auto item = elements_panel->getItemForDiagram(d)) item->setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Emet le signal requestForDiagramMoveDown avec le schema selectionne
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramDown()
|
||||
{
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramMoveDown(selected_diagram));
|
||||
* Emits the requestForDiagramMoveDown signal with all selected diagrams.
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramDown() {
|
||||
QList<Diagram *> diagrams_to_move = elements_panel->selectedDiagrams();
|
||||
if (diagrams_to_move.isEmpty()) return;
|
||||
|
||||
// Emit the entire list at once
|
||||
emit requestForDiagramMoveDown(diagrams_to_move);
|
||||
|
||||
// Clear messy tree selection caused by moving items, then restore clean selection
|
||||
elements_panel->clearSelection();
|
||||
for (Diagram *d : diagrams_to_move) {
|
||||
if (auto item = elements_panel->getItemForDiagram(d)) item->setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Emet le signal requestForDiagramMoveUpx10 avec le schema selectionne
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramUpx10()
|
||||
{
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramMoveUpx10(selected_diagram));
|
||||
* Emits the requestForDiagramMoveUpx10 signal with all selected diagrams.
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramUpx10() {
|
||||
QList<Diagram *> diagrams_to_move = elements_panel->selectedDiagrams();
|
||||
if (diagrams_to_move.isEmpty()) return;
|
||||
|
||||
// Emit the entire list at once
|
||||
emit requestForDiagramMoveUpx10(diagrams_to_move);
|
||||
|
||||
// Clear messy tree selection caused by moving items, then restore clean selection
|
||||
elements_panel->clearSelection();
|
||||
for (Diagram *d : diagrams_to_move) {
|
||||
if (auto item = elements_panel->getItemForDiagram(d)) item->setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Emet le signal requestForDiagramMoveUpx100 avec le schema selectionne
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramUpx100()
|
||||
{
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramMoveUpx100(selected_diagram));
|
||||
* Emits the requestForDiagramMoveUpx100 signal with all selected diagrams.
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramUpx100() {
|
||||
QList<Diagram *> diagrams_to_move = elements_panel->selectedDiagrams();
|
||||
if (diagrams_to_move.isEmpty()) return;
|
||||
|
||||
// Emit the entire list at once
|
||||
emit requestForDiagramMoveUpx100(diagrams_to_move);
|
||||
|
||||
// Clear messy tree selection caused by moving items, then restore clean selection
|
||||
elements_panel->clearSelection();
|
||||
for (Diagram *d : diagrams_to_move) {
|
||||
if (auto item = elements_panel->getItemForDiagram(d)) item->setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Emet le signal requestForDiagramMoveDownx10 avec le schema selectionne
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramDownx10()
|
||||
{
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramMoveDownx10(selected_diagram));
|
||||
* Emits the requestForDiagramMoveDownx10 signal with all selected diagrams.
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramDownx10() {
|
||||
QList<Diagram *> diagrams_to_move = elements_panel->selectedDiagrams();
|
||||
if (diagrams_to_move.isEmpty()) return;
|
||||
|
||||
// Emit the entire list at once
|
||||
emit requestForDiagramMoveDownx10(diagrams_to_move);
|
||||
|
||||
// Clear messy tree selection caused by moving items, then restore clean selection
|
||||
elements_panel->clearSelection();
|
||||
for (Diagram *d : diagrams_to_move) {
|
||||
if (auto item = elements_panel->getItemForDiagram(d)) item->setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Emet le signal requestForDiagramMoveDownx100 avec le schema selectionne
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramDownx100()
|
||||
{
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramMoveDownx100(selected_diagram));
|
||||
* Emits the requestForDiagramMoveDownx100 signal with all selected diagrams.
|
||||
*/
|
||||
void ElementsPanelWidget::moveDiagramDownx100() {
|
||||
QList<Diagram *> diagrams_to_move = elements_panel->selectedDiagrams();
|
||||
if (diagrams_to_move.isEmpty()) return;
|
||||
|
||||
// Emit the entire list at once
|
||||
emit requestForDiagramMoveDownx100(diagrams_to_move);
|
||||
|
||||
// Clear messy tree selection caused by moving items, then restore clean selection
|
||||
elements_panel->clearSelection();
|
||||
for (Diagram *d : diagrams_to_move) {
|
||||
if (auto item = elements_panel->getItemForDiagram(d)) item->setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,21 +428,35 @@ void ElementsPanelWidget::updateButtons()
|
||||
bool is_writable = !(elements_panel -> selectedProject() -> isReadOnly());
|
||||
prj_add_diagram -> setEnabled(is_writable);
|
||||
} else if (current_type == QET::Diagram) {
|
||||
Diagram *selected_diagram = elements_panel -> selectedDiagram();
|
||||
QETProject *selected_diagram_project = selected_diagram -> project();
|
||||
// Fetch ALL selected diagrams instead of just one
|
||||
QList<Diagram *> selected_diagrams = elements_panel -> selectedDiagrams();
|
||||
|
||||
bool is_writable = !(selected_diagram_project -> isReadOnly());
|
||||
int project_diagrams_count = selected_diagram_project -> diagrams().count();
|
||||
int diagram_position = selected_diagram_project -> diagrams().indexOf(selected_diagram);
|
||||
if (!selected_diagrams.isEmpty()) {
|
||||
QETProject *selected_diagram_project = selected_diagrams.first() -> project();
|
||||
bool is_writable = !(selected_diagram_project -> isReadOnly());
|
||||
int project_diagrams_count = selected_diagram_project -> diagrams().count();
|
||||
|
||||
prj_del_diagram -> setEnabled(is_writable);
|
||||
prj_move_diagram_up -> setEnabled(is_writable && diagram_position > 0);
|
||||
prj_move_diagram_down -> setEnabled(is_writable && diagram_position < project_diagrams_count - 1);
|
||||
prj_move_diagram_top -> setEnabled(is_writable && diagram_position > 0);
|
||||
prj_move_diagram_upx10 -> setEnabled(is_writable && diagram_position > 10);
|
||||
prj_move_diagram_upx100 -> setEnabled(is_writable && diagram_position > 100);
|
||||
prj_move_diagram_downx10 -> setEnabled(is_writable && diagram_position < project_diagrams_count - 10);
|
||||
prj_move_diagram_downx100 -> setEnabled(is_writable && diagram_position < project_diagrams_count - 100);
|
||||
// Find the highest (min) and lowest (max) index among the selection
|
||||
int min_position = project_diagrams_count;
|
||||
int max_position = -1;
|
||||
|
||||
for (Diagram *diagram : selected_diagrams) {
|
||||
int pos = selected_diagram_project -> diagrams().indexOf(diagram);
|
||||
if (pos < min_position) min_position = pos;
|
||||
if (pos > max_position) max_position = pos;
|
||||
}
|
||||
|
||||
prj_del_diagram -> setEnabled(is_writable);
|
||||
prj_move_diagram_up -> setEnabled(is_writable && min_position > 0);
|
||||
prj_move_diagram_down -> setEnabled(is_writable && max_position < project_diagrams_count - 1);
|
||||
prj_move_diagram_top -> setEnabled(is_writable && min_position > 0);
|
||||
|
||||
// Adjusted to >= to allow exactly 10 or 100 steps if space permits
|
||||
prj_move_diagram_upx10 -> setEnabled(is_writable && min_position > 10);
|
||||
prj_move_diagram_upx100 -> setEnabled(is_writable && min_position > 100);
|
||||
prj_move_diagram_downx10 -> setEnabled(is_writable && max_position < project_diagrams_count - 10);
|
||||
prj_move_diagram_downx100 -> setEnabled(is_writable && max_position < project_diagrams_count - 100);
|
||||
}
|
||||
} else if (current_type == QET::TitleBlockTemplatesCollection) {
|
||||
TitleBlockTemplateLocation location = elements_panel -> templateLocationForItem(current_item);
|
||||
tbt_add -> setEnabled(!location.isReadOnly());
|
||||
@@ -475,62 +539,57 @@ void ElementsPanelWidget::filterEdited(const QString &next_text) {
|
||||
}
|
||||
|
||||
/**
|
||||
Treat key press event inside elements panel widget
|
||||
*/
|
||||
void ElementsPanelWidget::keyPressEvent (QKeyEvent *e) {
|
||||
switch(e -> key()) {
|
||||
case Qt::Key_Delete: //delete diagram through elements panel widget
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
emit(requestForDiagramDeletion(selected_diagram));
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F3:
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
elements_panel->setSelectedItem(elements_panel->getItemForDiagram(selected_diagram));
|
||||
emit(requestForDiagramMoveUp(selected_diagram));
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F4:
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
elements_panel->setSelectedItem(elements_panel->getItemForDiagram(selected_diagram));
|
||||
emit(requestForDiagramMoveDown(selected_diagram));
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F5:
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
elements_panel->setSelectedItem(elements_panel->getItemForDiagram(selected_diagram));
|
||||
emit(requestForDiagramMoveUpTop(selected_diagram));
|
||||
}
|
||||
|
||||
break;
|
||||
case Qt::Key_F6:
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
elements_panel->setSelectedItem(elements_panel->getItemForDiagram(selected_diagram));
|
||||
emit(requestForDiagramMoveDownx10(selected_diagram));
|
||||
}
|
||||
|
||||
break;
|
||||
case Qt::Key_F7:
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
elements_panel->setSelectedItem(elements_panel->getItemForDiagram(selected_diagram));
|
||||
emit(requestForDiagramMoveDownx100(selected_diagram));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case Qt::Key_F8:
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
elements_panel->setSelectedItem(elements_panel->getItemForDiagram(selected_diagram));
|
||||
emit(requestForDiagramMoveUpx10(selected_diagram));
|
||||
}
|
||||
|
||||
break;
|
||||
case Qt::Key_F9:
|
||||
if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) {
|
||||
elements_panel->setSelectedItem(elements_panel->getItemForDiagram(selected_diagram));
|
||||
emit(requestForDiagramMoveUpx100(selected_diagram));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
* Treat key press event inside elements panel widget
|
||||
*/
|
||||
/**
|
||||
* Treat key press event inside elements panel widget.
|
||||
* Respects the enabled/disabled state of the corresponding QActions.
|
||||
*/
|
||||
void ElementsPanelWidget::keyPressEvent(QKeyEvent *e) {
|
||||
switch(e->key()) {
|
||||
case Qt::Key_Delete:
|
||||
if (prj_del_diagram && prj_del_diagram->isEnabled()) {
|
||||
deleteDiagram();
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F3:
|
||||
if (prj_move_diagram_up && prj_move_diagram_up->isEnabled()) {
|
||||
moveDiagramUp();
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F4:
|
||||
if (prj_move_diagram_down && prj_move_diagram_down->isEnabled()) {
|
||||
moveDiagramDown();
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F5:
|
||||
if (prj_move_diagram_top && prj_move_diagram_top->isEnabled()) {
|
||||
moveDiagramUpTop();
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F6:
|
||||
if (prj_move_diagram_downx10 && prj_move_diagram_downx10->isEnabled()) {
|
||||
moveDiagramDownx10();
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F7:
|
||||
if (prj_move_diagram_downx100 && prj_move_diagram_downx100->isEnabled()) {
|
||||
moveDiagramDownx100();
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F8:
|
||||
if (prj_move_diagram_upx10 && prj_move_diagram_upx10->isEnabled()) {
|
||||
moveDiagramUpx10();
|
||||
}
|
||||
break;
|
||||
case Qt::Key_F9:
|
||||
if (prj_move_diagram_upx100 && prj_move_diagram_upx100->isEnabled()) {
|
||||
moveDiagramUpx100();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Pass unhandled key events to the base class
|
||||
QWidget::keyPressEvent(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,13 +69,14 @@ class ElementsPanelWidget : public QWidget {
|
||||
void requestForProjectPropertiesEdition(QETProject *);
|
||||
void requestForDiagramPropertiesEdition(Diagram *);
|
||||
void requestForDiagramDeletion(Diagram *);
|
||||
void requestForDiagramMoveUp(Diagram *);
|
||||
void requestForDiagramMoveDown(Diagram *);
|
||||
void requestForDiagramMoveUpTop(Diagram *);
|
||||
void requestForDiagramMoveUpx10(Diagram *);
|
||||
void requestForDiagramMoveUpx100(Diagram *);
|
||||
void requestForDiagramMoveDownx10(Diagram *);
|
||||
void requestForDiagramMoveDownx100(Diagram *);
|
||||
void requestForDiagramsDeletion(const QList<Diagram *> &diagrams);
|
||||
void requestForDiagramMoveUp(const QList<Diagram *> &diagrams);
|
||||
void requestForDiagramMoveDown(const QList<Diagram *> &diagrams);
|
||||
void requestForDiagramMoveUpTop(const QList<Diagram *> &diagrams);
|
||||
void requestForDiagramMoveUpx10(const QList<Diagram *> &diagrams);
|
||||
void requestForDiagramMoveUpx100(const QList<Diagram *> &diagrams);
|
||||
void requestForDiagramMoveDownx10(const QList<Diagram *> &diagrams);
|
||||
void requestForDiagramMoveDownx100(const QList<Diagram *> &diagrams);
|
||||
|
||||
public slots:
|
||||
void openDirectoryForSelectedItem();
|
||||
|
||||
@@ -567,14 +567,7 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
|
||||
pen.setCapStyle(Qt::SquareCap);
|
||||
|
||||
//Get the couples style/value
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||
const QStringList styles = dom.attribute("style").split(";", QString::SkipEmptyParts);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||
#endif
|
||||
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
QRegularExpression rx("^(?<name>[a-z-]+):(?<value>[a-zA-Z-]+)$");
|
||||
if (!rx.isValid())
|
||||
|
||||
@@ -188,10 +188,8 @@ void MachineInfo::send_info_to_debug()
|
||||
QDirIterator it1(QETApp::commonElementsDir().toLatin1(),nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
||||
while (it1.hasNext())
|
||||
{
|
||||
if(it1.next() > 0 )
|
||||
{
|
||||
it1.next();
|
||||
commomElementsDir ++;
|
||||
}
|
||||
}
|
||||
qInfo()<< " Common Elements count:"<< commomElementsDir << "Elements";
|
||||
|
||||
@@ -200,10 +198,8 @@ void MachineInfo::send_info_to_debug()
|
||||
QDirIterator it2(QETApp::customElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
||||
while (it2.hasNext())
|
||||
{
|
||||
if(it2.next() > 0 )
|
||||
{
|
||||
it2.next();
|
||||
customElementsDir ++;
|
||||
}
|
||||
}
|
||||
qInfo()<< " Custom Elements count:"<< customElementsDir << "Elements";
|
||||
|
||||
@@ -211,10 +207,8 @@ void MachineInfo::send_info_to_debug()
|
||||
QDirIterator it3(QETApp::companyElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
||||
while (it3.hasNext())
|
||||
{
|
||||
if(it3.next() > 0 )
|
||||
{
|
||||
it3.next();
|
||||
companyElementsDir ++;
|
||||
}
|
||||
}
|
||||
qInfo()<< " Company Elements count:"<< companyElementsDir << "Elements";
|
||||
|
||||
|
||||
@@ -174,24 +174,9 @@ int main(int argc, char **argv)
|
||||
QCoreApplication::setApplicationName("QElectroTech");
|
||||
//Creation and execution of the application
|
||||
//HighDPI
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5, 7, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
qputenv("QT_ENABLE_HIGHDPI_SCALING", "1");
|
||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy());
|
||||
#endif
|
||||
qputenv("QT_ENABLE_HIGHDPI_SCALING", "1");
|
||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFactorRoundingPolicy());
|
||||
|
||||
|
||||
SingleApplication app(argc, argv, true);
|
||||
|
||||
@@ -190,25 +190,28 @@ ProjectPrintWindow::~ProjectPrintWindow()
|
||||
*/
|
||||
void ProjectPrintWindow::requestPaint()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "--";
|
||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << m_printer->resolution();
|
||||
qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber();
|
||||
#endif
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
#ifdef Q_OS_WIN
|
||||
auto screen = this->screen();
|
||||
if(screen)
|
||||
{
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "--";
|
||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << m_printer->resolution();
|
||||
qDebug() << "DiagramPrintDialog::print screennumber " << screen->name();
|
||||
#endif
|
||||
|
||||
QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber());
|
||||
qreal dotsPerInch = (qreal)srn->logicalDotsPerInch();
|
||||
m_printer->setResolution(dotsPerInch);
|
||||
qreal dotsPerInch = (qreal)screen->logicalDotsPerInch();
|
||||
m_printer->setResolution(dotsPerInch);
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch;
|
||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << m_printer->resolution();
|
||||
qDebug() << "--";
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch;
|
||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << m_printer->resolution();
|
||||
qDebug() << "--";
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!m_project->diagrams().count()) {
|
||||
return;
|
||||
@@ -265,9 +268,9 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
auto printed_rect = full_page ? printer->paperRect(QPrinter::Millimeter) :
|
||||
printer->pageRect(QPrinter::Millimeter);
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
auto printed_rect = full_page ? printer->paperRect(QPrinter::Millimeter) :
|
||||
printer->pageRect(QPrinter::Millimeter);
|
||||
#endif
|
||||
auto used_width = printed_rect.width();
|
||||
auto used_height = printed_rect.height();
|
||||
@@ -341,7 +344,7 @@ QRect ProjectPrintWindow::diagramRect(Diagram *diagram, const ExportProperties &
|
||||
diagram_rect.setHeight(diagram_rect.height() - titleblock_height);
|
||||
}
|
||||
|
||||
//Adjust the border of diagram to 1px (width of the line)
|
||||
//Adjust the border of diagram to 1px (width of the line)
|
||||
diagram_rect.adjust(0,0,1,1);
|
||||
|
||||
return (diagram_rect.toAlignedRect());
|
||||
@@ -356,7 +359,7 @@ QRect ProjectPrintWindow::diagramRect(Diagram *diagram, const ExportProperties &
|
||||
* with the orientation and the paper format used by the actual printer
|
||||
*/
|
||||
int ProjectPrintWindow::horizontalPagesCount(
|
||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||
{
|
||||
QRect printable_area;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||
@@ -385,7 +388,7 @@ int ProjectPrintWindow::horizontalPagesCount(
|
||||
* with the orientation and paper format used by the actual printer
|
||||
*/
|
||||
int ProjectPrintWindow::verticalPagesCount(
|
||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||
{
|
||||
QRect printable_area;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
||||
@@ -511,7 +514,7 @@ void ProjectPrintWindow::loadPageSetupForCurrentPrinter()
|
||||
QString value = settings.value("orientation", "landscape").toString();
|
||||
m_printer->setPageOrientation(
|
||||
value == "landscape" ? QPageLayout::Landscape :
|
||||
QPageLayout::Portrait);
|
||||
QPageLayout::Portrait);
|
||||
}
|
||||
if (settings.contains("papersize"))
|
||||
{
|
||||
@@ -780,9 +783,9 @@ void ProjectPrintWindow::print()
|
||||
void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
|
||||
{
|
||||
auto index = ui->m_date_from_cb->currentIndex();
|
||||
// 0 = all date
|
||||
// 1 = from the date
|
||||
// 2 = at the date
|
||||
// 0 = all date
|
||||
// 1 = from the date
|
||||
// 2 = at the date
|
||||
|
||||
if (index) { on_m_uncheck_all_clicked(); }
|
||||
else { on_m_check_all_pb_clicked(); }
|
||||
@@ -792,7 +795,7 @@ void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
|
||||
{
|
||||
auto diagram_date = diagram->border_and_titleblock.date();
|
||||
if ( (index == 1 && diagram_date >= date) ||
|
||||
(index == 2 && diagram_date == date) )
|
||||
(index == 2 && diagram_date == date) )
|
||||
m_diagram_list_hash.value(diagram)->setChecked(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -364,11 +364,12 @@ QETResult ProjectView::noProjectResult() const
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ProjectView::removeDiagram
|
||||
Remove a diagram (folio) of the project
|
||||
@param diagram_view : diagram view to remove
|
||||
*/
|
||||
void ProjectView::removeDiagram(DiagramView *diagram_view)
|
||||
* @brief ProjectView::removeDiagram
|
||||
* Remove a diagram (folio) of the project
|
||||
* @param diagram_view : diagram view to remove
|
||||
* @param silent : if true, bypasses the confirmation message box
|
||||
*/
|
||||
void ProjectView::removeDiagram(DiagramView *diagram_view, bool silent)
|
||||
{
|
||||
if (!diagram_view)
|
||||
return;
|
||||
@@ -377,17 +378,18 @@ void ProjectView::removeDiagram(DiagramView *diagram_view)
|
||||
if (!m_diagram_ids.values().contains(diagram_view))
|
||||
return;
|
||||
|
||||
|
||||
//Ask confirmation to user.
|
||||
int answer = QET::QetMessageBox::question(
|
||||
this,
|
||||
tr("Supprimer le folio ?", "message box title"),
|
||||
tr("Êtes-vous sûr de vouloir supprimer ce folio du projet ? Ce changement est irréversible.", "message box content"),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
|
||||
QMessageBox::No
|
||||
);
|
||||
if (answer != QMessageBox::Yes) {
|
||||
return;
|
||||
if (!silent) {
|
||||
//Ask confirmation to user.
|
||||
int answer = QET::QetMessageBox::question(
|
||||
this,
|
||||
tr("Supprimer le folio ?", "message box title"),
|
||||
tr("Êtes-vous sûr de vouloir supprimer ce folio du projet ? Ce changement est irréversible.", "message box content"),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
|
||||
QMessageBox::No
|
||||
);
|
||||
if (answer != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Remove the diagram view of the tabs widget
|
||||
@@ -405,14 +407,15 @@ void ProjectView::removeDiagram(DiagramView *diagram_view)
|
||||
}
|
||||
|
||||
/**
|
||||
Enleve un schema du ProjectView
|
||||
@param diagram Schema a enlever
|
||||
*/
|
||||
void ProjectView::removeDiagram(Diagram *diagram) {
|
||||
* Enleve un schema du ProjectView
|
||||
* @param diagram Schema a enlever
|
||||
* @param silent Si vrai, supprime sans demander confirmation
|
||||
*/
|
||||
void ProjectView::removeDiagram(Diagram *diagram, bool silent) {
|
||||
if (!diagram) return;
|
||||
|
||||
if (DiagramView *diagram_view = findDiagram(diagram)) {
|
||||
removeDiagram(diagram_view);
|
||||
removeDiagram(diagram_view, silent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,6 +560,56 @@ void ProjectView::moveDiagramUpx10(Diagram *diagram) {
|
||||
moveDiagramUpx10(findDiagram(diagram));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectView::moveDiagramUpx100
|
||||
* Moves the diagram_view up / left x100
|
||||
* @param diagram_view View to move
|
||||
*/
|
||||
void ProjectView::moveDiagramUpx100(DiagramView *diagram_view) {
|
||||
if (!diagram_view) return;
|
||||
|
||||
int diagram_view_position = m_diagram_ids.key(diagram_view);
|
||||
if (!diagram_view_position) {
|
||||
// The diagram is the first of the project
|
||||
return;
|
||||
}
|
||||
m_tab->tabBar()->moveTab(diagram_view_position, diagram_view_position - 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectView::moveDiagramUpx100
|
||||
* Moves the diagram up / left x100
|
||||
* @param diagram Diagram to move
|
||||
*/
|
||||
void ProjectView::moveDiagramUpx100(Diagram *diagram) {
|
||||
moveDiagramUpx100(findDiagram(diagram));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectView::moveDiagramDownx100
|
||||
* Moves the diagram_view down / right x100
|
||||
* @param diagram_view View to move
|
||||
*/
|
||||
void ProjectView::moveDiagramDownx100(DiagramView *diagram_view) {
|
||||
if (!diagram_view) return;
|
||||
|
||||
int diagram_view_position = m_diagram_ids.key(diagram_view);
|
||||
if (diagram_view_position + 1 == m_diagram_ids.count()) {
|
||||
// The diagram is the last of the project
|
||||
return;
|
||||
}
|
||||
m_tab->tabBar()->moveTab(diagram_view_position, diagram_view_position + 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ProjectView::moveDiagramDownx100
|
||||
* Moves the diagram down / right x100
|
||||
* @param diagram Diagram to move
|
||||
*/
|
||||
void ProjectView::moveDiagramDownx100(Diagram *diagram) {
|
||||
moveDiagramDownx100(findDiagram(diagram));
|
||||
}
|
||||
|
||||
/**
|
||||
Deplace le schema diagram_view vers le bas / la droite x10
|
||||
*/
|
||||
|
||||
@@ -104,8 +104,8 @@ class ProjectView : public QWidget
|
||||
void changeLastTab();
|
||||
|
||||
public slots:
|
||||
void removeDiagram(DiagramView *);
|
||||
void removeDiagram(Diagram *);
|
||||
void removeDiagram(DiagramView *diagram_view, bool silent = false);
|
||||
void removeDiagram(Diagram *diagram, bool silent = false);
|
||||
void showDiagram(DiagramView *);
|
||||
void showDiagram(Diagram *);
|
||||
void editProjectProperties();
|
||||
@@ -122,6 +122,10 @@ class ProjectView : public QWidget
|
||||
void moveDiagramUpx10(Diagram *);
|
||||
void moveDiagramDownx10(DiagramView *);
|
||||
void moveDiagramDownx10(Diagram *);
|
||||
void moveDiagramUpx100(DiagramView *);
|
||||
void moveDiagramUpx100(Diagram *);
|
||||
void moveDiagramDownx100(DiagramView *);
|
||||
void moveDiagramDownx100(Diagram *);
|
||||
void exportProject();
|
||||
QETResult save();
|
||||
QETResult saveAs();
|
||||
|
||||
@@ -45,14 +45,26 @@ QDomElement ElementData::toXml(QDomDocument &xml_element) const {
|
||||
bool ElementData::fromXml(const QDomElement &xml_element)
|
||||
{
|
||||
if(xml_element.tagName() != QLatin1String("definition") ||
|
||||
xml_element.attribute(QStringLiteral("type")) != QLatin1String("element")) {
|
||||
xml_element.attribute(QStringLiteral("type")) != QLatin1String("element")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// --- HIER STARTET UNSER DEBUG-BLOCK ---
|
||||
// Wir holen den String aus der XML und speichern ihn kurz zwischen
|
||||
QString raw_type_string = xml_element.attribute(QStringLiteral("link_type"), QStringLiteral("simple"));
|
||||
|
||||
qDebug() << "\n=== NEUES BAUTEIL WIRD GELADEN ===";
|
||||
qDebug() << "[XML Parser] Roher 'link_type' String aus der .elmt Datei:" << raw_type_string;
|
||||
|
||||
// Jetzt übergeben wir ihn an deine Übersetzungs-Funktion
|
||||
m_type = typeFromString(raw_type_string);
|
||||
|
||||
qDebug() << "[XML Parser] Übersetzter ElementData-Typ:" << typeToString(m_type);
|
||||
// --- HIER ENDET UNSER DEBUG-BLOCK ---
|
||||
|
||||
m_type = typeFromString(xml_element.attribute(QStringLiteral("link_type"), QStringLiteral("simple")));
|
||||
kindInfoFromXml(xml_element);
|
||||
m_informations.fromXml(xml_element.firstChildElement(QStringLiteral("elementInformations")),
|
||||
QStringLiteral("elementInformation"));
|
||||
QStringLiteral("elementInformation"));
|
||||
m_names_list.fromXml(xml_element);
|
||||
|
||||
auto xml_draw_info = xml_element.firstChildElement(QStringLiteral("informations"));
|
||||
@@ -323,6 +335,8 @@ QString ElementData::typeToString(ElementData::Type type)
|
||||
return QStringLiteral("terminal");
|
||||
case ElementData::Thumbnail:
|
||||
return QStringLiteral("thumbnail");
|
||||
case ElementData::ConductorDefinition:
|
||||
return QStringLiteral("conductor_definition");
|
||||
default:
|
||||
qDebug() << "ElementData::typeToString : type don't exist"
|
||||
<< "return failsafe value 'simple'";
|
||||
@@ -346,6 +360,8 @@ ElementData::Type ElementData::typeFromString(const QString &string)
|
||||
return ElementData::Terminal;
|
||||
} else if (string == QLatin1String("thumbnail")) {
|
||||
return ElementData::Thumbnail;
|
||||
} else if (string == QLatin1String("conductor_definition")) {
|
||||
return ElementData::ConductorDefinition;
|
||||
}
|
||||
|
||||
//Return simple if nothing match
|
||||
|
||||
@@ -41,7 +41,8 @@ class ElementData : public PropertiesInterface
|
||||
Master = 8,
|
||||
Slave = 16,
|
||||
Terminal = 32,
|
||||
Thumbnail = 64};
|
||||
Thumbnail = 64,
|
||||
ConductorDefinition = 128};
|
||||
Q_ENUM(Type)
|
||||
Q_DECLARE_FLAGS(Types, Type)
|
||||
|
||||
|
||||