mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-24 07:54:13 +02:00
Give new projects the terminal labelling of the settings
The labelling of the terminals is a setting of the project, so that the same file draws the same way on every machine which opens it. A new project has to start with something, though, and that is now a default of the application: Configure QElectroTech > New project, on the sheet tab, the same group box with the same two choices the project properties use -- what it saves is only what a new project starts with. Off unless the settings say otherwise, so a new project draws the whole label in one field, as it always did, and a project saved after that keeps its own choice (readTerminalLabelSplitXml()). The settings key starts with "diagrameditor/default", the prefix of the new-project part of a configuration profile, so the choice travels with the other defaults of a new project. The project gets the setting in its own properties and nowhere else: the page of the new sheets does not offer it, and the tests say so.
This commit is contained in:
@@ -136,6 +136,43 @@ NewDiagramPage::NewDiagramPage(QETProject *project,
|
||||
}
|
||||
}
|
||||
|
||||
//How the terminals of a new project draw their label, built for
|
||||
//the application's defaults only: per project this is a project
|
||||
//property (project properties > General page), which is where the
|
||||
//project gets it from. Same group box, same words, same choice as
|
||||
//there -- only what a new project starts with is read and written
|
||||
//here, in the settings (diagrameditor/defaultterminallabelling).
|
||||
if (!m_project) {
|
||||
m_terminal_label_gb = new QGroupBox(tr("Display of the terminal labelling", "group box title"));
|
||||
m_terminal_label_combined_rb = new QRadioButton(
|
||||
tr("Show the label and the terminal number in one field", "radio button label"));
|
||||
m_terminal_label_combined_rb -> setToolTip(tr(
|
||||
"A terminal's label (X1:1) is drawn as a whole, the way it has always been.",
|
||||
"tooltip"));
|
||||
m_terminal_label_split_rb = new QRadioButton(tr("Split the label and the terminal number",
|
||||
"radio button label"));
|
||||
m_terminal_label_split_rb -> setToolTip(tr(
|
||||
"The label (X1) is drawn in one field and the terminal number (1) in another, "
|
||||
"which a terminal symbol may place where it wants -- and hide when it must. "
|
||||
"A symbol without such a field shows the two, one under the other.",
|
||||
"tooltip"));
|
||||
m_terminal_label_help = new QLabel(tr("Only the drawing changes: what is written in the element, "
|
||||
"the numbering, the sorting and the exports keep the whole label.",
|
||||
"informative label"));
|
||||
m_terminal_label_help -> setWordWrap(true);
|
||||
|
||||
QVBoxLayout *terminal_label_layout = new QVBoxLayout(m_terminal_label_gb);
|
||||
terminal_label_layout -> addWidget(m_terminal_label_combined_rb);
|
||||
terminal_label_layout -> addWidget(m_terminal_label_split_rb);
|
||||
terminal_label_layout -> addWidget(m_terminal_label_help);
|
||||
|
||||
if (settings.value(QStringLiteral("diagrameditor/defaultterminallabelling"), false).toBool()) {
|
||||
m_terminal_label_split_rb -> setChecked(true);
|
||||
} else {
|
||||
m_terminal_label_combined_rb -> setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
//If there is a project, we edit his properties
|
||||
if (m_project) {
|
||||
bpw -> setProperties (m_project -> defaultBorderProperties());
|
||||
@@ -159,6 +196,11 @@ NewDiagramPage::NewDiagramPage(QETProject *project,
|
||||
|
||||
diagram_layout -> addWidget(bpw);
|
||||
diagram_layout -> addWidget(ipw);
|
||||
//The default labelling of the terminals, application's defaults only
|
||||
if (m_terminal_label_gb) {
|
||||
diagram_layout -> addWidget(m_terminal_label_gb);
|
||||
diagram_layout -> addStretch();
|
||||
}
|
||||
//A width only: a minimum height set by hand replaces the one the
|
||||
//tabs ask for, so on a low screen (1080p with display scaling,
|
||||
//#1562) the dialog's scroll area never scrolled and the tallest
|
||||
@@ -292,6 +334,13 @@ void NewDiagramPage::applyConf()
|
||||
}
|
||||
settings.endArray();
|
||||
|
||||
// How a new project's terminals draw their label. Kept with the
|
||||
// other defaults of a new project (the key starts with
|
||||
// "diagrameditor/default", the prefix of that part of a
|
||||
// configuration profile, see ConfigProfile::partOf())
|
||||
settings.setValue(QStringLiteral("diagrameditor/defaultterminallabelling"),
|
||||
m_terminal_label_split_rb -> isChecked());
|
||||
|
||||
// save global auto-numbering defaults
|
||||
//
|
||||
// The cable rule is written here as well as by its own Apply
|
||||
|
||||
@@ -74,6 +74,14 @@ public slots:
|
||||
ReportPropertieWidget *rpw; ///< Widget to edit default report label
|
||||
XRefPropertiesWidget *xrefpw; ///< Widget to edit default xref properties
|
||||
GuidesPropertiesWidget *m_gpw; ///< Widget to edit guides
|
||||
//How a new project's terminals draw their label, the application's
|
||||
//default (Configure QElectroTech > New project). Per project it is
|
||||
//a project property (project properties > General), so these are
|
||||
//only built for the application's defaults, without a project.
|
||||
QGroupBox *m_terminal_label_gb = nullptr;
|
||||
QRadioButton *m_terminal_label_combined_rb = nullptr;
|
||||
QRadioButton *m_terminal_label_split_rb = nullptr;
|
||||
QLabel *m_terminal_label_help = nullptr;
|
||||
TitleBlockProperties savedTbp; ///< Used to save current TBP and retrieve later
|
||||
QTabWidget *m_tab_widget; ///< Main tab widget (stored for later access)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user