mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-12 23:23:14 +02:00
Compare commits
57 Commits
de9eeed542
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ebefc269af | |||
| c6bfd46981 | |||
| 998c5e8a0d | |||
| ae382f6b12 | |||
| d4061d17fa | |||
| fb8c86ec12 | |||
| d62479e6e4 | |||
| 1a4bb91285 | |||
| aa96d5e7df | |||
| a8e408ad39 | |||
| 0eb3e1e436 | |||
| ba6320bff8 | |||
| 86b5d7ac95 | |||
| 19e99aab02 | |||
| 44f0abbb56 | |||
| e7787daa2c | |||
| c7fd3416f6 | |||
| b782a1612a | |||
| 2fdbc3c243 | |||
| a219c3f587 | |||
| 6b3b55b0e1 | |||
| 36d0121038 | |||
| 8235ecdbc9 | |||
| b6e4cd4786 | |||
| fb35027624 | |||
| 08a441d1f6 | |||
| e9840728b4 | |||
| ffbcd12d9b | |||
| 0a124f6695 | |||
| 3f6f99b50f | |||
| 42b64a7f0a | |||
| 361719ca74 | |||
| 181e2b555d | |||
| 420512595d | |||
| 9b4bed361d | |||
| 339bc8700b | |||
| 87d5ae5580 | |||
| 1070179617 | |||
| 6c4711a8d0 | |||
| 8a8a338a2e | |||
| 407cc7a4c2 | |||
| 5cb8930732 | |||
| a24acfac24 | |||
| 8b0b1d10d4 | |||
| 57dfa28674 | |||
| 3848c7821a | |||
| 1572c23d51 | |||
| e234f063f8 | |||
| be21604ad0 | |||
| e1ccc1e568 | |||
| e202b5bc2b | |||
| 2b7e62f901 | |||
| 23e8258ae1 | |||
| 457d265f0a | |||
| cd76b6a1d6 | |||
| b522a94556 | |||
| 399bc0e897 |
+2
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
include(cmake/hoto_update_cmake_message.cmake)
|
||||
|
||||
cmake_minimum_required(VERSION 3.14...3.19 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.5...4.2)
|
||||
|
||||
project(qelectrotech
|
||||
VERSION 0.100.1
|
||||
@@ -145,6 +145,7 @@ target_include_directories(
|
||||
${QET_DIR}/sources/dataBase/ui
|
||||
${QET_DIR}/sources/factory/ui
|
||||
${QET_DIR}/sources/print
|
||||
${QET_DIR}/sources/svg
|
||||
)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME})
|
||||
|
||||
+91
-2
@@ -2,13 +2,102 @@
|
||||
|
||||
## [Unreleased](https://github.com/qelectrotech/qelectrotech-source-mirror/tree/HEAD)
|
||||
|
||||
[Full Changelog](https://github.com/qelectrotech/qelectrotech-source-mirror/compare/0.9...HEAD)
|
||||
[Full Changelog](https://github.com/qelectrotech/qelectrotech-source-mirror/compare/nightly...HEAD)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- “Exclude from auto-numbering” and “Potential isolation” tick boxes fault [\#482](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/482)
|
||||
- Add ability to change appearance of multiple lines at once [\#476](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/476)
|
||||
- Save As dialog asks for "element name" but actually requires a file name [\#469](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/469)
|
||||
- Some icons are illegible with dark theme [\#466](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/466)
|
||||
- \[BUG\] Properties to all conductors [\#460](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/460)
|
||||
- Internal links in PDF export [\#417](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/417)
|
||||
- Apple silicon download is not working [\#400](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/400)
|
||||
- Add missing title block variables to 'folio properties' window [\#271](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/271)
|
||||
- Bug: Saving a read-only project doesn't clear the read-only state [\#217](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/217)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- PartText: keep text position stable across save/reopen on font-size change \(\#158\) [\#501](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/501) ([ispyisail](https://github.com/ispyisail))
|
||||
- Clear read-only state when a project is saved to a writable file [\#497](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/497) ([ispyisail](https://github.com/ispyisail))
|
||||
- Fix regional system locale loading the wrong translation \(pt\_BR/nl\_BE/nl\_NL\) [\#496](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/496) ([ispyisail](https://github.com/ispyisail))
|
||||
- Folio properties: auto-add a title block's custom variables [\#495](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/495) ([ispyisail](https://github.com/ispyisail))
|
||||
- Element editor Save As: label the field as a file name, not 'element name' [\#494](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/494) ([ispyisail](https://github.com/ispyisail))
|
||||
- CLI: add --set-titleblock, and fix headless backup crash [\#493](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/493) ([ispyisail](https://github.com/ispyisail))
|
||||
- Update qet\_zh.ts [\#491](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/491) ([zi-mozhuang](https://github.com/zi-mozhuang))
|
||||
- CLI: clickable cross-reference hyperlinks in PDF export [\#490](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/490) ([ispyisail](https://github.com/ispyisail))
|
||||
- CLI: add verification & data-export tools \(info, BOM, nets, links, check-elements, resave\) [\#489](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/489) ([ispyisail](https://github.com/ispyisail))
|
||||
- Issues 482 [\#488](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/488) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Revert "Update-UI-Chinese-translation" [\#486](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/486) ([scorpio810](https://github.com/scorpio810))
|
||||
- CLI export: don't draw the editor grid in PDF/PNG/SVG output [\#485](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/485) ([ispyisail](https://github.com/ispyisail))
|
||||
- Update-UI-Chinese-translation [\#484](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/484) ([zi-mozhuang](https://github.com/zi-mozhuang))
|
||||
- Add headless command-line export \(PDF / PNG / SVG / cable-list / wire-list\) [\#483](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/483) ([ispyisail](https://github.com/ispyisail))
|
||||
- fix possible crashes in crossrefitem [\#479](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/479) ([ChuckNr11](https://github.com/ChuckNr11))
|
||||
- Fix: Dynamic element text shifting/jumping when duplicating diagrams [\#477](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/477) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Update German translations for duplicate diagram feature [\#475](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/475) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Feat: Add ability to duplicate diagrams/folios with all metadata and … [\#473](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/473) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Feature: Allow excluding specific elements from BOM \(Nomenclature\) [\#472](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/472) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Potential Isolation option for terminals [\#471](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/471) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Fix: Wiring list filter and dynamic text timing [\#470](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/470) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- New element: Line definition [\#464](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/464) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Turkish Lang Update [\#463](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/463) ([scorpio810](https://github.com/scorpio810))
|
||||
- follow up: wiring list [\#462](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/462) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Fix and Improve Multi-selection for Diagram Operations [\#459](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/459) ([Kellermorph](https://github.com/Kellermorph))
|
||||
|
||||
## [nightly](https://github.com/qelectrotech/qelectrotech-source-mirror/tree/nightly) (2026-05-10)
|
||||
|
||||
[Full Changelog](https://github.com/qelectrotech/qelectrotech-source-mirror/compare/0.100...nightly)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Flatpak runtimes outdated [\#446](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/446)
|
||||
- Move Flemish man pages from man/be/ to man/nl\_BE/ [\#439](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/439)
|
||||
- you could share an PR to fix it? [\#438](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/438)
|
||||
- Diacritics in some filenames can possibly lead to the problems during packaging [\#437](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/437)
|
||||
- שרטוט חשמל [\#435](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/435)
|
||||
- Feature request: add circuit simulation [\#432](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/432)
|
||||
- No usable sources archive for version 0.100 [\#418](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/418)
|
||||
- New release ? [\#411](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/411)
|
||||
- options moving when opening "file", "edition" menus [\#299](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/299)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Try to add Windows build CI workflow [\#457](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/457) ([scorpio810](https://github.com/scorpio810))
|
||||
- Fixed: Prevented the selection in the project tree from jumping to the last page when saving. [\#456](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/456) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Fix Thumbnail in Makrotree [\#455](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/455) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Update German translation for macro feature [\#454](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/454) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Fix losing Focus on moving diagram position with keyboard [\#452](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/452) ([ChuckNr11](https://github.com/ChuckNr11))
|
||||
- Draft: Feature - Introduce User Templates Collection and Dedicated UI Tab [\#451](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/451) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Update translation [\#450](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/450) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Automatic Terminal Numbering Tool [\#449](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/449) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Supplement to pull request \#444 by Kellermorph [\#448](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/448) ([ChuckNr11](https://github.com/ChuckNr11))
|
||||
- Add RAM-based wiring list export [\#447](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/447) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Follow-up: Address review comments for slave limit feature [\#444](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/444) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Feature: Auto-select active diagram in the elements panel tree [\#443](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/443) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Revert "Feature: Implement max\_slaves limit for Master elements" [\#442](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/442) ([scorpio810](https://github.com/scorpio810))
|
||||
- Feature: Implement max\_slaves limit for Master elements [\#441](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/441) ([Kellermorph](https://github.com/Kellermorph))
|
||||
- Update qet\_cs.ts [\#434](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/434) ([pafri](https://github.com/pafri))
|
||||
- Update QCH Help file [\#433](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/433) ([Int-Circuit](https://github.com/Int-Circuit))
|
||||
- Create Korean man page for QElectroTech [\#431](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/431) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Update ELEMENTS.LICENSE [\#430](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/430) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Update CREDIT [\#429](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/429) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean comments to QElectroTech XML file [\#428](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/428) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Spanish and Korean summaries to appdata [\#427](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/427) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean translations for comments and generic names [\#426](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/426) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Restore copyright and license information in QET64.nsi [\#425](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/425) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean language strings to lang\_extra.nsh [\#424](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/424) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean translation author to aboutqetdialog [\#423](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/423) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean language support in xml element collection [\#422](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/422) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
- Add Korean translation \(ko\) – translated by jkh [\#419](https://github.com/qelectrotech/qelectrotech-source-mirror/pull/419) ([Kyle-Code-CA](https://github.com/Kyle-Code-CA))
|
||||
|
||||
## [0.100](https://github.com/qelectrotech/qelectrotech-source-mirror/tree/0.100) (2026-01-25)
|
||||
|
||||
[Full Changelog](https://github.com/qelectrotech/qelectrotech-source-mirror/compare/0.9...0.100)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- error in doxygen action code [\#414](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/414)
|
||||
- "NoName" is automatically inserted into empty text cells in title block [\#407](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/407)
|
||||
- Apple silicon download is not working [\#400](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/400)
|
||||
- Apple silicon download is not working [\#394](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/394)
|
||||
- Differenciating connector for proper labeling [\#390](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/390)
|
||||
- Non-perpendicular connections [\#368](https://github.com/qelectrotech/qelectrotech-source-mirror/issues/368)
|
||||
|
||||
@@ -25,7 +25,7 @@ if(BUILD_PUGIXML)
|
||||
FetchContent_Declare(
|
||||
pugixml
|
||||
GIT_REPOSITORY https://github.com/zeux/pugixml.git
|
||||
GIT_TAG v1.11.4)
|
||||
GIT_TAG v1.15)
|
||||
|
||||
FetchContent_MakeAvailable(pugixml)
|
||||
else()
|
||||
|
||||
@@ -29,6 +29,7 @@ set(QET_COMPONENTS
|
||||
set(QET_PRIVATE_LIBRARIES
|
||||
Qt::PrintSupport
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate # Required for QPdfEngine::drawHyperlink (PDF internal links)
|
||||
Qt::Xml
|
||||
Qt::Svg
|
||||
Qt::Sql
|
||||
@@ -106,6 +107,10 @@ set(QET_RES_FILES
|
||||
${QET_DIR}/sources/ui/configpage/generalconfigurationpage.ui
|
||||
)
|
||||
set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/cli_export.cpp
|
||||
${QET_DIR}/sources/cli_export.h
|
||||
${QET_DIR}/sources/pdf_links.cpp
|
||||
${QET_DIR}/sources/pdf_links.h
|
||||
${QET_DIR}/sources/borderproperties.cpp
|
||||
${QET_DIR}/sources/borderproperties.h
|
||||
${QET_DIR}/sources/bordertitleblock.cpp
|
||||
@@ -499,6 +504,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/SearchAndReplace/ui/replacefoliowidget.h
|
||||
${QET_DIR}/sources/SearchAndReplace/ui/searchandreplacewidget.cpp
|
||||
${QET_DIR}/sources/SearchAndReplace/ui/searchandreplacewidget.h
|
||||
${QET_DIR}/sources/svg/qetsvg.cpp
|
||||
${QET_DIR}/sources/svg/qetsvg.h
|
||||
|
||||
${QET_DIR}/sources/titleblock/dimension.cpp
|
||||
${QET_DIR}/sources/titleblock/dimension.h
|
||||
@@ -713,6 +720,8 @@ set(QET_SRC_FILES
|
||||
|
||||
${QET_DIR}/sources/xml/terminalstripitemxml.cpp
|
||||
${QET_DIR}/sources/xml/terminalstripitemxml.h
|
||||
${QET_DIR}/sources/xml/terminalstriplayoutpatternxml.cpp
|
||||
${QET_DIR}/sources/xml/terminalstriplayoutpatternxml.h
|
||||
)
|
||||
|
||||
set(TS_FILES
|
||||
|
||||
+1
-1
Submodule elements updated: f6a422ab00...3aab395fc4
+210
-192
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+127
-114
@@ -1836,61 +1836,69 @@ Bemerkung: diese Optionen verhindern NICHT das automatische Nummerieren.</transl
|
||||
<translation>Name der neuen Vorlage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="127"/>
|
||||
<source>Nom du nouvel élément</source>
|
||||
<translation>Name vom neuen Bauteil</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="238"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="248"/>
|
||||
<source>Écraser le template ?</source>
|
||||
<comment>message box title</comment>
|
||||
<translation>Die Vorlage überschreiben?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="239"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="249"/>
|
||||
<source>Le template existe déjà. Voulez-vous l'écraser ?</source>
|
||||
<comment>message box content</comment>
|
||||
<translation>Die Vorlage existiert bereits. Möchten Sie sie überschreiben?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="254"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="264"/>
|
||||
<source>Vous devez sélectionner un élément ou une catégorie avec un nom pour l'élément.</source>
|
||||
<comment>message box content</comment>
|
||||
<translation>Sie müssen ein Bauteil oder eine Kategorie auswählen.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="218"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="228"/>
|
||||
<source>Sélection inexistante</source>
|
||||
<comment>message box title</comment>
|
||||
<translation>Keine Auswahl</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="219"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="131"/>
|
||||
<source>Nom de fichier de l'élément</source>
|
||||
<comment>placeholder: the element's file name, not its display name</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="134"/>
|
||||
<source>Nom de fichier de l'élément : chiffres, minuscules, « - », « _ » et « . » uniquement.
|
||||
Le nom affiché de l'élément se modifie séparément dans les propriétés de l'élément.</source>
|
||||
<comment>tooltip for the element file-name field</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="229"/>
|
||||
<source>La sélection n'existe pas.</source>
|
||||
<comment>message box content</comment>
|
||||
<translation>Auswahl existiert nicht.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="225"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="253"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="235"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="263"/>
|
||||
<source>Sélection incorrecte</source>
|
||||
<comment>message box title</comment>
|
||||
<translation>Auswahl nicht korrekt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="226"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="236"/>
|
||||
<source>La sélection n'est pas un élément.</source>
|
||||
<comment>message box content</comment>
|
||||
<translation>Auswahl ist kein Bauteil.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="238"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="248"/>
|
||||
<source>Écraser l'élément ?</source>
|
||||
<comment>message box title</comment>
|
||||
<translation>Bauteil überschreiben?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementdialog.cpp" line="239"/>
|
||||
<location filename="../sources/elementdialog.cpp" line="249"/>
|
||||
<source>L'élément existe déjà. Voulez-vous l'écraser ?</source>
|
||||
<comment>message box content</comment>
|
||||
<translation>Das Bauteil existiert bereits. Soll es überschrieben werden?</translation>
|
||||
@@ -2813,61 +2821,66 @@ Alle Bauteile und Unterordner von diesem Ordner werden ebenso gelöscht.</transl
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="63"/>
|
||||
<source>Copier et coller</source>
|
||||
<translation>Kopieren und Einfügen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="64"/>
|
||||
<source>Supprimer ce folio</source>
|
||||
<translation>Folie löschen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="64"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="65"/>
|
||||
<source>Remonter ce folio</source>
|
||||
<translation>Folie 1 Position nach oben verschieben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="65"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="66"/>
|
||||
<source>Abaisser ce folio</source>
|
||||
<translation>Folie 1 Position nach unten verschieben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="66"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="67"/>
|
||||
<source>Remonter ce folio x10</source>
|
||||
<translation>Folie 10 Positionen nach oben verschieben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="67"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="68"/>
|
||||
<source>Remonter ce folio x100</source>
|
||||
<translation>Folie 100 Positionen nach oben verschieben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="68"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="69"/>
|
||||
<source>Remonter ce folio au debut</source>
|
||||
<translation>Folie an den Anfang verschieben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="69"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="70"/>
|
||||
<source>Abaisser ce folio x10</source>
|
||||
<translation>Folie 10 Positionen nach unten verschieben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="70"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="71"/>
|
||||
<source>Abaisser ce folio x100</source>
|
||||
<translation>Folie 100 Positionen nach unten verschieben</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="90"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="91"/>
|
||||
<source>Filtrer</source>
|
||||
<translation>Filter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="71"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="72"/>
|
||||
<source>Nouveau modèle</source>
|
||||
<translation>Neues Schriftfeld</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="72"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="73"/>
|
||||
<source>Éditer ce modèle</source>
|
||||
<translation>Schriftfeld bearbeiten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="73"/>
|
||||
<location filename="../sources/elementspanelwidget.cpp" line="74"/>
|
||||
<source>Supprimer ce modèle</source>
|
||||
<translation>Schriftfeld löschen</translation>
|
||||
</message>
|
||||
@@ -5620,44 +5633,44 @@ Folgende Variablen sind inkompatibel:
|
||||
<translation>Seite einrichten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="68"/>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="81"/>
|
||||
<source>Options d'impression</source>
|
||||
<comment>window title</comment>
|
||||
<translation>Druckoptionen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="109"/>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="122"/>
|
||||
<source>projet</source>
|
||||
<comment>string used to generate a filename</comment>
|
||||
<translation>Projekt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="140"/>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="153"/>
|
||||
<source>Imprimer</source>
|
||||
<translation>Drucken</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="146"/>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="159"/>
|
||||
<source>Exporter en pdf</source>
|
||||
<translation>Als PDF speichern</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="169"/>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="182"/>
|
||||
<source>Mise en page (non disponible sous Windows pour l'export PDF)</source>
|
||||
<translation>Layout (unter Windows für den PDF-Export nicht verfügbar)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="434"/>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="540"/>
|
||||
<source>Folio sans titre</source>
|
||||
<translation>Folie ohne Titel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="673"/>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="779"/>
|
||||
<source>Exporter sous : </source>
|
||||
<translation>Exportieren als: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="673"/>
|
||||
<location filename="../sources/print/projectprintwindow.cpp" line="779"/>
|
||||
<source>Fichier (*.pdf)</source>
|
||||
<translation>Datei (*.pdf)</translation>
|
||||
</message>
|
||||
@@ -5816,193 +5829,193 @@ Voulez-vous enregistrer les modifications ?</source>
|
||||
<translation>LTR</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="444"/>
|
||||
<location filename="../sources/qetapp.cpp" line="448"/>
|
||||
<source>Cartouches QET</source>
|
||||
<comment>title of the title block templates collection provided by QElectroTech</comment>
|
||||
<translation>QET-Schriftfelder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="465"/>
|
||||
<location filename="../sources/qetapp.cpp" line="469"/>
|
||||
<source>Cartouches company</source>
|
||||
<comment>title of the company's title block templates collection</comment>
|
||||
<translation>Firmen-Schriftfelder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="485"/>
|
||||
<location filename="../sources/qetapp.cpp" line="489"/>
|
||||
<source>Cartouches utilisateur</source>
|
||||
<comment>title of the user's title block templates collection</comment>
|
||||
<translation>Benutzer-Schriftfelder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="1486"/>
|
||||
<location filename="../sources/qetapp.cpp" line="1490"/>
|
||||
<source>Q</source>
|
||||
<comment>Single-letter example text - translate length, not meaning</comment>
|
||||
<translation>Q</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="1488"/>
|
||||
<location filename="../sources/qetapp.cpp" line="1492"/>
|
||||
<source>QET</source>
|
||||
<comment>Small example text - translate length, not meaning</comment>
|
||||
<translation>QET</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="1490"/>
|
||||
<location filename="../sources/qetapp.cpp" line="1494"/>
|
||||
<source>Schema</source>
|
||||
<comment>Normal example text - translate length, not meaning</comment>
|
||||
<translation>Folie</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="1492"/>
|
||||
<location filename="../sources/qetapp.cpp" line="1496"/>
|
||||
<source>Electrique</source>
|
||||
<comment>Normal example text - translate length, not meaning</comment>
|
||||
<translation>Elektrik</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="1494"/>
|
||||
<location filename="../sources/qetapp.cpp" line="1498"/>
|
||||
<source>QElectroTech</source>
|
||||
<comment>Long example text - translate length, not meaning</comment>
|
||||
<translation>QElectroTech</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="1971"/>
|
||||
<location filename="../sources/qetapp.cpp" line="1975"/>
|
||||
<source>Configurer QElectroTech</source>
|
||||
<comment>window title</comment>
|
||||
<translation>QElectroTech Einstellungen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2125"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2129"/>
|
||||
<source>Chargement...</source>
|
||||
<comment>splash screen caption</comment>
|
||||
<translation>Lade...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2285"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2289"/>
|
||||
<source>Chargement... icône du systray</source>
|
||||
<comment>splash screen caption</comment>
|
||||
<translation>Lade... Symbole des Systemsbenachrichtigungsfelds</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2289"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2293"/>
|
||||
<source>QElectroTech</source>
|
||||
<comment>systray menu title</comment>
|
||||
<translation>QElectroTech</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2292"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2296"/>
|
||||
<source>&Quitter</source>
|
||||
<translation>&Beenden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2294"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2298"/>
|
||||
<source>&Masquer</source>
|
||||
<translation>&Verstecken</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2296"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2300"/>
|
||||
<source>&Restaurer</source>
|
||||
<translation>&Zeigen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2298"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2302"/>
|
||||
<source>&Masquer tous les éditeurs de schéma</source>
|
||||
<translation>&Verstecke alle Schaltplaneditoren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2301"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2305"/>
|
||||
<source>&Restaurer tous les éditeurs de schéma</source>
|
||||
<translation>&Zeige alle Schaltplaneditoren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2304"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2308"/>
|
||||
<source>&Masquer tous les éditeurs d'élément</source>
|
||||
<translation>&Verstecke alle Bauteileditoren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2307"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2311"/>
|
||||
<source>&Restaurer tous les éditeurs d'élément</source>
|
||||
<translation>&Zeige alle Bauteileditoren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2310"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2314"/>
|
||||
<source>&Masquer tous les éditeurs de cartouche</source>
|
||||
<comment>systray submenu entry</comment>
|
||||
<translation>&Verstecke alle Schriftfeld-Editoren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2313"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2317"/>
|
||||
<source>&Restaurer tous les éditeurs de cartouche</source>
|
||||
<comment>systray submenu entry</comment>
|
||||
<translation>&Zeige alle Schriftfeld-Editoren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2316"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2320"/>
|
||||
<source>&Nouvel éditeur de schéma</source>
|
||||
<translation>&Neuer Schaltplaneditor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2318"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2322"/>
|
||||
<source>&Nouvel éditeur d'élément</source>
|
||||
<translation>&Neuer Bauteileditor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2320"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2324"/>
|
||||
<source>Ferme l'application QElectroTech</source>
|
||||
<translation>Anwendung QElectroTech schließen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2321"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2325"/>
|
||||
<source>Réduire QElectroTech dans le systray</source>
|
||||
<translation>QElectroTech in Systembenachrichtigungsfeld minimieren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2322"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2326"/>
|
||||
<source>Restaurer QElectroTech</source>
|
||||
<translation>QElectroTech wiederherstellen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2339"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2343"/>
|
||||
<source>QElectroTech</source>
|
||||
<comment>systray icon tooltip</comment>
|
||||
<translation>QElectroTech</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2434"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2438"/>
|
||||
<source>Éditeurs de schémas</source>
|
||||
<translation>Schaltplaneditor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2444"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2448"/>
|
||||
<source>Éditeurs d'élément</source>
|
||||
<translation>Bauteileditor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2455"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2459"/>
|
||||
<source>Éditeurs de cartouche</source>
|
||||
<comment>systray menu entry</comment>
|
||||
<translation>Schriftfeld-Editor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2507"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2511"/>
|
||||
<source><b>Le fichier de restauration suivant a été trouvé,<br>Voulez-vous l'ouvrir ?</b><br></source>
|
||||
<translation><b>Die folgende Sicherungsdatei wurde gefunden,<br>Möchten Sie sie öffnen?</b><br></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2510"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2514"/>
|
||||
<source><b>Les fichiers de restauration suivant on été trouvé,<br>Voulez-vous les ouvrir ?</b><br></source>
|
||||
<translation><b>Die folgenden Sicherungsdateien wurden gefunden,<br>Möchten Sie sie öffnen?</b><br></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2525"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2529"/>
|
||||
<source>Fichier de restauration</source>
|
||||
<translation>Sicherungsdatei</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2627"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2631"/>
|
||||
<source>Usage : </source>
|
||||
<translation>Verwendung: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2629"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2633"/>
|
||||
<source> [options] [fichier]...
|
||||
|
||||
</source>
|
||||
@@ -6011,7 +6024,7 @@ Voulez-vous enregistrer les modifications ?</source>
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2630"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2634"/>
|
||||
<source>QElectroTech, une application de réalisation de schémas électriques.
|
||||
|
||||
Options disponibles :
|
||||
@@ -6028,35 +6041,35 @@ Verfügbare Optionen:
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2636"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2640"/>
|
||||
<source> --common-elements-dir=DIR Definir le dossier de la collection d'elements
|
||||
</source>
|
||||
<translation> --common-elements-dir=DIR Setzt Pfad zur Bauteilsammlung
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2639"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2643"/>
|
||||
<source> --common-tbt-dir=DIR Definir le dossier de la collection de modeles de cartouches
|
||||
</source>
|
||||
<translation> --common-tbt-dir=DIR Pfad zur Schriftfeld-Sammlung setzen
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2642"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2646"/>
|
||||
<source> --config-dir=DIR Definir le dossier de configuration
|
||||
</source>
|
||||
<translation> --config-dir=DIR Setzt Pfad zur Konfiguration
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2645"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2649"/>
|
||||
<source> --data-dir=DIR Definir le dossier de data
|
||||
</source>
|
||||
<translation> --data-dir=DIR Setzt Pfad zu den Daten
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetapp.cpp" line="2647"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2651"/>
|
||||
<source> --lang-dir=DIR Definir le dossier contenant les fichiers de langue
|
||||
</source>
|
||||
<translation> --lang-dir=DIR Setzt Pfad zu den Sprachdateien
|
||||
@@ -7745,49 +7758,49 @@ les conditions requises ne sont pas valides</source>
|
||||
<context>
|
||||
<name>QETProject</name>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="395"/>
|
||||
<location filename="../sources/qetproject.cpp" line="402"/>
|
||||
<source>Projet « %1 : %2»</source>
|
||||
<comment>displayed title for a ProjectView - %1 is the project title, -%2 is the project path</comment>
|
||||
<translation>Projekt "%1: %2"</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="402"/>
|
||||
<location filename="../sources/qetproject.cpp" line="409"/>
|
||||
<source>Projet %1</source>
|
||||
<comment>displayed title for a title-less project - %1 is the file name</comment>
|
||||
<translation>Projekt %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="409"/>
|
||||
<location filename="../sources/qetproject.cpp" line="416"/>
|
||||
<source>Projet sans titre</source>
|
||||
<comment>displayed title for a project-less, file-less project</comment>
|
||||
<translation>Projekt ohne Titel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="418"/>
|
||||
<location filename="../sources/qetproject.cpp" line="425"/>
|
||||
<source>%1 [lecture seule]</source>
|
||||
<comment>displayed title for a read-only project - %1 is a displayable title</comment>
|
||||
<translation>%1 [schreibgeschützt]</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="426"/>
|
||||
<location filename="../sources/qetproject.cpp" line="433"/>
|
||||
<source>%1 [modifié]</source>
|
||||
<comment>displayed title for a modified project - %1 is a displayable title</comment>
|
||||
<translation>%1 [geändert]</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="1207"/>
|
||||
<location filename="../sources/qetproject.cpp" line="1228"/>
|
||||
<source>Une erreur s'est produite durant l'intégration du modèle.</source>
|
||||
<comment>error message</comment>
|
||||
<translation>Ein Fehler ist beim Einfügen der Vorlage aufgetreten.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="1360"/>
|
||||
<location filename="../sources/qetproject.cpp" line="1381"/>
|
||||
<source>Avertissement</source>
|
||||
<comment>message box title</comment>
|
||||
<translation>Warnung</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="1362"/>
|
||||
<location filename="../sources/qetproject.cpp" line="1383"/>
|
||||
<source>Ce document semble avoir été enregistré avec une version %1
|
||||
qui est ultérieure à votre version !
|
||||
Vous utilisez actuellement QElectroTech en version %2</source>
|
||||
@@ -7795,7 +7808,7 @@ Vous utilisez actuellement QElectroTech en version %2</source>
|
||||
Sie verwenden derzeit QElectroTech Version %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="1367"/>
|
||||
<location filename="../sources/qetproject.cpp" line="1388"/>
|
||||
<source>.
|
||||
Il est alors possible que l'ouverture de tout ou partie de ce document échoue.
|
||||
Que désirez vous faire ?</source>
|
||||
@@ -7803,32 +7816,32 @@ Que désirez vous faire ?</source>
|
||||
Was möchten Sie tun?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="1387"/>
|
||||
<location filename="../sources/qetproject.cpp" line="1408"/>
|
||||
<source>Avertissement </source>
|
||||
<comment>message box title</comment>
|
||||
<translation>Warnung </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="1388"/>
|
||||
<location filename="../sources/qetproject.cpp" line="1409"/>
|
||||
<source>Le projet que vous tentez d'ouvrir est partiellement compatible avec votre version %1 de QElectroTech.
|
||||
</source>
|
||||
<translation>Das Projekt, das Sie zu öffnen versuchen, ist teilweise mit Ihrer Version %1 von QElectroTech kompatibel.
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="1391"/>
|
||||
<location filename="../sources/qetproject.cpp" line="1412"/>
|
||||
<source>Afin de le rendre totalement compatible veuillez ouvrir ce même projet avec la version 0.8, ou 0.80 de QElectroTech et sauvegarder le projet et l'ouvrir à nouveau avec cette version.
|
||||
Que désirez vous faire ?</source>
|
||||
<translation>Um es vollständig kompatibel zu machen, öffnen Sie bitte das gleiche Projekt mit der QElectroTech-Version 0.8 oder 0.80, speichern Sie das Projekt und öffnen Sie es erneut mit dieser Version.
|
||||
Was möchten Sie tun?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="1462"/>
|
||||
<location filename="../sources/qetproject.cpp" line="1483"/>
|
||||
<source><p align="center"><b>Ouverture du projet en cours...</b><br/>Création des folios</p></source>
|
||||
<translation><p align="center"><b>Öffnen des Projekts...</b><br/>Folien werden erstellt</p></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetproject.cpp" line="1504"/>
|
||||
<location filename="../sources/qetproject.cpp" line="1525"/>
|
||||
<source><p align="center"><b>Ouverture du projet en cours...</b><br/>Mise en place des références croisées</p></source>
|
||||
<translation><p align="center"><b>Öffnen des Projekts...</b><br/>Querverweise werden eingelesen</p></translation>
|
||||
</message>
|
||||
@@ -8850,7 +8863,7 @@ Was möchten Sie tun?</translation>
|
||||
<message>
|
||||
<location filename="../sources/ElementsCollection/fileelementcollectionitem.cpp" line="133"/>
|
||||
<source>Makros</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Vorlagen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/ElementsCollection/fileelementcollectionitem.cpp" line="135"/>
|
||||
@@ -9423,7 +9436,7 @@ Möchten Sie sie ersetzen?</translation>
|
||||
<location filename="../sources/SearchAndReplace/ui/searchandreplacewidget.cpp" line="425"/>
|
||||
<location filename="../sources/conductorproperties.cpp" line="826"/>
|
||||
<location filename="../sources/factory/elementpicturefactory.cpp" line="582"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2379"/>
|
||||
<location filename="../sources/qetapp.cpp" line="2383"/>
|
||||
<location filename="../sources/titleblock/templatelocation.cpp" line="108"/>
|
||||
<source>this is an error in the code</source>
|
||||
<translation>dies ist ein Programmfehler</translation>
|
||||
@@ -13685,30 +13698,30 @@ Andere Felder werden nicht verwendet.</translation>
|
||||
<context>
|
||||
<name>TitleBlockPropertiesWidget</name>
|
||||
<message>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="413"/>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="418"/>
|
||||
<source>Modèle par défaut</source>
|
||||
<translation>Standardvorlage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="327"/>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="332"/>
|
||||
<source>Éditer ce modèle</source>
|
||||
<comment>menu entry</comment>
|
||||
<translation>Vorlage bearbeiten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="328"/>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="333"/>
|
||||
<source>Dupliquer et éditer ce modèle</source>
|
||||
<comment>menu entry</comment>
|
||||
<translation>Vorlage kopieren und bearbeiten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="341"/>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="346"/>
|
||||
<source>Title block templates actions</source>
|
||||
<translation>Aktionen zum Schriftfeld</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="355"/>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="482"/>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="360"/>
|
||||
<location filename="../sources/ui/titleblockpropertieswidget.cpp" line="524"/>
|
||||
<source>Créer un Folio Numérotation Auto</source>
|
||||
<translation>Neue auto-nummerierte Folie anlegen</translation>
|
||||
</message>
|
||||
@@ -14353,92 +14366,92 @@ Maximale Länge: %2px
|
||||
<context>
|
||||
<name>WiringListExport</name>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="157"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="211"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="156"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="171"/>
|
||||
<source>Erreur</source>
|
||||
<translation>Fehler</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="157"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="156"/>
|
||||
<source>Impossible de lire la structure en mémoire du projet.</source>
|
||||
<translation>Die Speicherstruktur des Projekts kann nicht gelesen werden.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="202"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="162"/>
|
||||
<source>Exporter le plan de câblage</source>
|
||||
<translation>Verdrahtungsplan erstellen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="204"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="164"/>
|
||||
<source>Fichiers CSV (*.csv)</source>
|
||||
<translation>CSV-Dateien (*.csv)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="211"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="171"/>
|
||||
<source>Impossible d'ouvrir le fichier pour l'écriture.</source>
|
||||
<translation>Die Datei kann nicht zum Schreiben geöffnet werden.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="357"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="369"/>
|
||||
<source>Page</source>
|
||||
<comment>Wiring list CSV header</comment>
|
||||
<translation>Seite</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="358"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="370"/>
|
||||
<source>Composant 1</source>
|
||||
<comment>Wiring list CSV header</comment>
|
||||
<translation>Bauteil 1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="359"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="371"/>
|
||||
<source>Borne 1</source>
|
||||
<comment>Wiring list CSV header</comment>
|
||||
<translation>Anschluss 1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="360"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="372"/>
|
||||
<source>Composant 2</source>
|
||||
<comment>Wiring list CSV header</comment>
|
||||
<translation>Bauteil 2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="361"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="373"/>
|
||||
<source>Borne 2</source>
|
||||
<comment>Wiring list CSV header</comment>
|
||||
<translation>Anschluss 2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="362"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="374"/>
|
||||
<source>Tension / Protocole</source>
|
||||
<comment>Wiring list CSV header</comment>
|
||||
<translation>Spannung / Protokoll</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="363"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="375"/>
|
||||
<source>Couleur du fil</source>
|
||||
<comment>Wiring list CSV header</comment>
|
||||
<translation>Leiterfarbe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="364"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="376"/>
|
||||
<source>Section du fil</source>
|
||||
<comment>Wiring list CSV header</comment>
|
||||
<translation>Leiterquerschnitt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="365"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="377"/>
|
||||
<source>Fonction</source>
|
||||
<comment>Wiring list CSV header</comment>
|
||||
<translation>Funktion</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="380"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="177"/>
|
||||
<source>Export réussi</source>
|
||||
<translation>Export erfolgreich</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="380"/>
|
||||
<location filename="../sources/wiringlistexport.cpp" line="177"/>
|
||||
<source>Le plan de câblage a été exporté avec succès !</source>
|
||||
<translation>Der Verdrahtungsplan wurde erfolgreich exportiert!</translation>
|
||||
</message>
|
||||
|
||||
+210
-192
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+209
-190
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+207
-189
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+208
-190
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+208
-190
File diff suppressed because it is too large
Load Diff
+208
-190
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+207
-189
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+207
-189
File diff suppressed because it is too large
Load Diff
+210
-192
File diff suppressed because it is too large
Load Diff
+207
-189
File diff suppressed because it is too large
Load Diff
+207
-189
File diff suppressed because it is too large
Load Diff
+207
-189
File diff suppressed because it is too large
Load Diff
+208
-190
File diff suppressed because it is too large
Load Diff
+208
-190
File diff suppressed because it is too large
Load Diff
+208
-190
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+1489
-1443
File diff suppressed because it is too large
Load Diff
+5
-1
@@ -230,7 +230,11 @@ RESOURCES += qelectrotech.qrc
|
||||
TRANSLATIONS += lang/*.ts
|
||||
|
||||
# Modules Qt utilises par l'application
|
||||
QT += xml svg network sql widgets printsupport concurrent KWidgetsAddons KCoreAddons
|
||||
QT += xml svg network sql widgets printsupport concurrent KWidgetsAddons KCoreAddons gui-private
|
||||
|
||||
# Private Qt GUI headers (needed for QPdfEngine::drawHyperlink)
|
||||
# gui-private should add this automatically, but some distros need it explicit
|
||||
INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtGui/$$[QT_VERSION]/QtGui
|
||||
|
||||
# UI DESIGNER FILES AND GENERATION SOURCES FILES
|
||||
FORMS += $$files(sources/richtext/*.ui) \
|
||||
|
||||
@@ -0,0 +1,825 @@
|
||||
/*
|
||||
Copyright 2006-2025 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "cli_export.h"
|
||||
|
||||
#include "bordertitleblock.h"
|
||||
#include "conductornumexport.h"
|
||||
#include "conductorproperties.h"
|
||||
#include "dataBase/projectdatabase.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramcontext.h"
|
||||
#include "pdf_links.h"
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
#include "qetgraphicsitem/element.h"
|
||||
#include "qetgraphicsitem/terminal.h"
|
||||
#include "qetproject.h"
|
||||
#include "titleblockproperties.h"
|
||||
#include "wiringlistexport.h"
|
||||
|
||||
// Private Qt PDF engine for drawHyperlink() — see pdf_links / projectprintwindow.
|
||||
#include <private/qpdf_p.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QDomDocument>
|
||||
#include <QDate>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QMap>
|
||||
#include <QPageLayout>
|
||||
#include <QPair>
|
||||
#include <QPainter>
|
||||
#include <QPdfWriter>
|
||||
#include <QSet>
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
#include <QSvgGenerator>
|
||||
#include <QTextStream>
|
||||
#include <QTransform>
|
||||
|
||||
namespace {
|
||||
|
||||
QTextStream out(stdout);
|
||||
QTextStream err(stderr);
|
||||
|
||||
/// All CLI option flags, mapped to a short format name.
|
||||
const QHash<QString, QString> &exportFlags()
|
||||
{
|
||||
static const QHash<QString, QString> flags {
|
||||
{"--export-pdf", "pdf"},
|
||||
{"--export-png", "png"},
|
||||
{"--export-svg", "svg"},
|
||||
{"--export-cables", "cables"},
|
||||
{"--export-wires", "wires"},
|
||||
{"--export-bom", "bom"},
|
||||
{"--export-nets", "nets"},
|
||||
{"--export-links", "links"},
|
||||
{"--info", "info"},
|
||||
{"--check-elements", "check"},
|
||||
{"--resave", "resave"},
|
||||
{"--set-titleblock", "settb"},
|
||||
};
|
||||
return flags;
|
||||
}
|
||||
|
||||
/// Device tag of an element ("K1", "Q55"), falling back to its name.
|
||||
QString elementLabel(Element *element)
|
||||
{
|
||||
const QString label = element->elementInformations()["label"].toString();
|
||||
return label.isEmpty() ? element->name() : label;
|
||||
}
|
||||
|
||||
/// Pixel rect of a diagram's border + title block (the printable page area).
|
||||
QRect diagramRect(Diagram *diagram)
|
||||
{
|
||||
QRectF r = diagram->border_and_titleblock.borderAndTitleBlockRect();
|
||||
r.adjust(0, 0, 1, 1); // include the 1px border line
|
||||
return r.toAlignedRect();
|
||||
}
|
||||
|
||||
/// A filesystem-safe per-diagram file stem: "01_Title".
|
||||
QString diagramStem(Diagram *diagram, int index)
|
||||
{
|
||||
QString title = diagram->title();
|
||||
title.replace(QRegularExpression("[^\\w \\-]"), "_");
|
||||
title = title.simplified();
|
||||
if (title.isEmpty())
|
||||
title = "diagram";
|
||||
return QStringLiteral("%1_%2")
|
||||
.arg(index, 2, 10, QChar('0'))
|
||||
.arg(title);
|
||||
}
|
||||
|
||||
/// Render @p diagram into @p painter, fitting @p target to the page rect.
|
||||
void renderDiagram(Diagram *diagram, QPainter &painter, const QRectF &target)
|
||||
{
|
||||
const QRect source = diagramRect(diagram);
|
||||
// Export without the editor grid: drawBackground() only paints it when
|
||||
// draw_grid_ is set (default true), so toggle it off around the render
|
||||
// and restore it afterwards.
|
||||
const bool was_drawing_grid = diagram->displayGrid();
|
||||
diagram->setDisplayGrid(false);
|
||||
diagram->render(&painter, target, source, Qt::KeepAspectRatio);
|
||||
diagram->setDisplayGrid(was_drawing_grid);
|
||||
}
|
||||
|
||||
int exportPdf(QETProject &project, const QString &output)
|
||||
{
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
if (diagrams.isEmpty()) {
|
||||
err << "No diagrams to export.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Page numbers (1-based) for cross-reference hyperlink targets: each
|
||||
// diagram is exactly one page in the CLI export (no tiling).
|
||||
QMap<Diagram *, int> pageMap;
|
||||
for (int i = 0; i < diagrams.size(); ++i)
|
||||
pageMap.insert(diagrams.at(i), i + 1);
|
||||
|
||||
QPdfWriter writer(output);
|
||||
writer.setCreator("QElectroTech");
|
||||
writer.setResolution(96);
|
||||
|
||||
QPainter painter;
|
||||
bool first = true;
|
||||
for (Diagram *diagram : diagrams) {
|
||||
const QRect r = diagramRect(diagram);
|
||||
// Match the page to the diagram (in points: 1px @ 96dpi = 0.75pt).
|
||||
const QPageSize page(QSizeF(r.width() * 72.0 / 96.0,
|
||||
r.height() * 72.0 / 96.0),
|
||||
QPageSize::Point);
|
||||
writer.setPageSize(page);
|
||||
writer.setPageMargins(QMarginsF(0, 0, 0, 0));
|
||||
|
||||
if (first) {
|
||||
if (!painter.begin(&writer)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
first = false;
|
||||
} else {
|
||||
writer.newPage();
|
||||
}
|
||||
const QRectF target(0, 0,
|
||||
writer.width(), writer.height());
|
||||
renderDiagram(diagram, painter, target);
|
||||
|
||||
// Inject clickable cross-reference / folio-report hyperlinks for this
|
||||
// page. The geometry is rebuilt from the QPdfWriter (not a QPrinter):
|
||||
// render() anchors the diagram top-left with KeepAspectRatio, and the
|
||||
// page is sized to the diagram so the scale is ~1.
|
||||
if (auto *engine = dynamic_cast<QPdfEngine *>(painter.paintEngine())) {
|
||||
const QRectF source(r);
|
||||
const qreal s = qMin(target.width() / source.width(),
|
||||
target.height() / source.height());
|
||||
QTransform fit;
|
||||
fit.translate(target.x(), target.y());
|
||||
fit.scale(s, s);
|
||||
fit.translate(-source.x(), -source.y());
|
||||
|
||||
// Device pixels -> PDF points, replicating the engine's page matrix
|
||||
// (72/resolution scale + Y flip; zero margins -> no paint offset).
|
||||
const qreal pt_scale = 72.0 / writer.resolution();
|
||||
const qreal fullH_pt = writer.pageLayout().fullRectPoints().height();
|
||||
const bool fullPageMode =
|
||||
(writer.pageLayout().mode() == QPageLayout::FullPageMode);
|
||||
const QRect paintPx =
|
||||
writer.pageLayout().paintRectPixels(writer.resolution());
|
||||
|
||||
PdfLinks::PageGeometry geom;
|
||||
geom.sceneToDevice = fit;
|
||||
geom.target = target;
|
||||
geom.pageBounds = QRectF(0, 0, target.width(), target.height());
|
||||
geom.devToPdf = [=](const QPointF &d) -> QPointF {
|
||||
qreal dx = d.x(), dy = d.y();
|
||||
if (!fullPageMode) { dx += paintPx.left(); dy += paintPx.top(); }
|
||||
return QPointF(pt_scale * dx, fullH_pt - pt_scale * dy);
|
||||
};
|
||||
geom.sourceRectOf = [](Diagram *dg) {
|
||||
return QRectF(diagramRect(dg));
|
||||
};
|
||||
PdfLinks::injectCrossRefLinks(engine, diagram, geom, pageMap, output);
|
||||
}
|
||||
}
|
||||
painter.end();
|
||||
|
||||
// Rewrite the URI link annotations into native internal GoTo actions, so
|
||||
// the cross-references jump inside the document in any PDF viewer.
|
||||
PdfLinks::convertUriToGoTo(output);
|
||||
|
||||
out << "Exported " << diagrams.size() << " page(s) -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exportImages(QETProject &project, const QString &format,
|
||||
const QString &out_dir)
|
||||
{
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
if (diagrams.isEmpty()) {
|
||||
err << "No diagrams to export.\n";
|
||||
return 1;
|
||||
}
|
||||
QDir().mkpath(out_dir);
|
||||
|
||||
int index = 0;
|
||||
for (Diagram *diagram : diagrams) {
|
||||
++index;
|
||||
const QRect r = diagramRect(diagram);
|
||||
const QString path = QDir(out_dir).filePath(
|
||||
diagramStem(diagram, index) + "." + format);
|
||||
|
||||
if (format == "svg") {
|
||||
QSvgGenerator gen;
|
||||
gen.setFileName(path);
|
||||
gen.setSize(r.size());
|
||||
gen.setViewBox(QRect(0, 0, r.width(), r.height()));
|
||||
gen.setTitle(diagram->title());
|
||||
QPainter painter(&gen);
|
||||
renderDiagram(diagram, painter, QRectF(QPointF(0, 0), r.size()));
|
||||
painter.end();
|
||||
} else { // png
|
||||
QImage image(r.size(), QImage::Format_ARGB32);
|
||||
image.fill(Qt::white);
|
||||
QPainter painter(&image);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
renderDiagram(diagram, painter, QRectF(QPointF(0, 0), r.size()));
|
||||
painter.end();
|
||||
if (!image.save(path)) {
|
||||
err << "Failed to write '" << path << "'.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
out << " " << path << "\n";
|
||||
}
|
||||
out << "Exported " << diagrams.size() << " diagram(s) -> " << out_dir << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exportCsv(QETProject &project, const QString &format, const QString &output)
|
||||
{
|
||||
QString csv;
|
||||
if (format == "cables") {
|
||||
WiringListExport wle(&project, nullptr);
|
||||
csv = wle.toCsvString();
|
||||
} else { // wires
|
||||
ConductorNumExport cne(&project, nullptr);
|
||||
csv = cne.wiresNum();
|
||||
}
|
||||
if (csv.isEmpty()) {
|
||||
err << "Nothing to export (empty list).\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << csv;
|
||||
file.close();
|
||||
out << "Exported " << format << " list -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Quote a field for CSV output (RFC-4180 style, ';' delimiter).
|
||||
QString csvField(const QString &value)
|
||||
{
|
||||
if (value.contains(';') || value.contains('"')
|
||||
|| value.contains('\n') || value.contains('\r')) {
|
||||
QString v = value;
|
||||
v.replace('"', "\"\"");
|
||||
return '"' % v % '"';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/// Bill of materials: one row per element, key component-data fields.
|
||||
/// Pulls from QET's own project database (the same source as the GUI BOM
|
||||
/// export), so the output matches what the editor produces.
|
||||
int exportBom(QETProject &project, const QString &output)
|
||||
{
|
||||
// The project database is built lazily; force a (re)build before querying.
|
||||
project.dataBase()->updateDB();
|
||||
|
||||
static const QStringList columns {
|
||||
"label", "designation", "manufacturer", "manufacturer_reference",
|
||||
"quantity", "location", "function", "title", "folio"
|
||||
};
|
||||
|
||||
QSqlQuery query = project.dataBase()->newQuery(
|
||||
"SELECT " % columns.join(", ") %
|
||||
" FROM element_nomenclature_view ORDER BY label");
|
||||
if (!query.exec()) {
|
||||
err << "BOM query failed: " << query.lastError().text() << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
QString csv = columns.join(";") % "\n";
|
||||
int rows = 0;
|
||||
while (query.next()) {
|
||||
QStringList values;
|
||||
for (int i = 0; i < columns.size(); ++i)
|
||||
values << csvField(query.value(i).toString());
|
||||
csv += values.join(";") % "\n";
|
||||
++rows;
|
||||
}
|
||||
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << csv;
|
||||
file.close();
|
||||
out << "Exported " << rows << " component(s) -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Count terminals on @p element that no conductor connects to.
|
||||
int freeTerminals(Element *element)
|
||||
{
|
||||
int free = 0;
|
||||
const QList<Terminal *> terminals = element->terminals();
|
||||
for (Terminal *t : terminals)
|
||||
if (t->conductorsCount() == 0)
|
||||
++free;
|
||||
return free;
|
||||
}
|
||||
|
||||
/// Structural ground-truth dump of a project, as JSON, to stdout (or a file).
|
||||
/// Uses QET's own loaded model, so it reports what the editor actually sees:
|
||||
/// per-page element / conductor counts and unconnected terminals.
|
||||
int exportInfo(QETProject &project, const QString &output)
|
||||
{
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
|
||||
int total_elements = 0, total_conductors = 0, total_free = 0;
|
||||
QJsonArray pages;
|
||||
int index = 0;
|
||||
for (Diagram *diagram : diagrams) {
|
||||
++index;
|
||||
const QList<Element *> elements = diagram->elements();
|
||||
const int conductors = diagram->conductors().size();
|
||||
int page_free = 0;
|
||||
for (Element *e : elements)
|
||||
page_free += freeTerminals(e);
|
||||
|
||||
const QRect r = diagramRect(diagram);
|
||||
QJsonObject page;
|
||||
page["index"] = index;
|
||||
page["title"] = diagram->title();
|
||||
page["folio"] = QStringLiteral("%1 of %2")
|
||||
.arg(index).arg(diagrams.size());
|
||||
page["width_px"] = r.width();
|
||||
page["height_px"] = r.height();
|
||||
page["elements"] = elements.size();
|
||||
page["conductors"] = conductors;
|
||||
page["free_terminals"] = page_free;
|
||||
pages.append(page);
|
||||
|
||||
total_elements += elements.size();
|
||||
total_conductors += conductors;
|
||||
total_free += page_free;
|
||||
}
|
||||
|
||||
QJsonObject root;
|
||||
root["project"] = project.title();
|
||||
root["diagrams"] = diagrams.size();
|
||||
root["elements"] = total_elements;
|
||||
root["conductors"] = total_conductors;
|
||||
root["free_terminals"] = total_free;
|
||||
root["pages"] = pages;
|
||||
|
||||
const QByteArray json =
|
||||
QJsonDocument(root).toJson(QJsonDocument::Indented);
|
||||
|
||||
if (output.isEmpty()) {
|
||||
out << QString::fromUtf8(json);
|
||||
} else {
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
file.write(json);
|
||||
file.close();
|
||||
out << "Wrote project info -> " << output << "\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Validate one .elmt file against QET's element schema.
|
||||
/// @return 0 = OK, 1 = warning (loads but suspicious), 2 = failure.
|
||||
int checkOneElement(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
out << "FAIL " << path << " (cannot open)\n";
|
||||
return 2;
|
||||
}
|
||||
QDomDocument doc;
|
||||
QString error;
|
||||
int line = 0;
|
||||
if (!doc.setContent(&file, &error, &line)) {
|
||||
file.close();
|
||||
out << "FAIL " << path << " (XML error line "
|
||||
<< line << ": " << error << ")\n";
|
||||
return 2;
|
||||
}
|
||||
file.close();
|
||||
|
||||
const QDomElement root = doc.documentElement();
|
||||
if (root.tagName() != "definition" || root.attribute("type") != "element") {
|
||||
out << "FAIL " << path << " (root is not <definition type=\"element\">)\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
bool w_ok = false, h_ok = false;
|
||||
const double w = root.attribute("width").toDouble(&w_ok);
|
||||
const double h = root.attribute("height").toDouble(&h_ok);
|
||||
if (!w_ok || !h_ok || w == 0 || h == 0) {
|
||||
out << "FAIL " << path << " (missing/zero bounding box "
|
||||
<< root.attribute("width") << "x"
|
||||
<< root.attribute("height") << ")\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
const int terminals = root.elementsByTagName("terminal").count();
|
||||
|
||||
// Negative dimensions are malformed but QET still loads them; surface as a
|
||||
// warning rather than a failure so this agrees with QET's own loader.
|
||||
if (w < 0 || h < 0) {
|
||||
out << "WARN " << path << " (negative bounding box "
|
||||
<< w << "x" << h << ", " << terminals << " terminals)\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (terminals == 0) {
|
||||
out << "WARN " << path << " (loads, but 0 terminals)\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
out << "OK " << path << " (" << terminals << " terminals)\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Validate a single .elmt file or every .elmt under a directory.
|
||||
int checkElements(const QString &path)
|
||||
{
|
||||
QStringList files;
|
||||
const QFileInfo info(path);
|
||||
if (info.isDir()) {
|
||||
QDirIterator it(path, {"*.elmt"}, QDir::Files,
|
||||
QDirIterator::Subdirectories);
|
||||
while (it.hasNext())
|
||||
files << it.next();
|
||||
files.sort();
|
||||
} else if (info.isFile()) {
|
||||
files << path;
|
||||
} else {
|
||||
err << "Not found: " << path << "\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (files.isEmpty()) {
|
||||
err << "No .elmt files found under: " << path << "\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
int warnings = 0, failures = 0;
|
||||
for (const QString &f : files) {
|
||||
const int r = checkOneElement(f);
|
||||
if (r == 1) ++warnings;
|
||||
else if (r == 2) ++failures;
|
||||
}
|
||||
out << files.size() << " file(s), " << warnings
|
||||
<< " warning(s), " << failures << " failure(s)\n";
|
||||
return failures > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
/// Map every element in the project to its 1-based folio (page) position.
|
||||
QHash<Element *, int> folioIndex(QETProject &project)
|
||||
{
|
||||
QHash<Element *, int> folio;
|
||||
int index = 0;
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
for (Diagram *diagram : diagrams) {
|
||||
++index;
|
||||
const QList<Element *> elements = diagram->elements();
|
||||
for (Element *e : elements)
|
||||
folio.insert(e, index);
|
||||
}
|
||||
return folio;
|
||||
}
|
||||
|
||||
/// Electrical nets: groups of terminals joined into one potential.
|
||||
/// Walks QET's own potential graph, so each net is a connected component
|
||||
/// of terminals across all folios. The ground truth for connectivity.
|
||||
int exportNets(QETProject &project, const QString &output)
|
||||
{
|
||||
const QHash<Element *, int> folio = folioIndex(project);
|
||||
|
||||
QList<Conductor *> all_conductors;
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
for (Diagram *diagram : diagrams)
|
||||
all_conductors << diagram->conductors();
|
||||
|
||||
QSet<Conductor *> visited;
|
||||
QJsonArray nets;
|
||||
int net_no = 0;
|
||||
for (Conductor *c : all_conductors) {
|
||||
if (visited.contains(c))
|
||||
continue;
|
||||
|
||||
// The whole potential this conductor belongs to. relatedPotential-
|
||||
// Conductors() also fills t_list with every terminal in the net
|
||||
// (following folio reports and terminal blocks too).
|
||||
QList<Terminal *> t_list;
|
||||
QSet<Conductor *> group = c->relatedPotentialConductors(true, &t_list);
|
||||
group.insert(c);
|
||||
for (Conductor *g : group)
|
||||
visited.insert(g);
|
||||
if (c->terminal1) t_list << c->terminal1;
|
||||
if (c->terminal2) t_list << c->terminal2;
|
||||
|
||||
// Wire number: smallest non-empty conductor text (deterministic).
|
||||
QStringList wire_nos;
|
||||
for (Conductor *g : group)
|
||||
if (!g->properties().text.isEmpty())
|
||||
wire_nos << g->properties().text;
|
||||
wire_nos.sort();
|
||||
|
||||
++net_no;
|
||||
QJsonArray terminals;
|
||||
QSet<Terminal *> seen;
|
||||
for (Terminal *t : t_list) {
|
||||
if (!t || seen.contains(t))
|
||||
continue;
|
||||
seen.insert(t);
|
||||
Element *pe = t->parentElement();
|
||||
QJsonObject to;
|
||||
to["element"] = pe ? elementLabel(pe) : QString();
|
||||
to["terminal"] = t->name();
|
||||
to["folio"] = pe ? folio.value(pe, 0) : 0;
|
||||
terminals.append(to);
|
||||
}
|
||||
QJsonObject net;
|
||||
net["net"] = net_no;
|
||||
net["wire_no"] = wire_nos.value(0);
|
||||
net["terminals"] = terminals;
|
||||
nets.append(net);
|
||||
}
|
||||
|
||||
QJsonObject root;
|
||||
root["project"] = project.title();
|
||||
root["nets"] = nets.size();
|
||||
root["list"] = nets;
|
||||
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
file.write(QJsonDocument(root).toJson(QJsonDocument::Indented));
|
||||
file.close();
|
||||
out << "Exported " << nets.size() << " net(s) -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Cross-references: each linkable element (coil / contact / report) and the
|
||||
/// elements it links to, flagging masters/slaves with no link as unresolved.
|
||||
int exportLinks(QETProject &project, const QString &output)
|
||||
{
|
||||
const QHash<Element *, int> folio = folioIndex(project);
|
||||
|
||||
QString csv("element;link_type;linked_to;folio;status\n");
|
||||
int linkable = 0, unresolved = 0;
|
||||
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
for (Diagram *diagram : diagrams) {
|
||||
const QList<Element *> elements = diagram->elements();
|
||||
for (Element *e : elements) {
|
||||
if (e->linkType() == Element::Simple)
|
||||
continue;
|
||||
++linkable;
|
||||
|
||||
const QList<Element *> linked = e->linkedElements();
|
||||
QStringList names;
|
||||
for (Element *le : linked)
|
||||
names << elementLabel(le) % "(f"
|
||||
% QString::number(folio.value(le, 0)) % ")";
|
||||
|
||||
QString status = "linked";
|
||||
if ((e->linkType() == Element::Master
|
||||
|| e->linkType() == Element::Slave)
|
||||
&& linked.isEmpty()) {
|
||||
status = "UNRESOLVED";
|
||||
++unresolved;
|
||||
}
|
||||
|
||||
csv += csvField(elementLabel(e)) % ";"
|
||||
% e->linkTypeToString() % ";"
|
||||
% csvField(names.join(", ")) % ";"
|
||||
% QString::number(folio.value(e, 0)) % ";"
|
||||
% status % "\n";
|
||||
}
|
||||
}
|
||||
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << csv;
|
||||
file.close();
|
||||
out << "Exported " << linkable << " linkable element(s), "
|
||||
<< unresolved << " unresolved -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Round-trip: load the project and write its XML back out, so an external
|
||||
/// diff can reveal markup QET silently normalises (tolerated-but-invalid XML).
|
||||
int resaveProject(QETProject &project, const QString &output)
|
||||
{
|
||||
const QDomDocument doc = project.toXml();
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << doc.toString(4);
|
||||
file.close();
|
||||
out << "Re-saved project -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Stamp title-block fields onto every folio (and the project default), then
|
||||
/// save. Each assignment is "key=value". Standard keys map to the documented
|
||||
/// title-block fields; "date=today" uses the current date; any other key is
|
||||
/// stored as a custom title-block field. Aimed at CI/revision workflows
|
||||
/// (e.g. set revision + date before exporting a new revision).
|
||||
int setTitleBlock(QETProject &project, const QString &output,
|
||||
const QStringList &assignments)
|
||||
{
|
||||
if (assignments.isEmpty()) {
|
||||
err << "No field assignments given (expected key=value).\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Parse "key=value" assignments up front so a bad one fails before writing.
|
||||
QList<QPair<QString, QString>> fields;
|
||||
for (const QString &a : assignments) {
|
||||
const int eq = a.indexOf('=');
|
||||
if (eq <= 0) {
|
||||
err << "Bad assignment '" << a << "' (expected key=value).\n";
|
||||
return 2;
|
||||
}
|
||||
const QString key = a.left(eq);
|
||||
const QString val = a.mid(eq + 1);
|
||||
if (key.compare("date", Qt::CaseInsensitive) == 0
|
||||
&& val.compare("today", Qt::CaseInsensitive) != 0
|
||||
&& !QDate::fromString(val, Qt::ISODate).isValid()) {
|
||||
err << "Bad date '" << val << "' (expected YYYY-MM-DD or 'today').\n";
|
||||
return 2;
|
||||
}
|
||||
fields << qMakePair(key, val);
|
||||
}
|
||||
|
||||
auto apply = [&](TitleBlockProperties &p) {
|
||||
for (const auto &f : fields) {
|
||||
const QString k = f.first.toLower();
|
||||
const QString &v = f.second;
|
||||
if (k == "title") p.title = v;
|
||||
else if (k == "author") p.author = v;
|
||||
else if (k == "filename") p.filename = v;
|
||||
else if (k == "plant") p.plant = v;
|
||||
else if (k == "location") p.locmach = v;
|
||||
else if (k == "revision") p.indexrev = v;
|
||||
else if (k == "version") p.version = v;
|
||||
else if (k == "date") {
|
||||
p.date = (v.compare("today", Qt::CaseInsensitive) == 0)
|
||||
? QDate::currentDate()
|
||||
: QDate::fromString(v, Qt::ISODate);
|
||||
// An explicit date is only honoured when the folio is in
|
||||
// "use the date value" mode (not "now"/"null").
|
||||
p.useDate = TitleBlockProperties::UseDateValue;
|
||||
}
|
||||
else // unknown key -> custom title-block field
|
||||
p.context.addValue(f.first, v);
|
||||
}
|
||||
};
|
||||
|
||||
// Project default (the template applied to new folios).
|
||||
TitleBlockProperties def = project.defaultTitleBlockProperties();
|
||||
apply(def);
|
||||
project.setDefaultTitleBlockProperties(def);
|
||||
|
||||
// Every existing folio's own title block.
|
||||
int folios = 0;
|
||||
const QList<Diagram *> diagrams = project.diagrams();
|
||||
for (Diagram *diagram : diagrams) {
|
||||
TitleBlockProperties p =
|
||||
diagram->border_and_titleblock.exportTitleBlock();
|
||||
apply(p);
|
||||
diagram->border_and_titleblock.importTitleBlock(p);
|
||||
++folios;
|
||||
}
|
||||
|
||||
const QDomDocument doc = project.toXml();
|
||||
QFile file(output);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
err << "Cannot open '" << output << "' for writing.\n";
|
||||
return 1;
|
||||
}
|
||||
QTextStream fout(&file);
|
||||
fout << doc.toString(4);
|
||||
file.close();
|
||||
out << "Stamped " << fields.size() << " field(s) on "
|
||||
<< folios << " folio(s) -> " << output << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace CLIExport {
|
||||
|
||||
bool isExportRequest(const QStringList &args)
|
||||
{
|
||||
for (const QString &a : args)
|
||||
if (exportFlags().contains(a))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int run(const QStringList &args)
|
||||
{
|
||||
QString flag;
|
||||
QStringList rest;
|
||||
for (int i = 0; i < args.size(); ++i) {
|
||||
if (exportFlags().contains(args.at(i))) {
|
||||
flag = args.at(i);
|
||||
for (int j = i + 1; j < args.size(); ++j)
|
||||
rest << args.at(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const QString format = exportFlags().value(flag);
|
||||
|
||||
// --check-elements operates on an element file/directory, not a project.
|
||||
if (format == "check") {
|
||||
if (rest.isEmpty()) {
|
||||
err << "Usage: qelectrotech --check-elements "
|
||||
"<element.elmt | directory>\n";
|
||||
return 2;
|
||||
}
|
||||
return checkElements(rest.at(0));
|
||||
}
|
||||
|
||||
const QString input = rest.value(0);
|
||||
if (input.isEmpty()) {
|
||||
err << "Usage: qelectrotech " << flag << " <project.qet> <output>\n";
|
||||
return 2;
|
||||
}
|
||||
if (!QFileInfo::exists(input)) {
|
||||
err << "Project not found: " << input << "\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
QETProject project(input);
|
||||
if (project.state() != QETProject::Ok) {
|
||||
err << "Failed to open project: " << input
|
||||
<< " (state " << project.state() << ")\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// --info writes JSON to stdout, or to an optional output file.
|
||||
if (format == "info")
|
||||
return exportInfo(project, rest.value(1));
|
||||
|
||||
const QString output = rest.value(1);
|
||||
if (output.isEmpty()) {
|
||||
err << "Usage: qelectrotech " << flag
|
||||
<< " <project.qet> <output>\n";
|
||||
return 2;
|
||||
}
|
||||
if (format == "pdf")
|
||||
return exportPdf(project, output);
|
||||
if (format == "cables" || format == "wires")
|
||||
return exportCsv(project, format, output);
|
||||
if (format == "bom")
|
||||
return exportBom(project, output);
|
||||
if (format == "nets")
|
||||
return exportNets(project, output);
|
||||
if (format == "links")
|
||||
return exportLinks(project, output);
|
||||
if (format == "resave")
|
||||
return resaveProject(project, output);
|
||||
if (format == "settb")
|
||||
return setTitleBlock(project, output, rest.mid(2));
|
||||
return exportImages(project, format, output);
|
||||
}
|
||||
|
||||
} // namespace CLIExport
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright 2006-2025 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CLI_EXPORT_H
|
||||
#define CLI_EXPORT_H
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
/**
|
||||
@brief Headless command-line export.
|
||||
|
||||
Implements the long-requested batch/headless export
|
||||
(qelectrotech.org bugtracker #171, GitHub #309): render a project's
|
||||
diagrams to files without opening the GUI.
|
||||
|
||||
Detected and handled in main() before the GUI is created.
|
||||
*/
|
||||
namespace CLIExport {
|
||||
|
||||
/**
|
||||
@brief True if @p args request a CLI export
|
||||
(i.e. contain one of the export options).
|
||||
*/
|
||||
bool isExportRequest(const QStringList &args);
|
||||
|
||||
/**
|
||||
@brief Run the CLI export described by @p args.
|
||||
@return process exit code (0 on success).
|
||||
|
||||
Usage:
|
||||
qelectrotech --export-pdf <project.qet> <output.pdf>
|
||||
qelectrotech --export-png <project.qet> <output_dir>
|
||||
qelectrotech --export-svg <project.qet> <output_dir>
|
||||
qelectrotech --export-cables <project.qet> <output.csv>
|
||||
qelectrotech --export-wires <project.qet> <output.csv>
|
||||
qelectrotech --export-bom <project.qet> <output.csv>
|
||||
qelectrotech --export-nets <project.qet> <output.json>
|
||||
qelectrotech --export-links <project.qet> <output.csv>
|
||||
qelectrotech --info <project.qet> [output.json]
|
||||
qelectrotech --check-elements <element.elmt | directory>
|
||||
qelectrotech --resave <project.qet> <output.qet>
|
||||
qelectrotech --set-titleblock <project.qet> <output.qet> key=value...
|
||||
|
||||
PDF: one multi-page document (one diagram per page).
|
||||
PNG/SVG: one file per diagram, named <output_dir>/<NN>_<title>.<ext>.
|
||||
cables: wiring list (one row per conductor) as CSV.
|
||||
wires: list of distinct wire numbers as CSV.
|
||||
bom: bill of materials (one row per element) as CSV.
|
||||
nets: electrical nets (connected-terminal groups) as JSON.
|
||||
links: element cross-references (coil/contact) as CSV, with
|
||||
unresolved links flagged.
|
||||
info: structural project summary as JSON (stdout, or a file) —
|
||||
per-page element / conductor counts and unconnected terminals.
|
||||
check-elements: validate .elmt file(s) against the element schema.
|
||||
resave: load and rewrite the project XML (round-trip integrity).
|
||||
set-titleblock: stamp title-block fields onto every folio, then save.
|
||||
Keys: title, author, date (or date=today), plant, location,
|
||||
revision, version, filename; any other key becomes a custom
|
||||
field. E.g. --set-titleblock in.qet out.qet revision=B date=today
|
||||
*/
|
||||
int run(const QStringList &args);
|
||||
|
||||
}
|
||||
|
||||
#endif // CLI_EXPORT_H
|
||||
+3
-2
@@ -142,10 +142,11 @@ class Diagram : public QGraphicsScene
|
||||
void wheelEvent (QGraphicsSceneWheelEvent *event) override;
|
||||
void keyPressEvent (QKeyEvent *event) override;
|
||||
void keyReleaseEvent (QKeyEvent *) override;
|
||||
void correctTextPos(Element* elmt);
|
||||
void restoreText(Element* elmt);
|
||||
|
||||
|
||||
public:
|
||||
void correctTextPos(Element* elmt);
|
||||
void restoreText(Element* elmt);
|
||||
QUuid uuid();
|
||||
void setEventInterface (DiagramEventInterface *event_interface);
|
||||
void clearEventInterface();
|
||||
|
||||
@@ -313,6 +313,12 @@ void PartText::setPlainText(const QString &text) {
|
||||
void PartText::setFont(const QFont &font) {
|
||||
if (font != this -> font()) {
|
||||
QGraphicsTextItem::setFont(font);
|
||||
// Re-anchor: the item's position transform is -margin(), and margin()
|
||||
// depends on the font ascent. Without re-running this on a font change,
|
||||
// the transform keeps the previous font's ascent — so the text renders
|
||||
// at a different spot after save/reopen (the position recomputes from
|
||||
// the saved font on load). See #158.
|
||||
adjustItemPosition();
|
||||
emit fontChanged(font);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,17 @@ void ElementDialog::setUpWidget()
|
||||
} else if (m_mode == SaveTemplate) {
|
||||
m_text_field->setPlaceholderText(tr("Nom du nouveau template"));
|
||||
} else {
|
||||
m_text_field->setPlaceholderText(tr("Nom du nouvel élément"));
|
||||
// This is the element's file name, not its display name: the field
|
||||
// only accepts file-name characters (QFileNameEdit). The visible
|
||||
// element name is edited separately in the element properties.
|
||||
m_text_field->setPlaceholderText(
|
||||
tr("Nom de fichier de l'élément",
|
||||
"placeholder: the element's file name, not its display name"));
|
||||
m_text_field->setToolTip(
|
||||
tr("Nom de fichier de l'élément : chiffres, minuscules, « - », "
|
||||
"« _ » et « . » uniquement.\nLe nom affiché de l'élément se "
|
||||
"modifie séparément dans les propriétés de l'élément.",
|
||||
"tooltip for the element file-name field"));
|
||||
}
|
||||
|
||||
layout->addWidget(m_text_field);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementspanelwidget.h"
|
||||
|
||||
#include "diagram.h"
|
||||
#include "editor/ui/qetelementeditor.h"
|
||||
#include "elementscategoryeditor.h"
|
||||
@@ -26,6 +25,7 @@
|
||||
#include "titleblock/templatedeleter.h"
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include "qetgraphicsitem/element.h"
|
||||
|
||||
/*
|
||||
When the ENABLE_PANEL_WIDGET_DND_CHECKS flag is set, the panel
|
||||
@@ -59,7 +59,8 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
||||
prj_close = new QAction(QET::Icons::DocumentClose, tr("Fermer ce projet"), this);
|
||||
prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propriétés du projet"), this);
|
||||
prj_prop_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
|
||||
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
|
||||
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
|
||||
prj_duplicate_diagram = new QAction(QET::Icons::IC_CopyFile, tr("Copier et coller"), this);
|
||||
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce folio"), this);
|
||||
prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce folio"), this);
|
||||
prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio"), this);
|
||||
@@ -100,6 +101,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
||||
connect(prj_prop_diagram, SIGNAL(triggered()), this, SLOT(editDiagramProperties()));
|
||||
connect(prj_add_diagram, SIGNAL(triggered()), this, SLOT(newDiagram()));
|
||||
connect(prj_del_diagram, SIGNAL(triggered()), this, SLOT(deleteDiagram()));
|
||||
connect(prj_duplicate_diagram, SIGNAL(triggered()), this, SLOT(duplicateDiagram()));
|
||||
connect(prj_move_diagram_up, SIGNAL(triggered()), this, SLOT(moveDiagramUp()));
|
||||
connect(prj_move_diagram_down, SIGNAL(triggered()), this, SLOT(moveDiagramDown()));
|
||||
connect(prj_move_diagram_top, SIGNAL(triggered()), this, SLOT(moveDiagramUpTop()));
|
||||
@@ -447,7 +449,8 @@ void ElementsPanelWidget::updateButtons()
|
||||
}
|
||||
|
||||
prj_del_diagram -> setEnabled(is_writable);
|
||||
prj_move_diagram_up -> setEnabled(is_writable && min_position > 0);
|
||||
prj_duplicate_diagram -> setEnabled(is_writable);
|
||||
prj_move_diagram_up -> setEnabled(is_writable && min_position > 0);
|
||||
prj_move_diagram_down -> setEnabled(is_writable && max_position < project_diagrams_count - 1);
|
||||
prj_move_diagram_top -> setEnabled(is_writable && min_position > 0);
|
||||
|
||||
@@ -501,6 +504,7 @@ void ElementsPanelWidget::handleContextMenu(const QPoint &pos) {
|
||||
case QET::Diagram:
|
||||
context_menu -> addAction(prj_prop_diagram);
|
||||
context_menu -> addAction(prj_del_diagram);
|
||||
context_menu -> addAction(prj_duplicate_diagram);
|
||||
context_menu -> addAction(prj_move_diagram_top);
|
||||
context_menu -> addAction(prj_move_diagram_upx10);
|
||||
context_menu -> addAction(prj_move_diagram_upx100);
|
||||
@@ -593,3 +597,56 @@ void ElementsPanelWidget::keyPressEvent(QKeyEvent *e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates the selected folios (pages) along with their content
|
||||
* and properties, and cleanly resolves cross-references.
|
||||
*/
|
||||
void ElementsPanelWidget::duplicateDiagram()
|
||||
{
|
||||
QList<Diagram *> diagrams_to_duplicate = elements_panel->selectedDiagrams();
|
||||
if (diagrams_to_duplicate.isEmpty()) return;
|
||||
|
||||
QETProject *project = diagrams_to_duplicate.first()->project();
|
||||
if (!project || project->isReadOnly()) return;
|
||||
|
||||
for (Diagram *source_diagram : diagrams_to_duplicate) {
|
||||
|
||||
Diagram *new_diagram = project->addNewDiagram();
|
||||
if (!new_diagram) continue;
|
||||
|
||||
QString template_name = source_diagram->border_and_titleblock.titleBlockTemplateName();
|
||||
new_diagram->setTitleBlockTemplate(template_name);
|
||||
|
||||
TitleBlockProperties tbp = source_diagram->border_and_titleblock.exportTitleBlock();
|
||||
new_diagram->border_and_titleblock.importTitleBlock(tbp);
|
||||
|
||||
BorderProperties bp = source_diagram->border_and_titleblock.exportBorder();
|
||||
new_diagram->border_and_titleblock.importBorder(bp);
|
||||
|
||||
for (QGraphicsItem *item : source_diagram->items()) {
|
||||
if (Element *elmt = dynamic_cast<Element *>(item)) {
|
||||
source_diagram->correctTextPos(elmt);
|
||||
}
|
||||
}
|
||||
|
||||
QDomDocument doc = source_diagram->toXml();
|
||||
QDomElement diagram_elmt = doc.documentElement();
|
||||
|
||||
for (QGraphicsItem *item : source_diagram->items()) {
|
||||
if (Element *elmt = dynamic_cast<Element *>(item)) {
|
||||
source_diagram->restoreText(elmt);
|
||||
}
|
||||
}
|
||||
|
||||
new_diagram->fromXml(diagram_elmt, QPointF(0, 0), false, nullptr);
|
||||
|
||||
for (QGraphicsItem *item : new_diagram->items()) {
|
||||
if (Element *elmt = dynamic_cast<Element *>(item)) {
|
||||
new_diagram->restoreText(elmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elements_panel->reload();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ class ElementsPanelWidget : public QWidget {
|
||||
*prj_prop_diagram,
|
||||
*prj_add_diagram,
|
||||
*prj_del_diagram,
|
||||
*prj_duplicate_diagram,
|
||||
*prj_move_diagram_up,
|
||||
*prj_move_diagram_top,
|
||||
*prj_move_diagram_down,
|
||||
@@ -88,6 +89,7 @@ class ElementsPanelWidget : public QWidget {
|
||||
void editDiagramProperties();
|
||||
void newDiagram();
|
||||
void deleteDiagram();
|
||||
void duplicateDiagram();
|
||||
void moveDiagramUp();
|
||||
void moveDiagramDown();
|
||||
void moveDiagramUpTop();
|
||||
|
||||
@@ -15,13 +15,17 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "cli_export.h"
|
||||
#include "machine_info.h"
|
||||
#include "qet.h"
|
||||
#include "qetapp.h"
|
||||
#include "qetproject.h"
|
||||
#include "singleapplication.h"
|
||||
#include "utils/macosxopenevent.h"
|
||||
#include "utils/qetsettings.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include <QStyleFactory>
|
||||
#include <QtConcurrentRun>
|
||||
|
||||
@@ -194,6 +198,23 @@ QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFacto
|
||||
#endif
|
||||
|
||||
|
||||
// Headless command-line export: render a project to PDF/PNG/SVG without
|
||||
// opening the GUI, then exit. Must be handled before SingleApplication
|
||||
// (which would forward the args to an already-running instance).
|
||||
{
|
||||
QStringList raw_args;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
raw_args << QString::fromLocal8Bit(argv[i]);
|
||||
if (CLIExport::isExportRequest(raw_args)) {
|
||||
QApplication export_app(argc, argv);
|
||||
// No crash-recovery backups in one-shot CLI mode: the backup write
|
||||
// runs on a background thread referencing the project and races the
|
||||
// process exit (intermittent segfault in QET::writeToFile).
|
||||
QETProject::setBackupEnabled(false);
|
||||
return CLIExport::run(export_app.arguments());
|
||||
}
|
||||
}
|
||||
|
||||
SingleApplication app(argc, argv, true);
|
||||
#ifdef Q_OS_MACOS
|
||||
//Handle the opening of QET when user double click on a .qet .elmt .tbt file
|
||||
|
||||
@@ -0,0 +1,382 @@
|
||||
/*
|
||||
Copyright 2006-2025 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pdf_links.h"
|
||||
|
||||
#include "diagram.h"
|
||||
#include "qetgraphicsitem/crossrefitem.h"
|
||||
#include "qetgraphicsitem/dynamicelementtextitem.h"
|
||||
#include "qetgraphicsitem/element.h"
|
||||
#include "qetgraphicsitem/elementtextitemgroup.h"
|
||||
|
||||
// Private Qt PDF engine for drawHyperlink() — not public API, stable since Qt4.
|
||||
// Requires QT += gui-private in qelectrotech.pro / gui-private in CMake.
|
||||
#include <private/qpdf_p.h>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QFile>
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QList>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
|
||||
namespace PdfLinks {
|
||||
|
||||
void injectCrossRefLinks(QPdfEngine *engine, Diagram *diagram,
|
||||
const PageGeometry &geom,
|
||||
const QMap<Diagram *, int> &pageMap,
|
||||
const QString &outputFileName)
|
||||
{
|
||||
if (!engine || !diagram)
|
||||
return;
|
||||
|
||||
const QTransform &fit = geom.sceneToDevice;
|
||||
const QRectF &target = geom.target;
|
||||
const QRectF &pageBounds = geom.pageBounds;
|
||||
|
||||
// Compute, in PDF points on its OWN page, the rectangle to frame for a
|
||||
// target element (used as a /FitR destination so the link zooms onto it).
|
||||
auto destRectPdf = [&](Element *tgt) -> QRectF {
|
||||
Diagram *dg = tgt ? tgt->diagram() : nullptr;
|
||||
if (!dg) return QRectF();
|
||||
const QRectF srcT = geom.sourceRectOf(dg);
|
||||
if (srcT.width() <= 0.0 || srcT.height() <= 0.0) return QRectF();
|
||||
const qreal sT = qMin(target.width() / srcT.width(),
|
||||
target.height() / srcT.height());
|
||||
QTransform fitT;
|
||||
fitT.translate(target.x(), target.y());
|
||||
fitT.scale(sT, sT);
|
||||
fitT.translate(-srcT.x(), -srcT.y());
|
||||
|
||||
QRectF elemScene = tgt->mapRectToScene(tgt->boundingRect());
|
||||
// Frame the element with a little context, and enforce a minimum
|
||||
// framed size so tiny contacts don't zoom in extremely.
|
||||
const qreal pad = 25.0;
|
||||
elemScene.adjust(-pad, -pad, pad, pad);
|
||||
const qreal minSide = 160.0;
|
||||
if (elemScene.width() < minSide)
|
||||
elemScene.adjust(-(minSide - elemScene.width()) / 2.0, 0,
|
||||
(minSide - elemScene.width()) / 2.0, 0);
|
||||
if (elemScene.height() < minSide)
|
||||
elemScene.adjust(0, -(minSide - elemScene.height()) / 2.0,
|
||||
0, (minSide - elemScene.height()) / 2.0);
|
||||
|
||||
const QRectF devT = fitT.mapRect(elemScene);
|
||||
const QPointF a = geom.devToPdf(devT.topLeft());
|
||||
const QPointF b = geom.devToPdf(devT.bottomRight());
|
||||
return QRectF(QPointF(qMin(a.x(), b.x()), qMin(a.y(), b.y())),
|
||||
QPointF(qMax(a.x(), b.x()), qMax(a.y(), b.y())));
|
||||
};
|
||||
|
||||
auto injectLink = [&](const QRectF &sceneRect, Element *targetElmt) {
|
||||
if (!targetElmt || !targetElmt->diagram()) return;
|
||||
const int targetPage = pageMap.value(targetElmt->diagram(), -1);
|
||||
if (targetPage < 1) return;
|
||||
const QRectF devRect = fit.mapRect(sceneRect);
|
||||
if (!devRect.isValid() || !pageBounds.intersects(devRect)) return;
|
||||
|
||||
QString frag = QString("page=%1").arg(targetPage);
|
||||
const QRectF d = destRectPdf(targetElmt); // /FitR L_B_R_T
|
||||
if (d.isValid())
|
||||
frag += QString("&fitr=%1_%2_%3_%4")
|
||||
.arg(qRound(d.left())).arg(qRound(d.top()))
|
||||
.arg(qRound(d.right())).arg(qRound(d.bottom()));
|
||||
|
||||
QUrl url = QUrl::fromLocalFile(outputFileName);
|
||||
url.setFragment(frag);
|
||||
engine->drawHyperlink(devRect, url);
|
||||
};
|
||||
|
||||
for (auto *item : diagram->items()) {
|
||||
|
||||
// --- CrossRefItem links ---
|
||||
if (auto *xref = dynamic_cast<CrossRefItem*>(item)) {
|
||||
for (auto it = xref->hoveredContactsMap().begin();
|
||||
it != xref->hoveredContactsMap().end(); ++it)
|
||||
{
|
||||
Element *targetElmt = it.key();
|
||||
if (!targetElmt || !targetElmt->diagram()) continue;
|
||||
// it.value() is in the CrossRefItem's LOCAL coords -> scene
|
||||
injectLink(xref->mapRectToScene(it.value()), targetElmt);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// --- Folio report links (DynamicElementTextItem) ---
|
||||
if (auto *deti = dynamic_cast<DynamicElementTextItem*>(item)) {
|
||||
Element *parent = deti->parentElement();
|
||||
if (!parent) continue;
|
||||
|
||||
// (a) Report element : label -> linked report on another folio
|
||||
if (parent->linkType() & Element::AllReport) {
|
||||
if (parent->linkedElements().isEmpty()) continue;
|
||||
|
||||
bool showsLabel =
|
||||
(deti->textFrom() == DynamicElementTextItem::ElementInfo
|
||||
&& deti->infoName() == QLatin1String("label")) ||
|
||||
(deti->textFrom() == DynamicElementTextItem::CompositeText
|
||||
&& deti->compositeText().contains(QStringLiteral("%{label}")));
|
||||
if (!showsLabel) continue;
|
||||
|
||||
Element *targetElmt = parent->linkedElements().first();
|
||||
if (!targetElmt || !targetElmt->diagram()) continue;
|
||||
|
||||
injectLink(deti->mapRectToScene(deti->boundingRect()), targetElmt);
|
||||
continue;
|
||||
}
|
||||
|
||||
// (b) Slave element : the "(folio-pos)" text -> master element
|
||||
if (parent->linkType() == Element::Slave) {
|
||||
QGraphicsTextItem *sx = deti->slaveXrefItem();
|
||||
Element *master = deti->masterElement();
|
||||
if (sx && master && master->diagram()) {
|
||||
injectLink(sx->mapRectToScene(sx->boundingRect()), master);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// --- Slave cross-reference carried by a grouped text ---
|
||||
if (auto *grp = dynamic_cast<ElementTextItemGroup*>(item)) {
|
||||
Element *parent = grp->parentElement();
|
||||
if (!parent || parent->linkType() != Element::Slave) continue;
|
||||
if (parent->linkedElements().isEmpty()) continue;
|
||||
QGraphicsTextItem *sx = grp->slaveXrefItem();
|
||||
if (!sx) continue;
|
||||
Element *master = parent->linkedElements().first();
|
||||
if (!master || !master->diagram()) continue;
|
||||
injectLink(sx->mapRectToScene(sx->boundingRect()), master);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void convertUriToGoTo(const QString &pdfPath)
|
||||
{
|
||||
// --- 1. Read raw bytes ---
|
||||
QFile f(pdfPath);
|
||||
if (!f.open(QIODevice::ReadOnly)) return;
|
||||
QByteArray data = f.readAll();
|
||||
f.close();
|
||||
|
||||
// --- 2. Collect page object numbers in document order ---
|
||||
// Read them from the page tree (/Type /Pages -> /Kids [ N 0 R ... ]).
|
||||
// This is reliable; scanning raw bytes for "/Type /Page" is NOT: that
|
||||
// marker also occurs inside content streams, and a forward lookahead
|
||||
// wrongly tags neighbouring objects (it found 280 "pages" for a 137-page
|
||||
// document). Qt writes a single, flat /Kids array listing every page.
|
||||
QVector<int> pageObjs;
|
||||
{
|
||||
int pagesPos = data.indexOf("/Type /Pages");
|
||||
int kidsPos = (pagesPos == -1) ? -1 : data.indexOf("/Kids", pagesPos);
|
||||
int lb = (kidsPos == -1) ? -1 : data.indexOf('[', kidsPos);
|
||||
int rb = (lb == -1) ? -1 : data.indexOf(']', lb);
|
||||
if (lb != -1 && rb != -1 && rb > lb) {
|
||||
const QString kids =
|
||||
QString::fromLatin1(data.mid(lb + 1, rb - lb - 1));
|
||||
QRegularExpression re(QStringLiteral("(\\d+)\\s+\\d+\\s+R"));
|
||||
auto it = re.globalMatch(kids);
|
||||
while (it.hasNext()) {
|
||||
int objNum = it.next().captured(1).toInt();
|
||||
if (objNum > 0) pageObjs.append(objNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pageObjs.isEmpty()) return; // nothing to do
|
||||
|
||||
// --- 3. Replace URI annotations with GoTo ---
|
||||
// Pattern (Qt always writes exactly this):
|
||||
// /S /URI\n/URI (file:///...<anything>#page=N)\n
|
||||
// or (older patches without file://):
|
||||
// /S /URI\n/URI (page=N)\n
|
||||
bool changed = false;
|
||||
{
|
||||
// We do a manual scan to handle variable-length replacements.
|
||||
QByteArray out;
|
||||
out.reserve(data.size());
|
||||
|
||||
const QByteArray sUri = "/S /URI\n/URI (";
|
||||
const QByteArray sGoTo = "/S /GoTo\n/D [";
|
||||
int pos = 0;
|
||||
|
||||
while (pos < data.size()) {
|
||||
int found = data.indexOf(sUri, pos);
|
||||
if (found == -1) {
|
||||
out.append(data.mid(pos));
|
||||
break;
|
||||
}
|
||||
|
||||
// Copy everything up to the match
|
||||
out.append(data.mid(pos, found - pos));
|
||||
|
||||
// Find closing ')' of the URI value
|
||||
int uriStart = found + sUri.size();
|
||||
int closeParen = data.indexOf(')', uriStart);
|
||||
if (closeParen == -1) {
|
||||
// Malformed — copy rest verbatim
|
||||
out.append(data.mid(found));
|
||||
pos = data.size();
|
||||
break;
|
||||
}
|
||||
|
||||
QByteArray uriVal = data.mid(uriStart, closeParen - uriStart);
|
||||
|
||||
// Extract page number: look for #page=N or bare page=N
|
||||
int pageNum = -1;
|
||||
int hashPos = uriVal.lastIndexOf("#page=");
|
||||
int digitStart = -1;
|
||||
if (hashPos != -1) {
|
||||
digitStart = hashPos + 6;
|
||||
} else if (uriVal.startsWith("page=")) {
|
||||
digitStart = 5;
|
||||
}
|
||||
if (digitStart != -1) {
|
||||
// Take only the leading digits: the fragment may carry extra
|
||||
// parameters after the page number (e.g. "22&fitr=15_489_..."),
|
||||
// and QByteArray::toInt() would fail on the whole remainder.
|
||||
int e = digitStart;
|
||||
while (e < uriVal.size()
|
||||
&& uriVal[e] >= '0' && uriVal[e] <= '9')
|
||||
++e;
|
||||
if (e > digitStart)
|
||||
pageNum = uriVal.mid(digitStart, e - digitStart).toInt();
|
||||
}
|
||||
|
||||
if (pageNum >= 1 && pageNum <= pageObjs.size()) {
|
||||
// Valid page reference — emit GoTo action.
|
||||
int pageObjNum = pageObjs[pageNum - 1];
|
||||
|
||||
// Optional precise destination: &fitr=Left_Bottom_Right_Top
|
||||
// (integer PDF points). If present -> /FitR (frame the element);
|
||||
// otherwise -> /Fit (whole page, top).
|
||||
QByteArray dest = " /Fit]";
|
||||
int fr = uriVal.indexOf("fitr=");
|
||||
if (fr != -1) {
|
||||
QByteArray rest = uriVal.mid(fr + 5);
|
||||
// stop at first char that is not part of the number list
|
||||
int end = 0;
|
||||
while (end < rest.size()
|
||||
&& ((rest[end] >= '0' && rest[end] <= '9')
|
||||
|| rest[end] == '_' || rest[end] == '-'))
|
||||
++end;
|
||||
QList<QByteArray> parts = rest.left(end).split('_');
|
||||
if (parts.size() == 4) {
|
||||
dest = " /FitR " + parts[0] + " " + parts[1] + " "
|
||||
+ parts[2] + " " + parts[3] + "]";
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray goTo = sGoTo
|
||||
+ QByteArray::number(pageObjNum)
|
||||
+ " 0 R" + dest;
|
||||
out.append(goTo);
|
||||
changed = true;
|
||||
} else {
|
||||
// Unknown page — keep original URI
|
||||
out.append(sUri);
|
||||
out.append(uriVal);
|
||||
out.append(')');
|
||||
}
|
||||
|
||||
pos = closeParen + 1; // skip past ')'
|
||||
}
|
||||
|
||||
if (!changed) return; // nothing was replaced
|
||||
data = out;
|
||||
}
|
||||
|
||||
// --- 4. Rebuild xref table ---
|
||||
// Find start of existing xref (last occurrence)
|
||||
int xrefStart = data.lastIndexOf("\nxref\n");
|
||||
if (xrefStart == -1) xrefStart = data.lastIndexOf("\nxref ");
|
||||
if (xrefStart == -1) return; // malformed PDF
|
||||
++xrefStart; // skip the leading '\n'
|
||||
|
||||
QByteArray body = data.left(xrefStart);
|
||||
|
||||
// Collect all object offsets from the body
|
||||
QMap<int, int> offsets; // objNum -> byte offset
|
||||
{
|
||||
const QByteArray objMarker = " 0 obj";
|
||||
int pos = 0;
|
||||
while ((pos = body.indexOf(objMarker, pos)) != -1) {
|
||||
int numStart = pos - 1;
|
||||
while (numStart > 0 && body[numStart-1] != '\n' && body[numStart-1] != '\r')
|
||||
--numStart;
|
||||
QByteArray numStr = body.mid(numStart, pos - numStart).trimmed();
|
||||
bool ok = false;
|
||||
int objNum = numStr.toInt(&ok);
|
||||
if (ok && objNum > 0)
|
||||
offsets[objNum] = numStart;
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
if (offsets.isEmpty()) return;
|
||||
|
||||
int maxObj = offsets.lastKey();
|
||||
|
||||
// Build xref table
|
||||
QByteArray xref;
|
||||
xref += "xref\n";
|
||||
xref += "0 " + QByteArray::number(maxObj + 1) + "\n";
|
||||
xref += "0000000000 65535 f \n";
|
||||
for (int i = 1; i <= maxObj; ++i) {
|
||||
if (offsets.contains(i)) {
|
||||
xref += QByteArray::number(offsets[i]).rightJustified(10, '0')
|
||||
+ " 00000 n \n";
|
||||
} else {
|
||||
xref += "0000000000 65535 f \n";
|
||||
}
|
||||
}
|
||||
|
||||
// Find trailer dict from the original xref section
|
||||
int trailerPos = data.indexOf("trailer", xrefStart);
|
||||
int trailerEnd = -1;
|
||||
if (trailerPos != -1) {
|
||||
trailerEnd = data.indexOf("%%EOF", trailerPos);
|
||||
if (trailerEnd != -1) trailerEnd += 5;
|
||||
}
|
||||
|
||||
QByteArray trailer;
|
||||
if (trailerPos != -1 && trailerEnd != -1)
|
||||
trailer = data.mid(trailerPos, trailerEnd - trailerPos);
|
||||
else
|
||||
trailer = "trailer\n<<>>\n%%EOF";
|
||||
|
||||
int newXrefOffset = body.size();
|
||||
|
||||
QByteArray result;
|
||||
result.reserve(body.size() + xref.size() + trailer.size() + 30);
|
||||
result += body;
|
||||
result += xref;
|
||||
result += trailer;
|
||||
result += "\nstartxref\n";
|
||||
result += QByteArray::number(newXrefOffset);
|
||||
result += "\n%%EOF\n";
|
||||
|
||||
// --- 5. Write back ---
|
||||
QFile out(pdfPath);
|
||||
if (!out.open(QIODevice::WriteOnly | QIODevice::Truncate)) return;
|
||||
out.write(result);
|
||||
out.close();
|
||||
}
|
||||
|
||||
} // namespace PdfLinks
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright 2006-2025 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PDF_LINKS_H
|
||||
#define PDF_LINKS_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QPointF>
|
||||
#include <QRectF>
|
||||
#include <QString>
|
||||
#include <QTransform>
|
||||
#include <functional>
|
||||
|
||||
class QPdfEngine;
|
||||
class Diagram;
|
||||
|
||||
/**
|
||||
Shared helper that turns a project's cross-references and folio reports
|
||||
into clickable internal hyperlinks in a Qt-generated PDF. Used by both the
|
||||
GUI print path (ProjectPrintWindow) and the headless CLI export, each of
|
||||
which builds its own page geometry and passes it in — this code never
|
||||
computes the scene-to-page mapping itself.
|
||||
*/
|
||||
namespace PdfLinks {
|
||||
|
||||
/**
|
||||
Geometry mapping for one rendered PDF page. Each caller builds this
|
||||
from its OWN page setup (printer page layout vs QPdfWriter), since the
|
||||
device-pixel and point conversions differ between them.
|
||||
*/
|
||||
struct PageGeometry {
|
||||
/// scene coordinates -> device pixels (the same "fit" render() applied)
|
||||
QTransform sceneToDevice;
|
||||
/// device paint rectangle, in pixels (the page area)
|
||||
QRectF target;
|
||||
/// links whose rectangle falls outside this are dropped
|
||||
QRectF pageBounds;
|
||||
/// device pixels -> PDF points (replicates the engine's page matrix)
|
||||
std::function<QPointF(const QPointF &)> devToPdf;
|
||||
/// a diagram -> its source rectangle in scene pixels (for /FitR framing)
|
||||
std::function<QRectF(Diagram *)> sourceRectOf;
|
||||
};
|
||||
|
||||
/**
|
||||
Inject clickable cross-reference / folio-report hyperlinks for @p diagram
|
||||
into the current page of @p engine. Each link is emitted as a URI
|
||||
annotation encoding the target page and a /FitR rectangle;
|
||||
convertUriToGoTo() then rewrites those into native internal GoTo actions.
|
||||
*/
|
||||
void injectCrossRefLinks(QPdfEngine *engine, Diagram *diagram,
|
||||
const PageGeometry &geom,
|
||||
const QMap<Diagram *, int> &pageMap,
|
||||
const QString &outputFileName);
|
||||
|
||||
/**
|
||||
Post-process a Qt-generated PDF file: rewrite every "/S /URI" link
|
||||
annotation into a native internal "/S /GoTo" action (page + /FitR or
|
||||
/Fit destination) and rebuild the xref table. No-op if the file has no
|
||||
such annotations.
|
||||
*/
|
||||
void convertUriToGoTo(const QString &pdfPath);
|
||||
|
||||
}
|
||||
|
||||
#endif // PDF_LINKS_H
|
||||
@@ -18,12 +18,20 @@
|
||||
#include "projectprintwindow.h"
|
||||
|
||||
#include "../diagram.h"
|
||||
#include "../pdf_links.h"
|
||||
#include "../qeticons.h"
|
||||
#include "../qetproject.h"
|
||||
#include "../qetversion.h"
|
||||
#include "../qetgraphicsitem/crossrefitem.h"
|
||||
#include "../qetgraphicsitem/dynamicelementtextitem.h"
|
||||
#include "../qetgraphicsitem/elementtextitemgroup.h"
|
||||
|
||||
#include "ui_projectprintwindow.h"
|
||||
|
||||
// Private Qt PDF engine for drawHyperlink() — not public API, stable since Qt4
|
||||
// Requires QT += gui-private in qelectrotech.pro
|
||||
#include <private/qpdf_p.h>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
# include <QDesktopWidget>
|
||||
#else
|
||||
@@ -37,6 +45,11 @@
|
||||
#include <QPrintDialog>
|
||||
#include <QPrintPreviewWidget>
|
||||
#include <QScreen>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QMap>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
|
||||
/**
|
||||
* @brief ProjectPrintWindow::ProjectPrintWindow
|
||||
@@ -214,13 +227,47 @@ void ProjectPrintWindow::requestPaint()
|
||||
return;
|
||||
}
|
||||
|
||||
// Build diagram -> first physical PDF page number map (1-based)
|
||||
// Must be done before the print loop since page numbers depend on order
|
||||
QMap<Diagram*, int> diagramPageMap;
|
||||
{
|
||||
int pageNum = 1;
|
||||
for (auto diagram : selectedDiagram()) {
|
||||
diagramPageMap.insert(diagram, pageNum);
|
||||
// Each diagram may span multiple pages if not fit_page
|
||||
if (!ui->m_fit_in_page_cb->isChecked()) {
|
||||
auto option = exportProperties();
|
||||
bool full_page = m_printer->fullPage();
|
||||
int h = horizontalPagesCount(diagram, option, full_page);
|
||||
int v = verticalPagesCount(diagram, option, full_page);
|
||||
pageNum += h * v;
|
||||
} else {
|
||||
pageNum += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool first = true;
|
||||
QPainter painter(m_printer);
|
||||
|
||||
// A real PDF export uses the QPdfEngine; the on-screen preview uses a
|
||||
// preview paint engine. We only post-process when actually writing a PDF.
|
||||
const bool pdfExport =
|
||||
(m_printer->outputFormat() == QPrinter::PdfFormat)
|
||||
&& (dynamic_cast<QPdfEngine*>(painter.paintEngine()) != nullptr);
|
||||
|
||||
for (auto diagram : selectedDiagram())
|
||||
{
|
||||
first ? first = false : m_printer->newPage();
|
||||
printDiagram(diagram, ui->m_fit_in_page_cb->isChecked(), &painter, m_printer);
|
||||
printDiagram(diagram, ui->m_fit_in_page_cb->isChecked(), &painter, m_printer, diagramPageMap);
|
||||
}
|
||||
|
||||
// Note: do NOT call painter.end() or pdfConvertUriToGoTo() here.
|
||||
// We are inside the paintRequested slot: the QPrintPreviewWidget still
|
||||
// owns the paint cycle. On macOS arm64 (Metal/CALayer compositor),
|
||||
// closing the QPainter manually inside this slot leaves the backing
|
||||
// store in an undefined state, producing a black screen after export.
|
||||
// pdfConvertUriToGoTo() is deferred to print() via QTimer::singleShot(0).
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,7 +277,7 @@ void ProjectPrintWindow::requestPaint()
|
||||
* @param fit_page
|
||||
* @param printer
|
||||
*/
|
||||
void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter *painter, QPrinter *printer)
|
||||
void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter *painter, QPrinter *printer, const QMap<Diagram*, int> &diagramPageMap)
|
||||
{
|
||||
|
||||
////Prepare the print////
|
||||
@@ -317,6 +364,65 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter
|
||||
}
|
||||
}
|
||||
|
||||
////Inject PDF cross-reference links////
|
||||
if (printer->outputFormat() == QPrinter::PdfFormat && fit_page) {
|
||||
auto *pdfEngine = dynamic_cast<QPdfEngine*>(painter->paintEngine());
|
||||
if (pdfEngine) {
|
||||
|
||||
// QGraphicsScene::render() fait save()/restore() : worldTransform()
|
||||
// est revenu a l'identite ici. On reconstruit DONC explicitement la
|
||||
// transform appliquee par :
|
||||
// diagram->render(painter, QRectF(), diagram_rect, KeepAspectRatio)
|
||||
// cible vide => painter->viewport() ; source = diagram_rect ; centre.
|
||||
const QRectF target = QRectF(painter->viewport());
|
||||
const QRectF source = QRectF(diagram_rect); // meme source que render()
|
||||
|
||||
// render() ANCRE en haut-gauche (pas de centrage) :
|
||||
// translate(target.topLeft) . scale(s,s) . translate(-source.topLeft)
|
||||
// On reproduit EXACTEMENT ca — surtout PAS de (target-source*s)/2.
|
||||
const qreal s = qMin(target.width() / source.width(),
|
||||
target.height() / source.height());
|
||||
|
||||
QTransform fit;
|
||||
fit.translate(target.x(), target.y());
|
||||
fit.scale(s, s);
|
||||
fit.translate(-source.x(), -source.y()); // scene -> pixels device
|
||||
|
||||
// IMPORTANT : QPdfEngine::drawHyperlink() applique lui-meme
|
||||
// pageMatrix() (echelle 72/resolution + inversion de Y + marges).
|
||||
// On lui passe donc le rectangle en PIXELS DEVICE, sans aucune
|
||||
// conversion en points ni flip de notre cote.
|
||||
const QRectF pageBounds(0, 0, target.width(), target.height());
|
||||
|
||||
// ---- Device-pixels -> PDF points, replicating QPdfEnginePrivate::pageMatrix()
|
||||
// (same geometry for every page: same printer, page size and margins). ----
|
||||
const qreal pt_scale = 72.0 / printer->resolution();
|
||||
const qreal fullH_pt = printer->pageLayout().fullRectPoints().height();
|
||||
const bool fullPageMode =
|
||||
(printer->pageLayout().mode() == QPageLayout::FullPageMode);
|
||||
const QRect paintPx =
|
||||
printer->pageLayout().paintRectPixels(printer->resolution());
|
||||
auto devToPdf = [=](const QPointF &d) -> QPointF {
|
||||
qreal dx = d.x(), dy = d.y();
|
||||
if (!fullPageMode) { dx += paintPx.left(); dy += paintPx.top(); }
|
||||
return QPointF(pt_scale * dx, fullH_pt - pt_scale * dy);
|
||||
};
|
||||
|
||||
PdfLinks::PageGeometry geom;
|
||||
geom.sceneToDevice = fit;
|
||||
geom.target = target;
|
||||
geom.pageBounds = pageBounds;
|
||||
geom.devToPdf = devToPdf;
|
||||
geom.sourceRectOf = [this](Diagram *dg) {
|
||||
return QRectF(diagramRect(dg, exportProperties()));
|
||||
};
|
||||
PdfLinks::injectCrossRefLinks(
|
||||
pdfEngine, diagram, geom, diagramPageMap,
|
||||
printer->outputFileName());
|
||||
}
|
||||
}
|
||||
////PDF links end////
|
||||
|
||||
////Print is finished, restore diagram and graphics item properties
|
||||
for (auto view : diagram->views()) {
|
||||
view->setInteractive(true);
|
||||
@@ -772,9 +878,29 @@ void ProjectPrintWindow::on_m_uncheck_all_clicked()
|
||||
|
||||
void ProjectPrintWindow::print()
|
||||
{
|
||||
m_preview->print();
|
||||
const bool isPdf = (m_printer->outputFormat() == QPrinter::PdfFormat);
|
||||
const QString pdfFile = isPdf ? m_printer->outputFileName() : QString();
|
||||
|
||||
m_preview->print(); // triggers requestPaint() synchronously; painter
|
||||
// is created/destroyed inside that call
|
||||
|
||||
savePageSetupForCurrentPrinter();
|
||||
this->close();
|
||||
|
||||
if (isPdf && !pdfFile.isEmpty()) {
|
||||
// Defer post-processing and window close to the next event-loop
|
||||
// iteration. This lets the macOS arm64 Metal compositor finish
|
||||
// compositing the backing store before the window is destroyed,
|
||||
// which prevents the black screen observed on Apple Silicon under
|
||||
// macOS Sequoia (QPrintPreviewWidget + CALayer timing issue).
|
||||
QTimer::singleShot(0, this, [this, pdfFile]() {
|
||||
// Convert URI link annotations into native internal GoTo/FitR
|
||||
// actions so cross-references jump inside the document.
|
||||
PdfLinks::convertUriToGoTo(pdfFile);
|
||||
this->close();
|
||||
});
|
||||
} else {
|
||||
this->close();
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "../exportproperties.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMap>
|
||||
#include <QPrinter>
|
||||
|
||||
namespace Ui {
|
||||
@@ -79,7 +80,7 @@ class ProjectPrintWindow : public QMainWindow
|
||||
|
||||
private:
|
||||
void requestPaint();
|
||||
void printDiagram(Diagram *diagram, bool fit_page, QPainter *painter, QPrinter *printer);
|
||||
void printDiagram(Diagram *diagram, bool fit_page, QPainter *painter, QPrinter *printer, const QMap<Diagram*, int> &diagramPageMap = {});
|
||||
QRect diagramRect(Diagram *diagram, const ExportProperties &option) const;
|
||||
int horizontalPagesCount(Diagram *diagram, const ExportProperties &option, bool full_page) const;
|
||||
int verticalPagesCount(Diagram *diagram, const ExportProperties &option, bool full_page) const;
|
||||
|
||||
+19
-15
@@ -226,20 +226,20 @@ void QETApp::setLanguage(const QString &desired_language) {
|
||||
|
||||
// load translations for the QET application
|
||||
// charge les traductions pour l'application QET
|
||||
if (!qetTranslator.load("qet_" + desired_language, languages_path)) {
|
||||
/* in case of failure,
|
||||
* we fall back on the native channels for French
|
||||
* en cas d'echec,
|
||||
* on retombe sur les chaines natives pour le francais
|
||||
*/
|
||||
if (desired_language != "fr") {
|
||||
// use of the English version by default
|
||||
// utilisation de la version anglaise par defaut
|
||||
if(!qetTranslator.load("qet_en", languages_path))
|
||||
qWarning() << "failed to load"
|
||||
<< "qet_en" << languages_path << "(" << __FILE__
|
||||
<< __LINE__ << __FUNCTION__ << ")";
|
||||
}
|
||||
// desired_language may be a full locale such as "pt_BR": try that exact
|
||||
// translation, then the base language ("pt"), then fall back to English.
|
||||
// French is the application's source language and needs no translation.
|
||||
const QString base_language = desired_language.section('_', 0, 0);
|
||||
bool loaded = qetTranslator.load("qet_" + desired_language, languages_path);
|
||||
if (!loaded && base_language != desired_language)
|
||||
loaded = qetTranslator.load("qet_" + base_language, languages_path);
|
||||
if (!loaded && base_language != "fr") {
|
||||
// use of the English version by default
|
||||
// utilisation de la version anglaise par defaut
|
||||
if(!qetTranslator.load("qet_en", languages_path))
|
||||
qWarning() << "failed to load"
|
||||
<< "qet_en" << languages_path << "(" << __FILE__
|
||||
<< __LINE__ << __FUNCTION__ << ")";
|
||||
}
|
||||
qApp->installTranslator(&qetTranslator);
|
||||
|
||||
@@ -263,7 +263,11 @@ QString QETApp::langFromSetting()
|
||||
QSettings settings;
|
||||
system_language = settings.value("lang", "system").toString();
|
||||
if(system_language == "system") {
|
||||
system_language = QLocale::system().name().left(2);
|
||||
// Keep the full locale (e.g. "pt_BR"), not just the base language
|
||||
// ("pt"): QET ships regional translations (pt_BR, nl_BE, nl_NL) and
|
||||
// truncating here loaded the wrong one. setLanguage() falls back to
|
||||
// the base language when no regional translation exists.
|
||||
system_language = QLocale::system().name();
|
||||
}
|
||||
lang_is_set = true;
|
||||
}
|
||||
|
||||
@@ -928,7 +928,7 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt, in
|
||||
bounding_rect = bounding_rect.united(text_rect);
|
||||
|
||||
if (m_update_map)
|
||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
||||
m_hovered_contacts_map.insert(elmt, text_rect);
|
||||
|
||||
++m_drawed_contacts;
|
||||
}
|
||||
@@ -961,22 +961,21 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt, in
|
||||
painter.drawPolyline(p2, 3);
|
||||
|
||||
// Draw terminal names for switch contact (3 terminals)
|
||||
// terminal_names[0] = NO side (top left)
|
||||
// terminal_names[1] = NC side (bottom left)
|
||||
// terminal_names[2] = common side (right)
|
||||
// terminal_names[0] = NC (bottom-left)
|
||||
// terminal_names[1] = NO (top-left)
|
||||
// terminal_names[2] = Common (right)
|
||||
if (!terminal_names.isEmpty() && m_properties.showTerminalName()) {
|
||||
painter.setFont(QETApp::diagramTextsFont(4));
|
||||
// Sort order from parseTerminal (top->bottom, left->right):
|
||||
// [0]=12 (NO, top-left), [1]=14 (common, top-center), [2]=13 (NC, bottom-center)
|
||||
if (terminal_names.size() >= 1)
|
||||
painter.drawText(QRectF(0, offset, 8, 8),
|
||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[1]); // 12 NO left
|
||||
// Storage order set above: [0]=NC, [1]=NO, [2]=Common
|
||||
if (terminal_names.size() >= 2)
|
||||
painter.drawText(QRectF(16, offset+4, 8, 6),
|
||||
Qt::AlignRight|Qt::AlignTop, terminal_names[2]); // 14 common right
|
||||
painter.drawText(QRectF(0, offset, 8, 8),
|
||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[1]); // NO top-left
|
||||
if (terminal_names.size() >= 3)
|
||||
painter.drawText(QRectF(16, offset+4, 8, 6),
|
||||
Qt::AlignRight|Qt::AlignTop, terminal_names[2]); // Common right
|
||||
if (terminal_names.size() >= 1)
|
||||
painter.drawText(QRectF(0, offset+9, 8, 6),
|
||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[0]); // 13 NC left-bottom
|
||||
Qt::AlignLeft|Qt::AlignTop, terminal_names[0]); // NC bottom-left
|
||||
painter.setFont(QETApp::diagramTextsFont(5));
|
||||
}
|
||||
|
||||
@@ -1012,7 +1011,7 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt, in
|
||||
bounding_rect = bounding_rect.united(text_rect);
|
||||
|
||||
if (m_update_map)
|
||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
||||
m_hovered_contacts_map.insert(elmt, text_rect);
|
||||
|
||||
//a switch contact take place of two normal contact
|
||||
m_drawed_contacts += 2;
|
||||
@@ -1044,7 +1043,7 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt, in
|
||||
bounding_rect = bounding_rect.united(text_rect);
|
||||
|
||||
if (m_update_map)
|
||||
m_hovered_contacts_map.insert(elmt, bounding_rect);
|
||||
m_hovered_contacts_map.insert(elmt, text_rect);
|
||||
++m_drawed_contacts;
|
||||
}
|
||||
return bounding_rect;
|
||||
|
||||
@@ -126,6 +126,12 @@ class CrossRefItem : public QGraphicsObject
|
||||
ElementTextItemGroup *m_group = nullptr;
|
||||
QList <QMetaObject::Connection> m_slave_connection;
|
||||
QList <QMetaObject::Connection> m_update_connection;
|
||||
|
||||
public:
|
||||
/// Returns the map of linked elements and their clickable rects (local coords).
|
||||
/// Used by the PDF export to inject hyperlink annotations.
|
||||
const QMultiMap<Element *, QRectF> &hoveredContactsMap() const
|
||||
{ return m_hovered_contacts_map; }
|
||||
};
|
||||
|
||||
#endif // CROSSREFITEM_H
|
||||
|
||||
@@ -86,6 +86,9 @@ class DynamicElementTextItem : public DiagramTextItem
|
||||
void fromXml(const QDomElement &dom_elmt) override;
|
||||
|
||||
Element *parentElement() const;
|
||||
/// PDF export: slave cross-reference text item ("(folio-pos)") and its master target.
|
||||
QGraphicsTextItem *slaveXrefItem() const { return m_slave_Xref_item; }
|
||||
Element *masterElement() const { return m_master_element.data(); }
|
||||
ElementTextItemGroup *parentGroup() const;
|
||||
Element *elementUseForInfo() const;
|
||||
void refreshLabelConnection();
|
||||
|
||||
@@ -76,6 +76,8 @@ class ElementTextItemGroup : public QObject, public QGraphicsItemGroup
|
||||
QList<DynamicElementTextItem *> texts() const;
|
||||
Diagram *diagram() const;
|
||||
Element *parentElement() const;
|
||||
/// PDF export: slave cross-reference text item of the group, if any.
|
||||
QGraphicsTextItem *slaveXrefItem() const { return m_slave_Xref_item; }
|
||||
|
||||
QDomElement toXml(QDomDocument &dom_document) const;
|
||||
void fromXml(QDomElement &dom_element);
|
||||
|
||||
+27
-4
@@ -43,6 +43,13 @@
|
||||
|
||||
static int BACKUP_INTERVAL = 1200000; //interval in ms of backup = 20min
|
||||
|
||||
bool QETProject::m_backup_enabled = true;
|
||||
|
||||
void QETProject::setBackupEnabled(bool enabled)
|
||||
{
|
||||
m_backup_enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETProject::QETProject
|
||||
Create a empty project
|
||||
@@ -1006,16 +1013,30 @@ QETResult QETProject::write()
|
||||
if (m_file_path.isEmpty())
|
||||
return(QString("unable to save project to file: no filepath was specified"));
|
||||
|
||||
// if the project was opened read-only
|
||||
// and the file is still non-writable, do not save the project
|
||||
if (isReadOnly() && !QFileInfo(m_file_path).isWritable())
|
||||
return(QString("the file %1 was opened read-only and thus will not be written").arg(m_file_path));
|
||||
// If the project was opened read-only, only refuse when the target
|
||||
// really can't be written: an existing file that is not writable, or a
|
||||
// new file (e.g. "Save As" to another location) whose directory is not
|
||||
// writable. A non-existent file reports isWritable() == false, so the
|
||||
// old check wrongly blocked saving a read-only project elsewhere.
|
||||
if (isReadOnly()) {
|
||||
const QFileInfo file_info(m_file_path);
|
||||
const bool can_write = file_info.exists()
|
||||
? file_info.isWritable()
|
||||
: QFileInfo(file_info.absolutePath()).isWritable();
|
||||
if (!can_write)
|
||||
return(QString("the file %1 was opened read-only and thus will not be written").arg(m_file_path));
|
||||
}
|
||||
|
||||
QDomDocument xml_project(toXml());
|
||||
QString error_message;
|
||||
if (!QET::writeXmlFile(xml_project, m_file_path, &error_message))
|
||||
return(error_message);
|
||||
|
||||
// The project has just been written to a writable file (e.g. saved to
|
||||
// a new location with "Save As"), so it is no longer read-only.
|
||||
if (isReadOnly())
|
||||
setReadOnly(false);
|
||||
|
||||
//title block variables should be updated after file save dialog is confirmed, before file is saved.
|
||||
m_project_properties.addValue("saveddate", QLocale::system().toString(QDate::currentDate(), QLocale::ShortFormat));
|
||||
m_project_properties.addValue("saveddate-us", QDate::currentDate().toString("yyyy-MM-dd"));
|
||||
@@ -1783,6 +1804,8 @@ void QETProject::addDiagram(Diagram *diagram, int pos)
|
||||
*/
|
||||
void QETProject::writeBackup()
|
||||
{
|
||||
if (!m_backup_enabled)
|
||||
return;
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
|
||||
@@ -105,6 +105,12 @@ class QETProject : public QObject
|
||||
QVersionNumber declaredQElectroTechVersion();
|
||||
void setTitle(const QString &);
|
||||
|
||||
/// Enable/disable the asynchronous crash-recovery backup for all
|
||||
/// projects. Disabled by the headless CLI: the backup write runs on a
|
||||
/// background thread referencing the project, and a short-lived CLI
|
||||
/// process can destroy the project before the write finishes (crash).
|
||||
static void setBackupEnabled(bool enabled);
|
||||
|
||||
///DEFAULT PROPERTIES
|
||||
BorderProperties defaultBorderProperties() const;
|
||||
void setDefaultBorderProperties(const BorderProperties &);
|
||||
@@ -241,6 +247,8 @@ class QETProject : public QObject
|
||||
|
||||
// attributes
|
||||
private:
|
||||
/// When false, writeBackup() is a no-op (set by the headless CLI)
|
||||
static bool m_backup_enabled;
|
||||
/// File path this project is saved to
|
||||
QString m_file_path;
|
||||
/// Current state of the project
|
||||
|
||||
@@ -1756,6 +1756,10 @@ QString TitleBlockTemplate::interpreteVariables(
|
||||
QStringList TitleBlockTemplate::listOfVariables()
|
||||
{
|
||||
QStringList list;
|
||||
// Match every "%{name}" placeholder. The bare "%name" form can't be
|
||||
// extracted reliably without the variable list, and templates use the
|
||||
// braced form, so only that is collected here.
|
||||
static const QRegularExpression rx(QStringLiteral("%\\{([^}]+)\\}"));
|
||||
// run through each individual cell
|
||||
for (int j = 0 ; j < rows_heights_.count() ; ++ j) {
|
||||
for (int i = 0 ; i < columns_width_.count() ; ++ i) {
|
||||
@@ -1763,14 +1767,15 @@ QStringList TitleBlockTemplate::listOfVariables()
|
||||
|| cells_[i][j] -> cell_type
|
||||
== TitleBlockCell::EmptyCell)
|
||||
continue;
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO not works on all cases...")
|
||||
#endif
|
||||
// TODO: not works on all cases...
|
||||
list << cells_[i][j] -> value.name().replace("%","");
|
||||
const QString cell_value = cells_[i][j] -> value.name();
|
||||
auto it = rx.globalMatch(cell_value);
|
||||
while (it.hasNext()) {
|
||||
const QString name = it.next().captured(1);
|
||||
if (!name.isEmpty() && !list.contains(name))
|
||||
list << name;
|
||||
}
|
||||
}
|
||||
}
|
||||
qDebug() << list;
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -273,9 +273,15 @@ void ElementInfoWidget::updateUi()
|
||||
}
|
||||
// Load the lock status for auto numbering
|
||||
if (m_element->elementData().m_type == ElementData::Terminal) {
|
||||
// ... (bestehender Terminal-Code für auto_num_locked und potential_isolating) ...
|
||||
}
|
||||
QString lock_value = element_info.value(QStringLiteral("auto_num_locked")).toString();
|
||||
ui->m_auto_num_locked_cb->setChecked(lock_value == QLatin1String("true"));
|
||||
|
||||
// English: Load the potential isolating status from the element information mapping
|
||||
if (m_potential_isolating_cb) {
|
||||
QString isolating_value = element_info.value(QStringLiteral("potential_isolating")).toString();
|
||||
m_potential_isolating_cb->setChecked(isolating_value == QLatin1String("true"));
|
||||
}
|
||||
}
|
||||
// English: Load the BOM exclusion status from the element information mapping
|
||||
if (m_exclude_from_bom_cb) {
|
||||
QString exclude_bom_value = element_info.value(QStringLiteral("exclude_from_bom")).toString();
|
||||
@@ -297,12 +303,11 @@ DiagramContext ElementInfoWidget::currentInfo() const
|
||||
|
||||
for (const auto &eipw : qAsConst(m_eipw_list))
|
||||
{
|
||||
|
||||
//add value only if they're something to store
|
||||
//add value only if they're something to store
|
||||
if (!eipw->text().isEmpty())
|
||||
{
|
||||
QString txt{eipw->text()};
|
||||
//remove line feed and carriage return
|
||||
//remove line feed and carriage return
|
||||
txt.remove(QStringLiteral("\r"));
|
||||
txt.remove(QStringLiteral("\n"));
|
||||
info_.addValue(eipw->key(), txt);
|
||||
@@ -311,12 +316,16 @@ DiagramContext ElementInfoWidget::currentInfo() const
|
||||
|
||||
// Save the auto numbering lock status
|
||||
if (m_element->elementData().m_type == ElementData::Terminal) {
|
||||
info_.addValue(QStringLiteral("auto_num_locked"), ui->m_auto_num_locked_cb->isChecked() ? QStringLiteral("true") : QStringLiteral("false"));
|
||||
|
||||
if (m_potential_isolating_cb) {
|
||||
info_.addValue(QStringLiteral("potential_isolating"), m_potential_isolating_cb->isChecked() ? QStringLiteral("true") : QStringLiteral("false"));
|
||||
}
|
||||
}
|
||||
|
||||
if (m_exclude_from_bom_cb) {
|
||||
info_.addValue(QStringLiteral("exclude_from_bom"), m_exclude_from_bom_cb->isChecked() ? QStringLiteral("true") : QStringLiteral("false"));
|
||||
}
|
||||
|
||||
return info_;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "ui_titleblockpropertieswidget.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QSet>
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
@@ -162,7 +163,11 @@ void TitleBlockPropertiesWidget::setProperties(
|
||||
}
|
||||
ui -> m_tbt_cb -> setCurrentIndex(index);
|
||||
|
||||
m_dcw -> setContext(properties.context);
|
||||
// Show the saved custom values, plus any of the template's custom variables
|
||||
// that aren't defined yet, so the user only fills in the missing ones (#271).
|
||||
DiagramContext context = properties.context;
|
||||
addTemplateVariables(context, index);
|
||||
m_dcw -> setContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -435,12 +440,15 @@ void TitleBlockPropertiesWidget::updateTemplateList()
|
||||
}
|
||||
|
||||
/**
|
||||
@brief TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate
|
||||
Load the additional field of title block "text"
|
||||
@brief TitleBlockPropertiesWidget::templateForIndex
|
||||
@param index : index in the collection-type map (= the template combo index)
|
||||
@return the TitleBlockTemplate currently selected for that collection, or
|
||||
nullptr.
|
||||
*/
|
||||
void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(int index)
|
||||
TitleBlockTemplate *TitleBlockPropertiesWidget::templateForIndex(int index) const
|
||||
{
|
||||
m_dcw -> clear();
|
||||
if (index < 0 || index >= m_map_index_to_collection_type.count())
|
||||
return nullptr;
|
||||
|
||||
QET::QetCollection qc = m_map_index_to_collection_type.at(index);
|
||||
TitleBlockTemplatesCollection *collection = nullptr;
|
||||
@@ -448,21 +456,55 @@ void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(int index)
|
||||
if (c -> collection() == qc)
|
||||
collection = c;
|
||||
|
||||
if (!collection) return;
|
||||
if (!collection) return nullptr;
|
||||
return collection -> getTemplate(ui -> m_tbt_cb -> currentText());
|
||||
}
|
||||
|
||||
// get template
|
||||
TitleBlockTemplate *tpl = collection -> getTemplate(ui -> m_tbt_cb -> currentText());
|
||||
if(tpl != nullptr) {
|
||||
// get all template fields
|
||||
QStringList fields = tpl -> listOfVariables();
|
||||
// set fields to additional_fields_ widget
|
||||
DiagramContext templateContext;
|
||||
for(int i =0; i<fields.count(); i++)
|
||||
templateContext.addValue(fields.at(i), "");
|
||||
m_dcw -> setContext(templateContext);
|
||||
/**
|
||||
@brief TitleBlockPropertiesWidget::addTemplateVariables
|
||||
Add to @p context every CUSTOM variable used by the currently selected
|
||||
template that is not already present, with an empty value — so the user
|
||||
only has to fill in the values instead of declaring the variables (#271).
|
||||
The standard fields (title, author, date, …) are handled by their own
|
||||
widgets and are skipped. Existing values in @p context are preserved.
|
||||
*/
|
||||
void TitleBlockPropertiesWidget::addTemplateVariables(
|
||||
DiagramContext &context, int index) const
|
||||
{
|
||||
TitleBlockTemplate *tpl = templateForIndex(index);
|
||||
if (!tpl) return;
|
||||
|
||||
// Variables rendered from the dedicated standard-field widgets; they must
|
||||
// not appear in the "Custom" tab.
|
||||
static const QSet<QString> reserved {
|
||||
QStringLiteral("author"), QStringLiteral("date"),
|
||||
QStringLiteral("title"), QStringLiteral("filename"),
|
||||
QStringLiteral("plant"), QStringLiteral("locmach"),
|
||||
QStringLiteral("indexrev"), QStringLiteral("version"),
|
||||
QStringLiteral("folio"), QStringLiteral("folio-id"),
|
||||
QStringLiteral("folio-total"), QStringLiteral("auto_page_num"),
|
||||
QStringLiteral("previous-folio-num"), QStringLiteral("next-folio-num")
|
||||
};
|
||||
|
||||
const QStringList variables = tpl -> listOfVariables();
|
||||
for (const QString &name : variables) {
|
||||
if (name.isEmpty() || reserved.contains(name)) continue;
|
||||
if (!context.contains(name)) context.addValue(name, "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate
|
||||
When the user picks a template, append its missing custom variables to the
|
||||
"Custom" tab while keeping the values already entered (#271).
|
||||
*/
|
||||
void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(int index)
|
||||
{
|
||||
DiagramContext context = m_dcw -> context();
|
||||
addTemplateVariables(context, index);
|
||||
m_dcw -> setContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief TitleBlockPropertiesWidget::on_m_date_now_pb_clicked
|
||||
Set the date to current date
|
||||
|
||||
@@ -30,6 +30,7 @@ class NumerotationContext;
|
||||
class QETProject;
|
||||
class QMenu;
|
||||
class TitleBlockTemplatesCollection;
|
||||
class TitleBlockTemplate;
|
||||
|
||||
namespace Ui {
|
||||
class TitleBlockPropertiesWidget;
|
||||
@@ -77,6 +78,8 @@ class TitleBlockPropertiesWidget : public QWidget
|
||||
void initDialog(const bool ¤t_date, QETProject *project);
|
||||
int getIndexFor (const QString &tbt_name,
|
||||
const QET::QetCollection collection) const;
|
||||
TitleBlockTemplate *templateForIndex (int index) const;
|
||||
void addTemplateVariables (DiagramContext &context, int index) const;
|
||||
|
||||
private slots:
|
||||
void editCurrentTitleBlockTemplate();
|
||||
|
||||
@@ -151,13 +151,39 @@ void WiringListExport::toCsv()
|
||||
{
|
||||
if (!m_project) return;
|
||||
|
||||
QDomDocument doc = m_project->toXml();
|
||||
|
||||
if (doc.isNull()) {
|
||||
const QString csv = toCsvString();
|
||||
if (csv.isEmpty()) {
|
||||
QMessageBox::warning(m_parent, tr("Erreur"), tr("Impossible de lire la structure en mémoire du projet."));
|
||||
return;
|
||||
}
|
||||
|
||||
QFileDialog dialog(m_parent);
|
||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||
dialog.setWindowTitle(tr("Exporter le plan de câblage"));
|
||||
dialog.setDefaultSuffix("csv");
|
||||
dialog.setNameFilter(tr("Fichiers CSV (*.csv)"));
|
||||
|
||||
if (dialog.exec() != QDialog::Accepted) return;
|
||||
QString fileName = dialog.selectedFiles().first();
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QMessageBox::warning(m_parent, tr("Erreur"), tr("Impossible d'ouvrir le fichier pour l'écriture."));
|
||||
return;
|
||||
}
|
||||
QTextStream out(&file);
|
||||
out << csv;
|
||||
file.close();
|
||||
QMessageBox::information(m_parent, tr("Export réussi"), tr("Le plan de câblage a été exporté avec succès !"));
|
||||
}
|
||||
|
||||
QString WiringListExport::toCsvString() const
|
||||
{
|
||||
if (!m_project) return QString();
|
||||
|
||||
QDomDocument doc = m_project->toXml();
|
||||
if (doc.isNull()) return QString();
|
||||
|
||||
QSet<QString> conductorDefinitionTypes;
|
||||
QDomElement rootElem = doc.documentElement();
|
||||
QDomElement collection = rootElem.firstChildElement("collection");
|
||||
@@ -197,21 +223,6 @@ void WiringListExport::toCsv()
|
||||
}
|
||||
}
|
||||
|
||||
QFileDialog dialog(m_parent);
|
||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||
dialog.setWindowTitle(tr("Exporter le plan de câblage"));
|
||||
dialog.setDefaultSuffix("csv");
|
||||
dialog.setNameFilter(tr("Fichiers CSV (*.csv)"));
|
||||
|
||||
if (dialog.exec() != QDialog::Accepted) return;
|
||||
QString fileName = dialog.selectedFiles().first();
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QMessageBox::warning(m_parent, tr("Erreur"), tr("Impossible d'ouvrir le fichier pour l'écriture."));
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<QString, ElementInfo> elementsInfo = collectElementsInfo(doc.documentElement());
|
||||
QList<ConductorData> conductors = collectConductors(doc.documentElement());
|
||||
|
||||
@@ -353,7 +364,8 @@ void WiringListExport::toCsv()
|
||||
return a.terminalname2 < b.terminalname2;
|
||||
});
|
||||
|
||||
QTextStream out(&file);
|
||||
QString csv;
|
||||
QTextStream out(&csv);
|
||||
out << tr("Page", "Wiring list CSV header") << ";"
|
||||
<< tr("Composant 1", "Wiring list CSV header") << ";"
|
||||
<< tr("Borne 1", "Wiring list CSV header") << ";"
|
||||
@@ -376,6 +388,5 @@ void WiringListExport::toCsv()
|
||||
<< c.function << "\n";
|
||||
}
|
||||
|
||||
file.close();
|
||||
QMessageBox::information(m_parent, tr("Export réussi"), tr("Le plan de câblage a été exporté avec succès !"));
|
||||
return csv;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,11 @@ class WiringListExport : public QObject
|
||||
public:
|
||||
explicit WiringListExport(QETProject *project, QWidget *parent = nullptr);
|
||||
void toCsv();
|
||||
/**
|
||||
Build the wiring-list CSV and return it as a string (no GUI).
|
||||
Used by toCsv() and by the headless command-line export.
|
||||
*/
|
||||
QString toCsvString() const;
|
||||
|
||||
private:
|
||||
QETProject *m_project;
|
||||
|
||||
Reference in New Issue
Block a user