mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-27 12:34:14 +02:00
Compare commits
278 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d5027eadbb | |||
| da09206826 | |||
| 9812166071 | |||
| 4efe28ce03 | |||
| 7c4355338b | |||
| 4c3e86c07e | |||
| 44cabbcfe4 | |||
| a2a30ef7c4 | |||
| 0b4f480dfe | |||
| 05260de87b | |||
| db154a8d06 | |||
| 7dc1d345b0 | |||
| ba1811a0cf | |||
| a3dc8d3ad4 | |||
| b1fe1ef7a7 | |||
| 9584fc4b7c | |||
| 25baf48153 | |||
| 7f51a3e10a | |||
| 503823bfce | |||
| 30c97612a2 | |||
| 8cdf51405a | |||
| 4a5755e552 | |||
| ef8b3866ba | |||
| f6f53e3f52 | |||
| 5120feb417 | |||
| cd38f6f2a2 | |||
| 29fe731728 | |||
| b740508b7f | |||
| 76eea09192 | |||
| 30e83d8c52 | |||
| 3a50cd9b0e | |||
| acb770909e | |||
| a9ad6e2f34 | |||
| ff795258c4 | |||
| 0cb424bd06 | |||
| 47e5a8072b | |||
| 5bd55801e9 | |||
| 5ccb089cdd | |||
| 416ababc41 | |||
| 63771a41b5 | |||
| 57905a5789 | |||
| 451cccd615 | |||
| af28a49b72 | |||
| 926bbcf75f | |||
| 6bcdb87524 | |||
| f850d0bee8 | |||
| d7036ad807 | |||
| 09fb81b99a | |||
| 501379def2 | |||
| 52a831e1fa | |||
| c1bb3b33f4 | |||
| f91ec74dde | |||
| b08d0692b7 | |||
| 627b818a30 | |||
| 0d2befbc00 | |||
| db387525e2 | |||
| 6763103d57 | |||
| 852c32fc07 | |||
| e82548bee9 | |||
| 60ab39b0f6 | |||
| b57c37ca62 | |||
| 329831d986 | |||
| b80d6e7cd3 | |||
| 6d42556d9f | |||
| 2da101ca90 | |||
| 07501d604e | |||
| 73ad43bd8f | |||
| c1d9e60656 | |||
| 92cbc8fd2a | |||
| db56262924 | |||
| 86cb7e430e | |||
| 3d260edcdb | |||
| 53706a80d8 | |||
| 1e74bcd9de | |||
| 45aec7735b | |||
| 923367d2a8 | |||
| 6dd260a7b2 | |||
| 132c564aef | |||
| e9c4969af7 | |||
| 040c4b5e29 | |||
| 71d708e2da | |||
| b490720652 | |||
| 519f2245f6 | |||
| b61193f66f | |||
| e6291eb8e8 | |||
| 0ca4b9f6c3 | |||
| a08cdf7272 | |||
| 2fdb225936 | |||
| 95f3ea2f6d | |||
| 0e02190eb2 | |||
| 2807771200 | |||
| 4cffdf93b6 | |||
| 9738345b45 | |||
| 286002fe25 | |||
| ce0e7e6867 | |||
| 5f0b015186 | |||
| e5738c5b7d | |||
| c3c264cd78 | |||
| d392ab4b8f | |||
| ebd4a57563 | |||
| 23d83ec153 | |||
| d43c535cc9 | |||
| 71782aec20 | |||
| 59dc59cf2f | |||
| 469c8cbc70 | |||
| 1330dbb435 | |||
| e7f19de2da | |||
| 4c9a307cb9 | |||
| 4381c6caa3 | |||
| 07d7aedc26 | |||
| 5622308ba2 | |||
| 149ae961cc | |||
| ac40d110fb | |||
| 4f309770f0 | |||
| 72cf86ece0 | |||
| 8aefdcc481 | |||
| 3a45625d69 | |||
| 988357057f | |||
| e9676ef87e | |||
| ca507dc0f3 | |||
| 1932150ea6 | |||
| 23241fba69 | |||
| f2f1051914 | |||
| 313aafc95b | |||
| aaeaff55cc | |||
| bb037ee3ff | |||
| 17ebbffbca | |||
| 04e2279a7f | |||
| 9987f05835 | |||
| a94f30b256 | |||
| 73075a5154 | |||
| 9875de85d7 | |||
| 48883b320e | |||
| d1256872c2 | |||
| b93d8d8baa | |||
| ae41dd7686 | |||
| 800189debb | |||
| 522e008c26 | |||
| 7fbbb71aac | |||
| 232724bf82 | |||
| 12f826e969 | |||
| 245aafb0d1 | |||
| 0d231ef548 | |||
| 3513f692fd | |||
| 5a27f3cf80 | |||
| d3a9adbe44 | |||
| 8ab4e24b61 | |||
| 2d2bf5ca2b | |||
| 2f6ab8f63b | |||
| 2266497b0b | |||
| dcb79b6553 | |||
| 745b4a936c | |||
| 7ac3719c37 | |||
| ddfa234943 | |||
| 9af562fcbd | |||
| c85276f61b | |||
| c1cc9a5b98 | |||
| f3a31c291f | |||
| a06220e8dc | |||
| 79990e40ee | |||
| e1e7ea4888 | |||
| 54b8fe5df4 | |||
| be0d214b75 | |||
| 2f988e6e2c | |||
| 9786006ca4 | |||
| 91e8956734 | |||
| 6fad3390df | |||
| 231ab990c3 | |||
| f10275cb22 | |||
| 3d0e7a27a3 | |||
| f14278324c | |||
| d5318eb7b4 | |||
| f10ef3ded7 | |||
| 6f7ea63589 | |||
| 9a6029a2bb | |||
| bc0ca56c7e | |||
| 1d4c0326d4 | |||
| d889a384aa | |||
| 3457a88e81 | |||
| 4e361f93fe | |||
| 6a8838e719 | |||
| 774f803626 | |||
| 5b0785fcce | |||
| ed0f800ab5 | |||
| de9b3eae06 | |||
| 032f2249a3 | |||
| 1890cee801 | |||
| 3eea3059bf | |||
| 6d8459d647 | |||
| 28acbadaf0 | |||
| 4456d08b91 | |||
| aae7a8bde3 | |||
| 4bcf5834e4 | |||
| f6889af99c | |||
| 9e5af6440b | |||
| b97bccecd3 | |||
| 14cf3e403f | |||
| 1f0ed43006 | |||
| fc2a200ca2 | |||
| ccf96e0537 | |||
| fa213d90d9 | |||
| 84add7b3ef | |||
| 36fb048a80 | |||
| a7ae17a1b4 | |||
| a1675d7dea | |||
| 13a37e1f59 | |||
| 6fc7e4a090 | |||
| 08b83f23e3 | |||
| 3fa5e0a475 | |||
| 8334a9a27f | |||
| 4a636b14e3 | |||
| f777be05b4 | |||
| 8ee3f90047 | |||
| 41e1e8172c | |||
| 1212f48c6d | |||
| e01f46c5b0 | |||
| bf7f49f334 | |||
| 3cec02b3f3 | |||
| a2e384761c | |||
| 4283ddad10 | |||
| 1046b97080 | |||
| a766f9a975 | |||
| 68503e2a7d | |||
| 3b05f5cf13 | |||
| 2906a48aab | |||
| a542b911e9 | |||
| 9cee71bde2 | |||
| 687837d7a3 | |||
| ea1f65107e | |||
| 6380e2a46b | |||
| 219273a8e5 | |||
| 8a2d31d835 | |||
| a8f883601d | |||
| cd27912605 | |||
| f087820757 | |||
| 2772b690e8 | |||
| 279b001a16 | |||
| 59cc758b7f | |||
| 0c958d3b66 | |||
| 528d33792d | |||
| fc41cf9f5d | |||
| 7f04bc1572 | |||
| 27bbf51024 | |||
| 65299e1178 | |||
| 8e2a29deaf | |||
| 5b739c3338 | |||
| a1e4e153ae | |||
| 56f60be60a | |||
| 852f581206 | |||
| 3b626a7d1a | |||
| 069a75d44b | |||
| e1f887a036 | |||
| c5edd0a54b | |||
| 3a13287ba9 | |||
| 24776bfcf6 | |||
| 3202c145e8 | |||
| 4888ae87f3 | |||
| 59344eb565 | |||
| 5d033bf1b2 | |||
| 8985babfe7 | |||
| 29d16c3337 | |||
| 61f5e5e502 | |||
| 77bc9ed8e4 | |||
| 9b26d5dc6a | |||
| b76d8ce8a1 | |||
| 78caeaec48 | |||
| 27dea3ffab | |||
| 2ec413a578 | |||
| 61ce75e380 | |||
| 83b9f32bd0 | |||
| e35cab33f0 | |||
| 2e4bb486bb | |||
| 4e754cfac1 | |||
| 151b16ba76 | |||
| 0902725a59 | |||
| 280051745a | |||
| e3ede85efd | |||
| 95c2f6cf6d |
@@ -1 +0,0 @@
|
||||
*.qch filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
name: Auto-build doxygen docs
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '**'
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
doxygen:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
show-progress: ''
|
||||
- name: Setup and run doxygen
|
||||
run: sudo apt update && sudo apt install doxygen graphviz qhelpgenerator-qt5 -y
|
||||
- name: Set up Git LFS
|
||||
run: |
|
||||
git lfs install
|
||||
git lfs track "*.qch"
|
||||
- name: Run doxygen
|
||||
run: doxygen Doxyfile
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v8
|
||||
with:
|
||||
token: ${{ secrets.MR_TOKEN }}
|
||||
commit-message: update QCH file
|
||||
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
||||
title: Update QCH Help file
|
||||
body: |
|
||||
- Updating QT Help file following commit ${{ github.sha }}.
|
||||
- Auto-generated by [create-pull-request][1]
|
||||
|
||||
[1]: https://github.com/peter-evans/create-pull-request
|
||||
branch: update-qch
|
||||
labels: |
|
||||
qch
|
||||
cicd
|
||||
delete-branch: true
|
||||
add-paths: doc/*.qch
|
||||
- uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ${{ github.workspace }}/doc/html/
|
||||
deploy:
|
||||
# Add a dependency to the build job
|
||||
needs: doxygen
|
||||
|
||||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
|
||||
permissions:
|
||||
pages: write # to deploy to Pages
|
||||
id-token: write # to verify the deployment originates from an appropriate source
|
||||
|
||||
# Deploy to the github-pages environment
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
|
||||
# Specify runner + deployment step
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
ca-certificates build-essential cmake ninja-build git pkg-config \
|
||||
qt6-base-dev qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools \
|
||||
libqt6svg6-dev libqt6sql6-sqlite libsqlite3-dev libcups2-dev \
|
||||
libqt6svg6-dev libqt6sql6-sqlite libcups2-dev libsqlite3-dev \
|
||||
libxkbcommon-x11-0 \
|
||||
xvfb openbox xdotool x11-utils
|
||||
# extra-cmake-modules and the KF6 libraries are installed rather than
|
||||
@@ -53,7 +53,9 @@ jobs:
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
cmake -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DQT_VERSION_MAJOR=6
|
||||
-DQT_VERSION_MAJOR=6 \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DQET_EXPORT_PROJECT_DB=ON
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --parallel $(nproc)
|
||||
|
||||
@@ -57,6 +57,7 @@ jobs:
|
||||
mingw-w64-ucrt-x86_64-nsis
|
||||
mingw-w64-ucrt-x86_64-angleproject
|
||||
mingw-w64-ucrt-x86_64-qt6-declarative
|
||||
mingw-w64-ucrt-x86_64-hidapi
|
||||
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v5
|
||||
@@ -120,6 +121,8 @@ jobs:
|
||||
-DCMAKE_POLICY_DEFAULT_CMP0077=NEW \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DQET_EXPORT_PROJECT_DB=ON \
|
||||
-DQET_ENABLE_SPACEMOUSE=ON \
|
||||
-DQET_SPACEMOUSE_BACKEND=hid \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=/ucrt64/bin/ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=/ucrt64/bin/ccache \
|
||||
-DSQLite3_INCLUDE_DIR=/ucrt64/include \
|
||||
@@ -146,6 +149,11 @@ jobs:
|
||||
SIZE=$(stat -c%s "$EXE")
|
||||
echo "Exe found: $EXE ($SIZE bytes)"
|
||||
[ "$SIZE" -gt 100000 ] || { echo "ERROR: exe too small"; exit 1; }
|
||||
# 3D mouse support (discussion #599): CMake only warns when hidapi
|
||||
# is missing, which would ship a package without it -- fail here.
|
||||
ldd "$EXE" | grep -qi 'libhidapi' \
|
||||
|| { echo "ERROR: exe not linked against hidapi -- 3D mouse support missing"; exit 1; }
|
||||
echo "3D mouse support: linked against $(ldd "$EXE" | grep -io 'libhidapi[^ ]*' | head -1)"
|
||||
|
||||
- name: Deploy — copy exe + windeployqt + DLLs
|
||||
shell: msys2 {0}
|
||||
@@ -191,6 +199,8 @@ jobs:
|
||||
echo "=== $DLL_COUNT DLLs present after scan ==="
|
||||
ls -lh "$BIN/QElectroTech.exe" || { echo "ERROR: exe missing from bin/"; exit 1; }
|
||||
[ "$DLL_COUNT" -gt 5 ] || { echo "ERROR: too few DLLs"; exit 1; }
|
||||
# Without it QElectroTech.exe would not start at all.
|
||||
[ -f "$BIN/libhidapi-0.dll" ] || { echo "ERROR: libhidapi-0.dll not deployed"; exit 1; }
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
|
||||
cp /ucrt64/bin/libgcc_s_seh-1.dll "$BIN/"
|
||||
|
||||
@@ -59,17 +59,41 @@ jobs:
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 2. Download the portable artifact for this flavor
|
||||
#
|
||||
# Wrapped in nick-fields/retry: actions/download-artifact@v8 has
|
||||
# shown repeated "Artifact download failed after 5 retries"
|
||||
# failures on this cross-workflow download (via run-id) — not a
|
||||
# real content/digest problem, just flaky Azure blob delivery.
|
||||
# Two separate occurrences observed within days of each other
|
||||
# (different artifact IDs/digests, same failure signature), each
|
||||
# one enough to fail build-msi outright and block the rest of the
|
||||
# pipeline. Retrying the whole download 3x is cheap insurance.
|
||||
# Switched to `gh run download` here because nick-fields/retry
|
||||
# can only retry a shell command, not re-invoke a `uses:` step.
|
||||
# ----------------------------------------------------------------
|
||||
- name: Download portable artifact
|
||||
uses: actions/download-artifact@v8
|
||||
uses: nick-fields/retry@v3
|
||||
with:
|
||||
name: ${{ matrix.portable_artifact }}
|
||||
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 }}
|
||||
timeout_minutes: 10
|
||||
max_attempts: 3
|
||||
retry_wait_seconds: 30
|
||||
shell: pwsh
|
||||
command: |
|
||||
if (Test-Path "artifact\files") { Remove-Item -Recurse -Force "artifact\files" }
|
||||
New-Item -ItemType Directory -Force -Path "artifact\files" | Out-Null
|
||||
|
||||
$runId = "${{ github.event.workflow_run.id || github.event.inputs.run_id || github.run_id }}"
|
||||
gh run download $runId `
|
||||
--repo "${{ github.repository }}" `
|
||||
--name "${{ matrix.portable_artifact }}" `
|
||||
--dir "artifact\files"
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "gh run download failed (exit $LASTEXITCODE)"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# 3. Extract version
|
||||
@@ -336,7 +360,13 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Delete old nightly .msi asset
|
||||
if: always()
|
||||
# Only run if a new MSI actually exists in dist/ — otherwise the old
|
||||
# (still working) nightly .msi would be deleted without anything to
|
||||
# replace it, leaving the nightly release with no MSI at all until
|
||||
# the next successful build (see windows-msi-pipeline notes,
|
||||
# run 35694391567: an upstream artifact-download failure meant
|
||||
# dist\*.msi never existed for that run).
|
||||
if: always() && hashFiles('dist/*.msi') != ''
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
@@ -381,7 +411,20 @@ jobs:
|
||||
deploy-pages:
|
||||
needs: build-msi
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && needs.build-msi.result == 'success'
|
||||
# Regenerate the page whenever the MSI job actually ran (success OR
|
||||
# packaging/signing failure) — not only on full success.
|
||||
# generate-page.py queries the published assets on the "nightly"
|
||||
# release itself (line 407: `gh release view nightly --json assets`),
|
||||
# so it already handles a missing MSI natively (empty MSI_NAME -> no
|
||||
# MSI button on the page). The page only needs the exe/zip already
|
||||
# published by windows-build.yml, independent of the MSI's fate.
|
||||
# Only "skipped"/"cancelled" are excluded: if build-msi never ran at
|
||||
# all (e.g. Windows Build itself failed), there is nothing new to
|
||||
# publish and regenerating the page would be pointless.
|
||||
if: >
|
||||
always() &&
|
||||
needs.build-msi.result != 'skipped' &&
|
||||
needs.build-msi.result != 'cancelled'
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
|
||||
+3
-9
@@ -1,5 +1,7 @@
|
||||
*.snap
|
||||
.flatpak-builder
|
||||
__pycache__/
|
||||
*.pyc
|
||||
# Qt build output
|
||||
*.user
|
||||
# doxygen Doxyfile output
|
||||
@@ -7,12 +9,4 @@ doc/*
|
||||
!doc/QElectroTech.qch
|
||||
QElectroTech.tag
|
||||
!doc/doc-utils
|
||||
lang/*.qm
|
||||
|
||||
# -- IDE settings/intermediate files --
|
||||
# zed
|
||||
.zed
|
||||
.cache
|
||||
|
||||
# VS Code
|
||||
.vscode
|
||||
ui_*.h
|
||||
|
||||
+9
-1
@@ -36,6 +36,7 @@ include(cmake/git_update_submodules.cmake)
|
||||
include(cmake/git_last_commit_sha.cmake)
|
||||
include(cmake/fetch_singleapplication.cmake)
|
||||
include(cmake/fetch_pugixml.cmake)
|
||||
include(cmake/find_spacemouse.cmake)
|
||||
include(cmake/qet_compilation_vars.cmake)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
@@ -169,6 +170,13 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
if(QET_SPACEMOUSE_BACKEND_SPNAV_ENABLED)
|
||||
list(APPEND QET_SPACEMOUSE_LIBRARIES PkgConfig::SPNAV)
|
||||
endif()
|
||||
if(QET_SPACEMOUSE_BACKEND_HID_ENABLED)
|
||||
list(APPEND QET_SPACEMOUSE_LIBRARIES PkgConfig::HIDAPI)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
# CFBundleIdentifier must not be empty. CMake's default Info.plist
|
||||
# template fills it from MACOSX_BUNDLE_GUI_IDENTIFIER; with that unset
|
||||
@@ -287,6 +295,7 @@ target_link_libraries(
|
||||
SQLite3::SQLite3
|
||||
${KF_PRIVATE_LIBRARIES}
|
||||
${QET_PRIVATE_LIBRARIES}
|
||||
${QET_SPACEMOUSE_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
@@ -318,7 +327,6 @@ target_include_directories(
|
||||
${QET_DIR}/sources/NameList
|
||||
${QET_DIR}/sources/NameList/ui
|
||||
${QET_DIR}/sources/utils
|
||||
${QET_DIR}/pugixml/src
|
||||
${QET_DIR}/sources/dataBase
|
||||
${QET_DIR}/sources/dataBase/ui
|
||||
${QET_DIR}/sources/factory/ui
|
||||
|
||||
@@ -50,6 +50,7 @@ parts:
|
||||
- python3-lxml
|
||||
- python3-tk
|
||||
- libtk8.6
|
||||
- libspnav0
|
||||
|
||||
kde-sdk-setup:
|
||||
plugin: nil
|
||||
@@ -92,6 +93,7 @@ parts:
|
||||
# runs FindCups at configure time and fails without the CUPS headers.
|
||||
# Build-time only: nothing from it is staged into the snap.
|
||||
- libcups2-dev
|
||||
- libspnav-dev
|
||||
override-build: |
|
||||
displayed_version=$(cat sources/qetversion.cpp | grep "return QVersionNumber{"| head -n 1| awk -F "{" '{ print $2 }' | awk -F "}" '{ print $1 }' | sed -e 's/,/./g' -e 's/ //g')
|
||||
snap_version="${displayed_version}-g$(git rev-parse --short=8 HEAD)"
|
||||
@@ -106,7 +108,8 @@ parts:
|
||||
-DBUILD_KF=OFF \
|
||||
-DPACKAGE_TESTS=OFF \
|
||||
-DBUILD_PUGIXML=ON \
|
||||
-DQET_EXPORT_PROJECT_DB=ON
|
||||
-DQET_EXPORT_PROJECT_DB=ON \
|
||||
-DQET_ENABLE_SPACEMOUSE=ON
|
||||
ninja -C build -j${CRAFT_PARALLEL_BUILD_COUNT}
|
||||
DESTDIR="$CRAFT_PART_INSTALL" ninja -C build install
|
||||
override-stage: |
|
||||
|
||||
@@ -47,3 +47,8 @@ option(BUILD_WITH_KF "Build with KDE Frameworks" ON)
|
||||
# compile for everyone else. Leaving it off keeps CI and contributors on the
|
||||
# strict behaviour, and only developers who opt in trade that for the speed.
|
||||
option(QET_ENABLE_PCH "Use precompiled headers (developer build speed; may mask missing #includes)" OFF)
|
||||
|
||||
# Discussion #599: 3Dconnexion SpaceMouse/SpacePilot pan/zoom support. Off by
|
||||
# default -- see cmake/find_spacemouse.cmake for the backends and what happens
|
||||
# when it is on but no library is found.
|
||||
option(QET_ENABLE_SPACEMOUSE "Build with 3D mouse (3Dconnexion SpaceMouse) support for pan/zoom; needs libspnav or hidapi, see QET_SPACEMOUSE_BACKEND" OFF)
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# Copyright 2006 The QElectroTech Team
|
||||
# This file is part of QElectroTech.
|
||||
#
|
||||
# QElectroTech is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# QElectroTech is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
message(" - find_spacemouse")
|
||||
|
||||
# QET_ENABLE_SPACEMOUSE (cmake/developer_options.cmake) is off by default,
|
||||
# so none of this runs, and the default build is entirely unaffected: no new
|
||||
# dependency, no new source files, no new symbols.
|
||||
#
|
||||
# When it is on, QET_SPACEMOUSE_BACKEND picks how the device is read -- see
|
||||
# sources/spacemouse/spacemousebackend.h for what a backend is:
|
||||
# spnav Linux, through the spacenavd daemon (libspnav)
|
||||
# hid any platform, directly over USB (hidapi), no 3Dconnexion driver
|
||||
# auto spnav on Linux when libspnav is found, hid otherwise
|
||||
# On macOS the 3DxWare backend is added to whichever of these is chosen.
|
||||
# A backend whose library is not found downgrades the option to off with a
|
||||
# warning, rather than failing configure for an opt-in feature.
|
||||
set(QET_SPACEMOUSE_BACKEND "auto" CACHE STRING "3D mouse backend: auto, spnav or hid")
|
||||
set_property(CACHE QET_SPACEMOUSE_BACKEND PROPERTY STRINGS auto spnav hid)
|
||||
|
||||
set(QET_SPACEMOUSE_ENABLED FALSE)
|
||||
set(QET_SPACEMOUSE_BACKEND_SPNAV_ENABLED FALSE)
|
||||
set(QET_SPACEMOUSE_BACKEND_HID_ENABLED FALSE)
|
||||
set(QET_SPACEMOUSE_BACKEND_CONNEXION_ENABLED FALSE)
|
||||
|
||||
if(QET_ENABLE_SPACEMOUSE)
|
||||
find_package(PkgConfig)
|
||||
|
||||
set(_qet_spacemouse_try_spnav FALSE)
|
||||
set(_qet_spacemouse_try_hid FALSE)
|
||||
if(QET_SPACEMOUSE_BACKEND STREQUAL "spnav")
|
||||
set(_qet_spacemouse_try_spnav TRUE)
|
||||
elseif(QET_SPACEMOUSE_BACKEND STREQUAL "hid")
|
||||
set(_qet_spacemouse_try_hid TRUE)
|
||||
else()
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(_qet_spacemouse_try_spnav TRUE)
|
||||
endif()
|
||||
set(_qet_spacemouse_try_hid TRUE)
|
||||
endif()
|
||||
|
||||
# libspnav: Debian/Ubuntu's libspnav-dev ships spnav.pc.
|
||||
if(_qet_spacemouse_try_spnav AND PkgConfig_FOUND)
|
||||
pkg_check_modules(SPNAV IMPORTED_TARGET spnav)
|
||||
if(SPNAV_FOUND)
|
||||
set(QET_SPACEMOUSE_ENABLED TRUE)
|
||||
set(QET_SPACEMOUSE_BACKEND_SPNAV_ENABLED TRUE)
|
||||
add_definitions(-DQET_SPACEMOUSE_BACKEND_SPNAV)
|
||||
message("QET_ENABLE_SPACEMOUSE ON (backend: libspnav ${SPNAV_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# hidapi: hidapi-hidraw.pc on Linux (libhidapi-dev), hidapi.pc from
|
||||
# MSYS2 (mingw-w64-ucrt-x86_64-hidapi) and Homebrew (hidapi).
|
||||
if(NOT QET_SPACEMOUSE_ENABLED AND _qet_spacemouse_try_hid AND PkgConfig_FOUND)
|
||||
pkg_search_module(HIDAPI IMPORTED_TARGET hidapi-hidraw hidapi)
|
||||
if(HIDAPI_FOUND)
|
||||
set(QET_SPACEMOUSE_ENABLED TRUE)
|
||||
set(QET_SPACEMOUSE_BACKEND_HID_ENABLED TRUE)
|
||||
add_definitions(-DQET_SPACEMOUSE_BACKEND_HID)
|
||||
message("QET_ENABLE_SPACEMOUSE ON (backend: hidapi ${HIDAPI_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# macOS: with 3DxWare installed the device can only be read through
|
||||
# 3DxWare, so its backend comes too, whichever backend was asked for.
|
||||
# It loads 3DxWare's library at run time and needs nothing to build.
|
||||
if(APPLE)
|
||||
set(QET_SPACEMOUSE_ENABLED TRUE)
|
||||
set(QET_SPACEMOUSE_BACKEND_CONNEXION_ENABLED TRUE)
|
||||
add_definitions(-DQET_SPACEMOUSE_BACKEND_CONNEXION)
|
||||
message("QET_ENABLE_SPACEMOUSE ON (backend: 3DxWare when installed)")
|
||||
endif()
|
||||
|
||||
if(QET_SPACEMOUSE_ENABLED)
|
||||
add_definitions(-DQET_SPACEMOUSE_SUPPORT)
|
||||
else()
|
||||
message(WARNING "QET_ENABLE_SPACEMOUSE is ON but no library was found for the "
|
||||
"'${QET_SPACEMOUSE_BACKEND}' backend (libspnav-dev for spnav, "
|
||||
"hidapi for hid, via pkg-config) -- building WITHOUT 3D mouse support.")
|
||||
endif()
|
||||
endif()
|
||||
@@ -62,7 +62,9 @@ if(WIN32)
|
||||
# puts the .qm files (see build-aux/windows/QElectroTech.wxs and the
|
||||
# windows-build workflow), and what the shortcuts pass as --lang-dir.
|
||||
set(QET_LANG_PATH "lang/")
|
||||
set(QET_EXAMPLES_PATH "examples/")
|
||||
set(QET_LICENSE_PATH "./")
|
||||
set(QET_ICONS_PATH "icons/hicolor/")
|
||||
# Liste des ressources Windows
|
||||
#RC_FILE = qelectrotech.rc
|
||||
endif()
|
||||
|
||||
@@ -168,6 +168,9 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/borderproperties.h
|
||||
${QET_DIR}/sources/bordertitleblock.cpp
|
||||
${QET_DIR}/sources/bordertitleblock.h
|
||||
${QET_DIR}/sources/bordercelllabels.h
|
||||
${QET_DIR}/sources/cellruler.cpp
|
||||
${QET_DIR}/sources/cellruler.h
|
||||
${QET_DIR}/sources/conductorautonumerotation.cpp
|
||||
${QET_DIR}/sources/conductorautonumerotation.h
|
||||
${QET_DIR}/sources/conductornumexport.cpp
|
||||
@@ -282,6 +285,14 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/recentfiles.h
|
||||
${QET_DIR}/sources/shortcutmanager.cpp
|
||||
${QET_DIR}/sources/shortcutmanager.h
|
||||
${QET_DIR}/sources/shortcutbarsettings.cpp
|
||||
${QET_DIR}/sources/shortcutbarsettings.h
|
||||
${QET_DIR}/sources/diagramcontexttoolbar.cpp
|
||||
${QET_DIR}/sources/diagramcontexttoolbar.h
|
||||
${QET_DIR}/sources/diagramgestureoverlay.cpp
|
||||
${QET_DIR}/sources/diagramgestureoverlay.h
|
||||
${QET_DIR}/sources/commandsearchpopup.cpp
|
||||
${QET_DIR}/sources/commandsearchpopup.h
|
||||
${QET_DIR}/sources/titleblockcell.cpp
|
||||
${QET_DIR}/sources/titleblockcell.h
|
||||
${QET_DIR}/sources/titleblockproperties.cpp
|
||||
@@ -297,6 +308,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/autoNum/numerotationcontextcommands.h
|
||||
${QET_DIR}/sources/autoNum/numerotationcontext.cpp
|
||||
${QET_DIR}/sources/autoNum/numerotationcontext.h
|
||||
${QET_DIR}/sources/autoNum/renumberelementscommand.cpp
|
||||
${QET_DIR}/sources/autoNum/renumberelementscommand.h
|
||||
${QET_DIR}/sources/autoNum/ui/autonumberingdockwidget.cpp
|
||||
${QET_DIR}/sources/autoNum/ui/autonumberingdockwidget.h
|
||||
${QET_DIR}/sources/autoNum/ui/autonumberingmanagementw.cpp
|
||||
@@ -307,11 +320,15 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/autoNum/ui/formulaautonumberingw.h
|
||||
${QET_DIR}/sources/autoNum/ui/numparteditorw.cpp
|
||||
${QET_DIR}/sources/autoNum/ui/numparteditorw.h
|
||||
${QET_DIR}/sources/autoNum/ui/renumberelementsdialog.cpp
|
||||
${QET_DIR}/sources/autoNum/ui/renumberelementsdialog.h
|
||||
${QET_DIR}/sources/autoNum/ui/selectautonumw.cpp
|
||||
${QET_DIR}/sources/autoNum/ui/selectautonumw.h
|
||||
|
||||
${QET_DIR}/sources/dataBase/projectdatabase.cpp
|
||||
${QET_DIR}/sources/dataBase/projectdatabase.h
|
||||
${QET_DIR}/sources/dataBase/sqlreadonly.cpp
|
||||
${QET_DIR}/sources/dataBase/sqlreadonly.h
|
||||
|
||||
${QET_DIR}/sources/dataBase/ui/elementquerywidget.cpp
|
||||
${QET_DIR}/sources/dataBase/ui/elementquerywidget.h
|
||||
@@ -442,6 +459,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/ElementsCollection/elementpreviewdelegate.h
|
||||
${QET_DIR}/sources/ElementsCollection/elementscollectionmodel.cpp
|
||||
${QET_DIR}/sources/ElementsCollection/elementscollectionmodel.h
|
||||
${QET_DIR}/sources/ElementsCollection/elementpickerpopup.cpp
|
||||
${QET_DIR}/sources/ElementsCollection/elementpickerpopup.h
|
||||
${QET_DIR}/sources/ElementsCollection/elementscollectionwidget.cpp
|
||||
${QET_DIR}/sources/ElementsCollection/elementscollectionwidget.h
|
||||
${QET_DIR}/sources/ElementsCollection/elementslocation.cpp
|
||||
@@ -507,10 +526,6 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.cpp
|
||||
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.h
|
||||
|
||||
${QET_DIR}/pugixml/src/pugiconfig.hpp
|
||||
${QET_DIR}/pugixml/src/pugixml.cpp
|
||||
${QET_DIR}/pugixml/src/pugixml.hpp
|
||||
|
||||
${QET_DIR}/sources/qetgraphicsitem/conductor.cpp
|
||||
${QET_DIR}/sources/qetgraphicsitem/conductor.h
|
||||
${QET_DIR}/sources/qetgraphicsitem/conductortextitem.cpp
|
||||
@@ -701,6 +716,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/ui/borderpropertieswidget.h
|
||||
${QET_DIR}/sources/ui/compositetexteditdialog.cpp
|
||||
${QET_DIR}/sources/ui/compositetexteditdialog.h
|
||||
${QET_DIR}/sources/ui/conductorpropertieseditorwidget.cpp
|
||||
${QET_DIR}/sources/ui/conductorpropertieseditorwidget.h
|
||||
${QET_DIR}/sources/ui/contactgroupselectiondialog.cpp
|
||||
${QET_DIR}/sources/ui/contactgroupselectiondialog.h
|
||||
${QET_DIR}/sources/ui/conductorpropertiesdialog.cpp
|
||||
@@ -725,6 +742,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/ui/backupdialog.h
|
||||
${QET_DIR}/sources/ui/dialogwaiting.cpp
|
||||
${QET_DIR}/sources/ui/dialogwaiting.h
|
||||
${QET_DIR}/sources/ui/duplicateoffsetdialog.cpp
|
||||
${QET_DIR}/sources/ui/duplicateoffsetdialog.h
|
||||
${QET_DIR}/sources/ui/dynamicelementtextitemeditor.cpp
|
||||
${QET_DIR}/sources/ui/dynamicelementtextitemeditor.h
|
||||
${QET_DIR}/sources/ui/dynamicelementtextmodel.cpp
|
||||
@@ -790,6 +809,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/ui/configpage/guidespropertieswidget.h
|
||||
${QET_DIR}/sources/ui/configpage/shortcutsconfigpage.cpp
|
||||
${QET_DIR}/sources/ui/configpage/shortcutsconfigpage.h
|
||||
${QET_DIR}/sources/ui/configpage/shortcutbarconfigpage.cpp
|
||||
${QET_DIR}/sources/ui/configpage/shortcutbarconfigpage.h
|
||||
|
||||
${QET_DIR}/sources/undocommand/addelementtextcommand.cpp
|
||||
${QET_DIR}/sources/undocommand/addelementtextcommand.h
|
||||
@@ -815,6 +836,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/undocommand/removediagramcommand.h
|
||||
${QET_DIR}/sources/undocommand/setautonumcontextcommand.cpp
|
||||
${QET_DIR}/sources/undocommand/setautonumcontextcommand.h
|
||||
${QET_DIR}/sources/undocommand/alignselectioncommand.cpp
|
||||
${QET_DIR}/sources/undocommand/alignselectioncommand.h
|
||||
${QET_DIR}/sources/undocommand/rotateselectioncommand.cpp
|
||||
${QET_DIR}/sources/undocommand/rotateselectioncommand.h
|
||||
${QET_DIR}/sources/undocommand/promoteshapecommand.cpp
|
||||
@@ -871,6 +894,43 @@ list(APPEND QET_SRC_FILES
|
||||
${QET_DIR}/sources/scripting/qetscripting.h
|
||||
)
|
||||
|
||||
if(QET_SPACEMOUSE_ENABLED)
|
||||
list(APPEND QET_SRC_FILES
|
||||
${QET_DIR}/sources/spacemouse/spacemousebackend.h
|
||||
${QET_DIR}/sources/spacemouse/spacemousebuttonmap.cpp
|
||||
${QET_DIR}/sources/spacemouse/spacemousebuttonmap.h
|
||||
${QET_DIR}/sources/spacemouse/spacemouselistener.cpp
|
||||
${QET_DIR}/sources/spacemouse/spacemouselistener.h
|
||||
${QET_DIR}/sources/spacemouse/spacemousemotion.cpp
|
||||
${QET_DIR}/sources/spacemouse/spacemousemotion.h
|
||||
${QET_DIR}/sources/ui/configpage/spacemouseconfigpage.cpp
|
||||
${QET_DIR}/sources/ui/configpage/spacemouseconfigpage.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(QET_SPACEMOUSE_BACKEND_SPNAV_ENABLED)
|
||||
list(APPEND QET_SRC_FILES
|
||||
${QET_DIR}/sources/spacemouse/spnavbackend.cpp
|
||||
${QET_DIR}/sources/spacemouse/spnavbackend.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(QET_SPACEMOUSE_BACKEND_HID_ENABLED)
|
||||
list(APPEND QET_SRC_FILES
|
||||
${QET_DIR}/sources/spacemouse/hidbackend.cpp
|
||||
${QET_DIR}/sources/spacemouse/hidbackend.h
|
||||
${QET_DIR}/sources/spacemouse/spacemousehid.cpp
|
||||
${QET_DIR}/sources/spacemouse/spacemousehid.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(QET_SPACEMOUSE_BACKEND_CONNEXION_ENABLED)
|
||||
list(APPEND QET_SRC_FILES
|
||||
${QET_DIR}/sources/spacemouse/connexionbackend.cpp
|
||||
${QET_DIR}/sources/spacemouse/connexionbackend.h
|
||||
)
|
||||
endif()
|
||||
|
||||
set(TS_FILES
|
||||
${QET_DIR}/lang/qet_ar.ts
|
||||
${QET_DIR}/lang/qet_ca.ts
|
||||
|
||||
+1
-1
Submodule elements updated: 60eacc28a6...08e438a919
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,222 @@
|
||||
<!DOCTYPE QPH>
|
||||
<QPH sourcelanguage="fr_FR" language="ca">
|
||||
<phrase>
|
||||
<source>Réf. croisée</source>
|
||||
<target>Ref. creuada</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>armoire</source>
|
||||
<target>armari</target>
|
||||
<definition>cabinet / enclosure</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bobine</source>
|
||||
<target>bobina</target>
|
||||
<definition>coil</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>borne</source>
|
||||
<target>born</target>
|
||||
<definition>terminal - a connection point on a symbol</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bornier</source>
|
||||
<target>bornes</target>
|
||||
<definition>terminal strip</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cable</source>
|
||||
<target>cable</target>
|
||||
<definition>cable</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>calibre</source>
|
||||
<target>calibre</target>
|
||||
<definition>rating - the current rating of a device</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cartouche</source>
|
||||
<target>cartutx</target>
|
||||
<definition>title block - the framed information panel</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>champ de texte</source>
|
||||
<target>camp de text</target>
|
||||
<definition>text field</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>collection</source>
|
||||
<target>col·lecció</target>
|
||||
<definition>collection - the symbol library</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>conducteur</source>
|
||||
<target>conductor</target>
|
||||
<definition>conductor - the drawn wire between terminals</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contact</source>
|
||||
<target>contacte</target>
|
||||
<definition>contact</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contacteur</source>
|
||||
<target>contactor</target>
|
||||
<definition>contactor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>courant</source>
|
||||
<target>corrent</target>
|
||||
<definition>current</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>disjoncteur</source>
|
||||
<target>disjuntor</target>
|
||||
<definition>circuit breaker</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>dossier</source>
|
||||
<target>carpeta</target>
|
||||
<definition>folder</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>element</source>
|
||||
<target>element</target>
|
||||
<definition>element - a symbol placed on a sheet</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>esclave</source>
|
||||
<target>esclau</target>
|
||||
<definition>slave - the contact block belonging to a master</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>fil</source>
|
||||
<target>fil</target>
|
||||
<definition>wire</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>folio</source>
|
||||
<target>plec</target>
|
||||
<definition>sheet - one drawing of a set</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>fusible</source>
|
||||
<target>fusible</target>
|
||||
<definition>fuse</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>grille</source>
|
||||
<target>graella</target>
|
||||
<definition>grid</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>interrupteur</source>
|
||||
<target>interruptor</target>
|
||||
<definition>switch</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>maitre</source>
|
||||
<target>mestre</target>
|
||||
<definition>master - the element a cross-reference points from</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>modele</source>
|
||||
<target>plantilla</target>
|
||||
<definition>template</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>moteur</source>
|
||||
<target>motor</target>
|
||||
<definition>motor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>neutre</source>
|
||||
<target>neutre</target>
|
||||
<definition>neutral</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>nomenclature</source>
|
||||
<target>nomenclatura</target>
|
||||
<definition>parts list / bill of materials</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>numerotation</source>
|
||||
<target>numeració</target>
|
||||
<definition>numbering - automatic wire and part numbering</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>phase</source>
|
||||
<target>fase</target>
|
||||
<definition>phase</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>potentiel</source>
|
||||
<target>potencial</target>
|
||||
<definition>potential - conductors electrically joined as one node</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>projet</source>
|
||||
<target>projecte</target>
|
||||
<definition>project - the .qet file holding the sheets</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>puissance</source>
|
||||
<target>potència</target>
|
||||
<definition>power</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>relais</source>
|
||||
<target>relé</target>
|
||||
<definition>relay</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>renvoi de folio</source>
|
||||
<target>referència de plec</target>
|
||||
<definition>sheet cross-reference</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>repere</source>
|
||||
<target>referència</target>
|
||||
<definition>designation - the identifying mark on a part</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>report de folio</source>
|
||||
<target>remissió de plec</target>
|
||||
<definition>sheet cross-reference (the arrow symbol)</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>schema</source>
|
||||
<target>esquema</target>
|
||||
<definition>diagram</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>section</source>
|
||||
<target>secció</target>
|
||||
<definition>cross-section - conductor size in mm2</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>sommaire</source>
|
||||
<target>sumari</target>
|
||||
<definition>summary / table of contents</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>tension</source>
|
||||
<target>tensió</target>
|
||||
<definition>voltage</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>terre</source>
|
||||
<target>terra</target>
|
||||
<definition>earth / ground</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>texte</source>
|
||||
<target>text</target>
|
||||
<definition>text</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>transformateur</source>
|
||||
<target>transformador</target>
|
||||
<definition>transformer</definition>
|
||||
</phrase>
|
||||
</QPH>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -100,4 +100,8 @@
|
||||
<source>traduction</source>
|
||||
<target>Übersetzung</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier le nom de la borne</source>
|
||||
<target>Klemmenname ändern</target>
|
||||
</phrase>
|
||||
</QPH>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,918 @@
|
||||
<!DOCTYPE QPH>
|
||||
<QPH sourcelanguage="fr_FR" language="en">
|
||||
<phrase>
|
||||
<source>Blue : Blue</source>
|
||||
<target>Blue : Blue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : CornflowerBlue</source>
|
||||
<target>Blue : CornflowerBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : DarkBlue</source>
|
||||
<target>Blue : DarkBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : DeepSkyBlue</source>
|
||||
<target>Blue : DeepSkyBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : DodgerBlue</source>
|
||||
<target>Blue : DodgerBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : LightBlue</source>
|
||||
<target>Blue : LightBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : LightSkyBlue</source>
|
||||
<target>Blue : LightSkyBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : LightSteelBlue</source>
|
||||
<target>Blue : LightSteelBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : MediumBlue</source>
|
||||
<target>Blue : MediumBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : MidnightBlue</source>
|
||||
<target>Blue : MidnightBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : Navy</source>
|
||||
<target>Blue : Navy</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : PowderBlue</source>
|
||||
<target>Blue : PowderBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : RoyalBlue</source>
|
||||
<target>Blue : RoyalBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : SkyBlue</source>
|
||||
<target>Blue : SkyBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Blue : SteelBlue</source>
|
||||
<target>Blue : SteelBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Bisque</source>
|
||||
<target>Brown : Bisque</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : BlanchedAlmond</source>
|
||||
<target>Brown : BlanchedAlmond</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Brown</source>
|
||||
<target>Brown : Brown</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Burlywood</source>
|
||||
<target>Brown : Burlywood</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Chocolate</source>
|
||||
<target>Brown : Chocolate</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Cornsilk</source>
|
||||
<target>Brown : Cornsilk</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : DarkGoldenrod</source>
|
||||
<target>Brown : DarkGoldenrod</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Goldenrod</source>
|
||||
<target>Brown : Goldenrod</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Maroon</source>
|
||||
<target>Brown : Maroon</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : NavajoWhite</source>
|
||||
<target>Brown : NavajoWhite</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Peru</source>
|
||||
<target>Brown : Peru</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : RosyBrown</source>
|
||||
<target>Brown : RosyBrown</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : SaddleBrown</source>
|
||||
<target>Brown : SaddleBrown</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : SandyBrown</source>
|
||||
<target>Brown : SandyBrown</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Sienna</source>
|
||||
<target>Brown : Sienna</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Tan</source>
|
||||
<target>Brown : Tan</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Brown : Wheat</source>
|
||||
<target>Brown : Wheat</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : Aqua</source>
|
||||
<target>Cyan : Aqua</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : Aquamarine</source>
|
||||
<target>Cyan : Aquamarine</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : CadetBlue</source>
|
||||
<target>Cyan : CadetBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : Cyan</source>
|
||||
<target>Cyan : Cyan</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : DarkCyan</source>
|
||||
<target>Cyan : DarkCyan</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : DarkTurquoise</source>
|
||||
<target>Cyan : DarkTurquoise</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : LightCyan</source>
|
||||
<target>Cyan : LightCyan</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : LightSeaGreen</source>
|
||||
<target>Cyan : LightSeaGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : MediumTurquoise</source>
|
||||
<target>Cyan : MediumTurquoise</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : PaleTurquoise</source>
|
||||
<target>Cyan : PaleTurquoise</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : Teal</source>
|
||||
<target>Cyan : Teal</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cyan : Turquoise</source>
|
||||
<target>Cyan : Turquoise</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : Black</source>
|
||||
<target>Gray : Black</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : DarkGray</source>
|
||||
<target>Gray : DarkGray</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : DarkSlateGray</source>
|
||||
<target>Gray : DarkSlateGray</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : DimGray</source>
|
||||
<target>Gray : DimGray</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : Gainsboro</source>
|
||||
<target>Gray : Gainsboro</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : Gray</source>
|
||||
<target>Gray : Gray</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : LightGray</source>
|
||||
<target>Gray : LightGray</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : LightSlateGray</source>
|
||||
<target>Gray : LightSlateGray</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : Silver</source>
|
||||
<target>Gray : Silver</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Gray : SlateGray</source>
|
||||
<target>Gray : SlateGray</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : Chartreuse</source>
|
||||
<target>Green : Chartreuse</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : DarkGreen</source>
|
||||
<target>Green : DarkGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : DarkOliveGreen</source>
|
||||
<target>Green : DarkOliveGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : DarkSeaGreen</source>
|
||||
<target>Green : DarkSeaGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : ForestGreen</source>
|
||||
<target>Green : ForestGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : Green</source>
|
||||
<target>Green : Green</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : GreenYellow</source>
|
||||
<target>Green : GreenYellow</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : LawnGreen</source>
|
||||
<target>Green : LawnGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : LightGreen</source>
|
||||
<target>Green : LightGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : Lime</source>
|
||||
<target>Green : Lime</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : LimeGreen</source>
|
||||
<target>Green : LimeGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : MediumAquamarine</source>
|
||||
<target>Green : MediumAquamarine</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : MediumSeaGreen</source>
|
||||
<target>Green : MediumSeaGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : MediumSpringGreen</source>
|
||||
<target>Green : MediumSpringGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : Olive</source>
|
||||
<target>Green : Olive</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : OliveDrab</source>
|
||||
<target>Green : OliveDrab</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : PaleGreen</source>
|
||||
<target>Green : PaleGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : SeaGreen</source>
|
||||
<target>Green : SeaGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : SpringGreen</source>
|
||||
<target>Green : SpringGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Green : YellowGreen</source>
|
||||
<target>Green : YellowGreen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Orange : Coral</source>
|
||||
<target>Orange : Coral</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Orange : DarkOrange</source>
|
||||
<target>Orange : DarkOrange</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Orange : Orange</source>
|
||||
<target>Orange : Orange</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Orange : OrangeRed</source>
|
||||
<target>Orange : OrangeRed</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Orange : Tomato</source>
|
||||
<target>Orange : Tomato</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Pink : DeepPink</source>
|
||||
<target>Pink: DeepPink</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Pink : HotPink</source>
|
||||
<target>Pink: HotPink</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Pink : LightPink</source>
|
||||
<target>Pink: LightPink</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Pink : MediumVioletRed</source>
|
||||
<target>Pink: MediumVioletRed</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Pink : PaleVioletRed</source>
|
||||
<target>Pink: PaleVioletRed</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Pink : Pink</source>
|
||||
<target>Pink: Pink</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : BlueViolet</source>
|
||||
<target>Purple : BlueViolet</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : DarkMagenta</source>
|
||||
<target>Purple : DarkMagenta</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : DarkOrchid</source>
|
||||
<target>Purple : DarkOrchid</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : DarkSlateBlue</source>
|
||||
<target>Purple : DarkSlateBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : DarkViolet</source>
|
||||
<target>Purple : DarkViolet</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : Fuchsia</source>
|
||||
<target>Purple : Fuchsia</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : Indigo</source>
|
||||
<target>Purple : Indigo</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : Lavender</source>
|
||||
<target>Purple : Lavender</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : Magenta</source>
|
||||
<target>Purple : Magenta</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : MediumOrchid</source>
|
||||
<target>Purple : MediumOrchid</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : MediumPurple</source>
|
||||
<target>Purple : MediumPurple</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : MediumSlateBlue</source>
|
||||
<target>Purple : MediumSlateBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : Orchid</source>
|
||||
<target>Purple : Orchid</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : Plum</source>
|
||||
<target>Purple : Plum</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : Purple</source>
|
||||
<target>Purple : Purple</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : SlateBlue</source>
|
||||
<target>Purple : SlateBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : Thistle</source>
|
||||
<target>Purple : Thistle</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Purple : Violet</source>
|
||||
<target>Purple : Violet</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Red : Crimson</source>
|
||||
<target>Red : Crimson</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Red : DarkRed</source>
|
||||
<target>Red : DarkRed</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Red : DarkSalmon</source>
|
||||
<target>Red: DarkSalmon</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Red : Firebrick</source>
|
||||
<target>Red : Firebrick</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Red : IndianRed</source>
|
||||
<target>Red: IndianRed</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Red : LightCoral</source>
|
||||
<target>Red: LightCoral</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Red : LightSalmon</source>
|
||||
<target>Red: LightSalmon</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Red : Red</source>
|
||||
<target>Red : Red</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Red : Salmon</source>
|
||||
<target>Red: Salmon</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : AliceBlue</source>
|
||||
<target>White : AliceBlue</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : AntiqueWhite</source>
|
||||
<target>White : AntiqueWhite</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : Azure</source>
|
||||
<target>White : Azure</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : Beige</source>
|
||||
<target>White : Beige</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : FloralWhite</source>
|
||||
<target>White : FloralWhite</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : GhostWhite</source>
|
||||
<target>White : GhostWhite</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : Honeydew</source>
|
||||
<target>White : Honeydew</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : Ivory</source>
|
||||
<target>White : Ivory</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : LavenderBlush</source>
|
||||
<target>White : LavenderBlush</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : Linen</source>
|
||||
<target>White : Linen</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : MintCream</source>
|
||||
<target>White : MintCream</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : MistyRose</source>
|
||||
<target>White : MistyRose</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : OldLace</source>
|
||||
<target>White : OldLace</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : Seashell</source>
|
||||
<target>White : Seashell</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : Snow</source>
|
||||
<target>White : Snow</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : White</source>
|
||||
<target>White : White</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>White : WhiteSmoke</source>
|
||||
<target>White : WhiteSmoke</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : DarkKhaki</source>
|
||||
<target>Yellow : DarkKhaki</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : Gold</source>
|
||||
<target>Yellow : Gold</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : Khaki</source>
|
||||
<target>Yellow : Khaki</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : LemonChiffon</source>
|
||||
<target>Yellow : LemonChiffon</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : LightGoldenrodYellow</source>
|
||||
<target>Yellow : LightGoldenrodYellow</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : LightYellow</source>
|
||||
<target>Yellow : LightYellow</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : Moccasin</source>
|
||||
<target>Yellow : Moccasin</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : PaleGoldenrod</source>
|
||||
<target>Yellow : PaleGoldenrod</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : PapayaWhip</source>
|
||||
<target>Yellow : PapayaWhip</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : PeachPuff</source>
|
||||
<target>Yellow : PeachPuff</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Yellow : Yellow</source>
|
||||
<target>Yellow : Yellow</target>
|
||||
<definition>element part filling</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>armoire</source>
|
||||
<target>cabinet</target>
|
||||
<definition>cabinet / enclosure</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bobine</source>
|
||||
<target>coil</target>
|
||||
<definition>coil</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>borne</source>
|
||||
<target>terminal</target>
|
||||
<definition>terminal - a connection point on a symbol</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bornier</source>
|
||||
<target>terminal strip</target>
|
||||
<definition>terminal strip</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cable</source>
|
||||
<target>cable</target>
|
||||
<definition>cable</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>calibre</source>
|
||||
<target>rating</target>
|
||||
<definition>rating - the current rating of a device</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cartouche</source>
|
||||
<target>title block</target>
|
||||
<definition>title block - the framed information panel</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>champ de texte</source>
|
||||
<target>text field</target>
|
||||
<definition>text field</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>collection</source>
|
||||
<target>collection</target>
|
||||
<definition>collection - the symbol library</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>conducteur</source>
|
||||
<target>conductor</target>
|
||||
<definition>conductor - the drawn wire between terminals</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contact</source>
|
||||
<target>contact</target>
|
||||
<definition>contact</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contacteur</source>
|
||||
<target>contactor</target>
|
||||
<definition>contactor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>courant</source>
|
||||
<target>current</target>
|
||||
<definition>current</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>disjoncteur</source>
|
||||
<target>circuit breaker</target>
|
||||
<definition>circuit breaker</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>dossier</source>
|
||||
<target>folder</target>
|
||||
<definition>folder</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>element</source>
|
||||
<target>element</target>
|
||||
<definition>element - a symbol placed on a sheet</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>esclave</source>
|
||||
<target>slave</target>
|
||||
<definition>slave - the contact block belonging to a master</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>fil</source>
|
||||
<target>wire</target>
|
||||
<definition>wire</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>folio</source>
|
||||
<target>sheet</target>
|
||||
<definition>sheet - one drawing of a set</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>fusible</source>
|
||||
<target>fuse</target>
|
||||
<definition>fuse</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>grille</source>
|
||||
<target>grid</target>
|
||||
<definition>grid</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>interrupteur</source>
|
||||
<target>switch</target>
|
||||
<definition>switch</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>maitre</source>
|
||||
<target>master</target>
|
||||
<definition>master - the element a cross-reference points from</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>modele</source>
|
||||
<target>template</target>
|
||||
<definition>template</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>moteur</source>
|
||||
<target>motor</target>
|
||||
<definition>motor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>neutre</source>
|
||||
<target>neutral</target>
|
||||
<definition>neutral</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>nomenclature</source>
|
||||
<target>parts list</target>
|
||||
<definition>parts list / bill of materials</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>numerotation</source>
|
||||
<target>numbering</target>
|
||||
<definition>numbering - automatic wire and part numbering</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>phase</source>
|
||||
<target>phase</target>
|
||||
<definition>phase</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>potentiel</source>
|
||||
<target>potential</target>
|
||||
<definition>potential - conductors electrically joined as one node</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>projet</source>
|
||||
<target>project</target>
|
||||
<definition>project - the .qet file holding the sheets</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>puissance</source>
|
||||
<target>power</target>
|
||||
<definition>power</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>relais</source>
|
||||
<target>relay</target>
|
||||
<definition>relay</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>renvoi de folio</source>
|
||||
<target>sheet cross-reference</target>
|
||||
<definition>sheet cross-reference</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>repere</source>
|
||||
<target>designation</target>
|
||||
<definition>designation - the identifying mark on a part</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>report de folio</source>
|
||||
<target>sheet cross-reference</target>
|
||||
<definition>sheet cross-reference (the arrow symbol)</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>schema</source>
|
||||
<target>diagram</target>
|
||||
<definition>diagram</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>section</source>
|
||||
<target>cross-section</target>
|
||||
<definition>cross-section - conductor size in mm2</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>sommaire</source>
|
||||
<target>summary</target>
|
||||
<definition>summary / table of contents</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>tension</source>
|
||||
<target>voltage</target>
|
||||
<definition>voltage</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>terre</source>
|
||||
<target>earth</target>
|
||||
<definition>earth / ground</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>texte</source>
|
||||
<target>text</target>
|
||||
<definition>text</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>transformateur</source>
|
||||
<target>transformer</target>
|
||||
<definition>transformer</definition>
|
||||
</phrase>
|
||||
</QPH>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,941 @@
|
||||
<!DOCTYPE QPH>
|
||||
<QPH sourcelanguage="fr_FR" language="nl_BE">
|
||||
<phrase>
|
||||
<source> Contacts : NO : %1, NC : %2, inverseurs : %3, autres : %4
|
||||
</source>
|
||||
<target>Contacten: NO: %1, NC: %2, wisselcontacten: %3, andere: %4
|
||||
</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> Contacts : NO : %1/%2, NC : %3/%4, inverseurs : %5/%6, autres : %7/%8
|
||||
</source>
|
||||
<target>Contacten: NO: %1/%2, NC: %3/%4, wisselcontacten: %5/%6, andere: %7/%8
|
||||
</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> %</source>
|
||||
<target>%</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> (Ctrl pendant le glissement = position libre, sans accrochage à la grille)</source>
|
||||
<target>(Ctrl tijdens het slepen = vrije positie, zonder vastklikken aan het raster)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> -- %1 : mode %2</source>
|
||||
<target>-- %1 : modus %2</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> ; point rouge : glisser pour repositionner le centre de rotation</source>
|
||||
<target>; rood punt: slepen om het draaipunt te verplaatsen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> ; point turquoise : arc</source>
|
||||
<target>; turquoise punt: boog</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> ; un bord : inclinaison</source>
|
||||
<target>; een rand: kanteling</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> °</source>
|
||||
<target>°</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> — Cliquer : mode %1</source>
|
||||
<target>— Klikken: modus %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>, Alt = créer des poignées</source>
|
||||
<target>, Alt = handgrepen creëren</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>, Alt = détacher en polyligne</source>
|
||||
<target>, Alt = losmaken als polylijn</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ajoute une courbe de Bézier sur le folio actuel</source>
|
||||
<target>Voegt een Béziercurve toe op het huidige blad</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ajouter la borne %1</source>
|
||||
<target>Klem %1 toevoegen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ajouter un point à une courbe</source>
|
||||
<target>Een punt aan een curve toevoegen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ajouter une courbe</source>
|
||||
<target>Een curve toevoegen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Angle</source>
|
||||
<target>Hoek</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Anguleux</source>
|
||||
<target>Hoekig</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Aperçu</source>
|
||||
<target>Voorbeeld</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Arrondir les coins d'%1</source>
|
||||
<target>Hoeken van %1 afronden</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Borne 1</source>
|
||||
<target>Klem 1</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Borne 2</source>
|
||||
<target>Klem 2</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Catégorie</source>
|
||||
<target>Categorie</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ce format ne prend pas en charge la transparence : l'image sera enregistrée telle qu'elle était avant l'application de la couleur transparente. Continuer ?</source>
|
||||
<target>Dit formaat ondersteunt geen transparantie: de afbeelding wordt opgeslagen zoals ze was vóór het toepassen van de transparante kleur. Doorgaan?</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Champ de texte</source>
|
||||
<target>Tekstveld</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic : positionner à la taille d'origine. Cliquer-glisser : positionner et redimensionner. Clic droit : pivoter de 90°. Ctrl+molette : ajuster la taille.</source>
|
||||
<target>Klik: op oorspronkelijke grootte plaatsen. Klikken en slepen: plaatsen en formaat wijzigen. Rechtsklik: 90° draaien. Ctrl+muiswiel: formaat aanpassen.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : point suivant ; double-clic ou Entrée : terminer ; clic droit : annuler le dernier point</source>
|
||||
<target>Linkerklik: volgend punt; dubbelklik of Enter: beëindigen; rechtsklik: laatste punt annuleren</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le coin opposé (Maj = carré, Ctrl = depuis le centre + position libre, Ctrl+Maj = carré centré) ; clic droit : annuler</source>
|
||||
<target>Linkerklik: tegenoverliggende hoek plaatsen (Shift = vierkant, Ctrl = vanuit het midden + vrije positie, Ctrl+Shift = gecentreerd vierkant); rechtsklik: annuleren</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le coin opposé (Maj = cercle, Ctrl = depuis le centre + position libre, Ctrl+Maj = cercle centré) ; clic droit : annuler</source>
|
||||
<target>Linkerklik: tegenoverliggende hoek plaatsen (Shift = cirkel, Ctrl = vanuit het midden + vrije positie, Ctrl+Shift = gecentreerde cirkel); rechtsklik: annuleren</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le point de départ (Ctrl = position libre)</source>
|
||||
<target>Linkerklik: startpunt plaatsen (Ctrl = vrije positie)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le point final (Ctrl = position libre) ; clic droit : annuler</source>
|
||||
<target>Linkerklik: eindpunt plaatsen (Ctrl = vrije positie); rechtsklik: annuleren</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le premier coin (Ctrl = point central, position libre)</source>
|
||||
<target>Linkerklik: eerste hoek plaatsen (Ctrl = middelpunt, vrije positie)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le premier point (Ctrl = position libre)</source>
|
||||
<target>Linkerklik: eerste punt plaatsen (Ctrl = vrije positie)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic: point anguleux. Cliquer-glisser: point courbe. Clic sur le premier point: fermer. Échap/Entrée: terminer. Clic droit: annuler le dernier point.</source>
|
||||
<target>Klik: hoekpunt. Klikken en slepen: curvepunt. Klik op het eerste punt: sluiten. Esc/Enter: beëindigen. Rechtsklik: laatste punt annuleren.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquer</source>
|
||||
<target>Klikken</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquer : mode %1</source>
|
||||
<target>Klikken: modus %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquez pour choisir une couleur</source>
|
||||
<target>Klik om een kleur te kiezen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquez sur l'image pour ajouter une couleur. Ajustez la tolérance de chaque couleur avec son curseur, ou cliquez sur × pour la retirer.</source>
|
||||
<target>Klik op de afbeelding om een kleur toe te voegen. Pas de tolerantie van elke kleur aan met de schuifregelaar, of klik op × om ze te verwijderen.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquez sur l'image pour choisir une couleur</source>
|
||||
<target>Klik op de afbeelding om een kleur te kiezen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Coins arrondis</source>
|
||||
<target>Afgeronde hoeken</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Composant 1</source>
|
||||
<target>Component 1</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Composant 2</source>
|
||||
<target>Component 2</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir %1 en courbe de Bézier</source>
|
||||
<target>%1 omzetten naar Béziercurve</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir %1 en polyligne</source>
|
||||
<target>%1 omzetten naar polylijn</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir en courbe de Bézier</source>
|
||||
<target>Omzetten naar Béziercurve</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir en polyligne</source>
|
||||
<target>Omzetten naar polylijn</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Couleur transparente</source>
|
||||
<target>Transparante kleur</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Couleur transparente...</source>
|
||||
<target>Transparante kleur...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Courant nominal</source>
|
||||
<target>Nominale stroom</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Deplacer le centre de rotation</source>
|
||||
<target>Draaipunt verplaatsen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Description</source>
|
||||
<target>Beschrijving</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Distance in pixels between the label and the slave cross reference</source>
|
||||
<target>Afstand in pixels tussen het label en de slave-kruisverwijzing</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Distance label - slave :</source>
|
||||
<target>Afstand label - slave:</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Définir une couleur transparente</source>
|
||||
<target>Een transparante kleur instellen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Déformer une courbe</source>
|
||||
<target>Een curve vervormen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Déplacer le centre de rotation d'une image</source>
|
||||
<target>Het draaipunt van een afbeelding verplaatsen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Déverrouillé : largeur et hauteur peuvent être modifiées indépendamment. Cliquer pour verrouiller.</source>
|
||||
<target>Ontgrendeld: breedte en hoogte kunnen onafhankelijk worden gewijzigd. Klik om te vergrendelen.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Enregistrer l'image d'origine sous...</source>
|
||||
<target>Oorspronkelijke afbeelding opslaan als...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Enregistrer l'image sous...</source>
|
||||
<target>Afbeelding opslaan als...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Erreur</source>
|
||||
<target>Fout</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Exclure de la nomenclature</source>
|
||||
<target>Uitsluiten van de stuklijst</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Faire pivoter %1</source>
|
||||
<target>%1 roteren</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Faire pivoter une image</source>
|
||||
<target>Een afbeelding draaien</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Faites glisser les poignées, ou l'intérieur du cadre, pour ajuster la zone à conserver.</source>
|
||||
<target>Sleep de handgrepen, of het binnenste van het kader, om het te behouden gebied aan te passen.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Fil</source>
|
||||
<target>Draad</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Folio</source>
|
||||
<target>Blad</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Forme fermée</source>
|
||||
<target>Gesloten vorm</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser %1 : rotation (Maj = 15°)</source>
|
||||
<target>Sleep %1: rotatie (Shift = 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : ajuster l'arc (Ctrl = position libre, Maj = 15°)</source>
|
||||
<target>Slepen: de boog aanpassen (Ctrl = vrije positie, Shift = 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : arrondir les coins (Ctrl = position libre)</source>
|
||||
<target>Slepen: hoeken afronden (Ctrl = vrije positie)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : déformer la courbe (Ctrl = position libre, Alt = briser la tangente)</source>
|
||||
<target>Slepen: de curve vervormen (Ctrl = vrije positie, Alt = de raaklijn breken)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : déplacer ce point</source>
|
||||
<target>Slepen: dit punt verplaatsen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : déplacer le centre de rotation</source>
|
||||
<target>Slepen: draaipunt verplaatsen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : déplacer le point (Ctrl = position libre</source>
|
||||
<target>Slepen: het punt verplaatsen (Ctrl = vrije positie</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : inclinaison (Ctrl = position libre, Maj = 15°)</source>
|
||||
<target>Slepen: kanteling (Ctrl = vrije positie, Shift = 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : incliner (Maj = par pas de 15°)</source>
|
||||
<target>Slepen: kantelen (Shift = stappen van 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : pivoter (Maj = par pas de 15°)</source>
|
||||
<target>Slepen: draaien (Shift = stappen van 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : redimensionner (Ctrl = depuis le centre + position libre, Maj = proportions</source>
|
||||
<target>Slepen: formaat wijzigen (Ctrl = vanuit het midden + vrije positie, Shift = verhoudingen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : redimensionner (Maj = conserver les proportions, Ctrl = depuis le centre)</source>
|
||||
<target>Slepen: formaat wijzigen (Shift = verhoudingen behouden, Ctrl = vanuit het midden)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : repositionner le centre de rotation (Ctrl = position libre)</source>
|
||||
<target>Slepen: het draaipunt verplaatsen (Ctrl = vrije positie)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : rotation (Ctrl = position libre, Maj = 15°)</source>
|
||||
<target>Slepen: rotatie (Ctrl = vrije positie, Shift = 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser le point violet : arrondir les coins</source>
|
||||
<target>Sleep het paarse punt: hoeken afronden</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser un coin : pivoter (Maj = par pas de 15°) ; glisser un bord : incliner (Maj = par pas de 15°) ; point rouge : déplacer le centre de rotation</source>
|
||||
<target>Sleep een hoek: draaien (Shift = stappen van 15°); sleep een rand: kantelen (Shift = stappen van 15°); rood punt: draaipunt verplaatsen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser un coin/bord : redimensionner (Ctrl = depuis le centre, Maj = conserver les proportions)</source>
|
||||
<target>Sleep een hoek/rand: formaat wijzigen (Ctrl = vanuit het midden, Shift = verhoudingen behouden)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser un coin/bord : redimensionner (Ctrl = depuis le centre, Maj = proportions, Alt = détacher en polyligne)</source>
|
||||
<target>Sleep een hoek/rand: formaat wijzigen (Ctrl = vanuit het midden, Shift = verhoudingen, Alt = losmaken als polylijn)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser un point : le déplacer</source>
|
||||
<target>Sleep een punt: het verplaatsen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser une extrémité : la déplacer</source>
|
||||
<target>Sleep een uiteinde: het verplaatsen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser une poignée ou la courbe : déformer (Alt = briser la tangente) ; Alt+glisser un point anguleux : créer des poignées ; clic droit : menu du nœud le plus proche</source>
|
||||
<target>Sleep een handgreep of de curve: vervormen (Alt = de raaklijn breken); Alt+sleep een hoekpunt: handgrepen creëren; rechtsklik: menu van het dichtstbijzijnde knooppunt</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Géométrie</source>
|
||||
<target>Geometrie</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Hauteur</source>
|
||||
<target>Hoogte</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image BMP (*.bmp)</source>
|
||||
<target>BMP-afbeelding (*.bmp)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image Files (*.png *.jpg *.jpeg *.bmp *.svg)</source>
|
||||
<target>Afbeeldingsbestanden (*.png *.jpg *.jpeg *.bmp *.svg)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image JPEG (*.jpg *.jpeg)</source>
|
||||
<target>JPEG-afbeelding (*.jpg *.jpeg)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image PNG (*.png)</source>
|
||||
<target>PNG-afbeelding (*.png)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image source</source>
|
||||
<target>Bronafbeelding</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image SVG (*.svg)</source>
|
||||
<target>SVG-afbeelding (*.svg)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Images non incluses dans l'export DXF</source>
|
||||
<target>Afbeeldingen niet inbegrepen in de DXF-export</target>
|
||||
<definition>message box title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Impossible d'enregistrer l'image à cet emplacement.</source>
|
||||
<target>Kan de afbeelding niet op die locatie opslaan.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Impossible d'enregistrer la nomenclature dans %1.
|
||||
%2</source>
|
||||
<target>Kan de stuklijst niet opslaan in %1.
|
||||
%2</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Impossible de charger l'image.</source>
|
||||
<target>Kan de afbeelding niet laden.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Inclinaison X</source>
|
||||
<target>Kanteling X</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Inclinaison Y</source>
|
||||
<target>Kanteling Y</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Incliner %1</source>
|
||||
<target>%1 kantelen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Incliner une image</source>
|
||||
<target>Een afbeelding kantelen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>La limite fixée pour cet élément maître est atteinte (Limite: %1).
|
||||
|
||||
Voulez-vous tout de même lier ce contact esclave ?</source>
|
||||
<target>De limiet voor dit hoofdelement is bereikt (Limiet: %1).
|
||||
|
||||
Wilt u dit hulpcontact toch koppelen?</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Largeur</source>
|
||||
<target>Breedte</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Le format DXF utilisé ici (AC1006) ne permet pas d'inclure d'image. Les images seront représentées uniquement par un rectangle de contour (position, taille, rotation et inclinaison conservées), sans le contenu de l'image.</source>
|
||||
<target>Het hier gebruikte DXF-formaat (AC1006) laat niet toe afbeeldingen op te nemen. Afbeeldingen worden enkel voorgesteld door een omtrekrechthoek (positie, grootte, rotatie en kanteling behouden), zonder de inhoud van de afbeelding.</target>
|
||||
<definition>message box content</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Lisse</source>
|
||||
<target>Vloeiend</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Liste de câblage</source>
|
||||
<target>Bekabelingslijst</target>
|
||||
<definition>window title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Liste de câblage (base de données)</source>
|
||||
<target>Bekabelingslijst (database)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Localisation :</source>
|
||||
<target>Locatie:</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Longueur</source>
|
||||
<target>Lengte</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>margin: 5px; font-weight: bold;</source>
|
||||
<target>margin: 5px; font-weight: bold;</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>max:</source>
|
||||
<target>max:</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>min:</source>
|
||||
<target>min:</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir horizontal</source>
|
||||
<target>Horizontaal spiegelen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir horizontal d'une image</source>
|
||||
<target>Horizontaal spiegelen van een afbeelding</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir horizontal de %1</source>
|
||||
<target>Horizontaal spiegelen van %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir impossible : inclinaison trop extrême pour cette forme</source>
|
||||
<target>Spiegelen onmogelijk: kanteling te extreem voor deze vorm</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir vertical</source>
|
||||
<target>Verticaal spiegelen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir vertical d'une image</source>
|
||||
<target>Verticaal spiegelen van een afbeelding</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir vertical de %1</source>
|
||||
<target>Verticaal spiegelen van %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier l'angle d'un arc</source>
|
||||
<target>Hoek van een boog wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier l'angle d'une forme</source>
|
||||
<target>Hoek van een vorm wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier l'angle d'une image</source>
|
||||
<target>De hoek van een afbeelding wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier l'inclinaison d'une image</source>
|
||||
<target>De kanteling van een afbeelding wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la courbure d'%1</source>
|
||||
<target>Kromming van %1 wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la forme d'%1</source>
|
||||
<target>Vorm van %1 wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la hauteur d'une image</source>
|
||||
<target>De hoogte van een afbeelding wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la largeur d'une image</source>
|
||||
<target>De breedte van een afbeelding wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la longueur d'une ligne</source>
|
||||
<target>Lengte van een lijn wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la taille d'une forme</source>
|
||||
<target>Grootte van een vorm wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier le type d'un nœud</source>
|
||||
<target>Het type van een knooppunt wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier une image</source>
|
||||
<target>Een afbeelding wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modèle</source>
|
||||
<target>Model</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Nombre maximum de contacts esclaves définis : non défini
|
||||
</source>
|
||||
<target>Maximumaantal gedefinieerde hulpcontacten: niet gedefinieerd
|
||||
</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Notes</source>
|
||||
<target>Notities</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Nœud le plus proche</source>
|
||||
<target>Dichtstbijzijnde knooppunt</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>pivoter/incliner</source>
|
||||
<target>draaien/kantelen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ponter des bornes entre-elles</source>
|
||||
<target>Klemmen onderling doorverbinden</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rayon X</source>
|
||||
<target>Straal X</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rayon Y</source>
|
||||
<target>Straal Y</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>redimensionner</source>
|
||||
<target>formaat wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Redimensionner %1</source>
|
||||
<target>%1 vergroten/verkleinen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Redimensionner une image</source>
|
||||
<target>Formaat van een afbeelding wijzigen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Remplacer l'image...</source>
|
||||
<target>Afbeelding vervangen...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Remplacer une image</source>
|
||||
<target>Een afbeelding vervangen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Restaurer les proportions</source>
|
||||
<target>Verhoudingen herstellen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Restaurer les proportions d'une image</source>
|
||||
<target>De verhoudingen van een afbeelding herstellen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Retirer cette couleur</source>
|
||||
<target>Deze kleur verwijderen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Revenir à l'image complète, sans rognage</source>
|
||||
<target>Terug naar de volledige afbeelding, zonder bijsnijden</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>rgb(%1, %2, %3)</source>
|
||||
<target>rgb(%1, %2, %3)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rogner l'image</source>
|
||||
<target>Afbeelding bijsnijden</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rogner une image</source>
|
||||
<target>Een afbeelding bijsnijden</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rogner...</source>
|
||||
<target>Bijsnijden...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rotation/Inclinaison</source>
|
||||
<target>Rotatie/kanteling</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Réinitialiser</source>
|
||||
<target>Herinitialiseren</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Selectionner une image...</source>
|
||||
<target>Een afbeelding selecteren...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Supprimer le nœud le plus proche</source>
|
||||
<target>Het dichtstbijzijnde knooppunt verwijderen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Supprimer un point d'une courbe</source>
|
||||
<target>Een punt van een curve verwijderen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Symétrique</source>
|
||||
<target>Symmetrisch</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Séparation de potentiel</source>
|
||||
<target>Potentiaalscheiding</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Taille</source>
|
||||
<target>Grootte</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Tension nominale</source>
|
||||
<target>Nominale spanning</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Tolérance pour cette couleur</source>
|
||||
<target>Tolerantie voor deze kleur</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Tous les fichiers (*)</source>
|
||||
<target>Alle bestanden (*)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Transformer %1</source>
|
||||
<target>%1 omvormen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Transparence non conservée</source>
|
||||
<target>Transparantie niet behouden</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>un arc</source>
|
||||
<target>een boog</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>un coin</source>
|
||||
<target>een hoek</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>un point</source>
|
||||
<target>een punt</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>une courbe</source>
|
||||
<target>een curve</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>une extrémité</source>
|
||||
<target>een uiteinde</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>une image</source>
|
||||
<target>een afbeelding</target>
|
||||
<definition>part of a sentence listing the content of a diagram</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Verrouiller la numérotation automatique</source>
|
||||
<target>Automatische nummering vergrendelen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Verrouiller la position</source>
|
||||
<target>Positie vergrendelen</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Verrouillé : modifier la largeur ou la hauteur ajuste l'autre pour conserver les proportions. Cliquer pour déverrouiller.</source>
|
||||
<target>Vergrendeld: het wijzigen van de breedte of hoogte past de andere aan om de verhoudingen te behouden. Klik om te ontgrendelen.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Échec de l'enregistrement</source>
|
||||
<target>Opslaan mislukt</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Édition des nœuds</source>
|
||||
<target>Knooppunten bewerken</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>armoire</source>
|
||||
<target>kast</target>
|
||||
<definition>cabinet / enclosure</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bobine</source>
|
||||
<target>spoel</target>
|
||||
<definition>coil</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>borne</source>
|
||||
<target>klem</target>
|
||||
<definition>terminal - a connection point on a symbol</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bornier</source>
|
||||
<target>klemmenstrook</target>
|
||||
<definition>terminal strip</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cable</source>
|
||||
<target>kabel</target>
|
||||
<definition>cable</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>calibre</source>
|
||||
<target>kaliber</target>
|
||||
<definition>rating - the current rating of a device</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cartouche</source>
|
||||
<target>titelblok</target>
|
||||
<definition>title block - the framed information panel</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>collection</source>
|
||||
<target>collectie</target>
|
||||
<definition>collection - the symbol library</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>conducteur</source>
|
||||
<target>geleider</target>
|
||||
<definition>conductor - the drawn wire between terminals</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contact</source>
|
||||
<target>contact</target>
|
||||
<definition>contact</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contacteur</source>
|
||||
<target>contacteur</target>
|
||||
<definition>contactor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>courant</source>
|
||||
<target>stroom</target>
|
||||
<definition>current</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>disjoncteur</source>
|
||||
<target>automaat</target>
|
||||
<definition>circuit breaker</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>dossier</source>
|
||||
<target>map</target>
|
||||
<definition>folder</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>element</source>
|
||||
<target>element</target>
|
||||
<definition>element - a symbol placed on a sheet</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>esclave</source>
|
||||
<target>hulpcontact</target>
|
||||
<definition>slave - the contact block belonging to a master</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>fusible</source>
|
||||
<target>zekering</target>
|
||||
<definition>fuse</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>grille</source>
|
||||
<target>raster</target>
|
||||
<definition>grid</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>interrupteur</source>
|
||||
<target>schakelaar</target>
|
||||
<definition>switch</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>maitre</source>
|
||||
<target>hoofd</target>
|
||||
<definition>master - the element a cross-reference points from</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>modele</source>
|
||||
<target>sjabloon</target>
|
||||
<definition>template</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>moteur</source>
|
||||
<target>motor</target>
|
||||
<definition>motor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>neutre</source>
|
||||
<target>nul</target>
|
||||
<definition>neutral</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>nomenclature</source>
|
||||
<target>stuklijst</target>
|
||||
<definition>parts list / bill of materials</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>numerotation</source>
|
||||
<target>nummering</target>
|
||||
<definition>numbering - automatic wire and part numbering</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>phase</source>
|
||||
<target>fase</target>
|
||||
<definition>phase</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>potentiel</source>
|
||||
<target>potentiaal</target>
|
||||
<definition>potential - conductors electrically joined as one node</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>projet</source>
|
||||
<target>project</target>
|
||||
<definition>project - the .qet file holding the sheets</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>puissance</source>
|
||||
<target>vermogen</target>
|
||||
<definition>power</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>relais</source>
|
||||
<target>relais</target>
|
||||
<definition>relay</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>renvoi de folio</source>
|
||||
<target>bladverwijzing</target>
|
||||
<definition>sheet cross-reference</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>repere</source>
|
||||
<target>aanduiding</target>
|
||||
<definition>designation - the identifying mark on a part</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>report de folio</source>
|
||||
<target>bladverwijzing</target>
|
||||
<definition>sheet cross-reference (the arrow symbol)</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>schema</source>
|
||||
<target>schema</target>
|
||||
<definition>diagram</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>section</source>
|
||||
<target>doorsnede</target>
|
||||
<definition>cross-section - conductor size in mm2</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>sommaire</source>
|
||||
<target>inhoudstafel</target>
|
||||
<definition>summary / table of contents</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>tension</source>
|
||||
<target>spanning</target>
|
||||
<definition>voltage</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>terre</source>
|
||||
<target>aarde</target>
|
||||
<definition>earth / ground</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>texte</source>
|
||||
<target>tekst</target>
|
||||
<definition>text</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>transformateur</source>
|
||||
<target>transformator</target>
|
||||
<definition>transformer</definition>
|
||||
</phrase>
|
||||
</QPH>
|
||||
@@ -0,0 +1,218 @@
|
||||
<!DOCTYPE QPH>
|
||||
<QPH sourcelanguage="fr_FR" language="pl">
|
||||
<phrase>
|
||||
<source>armoire</source>
|
||||
<target>Szafa</target>
|
||||
<definition>cabinet / enclosure</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bobine</source>
|
||||
<target>Cewka</target>
|
||||
<definition>coil</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>borne</source>
|
||||
<target>Zacisk</target>
|
||||
<definition>terminal - a connection point on a symbol</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bornier</source>
|
||||
<target>Listwa zaciskowa</target>
|
||||
<definition>terminal strip</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cable</source>
|
||||
<target>Kabel</target>
|
||||
<definition>cable</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>calibre</source>
|
||||
<target>Prąd znamionowy</target>
|
||||
<definition>rating - the current rating of a device</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cartouche</source>
|
||||
<target>Tabliczka rysunkowa</target>
|
||||
<definition>title block - the framed information panel</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>champ de texte</source>
|
||||
<target>Pole tekstowe</target>
|
||||
<definition>text field</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>collection</source>
|
||||
<target>Biblioteka</target>
|
||||
<definition>collection - the symbol library</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>conducteur</source>
|
||||
<target>Przewód</target>
|
||||
<definition>conductor - the drawn wire between terminals</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contact</source>
|
||||
<target>Styk</target>
|
||||
<definition>contact</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contacteur</source>
|
||||
<target>Stycznik</target>
|
||||
<definition>contactor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>courant</source>
|
||||
<target>Prąd</target>
|
||||
<definition>current</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>disjoncteur</source>
|
||||
<target>Wyłącznik nadprądowy</target>
|
||||
<definition>circuit breaker</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>dossier</source>
|
||||
<target>Folder</target>
|
||||
<definition>folder</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>element</source>
|
||||
<target>Element</target>
|
||||
<definition>element - a symbol placed on a sheet</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>esclave</source>
|
||||
<target>Element podrzędny</target>
|
||||
<definition>slave - the contact block belonging to a master</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>fil</source>
|
||||
<target>Przewód</target>
|
||||
<definition>wire</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>folio</source>
|
||||
<target>Arkusz</target>
|
||||
<definition>sheet - one drawing of a set</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>fusible</source>
|
||||
<target>Bezpiecznik</target>
|
||||
<definition>fuse</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>grille</source>
|
||||
<target>Siatka</target>
|
||||
<definition>grid</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>interrupteur</source>
|
||||
<target>Wyłącznik</target>
|
||||
<definition>switch</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>maitre</source>
|
||||
<target>Element główny</target>
|
||||
<definition>master - the element a cross-reference points from</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>modele</source>
|
||||
<target>Szablon</target>
|
||||
<definition>template</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>moteur</source>
|
||||
<target>Silnik</target>
|
||||
<definition>motor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>neutre</source>
|
||||
<target>Neutralny</target>
|
||||
<definition>neutral</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>nomenclature</source>
|
||||
<target>Zestawienie materiałów</target>
|
||||
<definition>parts list / bill of materials</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>numerotation</source>
|
||||
<target>Numeracja</target>
|
||||
<definition>numbering - automatic wire and part numbering</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>phase</source>
|
||||
<target>Faza</target>
|
||||
<definition>phase</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>potentiel</source>
|
||||
<target>Potencjał</target>
|
||||
<definition>potential - conductors electrically joined as one node</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>projet</source>
|
||||
<target>Projekt</target>
|
||||
<definition>project - the .qet file holding the sheets</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>puissance</source>
|
||||
<target>Moc</target>
|
||||
<definition>power</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>relais</source>
|
||||
<target>Przekaźnik</target>
|
||||
<definition>relay</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>renvoi de folio</source>
|
||||
<target>Odnośnik do arkusza</target>
|
||||
<definition>sheet cross-reference</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>repere</source>
|
||||
<target>Oznaczenie</target>
|
||||
<definition>designation - the identifying mark on a part</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>report de folio</source>
|
||||
<target>Odnośnik do arkusza</target>
|
||||
<definition>sheet cross-reference (the arrow symbol)</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>schema</source>
|
||||
<target>Schemat</target>
|
||||
<definition>diagram</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>section</source>
|
||||
<target>Przekrój</target>
|
||||
<definition>cross-section - conductor size in mm2</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>sommaire</source>
|
||||
<target>Spis treści</target>
|
||||
<definition>summary / table of contents</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>tension</source>
|
||||
<target>Napięcie</target>
|
||||
<definition>voltage</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>terre</source>
|
||||
<target>Uziemienie</target>
|
||||
<definition>earth / ground</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>texte</source>
|
||||
<target>Tekst</target>
|
||||
<definition>text</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>transformateur</source>
|
||||
<target>Transformator</target>
|
||||
<definition>transformer</definition>
|
||||
</phrase>
|
||||
</QPH>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,465 @@
|
||||
<!DOCTYPE QPH>
|
||||
<QPH sourcelanguage="fr_FR" language="pt_BR">
|
||||
<phrase>
|
||||
<source> Contacts : NO : %1, NC : %2, inverseurs : %3, autres : %4
|
||||
</source>
|
||||
<target>Contatos: NA: %1, NF: %2, reversíveis: %3, outros: %4
|
||||
</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> Contacts : NO : %1/%2, NC : %3/%4, inverseurs : %5/%6, autres : %7/%8
|
||||
</source>
|
||||
<target>Contatos: NA: %1/%2, NF: %3/%4, reversíveis: %5/%6, outros: %7/%8
|
||||
</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Aperçu</source>
|
||||
<target>Pré-visualização</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Arrondir les coins d'%1</source>
|
||||
<target>Arredondar os cantos de %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Borne 1</source>
|
||||
<target>Borne 1</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Borne 2</source>
|
||||
<target>Borne 2</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Catégorie</source>
|
||||
<target>Categoria</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ce format ne prend pas en charge la transparence : l'image sera enregistrée telle qu'elle était avant l'application de la couleur transparente. Continuer ?</source>
|
||||
<target>Este formato não suporta transparência: a imagem será salva como estava antes da aplicação da cor transparente. Continuar?</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Champ de texte</source>
|
||||
<target>Campo de texto</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Composant 1</source>
|
||||
<target>Componente 1</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Composant 2</source>
|
||||
<target>Componente 2</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir %1 en courbe de Bézier</source>
|
||||
<target>Converter %1 em curva de Bézier</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir en courbe de Bézier</source>
|
||||
<target>Converter em curva de Bézier</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Courant nominal</source>
|
||||
<target>Corrente nominal</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Distance in pixels between the label and the slave cross reference</source>
|
||||
<target>Distância em pixels entre o rótulo e a referência cruzada do escravo</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Distance label - slave :</source>
|
||||
<target>Distância do rótulo - escravo:</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Enregistrer l'image d'origine sous...</source>
|
||||
<target>Salvar a imagem original como...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Enregistrer l'image sous...</source>
|
||||
<target>Salvar a imagem como...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Erreur</source>
|
||||
<target>Erro</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Exclure de la nomenclature</source>
|
||||
<target>Excluir da lista de materiais</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Faire pivoter %1</source>
|
||||
<target>Girar %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Faire pivoter une image</source>
|
||||
<target>Girar uma imagem</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Fil</source>
|
||||
<target>Fio</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Folio</source>
|
||||
<target>Folha</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Hauteur</source>
|
||||
<target>Altura</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image BMP (*.bmp)</source>
|
||||
<target>Imagem BMP (*.bmp)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image JPEG (*.jpg *.jpeg)</source>
|
||||
<target>Imagem JPEG (*.jpg *.jpeg)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image PNG (*.png)</source>
|
||||
<target>Imagem PNG (*.png)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image SVG (*.svg)</source>
|
||||
<target>Imagem SVG (*.svg)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Images non incluses dans l'export DXF</source>
|
||||
<target>Imagens não incluídas na exportação DXF</target>
|
||||
<definition>message box title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Impossible d'enregistrer l'image à cet emplacement.</source>
|
||||
<target>Não foi possível salvar a imagem neste local.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Impossible d'enregistrer la nomenclature dans %1.
|
||||
%2</source>
|
||||
<target>Não foi possível salvar a lista de materiais em %1.
|
||||
%2</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Impossible de charger l'image.</source>
|
||||
<target>Não foi possível carregar a imagem.</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Incliner %1</source>
|
||||
<target>Inclinar %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Incliner une image</source>
|
||||
<target>Inclinar uma imagem</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>La limite fixée pour cet élément maître est atteinte (Limite: %1).
|
||||
|
||||
Voulez-vous tout de même lier ce contact esclave ?</source>
|
||||
<target>O limite definido para este elemento mestre foi atingido (Limite: %1).
|
||||
|
||||
Deseja vincular este contato escravo mesmo assim?</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Largeur</source>
|
||||
<target>Largura</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Le format DXF utilisé ici (AC1006) ne permet pas d'inclure d'image. Les images seront représentées uniquement par un rectangle de contour (position, taille, rotation et inclinaison conservées), sans le contenu de l'image.</source>
|
||||
<target>O formato DXF usado aqui (AC1006) não permite incluir imagens. As imagens serão representadas apenas por um retângulo de contorno (posição, tamanho, rotação e inclinação preservados), sem o conteúdo da imagem.</target>
|
||||
<definition>message box content</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Liste de câblage</source>
|
||||
<target>Lista de cabeamento</target>
|
||||
<definition>window title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Liste de câblage (base de données)</source>
|
||||
<target>Lista de cabeamento (banco de dados)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>margin: 5px; font-weight: bold;</source>
|
||||
<target>margin: 5px; font-weight: bold;</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier l'angle d'un arc</source>
|
||||
<target>Modificar o ângulo de um arco</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la courbure d'%1</source>
|
||||
<target>Modificar a curvatura de %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la forme d'%1</source>
|
||||
<target>Modificar a forma de %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modèle</source>
|
||||
<target>Modelo</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Nombre maximum de contacts esclaves définis : non défini
|
||||
</source>
|
||||
<target>Número máximo de contatos escravos definidos: não definido
|
||||
</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Notes</source>
|
||||
<target>Observações</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Redimensionner %1</source>
|
||||
<target>Redimensionar %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Redimensionner une image</source>
|
||||
<target>Redimensionar uma imagem</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Réinitialiser</source>
|
||||
<target>Redefinir</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Selectionner une image...</source>
|
||||
<target>Selecionar uma imagem...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Séparation de potentiel</source>
|
||||
<target>Separação de potencial</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Taille</source>
|
||||
<target>Tamanho</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Tension nominale</source>
|
||||
<target>Tensão nominal</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Tous les fichiers (*)</source>
|
||||
<target>Todos os arquivos (*)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Transparence non conservée</source>
|
||||
<target>Transparência não preservada</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>une image</source>
|
||||
<target>uma imagem</target>
|
||||
<definition>part of a sentence listing the content of a diagram</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Verrouiller la numérotation automatique</source>
|
||||
<target>Bloquear a numeração automática</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Verrouiller la position</source>
|
||||
<target>Bloquear a posição</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Échec de l'enregistrement</source>
|
||||
<target>Falha ao salvar</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>armoire</source>
|
||||
<target>armário</target>
|
||||
<definition>cabinet / enclosure</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bobine</source>
|
||||
<target>bobina</target>
|
||||
<definition>coil</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>borne</source>
|
||||
<target>borne</target>
|
||||
<definition>terminal - a connection point on a symbol</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bornier</source>
|
||||
<target>borneira</target>
|
||||
<definition>terminal strip</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cable</source>
|
||||
<target>cabo</target>
|
||||
<definition>cable</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>calibre</source>
|
||||
<target>calibre</target>
|
||||
<definition>rating - the current rating of a device</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cartouche</source>
|
||||
<target>bloco de título</target>
|
||||
<definition>title block - the framed information panel</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>collection</source>
|
||||
<target>coleção</target>
|
||||
<definition>collection - the symbol library</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>conducteur</source>
|
||||
<target>condutor</target>
|
||||
<definition>conductor - the drawn wire between terminals</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contact</source>
|
||||
<target>contato</target>
|
||||
<definition>contact</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contacteur</source>
|
||||
<target>contator</target>
|
||||
<definition>contactor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>courant</source>
|
||||
<target>corrente</target>
|
||||
<definition>current</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>disjoncteur</source>
|
||||
<target>disjuntor</target>
|
||||
<definition>circuit breaker</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>dossier</source>
|
||||
<target>pasta</target>
|
||||
<definition>folder</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>element</source>
|
||||
<target>elemento</target>
|
||||
<definition>element - a symbol placed on a sheet</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>esclave</source>
|
||||
<target>escravo</target>
|
||||
<definition>slave - the contact block belonging to a master</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>fusible</source>
|
||||
<target>fusível</target>
|
||||
<definition>fuse</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>grille</source>
|
||||
<target>grade</target>
|
||||
<definition>grid</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>interrupteur</source>
|
||||
<target>interruptor</target>
|
||||
<definition>switch</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>maitre</source>
|
||||
<target>mestre</target>
|
||||
<definition>master - the element a cross-reference points from</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>modele</source>
|
||||
<target>modelo</target>
|
||||
<definition>template</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>moteur</source>
|
||||
<target>motor</target>
|
||||
<definition>motor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>neutre</source>
|
||||
<target>neutro</target>
|
||||
<definition>neutral</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>nomenclature</source>
|
||||
<target>lista de materiais</target>
|
||||
<definition>parts list / bill of materials</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>numerotation</source>
|
||||
<target>numeração</target>
|
||||
<definition>numbering - automatic wire and part numbering</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>phase</source>
|
||||
<target>fase</target>
|
||||
<definition>phase</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>potentiel</source>
|
||||
<target>potencial</target>
|
||||
<definition>potential - conductors electrically joined as one node</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>projet</source>
|
||||
<target>projeto</target>
|
||||
<definition>project - the .qet file holding the sheets</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>puissance</source>
|
||||
<target>potência</target>
|
||||
<definition>power</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>relais</source>
|
||||
<target>relé</target>
|
||||
<definition>relay</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>renvoi de folio</source>
|
||||
<target>referência de folha</target>
|
||||
<definition>sheet cross-reference</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>repere</source>
|
||||
<target>designação</target>
|
||||
<definition>designation - the identifying mark on a part</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>report de folio</source>
|
||||
<target>remissão de folha</target>
|
||||
<definition>sheet cross-reference (the arrow symbol)</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>schema</source>
|
||||
<target>diagrama</target>
|
||||
<definition>diagram</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>section</source>
|
||||
<target>seção</target>
|
||||
<definition>cross-section - conductor size in mm2</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>sommaire</source>
|
||||
<target>sumário</target>
|
||||
<definition>summary / table of contents</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>tension</source>
|
||||
<target>tensão</target>
|
||||
<definition>voltage</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>terre</source>
|
||||
<target>terra</target>
|
||||
<definition>earth / ground</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>texte</source>
|
||||
<target>texto</target>
|
||||
<definition>text</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>transformateur</source>
|
||||
<target>transformador</target>
|
||||
<definition>transformer</definition>
|
||||
</phrase>
|
||||
</QPH>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,917 @@
|
||||
<!DOCTYPE QPH>
|
||||
<QPH sourcelanguage="fr_FR" language="zh">
|
||||
<phrase>
|
||||
<source> Contacts : NO : %1, NC : %2, inverseurs : %3, autres : %4
|
||||
</source>
|
||||
<target>触点:常开:%1,常闭:%2,转换:%3,其他:%4
|
||||
</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> Contacts : NO : %1/%2, NC : %3/%4, inverseurs : %5/%6, autres : %7/%8
|
||||
</source>
|
||||
<target>触点:常开:%1/%2,常闭:%3/%4,转换:%5/%6,其他:%7/%8
|
||||
</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> %</source>
|
||||
<target>%</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> (Ctrl pendant le glissement = position libre, sans accrochage à la grille)</source>
|
||||
<target>(拖动时按 Ctrl = 自由位置,不吸附到网格)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> -- %1 : mode %2</source>
|
||||
<target>-- %1:%2 模式</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> ; point rouge : glisser pour repositionner le centre de rotation</source>
|
||||
<target>;红点:拖动以重新定位旋转中心</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> ; point turquoise : arc</source>
|
||||
<target>;青色点:圆弧</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> ; un bord : inclinaison</source>
|
||||
<target>;边:倾斜</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> °</source>
|
||||
<target>°</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source> — Cliquer : mode %1</source>
|
||||
<target>— 单击:%1 模式</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>, Alt = créer des poignées</source>
|
||||
<target>,Alt = 创建控制柄</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>, Alt = détacher en polyligne</source>
|
||||
<target>,Alt = 分离为多段线</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ajoute une courbe de Bézier sur le folio actuel</source>
|
||||
<target>在当前图纸上添加贝塞尔曲线</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ajouter un point à une courbe</source>
|
||||
<target>向曲线添加点</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ajouter une courbe</source>
|
||||
<target>添加曲线</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Angle</source>
|
||||
<target>角度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Anguleux</source>
|
||||
<target>角点</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Aperçu</source>
|
||||
<target>预览</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Arrondir les coins d'%1</source>
|
||||
<target>将%1的角变圆</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Borne 1</source>
|
||||
<target>端子1</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Borne 2</source>
|
||||
<target>端子2</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Catégorie</source>
|
||||
<target>类别</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Ce format ne prend pas en charge la transparence : l'image sera enregistrée telle qu'elle était avant l'application de la couleur transparente. Continuer ?</source>
|
||||
<target>此格式不支持透明度:图像将按应用透明色之前的状态保存。是否继续?</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Champ de texte</source>
|
||||
<target>文本字段</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic : positionner à la taille d'origine. Cliquer-glisser : positionner et redimensionner. Clic droit : pivoter de 90°. Ctrl+molette : ajuster la taille.</source>
|
||||
<target>单击:按原始尺寸放置。单击拖动:放置并调整大小。右键:旋转 90°。Ctrl+滚轮:调整大小。</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : point suivant ; double-clic ou Entrée : terminer ; clic droit : annuler le dernier point</source>
|
||||
<target>左键单击:下一个点;双击或 Enter:结束;右键单击:撤销上一个点</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le coin opposé (Maj = carré, Ctrl = depuis le centre + position libre, Ctrl+Maj = carré centré) ; clic droit : annuler</source>
|
||||
<target>左键单击:放置对角(Shift = 正方形,Ctrl = 从中心 + 自由位置,Ctrl+Shift = 居中正方形);右键单击:取消</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le coin opposé (Maj = cercle, Ctrl = depuis le centre + position libre, Ctrl+Maj = cercle centré) ; clic droit : annuler</source>
|
||||
<target>左键单击:放置对角(Shift = 圆形,Ctrl = 从中心 + 自由位置,Ctrl+Shift = 居中圆形);右键单击:取消</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le point de départ (Ctrl = position libre)</source>
|
||||
<target>左键单击:放置起点(Ctrl = 自由位置)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le point final (Ctrl = position libre) ; clic droit : annuler</source>
|
||||
<target>左键单击:放置终点(Ctrl = 自由位置);右键单击:取消</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le premier coin (Ctrl = point central, position libre)</source>
|
||||
<target>左键单击:放置第一个角(Ctrl = 中心点,自由位置)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic gauche : positionner le premier point (Ctrl = position libre)</source>
|
||||
<target>左键单击:放置第一个点(Ctrl = 自由位置)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Clic: point anguleux. Cliquer-glisser: point courbe. Clic sur le premier point: fermer. Échap/Entrée: terminer. Clic droit: annuler le dernier point.</source>
|
||||
<target>单击:角点。单击拖动:曲线点。单击第一个点:闭合。Esc/Enter:结束。右键:撤销上一个点。</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquer</source>
|
||||
<target>单击</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquer : mode %1</source>
|
||||
<target>单击:%1 模式</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquez pour choisir une couleur</source>
|
||||
<target>点击选择颜色</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquez sur l'image pour ajouter une couleur. Ajustez la tolérance de chaque couleur avec son curseur, ou cliquez sur × pour la retirer.</source>
|
||||
<target>单击图像以添加颜色。使用滑块调整每种颜色的容差,或单击 × 将其移除。</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Cliquez sur l'image pour choisir une couleur</source>
|
||||
<target>单击图像选择颜色</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Coins arrondis</source>
|
||||
<target>圆角</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Composant 1</source>
|
||||
<target>元件1</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Composant 2</source>
|
||||
<target>元件2</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir %1 en courbe de Bézier</source>
|
||||
<target>将 %1 转换为贝塞尔曲线</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir %1 en polyligne</source>
|
||||
<target>将 %1 转换为多段线</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir en courbe de Bézier</source>
|
||||
<target>转换为贝塞尔曲线</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Convertir en polyligne</source>
|
||||
<target>转换为多段线</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Couleur transparente</source>
|
||||
<target>透明色</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Couleur transparente...</source>
|
||||
<target>透明色...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Courant nominal</source>
|
||||
<target>额定电流</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Deplacer le centre de rotation</source>
|
||||
<target>移动旋转中心</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Distance in pixels between the label and the slave cross reference</source>
|
||||
<target>标签与从站交叉引用之间的像素距离</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Distance label - slave :</source>
|
||||
<target>标签距离 - 从站:</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Définir une couleur transparente</source>
|
||||
<target>设置透明色</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Déformer une courbe</source>
|
||||
<target>变形曲线</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Déplacer le centre de rotation d'une image</source>
|
||||
<target>移动图像的旋转中心</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Déverrouillé : largeur et hauteur peuvent être modifiées indépendamment. Cliquer pour verrouiller.</source>
|
||||
<target>已解锁:宽度和高度可独立修改。单击锁定。</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Enregistrer l'image d'origine sous...</source>
|
||||
<target>原始图像另存为...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Enregistrer l'image sous...</source>
|
||||
<target>图像另存为...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Erreur</source>
|
||||
<target>错误</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Exclure de la nomenclature</source>
|
||||
<target>从物料清单中排除</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Faire pivoter %1</source>
|
||||
<target>旋转 %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Faire pivoter une image</source>
|
||||
<target>旋转图像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Faites glisser les poignées, ou l'intérieur du cadre, pour ajuster la zone à conserver.</source>
|
||||
<target>拖动控制柄或框内区域,调整要保留的区域。</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Fil</source>
|
||||
<target>导线</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Folio</source>
|
||||
<target>图页</target>
|
||||
<definition>column title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Forme fermée</source>
|
||||
<target>闭合形状</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser %1 : rotation (Maj = 15°)</source>
|
||||
<target>拖动 %1:旋转(Shift = 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : ajuster l'arc (Ctrl = position libre, Maj = 15°)</source>
|
||||
<target>拖动:调整圆弧(Ctrl = 自由位置,Shift = 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : arrondir les coins (Ctrl = position libre)</source>
|
||||
<target>拖动:圆角(Ctrl = 自由位置)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : déformer la courbe (Ctrl = position libre, Alt = briser la tangente)</source>
|
||||
<target>拖动:变形曲线(Ctrl = 自由位置,Alt = 断开切线)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : déplacer ce point</source>
|
||||
<target>拖动:移动此点</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : déplacer le centre de rotation</source>
|
||||
<target>拖动:移动旋转中心</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : déplacer le point (Ctrl = position libre</source>
|
||||
<target>拖动:移动点(Ctrl = 自由位置</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : inclinaison (Ctrl = position libre, Maj = 15°)</source>
|
||||
<target>拖动:倾斜(Ctrl = 自由位置,Shift = 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : incliner (Maj = par pas de 15°)</source>
|
||||
<target>拖动:倾斜(Shift = 以 15° 为步长)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : pivoter (Maj = par pas de 15°)</source>
|
||||
<target>拖动:旋转(Shift = 以 15° 为步长)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : redimensionner (Ctrl = depuis le centre + position libre, Maj = proportions</source>
|
||||
<target>拖动:调整大小(Ctrl = 从中心 + 自由位置,Shift = 比例</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : redimensionner (Maj = conserver les proportions, Ctrl = depuis le centre)</source>
|
||||
<target>拖动:调整大小(Shift = 保持比例,Ctrl = 从中心)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : repositionner le centre de rotation (Ctrl = position libre)</source>
|
||||
<target>拖动:重新定位旋转中心(Ctrl = 自由位置)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser : rotation (Ctrl = position libre, Maj = 15°)</source>
|
||||
<target>拖动:旋转(Ctrl = 自由位置,Shift = 15°)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser le point violet : arrondir les coins</source>
|
||||
<target>拖动紫色点:圆角</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser un coin : pivoter (Maj = par pas de 15°) ; glisser un bord : incliner (Maj = par pas de 15°) ; point rouge : déplacer le centre de rotation</source>
|
||||
<target>拖动角:旋转(Shift = 以 15° 为步长);拖动边:倾斜(Shift = 以 15° 为步长);红点:移动旋转中心</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser un coin/bord : redimensionner (Ctrl = depuis le centre, Maj = conserver les proportions)</source>
|
||||
<target>拖动角/边:调整大小(Ctrl = 从中心,Shift = 保持比例)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser un coin/bord : redimensionner (Ctrl = depuis le centre, Maj = proportions, Alt = détacher en polyligne)</source>
|
||||
<target>拖动角/边:调整大小(Ctrl = 从中心,Shift = 比例,Alt = 分离为多段线)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser un point : le déplacer</source>
|
||||
<target>拖动点:移动它</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser une extrémité : la déplacer</source>
|
||||
<target>拖动端点:移动它</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Glisser une poignée ou la courbe : déformer (Alt = briser la tangente) ; Alt+glisser un point anguleux : créer des poignées ; clic droit : menu du nœud le plus proche</source>
|
||||
<target>拖动控制柄或曲线:变形(Alt = 断开切线);Alt+拖动角点:创建控制柄;右键单击:最近节点菜单</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Géométrie</source>
|
||||
<target>几何</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Hauteur</source>
|
||||
<target>高度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image BMP (*.bmp)</source>
|
||||
<target>BMP 图像 (*.bmp)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image Files (*.png *.jpg *.jpeg *.bmp *.svg)</source>
|
||||
<target>图像文件 (*.png *.jpg *.jpeg *.bmp *.svg)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image JPEG (*.jpg *.jpeg)</source>
|
||||
<target>JPEG 图像 (*.jpg *.jpeg)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image PNG (*.png)</source>
|
||||
<target>PNG 图像 (*.png)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image source</source>
|
||||
<target>源图像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Image SVG (*.svg)</source>
|
||||
<target>SVG 图像 (*.svg)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Images non incluses dans l'export DXF</source>
|
||||
<target>图像未包含在 DXF 导出中</target>
|
||||
<definition>message box title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Impossible d'enregistrer l'image à cet emplacement.</source>
|
||||
<target>无法将图像保存到该位置。</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Impossible d'enregistrer la nomenclature dans %1.
|
||||
%2</source>
|
||||
<target>无法将物料清单保存到 %1。
|
||||
%2</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Impossible de charger l'image.</source>
|
||||
<target>无法加载图像。</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Inclinaison X</source>
|
||||
<target>X 倾斜</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Inclinaison Y</source>
|
||||
<target>Y 倾斜</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Incliner %1</source>
|
||||
<target>倾斜 %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Incliner une image</source>
|
||||
<target>倾斜图像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>La limite fixée pour cet élément maître est atteinte (Limite: %1).
|
||||
|
||||
Voulez-vous tout de même lier ce contact esclave ?</source>
|
||||
<target>已达到此主元件的限制(限制:%1)。
|
||||
|
||||
是否仍要链接此从属触点?</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Largeur</source>
|
||||
<target>宽度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Le format DXF utilisé ici (AC1006) ne permet pas d'inclure d'image. Les images seront représentées uniquement par un rectangle de contour (position, taille, rotation et inclinaison conservées), sans le contenu de l'image.</source>
|
||||
<target>此处使用的 DXF 格式 (AC1006) 无法包含图像。图像将仅以轮廓矩形表示(保留位置、大小、旋转和倾斜),不包含图像内容。</target>
|
||||
<definition>message box content</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Lisse</source>
|
||||
<target>平滑</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Liste de câblage</source>
|
||||
<target>接线列表</target>
|
||||
<definition>window title</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Liste de câblage (base de données)</source>
|
||||
<target>接线列表(数据库)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Longueur</source>
|
||||
<target>长度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>margin: 5px; font-weight: bold;</source>
|
||||
<target>margin: 5px; font-weight: bold;</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir horizontal</source>
|
||||
<target>水平镜像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir horizontal d'une image</source>
|
||||
<target>图像水平镜像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir horizontal de %1</source>
|
||||
<target>%1 的水平镜像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir impossible : inclinaison trop extrême pour cette forme</source>
|
||||
<target>无法镜像:此形状的倾斜过于极端</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir vertical</source>
|
||||
<target>垂直镜像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir vertical d'une image</source>
|
||||
<target>图像垂直镜像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Miroir vertical de %1</source>
|
||||
<target>%1 的垂直镜像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier l'angle d'un arc</source>
|
||||
<target>修改弧的角度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier l'angle d'une forme</source>
|
||||
<target>修改形状角度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier l'angle d'une image</source>
|
||||
<target>修改图像角度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier l'inclinaison d'une image</source>
|
||||
<target>修改图像倾斜</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la courbure d'%1</source>
|
||||
<target>修改%1的曲率</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la forme d'%1</source>
|
||||
<target>修改%1的形状</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la hauteur d'une image</source>
|
||||
<target>修改图像高度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la largeur d'une image</source>
|
||||
<target>修改图像宽度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la longueur d'une ligne</source>
|
||||
<target>修改线条长度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier la taille d'une forme</source>
|
||||
<target>修改形状大小</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier le type d'un nœud</source>
|
||||
<target>修改节点类型</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modifier une image</source>
|
||||
<target>修改图像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Modèle</source>
|
||||
<target>型号</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Nombre maximum de contacts esclaves définis : non défini
|
||||
</source>
|
||||
<target>已定义的从属触点最大数量:未定义
|
||||
</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Notes</source>
|
||||
<target>备注</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Nœud le plus proche</source>
|
||||
<target>最近节点</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>pivoter/incliner</source>
|
||||
<target>旋转/倾斜</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rayon X</source>
|
||||
<target>X半径</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rayon Y</source>
|
||||
<target>Y半径</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>redimensionner</source>
|
||||
<target>调整大小</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Redimensionner %1</source>
|
||||
<target>调整 %1 大小</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Redimensionner une image</source>
|
||||
<target>调整图像大小</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Remplacer l'image...</source>
|
||||
<target>替换图像...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Remplacer une image</source>
|
||||
<target>替换图像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Restaurer les proportions</source>
|
||||
<target>恢复比例</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Restaurer les proportions d'une image</source>
|
||||
<target>恢复图像比例</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Retirer cette couleur</source>
|
||||
<target>移除此颜色</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Revenir à l'image complète, sans rognage</source>
|
||||
<target>恢复为完整图像,不裁剪</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>rgb(%1, %2, %3)</source>
|
||||
<target>rgb(%1, %2, %3)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rogner l'image</source>
|
||||
<target>裁剪图像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rogner une image</source>
|
||||
<target>裁剪图像</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rogner...</source>
|
||||
<target>裁剪...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Rotation/Inclinaison</source>
|
||||
<target>旋转/倾斜</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Réinitialiser</source>
|
||||
<target>重置</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Selectionner une image...</source>
|
||||
<target>选择图像...</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Supprimer le nœud le plus proche</source>
|
||||
<target>删除最近节点</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Supprimer un point d'une courbe</source>
|
||||
<target>从曲线删除点</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Symétrique</source>
|
||||
<target>对称</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Séparation de potentiel</source>
|
||||
<target>电位分隔</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Taille</source>
|
||||
<target>大小</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Tension nominale</source>
|
||||
<target>额定电压</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Tolérance pour cette couleur</source>
|
||||
<target>此颜色的容差</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Tous les fichiers (*)</source>
|
||||
<target>所有文件 (*)</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Transformer %1</source>
|
||||
<target>变换 %1</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Transparence non conservée</source>
|
||||
<target>不保留透明度</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>un arc</source>
|
||||
<target>一段弧</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>un coin</source>
|
||||
<target>一个角</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>un point</source>
|
||||
<target>一个点</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>une courbe</source>
|
||||
<target>一条曲线</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>une extrémité</source>
|
||||
<target>一个端点</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>une image</source>
|
||||
<target>一张图像</target>
|
||||
<definition>part of a sentence listing the content of a diagram</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Verrouiller la numérotation automatique</source>
|
||||
<target>锁定自动编号</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Verrouiller la position</source>
|
||||
<target>锁定位置</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Verrouillé : modifier la largeur ou la hauteur ajuste l'autre pour conserver les proportions. Cliquer pour déverrouiller.</source>
|
||||
<target>已锁定:修改宽度或高度会调整另一个以保持比例。单击解锁。</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Échec de l'enregistrement</source>
|
||||
<target>保存失败</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>Édition des nœuds</source>
|
||||
<target>节点编辑</target>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>armoire</source>
|
||||
<target>机柜</target>
|
||||
<definition>cabinet / enclosure</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bobine</source>
|
||||
<target>线圈</target>
|
||||
<definition>coil</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>borne</source>
|
||||
<target>端子</target>
|
||||
<definition>terminal - a connection point on a symbol</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>bornier</source>
|
||||
<target>端子排</target>
|
||||
<definition>terminal strip</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cable</source>
|
||||
<target>电缆</target>
|
||||
<definition>cable</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>calibre</source>
|
||||
<target>额定值</target>
|
||||
<definition>rating - the current rating of a device</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>cartouche</source>
|
||||
<target>标题栏</target>
|
||||
<definition>title block - the framed information panel</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>collection</source>
|
||||
<target>符号库</target>
|
||||
<definition>collection - the symbol library</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>conducteur</source>
|
||||
<target>导线</target>
|
||||
<definition>conductor - the drawn wire between terminals</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contact</source>
|
||||
<target>触点</target>
|
||||
<definition>contact</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>contacteur</source>
|
||||
<target>接触器</target>
|
||||
<definition>contactor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>courant</source>
|
||||
<target>电流</target>
|
||||
<definition>current</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>disjoncteur</source>
|
||||
<target>断路器</target>
|
||||
<definition>circuit breaker</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>dossier</source>
|
||||
<target>文件夹</target>
|
||||
<definition>folder</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>element</source>
|
||||
<target>元件</target>
|
||||
<definition>element - a symbol placed on a sheet</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>esclave</source>
|
||||
<target>从</target>
|
||||
<definition>slave - the contact block belonging to a master</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>fusible</source>
|
||||
<target>熔断器</target>
|
||||
<definition>fuse</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>grille</source>
|
||||
<target>网格</target>
|
||||
<definition>grid</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>interrupteur</source>
|
||||
<target>开关</target>
|
||||
<definition>switch</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>maitre</source>
|
||||
<target>主</target>
|
||||
<definition>master - the element a cross-reference points from</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>modele</source>
|
||||
<target>模板</target>
|
||||
<definition>template</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>moteur</source>
|
||||
<target>电动机</target>
|
||||
<definition>motor</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>neutre</source>
|
||||
<target>中性线</target>
|
||||
<definition>neutral</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>nomenclature</source>
|
||||
<target>物料清单</target>
|
||||
<definition>parts list / bill of materials</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>numerotation</source>
|
||||
<target>编号</target>
|
||||
<definition>numbering - automatic wire and part numbering</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>phase</source>
|
||||
<target>相</target>
|
||||
<definition>phase</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>potentiel</source>
|
||||
<target>电位</target>
|
||||
<definition>potential - conductors electrically joined as one node</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>projet</source>
|
||||
<target>项目</target>
|
||||
<definition>project - the .qet file holding the sheets</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>puissance</source>
|
||||
<target>功率</target>
|
||||
<definition>power</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>relais</source>
|
||||
<target>继电器</target>
|
||||
<definition>relay</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>renvoi de folio</source>
|
||||
<target>图纸交叉引用</target>
|
||||
<definition>sheet cross-reference</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>repere</source>
|
||||
<target>标识</target>
|
||||
<definition>designation - the identifying mark on a part</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>report de folio</source>
|
||||
<target>图纸交叉引用</target>
|
||||
<definition>sheet cross-reference (the arrow symbol)</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>schema</source>
|
||||
<target>原理图</target>
|
||||
<definition>diagram</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>section</source>
|
||||
<target>截面积</target>
|
||||
<definition>cross-section - conductor size in mm2</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>sommaire</source>
|
||||
<target>目录</target>
|
||||
<definition>summary / table of contents</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>tension</source>
|
||||
<target>电压</target>
|
||||
<definition>voltage</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>terre</source>
|
||||
<target>接地</target>
|
||||
<definition>earth / ground</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>texte</source>
|
||||
<target>文本</target>
|
||||
<definition>text</definition>
|
||||
</phrase>
|
||||
<phrase>
|
||||
<source>transformateur</source>
|
||||
<target>变压器</target>
|
||||
<definition>transformer</definition>
|
||||
</phrase>
|
||||
</QPH>
|
||||
@@ -912,6 +912,31 @@ Note: these options DO NOT allow or block auto numberings, only their update pol
|
||||
<translation>Edit the properties of several conductors</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConductorPropertiesEditorWidget</name>
|
||||
<message>
|
||||
<location filename="../sources/ui/conductorpropertieseditorwidget.cpp" line="65"/>
|
||||
<source>Appliquer les propriétés à l'ensemble des conducteurs de ce potentiel</source>
|
||||
<translation>Apply properties to all conductors of this potential</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/ui/conductorpropertieseditorwidget.cpp" line="248"/>
|
||||
<source>Modifier les propriétés d'un conducteur</source>
|
||||
<comment>undo caption</comment>
|
||||
<translation>Edit conductor properties</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/ui/conductorpropertieseditorwidget.cpp" line="258"/>
|
||||
<source>Modifier les propriétés de plusieurs conducteurs</source>
|
||||
<comment>undo caption</comment>
|
||||
<translation>Edit the properties of several conductors</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/ui/conductorpropertieseditorwidget.cpp" line="278"/>
|
||||
<source>Conducteur</source>
|
||||
<translation>Conductor</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConductorPropertiesWidget</name>
|
||||
<message>
|
||||
|
||||
+1
-1
@@ -62,6 +62,6 @@
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>12.3.0</string>
|
||||
<string>14.0.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -99,11 +99,14 @@ fi
|
||||
|
||||
cmake -S . -B "$BUILD_DIR" -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
|
||||
-DQT_VERSION_MAJOR=$QT_MAJOR \
|
||||
-DBUILD_WITH_KF=$BUILD_WITH_KF \
|
||||
-DBUILD_KF=OFF \
|
||||
-DQET_EXPORT_PROJECT_DB=ON \
|
||||
-DPACKAGE_TESTS=OFF
|
||||
-DPACKAGE_TESTS=OFF \
|
||||
-DQET_ENABLE_SPACEMOUSE=ON \
|
||||
-DQET_SPACEMOUSE_BACKEND=hid
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: cmake configure failed."
|
||||
@@ -256,6 +259,7 @@ echo "Install Info.plist and app icon:"
|
||||
cp -R ${current_dir}/misc/Info.plist $BUNDLE/Contents/
|
||||
cp -R ${current_dir}/ico/mac_icon/*.icns $BUNDLE/Contents/Resources/
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION r$HEAD" "$BUNDLE/Contents/Info.plist"
|
||||
/usr/libexec/PlistBuddy -c "Set :LSMinimumSystemVersion 14.0.0" "$BUNDLE/Contents/Info.plist"
|
||||
|
||||
### add missing files ###############################################
|
||||
echo
|
||||
@@ -396,10 +400,12 @@ done
|
||||
|
||||
echo "-- Signing main executable..."
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime \
|
||||
--entitlements "${current_dir}/misc/qelectrotech.entitlements" \
|
||||
"$BUNDLE/Contents/MacOS/$APPNAME"
|
||||
|
||||
echo "-- Signing bundle..."
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$BUNDLE"
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime \
|
||||
--entitlements "${current_dir}/misc/qelectrotech.entitlements" "$BUNDLE"
|
||||
|
||||
echo
|
||||
echo "Verifying bundle signature..."
|
||||
@@ -500,8 +506,10 @@ find "$MOUNT_POINT/$BUNDLE/Contents/PlugIns" \( -name "*.dylib" -o -name "*.so"
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime "$lib"
|
||||
done
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime \
|
||||
--entitlements "${current_dir}/misc/qelectrotech.entitlements" \
|
||||
"$MOUNT_POINT/$BUNDLE/Contents/MacOS/$APPNAME"
|
||||
codesign --force --sign "$IDENTITY" --timestamp --options=runtime \
|
||||
--entitlements "${current_dir}/misc/qelectrotech.entitlements" \
|
||||
"$MOUNT_POINT/$BUNDLE"
|
||||
|
||||
echo "Verifying bundle signature inside DMG..."
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!-- 3D mouse with 3DxWare installed: lets QElectroTech load
|
||||
3Dconnexion's client library, which 3Dconnexion signs, at run time
|
||||
(sources/spacemouse/connexionbackend.h). The hardened runtime
|
||||
refuses it otherwise, and the 3D mouse does nothing. -->
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
+250
-23
@@ -30,14 +30,20 @@ here read the model.
|
||||
| `qet_project_info` | title, format version, folios, element and conductor counts |
|
||||
| `qet_elements` | placed elements: uuid, type, position, label, information bag |
|
||||
| `qet_conductors` | conductors and their documentation fields; filter by attribute |
|
||||
| `qet_diff` | **what an edit actually changed** — moves with deltas, adds, removes, relabels, conductor field changes |
|
||||
| `qet_diff` | **what an edit actually changed** — element moves, adds, removes, relabels; conductor changes; and folio fields, texts, shapes, images, symbol text fields and terminal strips |
|
||||
| `qet_scan` | sweep a directory of projects, counting nodes carrying an attribute |
|
||||
| `qet_element_info` | a `.elmt`: translated names, terminals, info fields, part counts |
|
||||
| `qet_export` | run a headless export (pdf, png, svg, bom, cables, wires, wiring, nets, links, info) |
|
||||
| `qet_edit` | **change a project** — place, move, rotate, label, wire, number, cross-reference, add text, shapes and images, restyle a symbol's text fields, delete; then diff the result |
|
||||
| `qet_element_build` | **author a `.elmt`** — draw a new symbol, with terminals to wire it by |
|
||||
| `qet_project_new` | **start from nothing** — an empty project with a title and folios |
|
||||
| `qet_element_search` | **find a symbol** in a collection by name (any language), type or terminal count |
|
||||
| `qet_check` | **design-rule checks** — duplicate labels, unlabelled masters, unnumbered conductors, empty folios |
|
||||
| `qet_query` | **ask the project database** — read-only SQL over the views and tables |
|
||||
|
||||
Only `qet_export` launches QElectroTech. Everything else parses the file
|
||||
directly, which is faster, needs no display, and cannot be confused by a
|
||||
dialog.
|
||||
`qet_export` and `qet_edit` launch QElectroTech. Everything else parses the
|
||||
file directly, which is faster, needs no display, and cannot be confused by
|
||||
a dialog.
|
||||
|
||||
## Running it
|
||||
|
||||
@@ -56,12 +62,80 @@ Register it with an MCP client, for example:
|
||||
"mcpServers": {
|
||||
"qet": {
|
||||
"command": "python3",
|
||||
"args": ["/path/to/qelectrotech/misc/qet-mcp/qet_mcp.py"]
|
||||
"args": ["/path/to/qelectrotech/misc/qet-mcp/qet_mcp.py"],
|
||||
"env": {
|
||||
"QET_MCP_WORKSPACE": "/home/you/drawings",
|
||||
"QET_ENABLE_SCRIPTING": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Five tools need scripting switched on
|
||||
|
||||
A QElectroTech with JavaScript scripting switched off refuses `--run`, and
|
||||
off is the default from
|
||||
[#984](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/984)
|
||||
onwards. Five tools here drive it that way and stop working until it is
|
||||
turned on:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| need `QET_ENABLE_SCRIPTING=1` | `qet_query`, `qet_continuity`, `qet_check`, `qet_project_new`, `qet_edit` |
|
||||
| unaffected | everything else — they read the `.qet` directly, or, in `qet_export`'s case, use a plain CLI flag |
|
||||
|
||||
The variable goes in the environment this server is started in, which for an
|
||||
MCP client is the `env` block above; the server passes its environment
|
||||
straight through to QElectroTech. It does not set the variable itself, on
|
||||
purpose — a switch a program turns on for itself is not a switch. Whoever
|
||||
configured this server and pointed it at a QElectroTech binary made that
|
||||
choice, and their interactive QElectroTech keeps whatever its own setting
|
||||
says.
|
||||
|
||||
Without it, those five come back `"ok": false` with a `hint` naming the
|
||||
variable. Older builds, from before the setting existed, need nothing.
|
||||
|
||||
## What the server is allowed to touch
|
||||
|
||||
Every path in a tool call is chosen by the model, so without a policy this
|
||||
server would be a read/write primitive for anything the operating system
|
||||
lets the process reach: read any project on the disk, export one somewhere
|
||||
else, overwrite an unrelated file, embed an arbitrary local image or PDF.
|
||||
|
||||
So **data paths are confined to a workspace**:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| `QET_MCP_WORKSPACE` | the directories tool calls may read and write, separated by `:` (`;` on Windows) |
|
||||
| unset | the directory the server was started in |
|
||||
| `QET_MCP_ALLOW_ANY_PATH=1` | turns the check off entirely |
|
||||
|
||||
Set the workspace to the folder your drawings live in. A path outside it is
|
||||
refused with an error naming what was allowed; symlinks are resolved first,
|
||||
so a link planted inside the workspace is judged by where it points.
|
||||
|
||||
Two arguments are deliberately **not** confined: `binary` (the
|
||||
`qelectrotech` executable) and `elements_dir` (the element collection).
|
||||
Those are configuration, chosen once by whoever runs the server, and both
|
||||
normally live in `/usr` or a build tree — outside any sensible workspace.
|
||||
Confining them would reject the ordinary case while stopping nothing.
|
||||
|
||||
`QET_MCP_ALLOW_ANY_PATH=1` is equivalent to granting the client local
|
||||
filesystem access with this process's privileges. It exists so that is a
|
||||
deliberate choice rather than the default.
|
||||
|
||||
**Nothing is overwritten unasked.** `qet_export`, `qet_edit`,
|
||||
`qet_project_new` and `qet_element_build` refuse an `output` that already
|
||||
exists unless the call passes `"overwrite": true`. Replacing a file is the
|
||||
one step this server cannot undo, so it is the one step it will not take on
|
||||
its own.
|
||||
|
||||
The confinement is applied where tool arguments enter the server, not inside
|
||||
each tool. Importing `qet_mcp` and calling `tool_export()` from your own
|
||||
Python is not confined and is not meant to be — that is your code calling a
|
||||
library, and you already chose the paths.
|
||||
|
||||
## Worked examples
|
||||
|
||||
**What did that edit change?**
|
||||
@@ -79,6 +153,74 @@ Register it with an MCP client, for example:
|
||||
Four elements moved by one uniform delta; nothing was relabelled. That is
|
||||
the answer a screenshot gave wrongly.
|
||||
|
||||
**Draw something, and check it landed**
|
||||
|
||||
```json
|
||||
{"name": "qet_edit", "arguments": {
|
||||
"binary": "/path/to/qelectrotech",
|
||||
"project": "in.qet", "output": "out.qet",
|
||||
"elements_dir": "/path/to/qelectrotech/elements",
|
||||
"operations": [
|
||||
{"op": "add_folio", "id": "f"},
|
||||
{"op": "set_folio_title", "folio": "$f", "title": "Starter"},
|
||||
{"op": "add_element", "id": "k1", "folio": "$f", "path": "common://.../coil.elmt", "x": 100, "y": 100},
|
||||
{"op": "add_element", "id": "k2", "folio": "$f", "path": "common://.../coil.elmt", "x": 320, "y": 100},
|
||||
{"op": "add_conductor", "folio": "$f", "from": "$k1", "from_terminal": 0, "to": "$k2", "to_terminal": 0},
|
||||
{"op": "set_conductor", "folio": "$f", "element": "$k1", "terminal": 0, "property": "num", "value": "W7"},
|
||||
{"op": "set_label", "folio": "$f", "element": "$k1", "label": "KM1"}
|
||||
]}}
|
||||
```
|
||||
|
||||
An op that creates something takes an `"id"`; later ops name it as `"$id"`.
|
||||
Terminals are addressed by index — top to bottom, then left to right, **not**
|
||||
the order the `.elmt` lists them. `qet_element_info` and `qet_element_search`
|
||||
both report that index order. The answer carries a per-operation result
|
||||
*and* a `qet_diff`, because "addConductor → true" says the call was
|
||||
accepted, not that the file came out right:
|
||||
|
||||
```json
|
||||
"diff": {"elements": {"before": 11, "after": 13, "added": ["{0aa3…}", "{6f63…}"]},
|
||||
"conductors": {"before": 47, "after": 48, "added": ["4:{0aa3…}/{2904…}--{6f63…}/{2904…}"],
|
||||
"removed": []}}
|
||||
```
|
||||
|
||||
**Draw a symbol that does not exist yet**
|
||||
|
||||
```json
|
||||
{"name": "qet_element_build", "arguments": {
|
||||
"output": "/path/to/collection/99_custom/my_resistor.elmt",
|
||||
"names": {"en": "Test resistor", "fr": "Résistance de test"},
|
||||
"parts": [
|
||||
{"type": "rect", "x": -10, "y": -20, "width": 20, "height": 40},
|
||||
{"type": "line", "x1": 0, "y1": -30, "x2": 0, "y2": -20},
|
||||
{"type": "line", "x1": 0, "y1": 20, "x2": 0, "y2": 30},
|
||||
{"type": "text", "x": 14, "y": -4, "text": "R"}
|
||||
],
|
||||
"terminals": [{"x": 0, "y": -30, "orientation": "n", "name": "1"},
|
||||
{"x": 0, "y": 30, "orientation": "s", "name": "2"}]}}
|
||||
```
|
||||
|
||||
Then place it with `qet_edit` like any catalogue element. Unlike a
|
||||
project, a `.elmt` is not rewritten by QElectroTech on a round trip, so
|
||||
generating one here is safe in a way that generating a `.qet` would not
|
||||
be — there is no `toXml()` waiting to drop what this writer did not know
|
||||
to emit.
|
||||
|
||||
**Ask a question the XML cannot answer**
|
||||
|
||||
```json
|
||||
{"name": "qet_query", "arguments": {
|
||||
"binary": "/path/to/qelectrotech", "project": "industrial.qet",
|
||||
"sql": "SELECT label, COUNT(*) AS n FROM element_nomenclature_view WHERE label <> '' GROUP BY label HAVING n > 1 ORDER BY n DESC"}}
|
||||
```
|
||||
|
||||
```json
|
||||
"rows": [{"label": "V6", "n": 7}, {"label": "V5", "n": 6}, {"label": "V4", "n": 6}]
|
||||
```
|
||||
|
||||
Duplicate element labels in a shipped example — a design-rule question,
|
||||
answered by the database that already knew it.
|
||||
|
||||
**How much of a corpus uses a field?**
|
||||
|
||||
```json
|
||||
@@ -92,14 +234,50 @@ the answer a screenshot gave wrongly.
|
||||
|
||||
Across the shipped examples: 3190 conductors, not one with a cable value.
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
python3 test_qet_mcp.py # unit + protocol, no QElectroTech needed
|
||||
QET_BINARY=/path/to/qelectrotech \
|
||||
QET_ELEMENTS=/path/to/qelectrotech/elements \
|
||||
QET_EXAMPLES=/path/to/qelectrotech/examples \
|
||||
QET_ENABLE_SCRIPTING=1 \
|
||||
python3 test_qet_mcp.py # everything
|
||||
```
|
||||
|
||||
`QET_ENABLE_SCRIPTING=1` matters from #984 onwards: without it the
|
||||
integration tests that drive QElectroTech through a script all fail, and
|
||||
they fail as "the edit did nothing" rather than as "scripting is off", which
|
||||
reads like a regression in the thing under test.
|
||||
|
||||
176 tests in three layers: unit (validation, script generation, the terminal
|
||||
order rule, the diff, the part schema), the real stdio transport, and
|
||||
integration against a built QElectroTech. Several exist because the
|
||||
behaviour they pin was once wrong and looked right, and say so in their
|
||||
docstrings. To check the suite itself rather than trust it, each of those
|
||||
bugs was reintroduced in turn and the suite confirmed to fail: ten in the
|
||||
Python, plus the hang guard on `addConductor` and the database refresh in
|
||||
`ConductorCreator` in the C++.
|
||||
|
||||
## Notes and limits
|
||||
|
||||
- **The project database is not reachable from outside the application.**
|
||||
`projectDataBase::newQuery()` and `isReadOnlySelect()` are C++-internal
|
||||
and the JavaScript scripting API exposes no SQL binding, so structural
|
||||
queries here are done over the XML. A `--query` CLI verb, or a scripting
|
||||
binding, would let this server expose the guarded read-only SQL surface
|
||||
instead, and would be a better foundation.
|
||||
- **The project database is reachable now, through `qet_query`.** It was
|
||||
not when this server was written, which is why every other structural
|
||||
tool here re-derives its answer from the XML. Prefer the views —
|
||||
`element_nomenclature_view`, `project_summary_view`, `wiring_list_view`
|
||||
— which exist to be queried; the underlying tables are how the cache is
|
||||
arranged today and a column may move. Call `qet_query` with no `sql` to
|
||||
list both. Only `SELECT` and `WITH` are accepted, which is the rule
|
||||
QElectroTech applies to its own custom-query box, not one invented here.
|
||||
An empty result and a failed query are told apart: `row_count` 0 with no
|
||||
`error` means nothing matched, and a typo'd column name says so.
|
||||
- **Texts, shapes and images are in the database too**, one row each in
|
||||
`drawing_item_view` (`uuid`, `kind`, `folio`, position and size, and a
|
||||
`description`: the shape type or the text). The uuid is the one saved in
|
||||
the file, and every `qet_edit` op that takes a text, shape or image
|
||||
`index` also takes that uuid, which does not shift the way an index
|
||||
does. `qet_element_build` gives every part of a symbol a uuid as well,
|
||||
returned in `part_uuids`; `qet_element_info` lists them in `part_list`.
|
||||
- **`qet_export` isolates its launch.** SingleApplication keys its socket
|
||||
on `applicationFilePath()`, so a second launch of the same binary path
|
||||
forwards its request to an already-running instance and returns *that*
|
||||
@@ -115,16 +293,65 @@ Across the shipped examples: 3190 conductors, not one with a cable value.
|
||||
its ends with `terminal1`/`terminal2`, and the project format has two
|
||||
schemes: folio-scoped integer ids in older files, terminal-definition
|
||||
uuids plus `element1`/`element2` in newer ones. The integer ids are
|
||||
**renumbered on every save**, so keying on them made all 47 conductors of
|
||||
an untouched `ArduinoLCD.qet` read as 29 removed and 29 re-added the
|
||||
moment the other side had been through QElectroTech. Ends are now keyed
|
||||
by owning element uuid plus terminal, which is stable across a save:
|
||||
measured at 0 colliding keys over 3190 conductors in the 24 shipped
|
||||
examples, and 0 churn on a re-saved but otherwise untouched project.
|
||||
Where an element predates persisted uuids the end cannot be resolved and
|
||||
keeps a `#`-marked unstable key; the diff then reports `unstable_keys`
|
||||
and says so rather than pretending to be comparable.
|
||||
**renumbered on every save**, so keying on them — which this tool did at
|
||||
first — made all 47 conductors of an untouched folio read as removed and
|
||||
re-added the moment the other side had been through QElectroTech, which
|
||||
is exactly what `qet_edit` produces. They are now keyed by owning element
|
||||
uuid plus terminal, which is stable across a save: measured at 0 colliding
|
||||
keys over 3190 conductors in the 24 shipped examples, and 0 churn on a
|
||||
no-op edit. Where an element predates persisted uuids the end cannot be
|
||||
resolved and keeps a `#`-marked unstable key; the diff then reports
|
||||
`unstable_keys` and says so rather than pretending to be comparable.
|
||||
- **Texts, shapes and images are keyed by uuid** when every one on both sides
|
||||
has one, so an edit or a move reads as a change to that item. A file saved
|
||||
before they carried a uuid has none; for such a pair (including a legacy
|
||||
file against its first re-save) that kind falls back to position, where an
|
||||
edited text reads as removed plus added and a move as a removal plus an
|
||||
addition. Each section says which it used in `keyed_by`. The folio `version` attribute is left out of the
|
||||
comparison on purpose: QElectroTech rewrites it on every save, and
|
||||
including it made every folio of any re-saved project look edited.
|
||||
- **Elements** written before persisted uuids fall back to a positional key,
|
||||
which makes a move in such a file read as a remove plus an add rather
|
||||
than as a move.
|
||||
- Read-only by design. Nothing here writes to a project.
|
||||
which makes a move in such a file read as a remove plus an add.
|
||||
- **`qet_edit` needs a build whose scripting API carries the drawing verbs.**
|
||||
Against an older one it reports exactly which methods are missing and
|
||||
changes nothing. `addElement` and the move/delete verbs shipped with the
|
||||
scripting API; `addConductor`, `rotateElement`, `setElementLabel`,
|
||||
`setElementInfo` and `setFolioTitle` are newer.
|
||||
- **`elements_dir` is not optional for `common://` paths.** The sandboxed
|
||||
run has its own empty HOME, so QElectroTech falls back to the compiled-in
|
||||
collection path, which on a machine that never ran `make install` does not
|
||||
exist. The only symptom is `addElement` reporting that a file plainly
|
||||
present "does not resolve to an element". An absolute `.elmt` path works
|
||||
without it.
|
||||
- **`set_conductor` changes the whole potential, not one segment.** That is
|
||||
what the application does — a wire number describes a potential — so name
|
||||
a terminal carrying exactly one conductor and the change reaches every
|
||||
conductor electrically joined to it. A terminal several conductors meet
|
||||
at names none of them and is refused, so address a potential from one of
|
||||
its leaves. Property names are the file's own, so `qet_conductors` reads
|
||||
back exactly what was set.
|
||||
- **`link_elements` takes a folio for each end**, because a master and its
|
||||
slave are normally on different folios. Whether a pair may be linked is
|
||||
decided by QElectroTech's own `isLinkable()`, so a script cannot make a
|
||||
link the GUI would refuse.
|
||||
- **An element must live inside a collection to be placeable.** This is
|
||||
not about the path syntax: an absolute `.elmt` path works, but only if
|
||||
the file sits under a directory QElectroTech knows as a collection.
|
||||
Write it under the tree you pass as `elements_dir` and `qet_edit` can
|
||||
place it, by absolute path or as `common://…`; write it anywhere else
|
||||
and `add_element` reports only "does not resolve to an element".
|
||||
- **`qet_element_build` computes the `.elmt` size header, and checks it.**
|
||||
`width`/`height`/`hotspot_x`/`hotspot_y` relate to the drawing by a
|
||||
containment constraint, not a formula — the declared box runs from
|
||||
`(-hotspot_x, -hotspot_y)` to `(width - hotspot_x, height - hotspot_y)`
|
||||
and the drawing must fit inside it. The shipped collection shows authors
|
||||
picking their own margins (one element pads 2 units left and 3 right,
|
||||
another 8 and 2), so there is no convention to copy, only an invariant
|
||||
to satisfy. A drawing that escaped its box is the classic way a
|
||||
hand-written element renders clipped in the collection panel while
|
||||
looking fine in XML.
|
||||
- **QElectroTech interrupts a script at 30 s** of its own accord, separately
|
||||
from this tool's `timeout`. A very long operation list will hit that
|
||||
first.
|
||||
- **`qet_edit` never writes the input.** It saves to a separate file and
|
||||
diffs the two, so the original is always the thing the diff is against.
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,44 @@
|
||||
<definition version="0.100.0" type="element" link_type="master" width="40" height="60" hotspot_x="17" hotspot_y="32">
|
||||
<uuid uuid="{6d3714f6-a0e1-71b3-e4bd-5a35d4cbbec1}"/>
|
||||
<names>
|
||||
<name lang="ar">ملف KA بمحتفظ مغناطيسي</name>
|
||||
<name lang="ca">Bobina</name>
|
||||
<name lang="cs">Bistabilní remanentní relé</name>
|
||||
<name lang="de">Remanenzrelais</name>
|
||||
<name lang="el">Πηνίο με μανδάλωση</name>
|
||||
<name lang="en">Coil</name>
|
||||
<name lang="es">Bobina KA de remanencia</name>
|
||||
<name lang="fr">Bobine KA à rémanence</name>
|
||||
<name lang="hu">Tekercs</name>
|
||||
<name lang="it">Bobina</name>
|
||||
<name lang="nl">spoel remanent</name>
|
||||
<name lang="nl_BE">Spoel KA remanent</name>
|
||||
<name lang="pl">Cewka przekaźnika remanencyjnego</name>
|
||||
<name lang="pt_BR">Bobina</name>
|
||||
<name lang="ru">Обмотка</name>
|
||||
<name lang="zh">剩磁保持线圈</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type">plc</kindInformation>
|
||||
</kindInformations>
|
||||
<informations>Author: The QElectroTech team
|
||||
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
|
||||
<description>
|
||||
<rect x="14" y="-8" width="6" height="16" rx="0" ry="0" style="line-style:normal;line-weight:normal;filling:none;color:black" antialias="false"/>
|
||||
<line x1="0" y1="-20" x2="0" y2="-8" end1="none" end2="none" length1="1.5" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black" antialias="false"/>
|
||||
<dynamic_text x="2" y="11.33" z="5" text_width="-1" Halignment="AlignLeft" Valignment="AlignTop" frame="false" rotation="0" keep_visual_rotation="false" text_from="UserText" uuid="{647e33ed-520b-4d80-bbc4-7b31177b8f26}" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular">
|
||||
<text>A2</text>
|
||||
</dynamic_text>
|
||||
<dynamic_text x="2" y="-24.67" z="6" text_width="-1" Halignment="AlignLeft" Valignment="AlignTop" frame="false" rotation="0" keep_visual_rotation="false" text_from="UserText" uuid="{fb1f8de9-70c0-4801-8dc7-12e6bf88d8f5}" font="Liberation Sans,4,-1,5,25,0,0,0,0,0,Regular">
|
||||
<text>A1</text>
|
||||
</dynamic_text>
|
||||
<line x1="0" y1="8" x2="0" y2="20" end1="none" end2="none" length1="1.5" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black" antialias="false"/>
|
||||
<dynamic_text x="30" y="-9.17" z="8" text_width="-1" Halignment="AlignLeft" Valignment="AlignTop" frame="false" rotation="0" keep_visual_rotation="false" text_from="ElementInfo" uuid="{b7fccfc3-05f1-459c-9766-f49a481bd0ff}" font="Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular">
|
||||
<text></text>
|
||||
<info_name>label</info_name>
|
||||
</dynamic_text>
|
||||
<polygon x1="-14" y1="-8" x2="14" y2="-8" x3="20" y3="8" x4="-14" y4="8" antialias="false" style="line-style:normal;line-weight:normal;filling:none;color:black"/>
|
||||
<terminal uuid="{6a87c921-6f5d-4f5c-8673-228a6d13c5c8}" name="A2" x="0" y="20" orientation="s" type="Generic"/>
|
||||
<terminal uuid="{2904e5fa-6bbe-4127-acdd-f92feadd6ece}" name="A1" x="0" y="-20" orientation="n" type="Generic"/>
|
||||
</description>
|
||||
</definition>
|
||||
@@ -0,0 +1,16 @@
|
||||
<definition version="0.100.0" type="element" link_type="slave" width="20" height="60" hotspot_x="9" hotspot_y="30">
|
||||
<uuid uuid="{94d56f06-6814-5561-9148-2da3a9c4f900}"/>
|
||||
<names>
|
||||
<name lang="en">PLC Slave Test</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type">plc</kindInformation>
|
||||
<kindInformation name="state">NO</kindInformation>
|
||||
<kindInformation name="number">1</kindInformation>
|
||||
</kindInformations>
|
||||
<description>
|
||||
<rect x="0" y="-8" width="6" height="16" rx="0" ry="0" style="line-style:normal;line-weight:normal;filling:none;color:black" antialias="false"/>
|
||||
<terminal uuid="{6a87c921-6f5d-4f5c-8673-228a6d13c500}" name="1" x="0" y="20" orientation="s" type="Generic"/>
|
||||
<terminal uuid="{2904e5fa-6bbe-4127-acdd-f92feadd6e00}" name="2" x="0" y="-20" orientation="n" type="Generic"/>
|
||||
</description>
|
||||
</definition>
|
||||
+2145
-9
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Executable
+659
@@ -0,0 +1,659 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2006-2026 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/>.
|
||||
r"""Record raw USB reports from a 3Dconnexion 3D mouse, for QElectroTech.
|
||||
|
||||
QElectroTech's Windows/macOS 3D mouse support reads the device directly
|
||||
over USB, so it has to decode each device model's raw reports itself.
|
||||
This records what your device sends while you make a few guided
|
||||
movements, and saves it to one file you can attach to discussion #599.
|
||||
Nothing is sent anywhere. One recording per device model is enough, from
|
||||
any of the three systems: the device sends the same reports on all of them.
|
||||
|
||||
It takes about two minutes. Each step says what to do: press Enter, make
|
||||
the movement and hold it until the next prompt. Push firmly.
|
||||
|
||||
Linux
|
||||
Python 3 is already installed.
|
||||
1. Download: curl -LO https://raw.githubusercontent.com/qelectrotech/qelectrotech-source-mirror/master/misc/spacemouse-capture.py
|
||||
2. List: sudo python3 spacemouse-capture.py --list
|
||||
3. Record: sudo python3 spacemouse-capture.py --seconds 3
|
||||
If --list shows several devices (a Logitech receiver shows up as
|
||||
several), add --device /dev/hidrawN with the 3D mouse's line.
|
||||
sudo is needed because /dev/hidraw* is readable by root only.
|
||||
spacenavd can keep running; if the recording comes out empty, stop it
|
||||
(sudo systemctl stop spacenavd) and try again.
|
||||
|
||||
macOS
|
||||
Python 3 comes with the Xcode command line tools; if "python3" asks
|
||||
to install them, accept. Open Terminal, then:
|
||||
1. Download: curl -LO https://raw.githubusercontent.com/qelectrotech/qelectrotech-source-mirror/master/misc/spacemouse-capture.py
|
||||
2. Record: python3 spacemouse-capture.py --seconds 3
|
||||
No sudo. If it says another program holds the device, quit 3DxWare
|
||||
(or uninstall it) and try again. If it says macOS refused access,
|
||||
allow Terminal in System Settings > Privacy & Security > Input
|
||||
Monitoring, and try again. (Rather not use Terminal? The SpaceMouse
|
||||
Check app does the same with a window: see discussion #599.)
|
||||
|
||||
Windows
|
||||
Install Python 3 from https://www.python.org/downloads/ (tick "Add
|
||||
python.exe to PATH") or from the Microsoft Store. Open a Command
|
||||
Prompt (Windows key, type cmd, Enter), then:
|
||||
1. cd %USERPROFILE%\Downloads
|
||||
2. Download: curl -LO https://raw.githubusercontent.com/qelectrotech/qelectrotech-source-mirror/master/misc/spacemouse-capture.py
|
||||
3. Record: python spacemouse-capture.py --seconds 3
|
||||
No administrator rights needed, and 3DxWare can keep running.
|
||||
Windows does not give out the device's report descriptor, so a
|
||||
recording made on Linux or macOS is a little more complete.
|
||||
|
||||
Every system
|
||||
--list only show the 3D mice found
|
||||
--device PATH pick one, if several are found (a path from --list)
|
||||
--seconds N multiply the time per step (3 triples it)
|
||||
-o FILE where to save (default: spacemouse-capture-<id>.json)
|
||||
|
||||
The file is saved in the current folder: attach it to discussion #599.
|
||||
Only Python's standard library is used.
|
||||
"""
|
||||
import argparse
|
||||
import datetime
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import select
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
VENDORS = {0x046D: 'Logitech (older 3Dconnexion)', 0x256F: '3Dconnexion'}
|
||||
|
||||
STEPS = [
|
||||
('rest', 'Do not touch the device.', 3),
|
||||
('right', 'Push the cap to the RIGHT and hold it, then let go.', 4),
|
||||
('left', 'Push the cap to the LEFT and hold it, then let go.', 4),
|
||||
('away', 'Push the cap AWAY from you and hold it, then let go.', 4),
|
||||
('toward', 'Pull the cap TOWARDS you and hold it, then let go.', 4),
|
||||
('down', 'Press the cap DOWN and hold it, then let go.', 4),
|
||||
('up', 'Lift the cap UP and hold it, then let go.', 4),
|
||||
('twist_cw', 'TWIST the cap CLOCKWISE (seen from above) and hold, then let go.', 4),
|
||||
('twist_ccw', 'TWIST the cap ANTICLOCKWISE and hold, then let go.', 4),
|
||||
('tilt_away', 'TILT the cap AWAY from you and hold, then let go.', 4),
|
||||
('tilt_right', 'TILT the cap to the RIGHT and hold, then let go.', 4),
|
||||
('buttons', 'Press each button once, slowly, one at a time, in any order.', 15),
|
||||
]
|
||||
|
||||
# Processes that may also be reading the device.
|
||||
OTHER_READERS = ('3dconnexion', '3dx', 'spacenavd') # 3DxWare: 3DconnexionHelper, 3DxNLServer...
|
||||
|
||||
|
||||
def other_readers():
|
||||
if sys.platform == 'win32':
|
||||
try:
|
||||
out = subprocess.run(['tasklist', '/fo', 'csv', '/nh'], capture_output=True,
|
||||
text=True, timeout=10).stdout
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
return ['unknown']
|
||||
names = {line.split('","')[0].strip('"') for line in out.splitlines() if line}
|
||||
return sorted(n for n in names if any(r in n.lower() for r in OTHER_READERS))
|
||||
try:
|
||||
out = subprocess.run(['ps', '-A', '-o', 'comm='], capture_output=True,
|
||||
text=True, timeout=5).stdout
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
return ['unknown']
|
||||
names = {os.path.basename(line.strip()) for line in out.splitlines()}
|
||||
return sorted(n for n in names if any(r in n.lower() for r in OTHER_READERS))
|
||||
|
||||
|
||||
# --- Linux: /dev/hidraw ----------------------------------------------------
|
||||
|
||||
class HidrawDevice:
|
||||
backend = 'hidraw'
|
||||
|
||||
def __init__(self, path, name='?', vendor='?', product='?', sysfs=None):
|
||||
self.path, self.name, self.vendor, self.product = path, name, vendor, product
|
||||
self.sysfs = sysfs
|
||||
self.fd = None
|
||||
|
||||
@staticmethod
|
||||
def find():
|
||||
found = []
|
||||
for sysdir in sorted(glob.glob('/sys/class/hidraw/hidraw*')):
|
||||
try:
|
||||
with open(os.path.join(sysdir, 'device', 'uevent')) as f:
|
||||
uevent = dict(line.strip().split('=', 1) for line in f if '=' in line)
|
||||
except OSError:
|
||||
continue
|
||||
# HID_ID=0003:0000256F:0000C635 (bus:vendor:product)
|
||||
try:
|
||||
_bus, vendor, product = (int(x, 16) for x in uevent.get('HID_ID', '').split(':'))
|
||||
except ValueError:
|
||||
continue
|
||||
if vendor not in VENDORS:
|
||||
continue
|
||||
found.append(HidrawDevice('/dev/' + os.path.basename(sysdir),
|
||||
uevent.get('HID_NAME', '?'),
|
||||
'%04x' % vendor, '%04x' % product, sysdir))
|
||||
return found
|
||||
|
||||
def descriptor(self):
|
||||
if not self.sysfs:
|
||||
return 'unknown'
|
||||
try:
|
||||
with open(os.path.join(self.sysfs, 'device', 'report_descriptor'), 'rb') as f:
|
||||
return f.read().hex()
|
||||
except OSError as e:
|
||||
return 'unreadable: %s' % e
|
||||
|
||||
def open(self):
|
||||
try:
|
||||
self.fd = os.open(self.path, os.O_RDONLY | os.O_NONBLOCK)
|
||||
except PermissionError:
|
||||
sys.exit('Permission denied on %s -- run with sudo.' % self.path)
|
||||
|
||||
def record(self, seconds):
|
||||
"""Read every report arriving within `seconds`; return [[ms, hex], ...]."""
|
||||
reports = []
|
||||
start = time.monotonic()
|
||||
while True:
|
||||
left = seconds - (time.monotonic() - start)
|
||||
if left <= 0:
|
||||
return reports
|
||||
ready, _, _ = select.select([self.fd], [], [], left)
|
||||
if not ready:
|
||||
continue
|
||||
try:
|
||||
data = os.read(self.fd, 64)
|
||||
except BlockingIOError:
|
||||
continue
|
||||
if not data: # only a test FIFO with no writer does this
|
||||
time.sleep(0.01)
|
||||
continue
|
||||
reports.append([round((time.monotonic() - start) * 1000, 1), data.hex()])
|
||||
|
||||
def drain(self):
|
||||
"""Drop reports queued while waiting for Enter."""
|
||||
while True:
|
||||
try:
|
||||
if not os.read(self.fd, 64):
|
||||
return
|
||||
except BlockingIOError:
|
||||
return
|
||||
|
||||
def close(self):
|
||||
os.close(self.fd)
|
||||
|
||||
def empty_hint(self):
|
||||
return 'Try stopping spacenavd first: sudo systemctl stop spacenavd'
|
||||
|
||||
|
||||
# --- macOS: IOKit, the same calls hidapi's mac backend makes ----------------
|
||||
|
||||
class MacHid:
|
||||
"""ctypes bindings to the few CoreFoundation/IOKit calls needed."""
|
||||
|
||||
def __init__(self):
|
||||
import ctypes as c
|
||||
self.c = c
|
||||
cf = c.CDLL('/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation')
|
||||
io = c.CDLL('/System/Library/Frameworks/IOKit.framework/IOKit')
|
||||
vp, i32, u32, idx = c.c_void_p, c.c_int32, c.c_uint32, c.c_long
|
||||
|
||||
def fn(lib, name, res, *args):
|
||||
f = getattr(lib, name)
|
||||
f.restype, f.argtypes = res, list(args)
|
||||
return f
|
||||
|
||||
self.CFStringCreateWithCString = fn(cf, 'CFStringCreateWithCString', vp, vp, c.c_char_p, u32)
|
||||
self.CFStringGetCString = fn(cf, 'CFStringGetCString', c.c_bool, vp, c.c_char_p, idx, u32)
|
||||
self.CFGetTypeID = fn(cf, 'CFGetTypeID', c.c_ulong, vp)
|
||||
self.CFNumberGetTypeID = fn(cf, 'CFNumberGetTypeID', c.c_ulong)
|
||||
self.CFStringGetTypeID = fn(cf, 'CFStringGetTypeID', c.c_ulong)
|
||||
self.CFDataGetTypeID = fn(cf, 'CFDataGetTypeID', c.c_ulong)
|
||||
self.CFNumberGetValue = fn(cf, 'CFNumberGetValue', c.c_bool, vp, idx, vp)
|
||||
self.CFDataGetLength = fn(cf, 'CFDataGetLength', idx, vp)
|
||||
self.CFDataGetBytePtr = fn(cf, 'CFDataGetBytePtr', vp, vp)
|
||||
self.CFSetGetCount = fn(cf, 'CFSetGetCount', idx, vp)
|
||||
self.CFSetGetValues = fn(cf, 'CFSetGetValues', None, vp, c.POINTER(vp))
|
||||
self.CFRunLoopGetCurrent = fn(cf, 'CFRunLoopGetCurrent', vp)
|
||||
self.CFRunLoopRunInMode = fn(cf, 'CFRunLoopRunInMode', i32, vp, c.c_double, c.c_bool)
|
||||
self.kCFRunLoopDefaultMode = vp.in_dll(cf, 'kCFRunLoopDefaultMode').value
|
||||
|
||||
self.IOHIDManagerCreate = fn(io, 'IOHIDManagerCreate', vp, vp, u32)
|
||||
self.IOHIDManagerSetDeviceMatching = fn(io, 'IOHIDManagerSetDeviceMatching', None, vp, vp)
|
||||
self.IOHIDManagerScheduleWithRunLoop = fn(io, 'IOHIDManagerScheduleWithRunLoop', None, vp, vp, vp)
|
||||
self.IOHIDManagerCopyDevices = fn(io, 'IOHIDManagerCopyDevices', vp, vp)
|
||||
self.IOHIDDeviceGetProperty = fn(io, 'IOHIDDeviceGetProperty', vp, vp, vp)
|
||||
self.IOHIDDeviceOpen = fn(io, 'IOHIDDeviceOpen', i32, vp, u32)
|
||||
self.IOHIDDeviceClose = fn(io, 'IOHIDDeviceClose', i32, vp, u32)
|
||||
self.IOHIDDeviceScheduleWithRunLoop = fn(io, 'IOHIDDeviceScheduleWithRunLoop', None, vp, vp, vp)
|
||||
self.IOHIDDeviceUnscheduleFromRunLoop = fn(io, 'IOHIDDeviceUnscheduleFromRunLoop', None, vp, vp, vp)
|
||||
# void (*)(void *ctx, IOReturn, void *sender, IOHIDReportType, uint32_t id, uint8_t *, CFIndex)
|
||||
self.ReportCallback = c.CFUNCTYPE(None, vp, i32, vp, c.c_int, u32, c.POINTER(c.c_uint8), idx)
|
||||
self.IOHIDDeviceRegisterInputReportCallback = fn(
|
||||
io, 'IOHIDDeviceRegisterInputReportCallback', None, vp, vp, idx, self.ReportCallback, vp)
|
||||
|
||||
def cfstr(self, s):
|
||||
return self.CFStringCreateWithCString(None, s.encode(), 0x08000100) # UTF-8
|
||||
|
||||
def prop(self, dev, key):
|
||||
"""A device property as int, str or bytes, or None."""
|
||||
c = self.c
|
||||
ref = self.IOHIDDeviceGetProperty(dev, self.cfstr(key))
|
||||
if not ref:
|
||||
return None
|
||||
t = self.CFGetTypeID(ref)
|
||||
if t == self.CFNumberGetTypeID():
|
||||
v = c.c_int64()
|
||||
self.CFNumberGetValue(ref, 4, c.byref(v)) # kCFNumberSInt64Type
|
||||
return v.value
|
||||
if t == self.CFStringGetTypeID():
|
||||
buf = c.create_string_buffer(256)
|
||||
return buf.value.decode('utf-8', 'replace') if self.CFStringGetCString(
|
||||
ref, buf, len(buf), 0x08000100) else None
|
||||
if t == self.CFDataGetTypeID():
|
||||
return c.string_at(self.CFDataGetBytePtr(ref), self.CFDataGetLength(ref))
|
||||
return None
|
||||
|
||||
|
||||
class MacDevice:
|
||||
backend = 'iokit'
|
||||
_hid = None
|
||||
|
||||
def __init__(self, ref, name, vendor, product, location):
|
||||
self.ref, self.name, self.vendor, self.product = ref, name, vendor, product
|
||||
self.path = 'iokit:%08x' % location
|
||||
self.reports = []
|
||||
self.start = time.monotonic()
|
||||
|
||||
@classmethod
|
||||
def hid(cls):
|
||||
if cls._hid is None:
|
||||
cls._hid = MacHid()
|
||||
return cls._hid
|
||||
|
||||
@classmethod
|
||||
def find(cls):
|
||||
h = cls.hid()
|
||||
mgr = h.IOHIDManagerCreate(None, 0)
|
||||
h.IOHIDManagerSetDeviceMatching(mgr, None)
|
||||
h.IOHIDManagerScheduleWithRunLoop(mgr, h.CFRunLoopGetCurrent(), h.kCFRunLoopDefaultMode)
|
||||
devset = h.IOHIDManagerCopyDevices(mgr)
|
||||
if not devset:
|
||||
return []
|
||||
n = h.CFSetGetCount(devset)
|
||||
refs = (h.c.c_void_p * n)()
|
||||
h.CFSetGetValues(devset, refs)
|
||||
found = []
|
||||
for ref in refs:
|
||||
vendor = h.prop(ref, 'VendorID')
|
||||
if vendor not in VENDORS:
|
||||
continue
|
||||
# The same test as QET's SpaceMouseHid::isSpaceMouse(): Generic
|
||||
# Desktop / Multi-axis Controller, or no usage at all. This also
|
||||
# skips Logitech's ordinary mice and keyboards.
|
||||
usage = (h.prop(ref, 'PrimaryUsagePage') or 0, h.prop(ref, 'PrimaryUsage') or 0)
|
||||
if usage not in ((1, 8), (0, 0)):
|
||||
continue
|
||||
found.append(cls(ref, h.prop(ref, 'Product') or '?', '%04x' % vendor,
|
||||
'%04x' % (h.prop(ref, 'ProductID') or 0),
|
||||
h.prop(ref, 'LocationID') or 0))
|
||||
return sorted(found, key=lambda d: d.path)
|
||||
|
||||
def descriptor(self):
|
||||
d = self.hid().prop(self.ref, 'ReportDescriptor')
|
||||
return d.hex() if d else 'unreadable'
|
||||
|
||||
def open(self):
|
||||
h = self.hid()
|
||||
ret = h.IOHIDDeviceOpen(self.ref, 0) & 0xFFFFFFFF # kIOHIDOptionsTypeNone: shared
|
||||
if ret == 0xE00002C5:
|
||||
sys.exit('The device is held exclusively by another program '
|
||||
'(kIOReturnExclusiveAccess). Quit 3DxWare and try again.')
|
||||
if ret in (0xE00002E2, 0xE00002C1):
|
||||
sys.exit('macOS refused access (0x%08X). Allow Terminal under System Settings > '
|
||||
'Privacy & Security > Input Monitoring, then try again.' % ret)
|
||||
if ret:
|
||||
sys.exit('Could not open the device (IOReturn 0x%08X).' % ret)
|
||||
size = h.prop(self.ref, 'MaxInputReportSize') or 64
|
||||
self.buf = h.c.create_string_buffer(size)
|
||||
|
||||
def on_report(_ctx, _result, _sender, _type, _id, data, length):
|
||||
self.reports.append([round((time.monotonic() - self.start) * 1000, 1),
|
||||
h.c.string_at(data, length).hex()])
|
||||
self.callback = h.ReportCallback(on_report) # must outlive the device
|
||||
h.IOHIDDeviceRegisterInputReportCallback(self.ref, self.buf, size, self.callback, None)
|
||||
h.IOHIDDeviceScheduleWithRunLoop(self.ref, h.CFRunLoopGetCurrent(), h.kCFRunLoopDefaultMode)
|
||||
|
||||
def record(self, seconds):
|
||||
h = self.hid()
|
||||
self.reports, self.start = [], time.monotonic()
|
||||
while True:
|
||||
left = seconds - (time.monotonic() - self.start)
|
||||
if left <= 0:
|
||||
return self.reports
|
||||
h.CFRunLoopRunInMode(h.kCFRunLoopDefaultMode, left, False)
|
||||
|
||||
def drain(self):
|
||||
self.hid().CFRunLoopRunInMode(self.hid().kCFRunLoopDefaultMode, 0.05, False)
|
||||
self.reports = []
|
||||
|
||||
def close(self):
|
||||
h = self.hid()
|
||||
h.IOHIDDeviceUnscheduleFromRunLoop(self.ref, h.CFRunLoopGetCurrent(), h.kCFRunLoopDefaultMode)
|
||||
h.IOHIDDeviceClose(self.ref, 0)
|
||||
|
||||
def empty_hint(self):
|
||||
return ('Quit 3DxWare if it is running, or allow Terminal under System Settings > '
|
||||
'Privacy & Security > Input Monitoring, and try again.')
|
||||
|
||||
|
||||
# --- Windows: hid.dll, the same calls hidapi's Windows backend makes ---------
|
||||
|
||||
class WinHid:
|
||||
"""ctypes bindings to the SetupAPI/HID/kernel32 calls needed."""
|
||||
|
||||
def __init__(self):
|
||||
import ctypes as c
|
||||
from ctypes import wintypes as w
|
||||
self.c, self.w = c, w
|
||||
self.hid = c.WinDLL('hid')
|
||||
self.setupapi = c.WinDLL('setupapi')
|
||||
self.k32 = c.WinDLL('kernel32', use_last_error=True)
|
||||
k, sa = self.k32, self.setupapi
|
||||
|
||||
class GUID(c.Structure):
|
||||
_fields_ = [('Data1', w.DWORD), ('Data2', w.WORD), ('Data3', w.WORD),
|
||||
('Data4', c.c_ubyte * 8)]
|
||||
|
||||
class InterfaceData(c.Structure):
|
||||
_fields_ = [('cbSize', w.DWORD), ('InterfaceClassGuid', GUID),
|
||||
('Flags', w.DWORD), ('Reserved', c.c_void_p)]
|
||||
|
||||
class Attributes(c.Structure):
|
||||
_fields_ = [('Size', w.ULONG), ('VendorID', w.USHORT), ('ProductID', w.USHORT),
|
||||
('VersionNumber', w.USHORT)]
|
||||
|
||||
class Caps(c.Structure):
|
||||
_fields_ = [('Usage', w.USHORT), ('UsagePage', w.USHORT),
|
||||
('InputReportByteLength', w.USHORT), ('OutputReportByteLength', w.USHORT),
|
||||
('FeatureReportByteLength', w.USHORT), ('Reserved', w.USHORT * 17),
|
||||
('rest', w.USHORT * 10)]
|
||||
|
||||
class Overlapped(c.Structure):
|
||||
_fields_ = [('Internal', c.c_void_p), ('InternalHigh', c.c_void_p),
|
||||
('Offset', w.DWORD), ('OffsetHigh', w.DWORD), ('hEvent', w.HANDLE)]
|
||||
|
||||
self.GUID, self.InterfaceData, self.Attributes = GUID, InterfaceData, Attributes
|
||||
self.Caps, self.Overlapped = Caps, Overlapped
|
||||
|
||||
k.CreateFileW.restype = w.HANDLE
|
||||
k.CreateFileW.argtypes = [w.LPCWSTR, w.DWORD, w.DWORD, c.c_void_p, w.DWORD, w.DWORD, w.HANDLE]
|
||||
k.CreateEventW.restype = w.HANDLE
|
||||
k.CreateEventW.argtypes = [c.c_void_p, w.BOOL, w.BOOL, w.LPCWSTR]
|
||||
k.ReadFile.argtypes = [w.HANDLE, c.c_void_p, w.DWORD, c.c_void_p, c.c_void_p]
|
||||
k.GetOverlappedResult.argtypes = [w.HANDLE, c.c_void_p, c.POINTER(w.DWORD), w.BOOL]
|
||||
k.WaitForSingleObject.argtypes = [w.HANDLE, w.DWORD]
|
||||
k.WaitForSingleObject.restype = w.DWORD
|
||||
k.CancelIo.argtypes = [w.HANDLE]
|
||||
k.CloseHandle.argtypes = [w.HANDLE]
|
||||
sa.SetupDiGetClassDevsW.restype = w.HANDLE
|
||||
sa.SetupDiGetClassDevsW.argtypes = [c.c_void_p, w.LPCWSTR, w.HWND, w.DWORD]
|
||||
sa.SetupDiEnumDeviceInterfaces.argtypes = [w.HANDLE, c.c_void_p, c.c_void_p, w.DWORD, c.c_void_p]
|
||||
sa.SetupDiGetDeviceInterfaceDetailW.argtypes = [w.HANDLE, c.c_void_p, c.c_void_p, w.DWORD,
|
||||
c.POINTER(w.DWORD), c.c_void_p]
|
||||
sa.SetupDiDestroyDeviceInfoList.argtypes = [w.HANDLE]
|
||||
self.hid.HidD_GetHidGuid.argtypes = [c.c_void_p]
|
||||
self.hid.HidD_GetAttributes.argtypes = [w.HANDLE, c.c_void_p]
|
||||
self.hid.HidD_GetPreparsedData.argtypes = [w.HANDLE, c.POINTER(c.c_void_p)]
|
||||
self.hid.HidD_FreePreparsedData.argtypes = [c.c_void_p]
|
||||
self.hid.HidP_GetCaps.argtypes = [c.c_void_p, c.c_void_p]
|
||||
self.hid.HidD_GetProductString.argtypes = [w.HANDLE, c.c_void_p, w.ULONG]
|
||||
|
||||
INVALID = (2 ** 64 - 1, 2 ** 32 - 1, -1) # INVALID_HANDLE_VALUE, 64/32-bit
|
||||
|
||||
def paths(self):
|
||||
"""Every HID interface path on the system."""
|
||||
c, w = self.c, self.w
|
||||
guid = self.GUID()
|
||||
self.hid.HidD_GetHidGuid(c.byref(guid))
|
||||
info = self.setupapi.SetupDiGetClassDevsW(c.byref(guid), None, None, 0x12) # PRESENT|INTERFACE
|
||||
paths = []
|
||||
i = 0
|
||||
while True:
|
||||
data = self.InterfaceData()
|
||||
data.cbSize = c.sizeof(data)
|
||||
if not self.setupapi.SetupDiEnumDeviceInterfaces(info, None, c.byref(guid), i, c.byref(data)):
|
||||
break
|
||||
i += 1
|
||||
needed = w.DWORD()
|
||||
self.setupapi.SetupDiGetDeviceInterfaceDetailW(info, c.byref(data), None, 0, c.byref(needed), None)
|
||||
buf = c.create_string_buffer(needed.value)
|
||||
# SP_DEVICE_INTERFACE_DETAIL_DATA_W: DWORD cbSize, then the path.
|
||||
c.cast(buf, c.POINTER(w.DWORD))[0] = 8 if c.sizeof(c.c_void_p) == 8 else 6
|
||||
if self.setupapi.SetupDiGetDeviceInterfaceDetailW(info, c.byref(data), buf, needed, None, None):
|
||||
paths.append(c.wstring_at(c.addressof(buf) + 4))
|
||||
self.setupapi.SetupDiDestroyDeviceInfoList(info)
|
||||
return paths
|
||||
|
||||
def open(self, path, access):
|
||||
# FILE_SHARE_READ|WRITE, OPEN_EXISTING, FILE_FLAG_OVERLAPPED
|
||||
h = self.k32.CreateFileW(path, access, 3, None, 3, 0x40000000, None)
|
||||
return None if h is None or h in self.INVALID else h
|
||||
|
||||
def describe(self, h):
|
||||
"""(vendor, product, usage_page, usage, input_length, name) of an open handle."""
|
||||
c = self.c
|
||||
attrs = self.Attributes()
|
||||
attrs.Size = c.sizeof(attrs)
|
||||
if not self.hid.HidD_GetAttributes(h, c.byref(attrs)):
|
||||
return None
|
||||
page = usage = length = 0
|
||||
pre = c.c_void_p()
|
||||
if self.hid.HidD_GetPreparsedData(h, c.byref(pre)):
|
||||
caps = self.Caps()
|
||||
self.hid.HidP_GetCaps(pre, c.byref(caps))
|
||||
page, usage, length = caps.UsagePage, caps.Usage, caps.InputReportByteLength
|
||||
self.hid.HidD_FreePreparsedData(pre)
|
||||
name = c.create_unicode_buffer(128)
|
||||
if not self.hid.HidD_GetProductString(h, name, c.sizeof(name)):
|
||||
name.value = '?'
|
||||
return attrs.VendorID, attrs.ProductID, page, usage, length, name.value
|
||||
|
||||
|
||||
class WinDevice:
|
||||
backend = 'windows-hid'
|
||||
_hid = None
|
||||
|
||||
def __init__(self, path, name, vendor, product, length):
|
||||
self.path, self.name, self.vendor, self.product = path, name, vendor, product
|
||||
self.length = length or 64
|
||||
self.handle = None
|
||||
|
||||
@classmethod
|
||||
def hid(cls):
|
||||
if cls._hid is None:
|
||||
cls._hid = WinHid()
|
||||
return cls._hid
|
||||
|
||||
@classmethod
|
||||
def find(cls):
|
||||
h = cls.hid()
|
||||
found = []
|
||||
for path in h.paths():
|
||||
handle = h.open(path, 0) # no access: enough to read attributes
|
||||
if handle is None:
|
||||
continue
|
||||
try:
|
||||
d = h.describe(handle)
|
||||
finally:
|
||||
h.k32.CloseHandle(handle)
|
||||
if not d:
|
||||
continue
|
||||
vendor, product, page, usage, length, name = d
|
||||
# The same test as QET's SpaceMouseHid::isSpaceMouse().
|
||||
if vendor not in VENDORS or (page, usage) not in ((1, 8), (0, 0)):
|
||||
continue
|
||||
found.append(cls(path, name, '%04x' % vendor, '%04x' % product, length))
|
||||
return found
|
||||
|
||||
def descriptor(self):
|
||||
# Windows only gives out a parsed form of it.
|
||||
return ''
|
||||
|
||||
def open(self):
|
||||
h = self.hid()
|
||||
self.handle = h.open(self.path, 0x80000000) # GENERIC_READ
|
||||
if self.handle is None:
|
||||
sys.exit('Could not open the device (error %d).' % h.c.get_last_error())
|
||||
self.event = h.k32.CreateEventW(None, True, False, None)
|
||||
self.buf = h.c.create_string_buffer(self.length)
|
||||
self.pending = False
|
||||
self.start = time.monotonic()
|
||||
|
||||
def _read(self, wait_ms):
|
||||
"""One report if it arrives within wait_ms, else None."""
|
||||
h = self.hid()
|
||||
c, w = h.c, h.w
|
||||
if not self.pending:
|
||||
self.ov = h.Overlapped()
|
||||
self.ov.hEvent = self.event
|
||||
h.k32.ReadFile(self.handle, self.buf, self.length, None, c.byref(self.ov))
|
||||
self.pending = True
|
||||
if h.k32.WaitForSingleObject(self.event, max(0, int(wait_ms))) != 0:
|
||||
return None
|
||||
self.pending = False
|
||||
n = w.DWORD()
|
||||
if not h.k32.GetOverlappedResult(self.handle, c.byref(self.ov), c.byref(n), False):
|
||||
return None
|
||||
data = self.buf.raw[:n.value]
|
||||
# Windows puts a report ID in front even when the device has none;
|
||||
# hidapi drops that 0, so QET never sees it.
|
||||
return data[1:] if data[:1] == b'\0' else data
|
||||
|
||||
def record(self, seconds):
|
||||
reports = []
|
||||
start = time.monotonic()
|
||||
while True:
|
||||
left = seconds - (time.monotonic() - start)
|
||||
if left <= 0:
|
||||
return reports
|
||||
data = self._read(left * 1000)
|
||||
if data:
|
||||
reports.append([round((time.monotonic() - start) * 1000, 1), data.hex()])
|
||||
|
||||
def drain(self):
|
||||
while self._read(0):
|
||||
pass
|
||||
|
||||
def close(self):
|
||||
h = self.hid()
|
||||
if self.pending:
|
||||
h.k32.CancelIo(self.handle)
|
||||
h.k32.CloseHandle(self.event)
|
||||
h.k32.CloseHandle(self.handle)
|
||||
|
||||
def empty_hint(self):
|
||||
return 'Check the cable, push the cap firmly, and try again.'
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description=__doc__,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument('--list', action='store_true', help='only list matching devices')
|
||||
ap.add_argument('--device', help='device path from --list, if more than one is found')
|
||||
ap.add_argument('--descriptor', help=argparse.SUPPRESS) # testing without a device
|
||||
ap.add_argument('--yes', action='store_true', help=argparse.SUPPRESS) # no Enter prompts
|
||||
ap.add_argument('-o', '--output', help='output file (default: spacemouse-capture-<product>.json)')
|
||||
ap.add_argument('--seconds', type=float, default=1.0,
|
||||
help='multiply each step\'s recording time (default: 1.0, e.g. 3 triples it)')
|
||||
args = ap.parse_args()
|
||||
|
||||
Device = {'darwin': MacDevice, 'win32': WinDevice}.get(sys.platform, HidrawDevice)
|
||||
devices = Device.find()
|
||||
if args.list:
|
||||
for d in devices:
|
||||
print('%s %s:%s %s' % (d.path, d.vendor, d.product, d.name))
|
||||
if not devices:
|
||||
print('No 3Dconnexion device found.')
|
||||
return 0 if devices else 1
|
||||
|
||||
if args.device:
|
||||
dev = next((d for d in devices if d.path == args.device), None)
|
||||
if dev is None:
|
||||
if Device is not HidrawDevice:
|
||||
sys.exit('No device %s (try --list)' % args.device)
|
||||
dev = HidrawDevice(args.device)
|
||||
elif len(devices) == 1:
|
||||
dev = devices[0]
|
||||
elif not devices:
|
||||
sys.exit('No 3Dconnexion device found. Is it plugged in? (try --list)')
|
||||
else:
|
||||
sys.exit('Several devices found, pick one with --device:\n' +
|
||||
'\n'.join(' %s %s' % (d.path, d.name) for d in devices))
|
||||
|
||||
if args.descriptor:
|
||||
with open(args.descriptor, 'rb') as f:
|
||||
descriptor = f.read().hex()
|
||||
else:
|
||||
descriptor = dev.descriptor()
|
||||
|
||||
dev.open()
|
||||
print('Recording from %s (%s, %s:%s).' % (dev.path, dev.name, dev.vendor, dev.product))
|
||||
readers = other_readers()
|
||||
if readers:
|
||||
print('Also running: %s. If nothing gets recorded, quit it and try again.' % ', '.join(readers))
|
||||
print('For each step, press Enter, do the movement, and wait for the next prompt.\n')
|
||||
|
||||
result = {
|
||||
'tool': 'spacemouse-capture.py 2',
|
||||
'date': datetime.datetime.now(datetime.timezone.utc).isoformat(timespec='seconds'),
|
||||
'system': platform.platform(),
|
||||
'backend': dev.backend,
|
||||
'other_readers': readers,
|
||||
'device': {'name': dev.name, 'vendor': dev.vendor, 'product': dev.product},
|
||||
'report_descriptor': descriptor,
|
||||
'steps': [],
|
||||
}
|
||||
try:
|
||||
for i, (key, text, seconds) in enumerate(STEPS, 1):
|
||||
seconds = seconds * args.seconds
|
||||
print('[%d/%d] %s' % (i, len(STEPS), text))
|
||||
if not args.yes:
|
||||
input(' Press Enter to start (%.0f s)... ' % seconds)
|
||||
dev.drain()
|
||||
reports = dev.record(seconds)
|
||||
print(' %d reports recorded.\n' % len(reports))
|
||||
result['steps'].append({'step': key, 'instruction': text, 'reports': reports})
|
||||
except KeyboardInterrupt:
|
||||
print('\nStopped early -- saving what was recorded so far.')
|
||||
finally:
|
||||
dev.close()
|
||||
|
||||
out = args.output or 'spacemouse-capture-%s.json' % dev.product
|
||||
with open(out, 'w') as f:
|
||||
json.dump(result, f, indent=1)
|
||||
total = sum(len(s['reports']) for s in result['steps'])
|
||||
print('Saved %s (%d reports in total).' % (out, total))
|
||||
if total == 0:
|
||||
print('Nothing was recorded. ' + dev.empty_hint())
|
||||
else:
|
||||
print('Please attach this file to discussion #599. Thank you!')
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,934 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 "elementpickerpopup.h"
|
||||
|
||||
#include "elementscollectionwidget.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QGuiApplication>
|
||||
#include <QHBoxLayout>
|
||||
#include <QListWidget>
|
||||
#include <QMenu>
|
||||
#include <QPushButton>
|
||||
#include <QToolButton>
|
||||
#include <QCloseEvent>
|
||||
#include <QCursor>
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QListView>
|
||||
#include <QScreen>
|
||||
#include <QSizeGrip>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QSettings>
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "../qetapp.h"
|
||||
#include "../shortcutmanager.h"
|
||||
#include "elementslocation.h"
|
||||
|
||||
//The palette is read from disk each time the picker opens. It is meant as
|
||||
//a shortlist, and a large custom collection would otherwise make opening
|
||||
//slow and the grid unusable.
|
||||
static const int max_palette_entries = 60;
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::ElementPickerPopup
|
||||
@param source : the collection widget whose model the search runs against
|
||||
@param parent
|
||||
*/
|
||||
ElementPickerPopup::ElementPickerPopup(ElementsCollectionWidget *source,
|
||||
QWidget *parent) :
|
||||
QFrame(parent, Qt::Popup),
|
||||
m_source(source)
|
||||
{
|
||||
setFrameShape(QFrame::StyledPanel);
|
||||
setFrameShadow(QFrame::Raised);
|
||||
setMinimumWidth(340);
|
||||
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(6, 6, 6, 6);
|
||||
layout->setSpacing(4);
|
||||
|
||||
//Command row, shown when the picker is opened as the shortcut bar
|
||||
m_commands = new QWidget(this);
|
||||
m_commands_layout = new QHBoxLayout(m_commands);
|
||||
m_commands_layout->setContentsMargins(0, 0, 0, 0);
|
||||
m_commands_layout->setSpacing(2);
|
||||
m_commands->hide();
|
||||
//SolidWorks: right-click the bar to customise it
|
||||
m_commands->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(m_commands, &QWidget::customContextMenuRequested, this, [this](const QPoint &pos) {
|
||||
QMenu menu;
|
||||
menu.addAction(tr("Personnaliser la barre…"), this, &ElementPickerPopup::startCustomising);
|
||||
menu.exec(m_commands->mapToGlobal(pos));
|
||||
});
|
||||
|
||||
//Customising, shown instead of everything else. Two lists that
|
||||
//commands are dragged between: the bar, left to right, and the
|
||||
//commands that are not on it.
|
||||
m_editor = new QWidget(this);
|
||||
auto *editor_layout = new QVBoxLayout(m_editor);
|
||||
editor_layout->setContentsMargins(0, 0, 0, 0);
|
||||
auto *help = new QLabel(
|
||||
tr("Glissez les commandes et les éléments dans la barre, hors de la "
|
||||
"barre, ou d'une place à l'autre. Un double-clic fait passer une "
|
||||
"commande ou un élément d'une liste à l'autre."), m_editor);
|
||||
help->setWordWrap(true);
|
||||
m_edit_row = new QListWidget(m_editor);
|
||||
m_edit_row->setFlow(QListView::LeftToRight);
|
||||
m_edit_row->setWrapping(false);
|
||||
m_edit_row->setIconSize(QSize(24, 24));
|
||||
m_edit_row->setFixedHeight(44);
|
||||
m_edit_available = new QListWidget(m_editor);
|
||||
m_edit_available->setIconSize(QSize(20, 20));
|
||||
m_edit_available->setMinimumHeight(220);
|
||||
for (QListWidget *list : {m_edit_row, m_edit_available}) {
|
||||
list->setDragDropMode(QAbstractItemView::DragDrop);
|
||||
list->setDefaultDropAction(Qt::MoveAction);
|
||||
list->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
}
|
||||
//A drop copies the item as it was in the other list, so a command
|
||||
//dragged onto the bar would keep its text and one dragged off would
|
||||
//have none. Set the text for the list it has landed in.
|
||||
//Deferred: a drop inserts the row first and copies the item's data
|
||||
//into it afterwards.
|
||||
auto relabel = [this](QListWidget *list, bool icon_only) {
|
||||
return [this, list, icon_only]() {
|
||||
QTimer::singleShot(0, this, [list, icon_only]() {
|
||||
for (int i = 0 ; i < list->count() ; ++i) {
|
||||
QListWidgetItem *item = list->item(i);
|
||||
item->setText(icon_only && !item->icon().isNull()
|
||||
? QString() : item->toolTip());
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
connect(m_edit_row->model(), &QAbstractItemModel::rowsInserted,
|
||||
this, relabel(m_edit_row, true));
|
||||
connect(m_edit_available->model(), &QAbstractItemModel::rowsInserted,
|
||||
this, relabel(m_edit_available, false));
|
||||
//An element dragged off the bar onto the commands is removed from
|
||||
//the bar, not listed as a command
|
||||
connect(m_edit_available->model(), &QAbstractItemModel::rowsInserted, this, [this]() {
|
||||
QTimer::singleShot(0, this, [this]() {
|
||||
for (int i = m_edit_available->count() - 1 ; i >= 0 ; --i) {
|
||||
if (ShortcutBarSettings::isElement(
|
||||
m_edit_available->item(i)->data(Qt::UserRole).toString())) {
|
||||
delete m_edit_available->takeItem(i);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
connect(m_edit_row, &QListWidget::itemDoubleClicked, this, [this](QListWidgetItem *item) {
|
||||
const QString id = item->data(Qt::UserRole).toString();
|
||||
delete item;
|
||||
if (!ShortcutBarSettings::isElement(id)) {
|
||||
m_edit_available->addItem(barItem(id, false));
|
||||
}
|
||||
});
|
||||
connect(m_edit_available, &QListWidget::itemDoubleClicked, this, [this](QListWidgetItem *item) {
|
||||
const QString id = item->data(Qt::UserRole).toString();
|
||||
delete item;
|
||||
m_edit_row->addItem(barItem(id, true));
|
||||
});
|
||||
|
||||
//Elements to pin: the same ranked search as the picker, dragged
|
||||
//onto the bar. Copied, not moved, so a result can be pinned and
|
||||
//still be seen in the list.
|
||||
m_edit_symbols_box = new QWidget(m_editor);
|
||||
auto *symbols_layout = new QVBoxLayout(m_edit_symbols_box);
|
||||
symbols_layout->setContentsMargins(0, 0, 0, 0);
|
||||
m_edit_symbols_search = new QLineEdit(m_edit_symbols_box);
|
||||
m_edit_symbols_search->setPlaceholderText(tr("Rechercher un élément…"));
|
||||
m_edit_symbols_search->setClearButtonEnabled(true);
|
||||
m_edit_symbols = new QListWidget(m_edit_symbols_box);
|
||||
m_edit_symbols->setIconSize(QSize(32, 32));
|
||||
m_edit_symbols->setMinimumHeight(220);
|
||||
m_edit_symbols->setDragDropMode(QAbstractItemView::DragOnly);
|
||||
m_edit_symbols->setDefaultDropAction(Qt::CopyAction);
|
||||
m_edit_symbols->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
symbols_layout->addWidget(new QLabel(tr("Éléments :"), m_edit_symbols_box));
|
||||
symbols_layout->addWidget(m_edit_symbols_search);
|
||||
symbols_layout->addWidget(m_edit_symbols);
|
||||
|
||||
auto *symbols_timer = new QTimer(this);
|
||||
symbols_timer->setSingleShot(true);
|
||||
symbols_timer->setInterval(300);
|
||||
connect(m_edit_symbols_search, &QLineEdit::textChanged, this,
|
||||
[symbols_timer]() { symbols_timer->start(); });
|
||||
connect(symbols_timer, &QTimer::timeout, this, &ElementPickerPopup::runSymbolSearch);
|
||||
connect(m_edit_symbols, &QListWidget::itemDoubleClicked, this, [this](QListWidgetItem *item) {
|
||||
m_edit_row->addItem(barItem(item->data(Qt::UserRole).toString(), true));
|
||||
});
|
||||
auto *defaults = new QPushButton(tr("Valeurs par défaut"), m_editor);
|
||||
auto *cancel = new QPushButton(tr("Annuler"), m_editor);
|
||||
auto *done = new QPushButton(tr("Terminé"), m_editor);
|
||||
done->setDefault(true);
|
||||
connect(defaults, &QPushButton::clicked, this, [this]() {
|
||||
fillCustomising(ShortcutBarSettings::defaultIds(m_context));
|
||||
});
|
||||
connect(cancel, &QPushButton::clicked, this, [this]() { finishCustomising(false); });
|
||||
connect(done, &QPushButton::clicked, this, [this]() { finishCustomising(true); });
|
||||
auto *editor_buttons = new QHBoxLayout();
|
||||
editor_buttons->addWidget(defaults);
|
||||
editor_buttons->addStretch();
|
||||
editor_buttons->addWidget(cancel);
|
||||
editor_buttons->addWidget(done);
|
||||
editor_layout->addWidget(help);
|
||||
editor_layout->addWidget(new QLabel(tr("Dans la barre :"), m_editor));
|
||||
editor_layout->addWidget(m_edit_row);
|
||||
auto *lists = new QHBoxLayout();
|
||||
auto *commands_column = new QVBoxLayout();
|
||||
commands_column->addWidget(new QLabel(tr("Autres commandes :"), m_editor));
|
||||
commands_column->addWidget(m_edit_available);
|
||||
lists->addLayout(commands_column);
|
||||
lists->addWidget(m_edit_symbols_box);
|
||||
editor_layout->addLayout(lists);
|
||||
editor_layout->addLayout(editor_buttons);
|
||||
m_editor->hide();
|
||||
|
||||
m_search = new QLineEdit(this);
|
||||
m_search->setPlaceholderText(tr("Rechercher un élément…"));
|
||||
m_search->setClearButtonEnabled(true);
|
||||
|
||||
m_model = new QStandardItemModel(this);
|
||||
m_view = new QListView(this);
|
||||
m_view->setModel(m_model);
|
||||
m_view->setIconSize(QSize(40, 40));
|
||||
m_view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_view->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
m_view->setMinimumHeight(260);
|
||||
|
||||
m_hint = new QLabel(tr("Entrée pour insérer · Échap pour fermer"), this);
|
||||
m_hint->setEnabled(false);
|
||||
//Wrapped rather than cut off when the bar is made narrow
|
||||
m_hint->setWordWrap(true);
|
||||
|
||||
//The bar's width is the user's: dragging the grip wraps the tiles
|
||||
//onto more rows, and the width is kept for next time
|
||||
m_grip = new QSizeGrip(this);
|
||||
m_grip->setToolTip(tr("Glisser pour changer la largeur de la barre"));
|
||||
m_grip->installEventFilter(this);
|
||||
auto *hint_row = new QHBoxLayout();
|
||||
hint_row->addWidget(m_hint, 1);
|
||||
hint_row->addWidget(m_grip, 0, Qt::AlignBottom | Qt::AlignRight);
|
||||
|
||||
layout->addWidget(m_commands);
|
||||
layout->addWidget(m_search);
|
||||
layout->addWidget(m_view);
|
||||
layout->addLayout(hint_row);
|
||||
layout->addWidget(m_editor);
|
||||
|
||||
//Search as you type, after a short idle: shorter than the dock's
|
||||
//500 ms, since the popup is opened and closed in a few seconds, but
|
||||
//the collection is large enough that every keystroke would show.
|
||||
auto *timer = new QTimer(this);
|
||||
timer->setSingleShot(true);
|
||||
timer->setInterval(300);
|
||||
connect(m_search, &QLineEdit::textChanged, this,
|
||||
[timer]() { timer->start(); });
|
||||
connect(timer, &QTimer::timeout, this, &ElementPickerPopup::runSearch);
|
||||
|
||||
connect(m_view, &QListView::doubleClicked, this,
|
||||
[this](const QModelIndex &) { chooseCurrent(); });
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::popUpAt
|
||||
Show the picker at @a global_pos, kept on screen, with the search field
|
||||
focused and any previous query cleared.
|
||||
@param global_pos
|
||||
*/
|
||||
void ElementPickerPopup::popUpAt(const QPoint &global_pos)
|
||||
{
|
||||
m_bar_mode = false;
|
||||
setCommands({});
|
||||
show(global_pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::popUpShortcutBar
|
||||
Show the picker at @a global_pos with the shortcut bar's commands for
|
||||
@a context above it.
|
||||
@param global_pos
|
||||
@param context
|
||||
*/
|
||||
void ElementPickerPopup::popUpShortcutBar(const QPoint &global_pos,
|
||||
ShortcutBarSettings::Context context)
|
||||
{
|
||||
m_bar_mode = true;
|
||||
m_context = context;
|
||||
setCommands(ShortcutBarSettings::ids(context));
|
||||
show(global_pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::commandAction
|
||||
@return the action registered under @a id by the window this popup
|
||||
belongs to, or nullptr
|
||||
*/
|
||||
QAction *ElementPickerPopup::commandAction(const QString &id) const
|
||||
{
|
||||
return ShortcutManager::instance().action(id, parentWidget());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::show
|
||||
Reset the search and show at @a global_pos, kept on screen.
|
||||
*/
|
||||
void ElementPickerPopup::show(const QPoint &global_pos)
|
||||
{
|
||||
m_search->clear();
|
||||
m_model->clear();
|
||||
showPalette();
|
||||
|
||||
keepOnScreen(global_pos);
|
||||
QFrame::show();
|
||||
m_search->setFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::keepOnScreen
|
||||
Fit the popup to its contents and move it to @a global_pos, kept fully on
|
||||
the screen that point is on: opening at the cursor near a right or bottom
|
||||
edge would otherwise push it off.
|
||||
*/
|
||||
void ElementPickerPopup::keepOnScreen(const QPoint &global_pos)
|
||||
{
|
||||
adjustSize();
|
||||
//The sizes the user gave the customising window and the bar
|
||||
if (m_customising) {
|
||||
const QSize size = ShortcutBarSettings::editorSize();
|
||||
if (size.isValid()) {
|
||||
resize(size.expandedTo(minimumSizeHint()));
|
||||
}
|
||||
} else if (m_bar_mode && ShortcutBarSettings::barWidth() > 0) {
|
||||
resize(qMax(ShortcutBarSettings::barWidth(), minimumSizeHint().width()),
|
||||
height());
|
||||
}
|
||||
QPoint pos = global_pos;
|
||||
|
||||
if (QScreen *screen = QGuiApplication::screenAt(global_pos)) {
|
||||
const QRect avail = screen->availableGeometry();
|
||||
pos.setX(qBound(avail.left(),
|
||||
pos.x(), avail.right() - width()));
|
||||
pos.setY(qBound(avail.top(),
|
||||
pos.y(), avail.bottom() - height()));
|
||||
}
|
||||
|
||||
move(pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::setCommands
|
||||
Show @a ids as a row of buttons above the search field, or hide the row
|
||||
when there are none. A disabled command keeps its place, greyed out, so
|
||||
the row looks the same every time for a given selection. An id no live
|
||||
action carries, or a pinned element that no longer exists, is skipped.
|
||||
|
||||
Clicking a button closes the picker first, then triggers the action: a
|
||||
command such as "add a line" starts a mode on the folio, which needs the
|
||||
focus the popup holds. A pinned element is placed, as if chosen from the
|
||||
picker.
|
||||
@param ids : command ids and pinned elements' collection paths
|
||||
*/
|
||||
void ElementPickerPopup::setCommands(const QStringList &ids)
|
||||
{
|
||||
while (QLayoutItem *item = m_commands_layout->takeAt(0)) {
|
||||
delete item->widget();
|
||||
delete item;
|
||||
}
|
||||
qDeleteAll(m_tiles);
|
||||
m_tiles.clear();
|
||||
m_tile_rows = new QVBoxLayout();
|
||||
m_tile_rows->setSpacing(2);
|
||||
m_commands_layout->addLayout(m_tile_rows);
|
||||
|
||||
for (const QString &id : ids)
|
||||
{
|
||||
if (ShortcutBarSettings::isElement(id))
|
||||
{
|
||||
const ElementsLocation location(id);
|
||||
if (!location.exist()) {
|
||||
continue;
|
||||
}
|
||||
auto *button = new QToolButton(m_commands);
|
||||
button->setAutoRaise(true);
|
||||
button->setIconSize(QSize(24, 24));
|
||||
button->setIcon(location.icon());
|
||||
button->setToolTip(location.name());
|
||||
button->setFocusPolicy(Qt::NoFocus);
|
||||
connect(button, &QToolButton::clicked, this, [this, location]() {
|
||||
hide();
|
||||
emit elementChosen(location);
|
||||
});
|
||||
m_tiles << button;
|
||||
continue;
|
||||
}
|
||||
|
||||
QAction *action = commandAction(id);
|
||||
if (!action) {
|
||||
continue;
|
||||
}
|
||||
auto *button = new QToolButton(m_commands);
|
||||
button->setAutoRaise(true);
|
||||
button->setIconSize(QSize(24, 24));
|
||||
const QString text = action->text().remove(QLatin1Char('&'));
|
||||
if (action->icon().isNull()) {
|
||||
button->setText(text);
|
||||
button->setToolButtonStyle(Qt::ToolButtonTextOnly);
|
||||
} else {
|
||||
button->setIcon(action->icon());
|
||||
}
|
||||
const QKeySequence key = action->shortcut();
|
||||
button->setToolTip(key.isEmpty()
|
||||
? text
|
||||
: QStringLiteral("%1 (%2)").arg(
|
||||
text, key.toString(QKeySequence::NativeText)));
|
||||
button->setEnabled(action->isEnabled());
|
||||
button->setFocusPolicy(Qt::NoFocus);
|
||||
connect(button, &QToolButton::clicked, this, [this, action]() {
|
||||
hide();
|
||||
action->trigger();
|
||||
});
|
||||
m_tiles << button;
|
||||
}
|
||||
m_commands_layout->addStretch();
|
||||
if (m_bar_mode)
|
||||
{
|
||||
auto *customise = new QToolButton(m_commands);
|
||||
customise->setAutoRaise(true);
|
||||
customise->setText(QStringLiteral("…"));
|
||||
customise->setToolTip(tr("Personnaliser la barre…"));
|
||||
customise->setFocusPolicy(Qt::NoFocus);
|
||||
connect(customise, &QToolButton::clicked, this, &ElementPickerPopup::startCustomising);
|
||||
m_commands_layout->addWidget(customise, 0, Qt::AlignTop);
|
||||
}
|
||||
layoutTiles(ShortcutBarSettings::barWidth());
|
||||
m_grip->setVisible(m_bar_mode);
|
||||
//An empty bar still shows, so it can be customised back
|
||||
m_commands->setVisible(m_bar_mode || !ids.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::layoutTiles
|
||||
Put the bar's tiles in rows no wider than the bar at @a bar_width, in
|
||||
their order, as many per row as fit. A @a bar_width of 0 or less, the
|
||||
width the user never set, keeps them on one row.
|
||||
*/
|
||||
void ElementPickerPopup::layoutTiles(int bar_width)
|
||||
{
|
||||
if (!m_tile_rows) {
|
||||
return;
|
||||
}
|
||||
//Emptying a row layout leaves its buttons alone; they go into the
|
||||
//new rows below
|
||||
while (QLayoutItem *item = m_tile_rows->takeAt(0)) {
|
||||
delete item->layout();
|
||||
}
|
||||
|
||||
//Room left beside the tiles: the popup's margins and the "…" button
|
||||
const int limit = bar_width > 0
|
||||
? bar_width - 12 - 30
|
||||
: std::numeric_limits<int>::max();
|
||||
QHBoxLayout *row = nullptr;
|
||||
int used = 0;
|
||||
for (QToolButton *tile : std::as_const(m_tiles))
|
||||
{
|
||||
const int w = tile->sizeHint().width() + m_tile_rows->spacing();
|
||||
if (!row || (used + w > limit && used > 0)) {
|
||||
row = new QHBoxLayout();
|
||||
row->setSpacing(2);
|
||||
row->addStretch();
|
||||
m_tile_rows->addLayout(row);
|
||||
used = 0;
|
||||
}
|
||||
//Before the stretch, which stays last so the row is left-aligned
|
||||
row->insertWidget(row->count() - 1, tile);
|
||||
used += w;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::eventFilter
|
||||
Drive the size grip by hand. QSizeGrip asks the window manager to do the
|
||||
resize, and a popup is a window the window manager does not manage, so
|
||||
on X11 nothing would happen. Only the width follows the mouse: the tiles
|
||||
re-flow into rows as it changes, the height follows the rows, and the
|
||||
width is saved when the grip is let go.
|
||||
*/
|
||||
bool ElementPickerPopup::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched != m_grip) {
|
||||
return QFrame::eventFilter(watched, event);
|
||||
}
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::MouseButtonPress: {
|
||||
auto *me = static_cast<QMouseEvent *>(event);
|
||||
if (me->button() != Qt::LeftButton) {
|
||||
break;
|
||||
}
|
||||
m_grip_active = true;
|
||||
m_grip_press_x = me->globalPosition().toPoint().x();
|
||||
m_grip_press_width = width();
|
||||
return true;
|
||||
}
|
||||
case QEvent::MouseMove: {
|
||||
if (!m_grip_active) {
|
||||
break;
|
||||
}
|
||||
auto *me = static_cast<QMouseEvent *>(event);
|
||||
const int w = qMax(minimumWidth(), m_grip_press_width
|
||||
+ me->globalPosition().toPoint().x() - m_grip_press_x);
|
||||
layoutTiles(w);
|
||||
layout()->activate();
|
||||
resize(w, sizeHint().height());
|
||||
return true;
|
||||
}
|
||||
case QEvent::MouseButtonRelease:
|
||||
if (!m_grip_active) {
|
||||
break;
|
||||
}
|
||||
m_grip_active = false;
|
||||
ShortcutBarSettings::setBarWidth(width());
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QFrame::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::barItem
|
||||
@return a list item for @a id, a command or a pinned element: icon only,
|
||||
for the bar row, or icon and text, for the other lists. The id is in
|
||||
UserRole.
|
||||
*/
|
||||
QListWidgetItem *ElementPickerPopup::barItem(const QString &id, bool icon_only) const
|
||||
{
|
||||
QString text = id;
|
||||
QIcon icon;
|
||||
if (ShortcutBarSettings::isElement(id)) {
|
||||
const ElementsLocation location(id);
|
||||
if (location.exist()) {
|
||||
text = location.name();
|
||||
icon = location.icon();
|
||||
}
|
||||
} else if (QAction *action = commandAction(id)) {
|
||||
text = action->text().remove(QLatin1Char('&'));
|
||||
icon = action->icon();
|
||||
}
|
||||
auto *item = new QListWidgetItem();
|
||||
item->setData(Qt::UserRole, id);
|
||||
item->setToolTip(text);
|
||||
if (!icon.isNull()) {
|
||||
item->setIcon(icon);
|
||||
}
|
||||
if (!icon_only || item->icon().isNull()) {
|
||||
item->setText(text);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::startCustomising
|
||||
Turn the bar into a small window holding the two lists. A Qt::Popup
|
||||
closes as soon as the mouse is pressed outside it and keeps the mouse
|
||||
grab during a drag, so the window is re-shown as a tool window for the
|
||||
time of the edit.
|
||||
*/
|
||||
void ElementPickerPopup::startCustomising()
|
||||
{
|
||||
const QPoint where = pos();
|
||||
m_customising = true;
|
||||
hide();
|
||||
setWindowFlags(Qt::Tool);
|
||||
setWindowTitle(tr("Personnaliser la barre de raccourcis : %1")
|
||||
.arg(ShortcutBarSettings::title(m_context)));
|
||||
|
||||
fillCustomising(ShortcutBarSettings::ids(m_context));
|
||||
m_commands->hide();
|
||||
setPickerVisible(false);
|
||||
m_grip->hide();
|
||||
//Elements are pinned to the empty-folio bar only: with something
|
||||
//selected, the bar is for acting on it, not for adding more
|
||||
m_edit_symbols_search->clear();
|
||||
m_edit_symbols->clear();
|
||||
m_edit_symbols_box->setVisible(m_context == ShortcutBarSettings::Canvas);
|
||||
m_editor->show();
|
||||
|
||||
keepOnScreen(where);
|
||||
QFrame::show();
|
||||
activateWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::fillCustomising
|
||||
Put @a ids on the bar row, and every other available command in the
|
||||
list below it.
|
||||
*/
|
||||
void ElementPickerPopup::fillCustomising(const QStringList &ids)
|
||||
{
|
||||
m_edit_row->clear();
|
||||
m_edit_available->clear();
|
||||
for (const QString &id : ids) {
|
||||
m_edit_row->addItem(barItem(id, true));
|
||||
}
|
||||
for (const QString &id : ShortcutBarSettings::availableIds()) {
|
||||
if (!ids.contains(id)) {
|
||||
m_edit_available->addItem(barItem(id, false));
|
||||
}
|
||||
}
|
||||
m_edit_available->sortItems();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::runSymbolSearch
|
||||
Fill the customising window's element list with the ranked hits for its
|
||||
search field. Elements embedded in a project are left out: their path
|
||||
names the project as it is loaded now, so it would not find them again
|
||||
in a later session.
|
||||
*/
|
||||
void ElementPickerPopup::runSymbolSearch()
|
||||
{
|
||||
m_edit_symbols->clear();
|
||||
if (!m_source) {
|
||||
return;
|
||||
}
|
||||
const QVector<ElementSearchHit> hits =
|
||||
m_source->rankedSearch(m_edit_symbols_search->text());
|
||||
for (const ElementSearchHit &hit : hits)
|
||||
{
|
||||
if (ElementsLocation(hit.path).isProject()) {
|
||||
continue;
|
||||
}
|
||||
auto *item = new QListWidgetItem(hit.icon, hit.name);
|
||||
item->setData(Qt::UserRole, hit.path);
|
||||
item->setToolTip(QStringLiteral("%1\n%2").arg(hit.name, hit.folder));
|
||||
m_edit_symbols->addItem(item);
|
||||
if (m_edit_symbols->count() >= max_palette_entries) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::finishCustomising
|
||||
Leave the edit, saving the bar row when @a save, and show the bar again
|
||||
at the cursor so the result can be seen and used straight away. The
|
||||
window's size is kept either way.
|
||||
*/
|
||||
void ElementPickerPopup::finishCustomising(bool save)
|
||||
{
|
||||
if (save)
|
||||
{
|
||||
QStringList ids;
|
||||
for (int i = 0 ; i < m_edit_row->count() ; ++i) {
|
||||
ids << m_edit_row->item(i)->data(Qt::UserRole).toString();
|
||||
}
|
||||
ShortcutBarSettings::setIds(m_context, ids);
|
||||
}
|
||||
|
||||
ShortcutBarSettings::setEditorSize(size());
|
||||
m_customising = false;
|
||||
hide();
|
||||
m_editor->hide();
|
||||
setPickerVisible(true);
|
||||
setWindowFlags(Qt::Popup);
|
||||
setWindowTitle(QString());
|
||||
//At the cursor, like any other opening of the bar
|
||||
popUpShortcutBar(QCursor::pos(), m_context);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::closeEvent
|
||||
Closing the customising window from its title bar cancels the edit,
|
||||
like the Annuler button, rather than leaving the bar half-edited.
|
||||
*/
|
||||
void ElementPickerPopup::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (m_customising) {
|
||||
event->ignore();
|
||||
finishCustomising(false);
|
||||
return;
|
||||
}
|
||||
QFrame::closeEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::setPickerVisible
|
||||
Show or hide the search field, the results and the hint line.
|
||||
*/
|
||||
void ElementPickerPopup::setPickerVisible(bool visible)
|
||||
{
|
||||
m_search->setVisible(visible);
|
||||
m_view->setVisible(visible);
|
||||
m_hint->setVisible(visible);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::runSearch
|
||||
*/
|
||||
void ElementPickerPopup::runSearch()
|
||||
{
|
||||
m_model->clear();
|
||||
if (!m_source) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_search->text().isEmpty()) {
|
||||
const bool was_hidden = m_view->isHidden();
|
||||
showPalette();
|
||||
if (was_hidden != m_view->isHidden()) {
|
||||
keepOnScreen(pos());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_view->isHidden()) {
|
||||
m_view->show();
|
||||
keepOnScreen(pos());
|
||||
}
|
||||
m_palette_mode = false;
|
||||
m_view->setViewMode(QListView::ListMode);
|
||||
m_view->setGridSize(QSize());
|
||||
m_view->setIconSize(QSize(40, 40));
|
||||
|
||||
const QVector<ElementSearchHit> hits = m_source->rankedSearch(m_search->text());
|
||||
for (const ElementSearchHit &hit : hits)
|
||||
{
|
||||
auto *item = new QStandardItem(hit.name);
|
||||
item->setIcon(hit.icon);
|
||||
item->setEditable(false);
|
||||
item->setToolTip(hit.folder);
|
||||
item->setData(hit.path, Qt::UserRole + 2);
|
||||
m_model->appendRow(item);
|
||||
}
|
||||
|
||||
//Preselect the best hit so Enter works straight from the search field
|
||||
//without arrowing down first -- that is the whole point of the popup.
|
||||
if (m_model->rowCount()) {
|
||||
m_view->setCurrentIndex(m_model->index(0, 0));
|
||||
}
|
||||
m_hint->setText(hits.isEmpty()
|
||||
? tr("Aucun résultat")
|
||||
: tr("Entrée pour insérer · Échap pour fermer"));
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::chooseCurrent
|
||||
Emit the highlighted element and close.
|
||||
*/
|
||||
void ElementPickerPopup::chooseCurrent()
|
||||
{
|
||||
const QModelIndex index = m_view->currentIndex();
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
const QString path = index.data(Qt::UserRole + 2).toString();
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ElementsLocation location(path);
|
||||
if (!location.exist()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Close before emitting: placement mode wants the focus, and a popup
|
||||
//still up would keep the grab.
|
||||
hide();
|
||||
emit elementChosen(location);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::keyPressEvent
|
||||
Drive the list from the search field, so the hands never leave the
|
||||
keyboard: Up/Down move the selection, Enter places, Esc closes.
|
||||
@param event
|
||||
*/
|
||||
void ElementPickerPopup::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Escape:
|
||||
if (m_customising) {
|
||||
finishCustomising(false);
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
return;
|
||||
case Qt::Key_Return:
|
||||
case Qt::Key_Enter:
|
||||
if (m_customising && m_edit_symbols_search->hasFocus()) {
|
||||
//Enter in the element search pins the best hit rather
|
||||
//than closing the window. Searched now, not on the
|
||||
//timer, so a quick Enter after typing gets this text.
|
||||
runSymbolSearch();
|
||||
if (QListWidgetItem *item = m_edit_symbols->item(0)) {
|
||||
m_edit_row->addItem(barItem(item->data(Qt::UserRole).toString(), true));
|
||||
}
|
||||
} else if (m_customising) {
|
||||
finishCustomising(true);
|
||||
} else {
|
||||
chooseCurrent();
|
||||
}
|
||||
return;
|
||||
case Qt::Key_Down:
|
||||
case Qt::Key_Up:
|
||||
case Qt::Key_PageDown:
|
||||
case Qt::Key_PageUp:
|
||||
if (!m_customising && m_model->rowCount()) {
|
||||
//Forwarded rather than focus-switched, so typing carries
|
||||
//on going to the search field.
|
||||
QCoreApplication::sendEvent(m_view, event);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QFrame::keyPressEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::showPalette
|
||||
With an empty search field, show the quick palette as an icon grid.
|
||||
|
||||
The palette is a folder, not a config file. QET already has a user-owned,
|
||||
drag-populated, icon-rendering collection -- so a palette is just a
|
||||
directory whose subfolders are categories and whose contents are entries.
|
||||
That gives set-up (drag into the folder), ordering (the 01_/02_ filename
|
||||
convention the shipped collection already uses), team sharing
|
||||
(companyElementsDir) and version control for free, with no schema, parser,
|
||||
merge rules or "reset to defaults" to build or maintain.
|
||||
|
||||
Only the path lives in QSettings, defaulting to the user's custom
|
||||
collection.
|
||||
*/
|
||||
void ElementPickerPopup::showPalette()
|
||||
{
|
||||
m_palette_mode = true;
|
||||
m_model->clear();
|
||||
|
||||
//Elements pinned to the bar replace the folder grid: the bar already
|
||||
//shows the user's shortlist, and a second one below it is noise.
|
||||
//The search still works; the list comes back as soon as one types.
|
||||
if (m_bar_mode && ShortcutBarSettings::hasElements(m_context)) {
|
||||
m_view->hide();
|
||||
m_hint->setText(tr("Tapez pour rechercher un élément · Échap pour fermer"));
|
||||
return;
|
||||
}
|
||||
m_view->show();
|
||||
|
||||
m_view->setViewMode(QListView::IconMode);
|
||||
m_view->setIconSize(QSize(48, 48));
|
||||
m_view->setGridSize(QSize(92, 84));
|
||||
m_view->setResizeMode(QListView::Adjust);
|
||||
m_view->setWordWrap(true);
|
||||
m_view->setMovement(QListView::Static);
|
||||
|
||||
QSettings settings;
|
||||
const QString path = settings.value(
|
||||
QStringLiteral("elementscollection/palette-path"),
|
||||
QETApp::customElementsDir()).toString();
|
||||
|
||||
const int count = loadPaletteDir(path, QString(), 0);
|
||||
|
||||
if (!count) {
|
||||
m_hint->setText(
|
||||
tr("Palette vide — glissez des éléments dans votre collection "
|
||||
"personnelle, ou tapez pour rechercher"));
|
||||
} else {
|
||||
m_hint->setText(tr("Entrée pour insérer · Échap pour fermer"));
|
||||
m_view->setCurrentIndex(m_model->index(0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementPickerPopup::loadPaletteDir
|
||||
Add every .elmt under @a dir_path to the grid, recursing into subfolders.
|
||||
@param dir_path
|
||||
@param prefix : folder path so far, shown as the entry's tooltip
|
||||
@param depth : recursion guard -- a palette is a shortlist, and the whole
|
||||
shipped collection would not be usable as a grid anyway
|
||||
@return how many entries were added
|
||||
*/
|
||||
int ElementPickerPopup::loadPaletteDir(const QString &dir_path,
|
||||
const QString &prefix, int depth)
|
||||
{
|
||||
if (depth > 3 || m_model->rowCount() >= max_palette_entries) {
|
||||
return 0;
|
||||
}
|
||||
QDir dir(dir_path);
|
||||
if (!dir.exists()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int added = 0;
|
||||
//Sorted by name, which is what makes the 01_/02_ filename convention
|
||||
//work as the ordering mechanism.
|
||||
const QFileInfoList entries = dir.entryInfoList(
|
||||
QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
|
||||
|
||||
for (const QFileInfo &info : entries)
|
||||
{
|
||||
if (m_model->rowCount() >= max_palette_entries) {
|
||||
break;
|
||||
}
|
||||
if (info.isDir()) {
|
||||
added += loadPaletteDir(info.absoluteFilePath(),
|
||||
prefix.isEmpty()
|
||||
? info.fileName()
|
||||
: prefix + QStringLiteral(" / ")
|
||||
+ info.fileName(),
|
||||
depth + 1);
|
||||
continue;
|
||||
}
|
||||
if (info.suffix().compare(QStringLiteral("elmt"),
|
||||
Qt::CaseInsensitive) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ElementsLocation location(info.absoluteFilePath());
|
||||
if (!location.exist()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto *item = new QStandardItem(location.name().isEmpty()
|
||||
? info.completeBaseName()
|
||||
: location.name());
|
||||
item->setIcon(location.icon());
|
||||
item->setEditable(false);
|
||||
item->setToolTip(prefix.isEmpty() ? info.completeBaseName() : prefix);
|
||||
item->setData(info.absoluteFilePath(), Qt::UserRole + 2);
|
||||
item->setTextAlignment(Qt::AlignHCenter | Qt::AlignTop);
|
||||
m_model->appendRow(item);
|
||||
++added;
|
||||
}
|
||||
return added;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 ELEMENTPICKERPOPUP_H
|
||||
#define ELEMENTPICKERPOPUP_H
|
||||
|
||||
#include "elementslocation.h"
|
||||
#include "../shortcutbarsettings.h"
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
class ElementsCollectionWidget;
|
||||
class QLineEdit;
|
||||
class QListView;
|
||||
class QStandardItemModel;
|
||||
class QLabel;
|
||||
class QAction;
|
||||
class QHBoxLayout;
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
class QSizeGrip;
|
||||
class QToolButton;
|
||||
class QVBoxLayout;
|
||||
|
||||
/**
|
||||
@brief A cursor-anchored element picker.
|
||||
|
||||
Opens where the mouse is, focused on its search field: type to filter,
|
||||
Enter to place, Esc to close. It is a recall tool, as opposed to the
|
||||
Collections dock, which is a browsing tool.
|
||||
|
||||
It deliberately does not build its own ElementsCollectionModel. Loading the
|
||||
collection is already the slow part of startup and a second copy would
|
||||
double it, so the picker asks the dock's widget to run the query -- see
|
||||
ElementsCollectionWidget::rankedSearch(). That also means the two always
|
||||
agree on results and ranking.
|
||||
*/
|
||||
class ElementPickerPopup : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElementPickerPopup(ElementsCollectionWidget *source,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
void popUpAt(const QPoint &global_pos);
|
||||
void popUpShortcutBar(const QPoint &global_pos,
|
||||
ShortcutBarSettings::Context context);
|
||||
|
||||
signals:
|
||||
/// Emitted when the user picks an element; the popup has closed
|
||||
void elementChosen(const ElementsLocation &location);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
void runSearch();
|
||||
void chooseCurrent();
|
||||
void showPalette();
|
||||
void show(const QPoint &global_pos);
|
||||
void setCommands(const QStringList &ids);
|
||||
void layoutTiles(int bar_width);
|
||||
QAction *commandAction(const QString &id) const;
|
||||
QListWidgetItem *barItem(const QString &id, bool icon_only) const;
|
||||
void startCustomising();
|
||||
void fillCustomising(const QStringList &ids);
|
||||
void finishCustomising(bool save);
|
||||
void runSymbolSearch();
|
||||
void setPickerVisible(bool visible);
|
||||
void keepOnScreen(const QPoint &global_pos);
|
||||
int loadPaletteDir(const QString &dir_path, const QString &prefix,
|
||||
int depth);
|
||||
|
||||
ElementsCollectionWidget *m_source = nullptr;
|
||||
QLineEdit *m_search = nullptr;
|
||||
QListView *m_view = nullptr;
|
||||
QStandardItemModel *m_model = nullptr;
|
||||
QLabel *m_hint = nullptr;
|
||||
QWidget *m_commands = nullptr;
|
||||
QHBoxLayout *m_commands_layout = nullptr;
|
||||
/// The bar's tiles, commands and elements, in order
|
||||
QList<QToolButton *> m_tiles;
|
||||
QVBoxLayout *m_tile_rows = nullptr;
|
||||
QSizeGrip *m_grip = nullptr;
|
||||
/// The size grip is being dragged, from this x at this width
|
||||
bool m_grip_active = false;
|
||||
int m_grip_press_x = 0;
|
||||
int m_grip_press_width = 0;
|
||||
/// Opened as the shortcut bar, as opposed to the plain picker
|
||||
bool m_bar_mode = false;
|
||||
ShortcutBarSettings::Context m_context = ShortcutBarSettings::Canvas;
|
||||
/// Customising the bar in place
|
||||
bool m_customising = false;
|
||||
QWidget *m_editor = nullptr;
|
||||
QListWidget *m_edit_row = nullptr;
|
||||
QListWidget *m_edit_available = nullptr;
|
||||
/// Element search, for pinning elements to the bar
|
||||
QWidget *m_edit_symbols_box = nullptr;
|
||||
QLineEdit *m_edit_symbols_search = nullptr;
|
||||
QListWidget *m_edit_symbols = nullptr;
|
||||
bool m_palette_mode = true;
|
||||
};
|
||||
|
||||
#endif // ELEMENTPICKERPOPUP_H
|
||||
@@ -49,6 +49,14 @@ ElementsCollectionModel::ElementsCollectionModel(QObject *parent) :
|
||||
*/
|
||||
ElementsCollectionModel::~ElementsCollectionModel()
|
||||
{
|
||||
// Without cancel(), the wait below runs the whole queued
|
||||
// QtConcurrent::map() to completion, so closing this dialog on a
|
||||
// large collection blocks until every remaining item has been
|
||||
// processed -- a visible hang on the button pressed precisely to
|
||||
// stop the work. cancel() drops the not-yet-started items so the
|
||||
// wait that follows (still needed, so an in-flight item can't
|
||||
// dereference this object after it's gone) is short.
|
||||
m_future.cancel();
|
||||
m_future.waitForFinished();
|
||||
}
|
||||
|
||||
@@ -431,7 +439,7 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location)
|
||||
collection_name);
|
||||
}
|
||||
}
|
||||
// ANPASSUNG: Makros und Custom Collection werden hier behandelt!
|
||||
// Macros and Custom Collection are handled here
|
||||
else if (location.isCustomCollection() || location.isMacrosCollection()) {
|
||||
QList <ElementCollectionItem *> child_list;
|
||||
|
||||
@@ -495,6 +503,10 @@ void ElementsCollectionModel::addProject(QETProject *project, bool set_data)
|
||||
connect(project->embeddedElementCollection(),
|
||||
&XmlElementCollection::directoryRemoved,
|
||||
this, &ElementsCollectionModel::itemRemovedFromCollection);
|
||||
connect(project, &QETProject::projectTitleChanged,
|
||||
this, &ElementsCollectionModel::projectNameChanged);
|
||||
connect(project, &QETProject::projectFilePathChanged,
|
||||
this, &ElementsCollectionModel::projectNameChanged);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -526,6 +538,10 @@ void ElementsCollectionModel::removeProject(QETProject *project)
|
||||
&XmlElementCollection::directoryRemoved,
|
||||
this,
|
||||
&ElementsCollectionModel::itemRemovedFromCollection);
|
||||
disconnect(project, &QETProject::projectTitleChanged,
|
||||
this, &ElementsCollectionModel::projectNameChanged);
|
||||
disconnect(project, &QETProject::projectFilePathChanged,
|
||||
this, &ElementsCollectionModel::projectNameChanged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -647,7 +663,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(
|
||||
if (eci->type() == FileElementCollectionItem::Type) {
|
||||
if (FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci)) {
|
||||
|
||||
// ANPASSUNG: Makro-Prüfung hinzugefügt, damit das Modell den Pfad im Baum findet!
|
||||
// Macro check added so the model finds the path in the tree
|
||||
if ( (location.isCommonCollection() && feci->isCommonCollection()) ||
|
||||
(location.isCompanyCollection() && feci->isCompanyCollection()) ||
|
||||
(location.isMacrosCollection() && feci->isMacrosCollection()) ||
|
||||
@@ -766,3 +782,15 @@ void ElementsCollectionModel::updateItem(const QString& path)
|
||||
eci->setUpData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionModel::projectNameChanged
|
||||
Update the displayed name of the collection of project,
|
||||
when its title or its file path changed.
|
||||
@param project
|
||||
*/
|
||||
void ElementsCollectionModel::projectNameChanged(QETProject *project)
|
||||
{
|
||||
if (XmlProjectElementCollectionItem *xpeci = m_project_hash.value(project))
|
||||
xpeci->updateProjectName();
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ class ElementsCollectionModel : public QStandardItemModel
|
||||
void elementIntegratedToCollection (const QString& path);
|
||||
void itemRemovedFromCollection (const QString& path);
|
||||
void updateItem (const QString& path);
|
||||
void projectNameChanged (QETProject *project);
|
||||
|
||||
private:
|
||||
QList <QETProject *> m_project_list;
|
||||
|
||||
@@ -35,6 +35,12 @@
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDesktopServices>
|
||||
#include <QSettings>
|
||||
#include <QShortcut>
|
||||
#include <QListView>
|
||||
#include <QStandardItemModel>
|
||||
#include <QSet>
|
||||
#include <algorithm>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFileDialog>
|
||||
@@ -49,6 +55,32 @@
|
||||
#include <QStatusBar>
|
||||
#include <QLineEdit>
|
||||
|
||||
namespace {
|
||||
/**
|
||||
@brief The SearchResultsView class
|
||||
The flat list of search results. Rows are not backed by the collection
|
||||
model, so the drag is built here from the path each row carries, with
|
||||
the same content and pixmap as a drag from the tree.
|
||||
*/
|
||||
class SearchResultsView : public QListView
|
||||
{
|
||||
public:
|
||||
using QListView::QListView;
|
||||
|
||||
protected:
|
||||
void startDrag(Qt::DropActions supportedActions) override
|
||||
{
|
||||
const QString path =
|
||||
currentIndex().data(Qt::UserRole + 2).toString();
|
||||
if (path.isEmpty()) {
|
||||
QListView::startDrag(supportedActions);
|
||||
return;
|
||||
}
|
||||
ElementsTreeView::execElementDrag(this, ElementsLocation(path));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::ElementsCollectionWidget
|
||||
Default constructor.
|
||||
@@ -217,8 +249,26 @@ void ElementsCollectionWidget::setUpWidget()
|
||||
m_tab_widget->addTab(m_tree_view, tr("Collections"));
|
||||
m_tab_widget->addTab(m_macros_tree_view, tr("Modèles"));
|
||||
|
||||
//Flat ranked search results.
|
||||
//The tree search hides non-matching rows, so hits stay scattered
|
||||
//through five levels of expanded folders -- searching "diode" leaves
|
||||
//you scrolling a tree to find them. This shows the same matches as a
|
||||
//ranked list instead, and takes the tab widget's place while a search
|
||||
//is active.
|
||||
m_search_model = new QStandardItemModel(this);
|
||||
m_search_results = new SearchResultsView(this);
|
||||
m_search_results->setModel(m_search_model);
|
||||
m_search_results->setDragDropMode(QAbstractItemView::DragOnly);
|
||||
m_search_results->setIconSize(QSize(50, 50));
|
||||
m_search_results->setUniformItemSizes(false);
|
||||
m_search_results->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_search_results->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_search_results->setMouseTracking(true);
|
||||
m_search_results->hide();
|
||||
|
||||
m_main_vlayout->addWidget(m_search_field);
|
||||
m_main_vlayout->addWidget(m_tab_widget);
|
||||
m_main_vlayout->addWidget(m_search_results);
|
||||
|
||||
m_progress_bar = new QProgressBar(this);
|
||||
m_progress_bar->setFormat(QObject::tr("chargement %p% (%v sur %m)"));
|
||||
@@ -266,15 +316,7 @@ void ElementsCollectionWidget::setUpConnection()
|
||||
this, &ElementsCollectionWidget::dirProperties);
|
||||
|
||||
connect(m_tree_view, &QTreeView::doubleClicked,
|
||||
[this](const QModelIndex &index)
|
||||
{
|
||||
this->m_index_at_context_menu = index ;
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(index);
|
||||
if (eci && eci->collectionPath().endsWith(".qetmak")) {
|
||||
return; // Do nothing on double click for macros
|
||||
}
|
||||
this->editElement();
|
||||
});
|
||||
[this](const QModelIndex &index) { this->activateIndex(index); });
|
||||
|
||||
connect(m_tree_view, &QTreeView::entered,
|
||||
[this] (const QModelIndex &index) {
|
||||
@@ -284,19 +326,58 @@ void ElementsCollectionWidget::setUpConnection()
|
||||
qde->statusBar()->showMessage(eci->localName());
|
||||
});
|
||||
|
||||
//Enter on the highlighted item does the same as a double click, so a
|
||||
//run of elements can be placed without leaving the keyboard. Bound as
|
||||
//a shortcut on the view rather than by reimplementing keyPressEvent,
|
||||
//which would mean subclassing ElementsTreeView for one key.
|
||||
for (const auto key : {Qt::Key_Return, Qt::Key_Enter}) {
|
||||
auto *sc = new QShortcut(QKeySequence(key), m_tree_view);
|
||||
sc->setContext(Qt::WidgetShortcut);
|
||||
connect(sc, &QShortcut::activated, this, [this]() {
|
||||
this->activateIndex(m_tree_view->currentIndex());
|
||||
});
|
||||
}
|
||||
|
||||
//The flat results list carries the collection path directly, so it
|
||||
//does not go through activateIndex() -- there is no tree index behind
|
||||
//a row to look an ElementCollectionItem up from.
|
||||
auto place_from_results = [this](const QModelIndex &index) {
|
||||
const QString path = index.data(Qt::UserRole + 2).toString();
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ElementsLocation location(path);
|
||||
if (location.exist()) {
|
||||
emit insertElementRequested(location);
|
||||
}
|
||||
};
|
||||
connect(m_search_results, &QListView::doubleClicked, this, place_from_results);
|
||||
for (const auto key : {Qt::Key_Return, Qt::Key_Enter}) {
|
||||
auto *sc = new QShortcut(QKeySequence(key), m_search_results);
|
||||
sc->setContext(Qt::WidgetShortcut);
|
||||
connect(sc, &QShortcut::activated, this, [this, place_from_results]() {
|
||||
place_from_results(m_search_results->currentIndex());
|
||||
});
|
||||
}
|
||||
//Down from the search field moves into the results, so the whole
|
||||
//type-then-place run happens without touching the mouse.
|
||||
auto *to_results = new QShortcut(QKeySequence(Qt::Key_Down), m_search_field);
|
||||
to_results->setContext(Qt::WidgetShortcut);
|
||||
connect(to_results, &QShortcut::activated, this, [this]() {
|
||||
if (!m_search_results->isVisible() || !m_search_model->rowCount()) {
|
||||
return;
|
||||
}
|
||||
m_search_results->setFocus();
|
||||
if (!m_search_results->currentIndex().isValid()) {
|
||||
m_search_results->setCurrentIndex(m_search_model->index(0, 0));
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_macros_tree_view, &QTreeView::customContextMenuRequested,
|
||||
this, &ElementsCollectionWidget::customContextMenu);
|
||||
|
||||
connect(m_macros_tree_view, &QTreeView::doubleClicked,
|
||||
[this](const QModelIndex &index)
|
||||
{
|
||||
this->m_index_at_context_menu = index ;
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(index);
|
||||
if (eci && eci->collectionPath().endsWith(".qetmak")) {
|
||||
return; // Do nothing on double click for macros
|
||||
}
|
||||
this->editElement();
|
||||
});
|
||||
[this](const QModelIndex &index) { this->activateIndex(index); });
|
||||
|
||||
connect(m_macros_tree_view, &QTreeView::entered,
|
||||
[this] (const QModelIndex &index) {
|
||||
@@ -405,6 +486,60 @@ void ElementsCollectionWidget::openDir()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::activateIndex
|
||||
What a double click (or Enter) on @a index does.
|
||||
|
||||
Historically this opened the element editor, which is the slowest action
|
||||
available on a symbol you are most likely about to place. Placing is now
|
||||
the default and editing has moved to the context menu, where it already
|
||||
was. The old behaviour is preserved behind a preference for anyone who
|
||||
relies on it.
|
||||
@param index
|
||||
*/
|
||||
void ElementsCollectionWidget::activateIndex(const QModelIndex &index)
|
||||
{
|
||||
m_index_at_context_menu = index;
|
||||
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(index);
|
||||
if (!eci) {
|
||||
return;
|
||||
}
|
||||
//Macros are placed, never edited, and were already skipped here.
|
||||
const bool is_macro = eci->collectionPath().endsWith(".qetmak");
|
||||
|
||||
QSettings settings;
|
||||
const bool insert = settings.value(
|
||||
QStringLiteral("elementscollection/double-click-inserts"), true).toBool();
|
||||
|
||||
if (insert) {
|
||||
insertCurrentElement();
|
||||
return;
|
||||
}
|
||||
if (!is_macro) {
|
||||
editElement();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::insertCurrentElement
|
||||
Ask for the current item to be placed on the folio.
|
||||
*/
|
||||
void ElementsCollectionWidget::insertCurrentElement()
|
||||
{
|
||||
ElementCollectionItem *eci =
|
||||
elementCollectionItemForIndex(m_index_at_context_menu);
|
||||
if (!(eci && eci->isElement())) {
|
||||
return;
|
||||
}
|
||||
|
||||
ElementsLocation location(eci->collectionPath());
|
||||
if (!location.exist()) {
|
||||
return;
|
||||
}
|
||||
emit insertElementRequested(location);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::editElement
|
||||
Edit the element represented by the current selected item
|
||||
@@ -415,10 +550,19 @@ void ElementsCollectionWidget::editElement()
|
||||
|
||||
if ( !(eci && eci->isElement()) ) return;
|
||||
|
||||
// Prevent the element editor from opening for macros
|
||||
if (eci->collectionPath().endsWith(".qetmak")) return;
|
||||
editLocation(ElementsLocation(eci->collectionPath()));
|
||||
}
|
||||
|
||||
ElementsLocation location(eci->collectionPath());
|
||||
/**
|
||||
@brief ElementsCollectionWidget::editLocation
|
||||
Open the element editor on @a location. Macros have no editor and are
|
||||
ignored.
|
||||
@param location
|
||||
*/
|
||||
void ElementsCollectionWidget::editLocation(const ElementsLocation &location)
|
||||
{
|
||||
// Prevent the element editor from opening for macros
|
||||
if (!location.exist() || location.path().endsWith(".qetmak")) return;
|
||||
|
||||
QETApp *app = QETApp::instance();
|
||||
app->openElementLocations(QList<ElementsLocation>() << location);
|
||||
@@ -932,6 +1076,7 @@ void ElementsCollectionWidget::search()
|
||||
//Reset the search
|
||||
if (text.isEmpty())
|
||||
{
|
||||
clearFlatResults();
|
||||
QModelIndex current_index = m_tree_view->currentIndex();
|
||||
m_tree_view->reset();
|
||||
|
||||
@@ -958,22 +1103,154 @@ void ElementsCollectionWidget::search()
|
||||
return;
|
||||
}
|
||||
|
||||
hideCollection(true);
|
||||
const QStringList text_list = text.split("+", Qt::SkipEmptyParts);
|
||||
QModelIndexList match_index;
|
||||
for (QString txt : text_list) {
|
||||
match_index << m_model->match(m_showed_index.isValid()
|
||||
? m_model->index(0,0,m_showed_index)
|
||||
showFlatResults(rankedSearch(text, m_showed_index));
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::rankedSearch
|
||||
Run the collection search for @a text and return the element hits, best
|
||||
first. The hits carry no model index, so a list that is not backed by the
|
||||
collection model can show them too.
|
||||
@param text : search text, "+" separating terms
|
||||
@param within : restrict the search to this item's children, or the
|
||||
whole collection when invalid
|
||||
@return ranked hits, best first
|
||||
*/
|
||||
QVector<ElementSearchHit> ElementsCollectionWidget::rankedSearch(
|
||||
const QString &text,
|
||||
const QModelIndex &within)
|
||||
{
|
||||
QVector<ElementSearchHit> hits;
|
||||
if (!m_model || text.size() < 3) {
|
||||
return hits;
|
||||
}
|
||||
|
||||
const QStringList terms = text.split("+", Qt::SkipEmptyParts);
|
||||
QModelIndexList matches;
|
||||
for (const QString &term : terms) {
|
||||
matches << m_model->match(within.isValid()
|
||||
? m_model->index(0, 0, within)
|
||||
: m_model->index(0, 0),
|
||||
Qt::UserRole+1,
|
||||
QVariant(txt),
|
||||
QVariant(term),
|
||||
-1,
|
||||
Qt::MatchContains
|
||||
| Qt::MatchRecursive);
|
||||
}
|
||||
|
||||
for(QModelIndex index : match_index)
|
||||
showAndExpandItem(index);
|
||||
const QString needle = terms.value(0).toLower();
|
||||
QVector<QPair<int, ElementSearchHit>> scored;
|
||||
QSet<QString> seen;
|
||||
|
||||
for (const QModelIndex &index : std::as_const(matches))
|
||||
{
|
||||
ElementCollectionItem *eci = elementCollectionItemForIndex(index);
|
||||
if (!(eci && eci->isElement())) {
|
||||
continue;
|
||||
}
|
||||
const QString path = eci->collectionPath();
|
||||
//match() is run once per "+"-separated term, so the same element
|
||||
//can arrive several times.
|
||||
if (path.isEmpty() || seen.contains(path)) {
|
||||
continue;
|
||||
}
|
||||
seen.insert(path);
|
||||
|
||||
ElementSearchHit hit;
|
||||
hit.path = path;
|
||||
hit.name = index.data(Qt::DisplayRole).toString();
|
||||
hit.icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole));
|
||||
//Where it lives, so two similarly-named symbols are tellable apart
|
||||
QStringList parts;
|
||||
for (QModelIndex p = index.parent(); p.isValid(); p = p.parent()) {
|
||||
parts.prepend(p.data(Qt::DisplayRole).toString());
|
||||
}
|
||||
hit.folder = parts.join(QStringLiteral(" / "));
|
||||
|
||||
const QString hay = index.data(Qt::UserRole + 1).toString().toLower();
|
||||
scored.append({rankMatch(needle, hit.name, hay), hit});
|
||||
}
|
||||
|
||||
std::stable_sort(scored.begin(), scored.end(),
|
||||
[](const QPair<int, ElementSearchHit> &a,
|
||||
const QPair<int, ElementSearchHit> &b) {
|
||||
return a.first > b.first;
|
||||
});
|
||||
hits.reserve(scored.size());
|
||||
for (const auto &p : std::as_const(scored)) {
|
||||
hits.append(p.second);
|
||||
}
|
||||
return hits;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::rankMatch
|
||||
Score a hit so the list can be ordered by how well it matches.
|
||||
|
||||
The tree search treats every hit equally, which is fine when they stay in
|
||||
place but useless in a ranked list: typing "diode" should not put an
|
||||
element whose *description* mentions diodes above one actually called
|
||||
"Diode". Name beats element-info field, earlier beats later, shorter beats
|
||||
longer.
|
||||
@param needle : lower-cased search text
|
||||
@param name : the element's display name
|
||||
@param haystack : the full indexed string (name + every info field)
|
||||
@return a score, higher is better
|
||||
*/
|
||||
int ElementsCollectionWidget::rankMatch(const QString &needle,
|
||||
const QString &name,
|
||||
const QString &haystack)
|
||||
{
|
||||
const QString n = name.toLower();
|
||||
int score = 0;
|
||||
|
||||
if (n == needle) {
|
||||
score = 1000;
|
||||
} else if (n.startsWith(needle)) {
|
||||
score = 800;
|
||||
} else if (n.contains(needle)) {
|
||||
score = 600 - qMin(n.indexOf(needle), 99);
|
||||
} else if (haystack.contains(needle)) {
|
||||
//Matched only on an info field -- manufacturer, reference,
|
||||
//description. Still a real hit, just a weaker one.
|
||||
score = 300;
|
||||
}
|
||||
//Among equally-placed hits prefer the shorter name: "Diode" over
|
||||
//"Diode Zener bidirectional".
|
||||
return score - qMin(n.size(), 99);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::showFlatResults
|
||||
Replace the tree with a flat list of @a hits, in the order given.
|
||||
@param hits : from rankedSearch()
|
||||
*/
|
||||
void ElementsCollectionWidget::showFlatResults(const QVector<ElementSearchHit> &hits)
|
||||
{
|
||||
m_search_model->clear();
|
||||
|
||||
for (const ElementSearchHit &hit : hits)
|
||||
{
|
||||
auto *item = new QStandardItem(hit.icon, hit.name);
|
||||
item->setEditable(false);
|
||||
item->setToolTip(hit.folder);
|
||||
item->setData(hit.path, Qt::UserRole + 2);
|
||||
m_search_model->appendRow(item);
|
||||
}
|
||||
|
||||
m_tab_widget->hide();
|
||||
m_search_results->show();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::clearFlatResults
|
||||
Put the tree back when the search field is emptied.
|
||||
*/
|
||||
void ElementsCollectionWidget::clearFlatResults()
|
||||
{
|
||||
m_search_model->clear();
|
||||
m_search_results->hide();
|
||||
m_tab_widget->show();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,6 +43,22 @@ class ElementsTreeView;
|
||||
and all action needed to use this widget.
|
||||
This is the element collection widget used in the diagram editor.
|
||||
*/
|
||||
class QListView;
|
||||
class QStandardItemModel;
|
||||
|
||||
/**
|
||||
@brief One ranked hit from a collection search.
|
||||
Carries everything a result row needs, so a list that is not backed by
|
||||
the collection model can show it.
|
||||
*/
|
||||
struct ElementSearchHit
|
||||
{
|
||||
QString path; ///< collection path, enough to build an ElementsLocation
|
||||
QString name; ///< display name
|
||||
QString folder; ///< where it lives, for telling similar names apart
|
||||
QIcon icon;
|
||||
};
|
||||
|
||||
class ElementsCollectionWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -56,6 +72,8 @@ class ElementsCollectionWidget : public QWidget
|
||||
void removeProject (QETProject *project);
|
||||
void highlightUnusedElement();
|
||||
void setCurrentLocation(const ElementsLocation &location);
|
||||
QVector<ElementSearchHit> rankedSearch(const QString &text,
|
||||
const QModelIndex &within = QModelIndex());
|
||||
|
||||
protected:
|
||||
void leaveEvent(QEvent *event) override;
|
||||
@@ -86,9 +104,26 @@ class ElementsCollectionWidget : public QWidget
|
||||
public slots:
|
||||
void reload();
|
||||
void loadingFinished();
|
||||
void insertCurrentElement();
|
||||
void editLocation(const ElementsLocation &location);
|
||||
|
||||
signals:
|
||||
/**
|
||||
Emitted when the user asks for an element to be placed on the
|
||||
current folio. Whoever hosts this widget decides which view
|
||||
receives it -- the dock is inside a diagram editor, but the
|
||||
picker popup is not, so the widget must not reach for an
|
||||
ancestor editor itself.
|
||||
*/
|
||||
void insertElementRequested(const ElementsLocation &location);
|
||||
|
||||
private:
|
||||
void locationWasSaved(const ElementsLocation& location);
|
||||
void activateIndex(const QModelIndex &index);
|
||||
void showFlatResults(const QVector<ElementSearchHit> &hits);
|
||||
void clearFlatResults();
|
||||
static int rankMatch(const QString &needle, const QString &name,
|
||||
const QString &haystack);
|
||||
|
||||
|
||||
private:
|
||||
@@ -100,6 +135,9 @@ class ElementsCollectionWidget : public QWidget
|
||||
ElementsTreeView *m_tree_view;
|
||||
ElementsTreeView *m_macros_tree_view = nullptr;
|
||||
QTabWidget *m_tab_widget = nullptr;
|
||||
/// Flat ranked results, shown in place of the tree while searching
|
||||
QListView *m_search_results = nullptr;
|
||||
QStandardItemModel *m_search_model = nullptr;
|
||||
QVBoxLayout *m_main_vlayout;
|
||||
QMenu *m_context_menu;
|
||||
QModelIndex m_index_at_context_menu;
|
||||
|
||||
@@ -653,10 +653,17 @@ QDomElement ElementsLocation::xml() const
|
||||
if (!m_project)
|
||||
{
|
||||
QFile file (m_file_system_path);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
return QDomElement();
|
||||
|
||||
QDomDocument docu;
|
||||
if (docu.setContent(&file))
|
||||
{
|
||||
file.close();
|
||||
return docu.documentElement();
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
QString str = m_collection_path;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "../NameList/nameslist.h"
|
||||
#include "../diagramcontext.h"
|
||||
#include "pugixml/src/pugixml.hpp"
|
||||
#include "pugixml.hpp"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
|
||||
@@ -82,13 +82,27 @@ void ElementsTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
@param location : location to use for create the content of the QDrag
|
||||
*/
|
||||
void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
||||
{
|
||||
execElementDrag(this, location);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ElementsTreeView::execElementDrag
|
||||
Build and run the QDrag for @a location, from @a source.
|
||||
Static so that a view which is not an ElementsTreeView -- the flat list
|
||||
of search results -- starts exactly the same drag as the tree.
|
||||
@param source : the widget the drag starts from
|
||||
@param location : location to use for create the content of the QDrag
|
||||
*/
|
||||
void ElementsTreeView::execElementDrag(QWidget *source,
|
||||
const ElementsLocation &location)
|
||||
{
|
||||
if (! location.exist()) return;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
QDrag* drag = new QDrag(this);
|
||||
QDrag* drag = new QDrag(source);
|
||||
#else
|
||||
QScopedPointer<QDrag> drag(new QDrag(this));
|
||||
QScopedPointer<QDrag> drag(new QDrag(source));
|
||||
#endif
|
||||
|
||||
QString location_str = location.toString();
|
||||
@@ -209,7 +223,7 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
||||
&elmt_creation_state));
|
||||
if (elmt_creation_state) { return; }
|
||||
|
||||
QPixmap elmt_pixmap(QET::Palette::forPalette(temp_elmt->pixmap(), palette()));
|
||||
QPixmap elmt_pixmap(QET::Palette::forPalette(temp_elmt->pixmap(), source->palette()));
|
||||
QPoint elmt_hotspot(temp_elmt->hotspot());
|
||||
|
||||
//Adjust the size of the pixmap if he is too big
|
||||
|
||||
@@ -32,6 +32,8 @@ class ElementsTreeView : public QTreeView
|
||||
{
|
||||
public:
|
||||
ElementsTreeView(QWidget *parent = nullptr);
|
||||
static void execElementDrag(QWidget *source,
|
||||
const ElementsLocation &location);
|
||||
|
||||
protected:
|
||||
void startDrag(Qt::DropActions supportedActions) override;
|
||||
|
||||
@@ -162,7 +162,7 @@ QString FileElementCollectionItem::localName()
|
||||
else if (m_path == QETApp::customElementsDirN())
|
||||
setText(QObject::tr("Collection utilisateur"));
|
||||
else if (m_path == macrosPath)
|
||||
setText(QObject::tr("Makros"));
|
||||
setText(QObject::tr("Macros"));
|
||||
else
|
||||
setText(QObject::tr("Collection inconnue"));
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "../qetproject.h"
|
||||
#include "xmlelementcollection.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
/**
|
||||
@brief XmlProjectElementCollectionItem::XmlProjectElementCollectionItem
|
||||
Constructor
|
||||
@@ -58,10 +60,7 @@ QString XmlProjectElementCollectionItem::localName()
|
||||
return text();
|
||||
|
||||
if (isCollectionRoot()) {
|
||||
if (m_project->title().isEmpty())
|
||||
setText(QObject::tr("Projet sans titre"));
|
||||
else
|
||||
setText(m_project->title());
|
||||
updateProjectName();
|
||||
}
|
||||
else {
|
||||
ElementsLocation location (embeddedPath(), m_project);
|
||||
@@ -71,6 +70,25 @@ QString XmlProjectElementCollectionItem::localName()
|
||||
return text();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief XmlProjectElementCollectionItem::updateProjectName
|
||||
Set the displayed name of the collection root from the project :
|
||||
its title, or its file name when it has no title, like the project panel.
|
||||
Does nothing if this item is not the root of the collection.
|
||||
*/
|
||||
void XmlProjectElementCollectionItem::updateProjectName()
|
||||
{
|
||||
if (!isCollectionRoot() || !m_project)
|
||||
return;
|
||||
|
||||
if (!m_project->title().isEmpty())
|
||||
setText(m_project->title());
|
||||
else if (!m_project->filePath().isEmpty())
|
||||
setText(QFileInfo(m_project->filePath()).completeBaseName());
|
||||
else
|
||||
setText(QObject::tr("Projet sans titre"));
|
||||
}
|
||||
|
||||
/**
|
||||
@brief XmlProjectElementCollectionItem::name
|
||||
@return The collection name of this item
|
||||
|
||||
@@ -45,6 +45,7 @@ class XmlProjectElementCollectionItem : public ElementCollectionItem
|
||||
bool isCollectionRoot() const override;
|
||||
void addChildAtPath(const QString &collection_name) override;
|
||||
QETProject * project() const;
|
||||
void updateProjectName();
|
||||
|
||||
void setProject (QETProject *project,
|
||||
bool set_data = true,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
#ifndef NAMES_LIST_H
|
||||
#define NAMES_LIST_H
|
||||
#include "pugixml/src/pugixml.hpp"
|
||||
#include "pugixml.hpp"
|
||||
|
||||
#include <QtXml>
|
||||
/**
|
||||
|
||||
@@ -171,20 +171,20 @@ MoveTerminalCommand::MoveTerminalCommand(QSharedPointer<PhysicalTerminal> termin
|
||||
QString text;
|
||||
if (t_label.isEmpty()) {
|
||||
if (strip_name.isEmpty() && new_strip_name.isEmpty())
|
||||
text = QObject::tr("Déplacer une borne d'un groupe de bornes vers un groupe de bornes");
|
||||
text = QObject::tr("Déplacer une borne d'un groupe de bornes vers un autre groupe de bornes");
|
||||
else if (strip_name.isEmpty())
|
||||
text = QObject::tr("Déplacer une borne d'un groupe de bornes vers le groupe de bornes %1").arg(new_strip_name);
|
||||
else if (new_strip_name.isEmpty())
|
||||
text = QObject::tr("Déplacer une borne du groupe de bornes %1 vers un groupe de bornes").arg(strip_name);
|
||||
text = QObject::tr("Déplacer une borne du groupe de bornes %1 vers un autre groupe de bornes").arg(strip_name);
|
||||
else
|
||||
text = QObject::tr("Déplacer une borne du groupe de bornes %1 vers le groupe de bornes %2").arg(strip_name, new_strip_name);
|
||||
} else {
|
||||
if (strip_name.isEmpty() && new_strip_name.isEmpty())
|
||||
text = QObject::tr("Déplacer la borne %1 d'un groupe de bornes vers un groupe de bornes").arg(t_label);
|
||||
text = QObject::tr("Déplacer la borne %1 d'un groupe de bornes vers un autre groupe de bornes").arg(t_label);
|
||||
else if (strip_name.isEmpty())
|
||||
text = QObject::tr("Déplacer la borne %1 d'un groupe de bornes vers le groupe de bornes %2").arg(t_label, new_strip_name);
|
||||
else if (new_strip_name.isEmpty())
|
||||
text = QObject::tr("Déplacer la borne %1 du groupe de bornes %2 vers un groupe de bornes").arg(t_label, strip_name);
|
||||
text = QObject::tr("Déplacer la borne %1 du groupe de bornes %2 vers un autre groupe de bornes").arg(t_label, strip_name);
|
||||
else
|
||||
text = QObject::tr("Déplacer la borne %1 du groupe de bornes %2 vers le groupe de bornes %3").arg(t_label, strip_name, new_strip_name);
|
||||
}
|
||||
@@ -205,11 +205,11 @@ MoveTerminalCommand::MoveTerminalCommand(QVector<QSharedPointer<PhysicalTerminal
|
||||
|
||||
QString text;
|
||||
if (strip_name.isEmpty() && new_strip_name.isEmpty())
|
||||
text = QObject::tr("Déplacer %n borne(s) d'un groupe de bornes vers un groupe de bornes", "", count);
|
||||
text = QObject::tr("Déplacer %n borne(s) d'un groupe de bornes vers un autre groupe de bornes", "", count);
|
||||
else if (strip_name.isEmpty())
|
||||
text = QObject::tr("Déplacer %n borne(s) d'un groupe de bornes vers le groupe de bornes %1", "", count).arg(new_strip_name);
|
||||
else if (new_strip_name.isEmpty())
|
||||
text = QObject::tr("Déplacer %n borne(s) du groupe de bornes %1 vers un groupe de bornes", "", count).arg(strip_name);
|
||||
text = QObject::tr("Déplacer %n borne(s) du groupe de bornes %1 vers un autre groupe de bornes", "", count).arg(strip_name);
|
||||
else
|
||||
text = QObject::tr("Déplacer %n borne(s) du groupe de bornes %1 vers le groupe de bornes %2", "", count).arg(strip_name, new_strip_name);
|
||||
setText(text);
|
||||
|
||||
@@ -46,10 +46,11 @@ FreeTerminalEditor::FreeTerminalEditor(QETProject *project, QWidget *parent) :
|
||||
connect(m_project, &QObject::destroyed, this, &FreeTerminalEditor::reload);
|
||||
}
|
||||
|
||||
//Disabled the move if the table is currently edited (yellow cell)
|
||||
connect(m_model, &FreeTerminalModel::dataChanged, this, [=] {
|
||||
this->setDisabledMove();
|
||||
});
|
||||
//Disable the move button while cells are edited (yellow), re-evaluate on every change
|
||||
connect(m_model, &FreeTerminalModel::dataChanged, this, &FreeTerminalEditor::selectionChanged);
|
||||
|
||||
connect(ui->m_table_view->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||
this, &FreeTerminalEditor::selectionChanged);
|
||||
|
||||
connect(ui->m_table_view, &QAbstractItemView::doubleClicked, this, [=](const QModelIndex &index)
|
||||
{
|
||||
@@ -102,7 +103,7 @@ void FreeTerminalEditor::reload()
|
||||
QString str(strip->installation() + " " + strip->location() + " " + strip->name());
|
||||
ui->m_move_in_cb->addItem(str, strip->uuid());
|
||||
}
|
||||
setDisabledMove(false);
|
||||
selectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,10 +274,19 @@ void FreeTerminalEditor::on_m_move_pb_clicked()
|
||||
reload();
|
||||
}
|
||||
|
||||
void FreeTerminalEditor::selectionChanged()
|
||||
{
|
||||
const bool has_selection = !ui->m_table_view->selectionModel()->selectedIndexes().isEmpty();
|
||||
const bool has_pending = !m_model->modifiedModelRealTerminalData().isEmpty();
|
||||
setDisabledMove(!has_selection || has_pending);
|
||||
}
|
||||
|
||||
void FreeTerminalEditor::setDisabledMove(bool b)
|
||||
{
|
||||
ui->m_move_label->setDisabled(b);
|
||||
ui->m_move_in_cb->setDisabled(b);
|
||||
ui->m_move_pb->setDisabled(b);
|
||||
ui->m_move_pb->setToolTip(b ? tr("Appliquez ou annulez les modifications en cours avant de déplacer")
|
||||
: tr("Déplacer les bornes sélectionnées vers le bornier choisi"));
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ bool FreeTerminalModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
modified_ = true;
|
||||
modified_cell = FUNCTION_CELL;
|
||||
}
|
||||
else if (column_ == LED_CELL)
|
||||
else if (column_ == LED_CELL && mrtd.led_ != value.toBool())
|
||||
{
|
||||
mrtd.led_ = value.toBool();
|
||||
modified_ = true;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 ALIGNMENT_H
|
||||
#define ALIGNMENT_H
|
||||
|
||||
#include "textgrid.h"
|
||||
|
||||
#include <QPointF>
|
||||
|
||||
/**
|
||||
The geometry behind the align commands, kept free of any scene so it
|
||||
can be tested on its own.
|
||||
*/
|
||||
namespace Alignment
|
||||
{
|
||||
/**
|
||||
@return the movement that puts p on a grid of x_grid by y_grid,
|
||||
divided by divisor as TextGrid::snap() does, or a null point when
|
||||
p is already on it. Unlike Diagram::snapToGrid(), this never looks
|
||||
at the keyboard: a command run from a shortcut with Ctrl in it must
|
||||
not quietly round to the pixel instead.
|
||||
Less than a millionth of a pixel counts as on the grid: positions
|
||||
that went through arithmetic carry residues of that size, and
|
||||
qFuzzyIsNull() (1e-12) is too strict to absorb them.
|
||||
*/
|
||||
inline QPointF gridOffset(const QPointF &p, int x_grid, int y_grid, qreal divisor = 1)
|
||||
{
|
||||
const QPointF offset = TextGrid::snap(p, x_grid, y_grid, divisor) - p;
|
||||
auto clean = [](qreal v) { return qAbs(v) < 1e-6 ? 0.0 : v; };
|
||||
return QPointF(clean(offset.x()), clean(offset.y()));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ALIGNMENT_H
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 "renumberelementscommand.h"
|
||||
|
||||
#include "../qetproject.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
|
||||
RenumberElementsCommand::RenumberElementsCommand(
|
||||
QETProject *project,
|
||||
QVector<ElementChange> changes,
|
||||
QHash<QString, NumerotationContext> old_ctx,
|
||||
QHash<QString, NumerotationContext> new_ctx,
|
||||
const QString &text)
|
||||
: QUndoCommand(text)
|
||||
, project_(project)
|
||||
, changes_(std::move(changes))
|
||||
, old_ctx_(std::move(old_ctx))
|
||||
, new_ctx_(std::move(new_ctx))
|
||||
{
|
||||
}
|
||||
|
||||
void RenumberElementsCommand::undo()
|
||||
{
|
||||
apply(false);
|
||||
}
|
||||
|
||||
void RenumberElementsCommand::redo()
|
||||
{
|
||||
// QUndoStack calls redo() once immediately after push(); keep standard behaviour.
|
||||
if (first_redo_) {
|
||||
first_redo_ = false;
|
||||
}
|
||||
apply(true);
|
||||
}
|
||||
|
||||
void RenumberElementsCommand::apply(bool use_new)
|
||||
{
|
||||
if (!project_) return;
|
||||
|
||||
// Restore project contexts
|
||||
const auto &ctx = use_new ? new_ctx_ : old_ctx_;
|
||||
for (auto it = ctx.constBegin(); it != ctx.constEnd(); ++it) {
|
||||
project_->addElementAutoNum(it.key(), it.value());
|
||||
}
|
||||
|
||||
// Apply per-element changes
|
||||
for (const ElementChange &c : changes_) {
|
||||
if (!c.element) continue;
|
||||
|
||||
const bool frozen = use_new ? c.new_frozen : c.old_frozen;
|
||||
const auto &infos = use_new ? c.new_infos : c.old_infos;
|
||||
const auto &seq = use_new ? c.new_seq : c.old_seq;
|
||||
|
||||
// Temporarily unfreeze so that label/infos update correctly.
|
||||
const bool was_frozen = c.element->isFreezeLabel();
|
||||
if (was_frozen) c.element->freezeLabel(false);
|
||||
|
||||
c.element->rSequenceStruct() = seq;
|
||||
c.element->setElementInformations(infos);
|
||||
c.element->freezeLabel(frozen);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 RENUMBERELEMENTSCOMMAND_H
|
||||
#define RENUMBERELEMENTSCOMMAND_H
|
||||
|
||||
#include <QUndoCommand>
|
||||
#include <QHash>
|
||||
#include <QVector>
|
||||
|
||||
#include "../diagramcontext.h"
|
||||
#include "assignvariables.h" // defines autonum::sequentialNumbers
|
||||
|
||||
class Element;
|
||||
class QETProject;
|
||||
|
||||
/**
|
||||
* @brief Undoable renumbering of element labels and sequence structs.
|
||||
*/
|
||||
class RenumberElementsCommand final : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
struct ElementChange
|
||||
{
|
||||
Element *element = nullptr;
|
||||
DiagramContext old_infos;
|
||||
DiagramContext new_infos;
|
||||
autonum::sequentialNumbers old_seq;
|
||||
autonum::sequentialNumbers new_seq;
|
||||
bool old_frozen = false;
|
||||
bool new_frozen = false;
|
||||
};
|
||||
|
||||
RenumberElementsCommand(
|
||||
QETProject *project,
|
||||
QVector<ElementChange> changes,
|
||||
QHash<QString, NumerotationContext> old_ctx,
|
||||
QHash<QString, NumerotationContext> new_ctx,
|
||||
const QString &text);
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
void apply(bool use_new);
|
||||
|
||||
private:
|
||||
QETProject *project_ = nullptr;
|
||||
QVector<ElementChange> changes_;
|
||||
QHash<QString, NumerotationContext> old_ctx_;
|
||||
QHash<QString, NumerotationContext> new_ctx_;
|
||||
bool first_redo_ = true;
|
||||
};
|
||||
|
||||
#endif // RENUMBERELEMENTSCOMMAND_H
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "formulaautonumberingw.h"
|
||||
#include "numparteditorw.h"
|
||||
#include "qdebug.h"
|
||||
#include "renumberelementsdialog.h"
|
||||
#include "ui_autonumberingmanagementw.h"
|
||||
#include "ui_formulaautonumberingw.h"
|
||||
|
||||
@@ -48,6 +49,8 @@ AutoNumberingManagementW::AutoNumberingManagementW(QETProject *project,
|
||||
ui->m_selected_folios_le->setDisabled(true);
|
||||
ui->m_selected_folios_le->setReadOnly(true);
|
||||
ui->m_apply_project_rb->setChecked(true);
|
||||
// Enabled only when project is in "Under Development" status and not read-only.
|
||||
ui->m_renumber_elements_pb->setEnabled(ui->m_status_cb->currentIndex() == 0 && project_ && !project_->isReadOnly());
|
||||
setProjectContext();
|
||||
}
|
||||
|
||||
@@ -87,6 +90,7 @@ void AutoNumberingManagementW::on_m_status_cb_currentIndexChanged(int index)
|
||||
ui->m_both_conductor_rb->setChecked(true);
|
||||
ui->m_both_element_rb->setChecked(true);
|
||||
ui->m_both_folio_rb->setChecked(true);
|
||||
ui->m_renumber_elements_pb->setEnabled(true);
|
||||
}
|
||||
//Installing
|
||||
else if (index == 1) {
|
||||
@@ -96,15 +100,31 @@ void AutoNumberingManagementW::on_m_status_cb_currentIndexChanged(int index)
|
||||
ui->m_new_conductor_rb->setChecked(true);
|
||||
ui->m_new_element_rb->setChecked(true);
|
||||
ui->m_new_folio_rb->setChecked(true);
|
||||
ui->m_renumber_elements_pb->setEnabled(true);
|
||||
}
|
||||
//Built
|
||||
else if (index == 2) {
|
||||
ui->m_disable_conductor_rb->setChecked(true);
|
||||
ui->m_disable_element_rb->setChecked(true);
|
||||
ui->m_disable_folio_rb->setChecked(true);
|
||||
ui->m_renumber_elements_pb->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AutoNumberingManagementW::on_m_renumber_elements_pb_clicked()
|
||||
{
|
||||
if (!project_ || project_->isReadOnly()) return;
|
||||
// Only allowed during "Under Development"
|
||||
// if (ui->m_status_cb->currentIndex() != 1) return;
|
||||
|
||||
QStringList titles = project_->elementAutoNum().keys();
|
||||
titles.sort(Qt::CaseInsensitive);
|
||||
RenumberElementsDialog dlg(titles, this);
|
||||
if (dlg.exec() != QDialog::Accepted) return;
|
||||
|
||||
project_->renumberElementsBySchemeTitle(dlg.selectedSchemeTitle());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief AutoNumberingManagementW::on_m_apply_folios_rb_clicked
|
||||
Set From Folios Combobox
|
||||
|
||||
@@ -50,6 +50,7 @@ class AutoNumberingManagementW : public QWidget
|
||||
void on_m_from_folios_cb_currentIndexChanged(int);
|
||||
void on_m_to_folios_cb_currentIndexChanged(int);
|
||||
void on_m_status_cb_currentIndexChanged(int);
|
||||
void on_m_renumber_elements_pb_clicked();
|
||||
void on_m_apply_folios_rb_clicked();
|
||||
void on_m_apply_project_rb_clicked();
|
||||
void on_buttonBox_clicked(QAbstractButton *);
|
||||
|
||||
@@ -305,6 +305,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_renumber_elements_pb">
|
||||
<property name="text">
|
||||
<string>Renumber element(s)…</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 "renumberelementsdialog.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
RenumberElementsDialog::RenumberElementsDialog(const QStringList &scheme_titles, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_scheme_titles(scheme_titles)
|
||||
{
|
||||
setWindowTitle(tr("Renumber element(s)"));
|
||||
setModal(true);
|
||||
|
||||
auto *vl = new QVBoxLayout(this);
|
||||
|
||||
auto *scope = new QGroupBox(tr("Scope"), this);
|
||||
auto *scope_l = new QVBoxLayout(scope);
|
||||
m_all_rb = new QRadioButton(tr("All schemes"), scope);
|
||||
m_one_rb = new QRadioButton(tr("One scheme"), scope);
|
||||
scope_l->addWidget(m_all_rb);
|
||||
scope_l->addWidget(m_one_rb);
|
||||
vl->addWidget(scope);
|
||||
|
||||
auto *form = new QFormLayout();
|
||||
m_combo = new QComboBox(this);
|
||||
m_combo->addItems(m_scheme_titles);
|
||||
form->addRow(new QLabel(tr("Scheme:"), this), m_combo);
|
||||
vl->addLayout(form);
|
||||
|
||||
m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
connect(m_buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(m_buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
vl->addWidget(m_buttons);
|
||||
|
||||
m_all_rb->setChecked(true);
|
||||
updateUi();
|
||||
|
||||
connect(m_all_rb, &QRadioButton::toggled, this, &RenumberElementsDialog::updateUi);
|
||||
connect(m_one_rb, &QRadioButton::toggled, this, &RenumberElementsDialog::updateUi);
|
||||
}
|
||||
|
||||
QString RenumberElementsDialog::selectedSchemeTitle() const
|
||||
{
|
||||
if (m_all_rb && m_all_rb->isChecked()) return QString();
|
||||
return m_combo ? m_combo->currentText() : QString();
|
||||
}
|
||||
|
||||
void RenumberElementsDialog::updateUi()
|
||||
{
|
||||
const bool one = m_one_rb && m_one_rb->isChecked();
|
||||
if (m_combo) m_combo->setEnabled(one);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 RENUMBERELEMENTSDIALOG_H
|
||||
#define RENUMBERELEMENTSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QStringList>
|
||||
|
||||
class QComboBox;
|
||||
class QRadioButton;
|
||||
class QDialogButtonBox;
|
||||
|
||||
/**
|
||||
* @brief Simple dialog to pick renumbering scope for elements.
|
||||
*
|
||||
* The user can choose between:
|
||||
* - all element autonumbering schemes
|
||||
* - one selected scheme title
|
||||
*/
|
||||
class RenumberElementsDialog final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RenumberElementsDialog(const QStringList &scheme_titles, QWidget *parent = nullptr);
|
||||
|
||||
/**
|
||||
* @return Empty string if "all" is selected, otherwise the chosen scheme title.
|
||||
*/
|
||||
QString selectedSchemeTitle() const;
|
||||
|
||||
private slots:
|
||||
void updateUi();
|
||||
|
||||
private:
|
||||
QStringList m_scheme_titles;
|
||||
QRadioButton *m_all_rb = nullptr;
|
||||
QRadioButton *m_one_rb = nullptr;
|
||||
QComboBox *m_combo = nullptr;
|
||||
QDialogButtonBox *m_buttons = nullptr;
|
||||
};
|
||||
|
||||
#endif // RENUMBERELEMENTSDIALOG_H
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 BORDERCELLLABELS_H
|
||||
#define BORDERCELLLABELS_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
/// The labels the border of a folio writes on its rows and columns, shared
|
||||
/// by BorderTitleBlock::draw() and the cell rulers of DiagramView so the
|
||||
/// two cannot disagree. Header-only so it can be unit-tested directly --
|
||||
/// see tests/qttest/tst_bordercelllabels.cpp.
|
||||
namespace BorderCellLabels {
|
||||
|
||||
/// @return the label of row \a row, counted from 1: A..Z, then AA, AB...
|
||||
/// (the sequence BorderTitleBlock::incrementLetters() walks through).
|
||||
inline QString rowLabel(int row)
|
||||
{
|
||||
QString label;
|
||||
while (row > 0) {
|
||||
--row;
|
||||
label.prepend(QChar('A' + row % 26));
|
||||
row /= 26;
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
/// @return the label of column \a column, counted from 1. When
|
||||
/// \a starts_at_zero (the "border-columns_0" setting) the first column
|
||||
/// is labelled 0.
|
||||
inline QString columnLabel(int column, bool starts_at_zero)
|
||||
{
|
||||
return QString::number(starts_at_zero ? column - 1 : column);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BORDERCELLLABELS_H
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
#include "bordertitleblock.h"
|
||||
|
||||
#include "bordercelllabels.h"
|
||||
#include "createdxf.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramposition.h"
|
||||
@@ -29,6 +30,7 @@
|
||||
|
||||
#include <QLocale>
|
||||
#include <QPainter>
|
||||
#include <QRegularExpression>
|
||||
#include <utility>
|
||||
|
||||
#define MIN_COLUMN_COUNT 3
|
||||
@@ -533,6 +535,8 @@ void BorderTitleBlock::draw(QPainter *painter)
|
||||
|
||||
//Draw the nums of columns
|
||||
if (display_border_ && display_columns_) {
|
||||
const bool columns_start_at_zero =
|
||||
settings.value("border-columns_0", true).toBool();
|
||||
for (int i = 1 ; i <= columns_count_ ; ++ i) {
|
||||
QRectF numbered_rectangle = QRectF(
|
||||
diagram_rect_.topLeft().x()
|
||||
@@ -543,23 +547,15 @@ void BorderTitleBlock::draw(QPainter *painter)
|
||||
columns_header_height_
|
||||
);
|
||||
painter -> drawRect(numbered_rectangle);
|
||||
if (settings.value("border-columns_0", true).toBool()){
|
||||
painter -> drawText(numbered_rectangle,
|
||||
Qt::AlignVCenter
|
||||
| Qt::AlignCenter,
|
||||
QString("%1").arg(i - 1));
|
||||
}else{
|
||||
painter -> drawText(numbered_rectangle,
|
||||
Qt::AlignVCenter
|
||||
| Qt::AlignCenter,
|
||||
QString("%1").arg(i));
|
||||
}
|
||||
BorderCellLabels::columnLabel(i, columns_start_at_zero));
|
||||
}
|
||||
}
|
||||
|
||||
//Draw the nums of rows
|
||||
if (display_border_ && display_rows_) {
|
||||
QString row_string("A");
|
||||
for (int i = 1 ; i <= rows_count_ ; ++ i) {
|
||||
QRectF lettered_rectangle = QRectF(
|
||||
diagram_rect_.topLeft().x(),
|
||||
@@ -575,8 +571,7 @@ void BorderTitleBlock::draw(QPainter *painter)
|
||||
painter -> drawText(lettered_rectangle,
|
||||
Qt::AlignVCenter
|
||||
| Qt::AlignCenter,
|
||||
row_string);
|
||||
row_string = incrementLetters(row_string);
|
||||
BorderCellLabels::rowLabel(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,10 +891,20 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(
|
||||
// An empty page-level value means the variable was auto-added to the
|
||||
// folio's Custom tab (#495) but never actually set by the user, so it
|
||||
// must not shadow a real project-level value of the same name (#531).
|
||||
//
|
||||
// That guard has to stop short of removing the key outright, though
|
||||
// (#973). TitleBlockTemplate::interpreteVariables() only replaces a
|
||||
// "%name"/"%{name}" placeholder when "name" is a key in this context at
|
||||
// all -- an unset variable that never makes it in is left as its own
|
||||
// literal placeholder text in the rendered title block, not blank.
|
||||
// So an empty page-level value is skipped only when a real project-level
|
||||
// one is already there to show through; otherwise it still goes in
|
||||
// empty, which is what makes the placeholder resolve to nothing.
|
||||
DiagramContext context = initial_context;
|
||||
foreach (QString key, additional_fields_.keys()) {
|
||||
if (!additional_fields_[key].toString().isEmpty())
|
||||
context.addValue(key, additional_fields_[key]);
|
||||
const QVariant value = additional_fields_[key];
|
||||
if (!value.toString().isEmpty() || !context.contains(key))
|
||||
context.addValue(key, value);
|
||||
}
|
||||
|
||||
// ... overridden by the historical and/or dynamically generated fields
|
||||
@@ -925,6 +930,46 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(
|
||||
m_titleblock_template_renderer -> setContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief BorderTitleBlock::cellRect
|
||||
Convert a cell written the way the border labels it (ex : B13, the row
|
||||
letter(s) then the column number) to its rect in scene coordinate.
|
||||
This is the reverse of convertPosition().
|
||||
@param cell : the cell to convert, case and surrounding spaces ignored
|
||||
@return the rect of the cell, or a null QRectF if \a cell is not a
|
||||
cell reference or lies outside of the border.
|
||||
*/
|
||||
QRectF BorderTitleBlock::cellRect(const QString &cell) const
|
||||
{
|
||||
static const QRegularExpression cell_re(
|
||||
QStringLiteral("^\\s*([A-Za-z]+)\\s*(\\d{1,4})\\s*$"));
|
||||
const QRegularExpressionMatch match = cell_re.match(cell);
|
||||
if (!match.hasMatch())
|
||||
return QRectF();
|
||||
|
||||
//Row letters count like A..Z, AA, AB... (see incrementLetters())
|
||||
int row = 0;
|
||||
for (const QChar c : match.captured(1).toUpper()) {
|
||||
row = row * 26 + (c.unicode() - 'A' + 1);
|
||||
if (row > rows_count_)
|
||||
return QRectF();
|
||||
}
|
||||
|
||||
int column = match.captured(2).toInt();
|
||||
QSettings settings;
|
||||
if (settings.value("border-columns_0", true).toBool())
|
||||
++column;
|
||||
|
||||
if (row < 1 || column < 1 || column > columns_count_)
|
||||
return QRectF();
|
||||
|
||||
const QPointF top_left = insideBorderRect().topLeft();
|
||||
return QRectF(top_left.x() + (column - 1) * columns_width_,
|
||||
top_left.y() + (row - 1) * rows_height_,
|
||||
columns_width_,
|
||||
rows_height_);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief BorderTitleBlock::incrementLetters
|
||||
increments string with Letters A to Z
|
||||
|
||||
@@ -159,6 +159,7 @@ class BorderTitleBlock : public QObject
|
||||
void setDiagramHeight(const qreal &);
|
||||
|
||||
DiagramPosition convertPosition(const QPointF &);
|
||||
QRectF cellRect(const QString &cell) const;
|
||||
|
||||
// methods to set title block basic data
|
||||
void setFolio(const QString &folio);
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 "cellruler.h"
|
||||
|
||||
#include "bordercelllabels.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramview.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QSettings>
|
||||
|
||||
/**
|
||||
@brief CellRuler::CellRuler
|
||||
@param orientation : Qt::Horizontal for the column numbers along the
|
||||
top, Qt::Vertical for the row letters along the left
|
||||
@param view : the view this ruler is placed on
|
||||
*/
|
||||
CellRuler::CellRuler(Qt::Orientation orientation, DiagramView *view) :
|
||||
QWidget(view),
|
||||
m_orientation(orientation),
|
||||
m_view(view)
|
||||
{
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
hide();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CellRuler::thickness
|
||||
@return the height of the top ruler, which is also the width of the
|
||||
side ruler, so the corner they share is square. Constant whatever the
|
||||
zoom.
|
||||
*/
|
||||
int CellRuler::thickness() const
|
||||
{
|
||||
const QFontMetrics metrics = fontMetrics();
|
||||
return qMax(metrics.height(), metrics.horizontalAdvance(QStringLiteral("WW"))) + 6;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CellRuler::setLeadingSpace
|
||||
@param space : pixels left empty before the first pixel of the
|
||||
viewport, along this ruler
|
||||
*/
|
||||
void CellRuler::setLeadingSpace(int space)
|
||||
{
|
||||
m_leading_space = space;
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CellRuler::paintEvent
|
||||
Draw a cell for each column (or row) of the folio border, at the
|
||||
position the view shows it. When the cells get too small for their
|
||||
labels, only one label every 2, 5, 10... cells is written.
|
||||
*/
|
||||
void CellRuler::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(rect(), background());
|
||||
|
||||
const bool horizontal = m_orientation == Qt::Horizontal;
|
||||
const int length = horizontal ? width() : height();
|
||||
const int depth = horizontal ? height() : width();
|
||||
|
||||
//Separate the ruler from the drawing
|
||||
painter.setPen(palette().color(QPalette::Dark));
|
||||
if (horizontal) {
|
||||
painter.drawLine(0, depth - 1, length, depth - 1);
|
||||
} else {
|
||||
painter.drawLine(depth - 1, 0, depth - 1, length);
|
||||
}
|
||||
|
||||
Diagram *diagram = m_view->diagram();
|
||||
if (!diagram) {
|
||||
return;
|
||||
}
|
||||
const BorderTitleBlock &border = diagram->border_and_titleblock;
|
||||
const QTransform transform = m_view->viewportTransform();
|
||||
|
||||
const int count = horizontal ? border.columnsCount() : border.rowsCount();
|
||||
const qreal cell_size = horizontal ? border.columnsWidth() : border.rowsHeight();
|
||||
//Where BorderTitleBlock::draw() puts the first cell: after the
|
||||
//other header's room even when that header is hidden, which
|
||||
//insideBorderRect() does not account for
|
||||
const qreal first = Diagram::margin
|
||||
+ (horizontal ? border.rowsHeaderWidth() : border.columnsHeaderHeight());
|
||||
const qreal scale = horizontal ? transform.m11() : transform.m22();
|
||||
const qreal offset = (horizontal ? transform.dx() : transform.dy()) + m_leading_space;
|
||||
const qreal cell_pixels = cell_size * scale;
|
||||
if (count < 1 || cell_pixels <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bool columns_start_at_zero =
|
||||
QSettings().value("border-columns_0", true).toBool();
|
||||
auto label = [&](int index) {
|
||||
return horizontal ? BorderCellLabels::columnLabel(index, columns_start_at_zero)
|
||||
: BorderCellLabels::rowLabel(index);
|
||||
};
|
||||
|
||||
//Room one label needs along the ruler, and the smallest step
|
||||
//between written labels that gives it that room
|
||||
const QFontMetrics metrics = fontMetrics();
|
||||
const int label_room = horizontal
|
||||
? metrics.horizontalAdvance(label(count)) + 6
|
||||
: metrics.height() + 2;
|
||||
int step = 1;
|
||||
for (int candidate : {1, 2, 5, 10, 20, 50, 100, 200, 500}) {
|
||||
step = candidate;
|
||||
if (candidate * cell_pixels >= label_room) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1 ; i <= count ; ++i) {
|
||||
const qreal start = offset + (first + (i - 1) * cell_size) * scale;
|
||||
const qreal end = start + cell_pixels;
|
||||
if (end < m_leading_space || start > length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Cell edges, drawn only when the cells are wide enough
|
||||
//for them to read as cells rather than as a hatching
|
||||
painter.setPen(palette().color(QPalette::Dark));
|
||||
if (cell_pixels >= 4) {
|
||||
if (horizontal) {
|
||||
painter.drawLine(QPointF(start, 0), QPointF(start, depth - 1));
|
||||
if (i == count) painter.drawLine(QPointF(end, 0), QPointF(end, depth - 1));
|
||||
} else {
|
||||
painter.drawLine(QPointF(0, start), QPointF(depth - 1, start));
|
||||
if (i == count) painter.drawLine(QPointF(0, end), QPointF(depth - 1, end));
|
||||
}
|
||||
}
|
||||
|
||||
//Written labels are the ones a multiple of step: 0, 5, 10...
|
||||
//for the columns, A, F, K... for the rows
|
||||
const int position = (horizontal && !columns_start_at_zero) ? i : i - 1;
|
||||
if (position % step != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
painter.setPen(palette().color(QPalette::ButtonText));
|
||||
const qreal centre = (start + end) / 2;
|
||||
const QRectF text_rect = horizontal
|
||||
? QRectF(centre - label_room / 2.0, 0, label_room, depth - 1)
|
||||
: QRectF(0, centre - label_room / 2.0, depth - 1, label_room);
|
||||
painter.drawText(text_rect, Qt::AlignCenter | Qt::TextDontClip, label(i));
|
||||
}
|
||||
|
||||
//Keep the corner empty: the other ruler's labels do not belong there
|
||||
if (m_leading_space > 0) {
|
||||
painter.fillRect(horizontal ? QRect(0, 0, m_leading_space, depth - 1)
|
||||
: QRect(0, 0, depth - 1, m_leading_space),
|
||||
background());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CellRuler::background
|
||||
@return the button colour laid over the window colour, always opaque.
|
||||
The Windows 11 style gives buttons a translucent colour; filled with it
|
||||
as is, a ruler (painted with Qt::WA_OpaquePaintEvent, so never cleared
|
||||
first) would let every previous frame show through, and zooming would
|
||||
leave a shadow of the old labels behind the new ones.
|
||||
*/
|
||||
QColor CellRuler::background() const
|
||||
{
|
||||
const QColor window = palette().color(QPalette::Window);
|
||||
const QColor button = palette().color(QPalette::Button);
|
||||
const qreal alpha = button.alphaF();
|
||||
return QColor::fromRgbF(
|
||||
button.redF() * alpha + window.redF() * (1 - alpha),
|
||||
button.greenF() * alpha + window.greenF() * (1 - alpha),
|
||||
button.blueF() * alpha + window.blueF() * (1 - alpha));
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 CELLRULER_H
|
||||
#define CELLRULER_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class DiagramView;
|
||||
|
||||
/**
|
||||
@brief The CellRuler class
|
||||
A bar along the top or the left edge of a DiagramView that repeats the
|
||||
column numbers or the row letters of the folio border, aligned with the
|
||||
cells at any zoom, so they stay in sight however far the view is
|
||||
scrolled. It sits in the view's margins, outside of the scene: printing
|
||||
and exporting are unaffected.
|
||||
*/
|
||||
class CellRuler : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CellRuler(Qt::Orientation orientation, DiagramView *view);
|
||||
|
||||
int thickness() const;
|
||||
void setLeadingSpace(int space);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
QColor background() const;
|
||||
|
||||
Qt::Orientation m_orientation;
|
||||
DiagramView *m_view;
|
||||
/// Pixels before the viewport starts, left empty: the corner the
|
||||
/// side ruler fills when both rulers are shown.
|
||||
int m_leading_space = 0;
|
||||
};
|
||||
|
||||
#endif // CELLRULER_H
|
||||
@@ -227,6 +227,7 @@ int exportPdf(QETProject &project, const QString &output,
|
||||
// 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);
|
||||
PdfLinks::removeUnusedPdfxNamespace(output);
|
||||
|
||||
out << "Exported " << diagrams.size() << " page(s) -> " << output << "\n";
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 "commandsearchpopup.h"
|
||||
|
||||
#include "shortcutmanager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QGuiApplication>
|
||||
#include <QKeyEvent>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QScreen>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
/**
|
||||
@brief CommandSearchPopup::CommandSearchPopup
|
||||
@param owner : the window whose commands are searched; also the parent
|
||||
*/
|
||||
CommandSearchPopup::CommandSearchPopup(QWidget *owner) :
|
||||
QFrame(owner, Qt::Popup)
|
||||
{
|
||||
setFrameShape(QFrame::StyledPanel);
|
||||
setFrameShadow(QFrame::Raised);
|
||||
setMinimumWidth(380);
|
||||
|
||||
m_search = new QLineEdit(this);
|
||||
m_search->setPlaceholderText(tr("Rechercher une commande…"));
|
||||
m_search->setClearButtonEnabled(true);
|
||||
m_list = new QListWidget(this);
|
||||
m_list->setIconSize(QSize(20, 20));
|
||||
m_list->setMinimumHeight(280);
|
||||
m_list->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
auto *hint = new QLabel(tr("Entrée pour lancer · Échap pour fermer"), this);
|
||||
hint->setEnabled(false);
|
||||
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(6, 6, 6, 6);
|
||||
layout->setSpacing(4);
|
||||
layout->addWidget(m_search);
|
||||
layout->addWidget(m_list);
|
||||
layout->addWidget(hint);
|
||||
|
||||
connect(m_search, &QLineEdit::textChanged, this, &CommandSearchPopup::filter);
|
||||
connect(m_list, &QListWidget::itemClicked, this, [this]() { runCurrent(); });
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CommandSearchPopup::fold
|
||||
@return @a text lower-cased, without accents and without the "&" of
|
||||
mnemonics, for matching
|
||||
*/
|
||||
QString CommandSearchPopup::fold(const QString &text)
|
||||
{
|
||||
QString out;
|
||||
const QString decomposed = text.normalized(QString::NormalizationForm_D);
|
||||
out.reserve(decomposed.size());
|
||||
for (const QChar c : decomposed) {
|
||||
if (c.category() != QChar::Mark_NonSpacing && c != QLatin1Char('&')) {
|
||||
out.append(c.toLower());
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CommandSearchPopup::popUpAt
|
||||
Rebuild the command list -- actions come and go with windows, and their
|
||||
enabled state changes -- then show at @a global_pos, kept on screen.
|
||||
*/
|
||||
void CommandSearchPopup::popUpAt(const QPoint &global_pos)
|
||||
{
|
||||
collect();
|
||||
m_search->clear();
|
||||
filter();
|
||||
|
||||
adjustSize();
|
||||
QPoint pos = global_pos;
|
||||
if (QScreen *screen = QGuiApplication::screenAt(global_pos)) {
|
||||
const QRect avail = screen->availableGeometry();
|
||||
pos.setX(qBound(avail.left(), pos.x(), avail.right() - width()));
|
||||
pos.setY(qBound(avail.top(), pos.y(), avail.bottom() - height()));
|
||||
}
|
||||
move(pos);
|
||||
show();
|
||||
m_search->setFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CommandSearchPopup::collect
|
||||
Every command registered by the owning window, except this search.
|
||||
*/
|
||||
void CommandSearchPopup::collect()
|
||||
{
|
||||
m_commands.clear();
|
||||
for (const ShortcutManager::ShortcutInfo &info :
|
||||
ShortcutManager::instance().allShortcuts())
|
||||
{
|
||||
if (info.id == QLatin1String("diagrameditor.command_search")) {
|
||||
continue;
|
||||
}
|
||||
QAction *action = ShortcutManager::instance().action(info.id, parentWidget());
|
||||
if (!action || !action->isVisible()) {
|
||||
continue;
|
||||
}
|
||||
const QString text = action->text().remove(QLatin1Char('&'));
|
||||
if (text.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
m_commands.append({action, text, fold(text)});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CommandSearchPopup::filter
|
||||
Show the commands matching the search text, best first: a name starting
|
||||
with it, then a word starting with it, then containing it. An empty
|
||||
search lists everything, alphabetically.
|
||||
*/
|
||||
void CommandSearchPopup::filter()
|
||||
{
|
||||
const QString needle = fold(m_search->text().trimmed());
|
||||
|
||||
QList<QPair<int, const Command *>> hits;
|
||||
for (const Command &command : std::as_const(m_commands))
|
||||
{
|
||||
int score = 0;
|
||||
if (needle.isEmpty()) {
|
||||
score = 1;
|
||||
} else if (command.folded.startsWith(needle)) {
|
||||
score = 3;
|
||||
} else if (command.folded.contains(QLatin1Char(' ') + needle)) {
|
||||
score = 2;
|
||||
} else if (command.folded.contains(needle)) {
|
||||
score = 1;
|
||||
}
|
||||
if (score) {
|
||||
hits.append({score, &command});
|
||||
}
|
||||
}
|
||||
std::stable_sort(hits.begin(), hits.end(), [](const auto &a, const auto &b) {
|
||||
if (a.first != b.first) {
|
||||
return a.first > b.first;
|
||||
}
|
||||
return a.second->folded < b.second->folded;
|
||||
});
|
||||
|
||||
m_list->clear();
|
||||
for (const auto &hit : std::as_const(hits))
|
||||
{
|
||||
QAction *action = hit.second->action;
|
||||
const QKeySequence key = action->shortcut();
|
||||
auto *item = new QListWidgetItem(
|
||||
action->icon(),
|
||||
key.isEmpty() ? hit.second->text
|
||||
: QStringLiteral("%1 (%2)").arg(hit.second->text,
|
||||
key.toString(QKeySequence::NativeText)));
|
||||
item->setData(Qt::UserRole, QVariant::fromValue(static_cast<void *>(action)));
|
||||
if (!action->isEnabled()) {
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
|
||||
}
|
||||
m_list->addItem(item);
|
||||
}
|
||||
|
||||
//Preselect the first command that can run, so Enter works at once
|
||||
for (int i = 0 ; i < m_list->count() ; ++i) {
|
||||
if (m_list->item(i)->flags() & Qt::ItemIsEnabled) {
|
||||
m_list->setCurrentRow(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CommandSearchPopup::runCurrent
|
||||
Close, then trigger the highlighted command: it may open a dialog or
|
||||
start a tool on the folio, which need the focus the popup holds.
|
||||
*/
|
||||
void CommandSearchPopup::runCurrent()
|
||||
{
|
||||
QListWidgetItem *item = m_list->currentItem();
|
||||
if (!item || !(item->flags() & Qt::ItemIsEnabled)) {
|
||||
return;
|
||||
}
|
||||
auto *action = static_cast<QAction *>(item->data(Qt::UserRole).value<void *>());
|
||||
hide();
|
||||
if (action) {
|
||||
action->trigger();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CommandSearchPopup::keyPressEvent
|
||||
Up and Down move through the list while typing goes on in the search
|
||||
field; Enter runs, Esc closes.
|
||||
*/
|
||||
void CommandSearchPopup::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Escape:
|
||||
hide();
|
||||
return;
|
||||
case Qt::Key_Return:
|
||||
case Qt::Key_Enter:
|
||||
runCurrent();
|
||||
return;
|
||||
case Qt::Key_Down:
|
||||
case Qt::Key_Up:
|
||||
case Qt::Key_PageDown:
|
||||
case Qt::Key_PageUp:
|
||||
QCoreApplication::sendEvent(m_list, event);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QFrame::keyPressEvent(event);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 COMMANDSEARCHPOPUP_H
|
||||
#define COMMANDSEARCHPOPUP_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <QList>
|
||||
|
||||
class QAction;
|
||||
class QLineEdit;
|
||||
class QListWidget;
|
||||
|
||||
/**
|
||||
@brief Type part of a command's name, press Enter to run it.
|
||||
|
||||
Lists every command the owning window registered with ShortcutManager,
|
||||
best match first, with its key if it has one. Matching ignores case and
|
||||
accents, so "editer" finds "Éditer". Disabled commands are listed,
|
||||
greyed, but cannot be run.
|
||||
*/
|
||||
class CommandSearchPopup : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CommandSearchPopup(QWidget *owner);
|
||||
|
||||
void popUpAt(const QPoint &global_pos);
|
||||
static QString fold(const QString &text);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
private:
|
||||
void collect();
|
||||
void filter();
|
||||
void runCurrent();
|
||||
|
||||
struct Command {
|
||||
QAction *action;
|
||||
QString text; ///< as shown
|
||||
QString folded; ///< for matching
|
||||
};
|
||||
|
||||
QLineEdit *m_search = nullptr;
|
||||
QListWidget *m_list = nullptr;
|
||||
QList<Command> m_commands;
|
||||
};
|
||||
|
||||
#endif // COMMANDSEARCHPOPUP_H
|
||||
+16
-2
@@ -27,6 +27,20 @@ const double Createdxf::sheetWidth = 4000;
|
||||
const double Createdxf::sheetHeight = 2700;
|
||||
|
||||
double Createdxf::xScale = 1;
|
||||
|
||||
namespace {
|
||||
/// @p text on one line. A DXF value ends at the line break, so a break
|
||||
/// inside a text would shift every group code after it by one line and
|
||||
/// a reader would take values for codes (FINDINGS F052). Callers that
|
||||
/// mean several lines split them first; this is the safety net.
|
||||
QString singleLine(QString text)
|
||||
{
|
||||
text.replace(QLatin1String("\r\n"), QLatin1String(" "));
|
||||
text.replace(QLatin1Char('\r'), QLatin1Char(' '));
|
||||
text.replace(QLatin1Char('\n'), QLatin1Char(' '));
|
||||
return text;
|
||||
}
|
||||
}
|
||||
double Createdxf::yScale = 1;
|
||||
|
||||
Createdxf::Createdxf()
|
||||
@@ -727,7 +741,7 @@ void Createdxf::drawText(
|
||||
To_Dxf << 41 << "\r\n";
|
||||
To_Dxf << xScaleW << "\r\n"; // X Scale
|
||||
To_Dxf << 1 << "\r\n";
|
||||
To_Dxf << text << "\r\n"; // Text Value
|
||||
To_Dxf << singleLine(text) << "\r\n"; // Text Value
|
||||
To_Dxf << 50 << "\r\n";
|
||||
To_Dxf << rotation << "\r\n"; // Text Rotation
|
||||
file.close();
|
||||
@@ -780,7 +794,7 @@ void Createdxf::drawTextAligned(
|
||||
To_Dxf << 41 << "\r\n";
|
||||
To_Dxf << xScaleW << "\r\n"; // X Scale
|
||||
To_Dxf << 1 << "\r\n";
|
||||
To_Dxf << text << "\r\n"; // Text Value
|
||||
To_Dxf << singleLine(text) << "\r\n"; // Text Value
|
||||
To_Dxf << 50 << "\r\n";
|
||||
To_Dxf << rotation << "\r\n"; // Text Rotation
|
||||
#if 0
|
||||
|
||||
@@ -17,22 +17,30 @@
|
||||
*/
|
||||
#include "projectdatabase.h"
|
||||
|
||||
#include "sqlreadonly.h"
|
||||
|
||||
#include "../diagram.h"
|
||||
#include "../diagramposition.h"
|
||||
#include "../elementprovider.h"
|
||||
#include "../qetapp.h"
|
||||
#include "../qetgraphicsitem/conductor.h"
|
||||
#include "../qetgraphicsitem/diagramimageitem.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
#include "../qetgraphicsitem/independenttextitem.h"
|
||||
#include "../qetgraphicsitem/qetshapeitem.h"
|
||||
#include "../qetgraphicsitem/terminal.h"
|
||||
#include "../qetinformation.h"
|
||||
#include "../qetproject.h"
|
||||
|
||||
#include <QLocale>
|
||||
#include <QMetaEnum>
|
||||
#include <QTextDocument>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QSqlDriver>
|
||||
#include <QSqlError>
|
||||
|
||||
#include <QSqlDriver>
|
||||
#include <sqlite3.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -100,6 +108,7 @@ void projectDataBase::updateDB()
|
||||
//refresh, and what they read back is unchanged either way.
|
||||
if (!m_content_changed)
|
||||
{
|
||||
flushDrawingItems();
|
||||
emit dataBaseUpdated();
|
||||
return;
|
||||
}
|
||||
@@ -109,6 +118,7 @@ void projectDataBase::updateDB()
|
||||
populateElementTable();
|
||||
populateElementInfoTable();
|
||||
populateConductorTable();
|
||||
populateDrawingItemTables();
|
||||
m_content_changed = false;
|
||||
|
||||
emit dataBaseUpdated();
|
||||
@@ -201,13 +211,23 @@ bool projectDataBase::isReadOnlySelect(const QString &query, QString *error)
|
||||
@param query the SQL text to run -- must be a single read-only
|
||||
SELECT/WITH statement, see isReadOnlySelect()
|
||||
@param error set to a human-readable reason when the query was rejected
|
||||
before ever reaching the database
|
||||
@return a QSqlQuery with query as query and the internal database of
|
||||
this class as database to use, or an unexecuted, harmless QSqlQuery if
|
||||
the query was rejected
|
||||
or failed
|
||||
@return the executed query, on the internal database of this class, or
|
||||
an empty, harmless QSqlQuery if the query was rejected or failed
|
||||
*/
|
||||
QSqlQuery projectDataBase::newQuery(const QString &query, QString *error) {
|
||||
QString reason;
|
||||
|
||||
//Drawing-item rows are rewritten lazily, see drawingItemChanged().
|
||||
//Every read from outside comes through here, so this is the one
|
||||
//place the queue has to be emptied for a reader to see current rows.
|
||||
flushDrawingItems();
|
||||
|
||||
// First gate: which kind of statement is acceptable here at all. A
|
||||
// textual check is the right tool for that and the wrong tool for
|
||||
// anything else -- see isReadOnlySelect()'s own comment. It is what
|
||||
// keeps ATTACH, BEGIN and PRAGMA out, none of which SQLite itself
|
||||
// considers writes.
|
||||
if (!isReadOnlySelect(query, &reason)) {
|
||||
qWarning().noquote() << "projectDataBase::newQuery: rejected query:" << reason << "--" << query;
|
||||
if (error) {
|
||||
@@ -215,7 +235,25 @@ QSqlQuery projectDataBase::newQuery(const QString &query, QString *error) {
|
||||
}
|
||||
return QSqlQuery(m_data_base);
|
||||
}
|
||||
return QSqlQuery(query, m_data_base);
|
||||
|
||||
// Second gate, and the one that actually enforces read-only: SQLite
|
||||
// runs the statement with query_only set and refuses a write itself,
|
||||
// instead of the text being read for clues. The first gate cannot see
|
||||
// through a CTE prefix -- "WITH x AS (SELECT 1) DELETE FROM element"
|
||||
// starts with WITH, contains no semicolon, and deletes every row. That
|
||||
// matters beyond the custom-query box, because this path is reachable
|
||||
// from a file: a <graphics_table>'s saved <query> is read straight out
|
||||
// of the .qet by ProjectDBModel::fromXml() and executed by fillValue(),
|
||||
// so opening or exporting a project someone else produced would have
|
||||
// been enough.
|
||||
QSqlQuery result = QETSql::execReadOnly(m_data_base, query, &reason);
|
||||
if (!reason.isEmpty()) {
|
||||
qWarning().noquote() << "projectDataBase::newQuery: rejected query:" << reason << "--" << query;
|
||||
if (error) {
|
||||
*error = reason;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,10 +329,23 @@ void projectDataBase::addElement(Element *element)
|
||||
void projectDataBase::removeElement(Element *element)
|
||||
{
|
||||
m_content_changed = true;
|
||||
bool changed = false;
|
||||
|
||||
m_remove_element_query.bindValue(":uuid", element->uuid().toString());
|
||||
if(!m_remove_element_query.exec()) {
|
||||
qDebug() << "projectDataBase::removeElement remove error : " << m_remove_element_query.lastError();
|
||||
if (m_remove_element_query.exec()) {
|
||||
changed = true;
|
||||
} else {
|
||||
qDebug() << "projectDataBase::removeElement remove error : " << m_remove_element_query.lastError();
|
||||
}
|
||||
|
||||
m_remove_element_info_query.bindValue(":uuid", element->uuid().toString());
|
||||
if (m_remove_element_info_query.exec()) {
|
||||
changed = true;
|
||||
} else {
|
||||
qDebug() << "projectDataBase::removeElement remove element_info error : " << m_remove_element_info_query.lastError();
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
emit dataBaseUpdated();
|
||||
}
|
||||
}
|
||||
@@ -350,6 +401,13 @@ void projectDataBase::addDiagram(Diagram *diagram)
|
||||
qDebug() << "projectDataBase::addDiagram insert info error : " << m_insert_diagram_info_query.lastError();
|
||||
}
|
||||
|
||||
//A folio put back by undoing its removal comes with its items already
|
||||
//on it, and their rows went with it: queue them again.
|
||||
const QList<QGraphicsItem *> items = diagram->items();
|
||||
for (QGraphicsItem *item : items) {
|
||||
addDrawingItem(item);
|
||||
}
|
||||
|
||||
//The information "folio" of other existing diagram can have the variable %total,
|
||||
//so when a new diagram is added this variable change.
|
||||
//We need to update this information in the database.
|
||||
@@ -409,6 +467,31 @@ void projectDataBase::removeDiagram(Diagram *diagram)
|
||||
return;
|
||||
}
|
||||
|
||||
for (const QString &table : {QStringLiteral("shape"),
|
||||
QStringLiteral("independent_text"),
|
||||
QStringLiteral("image")})
|
||||
{
|
||||
QSqlQuery cascade(m_data_base);
|
||||
cascade.prepare(QStringLiteral("DELETE FROM %1 WHERE diagram_uuid = :uuid").arg(table));
|
||||
cascade.bindValue(QStringLiteral(":uuid"), uuid_str);
|
||||
if (!cascade.exec()) {
|
||||
qDebug() << "projectDataBase::removeDiagram" << table << "cascade error : "
|
||||
<< cascade.lastError();
|
||||
m_data_base.rollback();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//The folio's items keep existing (the removal can be undone), but
|
||||
//their rows are gone: forget them, so that nothing is deleted or
|
||||
//skipped later on the strength of a row that no longer exists.
|
||||
const QList<QObject *> tracked = m_drawing_item_row.keys();
|
||||
for (QObject *object : tracked) {
|
||||
auto *item = dynamic_cast<QGraphicsItem *>(object);
|
||||
if (item && item->scene() == diagram) {
|
||||
forgetDrawingItem(object);
|
||||
}
|
||||
}
|
||||
|
||||
m_remove_diagram_query.bindValue(":uuid", uuid_str);
|
||||
if (!m_remove_diagram_query.exec()) {
|
||||
qDebug() << "projectDataBase::removeDiagram delete error : " << m_remove_diagram_query.lastError();
|
||||
@@ -567,6 +650,305 @@ void projectDataBase::bindConductorValues(QSqlQuery &query, Conductor *conductor
|
||||
query.bindValue(QStringLiteral(":text"), conductor->properties().text);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
/// Table holding @p object's row, or an empty string if it has none.
|
||||
QString drawingItemTable(QObject *object)
|
||||
{
|
||||
if (qobject_cast<QetShapeItem *>(object)) return QStringLiteral("shape");
|
||||
if (qobject_cast<IndependentTextItem *>(object)) return QStringLiteral("independent_text");
|
||||
if (qobject_cast<DiagramImageItem *>(object)) return QStringLiteral("image");
|
||||
return QString();
|
||||
}
|
||||
|
||||
QUuid drawingItemUuid(QObject *object)
|
||||
{
|
||||
if (auto s = qobject_cast<QetShapeItem *>(object)) return s->uuid();
|
||||
if (auto t = qobject_cast<IndependentTextItem *>(object)) return t->uuid();
|
||||
if (auto i = qobject_cast<DiagramImageItem *>(object)) return i->uuid();
|
||||
return QUuid();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
/**
|
||||
@brief projectDataBase::addDrawingItem
|
||||
Start keeping a row for a shape, an independent text or an image that
|
||||
was just added to a folio. Anything else is ignored, so Diagram::addItem()
|
||||
can pass every item it gets.
|
||||
|
||||
The row is not written here but queued, like every later change to it:
|
||||
see drawingItemChanged() for why.
|
||||
@param item
|
||||
*/
|
||||
void projectDataBase::addDrawingItem(QGraphicsItem *item)
|
||||
{
|
||||
QGraphicsObject *object = item ? item->toGraphicsObject() : nullptr;
|
||||
if (!object || drawingItemTable(object).isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto unique = Qt::UniqueConnection;
|
||||
connect(object, &QGraphicsObject::xChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
connect(object, &QGraphicsObject::yChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
connect(object, &QGraphicsObject::rotationChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
connect(object, &QObject::destroyed, this, &projectDataBase::drawingItemDestroyed, unique);
|
||||
|
||||
if (auto shape = qobject_cast<QetShapeItem *>(object)) {
|
||||
connect(shape, &QetShapeItem::uuidChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
connect(shape, &QetShapeItem::geometryChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
connect(shape, &QetShapeItem::transformChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
connect(shape, &QetShapeItem::penChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
connect(shape, &QetShapeItem::brushChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
}
|
||||
else if (auto text = qobject_cast<IndependentTextItem *>(object)) {
|
||||
connect(text, &IndependentTextItem::uuidChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
//Sent by the document, not the item: drawingItemChanged() walks
|
||||
//back up to the item. It is the one signal that catches every way
|
||||
//the text changes -- typing, undo, a script's setTextContent().
|
||||
connect(text->document(), &QTextDocument::contentsChanged,
|
||||
this, &projectDataBase::drawingItemChanged, unique);
|
||||
}
|
||||
else if (auto image = qobject_cast<DiagramImageItem *>(object)) {
|
||||
connect(image, &DiagramImageItem::uuidChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
connect(image, &DiagramImageItem::transformChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
connect(image, &DiagramImageItem::pixmapChanged, this, &projectDataBase::drawingItemChanged, unique);
|
||||
}
|
||||
|
||||
m_dirty_drawing_items.insert(object);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::removeDrawingItem
|
||||
Drop the row of a shape, independent text or image taken off its folio.
|
||||
The item itself usually lives on in the undo stack, so it is also
|
||||
disconnected: a change to it there must not bring its row back.
|
||||
@param item
|
||||
*/
|
||||
void projectDataBase::removeDrawingItem(QGraphicsItem *item)
|
||||
{
|
||||
QGraphicsObject *object = item ? item->toGraphicsObject() : nullptr;
|
||||
if (!object || drawingItemTable(object).isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
disconnect(object, nullptr, this, nullptr);
|
||||
if (auto text = qobject_cast<IndependentTextItem *>(object)) {
|
||||
disconnect(text->document(), nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
const QUuid row = m_drawing_item_row.value(object);
|
||||
if (!row.isNull() && m_drawing_row_owner.value(row) == object)
|
||||
{
|
||||
QSqlQuery remove(m_data_base);
|
||||
remove.prepare(QStringLiteral("DELETE FROM %1 WHERE uuid = :uuid")
|
||||
.arg(drawingItemTable(object)));
|
||||
remove.bindValue(QStringLiteral(":uuid"), row.toString());
|
||||
if (!remove.exec()) {
|
||||
qDebug() << "projectDataBase::removeDrawingItem delete error : " << remove.lastError();
|
||||
}
|
||||
}
|
||||
forgetDrawingItem(object);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::drawingItemChanged
|
||||
Queue the sender's row to be rewritten.
|
||||
|
||||
Queued rather than written: a move sends xChanged/yChanged for every
|
||||
mouse step of every selected item, and nothing reads the rows between
|
||||
two steps. newQuery() and updateDB() flush the queue before anything
|
||||
does, so a reader never sees a stale row -- a queued write only costs a
|
||||
set insertion.
|
||||
*/
|
||||
void projectDataBase::drawingItemChanged()
|
||||
{
|
||||
QObject *object = sender();
|
||||
//QTextDocument::contentsChanged: the item is an ancestor of the
|
||||
//document (item -> text control -> document).
|
||||
while (object && drawingItemTable(object).isEmpty()) {
|
||||
object = object->parent();
|
||||
}
|
||||
if (object) {
|
||||
m_dirty_drawing_items.insert(object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::drawingItemDestroyed
|
||||
An item deleted while still on its folio (e.g. by the scene's own
|
||||
destructor) never went through removeDrawingItem(). Its type can no
|
||||
longer be asked -- this runs from QObject's destructor -- so its row,
|
||||
if it wrote one, is looked for in all three tables.
|
||||
@param object
|
||||
*/
|
||||
void projectDataBase::drawingItemDestroyed(QObject *object)
|
||||
{
|
||||
const QUuid row = m_drawing_item_row.value(object);
|
||||
if (!row.isNull() && m_drawing_row_owner.value(row) == object)
|
||||
{
|
||||
for (const QString &table : {QStringLiteral("shape"),
|
||||
QStringLiteral("independent_text"),
|
||||
QStringLiteral("image")})
|
||||
{
|
||||
QSqlQuery remove(m_data_base);
|
||||
remove.prepare(QStringLiteral("DELETE FROM %1 WHERE uuid = :uuid").arg(table));
|
||||
remove.bindValue(QStringLiteral(":uuid"), row.toString());
|
||||
remove.exec();
|
||||
}
|
||||
}
|
||||
forgetDrawingItem(object);
|
||||
}
|
||||
|
||||
void projectDataBase::forgetDrawingItem(QObject *object)
|
||||
{
|
||||
const QUuid row = m_drawing_item_row.take(object);
|
||||
if (!row.isNull() && m_drawing_row_owner.value(row) == object) {
|
||||
m_drawing_row_owner.remove(row);
|
||||
}
|
||||
m_dirty_drawing_items.remove(object);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::writeDrawingItem
|
||||
Write @p object's row under its current uuid.
|
||||
@return false if the row must wait: another live item still owns that
|
||||
uuid. That is a pasted copy in the moment between being added to the
|
||||
folio and PasteDiagramCommand giving it its own uuid; writing then would
|
||||
overwrite its source's row with the copy's position. The copy's
|
||||
uuidChanged() queues it again once it has one.
|
||||
*/
|
||||
bool projectDataBase::writeDrawingItem(QObject *object)
|
||||
{
|
||||
auto *item = dynamic_cast<QGraphicsItem *>(object);
|
||||
auto *diagram = item ? qobject_cast<Diagram *>(item->scene()) : nullptr;
|
||||
if (!diagram || !m_project || !m_project->diagrams().contains(diagram)) {
|
||||
//Not on a folio of this project (any more): nothing to write,
|
||||
//and nothing to wait for.
|
||||
return true;
|
||||
}
|
||||
|
||||
const QUuid uuid = drawingItemUuid(object);
|
||||
QObject *owner = m_drawing_row_owner.value(uuid);
|
||||
if (owner && owner != object) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QSqlQuery *query = nullptr;
|
||||
const QRectF rect = item->sceneBoundingRect();
|
||||
if (auto shape = qobject_cast<QetShapeItem *>(object))
|
||||
{
|
||||
query = &m_insert_shape_query;
|
||||
const QMetaEnum type = QetShapeItem::staticMetaObject.enumerator(
|
||||
QetShapeItem::staticMetaObject.indexOfEnumerator("ShapeType"));
|
||||
query->bindValue(QStringLiteral(":type"), QString::fromLatin1(type.valueToKey(shape->shapeType())));
|
||||
query->bindValue(QStringLiteral(":color"), shape->pen().color().name());
|
||||
query->bindValue(QStringLiteral(":fill"), shape->brush().style() == Qt::NoBrush
|
||||
? QStringLiteral("none")
|
||||
: shape->brush().color().name());
|
||||
}
|
||||
else if (auto text = qobject_cast<IndependentTextItem *>(object))
|
||||
{
|
||||
query = &m_insert_independent_text_query;
|
||||
query->bindValue(QStringLiteral(":text"), text->toPlainText());
|
||||
query->bindValue(QStringLiteral(":rotation"), text->rotation());
|
||||
}
|
||||
else if (auto image = qobject_cast<DiagramImageItem *>(object))
|
||||
{
|
||||
query = &m_insert_image_query;
|
||||
query->bindValue(QStringLiteral(":pixel_width"), image->pixmap().width());
|
||||
query->bindValue(QStringLiteral(":pixel_height"), image->pixmap().height());
|
||||
}
|
||||
if (!query) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//Renewed since its last write (a paste, a folio duplication): its
|
||||
//old row was its own, and describes nothing now.
|
||||
const QUuid previous = m_drawing_item_row.value(object);
|
||||
if (!previous.isNull() && previous != uuid
|
||||
&& m_drawing_row_owner.value(previous) == object)
|
||||
{
|
||||
QSqlQuery remove(m_data_base);
|
||||
remove.prepare(QStringLiteral("DELETE FROM %1 WHERE uuid = :uuid")
|
||||
.arg(drawingItemTable(object)));
|
||||
remove.bindValue(QStringLiteral(":uuid"), previous.toString());
|
||||
remove.exec();
|
||||
m_drawing_row_owner.remove(previous);
|
||||
}
|
||||
|
||||
query->bindValue(QStringLiteral(":uuid"), uuid.toString());
|
||||
query->bindValue(QStringLiteral(":diagram_uuid"), diagram->uuid().toString());
|
||||
query->bindValue(QStringLiteral(":pos"), diagram->convertPosition(rect.topLeft()).toString());
|
||||
query->bindValue(QStringLiteral(":x"), rect.x());
|
||||
query->bindValue(QStringLiteral(":y"), rect.y());
|
||||
query->bindValue(QStringLiteral(":width"), rect.width());
|
||||
query->bindValue(QStringLiteral(":height"), rect.height());
|
||||
if (!query->exec()) {
|
||||
qDebug() << "projectDataBase::writeDrawingItem error : " << query->lastError();
|
||||
return true;
|
||||
}
|
||||
|
||||
m_drawing_item_row.insert(object, uuid);
|
||||
m_drawing_row_owner.insert(uuid, object);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::flushDrawingItems
|
||||
Write every queued drawing-item row. A row that has to wait for its uuid
|
||||
(see writeDrawingItem()) stays queued.
|
||||
*/
|
||||
void projectDataBase::flushDrawingItems()
|
||||
{
|
||||
if (m_dirty_drawing_items.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QSet<QObject *> dirty = m_dirty_drawing_items;
|
||||
//One transaction for the batch, unless a caller already holds one.
|
||||
const bool own_transaction = m_data_base.transaction();
|
||||
for (QObject *object : dirty) {
|
||||
if (writeDrawingItem(object)) {
|
||||
m_dirty_drawing_items.remove(object);
|
||||
}
|
||||
}
|
||||
if (own_transaction) {
|
||||
m_data_base.commit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::populateDrawingItemTables
|
||||
Rebuild the shape, independent_text and image tables from every folio.
|
||||
*/
|
||||
void projectDataBase::populateDrawingItemTables()
|
||||
{
|
||||
QSqlQuery query_(m_data_base);
|
||||
query_.exec(QStringLiteral("DELETE FROM shape"));
|
||||
query_.exec(QStringLiteral("DELETE FROM independent_text"));
|
||||
query_.exec(QStringLiteral("DELETE FROM image"));
|
||||
m_drawing_item_row.clear();
|
||||
m_drawing_row_owner.clear();
|
||||
m_dirty_drawing_items.clear();
|
||||
|
||||
//Queued directly, not through addDrawingItem(): every one of them
|
||||
//came onto its folio through Diagram::addItem(), which connected it
|
||||
//already, and a full rebuild runs on every load.
|
||||
for (auto diagram : m_project->diagrams())
|
||||
{
|
||||
const QList<QGraphicsItem *> items = diagram->items();
|
||||
for (QGraphicsItem *item : items)
|
||||
{
|
||||
QGraphicsObject *object = item->toGraphicsObject();
|
||||
if (object && !drawingItemTable(object).isEmpty()) {
|
||||
m_dirty_drawing_items.insert(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
flushDrawingItems();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::createDataBase
|
||||
Create the data base
|
||||
@@ -696,9 +1078,37 @@ bool projectDataBase::createDataBase()
|
||||
}
|
||||
}
|
||||
|
||||
//The folio's drawing furniture: shapes, independent texts, images.
|
||||
//x, y, width and height are the item's bounding rect on the folio,
|
||||
//pos the folio cell of its top left corner, as for element.
|
||||
const QString drawing_columns(
|
||||
"uuid VARCHAR(50) PRIMARY KEY NOT NULL, "
|
||||
"diagram_uuid VARCHAR(50) NOT NULL, "
|
||||
"pos VARCHAR(6), "
|
||||
"x REAL, y REAL, width REAL, height REAL, ");
|
||||
for (const QString &table : {
|
||||
QStringLiteral("CREATE TABLE shape (") + drawing_columns +
|
||||
"type VARCHAR(20), color VARCHAR(20), fill VARCHAR(20), "
|
||||
"FOREIGN KEY (diagram_uuid) REFERENCES diagram (uuid))",
|
||||
QStringLiteral("CREATE TABLE independent_text (") + drawing_columns +
|
||||
"text TEXT, rotation REAL, "
|
||||
"FOREIGN KEY (diagram_uuid) REFERENCES diagram (uuid))",
|
||||
QStringLiteral("CREATE TABLE image (") + drawing_columns +
|
||||
"pixel_width INTEGER, pixel_height INTEGER, "
|
||||
"FOREIGN KEY (diagram_uuid) REFERENCES diagram (uuid))",
|
||||
QStringLiteral("CREATE INDEX idx_shape_diagram ON shape (diagram_uuid)"),
|
||||
QStringLiteral("CREATE INDEX idx_independent_text_diagram ON independent_text (diagram_uuid)"),
|
||||
QStringLiteral("CREATE INDEX idx_image_diagram ON image (diagram_uuid)") })
|
||||
{
|
||||
if (!query_.exec(table)) {
|
||||
qDebug() << "drawing item table query : " << query_.lastError();
|
||||
}
|
||||
}
|
||||
|
||||
createElementNomenclatureView();
|
||||
createSummaryView();
|
||||
createWiringListView();
|
||||
createDrawingItemView();
|
||||
prepareQuery();
|
||||
updateDB();
|
||||
return true;
|
||||
@@ -893,6 +1303,32 @@ void projectDataBase::createWiringListView()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::createDrawingItemView
|
||||
One row per shape, independent text and image, whichever table holds it:
|
||||
find anything by uuid without knowing its kind first. folio is the
|
||||
folio's position in the project, starting at 1; description is the
|
||||
shape type, the text, or empty for an image.
|
||||
*/
|
||||
void projectDataBase::createDrawingItemView()
|
||||
{
|
||||
QSqlQuery query(m_data_base);
|
||||
const QString create_view(
|
||||
"CREATE VIEW drawing_item_view AS "
|
||||
"SELECT i.uuid, i.kind, d.pos AS folio, i.diagram_uuid, i.pos, "
|
||||
"i.x, i.y, i.width, i.height, i.description FROM ("
|
||||
"SELECT uuid, 'shape' AS kind, diagram_uuid, pos, x, y, width, height, "
|
||||
"type AS description FROM shape "
|
||||
"UNION ALL SELECT uuid, 'text', diagram_uuid, pos, x, y, width, height, "
|
||||
"text FROM independent_text "
|
||||
"UNION ALL SELECT uuid, 'image', diagram_uuid, pos, x, y, width, height, "
|
||||
"'' FROM image"
|
||||
") AS i LEFT JOIN diagram AS d ON d.uuid = i.diagram_uuid");
|
||||
if (!query.exec(create_view)) {
|
||||
qDebug() << query.lastError();
|
||||
}
|
||||
}
|
||||
|
||||
void projectDataBase::populateDiagramTable()
|
||||
{
|
||||
QSqlQuery query_(m_data_base);
|
||||
@@ -1078,6 +1514,23 @@ void projectDataBase::prepareQuery()
|
||||
m_remove_diagram_query = QSqlQuery(m_data_base);
|
||||
m_remove_diagram_query.prepare("DELETE FROM diagram WHERE uuid=:uuid");
|
||||
|
||||
//DRAWING ITEMS. OR REPLACE: a row is rewritten in place on every
|
||||
//change, see writeDrawingItem().
|
||||
const QString drawing_columns("uuid, diagram_uuid, pos, x, y, width, height");
|
||||
const QString drawing_values(":uuid, :diagram_uuid, :pos, :x, :y, :width, :height");
|
||||
m_insert_shape_query = QSqlQuery(m_data_base);
|
||||
m_insert_shape_query.prepare("INSERT OR REPLACE INTO shape (" + drawing_columns +
|
||||
", type, color, fill) VALUES (" + drawing_values +
|
||||
", :type, :color, :fill)");
|
||||
m_insert_independent_text_query = QSqlQuery(m_data_base);
|
||||
m_insert_independent_text_query.prepare("INSERT OR REPLACE INTO independent_text (" + drawing_columns +
|
||||
", text, rotation) VALUES (" + drawing_values +
|
||||
", :text, :rotation)");
|
||||
m_insert_image_query = QSqlQuery(m_data_base);
|
||||
m_insert_image_query.prepare("INSERT OR REPLACE INTO image (" + drawing_columns +
|
||||
", pixel_width, pixel_height) VALUES (" + drawing_values +
|
||||
", :pixel_width, :pixel_height)");
|
||||
|
||||
//INSERT DIAGRAM INFO
|
||||
m_insert_diagram_info_query = QSqlQuery(m_data_base);
|
||||
QStringList bind_diag_info_values;
|
||||
@@ -1131,6 +1584,21 @@ void projectDataBase::prepareQuery()
|
||||
m_remove_element_query = QSqlQuery(m_data_base);
|
||||
m_remove_element_query.prepare(remove_element);
|
||||
|
||||
//REMOVE ELEMENT INFO
|
||||
//element_info has no ON DELETE CASCADE (foreign keys aren't
|
||||
//enforced by this connection), so removeElement() must clear it
|
||||
//explicitly. Without this, the row is orphaned under the removed
|
||||
//element's uuid, and re-adding an element with that same uuid
|
||||
//later -- undo of this same removal, or a redo replaying it --
|
||||
//hits element_info's PRIMARY KEY constraint on element_uuid: the
|
||||
//element re-add succeeds, but its element_info insert silently
|
||||
//fails and is lost. removeDiagram()'s cascade already clears this
|
||||
//table when a whole folio goes, but that does not run for a
|
||||
//single element removed on its own.
|
||||
QString remove_element_info("DELETE FROM element_info WHERE element_uuid=:uuid");
|
||||
m_remove_element_info_query = QSqlQuery(m_data_base);
|
||||
m_remove_element_info_query.prepare(remove_element_info);
|
||||
|
||||
//UPDATE ELEMENT INFO
|
||||
QString update_str("UPDATE element_info SET ");
|
||||
for (auto string : QETInformation::elementInfoKeys()) {
|
||||
@@ -1246,23 +1714,6 @@ void projectDataBase::bindDiagramInfoValues(QSqlQuery &query, Diagram *diagram)
|
||||
}
|
||||
|
||||
#ifdef QET_EXPORT_PROJECT_DB
|
||||
/**
|
||||
@brief projectDataBase::sqliteHandle
|
||||
@param db
|
||||
@return the sqlite3 handler class used internally by db
|
||||
*/
|
||||
sqlite3 *projectDataBase::sqliteHandle(QSqlDatabase *db)
|
||||
{
|
||||
sqlite3 *handle = nullptr;
|
||||
|
||||
QVariant v = db->driver()->handle();
|
||||
if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {
|
||||
handle = *static_cast<sqlite3 **>(v.data());
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::exportDb
|
||||
@@ -1298,27 +1749,20 @@ void projectDataBase::exportDb(projectDataBase *db,
|
||||
return;
|
||||
}
|
||||
|
||||
QString connection_name("export_project_db_" % db->project()->uuid().toString());
|
||||
|
||||
if (true) //Enter in a scope only to nicely use QSqlDatabase::removeDatabase just after the end of the scope
|
||||
{
|
||||
auto file_db = QSqlDatabase::addDatabase("QSQLITE", connection_name);
|
||||
file_db.setDatabaseName(path_);
|
||||
if (!file_db.open()) {
|
||||
// VACUUM INTO requires the destination not to exist. QFileDialog may ask
|
||||
// about overwriting, but it does not remove the existing file for us.
|
||||
if (QFile::exists(path_) && !QFile::remove(path_)) {
|
||||
qWarning() << "Unable to replace project database export:" << path_;
|
||||
return;
|
||||
}
|
||||
|
||||
auto memory_db_handle = sqliteHandle(&db->m_data_base);
|
||||
auto file_db_handle = sqliteHandle(&file_db);
|
||||
|
||||
auto sqlite_backup = sqlite3_backup_init(file_db_handle, "main", memory_db_handle, "main");
|
||||
if (sqlite_backup)
|
||||
{
|
||||
sqlite3_backup_step(sqlite_backup, -1);
|
||||
sqlite3_backup_finish(sqlite_backup);
|
||||
// VACUUM INTO creates a standalone copy of the current database without
|
||||
// requiring access to the SQLite driver's native connection handle.
|
||||
const auto escaped_path = path_.replace("'", "''");
|
||||
db->flushDrawingItems();
|
||||
QSqlQuery query(db->m_data_base);
|
||||
if (!query.exec("VACUUM INTO '" % escaped_path % "'")) {
|
||||
qWarning() << "Unable to export project database:" << query.lastError().text();
|
||||
}
|
||||
file_db.close();
|
||||
}
|
||||
QSqlDatabase::removeDatabase(connection_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -23,13 +23,16 @@
|
||||
#include <QSqlQuery>
|
||||
#include <QPointer>
|
||||
#include <QFileDialog>
|
||||
#include <QHash>
|
||||
#include <QSet>
|
||||
#include <QUuid>
|
||||
|
||||
class Element;
|
||||
class QETProject;
|
||||
class Diagram;
|
||||
class Conductor;
|
||||
class Terminal;
|
||||
class sqlite3;
|
||||
class QGraphicsItem;
|
||||
|
||||
/**
|
||||
@brief The projectDataBase class
|
||||
@@ -61,6 +64,26 @@ class projectDataBase : public QObject
|
||||
QETProject *project() const;
|
||||
QSqlQuery newQuery(const QString &query = QString(), QString *error = nullptr);
|
||||
static bool isReadOnlySelect(const QString &query, QString *error = nullptr);
|
||||
|
||||
/**
|
||||
The most rows any caller reads out of one query result.
|
||||
|
||||
A SELECT is not bounded by how much data the project holds:
|
||||
SQLite produces rows lazily, so a query that never stops
|
||||
producing them makes the loop that reads them never stop
|
||||
either. A recursive CTE does exactly that in one line, and
|
||||
a <graphics_table>'s <query> is stored in the .qet and run
|
||||
on load -- so the text can arrive from a file rather than
|
||||
from the person at the keyboard, and opening that file is
|
||||
the whole attack.
|
||||
|
||||
100000 is far above any real result: the largest table in
|
||||
the shipped examples is 396 rows. It is a backstop, not a
|
||||
page size -- a caller that hits it has almost certainly
|
||||
been handed something it should not run to completion, and
|
||||
says so rather than truncating quietly.
|
||||
*/
|
||||
static constexpr int MaxResultRows = 100000;
|
||||
QSqlDatabase database() const {return m_data_base;}
|
||||
int excludedConductorCount() const;
|
||||
|
||||
@@ -78,9 +101,17 @@ class projectDataBase : public QObject
|
||||
void removeConductor (Conductor *conductor);
|
||||
void updateConductor (Conductor *conductor);
|
||||
|
||||
//Shapes, independent texts and images: the folio's drawing
|
||||
//furniture. Anything else passed here is ignored.
|
||||
void addDrawingItem (QGraphicsItem *item);
|
||||
void removeDrawingItem (QGraphicsItem *item);
|
||||
|
||||
private slots:
|
||||
//Refresh the sender()'s row after Conductor::setProperties().
|
||||
void conductorPropertiesChanged();
|
||||
//Queue the sender()'s drawing-item row for rewriting.
|
||||
void drawingItemChanged();
|
||||
void drawingItemDestroyed(QObject *object);
|
||||
|
||||
public:
|
||||
|
||||
@@ -92,11 +123,16 @@ class projectDataBase : public QObject
|
||||
void createElementNomenclatureView();
|
||||
void createSummaryView();
|
||||
void createWiringListView();
|
||||
void createDrawingItemView();
|
||||
void populateDiagramTable();
|
||||
void populateElementTable();
|
||||
void populateElementInfoTable();
|
||||
void populateDiagramInfoTable();
|
||||
void populateConductorTable();
|
||||
void populateDrawingItemTables();
|
||||
bool writeDrawingItem(QObject *object);
|
||||
void flushDrawingItems();
|
||||
void forgetDrawingItem(QObject *object);
|
||||
void bindConductorValues(QSqlQuery &query, Conductor *conductor, Diagram *diagram);
|
||||
void watchConductor(Conductor *conductor);
|
||||
void insertTerminal(Terminal *terminal);
|
||||
@@ -119,6 +155,7 @@ class projectDataBase : public QObject
|
||||
QSqlQuery m_insert_elements_query,
|
||||
m_insert_element_info_query,
|
||||
m_remove_element_query,
|
||||
m_remove_element_info_query,
|
||||
m_update_element_query,
|
||||
m_insert_diagram_query,
|
||||
m_remove_diagram_query,
|
||||
@@ -133,11 +170,23 @@ class projectDataBase : public QObject
|
||||
m_cascade_remove_element_info_query,
|
||||
m_cascade_remove_terminal_query,
|
||||
m_cascade_remove_conductor_query,
|
||||
m_cascade_remove_element_query;
|
||||
m_cascade_remove_element_query,
|
||||
m_insert_shape_query,
|
||||
m_insert_independent_text_query,
|
||||
m_insert_image_query;
|
||||
|
||||
//Which uuid's row each drawing item last wrote, and which item
|
||||
//wrote each row. A pasted copy is added to the folio still
|
||||
//carrying its source's uuid and renewed only afterwards, so two
|
||||
//live items can briefly share one: the row belongs to whichever
|
||||
//wrote it, and the other waits in m_dirty_drawing_items until its
|
||||
//uuid is its own. @see writeDrawingItem().
|
||||
QHash<QObject *, QUuid> m_drawing_item_row;
|
||||
QHash<QUuid, QObject *> m_drawing_row_owner;
|
||||
QSet<QObject *> m_dirty_drawing_items;
|
||||
|
||||
#ifdef QET_EXPORT_PROJECT_DB
|
||||
public:
|
||||
static sqlite3 *sqliteHandle(QSqlDatabase *db);
|
||||
static void exportDb(projectDataBase *db,
|
||||
QWidget *parent = nullptr,
|
||||
const QString &caption = QString(),
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 "sqlreadonly.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QSqlError>
|
||||
|
||||
namespace QETSql {
|
||||
|
||||
/**
|
||||
@brief QETSql::execReadOnly
|
||||
Run @p query on @p db with SQLite's query_only pragma set, so that
|
||||
SQLite itself refuses anything that would write.
|
||||
|
||||
Why SQLite is asked rather than the text inspected: a check on the
|
||||
query's first keyword cannot see what the statement actually does.
|
||||
SQLite has allowed a CTE prefix in front of a data-modifying statement
|
||||
since 3.8.3, so
|
||||
|
||||
@code
|
||||
WITH x AS (SELECT 1) DELETE FROM element
|
||||
@endcode
|
||||
|
||||
begins with WITH, contains no semicolon, and deletes every row. With
|
||||
query_only set, SQLite fails that statement with SQLITE_READONLY when it
|
||||
tries to start writing, before any row is touched, while an ordinary
|
||||
WITH ... SELECT still runs.
|
||||
|
||||
Why a pragma rather than sqlite3_stmt_readonly(): that needs the
|
||||
driver's native sqlite3 handle passed to the libsqlite3 QElectroTech
|
||||
links. The QSQLITE plugin of the Qt online installer carries its own
|
||||
private copy of SQLite, so that handle belongs to another library and
|
||||
the call crashes (qelectrotech-source-mirror#1045). A pragma goes
|
||||
through the driver, whichever SQLite it uses.
|
||||
|
||||
A statement that succeeded here is read-only, so running the returned
|
||||
query again, as several callers do, runs a read-only statement again.
|
||||
A refused one comes back as an empty query with nothing to run again:
|
||||
query_only is only set for the duration of this call.
|
||||
|
||||
Qt's SQLite driver refuses a second statement after the first one, so
|
||||
"SELECT 1; DROP TABLE element" is refused too.
|
||||
|
||||
This is a read-only test, NOT a statement-type allowlist: query_only
|
||||
does not refuse ATTACH, BEGIN or most PRAGMAs, because none of them
|
||||
change the contents of the database. Callers that need to restrict
|
||||
which *kind* of statement is acceptable must say so separately --
|
||||
projectDataBase::newQuery() keeps isReadOnlySelect() in front of this
|
||||
for exactly that reason.
|
||||
|
||||
@param db the connection to run the query on
|
||||
@param query the raw SQL text
|
||||
@param error set to a human-readable reason when the query is refused
|
||||
@return the executed query, or an empty query on @p db if @p query was
|
||||
refused or failed
|
||||
*/
|
||||
QSqlQuery execReadOnly(const QSqlDatabase &db, const QString &query, QString *error)
|
||||
{
|
||||
if (error) {
|
||||
error->clear();
|
||||
}
|
||||
|
||||
if (!QSqlQuery(db).exec(QStringLiteral("PRAGMA query_only = ON"))) {
|
||||
if (error) {
|
||||
*error = QCoreApplication::translate("QETSql",
|
||||
"Impossible de vérifier la requête : "
|
||||
"la base de données ne peut pas être mise en lecture seule.");
|
||||
}
|
||||
return QSqlQuery(db);
|
||||
}
|
||||
|
||||
QSqlQuery result(db);
|
||||
const bool ok = result.exec(query);
|
||||
//Switching query_only off aborts a statement SQLite is still
|
||||
//stepping through -- an unsorted UNION ALL then ends after its
|
||||
//first row. So the checked run is finished first, and a statement
|
||||
//that passed is run again for the caller: SQLite refuses a write
|
||||
//at its first step, so passing that step proves it read-only.
|
||||
result.finish();
|
||||
QSqlQuery(db).exec(QStringLiteral("PRAGMA query_only = OFF"));
|
||||
|
||||
if (ok) {
|
||||
result.exec(query);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
// SQLITE_READONLY is 8; extended codes keep it in the low byte.
|
||||
if ((result.lastError().nativeErrorCode().toInt() & 0xff) == 8) {
|
||||
*error = QCoreApplication::translate("QETSql",
|
||||
"Seules les requêtes en lecture seule sont autorisées : "
|
||||
"cette requête modifierait la base de données.");
|
||||
} else {
|
||||
*error = QCoreApplication::translate("QETSql",
|
||||
"Requête SQL invalide : %1")
|
||||
.arg(result.lastError().databaseText());
|
||||
}
|
||||
}
|
||||
return QSqlQuery(db);
|
||||
}
|
||||
|
||||
} // namespace QETSql
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 SQLREADONLY_H
|
||||
#define SQLREADONLY_H
|
||||
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
#include <QString>
|
||||
|
||||
/**
|
||||
Running a piece of SQL only if it reads.
|
||||
|
||||
Deliberately its own translation unit, depending on nothing but Qt SQL:
|
||||
it is the enforcement point for every query QElectroTech runs against a
|
||||
project database, including queries that arrive from outside the
|
||||
application (a .qet file's saved report/table query), so it is worth
|
||||
being able to test it in isolation -- see
|
||||
tests/qttest/tst_sqlreadonly.cpp, which links this file and nothing
|
||||
else of QElectroTech.
|
||||
*/
|
||||
namespace QETSql {
|
||||
|
||||
QSqlQuery execReadOnly(const QSqlDatabase &db,
|
||||
const QString &query,
|
||||
QString *error = nullptr);
|
||||
}
|
||||
|
||||
#endif // SQLREADONLY_H
|
||||
+116
-30
@@ -42,7 +42,10 @@
|
||||
#include "qetinformation.h"
|
||||
#include "qetproject.h"
|
||||
#include "diagramsortkeys.h"
|
||||
#include "textgrid.h"
|
||||
#include <QTextStream>
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <cassert>
|
||||
#include <math.h>
|
||||
|
||||
@@ -99,6 +102,43 @@ namespace {
|
||||
QString b = terminalSortKey(cond->terminal2);
|
||||
return (a <= b) ? (a + QLatin1Char('>') + b) : (b + QLatin1Char('>') + a);
|
||||
}
|
||||
|
||||
/// Serialize @p items and append them to a new @p tag block of @p root,
|
||||
/// in stacking order (@p stack_rank). items() cannot be trusted for
|
||||
/// this: with NoIndex, the first removeItem() on the scene sorts Qt's
|
||||
/// item list by pointer address, so from then on items() hands them over
|
||||
/// in a per-run order (bugtracker #343). Stacking order is what reloading
|
||||
/// the file rebuilds, so the drawing is unchanged and a resave is stable.
|
||||
template <typename T>
|
||||
void appendInStackingOrder(QDomDocument &document, QDomElement &root,
|
||||
const QString &tag, const QVector<T *> &items,
|
||||
const QHash<const QGraphicsItem *, int> &stack_rank)
|
||||
{
|
||||
if (items.isEmpty())
|
||||
return;
|
||||
struct Entry { int rank; QString xml_text; QDomElement xml; };
|
||||
QVector<Entry> sorted;
|
||||
for (T *item : items) {
|
||||
Entry entry{stack_rank.value(item, INT_MAX), QString(),
|
||||
item->toXml(document)};
|
||||
// Only an item the stacking query missed needs a tiebreak.
|
||||
if (entry.rank == INT_MAX) {
|
||||
QTextStream stream(&entry.xml_text);
|
||||
entry.xml.save(stream, 0);
|
||||
}
|
||||
sorted.append(entry);
|
||||
}
|
||||
std::stable_sort(sorted.begin(), sorted.end(),
|
||||
[](const Entry &a, const Entry &b) {
|
||||
return a.rank != b.rank ? a.rank < b.rank
|
||||
: a.xml_text < b.xml_text;
|
||||
});
|
||||
|
||||
auto block = document.createElement(tag);
|
||||
for (const auto &entry : sorted)
|
||||
block.appendChild(entry.xml);
|
||||
root.appendChild(block);
|
||||
}
|
||||
}
|
||||
|
||||
int Diagram::xGrid = 10;
|
||||
@@ -1223,37 +1263,20 @@ QDomDocument Diagram::toXml(bool whole_content, bool is_copy_command) {
|
||||
dom_root.appendChild(dom_conductors);
|
||||
}
|
||||
|
||||
if (!list_texts.isEmpty()) {
|
||||
auto dom_texts = document.createElement(QStringLiteral("inputs"));
|
||||
for (auto dti : list_texts) {
|
||||
dom_texts.appendChild(dti->toXml(document));
|
||||
}
|
||||
dom_root.appendChild(dom_texts);
|
||||
}
|
||||
|
||||
if (!list_images.isEmpty()) {
|
||||
auto dom_images = document.createElement(QStringLiteral("images"));
|
||||
for (auto dii : list_images) {
|
||||
dom_images.appendChild(dii->toXml(document));
|
||||
}
|
||||
dom_root.appendChild(dom_images);
|
||||
}
|
||||
|
||||
if (!list_shapes.isEmpty()) {
|
||||
auto dom_shapes = document.createElement(QStringLiteral("shapes"));
|
||||
for (auto dii : list_shapes) {
|
||||
dom_shapes.appendChild(dii -> toXml(document));
|
||||
}
|
||||
dom_root.appendChild(dom_shapes);
|
||||
}
|
||||
|
||||
if (table_vector.size()) {
|
||||
auto tables = document.createElement(QStringLiteral("tables"));
|
||||
for (auto table : table_vector) {
|
||||
tables.appendChild(table->toXml(document));
|
||||
}
|
||||
dom_root.appendChild(tables);
|
||||
// A rect query, unlike items(), returns true stacking order (z, then
|
||||
// insertion order) even with NoIndex.
|
||||
QHash<const QGraphicsItem *, int> stack_rank;
|
||||
{
|
||||
const QList<QGraphicsItem *> stacked = items(
|
||||
QRectF(-1e9, -1e9, 2e9, 2e9), Qt::IntersectsItemBoundingRect,
|
||||
Qt::AscendingOrder);
|
||||
for (int i = 0 ; i < stacked.size() ; ++i)
|
||||
stack_rank.insert(stacked.at(i), i);
|
||||
}
|
||||
appendInStackingOrder(document, dom_root, QStringLiteral("inputs"), list_texts, stack_rank);
|
||||
appendInStackingOrder(document, dom_root, QStringLiteral("images"), list_images, stack_rank);
|
||||
appendInStackingOrder(document, dom_root, QStringLiteral("shapes"), list_shapes, stack_rank);
|
||||
appendInStackingOrder(document, dom_root, QStringLiteral("tables"), table_vector, stack_rank);
|
||||
|
||||
if (!strip_vector.isEmpty()) {
|
||||
dom_root.appendChild(TerminalStripItemXml::toXml(strip_vector, document));
|
||||
@@ -1647,6 +1670,29 @@ bool Diagram::fromXml(QDomElement &document,
|
||||
}
|
||||
}
|
||||
|
||||
//Texts, images and shapes written before they carried a uuid (or
|
||||
//carrying one already used on this folio, from a hand-edited file)
|
||||
//get one derived from the folio uuid, their kind and their order in
|
||||
//the file, so that loading the same file twice gives the same uuids.
|
||||
//A random one would be a different identity on every load, and
|
||||
//toXml() writes it out, which is what #754 was for conductors.
|
||||
//Only for a folio being loaded: a paste renews them all anyway.
|
||||
QSet<QUuid> used_uuids;
|
||||
auto settle_uuid = [&](auto *item, const QDomElement &xml,
|
||||
const QString &kind, int index) {
|
||||
const QUuid persisted(xml.attribute(QStringLiteral("uuid")));
|
||||
if (consider_informations
|
||||
&& (persisted.isNull() || used_uuids.contains(persisted))) {
|
||||
item->setUuid(QUuid::createUuidV5(
|
||||
m_uuid,
|
||||
QStringLiteral("%1\n%2\n%3")
|
||||
.arg(kind)
|
||||
.arg(index)
|
||||
.arg(persisted.toString())));
|
||||
}
|
||||
used_uuids.insert(item->uuid());
|
||||
};
|
||||
|
||||
// Load text
|
||||
QList<IndependentTextItem *> added_texts;
|
||||
for (auto text_xml : QET::findInDomElement(root,
|
||||
@@ -1654,6 +1700,7 @@ bool Diagram::fromXml(QDomElement &document,
|
||||
QStringLiteral("input"))) {
|
||||
IndependentTextItem *iti = new IndependentTextItem();
|
||||
iti -> fromXml(text_xml);
|
||||
settle_uuid(iti, text_xml, QStringLiteral("input"), added_texts.size());
|
||||
addItem(iti);
|
||||
added_texts << iti;
|
||||
}
|
||||
@@ -1665,6 +1712,7 @@ bool Diagram::fromXml(QDomElement &document,
|
||||
QStringLiteral("image"))) {
|
||||
DiagramImageItem *dii = new DiagramImageItem ();
|
||||
dii -> fromXml(image_xml);
|
||||
settle_uuid(dii, image_xml, QStringLiteral("image"), added_images.size());
|
||||
addItem(dii);
|
||||
added_images << dii;
|
||||
}
|
||||
@@ -1676,6 +1724,7 @@ bool Diagram::fromXml(QDomElement &document,
|
||||
QStringLiteral("shape"))) {
|
||||
QetShapeItem *dii = new QetShapeItem (QPointF(0,0));
|
||||
dii -> fromXml(shape_xml);
|
||||
settle_uuid(dii, shape_xml, QStringLiteral("shape"), added_shapes.size());
|
||||
addItem(dii);
|
||||
added_shapes << dii;
|
||||
}
|
||||
@@ -1869,6 +1918,13 @@ void Diagram::addItem(QGraphicsItem *item)
|
||||
m_project->dataBase()->addConductor(conductor);
|
||||
break;
|
||||
}
|
||||
case QetShapeItem::Type:
|
||||
case IndependentTextItem::Type:
|
||||
case DiagramImageItem::Type:
|
||||
{
|
||||
m_project->dataBase()->addDrawingItem(item);
|
||||
break;
|
||||
}
|
||||
default: {break;}
|
||||
}
|
||||
}
|
||||
@@ -1900,6 +1956,13 @@ void Diagram::removeItem(QGraphicsItem *item)
|
||||
m_project->dataBase()->removeConductor(conductor);
|
||||
break;
|
||||
}
|
||||
case QetShapeItem::Type:
|
||||
case IndependentTextItem::Type:
|
||||
case DiagramImageItem::Type:
|
||||
{
|
||||
m_project->dataBase()->removeDrawingItem(item);
|
||||
break;
|
||||
}
|
||||
default: {break;}
|
||||
}
|
||||
|
||||
@@ -2662,6 +2725,29 @@ QPointF Diagram::snapToGrid(const QPointF &p)
|
||||
return (QPointF(p_x, p_y));
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Diagram::snapToTextGrid
|
||||
Return the nearest point of p on the text grid, see TextGrid.
|
||||
Ctrl held rounds to the nearest pixel instead, as snapToGrid() does.
|
||||
@param p point to find the nearest snapped point
|
||||
@return
|
||||
*/
|
||||
QPointF Diagram::snapToTextGrid(const QPointF &p)
|
||||
{
|
||||
QSettings settings;
|
||||
const qreal divisor =
|
||||
QApplication::keyboardModifiers().testFlag(Qt::ControlModifier)
|
||||
? 0
|
||||
: settings.value(TextGrid::settings_key, 1).toReal();
|
||||
|
||||
return TextGrid::snap(p,
|
||||
settings.value(QStringLiteral("diagrameditor/Xgrid"),
|
||||
Diagram::xGrid).toInt(),
|
||||
settings.value(QStringLiteral("diagrameditor/Ygrid"),
|
||||
Diagram::yGrid).toInt(),
|
||||
divisor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -233,6 +233,7 @@ class Diagram : public QGraphicsScene
|
||||
BorderOptions borderOptions();
|
||||
DiagramPosition convertPosition(const QPointF &);
|
||||
static QPointF snapToGrid(const QPointF &p);
|
||||
static QPointF snapToTextGrid(const QPointF &p);
|
||||
|
||||
bool drawTerminals() const;
|
||||
void setDrawTerminals(bool);
|
||||
|
||||
@@ -19,9 +19,12 @@
|
||||
|
||||
#include "diagram.h"
|
||||
#include "qetgraphicsitem/conductortextitem.h"
|
||||
#include "qetgraphicsitem/diagramimageitem.h"
|
||||
#include "qetgraphicsitem/dynamicelementtextitem.h"
|
||||
#include "qetgraphicsitem/element.h"
|
||||
#include "qetgraphicsitem/elementtextitemgroup.h"
|
||||
#include "qetgraphicsitem/independenttextitem.h"
|
||||
#include "qetgraphicsitem/qetshapeitem.h"
|
||||
#include "qetinformation.h"
|
||||
#include "qgimanager.h"
|
||||
|
||||
@@ -77,15 +80,40 @@ void PasteDiagramCommand::redo()
|
||||
{
|
||||
first_redo = false;
|
||||
|
||||
//Resolve a linked master/slave pair pasted together (bugtracker
|
||||
//#607) before anything below renews their uuids: at this exact
|
||||
//moment a pasted element's tmp_uuids_link still holds its
|
||||
//source's original partner uuid, which still equals the
|
||||
//not-yet-renewed uuid of that partner's own pasted copy if it
|
||||
//was carried along in the same batch. Scoped to this batch only
|
||||
//(not a project-wide search), so a pair pasted together links to
|
||||
//each other and not to an original element left elsewhere that
|
||||
//happens to still carry that same soon-to-be-replaced uuid. If
|
||||
//only one half of a linked group was pasted, its link entry
|
||||
//simply finds no match here and is dropped -- same "leave it
|
||||
//unlinked" outcome as always.
|
||||
const QList <Element *> elmts_list = content.m_elements;
|
||||
for (Element *e : elmts_list) {
|
||||
e->initLink(elmts_list);
|
||||
}
|
||||
|
||||
//make new uuid for every pasted conductor, because old uuid are
|
||||
//the uuid of the copied conductor
|
||||
const QList <Conductor *> all_pasted_conductors = content.conductors();
|
||||
for (Conductor *c : all_pasted_conductors) {
|
||||
c -> newUuid();
|
||||
}
|
||||
for (IndependentTextItem *t : std::as_const(content.m_text_fields)) {
|
||||
t -> newUuid();
|
||||
}
|
||||
for (DiagramImageItem *i : std::as_const(content.m_images)) {
|
||||
i -> newUuid();
|
||||
}
|
||||
for (QetShapeItem *s : std::as_const(content.m_shapes)) {
|
||||
s -> newUuid();
|
||||
}
|
||||
|
||||
//this is the first paste, we do some actions for the new element
|
||||
const QList <Element *> elmts_list = content.m_elements;
|
||||
for (Element *e : elmts_list)
|
||||
{
|
||||
//make new uuid, because old uuid are the uuid of the copied element
|
||||
|
||||
@@ -151,8 +151,8 @@ bool DiagramContext::operator!=(const DiagramContext &dc) const
|
||||
void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const
|
||||
{
|
||||
foreach (QString key, keys()) {
|
||||
if ((tag_name == "elementInformation") &&
|
||||
(m_content[key].toString().trimmed().isEmpty())) {
|
||||
const QString raw = m_content[key].toString();
|
||||
if ((tag_name == "elementInformation") && raw.trimmed().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
QDomElement property = e.ownerDocument().createElement(tag_name);
|
||||
@@ -161,7 +161,15 @@ void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const
|
||||
property.removeAttribute("name");
|
||||
property.setAttribute("show", m_content_show[key]);
|
||||
property.setAttribute("name", key);
|
||||
QDomText value = e.ownerDocument().createTextNode(m_content[key].toString().trimmed());
|
||||
// Trim stray leading/trailing whitespace around real content, but
|
||||
// not a value that IS whitespace: unconditionally trimming an
|
||||
// all-whitespace string collapses it to "", which is silently
|
||||
// indistinguishable from a value that was never set. A title-block
|
||||
// custom variable set to a single space -- a workaround for #973,
|
||||
// where an unset variable renders as its own literal placeholder --
|
||||
// would otherwise vanish on the very next save.
|
||||
const QString stored = raw.trimmed().isEmpty() ? raw : raw.trimmed();
|
||||
QDomText value = e.ownerDocument().createTextNode(stored);
|
||||
property.appendChild(value);
|
||||
e.appendChild(property);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
#ifndef DIAGRAM_CONTEXT_H
|
||||
#define DIAGRAM_CONTEXT_H
|
||||
#include "pugixml/src/pugixml.hpp"
|
||||
#include "pugixml.hpp"
|
||||
|
||||
#include <QDomElement>
|
||||
#include <QHash>
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 "diagramcontexttoolbar.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QEvent>
|
||||
#include <QGraphicsOpacityEffect>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMouseEvent>
|
||||
#include <QSettings>
|
||||
#include <QToolButton>
|
||||
|
||||
namespace {
|
||||
/// Fully opaque within this distance of the toolbar, in pixels...
|
||||
const int opaque_distance = 30;
|
||||
/// ...fading to hidden at this one
|
||||
const int hide_distance = 200;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DiagramContextToolbar::DiagramContextToolbar
|
||||
@param viewport : the view's viewport, which it is drawn on and watches
|
||||
*/
|
||||
DiagramContextToolbar::DiagramContextToolbar(QWidget *viewport) :
|
||||
QFrame(viewport)
|
||||
{
|
||||
setFrameShape(QFrame::StyledPanel);
|
||||
setAutoFillBackground(true);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
m_layout = new QHBoxLayout(this);
|
||||
m_layout->setContentsMargins(2, 2, 2, 2);
|
||||
m_layout->setSpacing(1);
|
||||
|
||||
m_opacity = new QGraphicsOpacityEffect(this);
|
||||
setGraphicsEffect(m_opacity);
|
||||
hide();
|
||||
|
||||
viewport->installEventFilter(this);
|
||||
//Key presses go to the view, not its viewport
|
||||
if (viewport->parentWidget()) {
|
||||
viewport->parentWidget()->installEventFilter(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@return whether the toolbar should be shown at all (a preference)
|
||||
*/
|
||||
bool DiagramContextToolbar::isEnabled()
|
||||
{
|
||||
return QSettings().value(QStringLiteral("diagrameditor/context_toolbar"),
|
||||
true).toBool();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DiagramContextToolbar::showAt
|
||||
Show @a actions just above and to the right of @a viewport_pos, kept
|
||||
inside the viewport. Clicking a button triggers the action and leaves
|
||||
the toolbar up, so a command such as rotate can be clicked again.
|
||||
*/
|
||||
void DiagramContextToolbar::showAt(const QPoint &viewport_pos,
|
||||
const QList<QAction *> &actions)
|
||||
{
|
||||
while (QLayoutItem *item = m_layout->takeAt(0)) {
|
||||
delete item->widget();
|
||||
delete item;
|
||||
}
|
||||
for (QAction *action : actions.mid(0, max_actions))
|
||||
{
|
||||
auto *button = new QToolButton(this);
|
||||
button->setAutoRaise(true);
|
||||
button->setFocusPolicy(Qt::NoFocus);
|
||||
button->setIconSize(QSize(20, 20));
|
||||
const QString text = action->text().remove(QLatin1Char('&'));
|
||||
if (action->icon().isNull()) {
|
||||
button->setText(text);
|
||||
} else {
|
||||
button->setIcon(action->icon());
|
||||
}
|
||||
button->setToolTip(text);
|
||||
button->setEnabled(action->isEnabled());
|
||||
connect(button, &QToolButton::clicked, action, &QAction::trigger);
|
||||
m_layout->addWidget(button);
|
||||
}
|
||||
if (actions.isEmpty()) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
adjustSize();
|
||||
const QRect area = parentWidget()->rect();
|
||||
QPoint pos = viewport_pos + QPoint(16, -height() - 16);
|
||||
pos.setX(qBound(area.left(), pos.x(), area.right() - width()));
|
||||
pos.setY(qBound(area.top(), pos.y(), area.bottom() - height()));
|
||||
move(pos);
|
||||
m_opacity->setOpacity(1.0);
|
||||
show();
|
||||
raise();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DiagramContextToolbar::followMouse
|
||||
Fade with the mouse's distance from the toolbar, and hide past
|
||||
hide_distance.
|
||||
*/
|
||||
void DiagramContextToolbar::followMouse(const QPoint &viewport_pos)
|
||||
{
|
||||
const QRect r = geometry();
|
||||
const int dx = qMax(qMax(r.left() - viewport_pos.x(), 0), viewport_pos.x() - r.right());
|
||||
const int dy = qMax(qMax(r.top() - viewport_pos.y(), 0), viewport_pos.y() - r.bottom());
|
||||
const int distance = qMax(dx, dy);
|
||||
|
||||
if (distance >= hide_distance) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
const qreal fade = qreal(distance - opaque_distance)
|
||||
/ (hide_distance - opaque_distance);
|
||||
m_opacity->setOpacity(qBound(0.15, 1.0 - fade, 1.0));
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DiagramContextToolbar::eventFilter
|
||||
Watch the viewport and the view while shown: follow the mouse, and hide
|
||||
on a press elsewhere, a wheel turn or a key press.
|
||||
*/
|
||||
bool DiagramContextToolbar::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
Q_UNUSED(watched)
|
||||
if (!isVisible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::MouseMove:
|
||||
followMouse(static_cast<QMouseEvent *>(event)->position().toPoint());
|
||||
break;
|
||||
case QEvent::MouseButtonPress:
|
||||
case QEvent::Wheel:
|
||||
case QEvent::KeyPress:
|
||||
case QEvent::Leave:
|
||||
hide();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright 2006-2026 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 DIAGRAMCONTEXTTOOLBAR_H
|
||||
#define DIAGRAMCONTEXTTOOLBAR_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <QList>
|
||||
|
||||
class QAction;
|
||||
class QGraphicsOpacityEffect;
|
||||
class QHBoxLayout;
|
||||
|
||||
/**
|
||||
@brief A small row of commands shown beside the cursor after a click
|
||||
selects something on a folio, as SolidWorks does.
|
||||
|
||||
It lives on the view's viewport, so it never takes the focus or opens a
|
||||
window. It fades as the mouse moves away and hides once the mouse is far
|
||||
enough, on a click elsewhere, a wheel turn or a key press. The commands
|
||||
are the shortcut bar's for the selection (ShortcutBarSettings).
|
||||
*/
|
||||
class DiagramContextToolbar : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DiagramContextToolbar(QWidget *viewport);
|
||||
|
||||
void showAt(const QPoint &viewport_pos, const QList<QAction *> &actions);
|
||||
static bool isEnabled();
|
||||
|
||||
/// At most this many commands, so it stays small
|
||||
static const int max_actions = 8;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
void followMouse(const QPoint &viewport_pos);
|
||||
|
||||
QHBoxLayout *m_layout = nullptr;
|
||||
QGraphicsOpacityEffect *m_opacity = nullptr;
|
||||
};
|
||||
|
||||
#endif // DIAGRAMCONTEXTTOOLBAR_H
|
||||
@@ -117,7 +117,16 @@ void DiagramEventAddImage::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
else if (m_image && !m_pressed && event->button() == Qt::RightButton)
|
||||
{
|
||||
m_image->setRotation(m_image->rotation() + 90);
|
||||
// rotationAngle()/setRotationAngle(), not QGraphicsItem's own
|
||||
// rotation()/setRotation(): DiagramImageItem's whole handle/undo/
|
||||
// XML-save machinery reads exclusively from its own m_transform
|
||||
// (see diagramimageitem.cpp's toXml() comment) and never looks at
|
||||
// QGraphicsItem's built-in convenience property at all -- using
|
||||
// it here left a rotation that displayed correctly in this tool
|
||||
// but silently vanished the moment the item was saved and
|
||||
// reloaded, and additionally desynced the rotate-handle's pivot
|
||||
// math once the image was later selected for editing.
|
||||
m_image->setRotationAngle(m_image->rotationAngle() + 90);
|
||||
event->setAccepted(true);
|
||||
}
|
||||
}
|
||||
@@ -167,6 +176,22 @@ void DiagramEventAddImage::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
else
|
||||
{
|
||||
// setPivot(QPointF(0, 0)), not left at its default
|
||||
// boundingRect().center(): DiagramImageItem's own m_transform
|
||||
// is pivot-centered, so with the default center pivot the
|
||||
// setPos(qMin(...)) below would no longer land on the image's
|
||||
// actual top-left corner the moment scale != 1 (the corner
|
||||
// only coincides with pos() when the pivot is the local
|
||||
// origin). Anchoring here to (0, 0) -- exactly the same
|
||||
// temporary-anchor trick DiagramImageItem::handlerMousePressEvent()
|
||||
// already uses for its own Resize handles -- makes pos()
|
||||
// keep meaning "scene position of the top-left corner"
|
||||
// regardless of scale, so the qMin(...) line below still
|
||||
// needs no change at all. setPivot() itself is a no-op past
|
||||
// the first call (same pivot value), and compensates pos()
|
||||
// automatically so nothing visibly jumps at the switch.
|
||||
m_image->setPivot(QPointF(0, 0));
|
||||
|
||||
const QSizeF naturalSize = m_image->boundingRect().size();
|
||||
if (naturalSize.width() > 0 && naturalSize.height() > 0)
|
||||
{
|
||||
@@ -179,7 +204,12 @@ void DiagramEventAddImage::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
// free-form one -- breaking aspect ratio on purpose is
|
||||
// its own, separate, larger piece of work.
|
||||
const qreal newScale = qBound(0.01, qMax(scaleX, scaleY), 50.0);
|
||||
m_image->setScale(newScale);
|
||||
// scaleFactorX()/scaleFactorY(), not QGraphicsItem's own
|
||||
// scale(): see the mousePressEvent right-click rotate
|
||||
// comment above for why -- identical reasoning, identical
|
||||
// fix.
|
||||
m_image->setScaleFactorX(newScale);
|
||||
m_image->setScaleFactorY(newScale);
|
||||
}
|
||||
m_image->setPos(qMin(m_press_pos.x(), pos.x()), qMin(m_press_pos.y(), pos.y()));
|
||||
}
|
||||
@@ -206,6 +236,17 @@ void DiagramEventAddImage::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (m_image && m_pressed && event->button() == Qt::LeftButton)
|
||||
{
|
||||
// Undo whatever temporary origin-anchoring mouseMoveEvent's
|
||||
// resize-drag branch did (a no-op if it never engaged): every
|
||||
// other DiagramImageItem code path -- handles, undo, XML save --
|
||||
// expects an image's pivot to be its bounding-rect center unless
|
||||
// the user deliberately customized it, exactly like a completed
|
||||
// handle-resize already resets it via resetPivotToBoundingRectCenter().
|
||||
// Doing this before reading pos() below is what makes the pushed
|
||||
// command capture the final, center-pivot position rather than
|
||||
// the drag's temporary corner-anchored one.
|
||||
m_image->setPivot(m_image->boundingRect().center());
|
||||
|
||||
m_diagram->undoStack().push(new AddGraphicsObjectCommand(m_image, m_diagram, m_image->pos()));
|
||||
|
||||
for (QGraphicsView *view : m_diagram->views()) {
|
||||
@@ -246,10 +287,32 @@ void DiagramEventAddImage::wheelEvent(QGraphicsSceneWheelEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
qreal scaling = m_image->scale();
|
||||
event->delta() > 1? scaling += 0.01 : scaling -= 0.01;
|
||||
if (scaling>0.01 && scaling <= 2) {
|
||||
m_image->setScale(scaling);
|
||||
// scaleFactorX()/scaleFactorY(), not QGraphicsItem's own scale(): see
|
||||
// the right-click rotate comment in mousePressEvent for why. Wheel-
|
||||
// scaling only ever runs while !m_pressed (guarded above), i.e. before
|
||||
// any drag-resize has anchored the pivot to the origin (see
|
||||
// mouseMoveEvent), so the pivot here is still the default
|
||||
// boundingRect().center() and this scales the image in place around
|
||||
// its own middle, exactly like before.
|
||||
//
|
||||
// Step each axis from its own current value rather than reading X and
|
||||
// writing it back to both: scaleFactorX and scaleFactorY cannot
|
||||
// actually differ at this point today (every other mutator in this
|
||||
// class -- the drag-resize branch above, and this same wheelEvent --
|
||||
// only ever sets them to the same value, and mouseReleaseEvent commits
|
||||
// and ends this tool on any left-button release, so a handle-based
|
||||
// non-uniform resize can never happen first and leave this instance
|
||||
// still alive). Stepping both from their own value rather than
|
||||
// collapsing Y to X costs nothing today and removes the trap if that
|
||||
// invariant ever stops holding.
|
||||
qreal scalingX = m_image->scaleFactorX();
|
||||
qreal scalingY = m_image->scaleFactorY();
|
||||
const qreal step = event->delta() > 1 ? 0.01 : -0.01;
|
||||
scalingX += step;
|
||||
scalingY += step;
|
||||
if (scalingX > 0.01 && scalingX <= 2 && scalingY > 0.01 && scalingY <= 2) {
|
||||
m_image->setScaleFactorX(scalingX);
|
||||
m_image->setScaleFactorY(scalingY);
|
||||
}
|
||||
|
||||
event->setAccepted(true);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user