mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 14:44:15 +02:00
9771ca96c9
English has been the source language of the program for a while now
(upstream: "Make English the source language ..."), the cable feature
came in with French ones: about 200 translatable strings over 30 files,
the two settings pages built from .ui files, four comments and one test
which asserted the old wording (blocking review comment by ispyisail).
The wording follows what the code base already uses where it exists:
Plant (=) and Location (+) as qetinformation.cpp names those element
information, Designation for the field the cable form calls its BMK,
Length, Sheet for folio, Automatic numbering, Cross-reference, and Right
aligned / Centred / Left aligned the way cabletextformatdialog.cpp
already spells the three alignment entries.
Two things are more than a word-for-word swap:
- xrefpropertieswidget.cpp:291 wrote the label of the master field on
every type change with a hardcoded tr("Maitre"), so the English
"Master" coming from the .ui was overwritten for every type, cable or
not: a real bug next to being French. The wording now comes back from
the .ui and only a cable renames the field to "Text:", so the two
cannot drift apart again.
- tst_cabletypelist kept asserting that a new catalogue is *labelled*
in French. That label line is the translated header and reads English
now. The test still reads files with French headers on purpose:
headerAliasMap() keeps the five old French labels as aliases next to
the English ones, so catalogues written by earlier builds, including
the one the reviewer reads her own types from, keep loading.
The .ts files are deliberately not regenerated here. Upstream
regenerates them on master, as it did for the language change itself,
and a translation is keyed on the source string: while the sources were
French a German user saw French in the cable dialogs, and an English
source string with no translation yet shows as it is.
Build clean, ctest 92/93, the one failure being the pre-existing
headless tst_menubarkeyboard.
101 lines
2.8 KiB
C++
101 lines
2.8 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 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 "cablelistmodelpropertieswidget.h"
|
|
|
|
#include "cablelistmodel.h"
|
|
#include "cablequerywidget.h"
|
|
|
|
#include <QDialog>
|
|
#include <QDialogButtonBox>
|
|
#include <QHBoxLayout>
|
|
#include <QPushButton>
|
|
#include <QVBoxLayout>
|
|
|
|
/**
|
|
@brief CableListModelPropertiesWidget::CableListModelPropertiesWidget
|
|
@param model
|
|
@param parent
|
|
*/
|
|
CableListModelPropertiesWidget::CableListModelPropertiesWidget(
|
|
CableListModel *model,
|
|
QWidget *parent) :
|
|
PropertiesEditorWidget(parent)
|
|
{
|
|
auto *layout = new QHBoxLayout(this);
|
|
m_edit_pb = new QPushButton(tr("Edit columns..."), this);
|
|
m_refresh_pb = new QPushButton(tr("Refresh"), this);
|
|
layout->addWidget(m_edit_pb);
|
|
layout->addWidget(m_refresh_pb);
|
|
layout->addStretch();
|
|
|
|
connect(m_edit_pb, &QPushButton::clicked, this, &CableListModelPropertiesWidget::editColumns);
|
|
connect(m_refresh_pb, &QPushButton::clicked, this, &CableListModelPropertiesWidget::refreshRows);
|
|
|
|
setModel(model);
|
|
}
|
|
|
|
/**
|
|
@brief CableListModelPropertiesWidget::setModel
|
|
@param model
|
|
*/
|
|
void CableListModelPropertiesWidget::setModel(CableListModel *model)
|
|
{
|
|
m_model = model;
|
|
m_edit_pb->setEnabled(m_model != nullptr);
|
|
m_refresh_pb->setEnabled(m_model != nullptr);
|
|
}
|
|
|
|
/**
|
|
@brief CableListModelPropertiesWidget::editColumns
|
|
Ask for the columns again and put them on the table right away --
|
|
the same immediate, not-undoable way the database table changes its
|
|
query
|
|
*/
|
|
void CableListModelPropertiesWidget::editColumns()
|
|
{
|
|
if (!m_model) {
|
|
return;
|
|
}
|
|
|
|
QDialog d(this);
|
|
d.setWindowTitle(tr("Cable list columns"));
|
|
auto *layout = new QVBoxLayout(&d);
|
|
auto *widget = new CableQueryWidget(&d);
|
|
widget->setFields(m_model->fields());
|
|
layout->addWidget(widget);
|
|
|
|
auto *button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
|
layout->addWidget(button_box);
|
|
connect(button_box, &QDialogButtonBox::accepted, &d, &QDialog::accept);
|
|
connect(button_box, &QDialogButtonBox::rejected, &d, &QDialog::reject);
|
|
|
|
if (d.exec()) {
|
|
m_model->setFields(widget->selectedKeys());
|
|
}
|
|
}
|
|
|
|
/**
|
|
@brief CableListModelPropertiesWidget::refreshRows
|
|
*/
|
|
void CableListModelPropertiesWidget::refreshRows()
|
|
{
|
|
if (m_model) {
|
|
m_model->refresh();
|
|
}
|
|
}
|