fixed broken signals

and added some English comments
This commit is contained in:
plc-user
2025-03-12 00:40:35 +01:00
committed by GitHub
parent 0a9f62126b
commit 8e7120e923
2 changed files with 34 additions and 12 deletions

View File

@@ -128,7 +128,9 @@ int ExportDialog::diagramsToExportCount() const
/** /**
Met en place la liste des schemas Met en place la liste des schemas
Set up the schematics list
@return Le widget representant la liste des schemas @return Le widget representant la liste des schemas
The widget representing the list of schematics
*/ */
QWidget *ExportDialog::initDiagramsListPart() QWidget *ExportDialog::initDiagramsListPart()
{ {
@@ -139,17 +141,17 @@ QWidget *ExportDialog::initDiagramsListPart()
reset_mapper_ = new QSignalMapper(this); reset_mapper_ = new QSignalMapper(this);
clipboard_mapper_ = new QSignalMapper(this); clipboard_mapper_ = new QSignalMapper(this);
connect(preview_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_previewDiagram(int))); connect(preview_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_previewDiagram(int)));
connect(width_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctHeight(int))); connect(width_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_correctHeight(int)));
connect(height_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctWidth(int))); connect(height_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_correctWidth(int)));
connect(ratio_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_keepRatioChanged(int))); connect(ratio_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_keepRatioChanged(int)));
connect(reset_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_resetSize(int))); connect(reset_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_resetSize(int)));
connect(clipboard_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_exportToClipBoard(int))); connect(clipboard_mapper_, SIGNAL(mappedInt(int)), this, SLOT(slot_exportToClipBoard(int)));
diagrams_list_layout_ = new QGridLayout(); diagrams_list_layout_ = new QGridLayout();
int line_count = 0; int line_count = 0;
diagrams_list_layout_ -> addWidget(new QLabel(tr("Titre du folio")), line_count, 1, Qt::AlignHCenter | Qt::AlignVCenter); diagrams_list_layout_ -> addWidget(new QLabel(tr("Titre du folio")), line_count, 1, Qt::AlignHCenter | Qt::AlignVCenter);
diagrams_list_layout_ -> addWidget(new QLabel(tr("Nom de fichier")), line_count, 2, Qt::AlignHCenter | Qt::AlignVCenter); diagrams_list_layout_ -> addWidget(new QLabel(tr("Nom de fichier")), line_count, 2, Qt::AlignHCenter | Qt::AlignVCenter);
diagrams_list_layout_ -> addWidget(new QLabel(tr("Dimensions")), line_count, 3, Qt::AlignHCenter | Qt::AlignVCenter); diagrams_list_layout_ -> addWidget(new QLabel(tr("Dimensions")), line_count, 3, Qt::AlignHCenter | Qt::AlignVCenter);
@@ -172,7 +174,9 @@ QWidget *ExportDialog::initDiagramsListPart()
ratio_mapper_ -> setMapping(diagram_line -> keep_ratio, line_count); ratio_mapper_ -> setMapping(diagram_line -> keep_ratio, line_count);
reset_mapper_ -> setMapping(diagram_line -> reset_size, line_count); reset_mapper_ -> setMapping(diagram_line -> reset_size, line_count);
connect(diagram_line -> width, SIGNAL(valueChanged(int)), width_mapper_, SLOT(map())); connect(diagram_line -> width, SIGNAL(valueChanged(int)), width_mapper_, SLOT(map()));
//connect(diagram_line -> width, &QSpinBox::valueChanged, width_mapper_, qOverload<>(&QSignalMapper::map));
connect(diagram_line -> height, SIGNAL(valueChanged(int)), height_mapper_, SLOT(map())); connect(diagram_line -> height, SIGNAL(valueChanged(int)), height_mapper_, SLOT(map()));
//connect(diagram_line -> height, &QSpinBox::valueChanged, height_mapper_, qOverload<>(&QSignalMapper::map));
connect(diagram_line -> keep_ratio, SIGNAL(toggled(bool)), ratio_mapper_, SLOT(map())); connect(diagram_line -> keep_ratio, SIGNAL(toggled(bool)), ratio_mapper_, SLOT(map()));
connect(diagram_line -> reset_size, SIGNAL(clicked(bool)), reset_mapper_, SLOT(map())); connect(diagram_line -> reset_size, SIGNAL(clicked(bool)), reset_mapper_, SLOT(map()));
@@ -245,21 +249,28 @@ QSize ExportDialog::diagramSize(Diagram *diagram)
Cette methode ajuste la largeur d'un des schemas a exporter en fonction de Cette methode ajuste la largeur d'un des schemas a exporter en fonction de
sa hauteur si et seulement si l'option "Conserver les proportions" est sa hauteur si et seulement si l'option "Conserver les proportions" est
activee pour ce schema. activee pour ce schema.
@param diagram_id numero du schema concerne This method adjusts the width of one of the layouts to be exported
according to its height if, and only if, the Keep proportions option
is enabled for this layout.
@param diagram_id numero du schema concerne / number of drawing concerned
*/ */
void ExportDialog::slot_correctWidth(int diagram_id) void ExportDialog::slot_correctWidth(int diagram_id)
{ {
// recupere l'ExportDiagramLine concernee // recupere l'ExportDiagramLine concernee
// retrieve the ExportDiagramLine concerned
ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id];
if (!current_diagram) return; if (!current_diagram) return;
// ne fait rien si l'option "Conserver les proportions" n'est pas activee // ne fait rien si l'option "Conserver les proportions" n'est pas activee
// do nothing if the Keep proportions option is not active
if (!(current_diagram -> keep_ratio -> isChecked())) return; if (!(current_diagram -> keep_ratio -> isChecked())) return;
// recupere les proportions du schema // recupere les proportions du schema
// retrieve the proportions of the diagram
qreal diagram_ratio = diagramRatio(current_diagram -> diagram); qreal diagram_ratio = diagramRatio(current_diagram -> diagram);
// ajuste la largeur // ajuste la largeur
// adjust the width
current_diagram -> width -> blockSignals(true); current_diagram -> width -> blockSignals(true);
current_diagram -> width -> setValue(qRound(current_diagram -> height -> value() * diagram_ratio)); current_diagram -> width -> setValue(qRound(current_diagram -> height -> value() * diagram_ratio));
current_diagram -> width -> blockSignals(false); current_diagram -> width -> blockSignals(false);
@@ -269,21 +280,28 @@ void ExportDialog::slot_correctWidth(int diagram_id)
Cette methode ajuste la hauteur d'un des schemas a exporter en fonction de Cette methode ajuste la hauteur d'un des schemas a exporter en fonction de
sa largeur si et seulement si l'option "Conserver les proportions" est sa largeur si et seulement si l'option "Conserver les proportions" est
activee pour ce schema. activee pour ce schema.
@param diagram_id numero du schema concerne This method adjusts the height of one of the layouts to be exported
according to its width if, and only if, the Keep proportions option
is enabled for this layout.
@param diagram_id numero du schema concerne / number of drawing concerned
*/ */
void ExportDialog::slot_correctHeight(int diagram_id) void ExportDialog::slot_correctHeight(int diagram_id)
{ {
// recupere l'ExportDiagramLine concernee // recupere l'ExportDiagramLine concernee
// retrieve the ExportDiagramLine concerned
ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id];
if (!current_diagram) return; if (!current_diagram) return;
// ne fait rien si l'option "Conserver les proportions" n'est pas activee // ne fait rien si l'option "Conserver les proportions" n'est pas activee
// do nothing if the Keep proportions option is not active
if (!(current_diagram -> keep_ratio -> isChecked())) return; if (!(current_diagram -> keep_ratio -> isChecked())) return;
// recupere les proportions du schema // recupere les proportions du schema
// retrieve the proportions of the diagram
qreal diagram_ratio = diagramRatio(current_diagram -> diagram); qreal diagram_ratio = diagramRatio(current_diagram -> diagram);
// ajuste la hauteur // ajuste la hauteur
// adjust the height
current_diagram -> height -> blockSignals(true); current_diagram -> height -> blockSignals(true);
current_diagram -> height -> setValue(qRound(current_diagram -> width -> value() / diagram_ratio)); current_diagram -> height -> setValue(qRound(current_diagram -> width -> value() / diagram_ratio));
current_diagram -> height -> blockSignals(false); current_diagram -> height -> blockSignals(false);
@@ -297,10 +315,12 @@ void ExportDialog::slot_correctHeight(int diagram_id)
void ExportDialog::slot_keepRatioChanged(int diagram_id) void ExportDialog::slot_keepRatioChanged(int diagram_id)
{ {
// recupere l'ExportDiagramLine concernee // recupere l'ExportDiagramLine concernee
// retrieve the ExportDiagramLine concerned
ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id]; ExportDialog::ExportDiagramLine *current_diagram = diagram_lines_[diagram_id];
if (!current_diagram) return; if (!current_diagram) return;
// gere l'icone du bouton "Conserver les proportions" // gere l'icone du bouton "Conserver les proportions"
// manages the Keep proportions button icon
if (current_diagram -> keep_ratio -> isChecked()) { if (current_diagram -> keep_ratio -> isChecked()) {
current_diagram -> keep_ratio -> setIcon(QET::Icons::ObjectLocked); current_diagram -> keep_ratio -> setIcon(QET::Icons::ObjectLocked);
} else { } else {
@@ -308,9 +328,11 @@ void ExportDialog::slot_keepRatioChanged(int diagram_id)
} }
// ne fait rien si l'option "Conserver les proportions" n'est pas activee // ne fait rien si l'option "Conserver les proportions" n'est pas activee
// do nothing if the Keep proportions option is not active
if (!(current_diagram -> keep_ratio -> isChecked())) return; if (!(current_diagram -> keep_ratio -> isChecked())) return;
// au contraire, si elle est activee, ajuste la hauteur en fonction de la largeur // au contraire, si elle est activee, ajuste la hauteur en fonction de la largeur
// on the other hand, if it is active, adjusts the height according to the width
slot_correctHeight(diagram_id); slot_correctHeight(diagram_id);
} }
@@ -1014,7 +1036,7 @@ ExportDialog::ExportDiagramLine::ExportDiagramLine(Diagram *dia, QSize diagram_s
if (diagram_title.isEmpty()) diagram_title = QObject::tr("Folio sans titre"); if (diagram_title.isEmpty()) diagram_title = QObject::tr("Folio sans titre");
QString diagram_filename = diagram -> title(); QString diagram_filename = diagram -> title();
if (diagram_filename.isEmpty()) diagram_filename = QObject::tr("schema"); if (diagram_filename.isEmpty()) diagram_filename = QObject::tr("schema");
diagram_filename = QET::stringToFileName(diagram_index + "_" + diagram_filename); diagram_filename = QET::stringToFileName(diagram_index % "_" + diagram_filename);
title_label = new QLabel(diagram_title); title_label = new QLabel(diagram_title);

View File

@@ -217,7 +217,7 @@ QString TitleBlockTemplateLogoManager::confirmLogoName(const QString &initial_na
connect(replace_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(replace_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
connect(rename_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(rename_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
connect(cancel_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(cancel_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
connect(signal_mapper, SIGNAL(mapped(int)), rename_dialog, SLOT(done(int))); connect(signal_mapper, SIGNAL(mappedInt(int)), rename_dialog, SLOT(done(int)));
} }
rd_label -> setText( rd_label -> setText(
QString(tr( QString(tr(
@@ -312,7 +312,7 @@ void TitleBlockTemplateLogoManager::exportLogo()
QString filepath = QFileDialog::getSaveFileName( QString filepath = QFileDialog::getSaveFileName(
this, this,
tr("Choisir un fichier pour exporter ce logo"), tr("Choisir un fichier pour exporter ce logo"),
open_dialog_dir_.absolutePath() + "/" + current_logo, open_dialog_dir_.absolutePath() % "/" + current_logo,
tr("Tous les fichiers (*);;Images vectorielles (*.svg);;Images bitmap (*.png *.jpg *.jpeg *.gif *.bmp *.xpm)") tr("Tous les fichiers (*);;Images vectorielles (*.svg);;Images bitmap (*.png *.jpg *.jpeg *.gif *.bmp *.xpm)")
); );
if (filepath.isEmpty()) return; if (filepath.isEmpty()) return;