Compare commits

...

4 Commits

Author SHA1 Message Date
Laurent Trinques 7426fedba3 crossrefitem: display terminal names on contact symbols in Xref
When a slave element has named terminals in its element definition
(.elmt), the terminal names (e.g. 13/14 for NO, 11/12 for NC,
12/13/14 for SW) are now displayed on each side of the contact
symbol in the cross-reference view.

- NO/NC contacts: name[0] on the left, name[1] on the right
- SW contacts: name[0] (NO) top-left, name[1] (common) top-right,
  name[2] (NC) bottom-left

Terminal names are read from Terminal::name() which is populated
from TerminalData::m_name during element parsing. If terminals are
not named, nothing is displayed (fully backward compatible).

Users are expected to name their own terminals in the element
editor to avoid duplicating elements in the official collection.
2026-05-21 17:10:44 +02:00
Laurent Trinques 027050c7e7 Update windows-msi.yml 2026-05-21 14:32:07 +02:00
Laurent Trinques fc948ad963 QElectroTech.wxs — add ProductCode="$(var.ProductCode)" to <Package>
+ AllowSameVersionUpgrades="yes" to <MajorUpgrade>
windows-msi.yml — in the ‘Extract version’ step, calculate a unique GUID
based on the commit’s SHA, then pass -d ‘ProductCode=$productGuid’ to the WIX build
This ensures that each build will have a different ProductCode → MajorUpgrade will always be triggered
2026-05-21 14:10:17 +02:00
Laurent Trinques 24d075b64c msi: add The AllowSameVersionUpgrades="yes" setting forces uninstallation
even when the MSI version is identical (which is the case here, as 0.100.1.0
remains unchanged between two nightly builds).
2026-05-21 13:59:53 +02:00
3 changed files with 62 additions and 9 deletions
+14
View File
@@ -75,10 +75,21 @@ jobs:
$count = git rev-list HEAD --count 2>$null $count = git rev-list HEAD --count 2>$null
$rev = [int]$count + 473 $rev = [int]$count + 473
$verDisplay = "${ver}-r${rev}-${sha}_x86_64-win64" $verDisplay = "${ver}-r${rev}-${sha}_x86_64-win64"
# Generate a unique ProductCode GUID from the commit SHA
# This ensures MajorUpgrade always triggers, even for same-version builds
$fullSha = git rev-parse HEAD 2>$null
if (-not $fullSha) { $fullSha = [System.Guid]::NewGuid().ToString() }
$bytes = [System.Text.Encoding]::UTF8.GetBytes($fullSha)
$md5 = [System.Security.Cryptography.MD5]::Create().ComputeHash($bytes)
$guidBytes = [byte[]]$md5[0..15]
$productGuid = [System.Guid]::new($guidBytes).ToString().ToUpper()
echo "VERSION_MSI=$verMsi" >> $env:GITHUB_OUTPUT echo "VERSION_MSI=$verMsi" >> $env:GITHUB_OUTPUT
echo "VERSION_DISPLAY=$verDisplay" >> $env:GITHUB_OUTPUT echo "VERSION_DISPLAY=$verDisplay" >> $env:GITHUB_OUTPUT
echo "PRODUCT_GUID=$productGuid" >> $env:GITHUB_OUTPUT
Write-Host "Version MSI : $verMsi" Write-Host "Version MSI : $verMsi"
Write-Host "Version display : $verDisplay" Write-Host "Version display : $verDisplay"
Write-Host "Product GUID : $productGuid"
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# 4. Install WiX v7, accept EULA and install WixUI extension # 4. Install WiX v7, accept EULA and install WixUI extension
@@ -202,10 +213,13 @@ jobs:
Write-Host " LicenseRtf : $licRtf" Write-Host " LicenseRtf : $licRtf"
Write-Host " Output : dist\$outputName" Write-Host " Output : dist\$outputName"
$productGuid = "${{ steps.version.outputs.PRODUCT_GUID }}"
wix build $wxs ` wix build $wxs `
-arch x64 ` -arch x64 `
-d "Version=$version" ` -d "Version=$version" `
-d "ProductVersion=$verDisplay" ` -d "ProductVersion=$verDisplay" `
-d "ProductCode=$productGuid" `
-d "FilesDir=$filesDir" ` -d "FilesDir=$filesDir" `
-d "LicenseRtf=$licRtf" ` -d "LicenseRtf=$licRtf" `
-ext WixToolset.UI.wixext ` -ext WixToolset.UI.wixext `
+2
View File
@@ -16,6 +16,7 @@
Name="QElectroTech" Name="QElectroTech"
Manufacturer="QElectroTech Team" Manufacturer="QElectroTech Team"
Version="$(var.Version)" Version="$(var.Version)"
ProductCode="$(var.ProductCode)"
UpgradeCode="A1B2C3D4-E5F6-7890-ABCD-EF1234567890" UpgradeCode="A1B2C3D4-E5F6-7890-ABCD-EF1234567890"
Language="1033" Language="1033"
Codepage="1252" Codepage="1252"
@@ -28,6 +29,7 @@
<!-- In-place upgrade: automatically uninstalls the previous version --> <!-- In-place upgrade: automatically uninstalls the previous version -->
<MajorUpgrade <MajorUpgrade
DowngradeErrorMessage="A newer version of QElectroTech is already installed." DowngradeErrorMessage="A newer version of QElectroTech is already installed."
AllowSameVersionUpgrades="yes"
Schedule="afterInstallInitialize" /> Schedule="afterInstallInitialize" />
<!-- Installation directory --> <!-- Installation directory -->
+43 -6
View File
@@ -25,6 +25,7 @@
#include "element.h" #include "element.h"
#include "elementtextitemgroup.h" #include "elementtextitemgroup.h"
#include "qgraphicsitemutility.h" #include "qgraphicsitemutility.h"
#include "terminal.h"
//define the height of the header. //define the height of the header.
static int header = 5; static int header = 5;
@@ -627,6 +628,16 @@ void CrossRefItem::drawAsContacts(QPainter &painter)
QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt) QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
{ {
QString str = elementPositionText(elmt); QString str = elementPositionText(elmt);
// Collect terminal names from the element definition (.elmt)
// e.g. name="13" and name="14" on each terminal
QStringList terminal_names;
for (Terminal *t : elmt->terminals()) {
const QString tname = t->name();
if (!tname.isEmpty())
terminal_names << tname;
}
int offset = m_drawed_contacts*10; int offset = m_drawed_contacts*10;
QRectF bounding_rect = QRectF(0, offset, 24, 10); QRectF bounding_rect = QRectF(0, offset, 24, 10);
@@ -643,15 +654,19 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
painter.drawLine(0, offset+6, 8, offset+6); painter.drawLine(0, offset+6, 8, offset+6);
painter.drawLine(16, offset+6, 24, offset+6); painter.drawLine(16, offset+6, 24, offset+6);
///take example of this code for display the terminal text // Draw terminal names on each side of the contact symbol
/*QFont font = QETApp::diagramTextsFont(4); // terminal_names[0] on the left, terminal_names[1] on the right
if (!terminal_names.isEmpty()) {
QFont font = QETApp::diagramTextsFont(4);
font.setBold(true); font.setBold(true);
painter.setFont(font); painter.setFont(font);
QRectF bt(0, offset, 24, 10); QRectF bt(0, offset, 24, 10);
int txt = 10 + m_drawed_contacts; if (terminal_names.size() >= 1)
painter.drawText(bt, Qt::AlignLeft|Qt::AlignTop, QString::number(txt)); painter.drawText(bt, Qt::AlignLeft|Qt::AlignTop, terminal_names[0]);
painter.drawText(bt, Qt::AlignRight|Qt::AlignTop, QString::number(txt)); if (terminal_names.size() >= 2)
painter.setFont(QETApp::diagramTextsFont(5));*/ painter.drawText(bt, Qt::AlignRight|Qt::AlignTop, terminal_names[1]);
painter.setFont(QETApp::diagramTextsFont(5));
}
//draw open contact //draw open contact
if (flags &NO) { if (flags &NO) {
@@ -768,6 +783,28 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
}; };
painter.drawPolyline(p2, 3); 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)
if (!terminal_names.isEmpty()) {
QFont font = QETApp::diagramTextsFont(4);
font.setBold(true);
painter.setFont(font);
// 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[0]); // 12 NO left
if (terminal_names.size() >= 2)
painter.drawText(QRectF(16, offset+4, 8, 6),
Qt::AlignRight|Qt::AlignTop, terminal_names[1]); // 14 common right
if (terminal_names.size() >= 3)
painter.drawText(QRectF(0, offset+9, 8, 6),
Qt::AlignLeft|Qt::AlignTop, terminal_names[2]); // 13 NC left-bottom
painter.setFont(QETApp::diagramTextsFont(5));
}
//Draw the half ellipse off delay //Draw the half ellipse off delay
if (flags &Delay) if (flags &Delay)
{ {