mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-05 18:54:14 +02:00
Compare commits
144 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 99ad9aa459 | |||
| c1c72c5a62 | |||
| eeabea10f0 | |||
| e034cfe9cf | |||
| 2db6c3968a | |||
| 14253930ae | |||
| ec0a9f45d3 | |||
| 1121ccea26 | |||
| 94cc9cfef5 | |||
| 346aad75fd | |||
| 2b8cdd3d67 | |||
| be008fb5f6 | |||
| 82cd4d359a | |||
| 6dca56f823 | |||
| 545006bed2 | |||
| dcec0bf7ff | |||
| 7a97e873d9 | |||
| e6124e941a | |||
| d0cea474a6 | |||
| 3c8ba1b1ca | |||
| e19f523227 | |||
| 5dac26d9c7 | |||
| e7873b40d5 | |||
| cd6c66c3c6 | |||
| ef04497ca6 | |||
| 58000283e6 | |||
| 73b96dd1b8 | |||
| 682c6a0ccb | |||
| d3cf8f2635 | |||
| 6aa14a7536 | |||
| 6ce688a709 | |||
| 28357b0f55 | |||
| e21f49d2cf | |||
| 2a115e4381 | |||
| bab32b3764 | |||
| 5cc2e165bf | |||
| 1c764babd1 | |||
| 8d76354647 | |||
| 31edf30c61 | |||
| f55ba568f6 | |||
| 1410e70d13 | |||
| 7669a95694 | |||
| ee53f20303 | |||
| df5f622418 | |||
| 71ff7f925d | |||
| 2fdc07b81b | |||
| 32bb247d68 | |||
| c586a2d3a3 | |||
| f301196f61 | |||
| f2d297b0d8 | |||
| a8e2a7acff | |||
| 53096fa3be | |||
| bf4d3353ae | |||
| 2e4fa9ae02 | |||
| cd0ae76141 | |||
| bd37f12edc | |||
| b873b05245 | |||
| eb02e1dce0 | |||
| ac1e8b3502 | |||
| 215962873b | |||
| 0555cd9045 | |||
| 02cc4f043b | |||
| 8791d2d202 | |||
| 4625964bb1 | |||
| 7a80ce40b7 | |||
| 342ac3626d | |||
| 19a75186b7 | |||
| 9122f5d687 | |||
| 482fd32dc2 | |||
| 4e0c075575 | |||
| ae42198882 | |||
| a666d2d0ae | |||
| 15e7d39243 | |||
| 5574b4d3e9 | |||
| 918db632ed | |||
| f465b33e2b | |||
| 492528136e | |||
| 564a0e64a4 | |||
| 7f5a42a055 | |||
| 14d4aa772b | |||
| 81419bd27d | |||
| ebefc269af | |||
| c6bfd46981 | |||
| 998c5e8a0d | |||
| ae382f6b12 | |||
| d4061d17fa | |||
| fb8c86ec12 | |||
| d62479e6e4 | |||
| 1a4bb91285 | |||
| aa96d5e7df | |||
| e63c303078 | |||
| a8e408ad39 | |||
| 0eb3e1e436 | |||
| ba6320bff8 | |||
| 86b5d7ac95 | |||
| 19e99aab02 | |||
| 44f0abbb56 | |||
| e7787daa2c | |||
| c7fd3416f6 | |||
| b782a1612a | |||
| 2fdbc3c243 | |||
| a219c3f587 | |||
| 6b3b55b0e1 | |||
| 36d0121038 | |||
| 8235ecdbc9 | |||
| b6e4cd4786 | |||
| fb35027624 | |||
| 08a441d1f6 | |||
| e9840728b4 | |||
| ffbcd12d9b | |||
| 0a124f6695 | |||
| 3f6f99b50f | |||
| 42b64a7f0a | |||
| 361719ca74 | |||
| 181e2b555d | |||
| 420512595d | |||
| 9b4bed361d | |||
| 339bc8700b | |||
| 87d5ae5580 | |||
| 1070179617 | |||
| 6c4711a8d0 | |||
| 8a8a338a2e | |||
| 407cc7a4c2 | |||
| 5cb8930732 | |||
| a24acfac24 | |||
| 8b0b1d10d4 | |||
| 57dfa28674 | |||
| 3848c7821a | |||
| 1572c23d51 | |||
| e234f063f8 | |||
| be21604ad0 | |||
| e1ccc1e568 | |||
| e202b5bc2b | |||
| 2b7e62f901 | |||
| 23e8258ae1 | |||
| 457d265f0a | |||
| cd76b6a1d6 | |||
| b522a94556 | |||
| 399bc0e897 | |||
| de9eeed542 | |||
| c071e92c58 | |||
| d22e4abf96 | |||
| 38b91e8083 | |||
| 19704cf5ca |
@@ -1,112 +0,0 @@
|
||||
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)"
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
@@ -44,7 +44,7 @@ jobs:
|
||||
mingw-w64-ucrt-x86_64-angleproject
|
||||
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: C:\Users\runneradmin\AppData\Local\ccache
|
||||
key: ccache-windows-${{ github.ref_name }}-${{ github.sha }}
|
||||
@@ -306,7 +306,7 @@ jobs:
|
||||
|
||||
- name: Upload build logs on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: build-logs
|
||||
path: |
|
||||
@@ -334,21 +334,21 @@ jobs:
|
||||
"zip_name=$zipName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
|
||||
- name: Upload portable (files/ without installer)
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: qelectrotech-${{ steps.qet_version.outputs.base_version }}+git${{ steps.qet_version.outputs.head }}-x86-win64-readytouse
|
||||
path: dist/${{ steps.zip_portable.outputs.zip_name }}
|
||||
retention-days: 14
|
||||
|
||||
- name: Upload NSIS installer
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: qelectrotech-windows-installer
|
||||
path: dist/Installer_*.exe
|
||||
retention-days: 14
|
||||
|
||||
- name: Upload portable (nom fixe pour le workflow MSI)
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: qelectrotech-windows-portable
|
||||
path: nsis_root/files/
|
||||
@@ -367,7 +367,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout master (for build-aux scripts)
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
ref: master
|
||||
path: source
|
||||
@@ -375,13 +375,13 @@ jobs:
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Download installer artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: qelectrotech-windows-installer
|
||||
path: downloaded/installer/
|
||||
|
||||
- name: Download portable artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
pattern: qelectrotech-*-readytouse
|
||||
path: downloaded/portable/
|
||||
@@ -402,7 +402,7 @@ jobs:
|
||||
echo "Old .exe and .zip assets deleted."
|
||||
|
||||
- name: Update nightly release
|
||||
uses: softprops/action-gh-release@v2
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
tag_name: nightly
|
||||
name: "Nightly Build – Windows"
|
||||
|
||||
@@ -18,7 +18,6 @@ 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' ||
|
||||
@@ -27,26 +26,29 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
id-token: write
|
||||
id-token: write # Required by SignPath
|
||||
|
||||
steps:
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 1. Checkout (to retrieve QElectroTech.wxs and sources)
|
||||
# ----------------------------------------------------------------
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 2. Download the portable artifact from the main build
|
||||
# Requires windows-build.yml to upload an artifact named
|
||||
# "qelectrotech-windows-portable" (fixed name)
|
||||
# ----------------------------------------------------------------
|
||||
- name: Download portable artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: qelectrotech-windows-portable
|
||||
path: artifact\files
|
||||
# workflow_run => use the triggering run's ID
|
||||
# workflow_dispatch => use input run_id if provided, otherwise current run
|
||||
run-id: ${{ github.event.workflow_run.id || github.event.inputs.run_id || github.run_id }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repository: ${{ github.repository }}
|
||||
@@ -58,10 +60,12 @@ jobs:
|
||||
id: version
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Version from qetversion.cpp (same logic as windows-build.yml)
|
||||
$src = Get-Content "sources\qetversion.cpp" -Raw -ErrorAction SilentlyContinue
|
||||
if ($src -match 'return QVersionNumber\{([^}]+)\}') {
|
||||
$ver = $Matches[1] -replace '\s','' -replace ',','.'
|
||||
} else {
|
||||
# Fallback: CMakeLists.txt
|
||||
$cmake = Get-Content "CMakeLists.txt" -Raw
|
||||
if ($cmake -match 'project\s*\([^)]*VERSION\s+([\d]+\.[\d]+\.[\d]+)') {
|
||||
$ver = $Matches[1]
|
||||
@@ -69,42 +73,56 @@ jobs:
|
||||
$ver = "0.0.0"
|
||||
}
|
||||
}
|
||||
$verMsi = "$ver.0"
|
||||
|
||||
# Short SHA for the display version
|
||||
$sha = git rev-parse --short HEAD 2>$null
|
||||
if (-not $sha) { $sha = "unknown" }
|
||||
|
||||
# Cumulative revision number (same calculation as windows-build.yml)
|
||||
$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
|
||||
# MSI Version only compares Major.Minor.Build (the 4th field is
|
||||
# ignored by Windows Installer for upgrade detection), so we
|
||||
# inject rev into Build to force a real increase between
|
||||
# nightlies and trigger MajorUpgrade's automatic uninstall.
|
||||
$verParts = $ver -split '\.'
|
||||
$verMsi = "$($verParts[0]).$($verParts[1]).$($rev % 65535)"
|
||||
|
||||
$verDisplay = "${ver}-r${rev}-${sha}_x86_64-win64"
|
||||
|
||||
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
|
||||
# All done in one step: PATH is updated within the same step
|
||||
# so wix is immediately available for eula and extension commands
|
||||
# ----------------------------------------------------------------
|
||||
- name: Install WiX v7
|
||||
shell: pwsh
|
||||
run: |
|
||||
dotnet tool install --global wix --version 7.0.0
|
||||
|
||||
# Update PATH immediately for the rest of this step
|
||||
$toolsPath = [System.IO.Path]::Combine($env:USERPROFILE, '.dotnet', 'tools')
|
||||
$env:PATH = "$toolsPath;$env:PATH"
|
||||
|
||||
# Also export for subsequent steps
|
||||
echo $toolsPath >> $env:GITHUB_PATH
|
||||
|
||||
# Accept OSMF EULA (official CI/CD method: writes a sentinel file)
|
||||
wix eula accept wix7
|
||||
|
||||
# Install WixUI extension
|
||||
wix extension add WixToolset.UI.wixext/7.0.0
|
||||
|
||||
# Install WixUtil extension (required for custom actions: Binary:Wix4UtilCA_*)
|
||||
wix extension add WixToolset.Util.wixext/7.0.0
|
||||
Write-Host "WiX v7 installed, EULA accepted, UI extension added."
|
||||
|
||||
Write-Host "WiX v7 installed, EULA accepted, UI + Util extensions added."
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 5. Check that the WXS file exists in the repository
|
||||
@@ -115,6 +133,8 @@ jobs:
|
||||
$wxs = "build-aux\windows\QElectroTech.wxs"
|
||||
if (-not (Test-Path $wxs)) {
|
||||
Write-Error "WXS file not found: $wxs"
|
||||
Write-Host "Contents of build-aux\windows\ :"
|
||||
Get-ChildItem "build-aux\windows\" -ErrorAction SilentlyContinue
|
||||
exit 1
|
||||
}
|
||||
Write-Host "WXS found: $wxs"
|
||||
@@ -129,8 +149,10 @@ jobs:
|
||||
Get-ChildItem -Path "artifact\files" -Depth 2 |
|
||||
Select-Object FullName | Format-Table -AutoSize
|
||||
|
||||
# Search for qelectrotech.exe in the artifact
|
||||
$exe = Get-ChildItem -Path "artifact\files" -Filter "qelectrotech.exe" -Recurse | Select-Object -First 1
|
||||
if (-not $exe) {
|
||||
# Also try QElectroTech.exe (capital Q)
|
||||
$exe = Get-ChildItem -Path "artifact\files" -Filter "QElectroTech.exe" -Recurse | Select-Object -First 1
|
||||
}
|
||||
if (-not $exe) {
|
||||
@@ -138,30 +160,40 @@ jobs:
|
||||
exit 1
|
||||
}
|
||||
Write-Host "Executable: $($exe.FullName) ($([math]::Round($exe.Length/1MB,1)) MB)"
|
||||
$binDir = $exe.Directory.FullName
|
||||
$filesDir = Split-Path $binDir -Parent
|
||||
|
||||
# FilesDir = folder containing bin\
|
||||
$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
|
||||
# RTF is the only format accepted by Windows Installer.
|
||||
# The conversion wraps plain text lines in basic RTF markup.
|
||||
# ----------------------------------------------------------------
|
||||
- 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 header — Courier New, 9pt, black
|
||||
$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) {
|
||||
# Escape RTF special characters
|
||||
$escaped = $line `
|
||||
-replace '\\', '\\\\' `
|
||||
-replace '\{', '\{' `
|
||||
@@ -169,30 +201,29 @@ jobs:
|
||||
[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.
|
||||
# 8. Replace Lancer QET.bat with the MSI-specific version
|
||||
# The portable version uses relative paths suited for the zip.
|
||||
# The MSI version uses %~dp0 to resolve paths relative to
|
||||
# the installation directory in Program Files.
|
||||
# ----------------------------------------------------------------
|
||||
- name: Remove Lancer QET.bat from artifact
|
||||
- name: Replace Lancer QET.bat for MSI
|
||||
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)."
|
||||
}
|
||||
$bat = "$env:FILES_DIR\Lancer QET.bat"
|
||||
$content = "@echo off`r`nstart `"`" `"%~dp0bin\qelectrotech.exe`" --common-elements-dir=`"%~dp0elements/`" --common-tbt-dir=`"%~dp0titleblocks/`" --lang-dir=`"%~dp0lang/`" -style windowsvista`r`n"
|
||||
[System.IO.File]::WriteAllText($bat, $content, [System.Text.Encoding]::ASCII)
|
||||
Write-Host "Lancer QET.bat replaced for MSI installation."
|
||||
Write-Host "=== Content of new Lancer QET.bat ==="
|
||||
Get-Content $bat
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 9. Build the MSI
|
||||
# 9. Build the MSI (unsigned)
|
||||
# ----------------------------------------------------------------
|
||||
- name: Build MSI
|
||||
shell: pwsh
|
||||
@@ -204,22 +235,31 @@ jobs:
|
||||
$wxs = "build-aux\windows\QElectroTech.wxs"
|
||||
$outputName = "QElectroTech-${verDisplay}.msi"
|
||||
|
||||
# Deterministic ProductCode GUID (UUID v5) based on version.
|
||||
# Same version => same GUID (required for MSI repair/uninstall).
|
||||
# Different version => different GUID (triggers a proper upgrade).
|
||||
$seed = "qelectrotech-msi-$version"
|
||||
$sha1 = [System.Security.Cryptography.SHA1]::Create()
|
||||
$hash = $sha1.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($seed))
|
||||
$hash[6] = ($hash[6] -band 0x0F) -bor 0x50 # UUID version 5
|
||||
$hash[8] = ($hash[8] -band 0x3F) -bor 0x80 # RFC4122 variant
|
||||
$productCode = "{$([System.Guid]::new([byte[]]$hash[0..15]).ToString().ToUpper())}"
|
||||
|
||||
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 }}"
|
||||
Write-Host " WXS : $wxs"
|
||||
Write-Host " Version : $version"
|
||||
Write-Host " ProductCode : $productCode"
|
||||
Write-Host " FilesDir : $filesDir"
|
||||
Write-Host " LicenseRtf : $licRtf"
|
||||
Write-Host " Output : dist\$outputName"
|
||||
|
||||
wix build $wxs `
|
||||
-arch x64 `
|
||||
-d "Version=$version" `
|
||||
-d "ProductVersion=$verDisplay" `
|
||||
-d "ProductCode=$productGuid" `
|
||||
-d "ProductCode=$productCode" `
|
||||
-d "FilesDir=$filesDir" `
|
||||
-d "LicenseRtf=$licRtf" `
|
||||
-ext WixToolset.UI.wixext `
|
||||
@@ -230,43 +270,53 @@ jobs:
|
||||
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
|
||||
# 9b. Upload unsigned MSI as artifact (required by SignPath)
|
||||
# SignPath fetches artifacts directly from GitHub Actions,
|
||||
# so the MSI must be uploaded before the signing request.
|
||||
# We capture the artifact-id output for use by 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)"
|
||||
- name: Upload unsigned MSI artifact (pre-signing)
|
||||
id: upload_unsigned
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: qelectrotech-windows-msi-unsigned
|
||||
path: dist\*.msi
|
||||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 11. Upload the MSI artifact
|
||||
# 9c. Submit signing request to SignPath (OSS organization)
|
||||
# Prerequisites:
|
||||
# - SIGNPATH_API_TOKEN : CI user token from the OSS org
|
||||
# - SIGNPATH_ORGANIZATION_ID : Organization ID of the OSS org
|
||||
# (visible in app.signpath.io → Settings after accepting
|
||||
# the OSS invitation)
|
||||
# The action downloads the signed MSI and places it in
|
||||
# dist/ (overwriting the unsigned one).
|
||||
# ----------------------------------------------------------------
|
||||
- name: Sign MSI via SignPath
|
||||
uses: signpath/github-action-submit-signing-request@v2
|
||||
with:
|
||||
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
|
||||
organization-id: ${{ secrets.SIGNPATH_ORGANIZATION_ID }}
|
||||
project-slug: 'qelectrotech-source-mirror'
|
||||
signing-policy-slug: 'test-signing'
|
||||
artifact-configuration-slug: 'MSI'
|
||||
github-artifact-id: ${{ steps.upload_unsigned.outputs.artifact-id }}
|
||||
wait-for-completion: true
|
||||
output-artifact-directory: 'dist\'
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 10. Upload the signed MSI artifact
|
||||
# ----------------------------------------------------------------
|
||||
- name: Upload MSI artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: qelectrotech-windows-msi
|
||||
path: dist\*.msi
|
||||
@@ -284,14 +334,14 @@ jobs:
|
||||
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 "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
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
tag_name: nightly
|
||||
files: dist/*.msi
|
||||
@@ -307,21 +357,23 @@ jobs:
|
||||
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 }}"
|
||||
Write-Host "Version : ${{ steps.version.outputs.VERSION_DISPLAY }}"
|
||||
Write-Host "WiX : v7.0.0"
|
||||
Write-Host "Signing : SignPath OSS"
|
||||
Write-Host "Runner : ${{ 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) ✓"
|
||||
Write-Host "MSI : $env:MSI_NAME ($size MB) ✓"
|
||||
} else {
|
||||
Write-Host "MSI : FAILED ✗"
|
||||
Write-Host "MSI : FAILED ✗"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 13. Generate and deploy the GitHub Pages download page
|
||||
# Toutes les URLs sont connues ici (exe, zip, msi).
|
||||
# ----------------------------------------------------------------
|
||||
- name: Checkout (for generate-page.py)
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
ref: master
|
||||
path: source
|
||||
@@ -334,23 +386,31 @@ jobs:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
REPO="${{ github.repository }}"
|
||||
|
||||
# Fetch asset names from the nightly release (source of truth)
|
||||
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
|
||||
@@ -358,7 +418,7 @@ jobs:
|
||||
run: touch gh-pages/.nojekyll
|
||||
|
||||
- name: Upload GitHub Pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
uses: actions/upload-pages-artifact@v5
|
||||
with:
|
||||
path: gh-pages/
|
||||
|
||||
|
||||
+15
-4
@@ -16,7 +16,7 @@
|
||||
|
||||
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.100.1
|
||||
@@ -145,8 +145,17 @@ target_include_directories(
|
||||
${QET_DIR}/sources/dataBase/ui
|
||||
${QET_DIR}/sources/factory/ui
|
||||
${QET_DIR}/sources/print
|
||||
${QET_DIR}/sources/svg
|
||||
)
|
||||
|
||||
if(NOT BUILD_WITH_KF5)
|
||||
target_include_directories(
|
||||
${PROJECT_NAME}
|
||||
PRIVATE
|
||||
${QET_DIR}/sources/ui/nokde
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS ${PROJECT_NAME})
|
||||
|
||||
if (NOT MINGW)
|
||||
@@ -161,8 +170,10 @@ if (NOT MINGW)
|
||||
install(DIRECTORY examples DESTINATION share/qelectrotech)
|
||||
install(DIRECTORY titleblocks DESTINATION share/qelectrotech)
|
||||
install(FILES LICENSE ELEMENTS.LICENSE CREDIT README ChangeLog DESTINATION share/doc/qelectrotech)
|
||||
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})
|
||||
if(UNIX AND NOT APPLE)
|
||||
install(FILES misc/org.qelectrotech.qelectrotech.desktop DESTINATION share/applications)
|
||||
install(FILES misc/qelectrotech.xml DESTINATION ${QET_MIME_PACKAGE_PATH})
|
||||
install(FILES misc/qelectrotech.appdata.xml DESTINATION ${QET_APPDATA_PATH})
|
||||
endif()
|
||||
install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})
|
||||
endif()
|
||||
|
||||
@@ -1,5 +1,810 @@
|
||||
# QElectroTech - CHANGELOG
|
||||
|
||||
## Version 0.101 (Unreleased)
|
||||
|
||||
_Compiled from commit history since 0.100._
|
||||
|
||||
## Overview
|
||||
|
||||
Since 0.100, development has centered on a new headless command-line workflow, terminal-strip and cross-reference improvements, a wave of crash and stability fixes, and continued packaging/CI modernization (Windows MSI, macOS, Snap). Translation coverage was extended again, notably with new Korean support.
|
||||
|
||||
## Highlights / Key Features
|
||||
|
||||
- **Headless CLI export**
|
||||
- New command-line export mode for PDF, PNG and SVG, letting QET projects be rendered without opening the GUI.
|
||||
- Added `--export-bom`, `--export-nets`, `--export-links`, `--check-elements`, `--info`, `--set-titleblock` and `--resave` CLI options for scripted/batch workflows.
|
||||
- The editor grid is now disabled in CLI-rendered output, and async crash-recovery backups are disabled in headless mode to avoid a segfault.
|
||||
- **PDF export improvements**
|
||||
- Cross-references are now clickable hyperlinks in exported PDFs, jumping directly to the linked element or terminal.
|
||||
- Wiring list and wire-number list can now be exported to CSV, both from the GUI and the CLI.
|
||||
- **Diagram duplication**
|
||||
- Diagrams/folios can now be duplicated along with all their metadata and embedded elements.
|
||||
- **BOM / Nomenclature**
|
||||
- Specific elements can now be excluded from the Bill of Materials (Nomenclature).
|
||||
- **Terminal & cross-reference (Xref) work**
|
||||
- Continued iteration on a `max_slaves` limit for Master elements (added, tuned, briefly reverted, then re-implemented with proper save/load handling).
|
||||
- New "potential isolation" option for terminals, and new No/Nc/Common contact types for switch (SW) terminals.
|
||||
- Cross-reference items gained an option to hide terminal names, fixed terminal-name sorting for power contacts, and fixed a couple of SIGSEGV crashes (including one when dropping a power NC contact on the diagram).
|
||||
- **Windows installer**
|
||||
- MSI nightlies now inject the Git revision count into the MSI version's Build field, fixing the long-standing regression where `MajorUpgrade` never triggered because the version string never changed — nightlies had to be uninstalled by hand before.
|
||||
- The old `Lancer QET.bat` wrapper was removed in favor of handling launch natively in `QElectroTech.wxs`.
|
||||
- NSIS installer updated to the 3.x line, with a bundled Fonts directory and corrected language tables.
|
||||
|
||||
## Detailed Changes
|
||||
|
||||
### Editor & UX
|
||||
|
||||
- Element panel and context-menu/link-button logic refactored for clarity; `MasterElement::isFull` and related conditional checks simplified.
|
||||
- Font-size spin boxes in the text editor now enforce a 4pt minimum, fixing a SIGSEGV that occurred when the value reached 0.
|
||||
- Text position (`PartText`) now stays stable across save/reopen when the font changes.
|
||||
- Element editor: no more spurious warning on save for front-view elements without terminals; "Save As" field is now correctly labelled as a file name rather than an element name.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fixed a Unicode-path bug in pugixml on Windows: collection or element paths containing accented characters (é, ü, ñ, …) silently failed to load because the narrow-char API was used instead of the wide-char one.
|
||||
- Fixed center-alignment not being restored when reloading a saved table configuration (config serialised `AlignHCenter`, but the loader compared against `AlignCenter`).
|
||||
- Fixed a `TerminalData` memory leak in the `Terminal` destructor (confirmed via ASan across several call sites).
|
||||
- Fixed several uninitialised-value bugs found with Valgrind, and a couple of thread-unsafe `QStandardPaths` calls in the data/config directory lookup.
|
||||
- Fixed a crash when destroying a `QETProject` before its asynchronous backup had finished.
|
||||
- Fixed regional system locale sometimes loading the wrong translation.
|
||||
- Fixed dynamic element text shifting/jumping when duplicating diagrams, and a wiring-list filter/timing issue.
|
||||
- Various smaller fixes: a first-click spurious element move right after selecting a tool, an -Wreorder compiler warning, and several translation corrections (German, French, Chinese).
|
||||
|
||||
### macOS
|
||||
|
||||
- Fixed the long-standing bug (open since 2022) where double-clicking a `.qet`, `.elmt` or `.titleblock` file launched the app without opening the file — the file-open event is now buffered during a cold launch, before `QETApp` exists, and routed correctly once the app is already running.
|
||||
- Continued work on the black-screen-after-PDF-export regression on Apple Silicon, tied to the Metal compositor's async timing.
|
||||
|
||||
### Build, Packaging & CI
|
||||
|
||||
- Windows nightly build pipeline continued its migration to GitHub Actions; test builds for the VS2026 toolchain were run against the same pipeline.
|
||||
- Snap package now stages `libxcb-cursor0`, fixing an xcb plugin load failure on Ubuntu 24.04.
|
||||
- CMake install rules for Linux-only targets are now correctly guarded against macOS.
|
||||
- `qet-tb-generator` in the Snap build is now pinned to a fixed upstream tag instead of floating.
|
||||
|
||||
### Internationalization & Translations
|
||||
|
||||
- Expanded Korean (ko) support: UI strings, comments, generic names, installer language strings, translator credits and a new Korean man page.
|
||||
- Additional updates to German, French, Chinese (zh), and other translation files, including strings related to the new duplicate-diagram and macro features.
|
||||
|
||||
## Developer & Contributor Notes
|
||||
|
||||
- Terminal strip and element data model continued to evolve incrementally (multiple passes on `max_slaves` handling, access modifiers, and storage), reflecting ongoing refinement of the terminal editor introduced in 0.100.
|
||||
- PDF link handling was factored out into a shared `pdf_links.{cpp,h}` helper, reused by both the interactive export and the new CLI export path.
|
||||
|
||||
## Upgrade / Migration Notes
|
||||
|
||||
- No project file format changes are expected to break compatibility with 0.100 projects.
|
||||
- Users relying on Windows nightlies should note that upgrades will now uninstall the previous nightly automatically, instead of requiring a manual uninstall first.
|
||||
|
||||
## How to get help / report bugs
|
||||
|
||||
- Use the project issue tracker to report regressions or new bugs, with detailed reproduction steps and example `.qet` files where possible.
|
||||
- Include the output of Help → About (application version and Git revision) when reporting build/packaging issues.
|
||||
|
||||
|
||||
|
||||
## Version 0.100
|
||||
|
||||
_Compiled from provided commit logs and contributor notes._
|
||||
|
||||
## Overview
|
||||
|
||||
This release (v0.100) collects a large set of new features, UI and editor improvements, element and symbol updates, build and packaging fixes, dependency upgrades, translations, and a broad set of bug fixes and stability improvements. It is intended as a stable, feature-rich stepping stone toward the next major workflows for symbol editing, terminal/strip handling and export improvements.
|
||||
|
||||
## Highlights / Key Features
|
||||
|
||||
- **Terminal Strip / Terminal Strip Editor**
|
||||
- New TerminalStripItem type and related editor workflow added.
|
||||
- Support for drawing and displaying terminal bridges and links in the editor.
|
||||
- Full editor support (layout preview, save/load into .qet files) and undo support for terminal strip operations.
|
||||
- **New Example Projects**
|
||||
- Several new example projects included, notably photovoltaic (PV) examples to help users getting started with PV designs.
|
||||
- **Improved Export / Print Handling**
|
||||
- Export limits adjusted and better handling of QPainter/printing boundaries to avoid export artefacts and out-of-range errors.
|
||||
- Export dialog updated to allow larger pixel limits where appropriate.
|
||||
- **Element & Symbol Additions**
|
||||
- New elements and symbols added (including vendor-specific elements and additional sensors/Arduino components).
|
||||
- Improvements to element import & metadata handling.
|
||||
- **Packaging & Multi-arch Support**
|
||||
- Updated packaging scripts for AppImage, Flatpak, Snap and macOS deployment. Improved aarch64/arm64 support.
|
||||
|
||||
## Detailed Changes
|
||||
|
||||
### Editor & UX
|
||||
|
||||
- Better handling for **rotation, flip and mirror** operations in the element editor:
|
||||
- Primitives and text rotation behavior improved.
|
||||
- Finer rotation increments and predictable text orientation after flips/rotations.
|
||||
- **Wiring and conductor behavior**:
|
||||
- More robust creation and movement of wires and conductor bundles.
|
||||
- Improved text attachment and positioning for wires and improved stability while editing complex conductor networks.
|
||||
- **TerminalStrip editor**: see Highlights - includes drawing, preview, layout editing, persistent storage in the project file and undo support.
|
||||
- **Element Editor & Symbol Trim/Sort**:
|
||||
- Improved trimming/normalization of element metadata.
|
||||
- Better sorting and error handling for element imports (DXF and other formats).
|
||||
- Small UI improvements: About dialog updates, autosave spinbox ranges, improved tooltips and mouse-hover help for dynamic texts.
|
||||
|
||||
### New & Updated Elements
|
||||
|
||||
- New elements added for industrial and automation workflows (including Siemens-related elements, logic elements, sensors and Arduino components).
|
||||
- Symbol library additions and cleanup; improved defaults for newly added symbols.
|
||||
- Element meta-data cleanup: article numbers, descriptions, and manufacturer fields were normalized and trimmed on import.
|
||||
|
||||
### Export / Printing / PDF
|
||||
|
||||
- Adjusted internal export limits to avoid hitting QPainter size restrictions; users can now export larger, high-resolution images/prints in more cases.
|
||||
- Better handling of page sizes and printer-related geometry using QRectF improvements.
|
||||
- PDF export improvements to increase reliability of exported vector content.
|
||||
|
||||
### Build, Dependencies, Packaging
|
||||
|
||||
- Upgrades of core test and build dependencies:
|
||||
- Catch2 upgraded to v2.13.10.
|
||||
- googletest upgraded to v1.17.0.
|
||||
- CMake fixes and i18n handling corrected for nl_BE and other locales.
|
||||
- Packaging scripts updated across platforms (AppImage/Flatpak/Snap/macOS deploy) including fixes for aarch64/arm64.
|
||||
- Submodule updates (e.g., qelectrotech-elements, pugixml, SingleApplication) synchronized where needed.
|
||||
|
||||
### Internationalization & Translations
|
||||
|
||||
- Large translation updates across many languages: German (DE), French (FR), Dutch (NL, including nl_BE), Swedish (SV), Italian (IT), Polish (PL), Portuguese-BR (PT-BR), Serbian (SR), Chinese (Simplified) and others.
|
||||
- Fixes and corrections for many UI strings and localized resources.
|
||||
|
||||
### Tests, QA & Logging
|
||||
|
||||
- Improved logging and machine/config-path reporting; Git revision display refined to only show a revision when available.
|
||||
- Unit test updates and fixes to align with updated testing frameworks.
|
||||
|
||||
## Bug Fixes (selected)
|
||||
|
||||
- Fixed crashes and various null pointer access issues discovered by static and dynamic testing.
|
||||
- Resolved multiple reported bugs that caused build failures on some platforms (FTBFS fixes for macOS and others).
|
||||
- Fixed issues with automatic conductor/strand numbering in several edge cases (referenced Bug 293 in the commit logs).
|
||||
- Resolved text/summary headline issues in the German-language summary generator.
|
||||
- Fixes for a number of visually incorrect renderings and layout corner-cases during element transformation (rotate/flip/mirror).
|
||||
- Fixed issues that affected export sizes and caused export artifacts (referenced fixes for bug IDs around #329/#330 in commit notes).
|
||||
|
||||
## Developer & Contributor Notes
|
||||
|
||||
- Reworked parts of the codebase to use QRectF consistently for better compatibility with QPrinter and export pipelines.
|
||||
- Code-style cleanups and comment improvements applied throughout the project.
|
||||
- Expanded test coverage and dependency refresh to keep CI builds stable.
|
||||
|
||||
## Contributors (selected)
|
||||
|
||||
Thanks to the many contributors who made this release possible. Selected contributors mentioned in the commit logs include:
|
||||
|
||||
- Laurent Trinques
|
||||
- joshua
|
||||
- plc-user
|
||||
- Achim
|
||||
- Pascal Sander
|
||||
- Andre Rummler
|
||||
- Magnus Hellströmer
|
||||
- Martin Marmsoler
|
||||
- Remi Collet
|
||||
|
||||
(See the full commit history for the complete contributor list.)
|
||||
|
||||
## Upgrade / Migration Notes
|
||||
|
||||
- No database or project file format breaking changes were reported in the provided logs. As always, back up projects before opening them with a new version.
|
||||
- If you rely on custom element libraries or third-party submodules, verify submodule synchronization after upgrading.
|
||||
- If you are using custom packaging pipelines, review the updated packaging scripts for any changes required by new dependency versions, especially on aarch64/arm64.
|
||||
|
||||
## Known Issues & Limitations
|
||||
|
||||
- Some very large exports may still be limited by platform-specific rendering restrictions; the export dialog now allows larger pixel limits but extreme sizes may still hit system-level limits.
|
||||
- If you use niche element-import workflows (DXF → element import), occasionally metadata normalization may alter whitespace/trim rules - verify newly imported elements in the element editor.
|
||||
|
||||
## How to get help / report bugs
|
||||
|
||||
- Use the project issue tracker (see repository) to report regressions or new bugs with detailed reproduction steps and example .qet files where possible.
|
||||
- Include the output of Help → About (application version and Git revision) when reporting build/packaging issues.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
====== ChangeLog from 0.8 to 0.9 ======
|
||||
|
||||
|
||||
*Diagram editor :
|
||||
Improved QElectroTech speed (launch qet, open project, function)
|
||||
A drop-down list has been added to the toolbar to change the size of the resize handles.
|
||||
|
||||
|
||||
*Element Editor:
|
||||
The "keep visual rotation" property of element texts is editable from the element editor.
|
||||
Thanks to the work of antonioaja it is now possible to import a dxf directly from the element editor in a completely transparent way for the user.
|
||||
In the background QElectroTech uses the dxf2elmt software. https://qelectrotech.org/forum/viewtopic.php?id=2265 https://github.com/antonioaja/dxf2elmt
|
||||
Improved responsiveness when multiple shapes are selected or deleted, especially when working on a large converted DXF element.
|
||||
https://qelectrotech.org/forum/viewtopic.php?pid=16612#p16612
|
||||
|
||||
*Other:
|
||||
Add a "side project" tab in the "about" window.
|
||||
In the general QElectroTech configuration, a drop down list allows to choose the scaling method for hdpi screens.
|
||||
Allow open polygons (i.e. polylines) when saving in dxf format.
|
||||
https://qelectrotech.org/forum/viewtopic.php?pid=16611#p16611
|
||||
|
||||
Added 'Other' option for slave device contact type.
|
||||
https://github.com/qelectrotech/qelectrotech-source-mirror/pull/222
|
||||
https://qelectrotech.org/forum/viewtopic.php?id=2264
|
||||
|
||||
*Logs:
|
||||
|
||||
Added a QElapsedTimer to calculate the time used to reload the item collection.
|
||||
Improved QElapsedTimer to calculate the time used to reload the item collection in seconds instead of ms.
|
||||
Added Linux pc.gpu.RAM information, but requires mesa-utils dependency on the Linux OS.
|
||||
Added information about mounted disk volumes.
|
||||
Added CPU architecture for which Qt was compiled in the aboutqetdialog widget and in the logs.
|
||||
Added MSVC support to MachineInfo.
|
||||
Added RAM information on Windows of available RAM.
|
||||
Added QElectroTech version to the log file.
|
||||
|
||||
|
||||
|
||||
* Elements collection :
|
||||
Improve collection 8274 elements in 1097 categories (i.e. 9371 files).
|
||||
|
||||
|
||||
|
||||
* macOS :
|
||||
Fix sqlite3 database export on macOS, now I use macports with Digikam scripts instead off Homebrew Package Manager.
|
||||
See: https://invent.kde.org/graphics/digikam/-/tree/master/project/bundles/macports
|
||||
|
||||
|
||||
*Bug fix:
|
||||
see: https://git.tuxfamily.org/qet/qet.git/log/?h=0.8.1
|
||||
|
||||
====== ChangeLog from 0.7 to 0.8 ======
|
||||
|
||||
|
||||
* Moving the main QET repository SVN trunk to GIT.
|
||||
* Add a mirror of the main QET repository, which is synced to hosted at tuxfamily.org to Github.
|
||||
* Doxyfile update add QCH file for doxygen-generated docs using qhelpgenerator and then import them into Qt Creator.
|
||||
* Improve portability of Doxyfile (Simon).
|
||||
* Fix deprecated warnings (Simon).
|
||||
* Wrap code for better readability (Simon, Damian).
|
||||
|
||||
|
||||
|
||||
|
||||
* Elements collection :
|
||||
Improve collection 7378 elements in 1092 categories
|
||||
Thanks Sebastien, Dinozzo, Simon, Rafał, Arnaud, Bisku, Fernando, Riesermauf, Alexis, david, Plc-user, Christophe, Michele, Galexis, Jevgenijs, Gabor,
|
||||
Benoit Michel, Franck, Ludovic, Cyrille, ossau2mation, Mitzot, Edgar, Nuri, Friskolon, Baboune41, Wiktor, shateks, Dik, Shateks, Marcin
|
||||
|
||||
|
||||
* Diagram editor :
|
||||
|
||||
* The export of the nomenclature to csv file has been completely rewritten :
|
||||
It is now possible to choose which information to export as well as the order in which it should be displayed.
|
||||
An option allows filtering by type of element: all, terminal block, button / switch.
|
||||
Another option allows to display or not the column headers in the csv file.
|
||||
With these options, it is possible to create a nomenclature, an order list, but also for printing labels: list of terminals and list of buttons / switches.
|
||||
It is possible to save / load a configuration easily.
|
||||
Finally, the work being done by an SQLite database, a text field allows the user to create his own SQL query.
|
||||
|
||||
* Add Conductors numbering to csv file.
|
||||
|
||||
* Add new summary table.
|
||||
|
||||
* add BOM creation dialog :
|
||||
nomenclature is now integrated into the project (accompanied by several parameters in order to be customizable).
|
||||
Tables can have a name.
|
||||
Tables an be added to any folio.
|
||||
Font margin and alignment (right center left) separately adjustable for headers and table cells.
|
||||
Position size and number of lines is adjustable.
|
||||
Possibility of linking several tables together, especially when the entire nomenclature cannot be contained in a folio.
|
||||
Automatic adjustment of the size of the table in relation to the folio.
|
||||
Option to apply the geometry of an array to all the array linked to it, so that everything is homogeneous.
|
||||
Save / load table configuration and content to make creation faster.
|
||||
Option to automatically adjust the table to the folio.
|
||||
Option to automatically add new tables in new folios if the nomenclature cannot be contained in 1 to N folios / tables.
|
||||
|
||||
* Table content:
|
||||
Fully customizable, you display what you want or want (info to display in the desired order, filter on type of element, filter on content of the info "contains, not contains, not empty etc ..." ).
|
||||
The content being generated from a sqlite database, you can write your own request.
|
||||
|
||||
|
||||
* Loading of element collections is now faster (thanks to the pugixml parser)
|
||||
* The loading of collections of elements no longer freezes QElectroTech.
|
||||
* The appearance and disappearance of the search / replace menu is animated.
|
||||
* Fix wrong position of slave xref after open a saved project
|
||||
|
||||
* Add font color of the conductors (Simon).
|
||||
* Add section and color properties for wires.
|
||||
|
||||
* config dialog :
|
||||
* Add QScrollArea to configdialog and resize to max_screen (Simon).
|
||||
* Add gui resize depending on screen size (Simon).
|
||||
* Add Screen info user (Simon).
|
||||
* Mod ScrollArea on demand (Simon).
|
||||
|
||||
|
||||
* Element editor:
|
||||
* Polygon editing widget, when you click on a point in the list, the corresponding point changes color in order to better visualize what you are doing.
|
||||
On this same list, a right click opens a contextual menu allowing to delete the selected point or inserted a point after the selected one.
|
||||
When holding the ctrl + directional arrow key, the selected parts move by 0.1 instead of 1 point.
|
||||
* with Ctrl key you can moving by keyboard primitives selected by 0.1 point instead by 1 points, added the same feature for moving the selected aera.
|
||||
* Added 140 web standard colors In Element editor (Arnaud).
|
||||
|
||||
* Add multiedit feature (martin).
|
||||
* Add terminals uuid for next features (martin).
|
||||
|
||||
|
||||
* Windows :
|
||||
* Fix bad fonts rendering if Qt version >= 5.13.1.
|
||||
See : https://bugreports.qt.io/browse/QTBUG-83161
|
||||
* Fix backup file on windows
|
||||
For unknown reason KautoSaveFile don't write the file on Windows if file
|
||||
is open in another part of the code.
|
||||
No error is returned and use the method :
|
||||
qint64 QIODevice::write(const QByteArray &byteArray) return the good
|
||||
number of bytes written but the real file stay empty.
|
||||
Probably the problem don't come from KautoSaveFile but QFileDevice or
|
||||
QIODevice on windows.
|
||||
|
||||
The fix consist to open the file just before write on it and close it
|
||||
just after.
|
||||
|
||||
* writeToFile on a other Thread to improve this for windows performance (Simon).
|
||||
|
||||
|
||||
* macOS :
|
||||
* Add Fusion style and fix tilesets tab bar size
|
||||
* Enable mouse wheel on tilesets tab bar with command keyboard, thanks Giovanni.
|
||||
(removed by Qt upstream) https://codereview.qt-project.org/gitweb?p=qt/qtbase.git;a=commitdiff;h=ea47d152b35158ba07a55d009f57df0e4c2a048f;hp=08cc9b9991ae9ab51bed5b857b6257401401ff6f
|
||||
|
||||
|
||||
* Add Snap packages :
|
||||
* thanks Max for help.
|
||||
https://snapcraft.io/qelectrotech
|
||||
See: https://qelectrotech.org/forum/viewtopic.php?id=1426
|
||||
* Use kde-neon extension
|
||||
The kde-neon extension reduces our boilerplate in snapcraft.yaml
|
||||
and reduces the snap size considerably, as we do not need to ship
|
||||
any library that is already included in the kde-frameworks-5-core18
|
||||
snap itself.
|
||||
|
||||
This limits qelectrotech builds to the architectures supported
|
||||
by kde-frameworks-5-core18, i.e. only amd64.
|
||||
|
||||
https://git.tuxfamily.org/qet/qet.git/log/?qt=grep&q=snap
|
||||
|
||||
|
||||
|
||||
* Add Flatpak packages :
|
||||
* thanks Mathieu for help.
|
||||
See: https://github.com/qelectrotech/qelectrotech-source-mirror/pull/18
|
||||
* remove the file name extension added
|
||||
automatically to the saved files even if the user sets an unknown file
|
||||
extension for the program.
|
||||
|
||||
https://git.tuxfamily.org/qet/qet.git/log/?qt=grep&q=flatpak
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
====== ChangeLog from 0.6 to 0.7 ======
|
||||
|
||||
|
||||
* Element editor :
|
||||
* Element informations (manufacturer, reference etc...) can be created directly from the element editor. For that go to the widget "Element Property"
|
||||
* It is no longer required to have a text field, for save the edited element.
|
||||
* Improve the behavior with the arrow keys (depending to the current selection (nothing / one / several).
|
||||
* Context menu display only enabled actions.
|
||||
* Added new feature -> alignment.
|
||||
* Alignment of text field can be edited.
|
||||
* Added two new actions in context menu for insert or remove point of a selected polygon.
|
||||
* Rectangle can have rounded corner.
|
||||
* Polyline: finish the creation of polyline with the last point at the same position of the first point, close the polyline.
|
||||
|
||||
|
||||
* Diagram editor :
|
||||
* Conductors can now be drawn with two colors.
|
||||
* Improve High-DPI support on Windows and Linux plateform.
|
||||
* The code for the resize handles has been almost completely redesigned.
|
||||
* Dissociate fonts policy and size for independent text item and for summarry pages (foliolist), added a 2 button in config page for open Qfontdialog widget and choose policy for independent text item.
|
||||
* Add in config page a Qfontdialog widget for change dynamic text size, font family, orientation angle and text length, by default.
|
||||
* Basic shape add new CustomDashLine style with Dash Pattern (<< 10 << 10 );
|
||||
* It is now possible to add a text field to an element directly from the diagram.
|
||||
* Element text item with are now converted to dynamic element text item.
|
||||
* Element editor, part text can't be edited directly.
|
||||
* User can export / import the configuration of the texts and texts group of an element.
|
||||
* Context menu display only enabled actions.
|
||||
* Added new action in the context menu, multiple paste, check box for autonum the pasted element.
|
||||
* Multipaste -> improve the conductor autonum, conductors are numerated from top to bottom, and left to right.
|
||||
* Text of conductor can be placed at top/bottom/left/right of conductor, and text never overlaps the conductor.
|
||||
* Function for search conductor at the same potential.
|
||||
When the search function is searching in a terminal element, they search only for the first terminal found, no matter if the terminal element have more than two terminals.
|
||||
So the list of conductors at the same potential is missing some conductors.
|
||||
This commit fix it, now the search function search for every terminals of a terminal element.
|
||||
* When remove an element with several conductors connected to the same terminal, the electrical potential is partially or totally destroyed.
|
||||
This commit fix it : When element is removed one or several conductors are created (if needed) to conserve the electrical potential.
|
||||
|
||||
* Added new feature -> alignment.
|
||||
* Alignment of text field can be edited.
|
||||
* Added new context menu action "group the selected texts".
|
||||
* Widget used to edit text item group can edit the pos of the group.
|
||||
* Element text item group can now be framed.
|
||||
* Added two new actions in context menu for insert or remove point of a selected polygon.
|
||||
* QETshapeItem rectangle can have rounded corner.
|
||||
* Add in config the possibility to start the numbering of the columns of titleblocks at 0.
|
||||
* Add new function Search and replace widget Crtl +F
|
||||
* Diagram properties, Element properties, Independent text item can be changed (and mass changed) through the search and replace widget.
|
||||
* Added 4 tools for edit the depth (Z value) of items.
|
||||
* Element panel : elements can be searched by their name but also with by all their informations.
|
||||
* New free selection style.
|
||||
* Diagram editor : dock used to edit the shape item, can now edit several items in the same time.
|
||||
* Dynamic element text item : The font of the dynamic texts can be individually be setted.
|
||||
|
||||
* Adding or revoming diagram set project to modified
|
||||
* When user cleanning an project, set project to modified
|
||||
* Add a shortcut "Ctrl+Shift+P" to quickly open the dialog used for create the auto numbering rules.
|
||||
* Add missing StatusTip of some QAction
|
||||
|
||||
* When user add a polygon, a message in statusBar show how to finish this shape
|
||||
* Polyline: finish the creation of polyline with the last point at the same position of the first point, close the polyline.
|
||||
|
||||
|
||||
|
||||
* Plug-in : Add StatusTip instruction for install and launching DXF plugin depending on the operating system
|
||||
* when plugin qet-tb-generator"generate terminal blocks and connectors" isn't installed show an QMessageBox instruction now depending on the operating system for install it
|
||||
Add in QMessageBox url encoding/decoding for easy download packages
|
||||
|
||||
* Elementspanelwidget: adds keyboard shortcuts to quickly move up, down,or move the targeted folio to the beginning of the project
|
||||
F3 MoveUp
|
||||
F4 MoveDown
|
||||
F5 MoveUpTop
|
||||
|
||||
* Title block editor :
|
||||
Added new title block variables %projectpath, %projectfilename, %projecttitle, previous-folio-num and next-folio-num
|
||||
"%saveddate, %savedtime, %savedfilename and %savedfilepath" they variables should be updated after file save or save as dialog is confirmed,
|
||||
before file is saved.
|
||||
* NameList widget : add a combo box for easily paste texts, like the variables for title block.
|
||||
* The font of the dynamic text field can be edited.
|
||||
* The font of the static text field can be edited.
|
||||
* The color of the static text field can be edited.
|
||||
|
||||
|
||||
|
||||
* Improve for new qet_tb_generator plug-in : added the full path of the current project as
|
||||
an argument when calling the plug-in from QET if a project is open.
|
||||
If not a file dialog is showed to select the QET project.
|
||||
|
||||
|
||||
|
||||
* QET create a backup file, use to restore the project when a crash occur.
|
||||
* Use KAutoSaveFile for the backup system, instead of home made function.
|
||||
* Use of QSAveFile instead a QFile.
|
||||
* User can enable and edit autosave timer.
|
||||
* let user define the file system path of the common,custom elements collections, and custom title blocks template.
|
||||
|
||||
|
||||
* QetGraphicsItem, remove the function applyRotation and rotateBy, and use instead the native function of QGraphicsItem : setRotation
|
||||
* Conductor is an herited class of QGraphicsObject, instead of QObject and QGraphicsPathItem
|
||||
* Clean (and reduce the size) the class QETDiagramEditor, mostly by replacing the connection syntax "signal -> slot" by "signal -> lambda".
|
||||
* Replace deprecated QMatrix by QTransform.
|
||||
|
||||
|
||||
* DXF export : fix some double items in dxf file.
|
||||
* DXF export : add some colors for basic shapes inside dxf.
|
||||
|
||||
|
||||
* Bug fix :
|
||||
* Fix compilation warning (clang and gcc).
|
||||
|
||||
* Fix element text item alignment work well when text rotation != 0.
|
||||
* Fix crash when the properties of a element text item group
|
||||
* Fix crash occurred by the conductor and shape "ghost".
|
||||
* Fix element text alignment work also when font size change.
|
||||
* fix :
|
||||
1- When open a .qet by double click on it, QET ask user for open the backup file, of this .qet.
|
||||
2- On windows, if user open a project from the recent files menu, when close QET the file is deleted  user lose her work.
|
||||
clear the element texts when paste an element with the option "Do not store the labels of items in the copy paste" enabled.
|
||||
* elements can't be moved up and left, when there rotation are different than 0.
|
||||
* minor fix : slave link dialog doesn't display the good label, when the label of master element is build from formula.
|
||||
* Fix : in some condition, dynamic text are not at the same position when open a project.
|
||||
* On windows when user drag and drop an element from the common elements collection to the custom elements collection,
|
||||
the element file stay in read only mode, and so user can't save the element
|
||||
* Improvement : minimize the unwanted gap of the top right folio of the view (see https://qelectrotech.org/forum/viewtopic.php?pid=9379#p9379)
|
||||
* Fix: bug 168
|
||||
* Fix : when create multiple conductors with the free hand selection, the checking of existing potentiel don't search trought a folio report.
|
||||
* Fix: DXF export.
|
||||
* Minor fix : remove from the element information the html hexadecimal and decimal characters of line feed and carriage return.
|
||||
* fix : in the diagram editor, when we select several shapes at the same time, the properties widget only apply the change to one shape.
|
||||
* Bug fix : when user load a project which contains summary pages, project was marked modified (summary was created on the fly and moved from the end on second
|
||||
position), now the project is no longer marked as amended when user have one or multiples summary pages when loading this project.
|
||||
* Static text of element are now exported to dxf
|
||||
* Fix Static text size of element exported to dxf
|
||||
* Improvement : minimize the unwanted gap of the top right folio of the view
|
||||
* Fix : when create multiple conductors with the free hand selection, the checking of existing potentiel don't search trought a folio report.
|
||||
* Don't display gui when qet is launched with specific argument
|
||||
|
||||
|
||||
|
||||
====== ChangeLog from 0.5 to 0.6 ======
|
||||
In the official collection, there are now 4106 elements, and 539 categoris for a total of 4645 files
|
||||
|
||||
* Improved performance, added multithreading to speed up the loading of items when launching QET.
|
||||
* RAM consumption has been considerably reduced.
|
||||
* New "collections" panel.
|
||||
* Automatic numberings (autonum), Variables and prefix.
|
||||
* Folio generator
|
||||
* Management Policy
|
||||
* New thickness properties for conductors.
|
||||
* The thickness of the lines of all basic shapes (lines, rectangles, ellipses, polygons) can be changed from 0,2px to 50,0px.
|
||||
* The color of lines and fillings of basic shapes can be choosed from a color palette or set with a html color code.
|
||||
* Added Copy/paste from another project.
|
||||
* Online documentation and links to download the latest packages of the version under development for Windows and MacOS are available directly from the software.
|
||||
* Resetting the layout of the summary pages.
|
||||
* In the panel left split the view into a several docks.
|
||||
* High-DPI support (Qt 5.6.0)
|
||||
* new python plugin to generate terminal block.
|
||||
* Windows packages are now created on a Debian operating system using cross-compilation and targeted to make executable binary files for these operating systems.
|
||||
This technical evolution allows a significant time saving during the creation of the packages. And we can provide also in the same time Windows XP and Vista packages by cross-compil with Qt 5.7.1 environment
|
||||
* The Mac OS X executable binary files are created on a virtual environment, moved compiler to latest LLVM clan version, improved dmg packages with added Info.plist.
|
||||
* An annoying memory leak has been found and solved. Afters hours of use, some users noticed that the RAM consumption growed steadily, up to 10GB or more. This problem is now solved.
|
||||
|
||||
|
||||
|
||||
====== ChangeLog from 0.4 to 0.5 ======
|
||||
In the official collection, there are now 2625 elements, and 418 catégoris for a total of 3043 files.
|
||||
|
||||
* Port to Qt 5 framework
|
||||
* New QSettings native format for config files.
|
||||
* In the diagram editor, the grid is not displayed by default outside the diagram, the minimum zoom is blocked. A button allows you to un-validate this operation.
|
||||
* It is now possible to put the tittle block on the right vertical mode.
|
||||
* The default tittle block can be defined for the next folios of the project.
|
||||
* The summary now takes the font set in the QElectroTech.conf
|
||||
* The floating dock is now operational, variables, actions are taken into account on the fly.
|
||||
* A transformation tool transforms quickly and finely each primitive by handles.
|
||||
* Add UUID tag for element XML.
|
||||
* The database enables faster loading a large number of managing symbols in tables changes pixmaps collections, it no longer compares the modification date of the files but their use UUID attributes to update the cache .
|
||||
* In terms of basic shapes, the transform tool works directly on vectors, it replaces the reduction tool / enlargement that has just been deleted as unnecessary.
|
||||
* Improve Undo command by QPropertyUndoCommand class.
|
||||
|
||||
|
||||
|
||||
====== ChangeLog from 0.3 to 0.4 ======
|
||||
In the official collection, there are now 2298 elements, and 376 catégoris for a total of 2674 files.
|
||||
|
||||
* We have removed the flag '-fno-ipa-sra "This settled the compilation problems on Mac OS X and FreeBSD clang.
|
||||
* The official collection has been redesigned, through the work of Nuri a new structure is in place.
|
||||
* A menu has been added, allowing you to change the application language.
|
||||
* we added a summary creation tool.
|
||||
* Added button "export the nomenclature" transforms data from diagrams to CSV file for spreadsheet.
|
||||
Arun wrote a detailed manual in English.
|
||||
* New tools have been added, they can create mechanical connections and draw cabinets, desks, junction boxes, or areas on the schematic (line tool, rectangle, ellipse, polygon type: respect for style dashes).
|
||||
* An aid in positioning cross, drawing, was added.
|
||||
* The locked state images and basic forms (basic shapes) is now stored in the project.
|
||||
* The "control" during the movement of an element, text field disables snapping to the grid, for free positioning.
|
||||
It is now possible to choose the background folios in white or gray.
|
||||
* Add supports trackpad gestures (multitouch).
|
||||
The dates of the cartridges are now using the short system date and date format according to the language detected setting in the OS.
|
||||
We take advantage of the transition to standard C ++ 11, and a big cleanup in the code was done.
|
||||
* The undo action or redo the undo stack are now animated graphically.
|
||||
When the action save, save as, the status bar displays the name and path of the backup job.
|
||||
Qet is now able to come to load a style sheet (stylesheet) directly from the conf directory.
|
||||
* A DXF export has been added, the entire project folios can be exported in this format.
|
||||
* Added reports folio, Cross references.
|
||||
* Added a variable font size for text of conductors.
|
||||
* Added new properties to all conductors at the same potential, even through referrals.
|
||||
* When several conductors have the same value potential equalization, it is not useful to display on all conductors.
|
||||
* Added button to activates the automatic connection of the conductors of the element when moving it.
|
||||
* Numbering rules are now available for the entire project.
|
||||
Qet detects the Windows version and applies the appropriate graphic style, depending on the version of Windows.
|
||||
|
||||
|
||||
====== ChangeLog from 0.3 rc to 0.3 ======
|
||||
First, the collection of symbols has made a big step forward, with about 1560 new elements.
|
||||
There are now symbols for pneumatics, hydraulics, process, solar, cold, etc. Considerable effort has been done to organize the collection in a better way.
|
||||
We hope that the new organisation is clearer for all. We would like to thank all the contributors who send us symbols.
|
||||
|
||||
=====-Element Editor: =====
|
||||
Considerable work has be done to replace the manual defining zone of the symbol, aka hotspot.And fix bugs, It is now automatic. You do not have to care about it anymore.
|
||||
Primary colors have been added for the drawing shapes.
|
||||
A contextual menu (right click) has been added. So, you can now work more quickly with symbols. It is also more user-friendly.
|
||||
|
||||
====== ChangeLog from v0.3 rc ======
|
||||
|
||||
=====-Element Editor: =====
|
||||
* Replacing checkboxes with lists of colors.
|
||||
* Removed the manual hotspot, it is now automatic and you do not have to worry.
|
||||
Officially Collection: a large classification work on the structure was realized. It should be clear to everyone.
|
||||
The collection is enriched with 1711 items in 286 categories (ie 1997 files)
|
||||
|
||||
=====-Schema Editor:=====
|
||||
* Added import image, image rotation, image resizing and saving the file in the project.
|
||||
(Double click on the image called a widget and cursor that reduce or enlarge the selected image.)
|
||||
NB: Following the "edit image" entry will also be added in the right click menu.
|
||||
* F5 keyboard shortcut can recharge symbol collections.
|
||||
Some bugs have been resolved, and the translation status continues to grow.
|
||||
|
||||
|
||||
======ChangeLog from v0.3 beta ======
|
||||
Two more items for the changelog:
|
||||
* In the official collection, there are now 1672 elements and 256 categoris for a total of 1928 files. In version 0.3 alpha, there were 1465 elements and 233 categories, while version 0.22 had153 elements and 51 categories.
|
||||
|
||||
*Progress in the translation (see http://qelectrotech.org/wiki/doc/translation/stats for current state)
|
||||
* Functions (edit element and find in panel) have been moved to the context
|
||||
Here is the changelog, for version 0.3 beta:
|
||||
* Functions (edit element and find in panel) have been moved to the context menu, that can be accessed with right click. This is more user friendly.
|
||||
* Refresh of categories when an element is moved.
|
||||
* DateNow button added in the "Diagram property" dialog.
|
||||
* Dotted lines can now been added between conductors.
|
||||
* Rich text can be added to the diagram text fields.
|
||||
[screenshot]
|
||||
* HTML WYSIWYG editor for rich text: bold, italic, underlined, font size from 6 to 72 pixels, font colour, etc.
|
||||
* You can change between the two modes(Selection mode <-> View mode) with the scroll button.
|
||||
* Symbol editor: focus on the new value for language, languages sorted in alphabetical order.
|
||||
* Added a widget that reflects the loading of a big project.
|
||||
* Automated numbering of conductors according to your rules. See note from Joshua http://qelectrotech.org/wiki/doc/autonum
|
||||
* Added a dialog to automatically rotate the text if the associated conductor is vertical or horizontal. Parameters are saved in qelectrotech.conf
|
||||
* Added basic colours on the tools for lines and for the filling of the primitives, and also for the style line and point in the element editor.
|
||||
* Added several protection to prevent from saving an element if one of its primitive is beyond the hotspot.
|
||||
|
||||
|
||||
====== ChangeLog from 0.22 to 0.3a ======
|
||||
|
||||
===== Application =====
|
||||
|
||||
Elements collection: QElectroTech now provides 1465 elements within 233 categories (0.22 provided 153 elements within 51 categories). Most elements are related to electricity though some relate to chillers, solar, hydraulic and pneumatic engineering.
|
||||
A new kind of collections appeared to store title block templates; as for elements, there is a distinction between common (system-wide) templates and custom (user-wide) templates.
|
||||
Translations:
|
||||
English, Spanish, French, Portuguese and Czech translations have been maintained.
|
||||
Russian translations have been removed because they are not maintained anymore.
|
||||
Polish, German, Italian, Arabic and Croatian translations have been added.
|
||||
Following translation to Arabic, some work was done to improve Right-To-Left languages support.
|
||||
Elements names are fully translated to English, French, Czech and Polish.
|
||||
Main windows: added a “What's this?” action.
|
||||
QElectroTech now handles *.titleblock files.
|
||||
|
||||
===== Diagram editor =====
|
||||
|
||||
It is now possible to move and rotate all texts on a diagram : element texts, conductor texts and independent texts.
|
||||
When moving a text related to an electrical element, this element is highlighted.
|
||||
Texts related to a conductor cannot be moved too far away from it.
|
||||
It is now possible to create diagrams with more than 100 rows/columns.
|
||||
Elements panel:
|
||||
During a drag and drop operation, the hovered item is now expanded after a short time not moving the mouse.
|
||||
Items are now expanded/collapsed by a double click.
|
||||
Common, custom and embedded collections of title block templates are displayed within the elements panel.
|
||||
Elements previews and names are now cached into a SQLite database stored in the user configuration directory, thus speeding up the elements panel (re)loading
|
||||
The elements panel now displays the folio index before each diagram title.
|
||||
UI consistency: renamed “Import element” to “Open an element file”, separated this action from those related to the current selection, and ensured elements-related actions are disabled when selecting a project/diagram/title block template.
|
||||
Freshly integrated elements are now highlighted in the elements panel – this behaviour can be disabled though.
|
||||
When clearing the search field, the panel state is restored to its previous state.
|
||||
Title blocks are now rendered using templates:
|
||||
For each diagram, users can choose the template to be used in the diagram properties.
|
||||
They may also drag and drop it from the elements panel to the diagram.
|
||||
Title block templates are always integrated within the parent project.
|
||||
Fixed a bug in the print preview dialog.
|
||||
Added a F2 shortcut for the widget “Edit the color of the given conductor”.
|
||||
As elements, diagrams now have a “version” attribute for compatibility purposes.
|
||||
Better handling of file opening for documents saved with newer versions of QElectroTech.
|
||||
Diagram loading: removed an optimization that could lead to conductors not being loaded when several terminals share the same coordinates.
|
||||
Users may now enter visualisation mode by pressing Ctrl and Shift.
|
||||
Printing: when printing diagrams with no title block, use the space left by the title block.
|
||||
Added a few status and “What's this?” tips.
|
||||
Got rid of the green icon used for projects, changed a few other icons.
|
||||
|
||||
===== Element editor =====
|
||||
|
||||
Both static and dynamic texts can now be rotated
|
||||
Added “dotted” line style
|
||||
Added white color for texts
|
||||
Newly added parts are placed above existing ones.
|
||||
|
||||
===== Title block template editor =====
|
||||
|
||||
A third kind of editor was implemented so users can create their own title block templates:
|
||||
|
||||
It allows users to customize the layout and content of cells that constitute the title block.
|
||||
Cells can be merged and splitted.
|
||||
Their width can be fixed, relative to the total width or relative to the remaining widths.
|
||||
Their height is a simple fixed length.
|
||||
They contain either a logo (be it in SVG or a usual bitmap format) or some text.
|
||||
The text value is optionally preceded by a label.
|
||||
As other texts within QElectroTech, labels and texts can be translated to other languages.
|
||||
Texts and labels may contain variables (e.g. %company-name); these variables are replaced by real world values once the template is applied to a diagram.
|
||||
Those real-world values can be set among the diagram properties.
|
||||
|
||||
|
||||
====== Changelog 0.11 -> 0.2 ======
|
||||
À partir de la version 0.2, QElectroTech est disponible en français, anglais, mais aussi :
|
||||
* en espagnol, grâce aux traductions de Youssef ;
|
||||
* en russe, grâce aux traductions de Yuriy ;
|
||||
* en portugais, grâce aux traductions de José.
|
||||
L'application utilise désormais le thème d'icônes Oxygen, réalisé par Nuno Pinheiro pour le projet KDE.
|
||||
|
||||
===== Notion de fichier projet =====
|
||||
Un fichier .qet peut désormais contenir zéro, un ou plusieurs schémas électriques. Les éléments composant ces schémas sont embarqués dans le fichier projet au moment où ils sont posés sur un schéma. Le panel d'éléments affiche donc désormais :
|
||||
* les projets ouverts, avec, sous chaque projet :
|
||||
* les schémas de ce projet,
|
||||
* la collection embarquée du projet (catégories et éléments utilisés dans les schémas)
|
||||
* la collection commune fournie par QET,
|
||||
* et la collection personnelle de l'utilisateur.
|
||||
|
||||
===== Éditeur de schémas =====
|
||||
* Il est désormais possible de déplacer et copier les catégories et éléments par simple glisser-déposer (drag'n drop) dans le panel d'éléments.
|
||||
* La collection embarquée est manipulable au même titre que la collection utilisateur. Les éléments inutilisés dans le projet apparaissent sur fond rouge et un dialogue permet de les purger rapidement.
|
||||
* Chaque projet embarque également (au niveau de ses propriétés) les paramétrages par défaut pour les nouveaux schémas, cartouches et conducteurs.
|
||||
* Il est possible de changer l'ordre des schémas dans le projet en déplaçant les onglets qui les représente. Dans le champ "Folio" des cartouches, on peut se référer à la position du schéma courant ou au nombre total de schémas dans le projet en écrivant respectivement %id et %total.
|
||||
* Lors du chargement d'un fichier .qet, si des éléments ne sont pas trouvés, ils sont remplacés par un élément "fantôme", ce qui évite de perdre certaines informations lors de l'enregistrement du fichier.
|
||||
* Le rendu avec un zoom réduit a été amélioré.
|
||||
* Enfin, le logiciel gère l'ouverture en lecture seule d'un fichier projet.
|
||||
|
||||
==== Impression et export ====
|
||||
|
||||
À partir de la version 0.2, QElectroTech :
|
||||
* propose d'utiliser une imprimante réelle ou bien de générer un document PDF ou PostScript, et ce sous Windows comme sous X11.
|
||||
* génère un aperçu avant l'impression d'un projet. Cet aperçu permet de choisir les options d'impression mais également les schémas à imprimer ou non.
|
||||
|
||||
À noter toutefois une limitation pour les impressions PDF/PS sous Windows : le dialogue de mise en page, permettant de spécifier le format du papier ainsi que ses marges, n'est pas disponible.
|
||||
|
||||
Le dialogue "Exporter" (pour générer un fichier image d'un schéma) a également été refait dans l'optique d'un export simultané de tous les schémas du projet.
|
||||
|
||||
===== Éditeur d'éléments =====
|
||||
|
||||
* Lorsque l'on dessine une ligne dans l'éditeur d'éléments, il est possible de choisir un embout différent pour chaque extrémité, comme par exemple une flèche, un cercle, un carré ou, tout simplement, un bout de ligne normal.
|
||||
* La forme "Rectangle" a été ajoutée.
|
||||
* On peut enregistrer un élément en désignant un fichier (= comportement en 0.11) ou bien en choisissant un élément cible dans une liste reprenant l'arborescence du panel d'éléments.
|
||||
* Si l'on maintient la touche Shift lorsque l'on ajoute une partie (droite, cercle, texte, ...), l'outil en cours est conservé après le dessin. Sinon l'éditeur repasse sur l'outil de sélection.
|
||||
* La grille a été améliorée : sa densité varie en fonction du zoom ; les points correspondant à ceux de la grille de l'éditeur de schémas sont mis en valeur.
|
||||
* L'accrochage à la grille (aka "snap to grid", également connu sous le nom de grille magnétique ou encore grille aimantée) a été ajouté. Le dessin s'y accroche désormais avec une précision de 1px. On peut travailler en coordonnées libres en maintenant la touche Ctrl enfoncée durant le dessin.
|
||||
* Le copier-coller a été implémenté : il est possible de coller :
|
||||
* avec le bouton du milieu de la souris
|
||||
* en choisissant une "zone de collage" sur l'élément (Ctrl+Shift+V)
|
||||
* directement (Ctrl+V) : les parties collées sont placées à côté des parties copiées ; si on recolle les parties, elles sont collées encore un cran à côté, et ce de manière incrémentale.
|
||||
* Des contrôles sont désormais effectués à l'enregistrement : présence de bornes, respect du cadre, etc.
|
||||
* Uniformisation des menus par rapport à l'éditeur de schémas
|
||||
|
||||
====== Changelog 0.1 -> 0.11 ======
|
||||
|
||||
===== Fonctionnalités et interface =====
|
||||
|
||||
* L'application est désormais capable d'ouvrir un fichier élément passe en paramètre
|
||||
* L'application se lance désormais une seule fois par utilisateur
|
||||
* Lors de l'ouverture d'un fichier en dehors de l'application alors que QET est déjà démarré celui-ci essaye de s'afficher ou d'attirer l'attention de l'utilisateur.
|
||||
* L'application vérifie que ce fichier n'est pas déjà ouvert dans tous les éditeurs de schémas / éléments.
|
||||
* Ajout de fichiers permettant d'automatiser les associations de fichiers sous Windows (.bat et .reg) et X11 (.desktop et .xml)
|
||||
* Ajout de menus "Récemment ouverts" pour accéder aux fichiers récents dans les éditeurs de schémas et éléments.
|
||||
* Ajout d'un splash screen
|
||||
* La hauteur du schéma est désormais gérée via un système de lignes, dont le nombre et la hauteur sont ajustables.
|
||||
* Il est également possible d'afficher ou non les en-têtes des lignes et/ou des colonnes.
|
||||
* Ajout d'une option --lang-dir
|
||||
* Ajout d'une description dans le dialogue des options d'impression
|
||||
* Ajout de pages de manuel Unix (`man') en anglais et en français
|
||||
|
||||
===== Corrections de bugs =====
|
||||
|
||||
* Bug #12 : QET provoquait une erreur de segmentation dès son démarrage dans un environnement sans systray
|
||||
* Bug #14 : il manquait un / dans le chemin proposé lors de l'impression vers un PDF
|
||||
* Bug #15 : Mauvais positionnement des champs de texte sur le schéma
|
||||
* Bug #16 : Mauvaise gestion des modifications du texte d'un conducteur
|
||||
* La classe DiagramView écrivait sur la sortie d'erreur sans fin de ligne
|
||||
* L'option --config-dir était mal prise en compte
|
||||
* Après fermeture d'un schema, le menu Fenêtres n'était pas correctement mis à jour
|
||||
* Les textes des éléments, des conducteurs, du cartouche ainsi que les textes indépendants utilisent désormais tous la même police.
|
||||
* Remise à niveau de l'impression suite au passage à Qt 4.4
|
||||
|
||||
===== Code et détails techniques =====
|
||||
|
||||
* Corrections pour que QET compile avec gcc-4.3
|
||||
* Les classes Conductor et Element héritent désormais de QObject (dépendance sur Qt 4.4)
|
||||
* Affinage du constructeur de la classe QETApp
|
||||
* Moins d'avertissements à la compilation (testé avec gcc 4.3)
|
||||
* Moins d'inclusions non pertinentes
|
||||
|
||||
|
||||
## Version 0.100
|
||||
|
||||
_Compiled from provided commit logs and contributor notes._
|
||||
|
||||
+91
-2
@@ -2,13 +2,102 @@
|
||||
|
||||
## [Unreleased](https://github.com/qelectrotech/qelectrotech-source-mirror/tree/HEAD)
|
||||
|
||||
[Full Changelog](https://github.com/qelectrotech/qelectrotech-source-mirror/compare/0.9...HEAD)
|
||||
[Full Changelog](https://github.com/qelectrotech/qelectrotech-source-mirror/compare/nightly...HEAD)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- “Exclude from auto-numbering” and “Potential isolation” tick boxes fault [\#482](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/482)
|
||||
- Add ability to change appearance of multiple lines at once [\#476](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/476)
|
||||
- Save As dialog asks for "element name" but actually requires a file name [\#469](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/469)
|
||||
- Some icons are illegible with dark theme [\#466](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/466)
|
||||
- \[BUG\] Properties to all conductors [\#460](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/460)
|
||||
- Internal links in PDF export [\#417](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/417)
|
||||
- Apple silicon download is not working [\#400](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/400)
|
||||
- Add missing title block variables to 'folio properties' window [\#271](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/271)
|
||||
- Bug: Saving a read-only project doesn't clear the read-only state [\#217](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/217)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- PartText: keep text position stable across save/reopen on font-size change \(\#158\) [\#501](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/501) ([ispyisail](https://github.com/ispyisail))
|
||||
- Clear read-only state when a project is saved to a writable file [\#497](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/497) ([ispyisail](https://github.com/ispyisail))
|
||||
- Fix regional system locale loading the wrong translation \(pt\_BR/nl\_BE/nl\_NL\) [\#496](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/496) ([ispyisail](https://github.com/ispyisail))
|
||||
- Folio properties: auto-add a title block's custom variables [\#495](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/495) ([ispyisail](https://github.com/ispyisail))
|
||||
- Element editor Save As: label the field as a file name, not 'element name' [\#494](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/494) ([ispyisail](https://github.com/ispyisail))
|
||||
- CLI: add --set-titleblock, and fix headless backup crash [\#493](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/493) ([ispyisail](https://github.com/ispyisail))
|
||||
- Update qet\_zh.ts [\#491](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/491) ([zi-mozhuang](https://github.com/zi-mozhuang))
|
||||
- CLI: clickable cross-reference hyperlinks in PDF export [\#490](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/490) ([ispyisail](https://github.com/ispyisail))
|
||||
- CLI: add verification & data-export tools \(info, BOM, nets, links, check-elements, resave\) [\#489](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/489) ([ispyisail](https://github.com/ispyisail))
|
||||
- Issues 482 [\#488](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/488) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Revert "Update-UI-Chinese-translation" [\#486](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/486) ([scorpio810](https://github.com/scorpio810))
|
||||
- CLI export: don't draw the editor grid in PDF/PNG/SVG output [\#485](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/485) ([ispyisail](https://github.com/ispyisail))
|
||||
- Update-UI-Chinese-translation [\#484](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/484) ([zi-mozhuang](https://github.com/zi-mozhuang))
|
||||
- Add headless command-line export \(PDF / PNG / SVG / cable-list / wire-list\) [\#483](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/483) ([ispyisail](https://github.com/ispyisail))
|
||||
- fix possible crashes in crossrefitem [\#479](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/479) ([ChuckNr11](https://github.com/ChuckNr11))
|
||||
- Fix: Dynamic element text shifting/jumping when duplicating diagrams [\#477](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/477) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Update German translations for duplicate diagram feature [\#475](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/475) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Feat: Add ability to duplicate diagrams/folios with all metadata and … [\#473](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/473) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Feature: Allow excluding specific elements from BOM \(Nomenclature\) [\#472](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/472) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Potential Isolation option for terminals [\#471](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/471) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Fix: Wiring list filter and dynamic text timing [\#470](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/470) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- New element: Line definition [\#464](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/464) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Turkish Lang Update [\#463](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/463) ([scorpio810](https://github.com/scorpio810))
|
||||
- follow up: wiring list [\#462](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/462) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Fix and Improve Multi-selection for Diagram Operations [\#459](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/459) ([Kellermorph](https://github.com/Kellermorph))
|
||||
|
||||
## [nightly](https://github.com/qelectrotech/qelectrotech-source-mirror/tree/nightly) (2026-05-10)
|
||||
|
||||
[Full Changelog](https://github.com/qelectrotech/qelectrotech-source-mirror/compare/0.100...nightly)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Flatpak runtimes outdated [\#446](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/446)
|
||||
- Move Flemish man pages from man/be/ to man/nl\_BE/ [\#439](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/439)
|
||||
- you could share an PR to fix it? [\#438](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/438)
|
||||
- Diacritics in some filenames can possibly lead to the problems during packaging [\#437](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/437)
|
||||
- שרטוט חשמל [\#435](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/435)
|
||||
- Feature request: add circuit simulation [\#432](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/432)
|
||||
- No usable sources archive for version 0.100 [\#418](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/418)
|
||||
- New release ? [\#411](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/411)
|
||||
- options moving when opening "file", "edition" menus [\#299](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/299)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Try to add Windows build CI workflow [\#457](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/457) ([scorpio810](https://github.com/scorpio810))
|
||||
- Fixed: Prevented the selection in the project tree from jumping to the last page when saving. [\#456](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/456) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Fix Thumbnail in Makrotree [\#455](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/455) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Update German translation for macro feature [\#454](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/454) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Fix losing Focus on moving diagram position with keyboard [\#452](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/452) ([ChuckNr11](https://github.com/ChuckNr11))
|
||||
- Draft: Feature - Introduce User Templates Collection and Dedicated UI Tab [\#451](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/451) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Update translation [\#450](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/450) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Automatic Terminal Numbering Tool [\#449](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/449) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Supplement to pull request \#444 by Kellermorph [\#448](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/448) ([ChuckNr11](https://github.com/ChuckNr11))
|
||||
- Add RAM-based wiring list export [\#447](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/447) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Follow-up: Address review comments for slave limit feature [\#444](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/444) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Feature: Auto-select active diagram in the elements panel tree [\#443](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/443) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Revert "Feature: Implement max\_slaves limit for Master elements" [\#442](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/442) ([scorpio810](https://github.com/scorpio810))
|
||||
- Feature: Implement max\_slaves limit for Master elements [\#441](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/441) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Update qet\_cs.ts [\#434](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/434) ([pafri](https://github.com/pafri))
|
||||
- Update QCH Help file [\#433](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/433) ([Int-Circuit](https://github.com/Int-Circuit))
|
||||
- Create Korean man page for QElectroTech [\#431](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/431) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Update ELEMENTS.LICENSE [\#430](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/430) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Update CREDIT [\#429](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/429) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean comments to QElectroTech XML file [\#428](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/428) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Spanish and Korean summaries to appdata [\#427](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/427) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean translations for comments and generic names [\#426](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/426) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Restore copyright and license information in QET64.nsi [\#425](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/425) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean language strings to lang\_extra.nsh [\#424](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/424) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean translation author to aboutqetdialog [\#423](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/423) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean language support in xml element collection [\#422](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/422) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean translation \(ko\) – translated by jkh [\#419](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/419) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
|
||||
## [0.100](https://github.com/qelectrotech/qelectrotech-source-mirror/tree/0.100) (2026-01-25)
|
||||
|
||||
[Full Changelog](https://github.com/qelectrotech/qelectrotech-source-mirror/compare/0.9...0.100)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- error in doxygen action code [\#414](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/414)
|
||||
- "NoName" is automatically inserted into empty text cells in title block [\#407](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/407)
|
||||
- Apple silicon download is not working [\#400](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/400)
|
||||
- Apple silicon download is not working [\#394](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/394)
|
||||
- Differenciating connector for proper labeling [\#390](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/390)
|
||||
- Non-perpendicular connections [\#368](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/368)
|
||||
|
||||
+1087
File diff suppressed because it is too large
Load Diff
+1
-1
Submodule SingleApplication updated: cbe496bc01...a218603d76
@@ -53,6 +53,7 @@ parts:
|
||||
qet-tb-generator:
|
||||
plugin: python
|
||||
source: https://github.com/raulroda/qet_tb_generator-plugin.git
|
||||
source-tag: v1.31
|
||||
python-packages: [PySimpleGUI]
|
||||
stage-packages:
|
||||
- python3-lxml
|
||||
@@ -76,7 +77,16 @@ parts:
|
||||
after: [kde-sdk-setup]
|
||||
plugin: nil
|
||||
source: .
|
||||
stage-packages: [ git, sqlite3, xdg-user-dirs ]
|
||||
stage-packages:
|
||||
- git
|
||||
- sqlite3
|
||||
- xdg-user-dirs
|
||||
# libxcb-cursor0 was added as a hard dependency of the Qt5 xcb platform
|
||||
# plugin in Qt 5.15.x. The kf5-5-110-qt-5-15-11-core22 content snap does
|
||||
# not bundle it, so dlopen() of libqxcb.so fails on Ubuntu 24.04 hosts
|
||||
# with "found but could not load" (issue #373). Staging the 22.04 build
|
||||
# of this library satisfies the dep without changing base or Qt version.
|
||||
- libxcb-cursor0
|
||||
build-packages:
|
||||
- git
|
||||
- libsqlite3-dev
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
# Configuration for git-cliff, tuned to mimic github_changelog_generator's output style
|
||||
# Doc: https://git-cliff.org/docs/configuration
|
||||
|
||||
[changelog]
|
||||
header = """
|
||||
# Changelog\n
|
||||
All notable changes to QElectroTech are documented here.\n
|
||||
"""
|
||||
|
||||
# Format proche de github_changelog_generator : titre de version avec lien de comparaison + date
|
||||
body = """
|
||||
{% if version %}\
|
||||
## [{{ version }}]\
|
||||
{%- if previous.version %}({{ previous.version }}...{{ version }}){% endif %} \
|
||||
- {{ timestamp | date(format="%Y-%m-%d") }}
|
||||
{% else %}\
|
||||
## [Unreleased]
|
||||
{% endif %}\
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
### {{ group | upper_first }}
|
||||
{% for commit in commits | unique(attribute="message") %}
|
||||
- {{ commit.message | trim | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](../../commit/{{ commit.id }}))\
|
||||
{% endfor %}
|
||||
{% endfor %}\n
|
||||
"""
|
||||
|
||||
footer = ""
|
||||
trim = true
|
||||
|
||||
[git]
|
||||
conventional_commits = false
|
||||
filter_unconventional = false
|
||||
split_commits = false
|
||||
protect_breaking_commits = false
|
||||
filter_commits = false
|
||||
tag_pattern = "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$"
|
||||
skip_tags = "nightly"
|
||||
ignore_tags = "nightly"
|
||||
topo_order = false
|
||||
sort_commits = "newest"
|
||||
|
||||
# Ne garder que la première ligne du message (résumé), le corps détaillé
|
||||
# est retiré ici plutôt qu'au moment de l'affichage, pour que la
|
||||
# déduplication par message fonctionne correctement.
|
||||
commit_preprocessors = [
|
||||
{ pattern = "(?s)\n.*", replace = "" },
|
||||
]
|
||||
|
||||
# Groupement par mots-clés (FR + EN), puisque l'historique QET
|
||||
# ne suit pas Conventional Commits strictement.
|
||||
commit_parsers = [
|
||||
{ message = "^[Mm]erge", skip = true },
|
||||
{ message = "^(?i)(fix|corrig|répar|bug)", group = "🐛 Bug Fixes" },
|
||||
{ message = "^(?i)(feat|ajout|add|nouvelle|nouveau)", group = "🚀 Features" },
|
||||
{ message = "^(?i)(doc|traduc|translation)", group = "📝 Documentation" },
|
||||
{ message = "^(?i)(refactor|clean|nettoy|optimi)", group = "♻️ Refactoring / Cleanup" },
|
||||
{ message = "^(?i)(element|librairie|library)", group = "📦 Elements / Libraries" },
|
||||
{ message = ".*", group = "🔧 Other Changes" },
|
||||
]
|
||||
|
||||
[remote.github]
|
||||
owner = "qelectrotech"
|
||||
repo = "qelectrotech-source-mirror"
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
message(" - fetch_kdeaddons")
|
||||
|
||||
if(DEFINED BUILD_WITH_KF5)
|
||||
if(BUILD_WITH_KF5)
|
||||
Include(FetchContent)
|
||||
|
||||
option(BUILD_KF5 "Build KF5 libraries, use system ones otherwise" YES)
|
||||
|
||||
@@ -25,7 +25,7 @@ if(BUILD_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()
|
||||
|
||||
@@ -29,6 +29,7 @@ set(QET_COMPONENTS
|
||||
set(QET_PRIVATE_LIBRARIES
|
||||
Qt::PrintSupport
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate # Required for QPdfEngine::drawHyperlink (PDF internal links)
|
||||
Qt::Xml
|
||||
Qt::Svg
|
||||
Qt::Sql
|
||||
@@ -106,6 +107,10 @@ set(QET_RES_FILES
|
||||
${QET_DIR}/sources/ui/configpage/generalconfigurationpage.ui
|
||||
)
|
||||
set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/cli_export.cpp
|
||||
${QET_DIR}/sources/cli_export.h
|
||||
${QET_DIR}/sources/pdf_links.cpp
|
||||
${QET_DIR}/sources/pdf_links.h
|
||||
${QET_DIR}/sources/borderproperties.cpp
|
||||
${QET_DIR}/sources/borderproperties.h
|
||||
${QET_DIR}/sources/bordertitleblock.cpp
|
||||
@@ -499,6 +504,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/SearchAndReplace/ui/replacefoliowidget.h
|
||||
${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
|
||||
@@ -625,6 +632,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/ui/diagrampropertieseditordockwidget.h
|
||||
${QET_DIR}/sources/ui/diagramselection.cpp
|
||||
${QET_DIR}/sources/ui/diagramselection.h
|
||||
${QET_DIR}/sources/ui/backupdialog.cpp
|
||||
${QET_DIR}/sources/ui/backupdialog.h
|
||||
${QET_DIR}/sources/ui/dialogwaiting.cpp
|
||||
${QET_DIR}/sources/ui/dialogwaiting.h
|
||||
${QET_DIR}/sources/ui/dynamicelementtextitemeditor.cpp
|
||||
@@ -678,6 +687,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/ui/configpage/generalconfigurationpage.h
|
||||
${QET_DIR}/sources/ui/configpage/projectconfigpages.cpp
|
||||
${QET_DIR}/sources/ui/configpage/projectconfigpages.h
|
||||
${QET_DIR}/sources/ui/configpage/guidespropertieswidget.cpp
|
||||
${QET_DIR}/sources/ui/configpage/guidespropertieswidget.h
|
||||
|
||||
${QET_DIR}/sources/undocommand/addelementtextcommand.cpp
|
||||
${QET_DIR}/sources/undocommand/addelementtextcommand.h
|
||||
@@ -713,8 +724,21 @@ 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
|
||||
)
|
||||
|
||||
if(NOT BUILD_WITH_KF5)
|
||||
list(APPEND QET_SRC_FILES
|
||||
${QET_DIR}/sources/ui/nokde/kautosavefile.cpp
|
||||
${QET_DIR}/sources/ui/nokde/kautosavefile.h
|
||||
${QET_DIR}/sources/ui/nokde/kcolorbutton.cpp
|
||||
${QET_DIR}/sources/ui/nokde/kcolorbutton.h
|
||||
${QET_DIR}/sources/ui/nokde/kcolorcombo.cpp
|
||||
${QET_DIR}/sources/ui/nokde/kcolorcombo.h
|
||||
)
|
||||
endif()
|
||||
|
||||
set(TS_FILES
|
||||
${QET_DIR}/lang/qet_ar.ts
|
||||
${QET_DIR}/lang/qet_ca.ts
|
||||
|
||||
+1
-1
Submodule elements updated: f6a422ab00...4e75942618
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 204 B |
+661
-547
File diff suppressed because it is too large
Load Diff
+661
-547
File diff suppressed because it is too large
Load Diff
+660
-546
File diff suppressed because it is too large
Load Diff
+660
-546
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+674
-558
File diff suppressed because it is too large
Load Diff
+660
-546
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+659
-544
File diff suppressed because it is too large
Load Diff
+660
-546
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+657
-543
File diff suppressed because it is too large
Load Diff
+661
-547
File diff suppressed because it is too large
Load Diff
+660
-546
File diff suppressed because it is too large
Load Diff
+661
-547
File diff suppressed because it is too large
Load Diff
+659
-545
File diff suppressed because it is too large
Load Diff
+660
-546
File diff suppressed because it is too large
Load Diff
+659
-545
File diff suppressed because it is too large
Load Diff
+659
-545
File diff suppressed because it is too large
Load Diff
+660
-546
File diff suppressed because it is too large
Load Diff
+657
-543
File diff suppressed because it is too large
Load Diff
+660
-546
File diff suppressed because it is too large
Load Diff
+661
-547
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+773
-659
File diff suppressed because it is too large
Load Diff
+661
-547
File diff suppressed because it is too large
Load Diff
+658
-544
File diff suppressed because it is too large
Load Diff
+660
-546
File diff suppressed because it is too large
Load Diff
+658
-544
File diff suppressed because it is too large
Load Diff
+658
-544
File diff suppressed because it is too large
Load Diff
+658
-544
File diff suppressed because it is too large
Load Diff
+659
-545
File diff suppressed because it is too large
Load Diff
+658
-544
File diff suppressed because it is too large
Load Diff
+659
-545
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+1950
-1808
File diff suppressed because it is too large
Load Diff
+1
-1
Submodule pugixml updated: 5a1892b321...27b68329de
+5
-1
@@ -230,7 +230,11 @@ RESOURCES += qelectrotech.qrc
|
||||
TRANSLATIONS += lang/*.ts
|
||||
|
||||
# Modules Qt utilises par l'application
|
||||
QT += xml svg network sql widgets printsupport concurrent KWidgetsAddons KCoreAddons
|
||||
QT += xml svg network sql widgets printsupport concurrent KWidgetsAddons KCoreAddons gui-private
|
||||
|
||||
# Private Qt GUI headers (needed for QPdfEngine::drawHyperlink)
|
||||
# gui-private should add this automatically, but some distros need it explicit
|
||||
INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtGui/$$[QT_VERSION]/QtGui
|
||||
|
||||
# UI DESIGNER FILES AND GENERATION SOURCES FILES
|
||||
FORMS += $$files(sources/richtext/*.ui) \
|
||||
|
||||
@@ -222,6 +222,7 @@
|
||||
<file>ico/24x16/dk.png</file>
|
||||
<file>ico/24x16/br.png</file>
|
||||
<file>ico/22x22/grid.png</file>
|
||||
<file>ico/22x22/guides.png</file>
|
||||
<file>ico/22x22/terminalstrip.png</file>
|
||||
<file>ico/16x16/diagram.png</file>
|
||||
<file>ico/16x16/edit-clear-locationbar-rtl.png</file>
|
||||
|
||||
@@ -469,7 +469,7 @@ bool ElementCollectionHandler::setNames(ElementsLocation &location,
|
||||
root.appendChild(name_list.toXml(document));
|
||||
|
||||
QString filepath = location.fileSystemPath()
|
||||
+ "/qet_directory";
|
||||
% "/qet_directory";
|
||||
if (!QET::writeXmlFile(document, filepath)) {
|
||||
qDebug() << "ElementCollectionHandler::setNames : write qet-directory file failed";
|
||||
return false;
|
||||
|
||||
@@ -538,6 +538,16 @@ QList<QETProject *> ElementsCollectionModel::project() const
|
||||
*/
|
||||
void ElementsCollectionModel::highlightUnusedElement()
|
||||
{
|
||||
//Reset only the items currently highlighted in red, so elements that
|
||||
//are no longer unused lose the highlight. Scoping to the red
|
||||
//Dense4Pattern avoids touching other backgrounds (e.g. the amber
|
||||
//"show this dir" highlight) and avoids needless updates on big
|
||||
//collections (issue #159).
|
||||
for (ElementCollectionItem *eci : items())
|
||||
if (eci->background().style() == Qt::Dense4Pattern &&
|
||||
eci->background().color() == Qt::red)
|
||||
eci->setBackground(QBrush());
|
||||
|
||||
QList <ElementsLocation> unused;
|
||||
|
||||
foreach (QETProject *project, m_project_list)
|
||||
|
||||
@@ -523,7 +523,9 @@ bool ElementsLocation::isCompanyCollection() const
|
||||
*/
|
||||
bool ElementsLocation::isCustomCollection() const
|
||||
{
|
||||
return fileSystemPath().startsWith(QETApp::customElementsDirN());
|
||||
const QString dir = QETApp::customElementsDirN();
|
||||
const QString path = fileSystemPath();
|
||||
return path == dir || path.startsWith(dir + QLatin1Char('/'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -701,11 +703,11 @@ pugi::xml_document ElementsLocation::pugiXml() const
|
||||
if (!m_project)
|
||||
{
|
||||
#ifndef Q_OS_LINUX
|
||||
if (docu.load_file(m_file_system_path.toStdString().c_str())) {
|
||||
if (docu.load_file(m_file_system_path.toStdWString().c_str())) {
|
||||
docu.save(m_string_stream);
|
||||
}
|
||||
#else
|
||||
docu.load_file(m_file_system_path.toStdString().c_str());
|
||||
docu.load_file(m_file_system_path.toStdWString().c_str());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
||||
@@ -138,7 +138,7 @@ QString FileElementCollectionItem::localName()
|
||||
{
|
||||
QString str(fileSystemPath() % "/qet_directory");
|
||||
pugi::xml_document docu;
|
||||
if(docu.load_file(str.toStdString().c_str()))
|
||||
if(docu.load_file(str.toStdWString().c_str()))
|
||||
{
|
||||
if (QString(docu.document_element().name())
|
||||
== "qet-directory")
|
||||
@@ -274,7 +274,9 @@ bool FileElementCollectionItem::isCompanyCollection() const
|
||||
*/
|
||||
bool FileElementCollectionItem::isCustomCollection() const
|
||||
{
|
||||
return fileSystemPath().startsWith(QETApp::customElementsDirN());
|
||||
const QString dir = QETApp::customElementsDirN();
|
||||
const QString path = fileSystemPath();
|
||||
return path == dir || path.startsWith(dir + QLatin1Char('/'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "searchandreplaceworker.h"
|
||||
|
||||
#include "../qetproject.h"
|
||||
#include "../QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "../diagram.h"
|
||||
#include "../diagramcommands.h"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstripitem.h"
|
||||
|
||||
#include "../../qetproject.h"
|
||||
|
||||
#include "../diagram.h"
|
||||
#include "../../project/projectpropertieshandler.h"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
#include "addterminalstripitemdialog.h"
|
||||
#include "ui_addterminalstripitemdialog.h"
|
||||
|
||||
#include "../../qetproject.h"
|
||||
#include "../../undocommand/addgraphicsobjectcommand.h"
|
||||
#include "../terminalstrip.h"
|
||||
#include "../GraphicsItem/terminalstripitem.h"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "../qetgraphicsitem/conductor.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
#include "../qetxml.h"
|
||||
|
||||
#include "../qetproject.h"
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <utility>
|
||||
|
||||
@@ -0,0 +1,828 @@
|
||||
/*
|
||||
Copyright 2006-2025 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/>.
|
||||
*/
|
||||
#include "cli_export.h"
|
||||
|
||||
#include "bordertitleblock.h"
|
||||
#include "conductornumexport.h"
|
||||
#include "conductorproperties.h"
|
||||
#include "dataBase/projectdatabase.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramcontext.h"
|
||||
#include "pdf_links.h"
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
#include "qetgraphicsitem/element.h"
|
||||
#include "qetgraphicsitem/terminal.h"
|
||||
#include "qetproject.h"
|
||||
#include "titleblockproperties.h"
|
||||
#include "wiringlistexport.h"
|
||||
|
||||
// Private Qt PDF engine for drawHyperlink() — see pdf_links / projectprintwindow.
|
||||
#include <private/qpdf_p.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QDomDocument>
|
||||
#include <QDate>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QMap>
|
||||
#include <QPageLayout>
|
||||
#include <QPair>
|
||||
#include <QPainter>
|
||||
#include <QPdfWriter>
|
||||
#include <QSet>
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
#include <QSvgGenerator>
|
||||
#include <QTextStream>
|
||||
#include <QTransform>
|
||||
|
||||
namespace {
|
||||
|
||||
QTextStream out(stdout);
|
||||
QTextStream err(stderr);
|
||||
|
||||
/// All CLI option flags, mapped to a short format name.
|
||||
const QHash<QString, QString> &exportFlags()
|
||||
{
|
||||
static const QHash<QString, QString> flags {
|
||||
{"--export-pdf", "pdf"},
|
||||
{"--export-png", "png"},
|
||||
{"--export-svg", "svg"},
|
||||
{"--export-cables", "cables"},
|
||||
{"--export-wires", "wires"},
|
||||
{"--export-bom", "bom"},
|
||||
{"--export-nets", "nets"},
|
||||
{"--export-links", "links"},
|
||||
{"--info", "info"},
|
||||
{"--check-elements", "check"},
|
||||
{"--resave", "resave"},
|
||||
{"--set-titleblock", "settb"},
|
||||
};
|
||||
return flags;
|
||||
}
|
||||
|
||||
/// Device tag of an element ("K1", "Q55"), falling back to its name.
|
||||
QString elementLabel(Element *element)
|
||||
{
|
||||
const QString label = element->elementInformations()["label"].toString();
|
||||
return label.isEmpty() ? element->name() : label;
|
||||
}
|
||||
|
||||
/// Pixel rect of a diagram's border + title block (the printable page area).
|
||||
QRect diagramRect(Diagram *diagram)
|
||||
{
|
||||
QRectF r = diagram->border_and_titleblock.borderAndTitleBlockRect();
|
||||
r.adjust(0, 0, 1, 1); // include the 1px border line
|
||||
return r.toAlignedRect();
|
||||
}
|
||||
|
||||
/// A filesystem-safe per-diagram file stem: "01_Title".
|
||||
QString diagramStem(Diagram *diagram, int index)
|
||||
{
|
||||
QString title = diagram->title();
|
||||
title.replace(QRegularExpression("[^\\w \\-]"), "_");
|
||||
title = title.simplified();
|
||||
if (title.isEmpty())
|
||||
title = "diagram";
|
||||
return QStringLiteral("%1_%2")
|
||||
.arg(index, 2, 10, QChar('0'))
|
||||
.arg(title);
|
||||
}
|
||||
|
||||
/// Render @p diagram into @p painter, fitting @p target to the page rect.
|
||||
void renderDiagram(Diagram *diagram, QPainter &painter, const QRectF &target)
|
||||
{
|
||||
const QRect source = diagramRect(diagram);
|
||||
// Export without the editor grid: drawBackground() only paints it when
|
||||
// draw_grid_ is set (default true), so toggle it off around the render
|
||||
// and restore it afterwards.
|
||||
const bool was_drawing_grid = diagram->displayGrid();
|
||||
const bool was_drawing_guides = diagram->displayGuides();
|
||||
diagram->setDisplayGrid(false);
|
||||
diagram->setDisplayGuides(false);
|
||||
diagram->render(&painter, target, source, Qt::KeepAspectRatio);
|
||||
diagram->setDisplayGrid(was_drawing_grid);
|
||||
diagram->setDisplayGuides(was_drawing_guides);
|
||||
}
|
||||
|
||||
int exportPdf(QETProject &project, const QString &output)
|
||||
{
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
if (diagrams.isEmpty()) {
|
||||
err << "No diagrams to export.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Page numbers (1-based) for cross-reference hyperlink targets: each
|
||||
// diagram is exactly one page in the CLI export (no tiling).
|
||||
QMap<Diagram *, int> pageMap;
|
||||
for (int i = 0; i < diagrams.size(); ++i)
|
||||
pageMap.insert(diagrams.at(i), i + 1);
|
||||
|
||||
QPdfWriter writer(output);
|
||||
writer.setCreator("QElectroTech");
|
||||
writer.setResolution(96);
|
||||
|
||||
QPainter painter;
|
||||
bool first = true;
|
||||
for (Diagram *diagram : diagrams) {
|
||||
const QRect r = diagramRect(diagram);
|
||||
// Match the page to the diagram (in points: 1px @ 96dpi = 0.75pt).
|
||||
const QPageSize page(QSizeF(r.width() * 72.0 / 96.0,
|
||||
r.height() * 72.0 / 96.0),
|
||||
QPageSize::Point);
|
||||
writer.setPageSize(page);
|
||||
writer.setPageMargins(QMarginsF(0, 0, 0, 0));
|
||||
|
||||
if (first) {
|
||||
if (!painter.begin(&writer)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
first = false;
|
||||
} else {
|
||||
writer.newPage();
|
||||
}
|
||||
const QRectF target(0, 0,
|
||||
writer.width(), writer.height());
|
||||
renderDiagram(diagram, painter, target);
|
||||
|
||||
// Inject clickable cross-reference / folio-report hyperlinks for this
|
||||
// page. The geometry is rebuilt from the QPdfWriter (not a QPrinter):
|
||||
// render() anchors the diagram top-left with KeepAspectRatio, and the
|
||||
// page is sized to the diagram so the scale is ~1.
|
||||
if (auto *engine = dynamic_cast<QPdfEngine *>(painter.paintEngine())) {
|
||||
const QRectF source(r);
|
||||
const qreal s = qMin(target.width() / source.width(),
|
||||
target.height() / source.height());
|
||||
QTransform fit;
|
||||
fit.translate(target.x(), target.y());
|
||||
fit.scale(s, s);
|
||||
fit.translate(-source.x(), -source.y());
|
||||
|
||||
// Device pixels -> PDF points, replicating the engine's page matrix
|
||||
// (72/resolution scale + Y flip; zero margins -> no paint offset).
|
||||
const qreal pt_scale = 72.0 / writer.resolution();
|
||||
const qreal fullH_pt = writer.pageLayout().fullRectPoints().height();
|
||||
const bool fullPageMode =
|
||||
(writer.pageLayout().mode() == QPageLayout::FullPageMode);
|
||||
const QRect paintPx =
|
||||
writer.pageLayout().paintRectPixels(writer.resolution());
|
||||
|
||||
PdfLinks::PageGeometry geom;
|
||||
geom.sceneToDevice = fit;
|
||||
geom.target = target;
|
||||
geom.pageBounds = QRectF(0, 0, target.width(), target.height());
|
||||
geom.devToPdf = [=](const QPointF &d) -> QPointF {
|
||||
qreal dx = d.x(), dy = d.y();
|
||||
if (!fullPageMode) { dx += paintPx.left(); dy += paintPx.top(); }
|
||||
return QPointF(pt_scale * dx, fullH_pt - pt_scale * dy);
|
||||
};
|
||||
geom.sourceRectOf = [](Diagram *dg) {
|
||||
return QRectF(diagramRect(dg));
|
||||
};
|
||||
PdfLinks::injectCrossRefLinks(engine, diagram, geom, pageMap, output);
|
||||
}
|
||||
}
|
||||
painter.end();
|
||||
|
||||
// Rewrite the URI link annotations into native internal GoTo actions, so
|
||||
// the cross-references jump inside the document in any PDF viewer.
|
||||
PdfLinks::convertUriToGoTo(output);
|
||||
|
||||
out << "Exported " << diagrams.size() << " page(s) -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exportImages(QETProject &project, const QString &format,
|
||||
const QString &out_dir)
|
||||
{
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
if (diagrams.isEmpty()) {
|
||||
err << "No diagrams to export.\n";
|
||||
return 1;
|
||||
}
|
||||
QDir().mkpath(out_dir);
|
||||
|
||||
int index = 0;
|
||||
for (Diagram *diagram : diagrams) {
|
||||
++index;
|
||||
const QRect r = diagramRect(diagram);
|
||||
const QString path = QDir(out_dir).filePath(
|
||||
diagramStem(diagram, index) + "." + format);
|
||||
|
||||
if (format == "svg") {
|
||||
QSvgGenerator gen;
|
||||
gen.setFileName(path);
|
||||
gen.setSize(r.size());
|
||||
gen.setViewBox(QRect(0, 0, r.width(), r.height()));
|
||||
gen.setTitle(diagram->title());
|
||||
QPainter painter(&gen);
|
||||
renderDiagram(diagram, painter, QRectF(QPointF(0, 0), r.size()));
|
||||
painter.end();
|
||||
} else { // png
|
||||
QImage image(r.size(), QImage::Format_ARGB32);
|
||||
image.fill(Qt::white);
|
||||
QPainter painter(&image);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
renderDiagram(diagram, painter, QRectF(QPointF(0, 0), r.size()));
|
||||
painter.end();
|
||||
if (!image.save(path)) {
|
||||
err << "Failed to write '" << path << "'.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
out << " " << path << "\n";
|
||||
}
|
||||
out << "Exported " << diagrams.size() << " diagram(s) -> " << out_dir << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exportCsv(QETProject &project, const QString &format, const QString &output)
|
||||
{
|
||||
QString csv;
|
||||
if (format == "cables") {
|
||||
WiringListExport wle(&project, nullptr);
|
||||
csv = wle.toCsvString();
|
||||
} else { // wires
|
||||
ConductorNumExport cne(&project, nullptr);
|
||||
csv = cne.wiresNum();
|
||||
}
|
||||
if (csv.isEmpty()) {
|
||||
err << "Nothing to export (empty list).\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << csv;
|
||||
file.close();
|
||||
out << "Exported " << format << " list -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Quote a field for CSV output (RFC-4180 style, ';' delimiter).
|
||||
QString csvField(const QString &value)
|
||||
{
|
||||
if (value.contains(';') || value.contains('"')
|
||||
|| value.contains('\n') || value.contains('\r')) {
|
||||
QString v = value;
|
||||
v.replace('"', "\"\"");
|
||||
return '"' % v % '"';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/// Bill of materials: one row per element, key component-data fields.
|
||||
/// Pulls from QET's own project database (the same source as the GUI BOM
|
||||
/// export), so the output matches what the editor produces.
|
||||
int exportBom(QETProject &project, const QString &output)
|
||||
{
|
||||
// The project database is built lazily; force a (re)build before querying.
|
||||
project.dataBase()->updateDB();
|
||||
|
||||
static const QStringList columns {
|
||||
"label", "designation", "manufacturer", "manufacturer_reference",
|
||||
"quantity", "location", "function", "title", "folio"
|
||||
};
|
||||
|
||||
QSqlQuery query = project.dataBase()->newQuery(
|
||||
"SELECT " % columns.join(", ") %
|
||||
" FROM element_nomenclature_view ORDER BY label");
|
||||
if (!query.exec()) {
|
||||
err << "BOM query failed: " << query.lastError().text() << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
QString csv = columns.join(";") % "\n";
|
||||
int rows = 0;
|
||||
while (query.next()) {
|
||||
QStringList values;
|
||||
for (int i = 0; i < columns.size(); ++i)
|
||||
values << csvField(query.value(i).toString());
|
||||
csv += values.join(";") % "\n";
|
||||
++rows;
|
||||
}
|
||||
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << csv;
|
||||
file.close();
|
||||
out << "Exported " << rows << " component(s) -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Count terminals on @p element that no conductor connects to.
|
||||
int freeTerminals(Element *element)
|
||||
{
|
||||
int free = 0;
|
||||
const QList<Terminal *> terminals = element->terminals();
|
||||
for (Terminal *t : terminals)
|
||||
if (t->conductorsCount() == 0)
|
||||
++free;
|
||||
return free;
|
||||
}
|
||||
|
||||
/// Structural ground-truth dump of a project, as JSON, to stdout (or a file).
|
||||
/// Uses QET's own loaded model, so it reports what the editor actually sees:
|
||||
/// per-page element / conductor counts and unconnected terminals.
|
||||
int exportInfo(QETProject &project, const QString &output)
|
||||
{
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
|
||||
int total_elements = 0, total_conductors = 0, total_free = 0;
|
||||
QJsonArray pages;
|
||||
int index = 0;
|
||||
for (Diagram *diagram : diagrams) {
|
||||
++index;
|
||||
const QList<Element *> elements = diagram->elements();
|
||||
const int conductors = diagram->conductors().size();
|
||||
int page_free = 0;
|
||||
for (Element *e : elements)
|
||||
page_free += freeTerminals(e);
|
||||
|
||||
const QRect r = diagramRect(diagram);
|
||||
QJsonObject page;
|
||||
page["index"] = index;
|
||||
page["title"] = diagram->title();
|
||||
page["folio"] = QStringLiteral("%1 of %2")
|
||||
.arg(index).arg(diagrams.size());
|
||||
page["width_px"] = r.width();
|
||||
page["height_px"] = r.height();
|
||||
page["elements"] = elements.size();
|
||||
page["conductors"] = conductors;
|
||||
page["free_terminals"] = page_free;
|
||||
pages.append(page);
|
||||
|
||||
total_elements += elements.size();
|
||||
total_conductors += conductors;
|
||||
total_free += page_free;
|
||||
}
|
||||
|
||||
QJsonObject root;
|
||||
root["project"] = project.title();
|
||||
root["diagrams"] = diagrams.size();
|
||||
root["elements"] = total_elements;
|
||||
root["conductors"] = total_conductors;
|
||||
root["free_terminals"] = total_free;
|
||||
root["pages"] = pages;
|
||||
|
||||
const QByteArray json =
|
||||
QJsonDocument(root).toJson(QJsonDocument::Indented);
|
||||
|
||||
if (output.isEmpty()) {
|
||||
out << QString::fromUtf8(json);
|
||||
} else {
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
file.write(json);
|
||||
file.close();
|
||||
out << "Wrote project info -> " << output << "\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Validate one .elmt file against QET's element schema.
|
||||
/// @return 0 = OK, 1 = warning (loads but suspicious), 2 = failure.
|
||||
int checkOneElement(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
out << "FAIL " << path << " (cannot open)\n";
|
||||
return 2;
|
||||
}
|
||||
QDomDocument doc;
|
||||
QString error;
|
||||
int line = 0;
|
||||
if (!doc.setContent(&file, &error, &line)) {
|
||||
file.close();
|
||||
out << "FAIL " << path << " (XML error line "
|
||||
<< line << ": " << error << ")\n";
|
||||
return 2;
|
||||
}
|
||||
file.close();
|
||||
|
||||
const QDomElement root = doc.documentElement();
|
||||
if (root.tagName() != "definition" || root.attribute("type") != "element") {
|
||||
out << "FAIL " << path << " (root is not <definition type=\"element\">)\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
bool w_ok = false, h_ok = false;
|
||||
const double w = root.attribute("width").toDouble(&w_ok);
|
||||
const double h = root.attribute("height").toDouble(&h_ok);
|
||||
if (!w_ok || !h_ok || w == 0 || h == 0) {
|
||||
out << "FAIL " << path << " (missing/zero bounding box "
|
||||
<< root.attribute("width") << "x"
|
||||
<< root.attribute("height") << ")\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
const int terminals = root.elementsByTagName("terminal").count();
|
||||
|
||||
// Negative dimensions are malformed but QET still loads them; surface as a
|
||||
// warning rather than a failure so this agrees with QET's own loader.
|
||||
if (w < 0 || h < 0) {
|
||||
out << "WARN " << path << " (negative bounding box "
|
||||
<< w << "x" << h << ", " << terminals << " terminals)\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (terminals == 0) {
|
||||
out << "WARN " << path << " (loads, but 0 terminals)\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
out << "OK " << path << " (" << terminals << " terminals)\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Validate a single .elmt file or every .elmt under a directory.
|
||||
int checkElements(const QString &path)
|
||||
{
|
||||
QStringList files;
|
||||
const QFileInfo info(path);
|
||||
if (info.isDir()) {
|
||||
QDirIterator it(path, {"*.elmt"}, QDir::Files,
|
||||
QDirIterator::Subdirectories);
|
||||
while (it.hasNext())
|
||||
files << it.next();
|
||||
files.sort();
|
||||
} else if (info.isFile()) {
|
||||
files << path;
|
||||
} else {
|
||||
err << "Not found: " << path << "\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (files.isEmpty()) {
|
||||
err << "No .elmt files found under: " << path << "\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
int warnings = 0, failures = 0;
|
||||
for (const QString &f : files) {
|
||||
const int r = checkOneElement(f);
|
||||
if (r == 1) ++warnings;
|
||||
else if (r == 2) ++failures;
|
||||
}
|
||||
out << files.size() << " file(s), " << warnings
|
||||
<< " warning(s), " << failures << " failure(s)\n";
|
||||
return failures > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
/// Map every element in the project to its 1-based folio (page) position.
|
||||
QHash<Element *, int> folioIndex(QETProject &project)
|
||||
{
|
||||
QHash<Element *, int> folio;
|
||||
int index = 0;
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
for (Diagram *diagram : diagrams) {
|
||||
++index;
|
||||
const QList<Element *> elements = diagram->elements();
|
||||
for (Element *e : elements)
|
||||
folio.insert(e, index);
|
||||
}
|
||||
return folio;
|
||||
}
|
||||
|
||||
/// Electrical nets: groups of terminals joined into one potential.
|
||||
/// Walks QET's own potential graph, so each net is a connected component
|
||||
/// of terminals across all folios. The ground truth for connectivity.
|
||||
int exportNets(QETProject &project, const QString &output)
|
||||
{
|
||||
const QHash<Element *, int> folio = folioIndex(project);
|
||||
|
||||
QList<Conductor *> all_conductors;
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
for (Diagram *diagram : diagrams)
|
||||
all_conductors << diagram->conductors();
|
||||
|
||||
QSet<Conductor *> visited;
|
||||
QJsonArray nets;
|
||||
int net_no = 0;
|
||||
for (Conductor *c : all_conductors) {
|
||||
if (visited.contains(c))
|
||||
continue;
|
||||
|
||||
// The whole potential this conductor belongs to. relatedPotential-
|
||||
// Conductors() also fills t_list with every terminal in the net
|
||||
// (following folio reports and terminal blocks too).
|
||||
QList<Terminal *> t_list;
|
||||
QSet<Conductor *> group = c->relatedPotentialConductors(true, &t_list);
|
||||
group.insert(c);
|
||||
for (Conductor *g : group)
|
||||
visited.insert(g);
|
||||
if (c->terminal1) t_list << c->terminal1;
|
||||
if (c->terminal2) t_list << c->terminal2;
|
||||
|
||||
// Wire number: smallest non-empty conductor text (deterministic).
|
||||
QStringList wire_nos;
|
||||
for (Conductor *g : group)
|
||||
if (!g->properties().text.isEmpty())
|
||||
wire_nos << g->properties().text;
|
||||
wire_nos.sort();
|
||||
|
||||
++net_no;
|
||||
QJsonArray terminals;
|
||||
QSet<Terminal *> seen;
|
||||
for (Terminal *t : t_list) {
|
||||
if (!t || seen.contains(t))
|
||||
continue;
|
||||
seen.insert(t);
|
||||
Element *pe = t->parentElement();
|
||||
QJsonObject to;
|
||||
to["element"] = pe ? elementLabel(pe) : QString();
|
||||
to["terminal"] = t->name();
|
||||
to["folio"] = pe ? folio.value(pe, 0) : 0;
|
||||
terminals.append(to);
|
||||
}
|
||||
QJsonObject net;
|
||||
net["net"] = net_no;
|
||||
net["wire_no"] = wire_nos.value(0);
|
||||
net["terminals"] = terminals;
|
||||
nets.append(net);
|
||||
}
|
||||
|
||||
QJsonObject root;
|
||||
root["project"] = project.title();
|
||||
root["nets"] = nets.size();
|
||||
root["list"] = nets;
|
||||
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
file.write(QJsonDocument(root).toJson(QJsonDocument::Indented));
|
||||
file.close();
|
||||
out << "Exported " << nets.size() << " net(s) -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Cross-references: each linkable element (coil / contact / report) and the
|
||||
/// elements it links to, flagging masters/slaves with no link as unresolved.
|
||||
int exportLinks(QETProject &project, const QString &output)
|
||||
{
|
||||
const QHash<Element *, int> folio = folioIndex(project);
|
||||
|
||||
QString csv("element;link_type;linked_to;folio;status\n");
|
||||
int linkable = 0, unresolved = 0;
|
||||
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
for (Diagram *diagram : diagrams) {
|
||||
const QList<Element *> elements = diagram->elements();
|
||||
for (Element *e : elements) {
|
||||
if (e->linkType() == Element::Simple)
|
||||
continue;
|
||||
++linkable;
|
||||
|
||||
const QList<Element *> linked = e->linkedElements();
|
||||
QStringList names;
|
||||
for (Element *le : linked)
|
||||
names << elementLabel(le) % "(f"
|
||||
% QString::number(folio.value(le, 0)) % ")";
|
||||
|
||||
QString status = "linked";
|
||||
if ((e->linkType() == Element::Master
|
||||
|| e->linkType() == Element::Slave)
|
||||
&& linked.isEmpty()) {
|
||||
status = "UNRESOLVED";
|
||||
++unresolved;
|
||||
}
|
||||
|
||||
csv += csvField(elementLabel(e)) % ";"
|
||||
% e->linkTypeToString() % ";"
|
||||
% csvField(names.join(", ")) % ";"
|
||||
% QString::number(folio.value(e, 0)) % ";"
|
||||
% status % "\n";
|
||||
}
|
||||
}
|
||||
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << csv;
|
||||
file.close();
|
||||
out << "Exported " << linkable << " linkable element(s), "
|
||||
<< unresolved << " unresolved -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Round-trip: load the project and write its XML back out, so an external
|
||||
/// diff can reveal markup QET silently normalises (tolerated-but-invalid XML).
|
||||
int resaveProject(QETProject &project, const QString &output)
|
||||
{
|
||||
const QDomDocument doc = project.toXml();
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << doc.toString(4);
|
||||
file.close();
|
||||
out << "Re-saved project -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Stamp title-block fields onto every folio (and the project default), then
|
||||
/// save. Each assignment is "key=value". Standard keys map to the documented
|
||||
/// title-block fields; "date=today" uses the current date; any other key is
|
||||
/// stored as a custom title-block field. Aimed at CI/revision workflows
|
||||
/// (e.g. set revision + date before exporting a new revision).
|
||||
int setTitleBlock(QETProject &project, const QString &output,
|
||||
const QStringList &assignments)
|
||||
{
|
||||
if (assignments.isEmpty()) {
|
||||
err << "No field assignments given (expected key=value).\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Parse "key=value" assignments up front so a bad one fails before writing.
|
||||
QList<QPair<QString, QString>> fields;
|
||||
for (const QString &a : assignments) {
|
||||
const int eq = a.indexOf('=');
|
||||
if (eq <= 0) {
|
||||
err << "Bad assignment '" << a << "' (expected key=value).\n";
|
||||
return 2;
|
||||
}
|
||||
const QString key = a.left(eq);
|
||||
const QString val = a.mid(eq + 1);
|
||||
if (key.compare("date", Qt::CaseInsensitive) == 0
|
||||
&& val.compare("today", Qt::CaseInsensitive) != 0
|
||||
&& !QDate::fromString(val, Qt::ISODate).isValid()) {
|
||||
err << "Bad date '" << val << "' (expected YYYY-MM-DD or 'today').\n";
|
||||
return 2;
|
||||
}
|
||||
fields << qMakePair(key, val);
|
||||
}
|
||||
|
||||
auto apply = [&](TitleBlockProperties &p) {
|
||||
for (const auto &f : fields) {
|
||||
const QString k = f.first.toLower();
|
||||
const QString &v = f.second;
|
||||
if (k == "title") p.title = v;
|
||||
else if (k == "author") p.author = v;
|
||||
else if (k == "filename") p.filename = v;
|
||||
else if (k == "plant") p.plant = v;
|
||||
else if (k == "location") p.locmach = v;
|
||||
else if (k == "revision") p.indexrev = v;
|
||||
else if (k == "version") p.version = v;
|
||||
else if (k == "date") {
|
||||
p.date = (v.compare("today", Qt::CaseInsensitive) == 0)
|
||||
? QDate::currentDate()
|
||||
: QDate::fromString(v, Qt::ISODate);
|
||||
// An explicit date is only honoured when the folio is in
|
||||
// "use the date value" mode (not "now"/"null").
|
||||
p.useDate = TitleBlockProperties::UseDateValue;
|
||||
}
|
||||
else // unknown key -> custom title-block field
|
||||
p.context.addValue(f.first, v);
|
||||
}
|
||||
};
|
||||
|
||||
// Project default (the template applied to new folios).
|
||||
TitleBlockProperties def = project.defaultTitleBlockProperties();
|
||||
apply(def);
|
||||
project.setDefaultTitleBlockProperties(def);
|
||||
|
||||
// Every existing folio's own title block.
|
||||
int folios = 0;
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
for (Diagram *diagram : diagrams) {
|
||||
TitleBlockProperties p =
|
||||
diagram->border_and_titleblock.exportTitleBlock();
|
||||
apply(p);
|
||||
diagram->border_and_titleblock.importTitleBlock(p);
|
||||
++folios;
|
||||
}
|
||||
|
||||
const QDomDocument doc = project.toXml();
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << doc.toString(4);
|
||||
file.close();
|
||||
out << "Stamped " << fields.size() << " field(s) on "
|
||||
<< folios << " folio(s) -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace CLIExport {
|
||||
|
||||
bool isExportRequest(const QStringList &args)
|
||||
{
|
||||
for (const QString &a : args)
|
||||
if (exportFlags().contains(a))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int run(const QStringList &args)
|
||||
{
|
||||
QString flag;
|
||||
QStringList rest;
|
||||
for (int i = 0; i < args.size(); ++i) {
|
||||
if (exportFlags().contains(args.at(i))) {
|
||||
flag = args.at(i);
|
||||
for (int j = i + 1; j < args.size(); ++j)
|
||||
rest << args.at(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const QString format = exportFlags().value(flag);
|
||||
|
||||
// --check-elements operates on an element file/directory, not a project.
|
||||
if (format == "check") {
|
||||
if (rest.isEmpty()) {
|
||||
err << "Usage: qelectrotech --check-elements "
|
||||
"<element.elmt | directory>\n";
|
||||
return 2;
|
||||
}
|
||||
return checkElements(rest.at(0));
|
||||
}
|
||||
|
||||
const QString input = rest.value(0);
|
||||
if (input.isEmpty()) {
|
||||
err << "Usage: qelectrotech " << flag << " <project.qet> <output>\n";
|
||||
return 2;
|
||||
}
|
||||
if (!QFileInfo::exists(input)) {
|
||||
err << "Project not found: " << input << "\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
QETProject project(input);
|
||||
if (project.state() != QETProject::Ok) {
|
||||
err << "Failed to open project: " << input
|
||||
<< " (state " << project.state() << ")\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// --info writes JSON to stdout, or to an optional output file.
|
||||
if (format == "info")
|
||||
return exportInfo(project, rest.value(1));
|
||||
|
||||
const QString output = rest.value(1);
|
||||
if (output.isEmpty()) {
|
||||
err << "Usage: qelectrotech " << flag
|
||||
<< " <project.qet> <output>\n";
|
||||
return 2;
|
||||
}
|
||||
if (format == "pdf")
|
||||
return exportPdf(project, output);
|
||||
if (format == "cables" || format == "wires")
|
||||
return exportCsv(project, format, output);
|
||||
if (format == "bom")
|
||||
return exportBom(project, output);
|
||||
if (format == "nets")
|
||||
return exportNets(project, output);
|
||||
if (format == "links")
|
||||
return exportLinks(project, output);
|
||||
if (format == "resave")
|
||||
return resaveProject(project, output);
|
||||
if (format == "settb")
|
||||
return setTitleBlock(project, output, rest.mid(2));
|
||||
return exportImages(project, format, output);
|
||||
}
|
||||
|
||||
} // namespace CLIExport
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright 2006-2025 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/>.
|
||||
*/
|
||||
#ifndef CLI_EXPORT_H
|
||||
#define CLI_EXPORT_H
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
/**
|
||||
@brief Headless command-line export.
|
||||
|
||||
Implements the long-requested batch/headless export
|
||||
(qelectrotech.org bugtracker #171, GitHub #309): render a project's
|
||||
diagrams to files without opening the GUI.
|
||||
|
||||
Detected and handled in main() before the GUI is created.
|
||||
*/
|
||||
namespace CLIExport {
|
||||
|
||||
/**
|
||||
@brief True if @p args request a CLI export
|
||||
(i.e. contain one of the export options).
|
||||
*/
|
||||
bool isExportRequest(const QStringList &args);
|
||||
|
||||
/**
|
||||
@brief Run the CLI export described by @p args.
|
||||
@return process exit code (0 on success).
|
||||
|
||||
Usage:
|
||||
qelectrotech --export-pdf <project.qet> <output.pdf>
|
||||
qelectrotech --export-png <project.qet> <output_dir>
|
||||
qelectrotech --export-svg <project.qet> <output_dir>
|
||||
qelectrotech --export-cables <project.qet> <output.csv>
|
||||
qelectrotech --export-wires <project.qet> <output.csv>
|
||||
qelectrotech --export-bom <project.qet> <output.csv>
|
||||
qelectrotech --export-nets <project.qet> <output.json>
|
||||
qelectrotech --export-links <project.qet> <output.csv>
|
||||
qelectrotech --info <project.qet> [output.json]
|
||||
qelectrotech --check-elements <element.elmt | directory>
|
||||
qelectrotech --resave <project.qet> <output.qet>
|
||||
qelectrotech --set-titleblock <project.qet> <output.qet> key=value...
|
||||
|
||||
PDF: one multi-page document (one diagram per page).
|
||||
PNG/SVG: one file per diagram, named <output_dir>/<NN>_<title>.<ext>.
|
||||
cables: wiring list (one row per conductor) as CSV.
|
||||
wires: list of distinct wire numbers as CSV.
|
||||
bom: bill of materials (one row per element) as CSV.
|
||||
nets: electrical nets (connected-terminal groups) as JSON.
|
||||
links: element cross-references (coil/contact) as CSV, with
|
||||
unresolved links flagged.
|
||||
info: structural project summary as JSON (stdout, or a file) —
|
||||
per-page element / conductor counts and unconnected terminals.
|
||||
check-elements: validate .elmt file(s) against the element schema.
|
||||
resave: load and rewrite the project XML (round-trip integrity).
|
||||
set-titleblock: stamp title-block fields onto every folio, then save.
|
||||
Keys: title, author, date (or date=today), plant, location,
|
||||
revision, version, filename; any other key becomes a custom
|
||||
field. E.g. --set-titleblock in.qet out.qet revision=B date=today
|
||||
*/
|
||||
int run(const QStringList &args);
|
||||
|
||||
}
|
||||
|
||||
#endif // CLI_EXPORT_H
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "conductorautonumerotation.h"
|
||||
|
||||
#include "qetproject.h"
|
||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "autoNum/assignvariables.h"
|
||||
#include "autoNum/numerotationcontextcommands.h"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "conductornumexport.h"
|
||||
|
||||
#include "qetproject.h"
|
||||
#include "qetapp.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramcontent.h"
|
||||
|
||||
@@ -383,7 +383,7 @@ void projectDataBase::createElementNomenclatureView()
|
||||
"ei.supplier_auxiliary4 AS supplier_auxiliary4,"
|
||||
"ei.quantity_auxiliary4 AS quantity_auxiliary4,"
|
||||
"ei.unity_auxiliary4 AS unity_auxiliary4,"
|
||||
|
||||
"ei.exclude_from_bom AS exclude_from_bom,"
|
||||
|
||||
"d.pos AS diagram_position,"
|
||||
"e.type AS element_type,"
|
||||
@@ -392,7 +392,7 @@ void projectDataBase::createElementNomenclatureView()
|
||||
"di.folio AS folio,"
|
||||
"e.pos AS position "
|
||||
" FROM element_info ei, diagram_info di, element e, diagram d"
|
||||
" WHERE ei.element_uuid = e.uuid AND e.diagram_uuid = d.uuid AND di.diagram_uuid = d.uuid");
|
||||
" WHERE ei.element_uuid = e.uuid AND e.diagram_uuid = d.uuid AND di.diagram_uuid = d.uuid AND (ei.exclude_from_bom IS NOT 'true')");
|
||||
|
||||
QSqlQuery query(m_data_base);
|
||||
if (!query.exec(create_view)) {
|
||||
|
||||
@@ -373,6 +373,11 @@ QString ElementQueryWidget::queryStr() const
|
||||
where.clear();
|
||||
}
|
||||
|
||||
QString exclude_condition = "(exclude_from_bom IS NULL OR exclude_from_bom != '1')";
|
||||
|
||||
filter_ += " AND " + exclude_condition;
|
||||
// -------------------------------------------------------------
|
||||
|
||||
if (where.isEmpty() && !filter_.isEmpty()) {
|
||||
filter_.remove(0, 4); //Remove the first " AND" of filter.
|
||||
filter_.prepend( " WHERE");
|
||||
@@ -456,7 +461,7 @@ void ElementQueryWidget::setUpItems()
|
||||
{
|
||||
for(QString key : QETInformation::elementInfoKeys())
|
||||
{
|
||||
if (key == "formula")
|
||||
if (key == "formula" || key == "exclude_from_bom")
|
||||
continue;
|
||||
|
||||
auto item = new QListWidgetItem(QETInformation::translatedInfoKey(key), ui->m_var_list);
|
||||
|
||||
+77
-13
@@ -39,7 +39,7 @@
|
||||
#include "qetxml.h"
|
||||
#include "undocommand/addelementtextcommand.h"
|
||||
#include "qetinformation.h"
|
||||
|
||||
#include "qetproject.h"
|
||||
#include <cassert>
|
||||
#include <math.h>
|
||||
|
||||
@@ -65,7 +65,6 @@ QColor Diagram::background_color = Qt::white;
|
||||
Diagram::Diagram(QETProject *project) :
|
||||
QGraphicsScene (project),
|
||||
m_project (project),
|
||||
draw_grid_ (true),
|
||||
use_border_ (true),
|
||||
draw_terminals_ (true),
|
||||
draw_colored_conductors_ (true),
|
||||
@@ -73,6 +72,11 @@ Diagram::Diagram(QETProject *project) :
|
||||
m_freeze_new_elements (false),
|
||||
m_freeze_new_conductors_ (false)
|
||||
{
|
||||
|
||||
QSettings settings;
|
||||
draw_grid_ = settings.value(QStringLiteral("diagrameditor/grid_display_startup"), true).toBool();
|
||||
draw_guides_ = settings.value(QStringLiteral("diagrameditor/guides_display_startup"), false).toBool();
|
||||
|
||||
setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||
/* Set to no index,
|
||||
* because they can be the source of the crash with conductor and shape ghost.
|
||||
@@ -121,8 +125,30 @@ Diagram::Diagram(QETProject *project) :
|
||||
connect(this, &Diagram::diagramActivated,
|
||||
this, &Diagram::loadCndFolioSeq);
|
||||
adjustSceneRect();
|
||||
}
|
||||
|
||||
m_guides_list.clear();
|
||||
if (m_project) {
|
||||
for (const auto &pg : m_project->defaultGuides()) {
|
||||
Diagram::Guide g;
|
||||
g.orientation = static_cast<Diagram::Guide::Orientation>(pg.orientation);
|
||||
g.position = pg.position;
|
||||
g.color = pg.color;
|
||||
m_guides_list.append(g);
|
||||
}
|
||||
} else {
|
||||
QSettings settings;
|
||||
int size = settings.beginReadArray(QStringLiteral("diagrameditor/defaultguides"));
|
||||
for (int i = 0; i < size; ++i) {
|
||||
settings.setArrayIndex(i);
|
||||
Diagram::Guide g;
|
||||
g.orientation = static_cast<Diagram::Guide::Orientation>(settings.value(QStringLiteral("orientation"), 0).toInt());
|
||||
g.position = settings.value(QStringLiteral("position"), 0.0).toReal();
|
||||
g.color = QColor(settings.value(QStringLiteral("color"), QStringLiteral("#ff0000")).toString());
|
||||
m_guides_list.append(g);
|
||||
}
|
||||
settings.endArray();
|
||||
}
|
||||
}
|
||||
/**
|
||||
@brief Diagram::~Diagram
|
||||
Destructor
|
||||
@@ -186,6 +212,14 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
||||
p -> setBrush(Diagram::background_color);
|
||||
p -> drawRect(r);
|
||||
|
||||
QSettings settings;
|
||||
QRectF rect = settings.value(
|
||||
QStringLiteral("diagrameditor/zoom-out-beyond-of-folio"),
|
||||
false).toBool() ? r
|
||||
: border_and_titleblock
|
||||
.insideBorderRect()
|
||||
.intersected(r);
|
||||
|
||||
if (draw_grid_) {
|
||||
/* Draw the points of the grid
|
||||
* if background color is black,
|
||||
@@ -200,19 +234,10 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
||||
|
||||
p -> setBrush(Qt::NoBrush);
|
||||
|
||||
// If user allow zoom out beyond of folio,
|
||||
// we draw grid outside of border.
|
||||
QSettings settings;
|
||||
int xGrid = settings.value(QStringLiteral("diagrameditor/Xgrid"),
|
||||
Diagram::xGrid).toInt();
|
||||
int yGrid = settings.value(QStringLiteral("diagrameditor/Ygrid"),
|
||||
Diagram::yGrid).toInt();
|
||||
QRectF rect = settings.value(
|
||||
QStringLiteral("diagrameditor/zoom-out-beyond-of-folio"),
|
||||
false).toBool() ? r
|
||||
: border_and_titleblock
|
||||
.insideBorderRect()
|
||||
.intersected(r);
|
||||
|
||||
qreal limit_x = rect.x() + rect.width();
|
||||
qreal limit_y = rect.y() + rect.height();
|
||||
@@ -252,7 +277,23 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
||||
p -> drawPoints(points);
|
||||
}
|
||||
|
||||
if (use_border_) border_and_titleblock.draw(p);
|
||||
if (draw_guides_) {
|
||||
for (const Diagram::Guide &guide : m_guides_list) {
|
||||
QPen guidePen(guide.color, 1, Qt::DashLine);
|
||||
guidePen.setCosmetic(true);
|
||||
p->setPen(guidePen);
|
||||
|
||||
if (guide.orientation == Diagram::Guide::Vertical) {
|
||||
p->drawLine(guide.position, rect.top(), guide.position, rect.bottom());
|
||||
} else {
|
||||
p->drawLine(rect.left(), guide.position, rect.right(), guide.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (use_border_) {
|
||||
border_and_titleblock.draw(p);
|
||||
}
|
||||
|
||||
p -> restore();
|
||||
}
|
||||
|
||||
@@ -2274,6 +2315,7 @@ ExportProperties Diagram::applyProperties(
|
||||
// exporte les options de rendu en cours
|
||||
ExportProperties old_properties;
|
||||
old_properties.draw_grid = displayGrid();
|
||||
old_properties.draw_guides = displayGuides();
|
||||
old_properties.draw_border = border_and_titleblock.borderIsDisplayed();
|
||||
old_properties.draw_titleblock = border_and_titleblock.titleBlockIsDisplayed();
|
||||
old_properties.draw_terminals = drawTerminals();
|
||||
@@ -2287,6 +2329,7 @@ ExportProperties Diagram::applyProperties(
|
||||
setDrawTerminals (new_properties.draw_terminals);
|
||||
setDrawColoredConductors (new_properties.draw_colored_conductors);
|
||||
setDisplayGrid (new_properties.draw_grid);
|
||||
setDisplayGuides (new_properties.draw_guides);
|
||||
border_and_titleblock.displayBorder(new_properties.draw_border);
|
||||
border_and_titleblock.displayTitleBlock (new_properties.draw_titleblock);
|
||||
|
||||
@@ -2635,3 +2678,24 @@ void Diagram::restoreText(Element* elmt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QUndoStack &Diagram::undoStack() {
|
||||
return *(project()->undoStack());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Diagram::updateProjectGuides
|
||||
* Aktualisiert die internen Hilfslinien dieses Schaltplans
|
||||
* basierend auf den Projekt-Einstellungen und erzwingt ein Neuzeichnen.
|
||||
*/
|
||||
void Diagram::updateProjectGuides(const QList<GuideProperties> &guides) {
|
||||
m_guides_list.clear();
|
||||
for (const GuideProperties &pg : guides) {
|
||||
Diagram::Guide g;
|
||||
g.orientation = static_cast<Diagram::Guide::Orientation>(pg.orientation);
|
||||
g.position = pg.position;
|
||||
g.color = pg.color;
|
||||
m_guides_list.append(g);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
+26
-13
@@ -24,7 +24,6 @@
|
||||
#include "elementtextsmover.h"
|
||||
#include "exportproperties.h"
|
||||
#include "properties/xrefproperties.h"
|
||||
#include "qetproject.h"
|
||||
#include "qgimanager.h"
|
||||
|
||||
#include <QHash>
|
||||
@@ -39,12 +38,11 @@ class DiagramPosition;
|
||||
class DiagramTextItem;
|
||||
class Element;
|
||||
class ElementsLocation;
|
||||
class QETProject;
|
||||
class Terminal;
|
||||
class DiagramImageItem;
|
||||
class DiagramEventInterface;
|
||||
class DiagramFolioList;
|
||||
class QETProject;
|
||||
struct GuideProperties;
|
||||
|
||||
/**
|
||||
@brief The Diagram class
|
||||
@@ -67,6 +65,13 @@ class Diagram : public QGraphicsScene
|
||||
|
||||
// ATTRIBUTES
|
||||
public:
|
||||
struct Guide {
|
||||
enum Orientation { Horizontal, Vertical };
|
||||
Orientation orientation;
|
||||
qreal position;
|
||||
QColor color;
|
||||
};
|
||||
|
||||
/**
|
||||
@brief The BorderOptions enum
|
||||
Represents available options when rendering a particular diagram:
|
||||
@@ -119,6 +124,8 @@ class Diagram : public QGraphicsScene
|
||||
|
||||
bool draw_grid_;
|
||||
bool use_border_;
|
||||
bool draw_guides_;
|
||||
QList<Diagram::Guide> m_guides_list;
|
||||
bool draw_terminals_;
|
||||
bool draw_colored_conductors_;
|
||||
|
||||
@@ -142,10 +149,11 @@ class Diagram : public QGraphicsScene
|
||||
void wheelEvent (QGraphicsSceneWheelEvent *event) override;
|
||||
void keyPressEvent (QKeyEvent *event) override;
|
||||
void keyReleaseEvent (QKeyEvent *) override;
|
||||
void correctTextPos(Element* elmt);
|
||||
void restoreText(Element* elmt);
|
||||
|
||||
|
||||
public:
|
||||
void correctTextPos(Element* elmt);
|
||||
void restoreText(Element* elmt);
|
||||
QUuid uuid();
|
||||
void setEventInterface (DiagramEventInterface *event_interface);
|
||||
void clearEventInterface();
|
||||
@@ -206,6 +214,9 @@ class Diagram : public QGraphicsScene
|
||||
ExportProperties applyProperties(const ExportProperties &);
|
||||
void setDisplayGrid(bool);
|
||||
bool displayGrid();
|
||||
void setDisplayGuides(bool);
|
||||
bool displayGuides();
|
||||
void updateProjectGuides(const QList<GuideProperties> &guides);
|
||||
void setUseBorder(bool);
|
||||
bool useBorder();
|
||||
void setBorderOptions(BorderOptions);
|
||||
@@ -340,6 +351,16 @@ inline bool Diagram::displayGrid() {
|
||||
return(draw_grid_);
|
||||
}
|
||||
|
||||
inline void Diagram::setDisplayGuides(bool dg) {
|
||||
if (draw_guides_ != dg) {
|
||||
draw_guides_ = dg;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
inline bool Diagram::displayGuides() {
|
||||
return(draw_guides_);
|
||||
}
|
||||
/**
|
||||
@brief Diagram::setUseBorder
|
||||
Set whether the diagram border (including rows/columns headers and the title
|
||||
@@ -388,14 +409,6 @@ inline Diagram::BorderOptions Diagram::borderOptions() {
|
||||
return(options);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Diagram::undoStack
|
||||
@return the diagram undo stack
|
||||
*/
|
||||
inline QUndoStack &Diagram::undoStack() {
|
||||
return *(project()->undoStack());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Diagram::qgiManager
|
||||
@return the diagram graphics item manager
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "diagrameventaddelement.h"
|
||||
|
||||
#include "../qetproject.h"
|
||||
#include "../conductorautonumerotation.h"
|
||||
#include "../diagram.h"
|
||||
#include "../undocommand/addgraphicsobjectcommand.h"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "diagramview.h"
|
||||
|
||||
#include "qetproject.h"
|
||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "diagramcommands.h"
|
||||
#include "diagramevent/diagrameventaddelement.h"
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "../../QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "../elementscene.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QRegularExpression>
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,8 @@ CustomElementGraphicPart::CustomElementGraphicPart(QETElementEditor *editor,
|
||||
_lineweight(NormalWeight),
|
||||
_filling(NoneFilling),
|
||||
_color(BlackColor),
|
||||
_antialiased(false)
|
||||
_antialiased(false),
|
||||
m_first_move (false)
|
||||
{
|
||||
setFlags(QGraphicsItem::ItemIsSelectable
|
||||
| QGraphicsItem::ItemIsMovable
|
||||
@@ -1332,26 +1334,24 @@ void CustomElementGraphicPart::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
void CustomElementGraphicPart::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
//m_first_move is used to avoid an unwanted behavior
|
||||
//when the properties dock widget is displayed :
|
||||
//1 there is no selection
|
||||
//2 the dock widget width is set to minimum
|
||||
//3 select a part, the dock widget gain new widgets used to edit
|
||||
//the current selected part and the width of the dock grow
|
||||
//so the width of the QGraphicsView is reduced and cause a mouse move event.
|
||||
//When this case occur the part is moved but they should not. This bool fix it.
|
||||
if (Q_UNLIKELY(m_first_move)) {
|
||||
if (m_first_move) {
|
||||
// Suppress spurious move events fired when the properties dock
|
||||
// widget expands on first selection of a new item type, causing
|
||||
// the QGraphicsView to shrink and re-map coordinates. Screen
|
||||
// coordinates are stable across viewport changes; scene coords
|
||||
// are not — so use screenPos() for the threshold check.
|
||||
const QPointF d = event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton);
|
||||
if (d.manhattanLength() < QApplication::startDragDistance())
|
||||
return;
|
||||
m_first_move = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if((event->buttons() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable))
|
||||
{
|
||||
if ((event->buttons() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable)) {
|
||||
QPointF pos = event->scenePos() + (m_origin_pos - event->buttonDownScenePos(Qt::LeftButton));
|
||||
event->modifiers() == Qt::ControlModifier ? setPos(pos) : setPos(elementScene()->snapToGrid(pos));
|
||||
}
|
||||
else
|
||||
} else {
|
||||
QGraphicsObject::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void CustomElementGraphicPart::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "../../QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "../../qetapp.h"
|
||||
#include "../elementscene.h"
|
||||
#include <QApplication>
|
||||
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
@@ -495,12 +496,16 @@ bool PartDynamicTextField::keepVisualRotation() const {
|
||||
@param event
|
||||
*/
|
||||
void PartDynamicTextField::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
|
||||
if((event -> buttons() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable)) {
|
||||
QPointF pos = event -> scenePos() + (m_origin_pos - event -> buttonDownScenePos(Qt::LeftButton));
|
||||
event -> modifiers() == Qt::ControlModifier ? setPos(pos) : setPos(elementScene() -> snapToGrid(pos));
|
||||
}
|
||||
else
|
||||
if ((event->buttons() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable)) {
|
||||
// Suppress spurious moves from the properties dock resizing the viewport.
|
||||
const QPointF d = event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton);
|
||||
if (d.manhattanLength() < QApplication::startDragDistance())
|
||||
return;
|
||||
QPointF pos = event->scenePos() + (m_origin_pos - event->buttonDownScenePos(Qt::LeftButton));
|
||||
event->modifiers() == Qt::ControlModifier ? setPos(pos) : setPos(elementScene()->snapToGrid(pos));
|
||||
} else {
|
||||
QGraphicsObject::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "parttext.h"
|
||||
|
||||
#include "../../QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include <QApplication>
|
||||
#include "../../qetapp.h"
|
||||
#include "../elementprimitivedecorator.h"
|
||||
#include "../elementscene.h"
|
||||
@@ -313,16 +314,25 @@ void PartText::setPlainText(const QString &text) {
|
||||
void PartText::setFont(const QFont &font) {
|
||||
if (font != this -> font()) {
|
||||
QGraphicsTextItem::setFont(font);
|
||||
// Re-anchor: the item's position transform is -margin(), and margin()
|
||||
// depends on the font ascent. Without re-running this on a font change,
|
||||
// the transform keeps the previous font's ascent — so the text renders
|
||||
// at a different spot after save/reopen (the position recomputes from
|
||||
// the saved font on load). See #158.
|
||||
adjustItemPosition();
|
||||
emit fontChanged(font);
|
||||
}
|
||||
}
|
||||
|
||||
void PartText::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
|
||||
if((event -> buttons() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable)) {
|
||||
QPointF pos = event -> scenePos() + (m_origin_pos - event -> buttonDownScenePos(Qt::LeftButton));
|
||||
event -> modifiers() == Qt::ControlModifier ? setPos(pos) : setPos(elementScene() -> snapToGrid(pos));
|
||||
}
|
||||
else {
|
||||
if ((event->buttons() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable)) {
|
||||
// Suppress spurious moves from the properties dock resizing the viewport.
|
||||
const QPointF d = event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton);
|
||||
if (d.manhattanLength() < QApplication::startDragDistance())
|
||||
return;
|
||||
QPointF pos = event->scenePos() + (m_origin_pos - event->buttonDownScenePos(Qt::LeftButton));
|
||||
event->modifiers() == Qt::ControlModifier ? setPos(pos) : setPos(elementScene()->snapToGrid(pos));
|
||||
} else {
|
||||
QGraphicsObject::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,11 +736,13 @@ bool QETElementEditor::checkElement()
|
||||
QList<QETWarning> warnings;
|
||||
QList<QETWarning> errors;
|
||||
|
||||
// Warning #1: Element haven't got terminal
|
||||
// Warning #1: Element does not have (enough) terminals
|
||||
// (except for report and conductor definition, because they must have one terminal and this checking is done below)
|
||||
// (another exception: "thumbnails" aka "front-views" may/should not have terminals)
|
||||
if (!m_elmt_scene -> containsTerminals() &&
|
||||
!(m_elmt_scene->elementData().m_type & ElementData::AllReport) &&
|
||||
m_elmt_scene->elementData().m_type != ElementData::ConductorDefinition) {
|
||||
m_elmt_scene->elementData().m_type != ElementData::ConductorDefinition &&
|
||||
m_elmt_scene->elementData().m_type != ElementData::Thumbnail) {
|
||||
warnings << qMakePair(
|
||||
tr("Absence de borne", "warning title"),
|
||||
tr(
|
||||
@@ -749,50 +751,50 @@ bool QETElementEditor::checkElement()
|
||||
"warning description"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Check folio report element
|
||||
if (m_elmt_scene->elementData().m_type & ElementData::AllReport)
|
||||
{
|
||||
int terminal =0;
|
||||
// Check folio report element
|
||||
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 ++;
|
||||
}
|
||||
}
|
||||
|
||||
//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"));
|
||||
for(auto qgi : m_elmt_scene -> items()) {
|
||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||
terminal ++;
|
||||
}
|
||||
}
|
||||
|
||||
// Check conductor definition element
|
||||
if (m_elmt_scene->elementData().m_type == ElementData::ConductorDefinition)
|
||||
{
|
||||
int terminal =0;
|
||||
//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"));
|
||||
}
|
||||
}
|
||||
|
||||
for(auto qgi : m_elmt_scene -> items()) {
|
||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||
terminal ++;
|
||||
}
|
||||
}
|
||||
// Check conductor definition element
|
||||
if (m_elmt_scene->elementData().m_type == ElementData::ConductorDefinition)
|
||||
{
|
||||
int terminal =0;
|
||||
|
||||
// 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"));
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,17 @@ void ElementDialog::setUpWidget()
|
||||
} else if (m_mode == SaveTemplate) {
|
||||
m_text_field->setPlaceholderText(tr("Nom du nouveau template"));
|
||||
} else {
|
||||
m_text_field->setPlaceholderText(tr("Nom du nouvel élément"));
|
||||
// This is the element's file name, not its display name: the field
|
||||
// only accepts file-name characters (QFileNameEdit). The visible
|
||||
// element name is edited separately in the element properties.
|
||||
m_text_field->setPlaceholderText(
|
||||
tr("Nom de fichier de l'élément",
|
||||
"placeholder: the element's file name, not its display name"));
|
||||
m_text_field->setToolTip(
|
||||
tr("Nom de fichier de l'élément : chiffres, minuscules, « - », "
|
||||
"« _ » et « . » uniquement.\nLe nom affiché de l'élément se "
|
||||
"modifie séparément dans les propriétés de l'élément.",
|
||||
"tooltip for the element file-name field"));
|
||||
}
|
||||
|
||||
layout->addWidget(m_text_field);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementsmover.h"
|
||||
|
||||
#include "qetproject.h"
|
||||
#include "conductorautonumerotation.h"
|
||||
#include "diagram.h"
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementspanelwidget.h"
|
||||
|
||||
#include "diagram.h"
|
||||
#include "editor/ui/qetelementeditor.h"
|
||||
#include "elementscategoryeditor.h"
|
||||
@@ -26,6 +25,7 @@
|
||||
#include "titleblock/templatedeleter.h"
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include "qetgraphicsitem/element.h"
|
||||
|
||||
/*
|
||||
When the ENABLE_PANEL_WIDGET_DND_CHECKS flag is set, the panel
|
||||
@@ -59,7 +59,8 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
||||
prj_close = new QAction(QET::Icons::DocumentClose, tr("Fermer ce projet"), this);
|
||||
prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propriétés du projet"), this);
|
||||
prj_prop_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
|
||||
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
|
||||
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
|
||||
prj_duplicate_diagram = new QAction(QET::Icons::IC_CopyFile, tr("Copier et coller"), this);
|
||||
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce folio"), this);
|
||||
prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce folio"), this);
|
||||
prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio"), this);
|
||||
@@ -100,6 +101,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
||||
connect(prj_prop_diagram, SIGNAL(triggered()), this, SLOT(editDiagramProperties()));
|
||||
connect(prj_add_diagram, SIGNAL(triggered()), this, SLOT(newDiagram()));
|
||||
connect(prj_del_diagram, SIGNAL(triggered()), this, SLOT(deleteDiagram()));
|
||||
connect(prj_duplicate_diagram, SIGNAL(triggered()), this, SLOT(duplicateDiagram()));
|
||||
connect(prj_move_diagram_up, SIGNAL(triggered()), this, SLOT(moveDiagramUp()));
|
||||
connect(prj_move_diagram_down, SIGNAL(triggered()), this, SLOT(moveDiagramDown()));
|
||||
connect(prj_move_diagram_top, SIGNAL(triggered()), this, SLOT(moveDiagramUpTop()));
|
||||
@@ -447,7 +449,8 @@ void ElementsPanelWidget::updateButtons()
|
||||
}
|
||||
|
||||
prj_del_diagram -> setEnabled(is_writable);
|
||||
prj_move_diagram_up -> setEnabled(is_writable && min_position > 0);
|
||||
prj_duplicate_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);
|
||||
|
||||
@@ -501,6 +504,7 @@ void ElementsPanelWidget::handleContextMenu(const QPoint &pos) {
|
||||
case QET::Diagram:
|
||||
context_menu -> addAction(prj_prop_diagram);
|
||||
context_menu -> addAction(prj_del_diagram);
|
||||
context_menu -> addAction(prj_duplicate_diagram);
|
||||
context_menu -> addAction(prj_move_diagram_top);
|
||||
context_menu -> addAction(prj_move_diagram_upx10);
|
||||
context_menu -> addAction(prj_move_diagram_upx100);
|
||||
@@ -593,3 +597,56 @@ void ElementsPanelWidget::keyPressEvent(QKeyEvent *e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates the selected folios (pages) along with their content
|
||||
* and properties, and cleanly resolves cross-references.
|
||||
*/
|
||||
void ElementsPanelWidget::duplicateDiagram()
|
||||
{
|
||||
QList<Diagram *> diagrams_to_duplicate = elements_panel->selectedDiagrams();
|
||||
if (diagrams_to_duplicate.isEmpty()) return;
|
||||
|
||||
QETProject *project = diagrams_to_duplicate.first()->project();
|
||||
if (!project || project->isReadOnly()) return;
|
||||
|
||||
for (Diagram *source_diagram : diagrams_to_duplicate) {
|
||||
|
||||
Diagram *new_diagram = project->addNewDiagram();
|
||||
if (!new_diagram) continue;
|
||||
|
||||
QString template_name = source_diagram->border_and_titleblock.titleBlockTemplateName();
|
||||
new_diagram->setTitleBlockTemplate(template_name);
|
||||
|
||||
TitleBlockProperties tbp = source_diagram->border_and_titleblock.exportTitleBlock();
|
||||
new_diagram->border_and_titleblock.importTitleBlock(tbp);
|
||||
|
||||
BorderProperties bp = source_diagram->border_and_titleblock.exportBorder();
|
||||
new_diagram->border_and_titleblock.importBorder(bp);
|
||||
|
||||
for (QGraphicsItem *item : source_diagram->items()) {
|
||||
if (Element *elmt = dynamic_cast<Element *>(item)) {
|
||||
source_diagram->correctTextPos(elmt);
|
||||
}
|
||||
}
|
||||
|
||||
QDomDocument doc = source_diagram->toXml();
|
||||
QDomElement diagram_elmt = doc.documentElement();
|
||||
|
||||
for (QGraphicsItem *item : source_diagram->items()) {
|
||||
if (Element *elmt = dynamic_cast<Element *>(item)) {
|
||||
source_diagram->restoreText(elmt);
|
||||
}
|
||||
}
|
||||
|
||||
new_diagram->fromXml(diagram_elmt, QPointF(0, 0), false, nullptr);
|
||||
|
||||
for (QGraphicsItem *item : new_diagram->items()) {
|
||||
if (Element *elmt = dynamic_cast<Element *>(item)) {
|
||||
new_diagram->restoreText(elmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elements_panel->reload();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ class ElementsPanelWidget : public QWidget {
|
||||
*prj_prop_diagram,
|
||||
*prj_add_diagram,
|
||||
*prj_del_diagram,
|
||||
*prj_duplicate_diagram,
|
||||
*prj_move_diagram_up,
|
||||
*prj_move_diagram_top,
|
||||
*prj_move_diagram_down,
|
||||
@@ -88,6 +89,7 @@ class ElementsPanelWidget : public QWidget {
|
||||
void editDiagramProperties();
|
||||
void newDiagram();
|
||||
void deleteDiagram();
|
||||
void duplicateDiagram();
|
||||
void moveDiagramUp();
|
||||
void moveDiagramDown();
|
||||
void moveDiagramUpTop();
|
||||
|
||||
@@ -30,6 +30,7 @@ ExportProperties::ExportProperties() :
|
||||
destination_directory(QETApp::documentDir()),
|
||||
format("PNG"),
|
||||
draw_grid(false),
|
||||
draw_guides(false),
|
||||
draw_border(true),
|
||||
draw_titleblock(true),
|
||||
draw_terminals(false),
|
||||
@@ -61,6 +62,8 @@ void ExportProperties::toSettings(QSettings &settings,
|
||||
format);
|
||||
settings.setValue(prefix % "drawgrid",
|
||||
draw_grid);
|
||||
settings.setValue(prefix % "drawguides",
|
||||
draw_guides);
|
||||
settings.setValue(prefix % "drawborder",
|
||||
draw_border);
|
||||
settings.setValue(prefix % "drawtitleblock",
|
||||
@@ -94,6 +97,8 @@ void ExportProperties::fromSettings(QSettings &settings,
|
||||
|
||||
draw_grid = settings.value(prefix % "drawgrid",
|
||||
false).toBool();
|
||||
draw_guides = settings.value(prefix % "drawguides",
|
||||
false).toBool();
|
||||
draw_border = settings.value(prefix % "drawborder",
|
||||
true ).toBool();
|
||||
draw_titleblock = settings.value(prefix % "drawtitleblock",
|
||||
|
||||
@@ -43,6 +43,7 @@ class ExportProperties {
|
||||
QDir destination_directory; ///< Target directory for generated files
|
||||
QString format; ///< Image format of generated files
|
||||
bool draw_grid; ///< Whether to render the diagram grid
|
||||
bool draw_guides; ///< Whether to render the diagram guides
|
||||
bool draw_border; ///< Whether to render the border (along with rows/columns headers)
|
||||
bool draw_titleblock; ///< Whether to render the title block
|
||||
bool draw_terminals; ///< Whether to render terminals
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "../qetgraphicsitem/ViewItem/qetgraphicstableitem.h"
|
||||
#include "../utils/qetutils.h"
|
||||
#include "ui/addtabledialog.h"
|
||||
|
||||
#include "../qetproject.h"
|
||||
#include <QDialog>
|
||||
|
||||
QetGraphicsTableFactory::QetGraphicsTableFactory()
|
||||
|
||||
@@ -268,7 +268,8 @@ void AddTableDialog::loadConfig()
|
||||
case Qt::AlignLeft :
|
||||
ui->m_header_alignment_cb->setCurrentIndex(0);
|
||||
break;
|
||||
case Qt::AlignCenter :
|
||||
case Qt::AlignHCenter :
|
||||
case Qt::AlignCenter : // accept AlignCenter in case it was hand-edited by the user
|
||||
ui->m_header_alignment_cb->setCurrentIndex(1);
|
||||
break;
|
||||
default:
|
||||
@@ -284,7 +285,8 @@ void AddTableDialog::loadConfig()
|
||||
case Qt::AlignLeft :
|
||||
ui->m_table_alignment_cb->setCurrentIndex(0);
|
||||
break;
|
||||
case Qt::AlignCenter :
|
||||
case Qt::AlignHCenter :
|
||||
case Qt::AlignCenter : // accept AlignCenter in case it was hand-edited by the user
|
||||
ui->m_table_alignment_cb->setCurrentIndex(1);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -75,11 +75,11 @@ class MachineInfo
|
||||
{
|
||||
struct Screen
|
||||
{
|
||||
int32_t count;
|
||||
int32_t width[10];
|
||||
int32_t height[10];
|
||||
int32_t Max_width;
|
||||
int32_t Max_height;
|
||||
int32_t count = 0;
|
||||
int32_t width[10] = {};
|
||||
int32_t height[10]= {};
|
||||
int32_t Max_width = 0;
|
||||
int32_t Max_height= 0;
|
||||
}screen;
|
||||
struct Built
|
||||
{
|
||||
|
||||
+74
-5
@@ -15,16 +15,51 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "cli_export.h"
|
||||
#include "machine_info.h"
|
||||
#include "qet.h"
|
||||
#include "qetapp.h"
|
||||
#include "qetproject.h"
|
||||
#include "singleapplication.h"
|
||||
#include "utils/macosxopenevent.h"
|
||||
#include "utils/qetsettings.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include <QStyleFactory>
|
||||
#include <QtConcurrentRun>
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
#include <QFileOpenEvent>
|
||||
|
||||
/**
|
||||
@brief EarlyFileOpenCatcher
|
||||
On macOS, a cold launch via Finder double-click can deliver the
|
||||
QFileOpenEvent to QApplication before QETApp exists and before its
|
||||
real eventFilter is installed (the event loop can start servicing
|
||||
native/Cocoa events before our own code in main() reaches that
|
||||
point). This tiny filter is installed immediately on `app` so no
|
||||
QFileOpenEvent can slip through unseen; it just buffers the path.
|
||||
Once QETApp is constructed, main() drains the buffer and installs
|
||||
the real QETApp::eventFilter for any subsequent event.
|
||||
*/
|
||||
class EarlyFileOpenCatcher : public QObject
|
||||
{
|
||||
public:
|
||||
using QObject::QObject;
|
||||
QStringList bufferedFiles;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *object, QEvent *e) override
|
||||
{
|
||||
if (e->type() == QEvent::FileOpen) {
|
||||
bufferedFiles << static_cast<QFileOpenEvent *>(e)->file();
|
||||
return true;
|
||||
}
|
||||
return QObject::eventFilter(object, e);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
@brief myMessageOutput
|
||||
for debugging
|
||||
@@ -194,13 +229,31 @@ QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFacto
|
||||
#endif
|
||||
|
||||
|
||||
// Headless command-line export: render a project to PDF/PNG/SVG without
|
||||
// opening the GUI, then exit. Must be handled before SingleApplication
|
||||
// (which would forward the args to an already-running instance).
|
||||
{
|
||||
QStringList raw_args;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
raw_args << QString::fromLocal8Bit(argv[i]);
|
||||
if (CLIExport::isExportRequest(raw_args)) {
|
||||
QApplication export_app(argc, argv);
|
||||
// No crash-recovery backups in one-shot CLI mode: the backup write
|
||||
// runs on a background thread referencing the project and races the
|
||||
// process exit (intermittent segfault in QET::writeToFile).
|
||||
QETProject::setBackupEnabled(false);
|
||||
return CLIExport::run(export_app.arguments());
|
||||
}
|
||||
}
|
||||
|
||||
SingleApplication app(argc, argv, true);
|
||||
#ifdef Q_OS_MACOS
|
||||
//Handle the opening of QET when user double click on a .qet .elmt .tbt file
|
||||
//or drop these same files to the QET icon of the dock
|
||||
MacOSXOpenEvent open_event;
|
||||
app.installEventFilter(&open_event);
|
||||
app.setStyle(QStyleFactory::create("Fusion"));
|
||||
// Installed as early as possible, before anything else can run an
|
||||
// event loop, to catch a QFileOpenEvent that might be delivered
|
||||
// during a cold launch before QETApp exists.
|
||||
EarlyFileOpenCatcher early_catcher;
|
||||
app.installEventFilter(&early_catcher);
|
||||
#endif
|
||||
|
||||
if (app.isSecondary())
|
||||
@@ -217,9 +270,25 @@ QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFacto
|
||||
|
||||
QETApp qetapp;
|
||||
QETApp::instance()->installEventFilter(&qetapp);
|
||||
#ifdef Q_OS_MACOS
|
||||
//Handle the opening of QET when user double click on a .qet .elmt .tbt file
|
||||
//or drop these same files to the QET icon of the dock.
|
||||
//Swap the early catcher (installed right after `app` was constructed,
|
||||
//see above) for the real filter, then drain anything it buffered
|
||||
//during the cold-launch window before QETApp existed.
|
||||
app.removeEventFilter(&early_catcher);
|
||||
app.installEventFilter(&qetapp);
|
||||
if (!early_catcher.bufferedFiles.isEmpty())
|
||||
qetapp.openFiles(QETArguments(early_catcher.bufferedFiles));
|
||||
#endif
|
||||
QObject::connect(&app, &SingleApplication::receivedMessage,
|
||||
&qetapp, &QETApp::receiveMessage);
|
||||
|
||||
// Pre-initialise on the main (GUI) thread: the constructor calls
|
||||
// qApp->screens() which is not thread-safe in Qt5 — calling instance()
|
||||
// here guarantees the singleton is fully built before the worker runs.
|
||||
MachineInfo::instance();
|
||||
|
||||
QtConcurrent::run([=]()
|
||||
{
|
||||
// for debugging
|
||||
|
||||
@@ -0,0 +1,382 @@
|
||||
/*
|
||||
Copyright 2006-2025 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/>.
|
||||
*/
|
||||
#include "pdf_links.h"
|
||||
|
||||
#include "diagram.h"
|
||||
#include "qetgraphicsitem/crossrefitem.h"
|
||||
#include "qetgraphicsitem/dynamicelementtextitem.h"
|
||||
#include "qetgraphicsitem/element.h"
|
||||
#include "qetgraphicsitem/elementtextitemgroup.h"
|
||||
|
||||
// Private Qt PDF engine for drawHyperlink() — not public API, stable since Qt4.
|
||||
// Requires QT += gui-private in qelectrotech.pro / gui-private in CMake.
|
||||
#include <private/qpdf_p.h>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QFile>
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QList>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
|
||||
namespace PdfLinks {
|
||||
|
||||
void injectCrossRefLinks(QPdfEngine *engine, Diagram *diagram,
|
||||
const PageGeometry &geom,
|
||||
const QMap<Diagram *, int> &pageMap,
|
||||
const QString &outputFileName)
|
||||
{
|
||||
if (!engine || !diagram)
|
||||
return;
|
||||
|
||||
const QTransform &fit = geom.sceneToDevice;
|
||||
const QRectF &target = geom.target;
|
||||
const QRectF &pageBounds = geom.pageBounds;
|
||||
|
||||
// Compute, in PDF points on its OWN page, the rectangle to frame for a
|
||||
// target element (used as a /FitR destination so the link zooms onto it).
|
||||
auto destRectPdf = [&](Element *tgt) -> QRectF {
|
||||
Diagram *dg = tgt ? tgt->diagram() : nullptr;
|
||||
if (!dg) return QRectF();
|
||||
const QRectF srcT = geom.sourceRectOf(dg);
|
||||
if (srcT.width() <= 0.0 || srcT.height() <= 0.0) return QRectF();
|
||||
const qreal sT = qMin(target.width() / srcT.width(),
|
||||
target.height() / srcT.height());
|
||||
QTransform fitT;
|
||||
fitT.translate(target.x(), target.y());
|
||||
fitT.scale(sT, sT);
|
||||
fitT.translate(-srcT.x(), -srcT.y());
|
||||
|
||||
QRectF elemScene = tgt->mapRectToScene(tgt->boundingRect());
|
||||
// Frame the element with a little context, and enforce a minimum
|
||||
// framed size so tiny contacts don't zoom in extremely.
|
||||
const qreal pad = 25.0;
|
||||
elemScene.adjust(-pad, -pad, pad, pad);
|
||||
const qreal minSide = 160.0;
|
||||
if (elemScene.width() < minSide)
|
||||
elemScene.adjust(-(minSide - elemScene.width()) / 2.0, 0,
|
||||
(minSide - elemScene.width()) / 2.0, 0);
|
||||
if (elemScene.height() < minSide)
|
||||
elemScene.adjust(0, -(minSide - elemScene.height()) / 2.0,
|
||||
0, (minSide - elemScene.height()) / 2.0);
|
||||
|
||||
const QRectF devT = fitT.mapRect(elemScene);
|
||||
const QPointF a = geom.devToPdf(devT.topLeft());
|
||||
const QPointF b = geom.devToPdf(devT.bottomRight());
|
||||
return QRectF(QPointF(qMin(a.x(), b.x()), qMin(a.y(), b.y())),
|
||||
QPointF(qMax(a.x(), b.x()), qMax(a.y(), b.y())));
|
||||
};
|
||||
|
||||
auto injectLink = [&](const QRectF &sceneRect, Element *targetElmt) {
|
||||
if (!targetElmt || !targetElmt->diagram()) return;
|
||||
const int targetPage = pageMap.value(targetElmt->diagram(), -1);
|
||||
if (targetPage < 1) return;
|
||||
const QRectF devRect = fit.mapRect(sceneRect);
|
||||
if (!devRect.isValid() || !pageBounds.intersects(devRect)) return;
|
||||
|
||||
QString frag = QString("page=%1").arg(targetPage);
|
||||
const QRectF d = destRectPdf(targetElmt); // /FitR L_B_R_T
|
||||
if (d.isValid())
|
||||
frag += QString("&fitr=%1_%2_%3_%4")
|
||||
.arg(qRound(d.left())).arg(qRound(d.top()))
|
||||
.arg(qRound(d.right())).arg(qRound(d.bottom()));
|
||||
|
||||
QUrl url = QUrl::fromLocalFile(outputFileName);
|
||||
url.setFragment(frag);
|
||||
engine->drawHyperlink(devRect, url);
|
||||
};
|
||||
|
||||
for (auto *item : diagram->items()) {
|
||||
|
||||
// --- CrossRefItem links ---
|
||||
if (auto *xref = dynamic_cast<CrossRefItem*>(item)) {
|
||||
for (auto it = xref->hoveredContactsMap().begin();
|
||||
it != xref->hoveredContactsMap().end(); ++it)
|
||||
{
|
||||
Element *targetElmt = it.key();
|
||||
if (!targetElmt || !targetElmt->diagram()) continue;
|
||||
// it.value() is in the CrossRefItem's LOCAL coords -> scene
|
||||
injectLink(xref->mapRectToScene(it.value()), targetElmt);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// --- Folio report links (DynamicElementTextItem) ---
|
||||
if (auto *deti = dynamic_cast<DynamicElementTextItem*>(item)) {
|
||||
Element *parent = deti->parentElement();
|
||||
if (!parent) continue;
|
||||
|
||||
// (a) Report element : label -> linked report on another folio
|
||||
if (parent->linkType() & Element::AllReport) {
|
||||
if (parent->linkedElements().isEmpty()) continue;
|
||||
|
||||
bool showsLabel =
|
||||
(deti->textFrom() == DynamicElementTextItem::ElementInfo
|
||||
&& deti->infoName() == QLatin1String("label")) ||
|
||||
(deti->textFrom() == DynamicElementTextItem::CompositeText
|
||||
&& deti->compositeText().contains(QStringLiteral("%{label}")));
|
||||
if (!showsLabel) continue;
|
||||
|
||||
Element *targetElmt = parent->linkedElements().first();
|
||||
if (!targetElmt || !targetElmt->diagram()) continue;
|
||||
|
||||
injectLink(deti->mapRectToScene(deti->boundingRect()), targetElmt);
|
||||
continue;
|
||||
}
|
||||
|
||||
// (b) Slave element : the "(folio-pos)" text -> master element
|
||||
if (parent->linkType() == Element::Slave) {
|
||||
QGraphicsTextItem *sx = deti->slaveXrefItem();
|
||||
Element *master = deti->masterElement();
|
||||
if (sx && master && master->diagram()) {
|
||||
injectLink(sx->mapRectToScene(sx->boundingRect()), master);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// --- Slave cross-reference carried by a grouped text ---
|
||||
if (auto *grp = dynamic_cast<ElementTextItemGroup*>(item)) {
|
||||
Element *parent = grp->parentElement();
|
||||
if (!parent || parent->linkType() != Element::Slave) continue;
|
||||
if (parent->linkedElements().isEmpty()) continue;
|
||||
QGraphicsTextItem *sx = grp->slaveXrefItem();
|
||||
if (!sx) continue;
|
||||
Element *master = parent->linkedElements().first();
|
||||
if (!master || !master->diagram()) continue;
|
||||
injectLink(sx->mapRectToScene(sx->boundingRect()), master);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void convertUriToGoTo(const QString &pdfPath)
|
||||
{
|
||||
// --- 1. Read raw bytes ---
|
||||
QFile f(pdfPath);
|
||||
if (!f.open(QIODevice::ReadOnly)) return;
|
||||
QByteArray data = f.readAll();
|
||||
f.close();
|
||||
|
||||
// --- 2. Collect page object numbers in document order ---
|
||||
// Read them from the page tree (/Type /Pages -> /Kids [ N 0 R ... ]).
|
||||
// This is reliable; scanning raw bytes for "/Type /Page" is NOT: that
|
||||
// marker also occurs inside content streams, and a forward lookahead
|
||||
// wrongly tags neighbouring objects (it found 280 "pages" for a 137-page
|
||||
// document). Qt writes a single, flat /Kids array listing every page.
|
||||
QVector<int> pageObjs;
|
||||
{
|
||||
int pagesPos = data.indexOf("/Type /Pages");
|
||||
int kidsPos = (pagesPos == -1) ? -1 : data.indexOf("/Kids", pagesPos);
|
||||
int lb = (kidsPos == -1) ? -1 : data.indexOf('[', kidsPos);
|
||||
int rb = (lb == -1) ? -1 : data.indexOf(']', lb);
|
||||
if (lb != -1 && rb != -1 && rb > lb) {
|
||||
const QString kids =
|
||||
QString::fromLatin1(data.mid(lb + 1, rb - lb - 1));
|
||||
QRegularExpression re(QStringLiteral("(\\d+)\\s+\\d+\\s+R"));
|
||||
auto it = re.globalMatch(kids);
|
||||
while (it.hasNext()) {
|
||||
int objNum = it.next().captured(1).toInt();
|
||||
if (objNum > 0) pageObjs.append(objNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pageObjs.isEmpty()) return; // nothing to do
|
||||
|
||||
// --- 3. Replace URI annotations with GoTo ---
|
||||
// Pattern (Qt always writes exactly this):
|
||||
// /S /URI\n/URI (file:///...<anything>#page=N)\n
|
||||
// or (older patches without file://):
|
||||
// /S /URI\n/URI (page=N)\n
|
||||
bool changed = false;
|
||||
{
|
||||
// We do a manual scan to handle variable-length replacements.
|
||||
QByteArray out;
|
||||
out.reserve(data.size());
|
||||
|
||||
const QByteArray sUri = "/S /URI\n/URI (";
|
||||
const QByteArray sGoTo = "/S /GoTo\n/D [";
|
||||
int pos = 0;
|
||||
|
||||
while (pos < data.size()) {
|
||||
int found = data.indexOf(sUri, pos);
|
||||
if (found == -1) {
|
||||
out.append(data.mid(pos));
|
||||
break;
|
||||
}
|
||||
|
||||
// Copy everything up to the match
|
||||
out.append(data.mid(pos, found - pos));
|
||||
|
||||
// Find closing ')' of the URI value
|
||||
int uriStart = found + sUri.size();
|
||||
int closeParen = data.indexOf(')', uriStart);
|
||||
if (closeParen == -1) {
|
||||
// Malformed — copy rest verbatim
|
||||
out.append(data.mid(found));
|
||||
pos = data.size();
|
||||
break;
|
||||
}
|
||||
|
||||
QByteArray uriVal = data.mid(uriStart, closeParen - uriStart);
|
||||
|
||||
// Extract page number: look for #page=N or bare page=N
|
||||
int pageNum = -1;
|
||||
int hashPos = uriVal.lastIndexOf("#page=");
|
||||
int digitStart = -1;
|
||||
if (hashPos != -1) {
|
||||
digitStart = hashPos + 6;
|
||||
} else if (uriVal.startsWith("page=")) {
|
||||
digitStart = 5;
|
||||
}
|
||||
if (digitStart != -1) {
|
||||
// Take only the leading digits: the fragment may carry extra
|
||||
// parameters after the page number (e.g. "22&fitr=15_489_..."),
|
||||
// and QByteArray::toInt() would fail on the whole remainder.
|
||||
int e = digitStart;
|
||||
while (e < uriVal.size()
|
||||
&& uriVal[e] >= '0' && uriVal[e] <= '9')
|
||||
++e;
|
||||
if (e > digitStart)
|
||||
pageNum = uriVal.mid(digitStart, e - digitStart).toInt();
|
||||
}
|
||||
|
||||
if (pageNum >= 1 && pageNum <= pageObjs.size()) {
|
||||
// Valid page reference — emit GoTo action.
|
||||
int pageObjNum = pageObjs[pageNum - 1];
|
||||
|
||||
// Optional precise destination: &fitr=Left_Bottom_Right_Top
|
||||
// (integer PDF points). If present -> /FitR (frame the element);
|
||||
// otherwise -> /Fit (whole page, top).
|
||||
QByteArray dest = " /Fit]";
|
||||
int fr = uriVal.indexOf("fitr=");
|
||||
if (fr != -1) {
|
||||
QByteArray rest = uriVal.mid(fr + 5);
|
||||
// stop at first char that is not part of the number list
|
||||
int end = 0;
|
||||
while (end < rest.size()
|
||||
&& ((rest[end] >= '0' && rest[end] <= '9')
|
||||
|| rest[end] == '_' || rest[end] == '-'))
|
||||
++end;
|
||||
QList<QByteArray> parts = rest.left(end).split('_');
|
||||
if (parts.size() == 4) {
|
||||
dest = " /FitR " + parts[0] + " " + parts[1] + " "
|
||||
+ parts[2] + " " + parts[3] + "]";
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray goTo = sGoTo
|
||||
+ QByteArray::number(pageObjNum)
|
||||
+ " 0 R" + dest;
|
||||
out.append(goTo);
|
||||
changed = true;
|
||||
} else {
|
||||
// Unknown page — keep original URI
|
||||
out.append(sUri);
|
||||
out.append(uriVal);
|
||||
out.append(')');
|
||||
}
|
||||
|
||||
pos = closeParen + 1; // skip past ')'
|
||||
}
|
||||
|
||||
if (!changed) return; // nothing was replaced
|
||||
data = out;
|
||||
}
|
||||
|
||||
// --- 4. Rebuild xref table ---
|
||||
// Find start of existing xref (last occurrence)
|
||||
int xrefStart = data.lastIndexOf("\nxref\n");
|
||||
if (xrefStart == -1) xrefStart = data.lastIndexOf("\nxref ");
|
||||
if (xrefStart == -1) return; // malformed PDF
|
||||
++xrefStart; // skip the leading '\n'
|
||||
|
||||
QByteArray body = data.left(xrefStart);
|
||||
|
||||
// Collect all object offsets from the body
|
||||
QMap<int, int> offsets; // objNum -> byte offset
|
||||
{
|
||||
const QByteArray objMarker = " 0 obj";
|
||||
int pos = 0;
|
||||
while ((pos = body.indexOf(objMarker, pos)) != -1) {
|
||||
int numStart = pos - 1;
|
||||
while (numStart > 0 && body[numStart-1] != '\n' && body[numStart-1] != '\r')
|
||||
--numStart;
|
||||
QByteArray numStr = body.mid(numStart, pos - numStart).trimmed();
|
||||
bool ok = false;
|
||||
int objNum = numStr.toInt(&ok);
|
||||
if (ok && objNum > 0)
|
||||
offsets[objNum] = numStart;
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
if (offsets.isEmpty()) return;
|
||||
|
||||
int maxObj = offsets.lastKey();
|
||||
|
||||
// Build xref table
|
||||
QByteArray xref;
|
||||
xref += "xref\n";
|
||||
xref += "0 " + QByteArray::number(maxObj + 1) + "\n";
|
||||
xref += "0000000000 65535 f \n";
|
||||
for (int i = 1; i <= maxObj; ++i) {
|
||||
if (offsets.contains(i)) {
|
||||
xref += QByteArray::number(offsets[i]).rightJustified(10, '0')
|
||||
+ " 00000 n \n";
|
||||
} else {
|
||||
xref += "0000000000 65535 f \n";
|
||||
}
|
||||
}
|
||||
|
||||
// Find trailer dict from the original xref section
|
||||
int trailerPos = data.indexOf("trailer", xrefStart);
|
||||
int trailerEnd = -1;
|
||||
if (trailerPos != -1) {
|
||||
trailerEnd = data.indexOf("%%EOF", trailerPos);
|
||||
if (trailerEnd != -1) trailerEnd += 5;
|
||||
}
|
||||
|
||||
QByteArray trailer;
|
||||
if (trailerPos != -1 && trailerEnd != -1)
|
||||
trailer = data.mid(trailerPos, trailerEnd - trailerPos);
|
||||
else
|
||||
trailer = "trailer\n<<>>\n%%EOF";
|
||||
|
||||
int newXrefOffset = body.size();
|
||||
|
||||
QByteArray result;
|
||||
result.reserve(body.size() + xref.size() + trailer.size() + 30);
|
||||
result += body;
|
||||
result += xref;
|
||||
result += trailer;
|
||||
result += "\nstartxref\n";
|
||||
result += QByteArray::number(newXrefOffset);
|
||||
result += "\n%%EOF\n";
|
||||
|
||||
// --- 5. Write back ---
|
||||
QFile out(pdfPath);
|
||||
if (!out.open(QIODevice::WriteOnly | QIODevice::Truncate)) return;
|
||||
out.write(result);
|
||||
out.close();
|
||||
}
|
||||
|
||||
} // namespace PdfLinks
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright 2006-2025 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/>.
|
||||
*/
|
||||
#ifndef PDF_LINKS_H
|
||||
#define PDF_LINKS_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QPointF>
|
||||
#include <QRectF>
|
||||
#include <QString>
|
||||
#include <QTransform>
|
||||
#include <functional>
|
||||
|
||||
class QPdfEngine;
|
||||
class Diagram;
|
||||
|
||||
/**
|
||||
Shared helper that turns a project's cross-references and folio reports
|
||||
into clickable internal hyperlinks in a Qt-generated PDF. Used by both the
|
||||
GUI print path (ProjectPrintWindow) and the headless CLI export, each of
|
||||
which builds its own page geometry and passes it in — this code never
|
||||
computes the scene-to-page mapping itself.
|
||||
*/
|
||||
namespace PdfLinks {
|
||||
|
||||
/**
|
||||
Geometry mapping for one rendered PDF page. Each caller builds this
|
||||
from its OWN page setup (printer page layout vs QPdfWriter), since the
|
||||
device-pixel and point conversions differ between them.
|
||||
*/
|
||||
struct PageGeometry {
|
||||
/// scene coordinates -> device pixels (the same "fit" render() applied)
|
||||
QTransform sceneToDevice;
|
||||
/// device paint rectangle, in pixels (the page area)
|
||||
QRectF target;
|
||||
/// links whose rectangle falls outside this are dropped
|
||||
QRectF pageBounds;
|
||||
/// device pixels -> PDF points (replicates the engine's page matrix)
|
||||
std::function<QPointF(const QPointF &)> devToPdf;
|
||||
/// a diagram -> its source rectangle in scene pixels (for /FitR framing)
|
||||
std::function<QRectF(Diagram *)> sourceRectOf;
|
||||
};
|
||||
|
||||
/**
|
||||
Inject clickable cross-reference / folio-report hyperlinks for @p diagram
|
||||
into the current page of @p engine. Each link is emitted as a URI
|
||||
annotation encoding the target page and a /FitR rectangle;
|
||||
convertUriToGoTo() then rewrites those into native internal GoTo actions.
|
||||
*/
|
||||
void injectCrossRefLinks(QPdfEngine *engine, Diagram *diagram,
|
||||
const PageGeometry &geom,
|
||||
const QMap<Diagram *, int> &pageMap,
|
||||
const QString &outputFileName);
|
||||
|
||||
/**
|
||||
Post-process a Qt-generated PDF file: rewrite every "/S /URI" link
|
||||
annotation into a native internal "/S /GoTo" action (page + /FitR or
|
||||
/Fit destination) and rebuild the xref table. No-op if the file has no
|
||||
such annotations.
|
||||
*/
|
||||
void convertUriToGoTo(const QString &pdfPath);
|
||||
|
||||
}
|
||||
|
||||
#endif // PDF_LINKS_H
|
||||
@@ -18,12 +18,20 @@
|
||||
#include "projectprintwindow.h"
|
||||
|
||||
#include "../diagram.h"
|
||||
#include "../pdf_links.h"
|
||||
#include "../qeticons.h"
|
||||
#include "../qetproject.h"
|
||||
#include "../qetversion.h"
|
||||
#include "../qetgraphicsitem/crossrefitem.h"
|
||||
#include "../qetgraphicsitem/dynamicelementtextitem.h"
|
||||
#include "../qetgraphicsitem/elementtextitemgroup.h"
|
||||
|
||||
#include "ui_projectprintwindow.h"
|
||||
|
||||
// Private Qt PDF engine for drawHyperlink() — not public API, stable since Qt4
|
||||
// Requires QT += gui-private in qelectrotech.pro
|
||||
#include <private/qpdf_p.h>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
# include <QDesktopWidget>
|
||||
#else
|
||||
@@ -37,6 +45,11 @@
|
||||
#include <QPrintDialog>
|
||||
#include <QPrintPreviewWidget>
|
||||
#include <QScreen>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QMap>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
|
||||
/**
|
||||
* @brief ProjectPrintWindow::ProjectPrintWindow
|
||||
@@ -214,13 +227,50 @@ void ProjectPrintWindow::requestPaint()
|
||||
return;
|
||||
}
|
||||
|
||||
// Build diagram -> first physical PDF page number map (1-based)
|
||||
// Must be done before the print loop since page numbers depend on order
|
||||
QMap<Diagram*, int> diagramPageMap;
|
||||
{
|
||||
int pageNum = 1;
|
||||
for (auto diagram : selectedDiagram()) {
|
||||
diagramPageMap.insert(diagram, pageNum);
|
||||
// Each diagram may span multiple pages if not fit_page
|
||||
if (!ui->m_fit_in_page_cb->isChecked()) {
|
||||
auto option = exportProperties();
|
||||
bool full_page = m_printer->fullPage();
|
||||
int h = horizontalPagesCount(diagram, option, full_page);
|
||||
int v = verticalPagesCount(diagram, option, full_page);
|
||||
pageNum += h * v;
|
||||
} else {
|
||||
pageNum += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool first = true;
|
||||
QPainter painter(m_printer);
|
||||
|
||||
// A real PDF export uses the QPdfEngine; the on-screen preview uses a
|
||||
// preview paint engine. We only post-process when actually writing a PDF.
|
||||
const bool pdfExport =
|
||||
(m_printer->outputFormat() == QPrinter::PdfFormat)
|
||||
&& (dynamic_cast<QPdfEngine*>(painter.paintEngine()) != nullptr);
|
||||
// plc-user: added because of "Warning: unused variable 'pdfExport'":
|
||||
// should be fixed by original author by evaluating function-result!
|
||||
(void)pdfExport;
|
||||
|
||||
for (auto diagram : selectedDiagram())
|
||||
{
|
||||
first ? first = false : m_printer->newPage();
|
||||
printDiagram(diagram, ui->m_fit_in_page_cb->isChecked(), &painter, m_printer);
|
||||
printDiagram(diagram, ui->m_fit_in_page_cb->isChecked(), &painter, m_printer, diagramPageMap);
|
||||
}
|
||||
|
||||
// Note: do NOT call painter.end() or pdfConvertUriToGoTo() here.
|
||||
// We are inside the paintRequested slot: the QPrintPreviewWidget still
|
||||
// owns the paint cycle. On macOS arm64 (Metal/CALayer compositor),
|
||||
// closing the QPainter manually inside this slot leaves the backing
|
||||
// store in an undefined state, producing a black screen after export.
|
||||
// pdfConvertUriToGoTo() is deferred to print() via QTimer::singleShot(0).
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,7 +280,7 @@ void ProjectPrintWindow::requestPaint()
|
||||
* @param fit_page
|
||||
* @param printer
|
||||
*/
|
||||
void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter *painter, QPrinter *printer)
|
||||
void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter *painter, QPrinter *printer, const QMap<Diagram*, int> &diagramPageMap)
|
||||
{
|
||||
|
||||
////Prepare the print////
|
||||
@@ -317,6 +367,65 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter
|
||||
}
|
||||
}
|
||||
|
||||
////Inject PDF cross-reference links////
|
||||
if (printer->outputFormat() == QPrinter::PdfFormat && fit_page) {
|
||||
auto *pdfEngine = dynamic_cast<QPdfEngine*>(painter->paintEngine());
|
||||
if (pdfEngine) {
|
||||
|
||||
// QGraphicsScene::render() fait save()/restore() : worldTransform()
|
||||
// est revenu a l'identite ici. On reconstruit DONC explicitement la
|
||||
// transform appliquee par :
|
||||
// diagram->render(painter, QRectF(), diagram_rect, KeepAspectRatio)
|
||||
// cible vide => painter->viewport() ; source = diagram_rect ; centre.
|
||||
const QRectF target = QRectF(painter->viewport());
|
||||
const QRectF source = QRectF(diagram_rect); // meme source que render()
|
||||
|
||||
// render() ANCRE en haut-gauche (pas de centrage) :
|
||||
// translate(target.topLeft) . scale(s,s) . translate(-source.topLeft)
|
||||
// On reproduit EXACTEMENT ca — surtout PAS de (target-source*s)/2.
|
||||
const qreal s = qMin(target.width() / source.width(),
|
||||
target.height() / source.height());
|
||||
|
||||
QTransform fit;
|
||||
fit.translate(target.x(), target.y());
|
||||
fit.scale(s, s);
|
||||
fit.translate(-source.x(), -source.y()); // scene -> pixels device
|
||||
|
||||
// IMPORTANT : QPdfEngine::drawHyperlink() applique lui-meme
|
||||
// pageMatrix() (echelle 72/resolution + inversion de Y + marges).
|
||||
// On lui passe donc le rectangle en PIXELS DEVICE, sans aucune
|
||||
// conversion en points ni flip de notre cote.
|
||||
const QRectF pageBounds(0, 0, target.width(), target.height());
|
||||
|
||||
// ---- Device-pixels -> PDF points, replicating QPdfEnginePrivate::pageMatrix()
|
||||
// (same geometry for every page: same printer, page size and margins). ----
|
||||
const qreal pt_scale = 72.0 / printer->resolution();
|
||||
const qreal fullH_pt = printer->pageLayout().fullRectPoints().height();
|
||||
const bool fullPageMode =
|
||||
(printer->pageLayout().mode() == QPageLayout::FullPageMode);
|
||||
const QRect paintPx =
|
||||
printer->pageLayout().paintRectPixels(printer->resolution());
|
||||
auto devToPdf = [=](const QPointF &d) -> QPointF {
|
||||
qreal dx = d.x(), dy = d.y();
|
||||
if (!fullPageMode) { dx += paintPx.left(); dy += paintPx.top(); }
|
||||
return QPointF(pt_scale * dx, fullH_pt - pt_scale * dy);
|
||||
};
|
||||
|
||||
PdfLinks::PageGeometry geom;
|
||||
geom.sceneToDevice = fit;
|
||||
geom.target = target;
|
||||
geom.pageBounds = pageBounds;
|
||||
geom.devToPdf = devToPdf;
|
||||
geom.sourceRectOf = [this](Diagram *dg) {
|
||||
return QRectF(diagramRect(dg, exportProperties()));
|
||||
};
|
||||
PdfLinks::injectCrossRefLinks(
|
||||
pdfEngine, diagram, geom, diagramPageMap,
|
||||
printer->outputFileName());
|
||||
}
|
||||
}
|
||||
////PDF links end////
|
||||
|
||||
////Print is finished, restore diagram and graphics item properties
|
||||
for (auto view : diagram->views()) {
|
||||
view->setInteractive(true);
|
||||
@@ -413,6 +522,7 @@ ExportProperties ProjectPrintWindow::exportProperties() const
|
||||
exp.draw_terminals = ui->m_draw_terminal_cb->isChecked();
|
||||
exp.draw_colored_conductors = ui->m_keep_conductor_color_cb->isChecked();
|
||||
exp.draw_grid = false;
|
||||
exp.draw_guides = false;
|
||||
|
||||
return exp;
|
||||
}
|
||||
@@ -772,9 +882,29 @@ void ProjectPrintWindow::on_m_uncheck_all_clicked()
|
||||
|
||||
void ProjectPrintWindow::print()
|
||||
{
|
||||
m_preview->print();
|
||||
const bool isPdf = (m_printer->outputFormat() == QPrinter::PdfFormat);
|
||||
const QString pdfFile = isPdf ? m_printer->outputFileName() : QString();
|
||||
|
||||
m_preview->print(); // triggers requestPaint() synchronously; painter
|
||||
// is created/destroyed inside that call
|
||||
|
||||
savePageSetupForCurrentPrinter();
|
||||
this->close();
|
||||
|
||||
if (isPdf && !pdfFile.isEmpty()) {
|
||||
// Defer post-processing and window close to the next event-loop
|
||||
// iteration. This lets the macOS arm64 Metal compositor finish
|
||||
// compositing the backing store before the window is destroyed,
|
||||
// which prevents the black screen observed on Apple Silicon under
|
||||
// macOS Sequoia (QPrintPreviewWidget + CALayer timing issue).
|
||||
QTimer::singleShot(0, this, [this, pdfFile]() {
|
||||
// Convert URI link annotations into native internal GoTo/FitR
|
||||
// actions so cross-references jump inside the document.
|
||||
PdfLinks::convertUriToGoTo(pdfFile);
|
||||
this->close();
|
||||
});
|
||||
} else {
|
||||
this->close();
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "../exportproperties.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMap>
|
||||
#include <QPrinter>
|
||||
|
||||
namespace Ui {
|
||||
@@ -79,7 +80,7 @@ class ProjectPrintWindow : public QMainWindow
|
||||
|
||||
private:
|
||||
void requestPaint();
|
||||
void printDiagram(Diagram *diagram, bool fit_page, QPainter *painter, QPrinter *printer);
|
||||
void printDiagram(Diagram *diagram, bool fit_page, QPainter *painter, QPrinter *printer, const QMap<Diagram*, int> &diagramPageMap = {});
|
||||
QRect diagramRect(Diagram *diagram, const ExportProperties &option) const;
|
||||
int horizontalPagesCount(Diagram *diagram, const ExportProperties &option, bool full_page) const;
|
||||
int verticalPagesCount(Diagram *diagram, const ExportProperties &option, bool full_page) const;
|
||||
|
||||
@@ -49,18 +49,18 @@ bool ElementData::fromXml(const QDomElement &xml_element)
|
||||
return false;
|
||||
}
|
||||
|
||||
// --- HIER STARTET UNSER DEBUG-BLOCK ---
|
||||
// Wir holen den String aus der XML und speichern ihn kurz zwischen
|
||||
// --- OUR DEBUG BLOCK STARTS HERE ---
|
||||
// We retrieve the string from the XML and store it temporarily
|
||||
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;
|
||||
qDebug() << "\n=== NEW COMPONENT IS LOADING ===";
|
||||
qDebug() << "[XML Parser] Raw “link_type” string from the .elmt file:" << raw_type_string;
|
||||
|
||||
// Jetzt übergeben wir ihn an deine Übersetzungs-Funktion
|
||||
// Now we’ll pass it on to your translation function
|
||||
m_type = typeFromString(raw_type_string);
|
||||
|
||||
qDebug() << "[XML Parser] Übersetzter ElementData-Typ:" << typeToString(m_type);
|
||||
// --- HIER ENDET UNSER DEBUG-BLOCK ---
|
||||
qDebug() << "[XML Parser] Translated ElementData type:" << typeToString(m_type);
|
||||
// --- THIS IS WHERE OUR DEBUG BLOCK ENDS ---
|
||||
|
||||
kindInfoFromXml(xml_element);
|
||||
m_informations.fromXml(xml_element.firstChildElement(QStringLiteral("elementInformations")),
|
||||
|
||||
+58
-31
@@ -47,6 +47,7 @@
|
||||
#include <QProcessEnvironment>
|
||||
#include <QRegularExpression>
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
# include "ui/nokde/kautosavefile.h"
|
||||
#else
|
||||
# include <KAutoSaveFile>
|
||||
#endif
|
||||
@@ -226,20 +227,20 @@ void QETApp::setLanguage(const QString &desired_language) {
|
||||
|
||||
// load translations for the QET application
|
||||
// charge les traductions pour l'application QET
|
||||
if (!qetTranslator.load("qet_" + desired_language, languages_path)) {
|
||||
/* in case of failure,
|
||||
* we fall back on the native channels for French
|
||||
* en cas d'echec,
|
||||
* on retombe sur les chaines natives pour le francais
|
||||
*/
|
||||
if (desired_language != "fr") {
|
||||
// use of the English version by default
|
||||
// utilisation de la version anglaise par defaut
|
||||
if(!qetTranslator.load("qet_en", languages_path))
|
||||
qWarning() << "failed to load"
|
||||
<< "qet_en" << languages_path << "(" << __FILE__
|
||||
<< __LINE__ << __FUNCTION__ << ")";
|
||||
}
|
||||
// desired_language may be a full locale such as "pt_BR": try that exact
|
||||
// translation, then the base language ("pt"), then fall back to English.
|
||||
// French is the application's source language and needs no translation.
|
||||
const QString base_language = desired_language.section('_', 0, 0);
|
||||
bool loaded = qetTranslator.load("qet_" + desired_language, languages_path);
|
||||
if (!loaded && base_language != desired_language)
|
||||
loaded = qetTranslator.load("qet_" + base_language, languages_path);
|
||||
if (!loaded && base_language != "fr") {
|
||||
// use of the English version by default
|
||||
// utilisation de la version anglaise par defaut
|
||||
if(!qetTranslator.load("qet_en", languages_path))
|
||||
qWarning() << "failed to load"
|
||||
<< "qet_en" << languages_path << "(" << __FILE__
|
||||
<< __LINE__ << __FUNCTION__ << ")";
|
||||
}
|
||||
qApp->installTranslator(&qetTranslator);
|
||||
|
||||
@@ -263,7 +264,11 @@ QString QETApp::langFromSetting()
|
||||
QSettings settings;
|
||||
system_language = settings.value("lang", "system").toString();
|
||||
if(system_language == "system") {
|
||||
system_language = QLocale::system().name().left(2);
|
||||
// Keep the full locale (e.g. "pt_BR"), not just the base language
|
||||
// ("pt"): QET ships regional translations (pt_BR, nl_BE, nl_NL) and
|
||||
// truncating here loaded the wrong one. setLanguage() falls back to
|
||||
// the base language when no regional translation exists.
|
||||
system_language = QLocale::system().name();
|
||||
}
|
||||
lang_is_set = true;
|
||||
}
|
||||
@@ -883,10 +888,13 @@ QString QETApp::configDir()
|
||||
#ifdef QET_ALLOW_OVERRIDE_CD_OPTION
|
||||
if (config_dir != QString()) return(config_dir);
|
||||
#endif
|
||||
QString configdir = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
||||
while (configdir.endsWith('/')) {
|
||||
configdir.remove(configdir.length()-1, 1);
|
||||
}
|
||||
// C++11 static-local init runs exactly once across all threads — safe to
|
||||
// call from QtConcurrent background threads (QStandardPaths is not).
|
||||
static const QString configdir = []() {
|
||||
QString d = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
||||
while (d.endsWith('/')) d.chop(1);
|
||||
return d;
|
||||
}();
|
||||
return configdir;
|
||||
}
|
||||
|
||||
@@ -907,10 +915,13 @@ QString QETApp::dataDir()
|
||||
#ifdef QET_ALLOW_OVERRIDE_DD_OPTION
|
||||
if (data_dir != QString()) return(data_dir);
|
||||
#endif
|
||||
QString datadir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
while (datadir.endsWith('/')) {
|
||||
datadir.remove(datadir.length()-1, 1);
|
||||
}
|
||||
// C++11 static-local init runs exactly once across all threads — safe to
|
||||
// call from QtConcurrent background threads (QStandardPaths is not).
|
||||
static const QString datadir = []() {
|
||||
QString d = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
while (d.endsWith('/')) d.chop(1);
|
||||
return d;
|
||||
}();
|
||||
return datadir;
|
||||
}
|
||||
|
||||
@@ -1228,7 +1239,21 @@ QString QETApp::languagesPath()
|
||||
* en l'absence d'option de compilation, on utilise le dossier lang,
|
||||
* situe a cote du binaire executable
|
||||
*/
|
||||
return(QCoreApplication::applicationDirPath() + "/lang/");
|
||||
{
|
||||
const QString bin_dir = QCoreApplication::applicationDirPath();
|
||||
const QString next_to_bin = bin_dir + "/lang/";
|
||||
// Some packagings (notably the Windows installer) put the binary in a
|
||||
// "bin" subfolder while "lang" sits beside it (../lang). Fall back to
|
||||
// that layout when the folder next to the binary is absent, so the
|
||||
// translations are found without a --lang-dir argument. See issue #86.
|
||||
if (!QDir(next_to_bin).exists()) {
|
||||
const QString sibling_of_bin =
|
||||
QDir::cleanPath(bin_dir + "/../lang") + "/";
|
||||
if (QDir(sibling_of_bin).exists())
|
||||
return(sibling_of_bin);
|
||||
}
|
||||
return(next_to_bin);
|
||||
}
|
||||
#else
|
||||
#ifndef QET_LANG_PATH_RELATIVE_TO_BINARY_PATH
|
||||
/* the compilation option represents
|
||||
@@ -1969,7 +1994,10 @@ void QETApp::configureQET()
|
||||
// cree le dialogue
|
||||
ConfigDialog cd;
|
||||
cd.setWindowTitle(tr("Configurer QElectroTech", "window title"));
|
||||
cd.setWindowModality(Qt::WindowModal);
|
||||
// ApplicationModal so no other window can dispatch events while the dialog
|
||||
// holds raw pointers derived from the current project list. Same class of
|
||||
// bug as ProjectPropertiesDialog — see issue #527.
|
||||
cd.setWindowModality(Qt::ApplicationModal);
|
||||
cd.addPage(new GeneralConfigurationPage());
|
||||
cd.addPage(new NewDiagramPage());
|
||||
cd.addPage(new ExportConfigPage());
|
||||
@@ -2473,9 +2501,6 @@ void QETApp::buildSystemTrayMenu()
|
||||
*/
|
||||
void QETApp::checkBackupFiles()
|
||||
{
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
return;
|
||||
#else
|
||||
QList<KAutoSaveFile *> stale_files = KAutoSaveFile::allStaleFiles();
|
||||
|
||||
//Remove from the list @stale_files, the stales file of opened project
|
||||
@@ -2550,7 +2575,6 @@ void QETApp::checkBackupFiles()
|
||||
delete stale;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2601,14 +2625,17 @@ void QETApp::fetchWindowStats(
|
||||
#ifdef Q_OS_DARWIN
|
||||
/**
|
||||
Gere les evenements, en particulier l'evenement FileOpen sous MacOs.
|
||||
Installe comme event filter sur QApplication dans main(), une fois
|
||||
QETApp construite (voir main.cpp).
|
||||
@param object Objet cible de l'evenement
|
||||
@param e Evenement a gerer
|
||||
*/
|
||||
bool QETApp::eventFiltrer(QObject *object, QEvent *e) {
|
||||
bool QETApp::eventFilter(QObject *object, QEvent *e) {
|
||||
// gere l'ouverture de fichiers (sous MacOs)
|
||||
if (e -> type() == QEvent::FileOpen) {
|
||||
// nom du fichier a ouvrir
|
||||
QString filename = static_cast<QFileOpenEvent *>(e) -> file();
|
||||
openFiles(QStringList() << filename);
|
||||
openFiles(QETArguments(QStringList() << filename));
|
||||
return(true);
|
||||
} else {
|
||||
return QObject::eventFilter(object, e);
|
||||
|
||||
+2
-3
@@ -178,10 +178,9 @@ class QETApp : public QObject
|
||||
static QTextOrientationSpinBoxWidget *createTextOrientationSpinBoxWidget();
|
||||
static TitleBlockTemplate *defaultTitleBlockTemplate();
|
||||
|
||||
protected:
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
bool eventFiltrer(QObject *object, QEvent *);
|
||||
public:
|
||||
bool eventFilter(QObject *object, QEvent *) override;
|
||||
#endif
|
||||
|
||||
// attributes
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "recentfiles.h"
|
||||
#include "ui/bomexportdialog.h"
|
||||
#include "ui/diagrampropertieseditordockwidget.h"
|
||||
#include "ui/backupdialog.h"
|
||||
#include "ui/dialogwaiting.h"
|
||||
#include "undocommand/addelementtextcommand.h"
|
||||
#include "undocommand/rotateselectioncommand.h"
|
||||
@@ -47,8 +48,11 @@
|
||||
#include "TerminalStrip/ui/addterminalstripitemdialog.h"
|
||||
#include "wiringlistexport.h"
|
||||
#include "ui/terminalnumberingdialog.h"
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
# include "ui/nokde/kautosavefile.h"
|
||||
#else
|
||||
# include <KAutoSaveFile>
|
||||
#endif
|
||||
@@ -372,8 +376,9 @@ void QETDiagramEditor::setUpActions()
|
||||
//Draw or not the background grid
|
||||
m_draw_grid = new QAction ( QET::Icons::Grid, tr("Afficher la grille"), this);
|
||||
m_draw_grid->setStatusTip(tr("Affiche ou masque la grille des folios"));
|
||||
QSettings settings;
|
||||
m_draw_grid->setCheckable(true);
|
||||
m_draw_grid->setChecked(true);
|
||||
m_draw_grid->setChecked(settings.value("diagrameditor/grid_display_startup", true).toBool());
|
||||
connect(m_draw_grid, &QAction::triggered, [this](bool checked) {
|
||||
foreach (ProjectView *prjv, this->openedProjects())
|
||||
foreach (Diagram *d, prjv->project()->diagrams()) {
|
||||
@@ -382,6 +387,18 @@ void QETDiagramEditor::setUpActions()
|
||||
}
|
||||
});
|
||||
|
||||
// Draw or not the custom guides
|
||||
m_draw_guides = new QAction ( QIcon(":/ico/22x22/guides.png"), tr("Afficher les guides"), this);
|
||||
m_draw_guides->setStatusTip(tr("Affiche ou masque les guides"));
|
||||
m_draw_guides->setCheckable(true);
|
||||
m_draw_guides->setChecked(settings.value("diagrameditor/guides_display_startup", false).toBool());
|
||||
connect(m_draw_guides, &QAction::triggered, [this](bool checked) {
|
||||
foreach (ProjectView *prjv, this->openedProjects())
|
||||
foreach (Diagram *d, prjv->project()->diagrams()) {
|
||||
d->setDisplayGuides(checked);
|
||||
}
|
||||
});
|
||||
|
||||
//Edit current diagram properties
|
||||
m_edit_diagram_properties = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
|
||||
m_edit_diagram_properties->setShortcut(Qt::CTRL | Qt::Key_L);
|
||||
@@ -764,6 +781,7 @@ void QETDiagramEditor::setUpToolBar()
|
||||
view_tool_bar -> addWidget(new DiagramEditorHandlerSizeWidget(this));
|
||||
view_tool_bar -> addSeparator();
|
||||
view_tool_bar -> addAction(m_draw_grid);
|
||||
view_tool_bar -> addAction(m_draw_guides);
|
||||
view_tool_bar -> addAction (m_grey_background);
|
||||
view_tool_bar -> addSeparator();
|
||||
view_tool_bar -> addActions(m_zoom_action_toolBar);
|
||||
@@ -1172,6 +1190,16 @@ bool QETDiagramEditor::openAndAddProject(
|
||||
QETApp::projectsRecentFiles() -> fileWasOpened(filepath);
|
||||
addProject(project);
|
||||
DialogWaiting::dropInstance();
|
||||
|
||||
BackupDialog backup_dialog(this);
|
||||
if (backup_dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString backup_path = filepath_info.absolutePath() + QDir::separator() +
|
||||
QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm") + "_" +
|
||||
filepath_info.fileName();
|
||||
QFile::copy(filepath, backup_path);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1576,6 +1604,7 @@ void QETDiagramEditor::slot_updateActions()
|
||||
m_row_column_actions_group. setEnabled(editable_project);
|
||||
m_grey_background-> setEnabled(opened_diagram);
|
||||
m_draw_grid-> setEnabled(opened_diagram);
|
||||
m_draw_guides-> setEnabled(opened_diagram);
|
||||
|
||||
//Project menu
|
||||
m_project_edit_properties -> setEnabled(opened_project);
|
||||
@@ -1948,8 +1977,6 @@ bool QETDiagramEditor::drawGrid() const
|
||||
return m_draw_grid->isChecked();
|
||||
}
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
/**
|
||||
@brief QETDiagramEditor::openBackupFiles
|
||||
@param backup_files
|
||||
@@ -1980,7 +2007,6 @@ void QETDiagramEditor::openBackupFiles(QList<KAutoSaveFile *> backup_files)
|
||||
DialogWaiting::dropInstance();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
met a jour le menu "Fenetres"
|
||||
*/
|
||||
@@ -2474,7 +2500,6 @@ void QETDiagramEditor::generateTerminalBlock()
|
||||
exeList << (QETApp::dataDir() + "/binary/qet_tb_generator.exe")
|
||||
<< (QDir::currentPath() + "/qet_tb_generator.exe")
|
||||
<< QStandardPaths::findExecutable("qet_tb_generator.exe")
|
||||
<< (QDir::homePath() + "/Application Data/qet/qet_tb_generator.exe")
|
||||
<< "qet_tb_generator.exe"
|
||||
<< "qet_tb_generator"; // from original code: missing ".exe" ???
|
||||
#elif defined(Q_OS_MACOS)
|
||||
|
||||
@@ -44,10 +44,7 @@ class ElementsCollectionWidget;
|
||||
class AutoNumberingDockWidget;
|
||||
class TerminalNumberingDialog;
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
class KAutoSaveFile;
|
||||
#endif
|
||||
/**
|
||||
This class represents the main window of the QElectroTech diagram editor and,
|
||||
ipso facto, the most important part of the QElectroTech user interface.
|
||||
@@ -72,14 +69,16 @@ class QETDiagramEditor : public QETMainWindow
|
||||
ProjectView *currentProjectView() const;
|
||||
QETProject *currentProject() const;
|
||||
bool drawGrid() const;
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
void openBackupFiles (QList<KAutoSaveFile *> backup_files);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool event(QEvent *) override;
|
||||
private:
|
||||
// Declared first so it is initialised before any member whose
|
||||
// constructor may dispatch a Qt event calling event() (e.g. the
|
||||
// QActionGroup members below trigger QObject::setParent events).
|
||||
bool m_first_show = true;
|
||||
|
||||
QETDiagramEditor(const QETDiagramEditor &);
|
||||
void setUpElementsPanel ();
|
||||
void setUpElementsCollectionWidget();
|
||||
@@ -194,6 +193,7 @@ class QETDiagramEditor : public QETMainWindow
|
||||
*conductor_default, ///< Show a dialog to edit default conductor properties
|
||||
*m_grey_background, ///< Switch the background color in white or grey
|
||||
*m_draw_grid, ///< Switch the background grid display or not
|
||||
*m_draw_guides = nullptr, ///< Switch the custom guides display or not
|
||||
*m_project_edit_properties, ///< Edit the properties of the current project.
|
||||
*m_project_add_diagram, ///< Add a diagram to the current project.
|
||||
*m_remove_diagram_from_project, ///< Delete a diagram from the current project
|
||||
@@ -253,7 +253,6 @@ class QETDiagramEditor : public QETMainWindow
|
||||
QUndoGroup undo_group;
|
||||
AutoNumberingDockWidget *m_autonumbering_dock;
|
||||
int activeSubWindowIndex;
|
||||
bool m_first_show = true;
|
||||
SearchAndReplaceWidget m_search_and_replace_widget;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "qetgraphicstableitem.h"
|
||||
|
||||
#include "../../qetproject.h"
|
||||
#include "../../QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "../../createdxf.h"
|
||||
#include "../../diagram.h"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "../qetgraphicsitem/conductor.h"
|
||||
|
||||
#include "../qetproject.h"
|
||||
#include "../QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "../autoNum/numerotationcontextcommands.h"
|
||||
#include "../conductorautonumerotation.h"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "crossrefitem.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#include "../qetproject.h"
|
||||
#include "../autoNum/assignvariables.h"
|
||||
#include "../diagram.h"
|
||||
#include "../diagramposition.h"
|
||||
@@ -928,7 +928,7 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt, in
|
||||
bounding_rect = bounding_rect.united(text_rect);
|
||||
|
||||
if (m_update_map)
|
||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
||||
m_hovered_contacts_map.insert(elmt, text_rect);
|
||||
|
||||
++m_drawed_contacts;
|
||||
}
|
||||
@@ -961,22 +961,21 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt, in
|
||||
painter.drawPolyline(p2, 3);
|
||||
|
||||
// Draw terminal names for switch contact (3 terminals)
|
||||
// terminal_names[0] = NO side (top left)
|
||||
// terminal_names[1] = NC side (bottom left)
|
||||
// terminal_names[2] = common side (right)
|
||||
// terminal_names[0] = NC (bottom-left)
|
||||
// terminal_names[1] = NO (top-left)
|
||||
// terminal_names[2] = Common (right)
|
||||
if (!terminal_names.isEmpty() && m_properties.showTerminalName()) {
|
||||
painter.setFont(QETApp::diagramTextsFont(4));
|
||||
// Sort order from parseTerminal (top->bottom, left->right):
|
||||
// [0]=12 (NO, top-left), [1]=14 (common, top-center), [2]=13 (NC, bottom-center)
|
||||
if (terminal_names.size() >= 1)
|
||||
painter.drawText(QRectF(0, offset, 8, 8),
|
||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[1]); // 12 NO left
|
||||
// Storage order set above: [0]=NC, [1]=NO, [2]=Common
|
||||
if (terminal_names.size() >= 2)
|
||||
painter.drawText(QRectF(16, offset+4, 8, 6),
|
||||
Qt::AlignRight|Qt::AlignTop, terminal_names[2]); // 14 common right
|
||||
painter.drawText(QRectF(0, offset, 8, 8),
|
||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[1]); // NO top-left
|
||||
if (terminal_names.size() >= 3)
|
||||
painter.drawText(QRectF(16, offset+4, 8, 6),
|
||||
Qt::AlignRight|Qt::AlignTop, terminal_names[2]); // Common right
|
||||
if (terminal_names.size() >= 1)
|
||||
painter.drawText(QRectF(0, offset+9, 8, 6),
|
||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[0]); // 13 NC left-bottom
|
||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[0]); // NC bottom-left
|
||||
painter.setFont(QETApp::diagramTextsFont(5));
|
||||
}
|
||||
|
||||
@@ -1012,7 +1011,7 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt, in
|
||||
bounding_rect = bounding_rect.united(text_rect);
|
||||
|
||||
if (m_update_map)
|
||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
||||
m_hovered_contacts_map.insert(elmt, text_rect);
|
||||
|
||||
//a switch contact take place of two normal contact
|
||||
m_drawed_contacts += 2;
|
||||
@@ -1044,7 +1043,7 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt, in
|
||||
bounding_rect = bounding_rect.united(text_rect);
|
||||
|
||||
if (m_update_map)
|
||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
||||
m_hovered_contacts_map.insert(elmt, text_rect);
|
||||
++m_drawed_contacts;
|
||||
}
|
||||
return bounding_rect;
|
||||
|
||||
@@ -126,6 +126,12 @@ class CrossRefItem : public QGraphicsObject
|
||||
ElementTextItemGroup *m_group = nullptr;
|
||||
QList <QMetaObject::Connection> m_slave_connection;
|
||||
QList <QMetaObject::Connection> m_update_connection;
|
||||
|
||||
public:
|
||||
/// Returns the map of linked elements and their clickable rects (local coords).
|
||||
/// Used by the PDF export to inject hyperlink annotations.
|
||||
const QMultiMap<Element *, QRectF> &hoveredContactsMap() const
|
||||
{ return m_hovered_contacts_map; }
|
||||
};
|
||||
|
||||
#endif // CROSSREFITEM_H
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user