mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Search and replace : We can now replace a properties text (diagram, element, conductor, diagram text) with regular expression
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5658 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -231,6 +231,122 @@ void SearchAndReplaceWorker::replaceConductor(Conductor *conductor)
|
|||||||
replaceConductor(list);
|
replaceConductor(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SearchAndReplaceWorker::replaceAdvanced
|
||||||
|
* Apply the change of text according to the current advancedStruct
|
||||||
|
* All items in the 4 list must belong to the same QETProject,
|
||||||
|
* if not this function do nothing
|
||||||
|
* @param d
|
||||||
|
* @param e
|
||||||
|
* @param t
|
||||||
|
* @param c
|
||||||
|
*/
|
||||||
|
void SearchAndReplaceWorker::replaceAdvanced(QList<Diagram *> diagrams, QList<Element *> elements, QList<IndependentTextItem *> texts, QList<Conductor *> conductors)
|
||||||
|
{
|
||||||
|
QETProject *project_ = nullptr;
|
||||||
|
|
||||||
|
//Some test to check if a least one list have one item
|
||||||
|
//and if all items belong to the same project
|
||||||
|
if (!diagrams.isEmpty()) {
|
||||||
|
project_ = diagrams.first()->project();
|
||||||
|
} else if (!elements.isEmpty() && elements.first()->diagram()) {
|
||||||
|
project_ = elements.first()->diagram()->project();
|
||||||
|
} else if (!texts.isEmpty() && texts.first()->diagram()) {
|
||||||
|
project_ = texts.first()->diagram()->project();
|
||||||
|
} else if (!conductors.isEmpty() && conductors.first()->diagram()) {
|
||||||
|
project_ = conductors.first()->diagram()->project();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Diagram *dd : diagrams) {
|
||||||
|
if (dd->project() != project_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Element *elmt : elements) {
|
||||||
|
if (!elmt->diagram() || elmt->diagram()->project() != project_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (IndependentTextItem *text : texts) {
|
||||||
|
if (!text->diagram() || text->diagram()->project() != project_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Conductor *cc : conductors) {
|
||||||
|
if (!cc->diagram() || cc->diagram()->project() != project_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//The end of the test
|
||||||
|
|
||||||
|
int who = m_advanced_struct.who;
|
||||||
|
if (who == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
project_->undoStack()->beginMacro(QObject::tr("Rechercher / remplacer avancé"));
|
||||||
|
if (who == 0)
|
||||||
|
{
|
||||||
|
for (Diagram *diagram : diagrams)
|
||||||
|
{
|
||||||
|
TitleBlockProperties old_properties = diagram->border_and_titleblock.exportTitleBlock();
|
||||||
|
TitleBlockProperties new_properties = replaceAdvanced(diagram);
|
||||||
|
if (old_properties != new_properties) {
|
||||||
|
project_->undoStack()->push(new ChangeTitleBlockCommand(diagram, old_properties, new_properties));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (who == 1)
|
||||||
|
{
|
||||||
|
for (Element *element : elements)
|
||||||
|
{
|
||||||
|
DiagramContext old_context = element->elementInformations();
|
||||||
|
DiagramContext new_context = replaceAdvanced(element);
|
||||||
|
if (old_context != new_context) {
|
||||||
|
project_->undoStack()->push(new ChangeElementInformationCommand(element, old_context, new_context));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (who == 2)
|
||||||
|
{
|
||||||
|
for (Conductor *conductor : conductors)
|
||||||
|
{
|
||||||
|
ConductorProperties old_properties = conductor->properties();
|
||||||
|
ConductorProperties new_properties = replaceAdvanced(conductor);
|
||||||
|
if (old_properties != new_properties)
|
||||||
|
{
|
||||||
|
QSet <Conductor *> potential_conductors = conductor->relatedPotentialConductors(true);
|
||||||
|
potential_conductors << conductor;
|
||||||
|
|
||||||
|
for (Conductor *c : potential_conductors)
|
||||||
|
{
|
||||||
|
QVariant old_value, new_value;
|
||||||
|
old_value.setValue(c->properties());
|
||||||
|
new_value.setValue(new_properties);
|
||||||
|
project_->undoStack()->push(new QPropertyUndoCommand(c, "properties", old_value, new_value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (who == 3)
|
||||||
|
{
|
||||||
|
for (IndependentTextItem *text : texts)
|
||||||
|
{
|
||||||
|
QRegularExpression rx(m_advanced_struct.search);
|
||||||
|
QString replace = m_advanced_struct.replace;
|
||||||
|
QString after = text->toPlainText();
|
||||||
|
after = after.replace(rx, replace);
|
||||||
|
|
||||||
|
if (after != text->toPlainText()) {
|
||||||
|
project_->undoStack()->push(new ChangeDiagramTextCommand(text, text->toPlainText(), after));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
project_->undoStack()->endMacro();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SearchAndReplaceWorker::setupLineEdit
|
* @brief SearchAndReplaceWorker::setupLineEdit
|
||||||
* With search and replace, when the variable to edit is a text,
|
* With search and replace, when the variable to edit is a text,
|
||||||
@@ -313,3 +429,79 @@ QString SearchAndReplaceWorker::applyChange(const QString &original, const QStri
|
|||||||
else if (change == eraseText()) {return QString();}
|
else if (change == eraseText()) {return QString();}
|
||||||
else {return change;}
|
else {return change;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SearchAndReplaceWorker::replaceAdvanced
|
||||||
|
* @param diagram
|
||||||
|
* @return the titleblock properties with the change applied,
|
||||||
|
* according to the state of @m_advanced_struct
|
||||||
|
*/
|
||||||
|
TitleBlockProperties SearchAndReplaceWorker::replaceAdvanced(Diagram *diagram)
|
||||||
|
{
|
||||||
|
TitleBlockProperties p = diagram->border_and_titleblock.exportTitleBlock();
|
||||||
|
|
||||||
|
if (m_advanced_struct.who == 0)
|
||||||
|
{
|
||||||
|
QRegularExpression rx(m_advanced_struct.search);
|
||||||
|
QString replace = m_advanced_struct.replace;
|
||||||
|
QString what = m_advanced_struct.what;
|
||||||
|
if (what == "title") {p.title = p.title.replace(rx, replace);}
|
||||||
|
else if (what == "author") {p.author = p.author.replace(rx, replace);}
|
||||||
|
else if (what == "filename") {p.filename = p.filename.replace(rx, replace);}
|
||||||
|
else if (what == "folio") {p.folio = p.folio.replace(rx, replace);}
|
||||||
|
else if (what == "plant") {p.plant = p.plant.replace(rx, replace);}
|
||||||
|
else if (what == "locmach") {p.locmach = p.locmach.replace(rx, replace);}
|
||||||
|
else if (what == "indexrev") {p.indexrev = p.indexrev.replace(rx, replace);}
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SearchAndReplaceWorker::replaceAdvanced
|
||||||
|
* @param element
|
||||||
|
* @return The diagram context with the change applied,
|
||||||
|
* according to the state of @m_advanced_struct
|
||||||
|
*/
|
||||||
|
DiagramContext SearchAndReplaceWorker::replaceAdvanced(Element *element)
|
||||||
|
{
|
||||||
|
DiagramContext context = element->elementInformations();
|
||||||
|
|
||||||
|
if (m_advanced_struct.who == 1)
|
||||||
|
{
|
||||||
|
QString what = m_advanced_struct.what;
|
||||||
|
if (context.contains(what))
|
||||||
|
{
|
||||||
|
QRegularExpression rx(m_advanced_struct.search);
|
||||||
|
QString replace = m_advanced_struct.replace;
|
||||||
|
QString value = context[what].toString();
|
||||||
|
context.addValue(what, value.replace(rx, replace));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SearchAndReplaceWorker::replaceAdvanced
|
||||||
|
* @param conductor
|
||||||
|
* @return the conductor properties with the change applied,
|
||||||
|
* according to the state of @m_advanced_struct
|
||||||
|
*/
|
||||||
|
ConductorProperties SearchAndReplaceWorker::replaceAdvanced(Conductor *conductor)
|
||||||
|
{
|
||||||
|
ConductorProperties properties = conductor->properties();
|
||||||
|
|
||||||
|
if (m_advanced_struct.who == 2)
|
||||||
|
{
|
||||||
|
QRegularExpression rx(m_advanced_struct.search);
|
||||||
|
QString what = m_advanced_struct.what;
|
||||||
|
QString replace = m_advanced_struct.replace;
|
||||||
|
|
||||||
|
if (what == "formula") {properties.m_formula.replace(rx, replace);}
|
||||||
|
else if (what == "text") {properties.text.replace(rx, replace);}
|
||||||
|
else if (what == "function") {properties.m_function.replace(rx, replace);}
|
||||||
|
else if (what == "tension/protocol") {properties.m_tension_protocol.replace(rx, replace);}
|
||||||
|
}
|
||||||
|
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,6 +30,19 @@ class Conductor;
|
|||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
|
|
||||||
|
struct advancedReplaceStruct
|
||||||
|
{
|
||||||
|
//Who :
|
||||||
|
// 0 == diagram
|
||||||
|
// 1 == element
|
||||||
|
// 2 == conductor
|
||||||
|
// 3 == independant text
|
||||||
|
int who = -1;
|
||||||
|
QString what;
|
||||||
|
QString search;
|
||||||
|
QString replace;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The SearchAndReplaceWorker class
|
* @brief The SearchAndReplaceWorker class
|
||||||
* This class is the worker use to change properties when use the search and replace function of QET
|
* This class is the worker use to change properties when use the search and replace function of QET
|
||||||
@@ -47,6 +60,8 @@ class SearchAndReplaceWorker
|
|||||||
void replaceIndiText(IndependentTextItem *text);
|
void replaceIndiText(IndependentTextItem *text);
|
||||||
void replaceConductor(QList <Conductor *> list);
|
void replaceConductor(QList <Conductor *> list);
|
||||||
void replaceConductor(Conductor *conductor);
|
void replaceConductor(Conductor *conductor);
|
||||||
|
void replaceAdvanced (QList<Diagram *> diagrams = QList<Diagram *>(), QList<Element *> elements = QList<Element *>(),\
|
||||||
|
QList<IndependentTextItem *> texts = QList<IndependentTextItem *>(), QList<Conductor *> conductors = QList<Conductor *>());
|
||||||
|
|
||||||
static QString eraseText() {return QString("XXXXXXXXXXXXXXXXXXX");}
|
static QString eraseText() {return QString("XXXXXXXXXXXXXXXXXXX");}
|
||||||
static QDate eraseDate() {return QDate(1900, 1, 1);}
|
static QDate eraseDate() {return QDate(1900, 1, 1);}
|
||||||
@@ -57,10 +72,15 @@ class SearchAndReplaceWorker
|
|||||||
static QString applyChange(const QString &original, const QString &change);
|
static QString applyChange(const QString &original, const QString &change);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
TitleBlockProperties replaceAdvanced (Diagram *diagram);
|
||||||
|
DiagramContext replaceAdvanced (Element *element);
|
||||||
|
ConductorProperties replaceAdvanced (Conductor *conductor);
|
||||||
|
|
||||||
TitleBlockProperties m_titleblock_properties;
|
TitleBlockProperties m_titleblock_properties;
|
||||||
DiagramContext m_element_context;
|
DiagramContext m_element_context;
|
||||||
QString m_indi_text;
|
QString m_indi_text;
|
||||||
ConductorProperties m_conductor_properties;
|
ConductorProperties m_conductor_properties;
|
||||||
|
advancedReplaceStruct m_advanced_struct;
|
||||||
|
|
||||||
friend class SearchAndReplaceWidget;
|
friend class SearchAndReplaceWidget;
|
||||||
};
|
};
|
||||||
|
|||||||
118
sources/SearchAndReplace/ui/replaceadvanceddialog.cpp
Normal file
118
sources/SearchAndReplace/ui/replaceadvanceddialog.cpp
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2006-2018 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 "replaceadvanceddialog.h"
|
||||||
|
#include "ui_replaceadvanceddialog.h"
|
||||||
|
#include "qetapp.h"
|
||||||
|
|
||||||
|
#include <QAbstractButton>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief replaceAdvancedDialog::replaceAdvancedDialog
|
||||||
|
* @param advanced
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
|
replaceAdvancedDialog::replaceAdvancedDialog(advancedReplaceStruct advanced, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::replaceAdvancedDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
connect(ui->m_button_box, &QDialogButtonBox::clicked, [this](QAbstractButton *button_) {
|
||||||
|
this->done(ui->m_button_box->buttonRole(button_));
|
||||||
|
});
|
||||||
|
|
||||||
|
fillWhatComboBox(ui->m_who_cb->currentIndex());
|
||||||
|
ui->m_search_le->setFocus();
|
||||||
|
setAdvancedStruct(advanced);
|
||||||
|
}
|
||||||
|
|
||||||
|
replaceAdvancedDialog::~replaceAdvancedDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief replaceAdvancedDialog::setAdvancedStruct
|
||||||
|
* Set the edited advanced struct
|
||||||
|
* @param advanced
|
||||||
|
*/
|
||||||
|
void replaceAdvancedDialog::setAdvancedStruct(advancedReplaceStruct advanced)
|
||||||
|
{
|
||||||
|
int index = advanced.who;
|
||||||
|
if (index == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ui->m_who_cb->setCurrentIndex(index);
|
||||||
|
|
||||||
|
for (int i=0 ; i < ui->m_what_cb->count() ; i++)
|
||||||
|
{
|
||||||
|
if (ui->m_what_cb->itemData(i).toString() == advanced.what)
|
||||||
|
{
|
||||||
|
ui->m_what_cb->setCurrentIndex(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->m_search_le->setText(advanced.search);
|
||||||
|
ui->m_replace_le->setText(advanced.replace);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief replaceAdvancedDialog::advancedStruct
|
||||||
|
* @return the edited advanced struct
|
||||||
|
*/
|
||||||
|
advancedReplaceStruct replaceAdvancedDialog::advancedStruct() const
|
||||||
|
{
|
||||||
|
advancedReplaceStruct a;
|
||||||
|
a.who = ui->m_who_cb->currentIndex();
|
||||||
|
a.what = ui->m_what_cb->currentData().toString();
|
||||||
|
a.search = ui->m_search_le->text();
|
||||||
|
a.replace = ui->m_replace_le->text();
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
void replaceAdvancedDialog::fillWhatComboBox(int index)
|
||||||
|
{
|
||||||
|
ui->m_what_cb->clear();
|
||||||
|
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
for (QString str : QETApp::diagramInfoKeys()) {
|
||||||
|
ui->m_what_cb->addItem(QETApp::diagramTranslatedInfoKey(str), str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (index == 1) {
|
||||||
|
for (QString str : QETApp::elementInfoKeys()) {
|
||||||
|
ui->m_what_cb->addItem(QETApp::elementTranslatedInfoKey(str), str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (index == 2) {
|
||||||
|
for (QString str : QETApp::conductorInfoKeys()) {
|
||||||
|
ui->m_what_cb->addItem(QETApp::conductorTranslatedInfoKey(str), str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief replaceAdvancedDialog::on_m_who_cb_currentIndexChanged
|
||||||
|
* @param index
|
||||||
|
*/
|
||||||
|
void replaceAdvancedDialog::on_m_who_cb_currentIndexChanged(int index) {
|
||||||
|
fillWhatComboBox(index);
|
||||||
|
}
|
||||||
50
sources/SearchAndReplace/ui/replaceadvanceddialog.h
Normal file
50
sources/SearchAndReplace/ui/replaceadvanceddialog.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2006-2018 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 REPLACEADVANCEDDIALOG_H
|
||||||
|
#define REPLACEADVANCEDDIALOG_H
|
||||||
|
|
||||||
|
#include "searchandreplaceworker.h"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class replaceAdvancedDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class replaceAdvancedDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit replaceAdvancedDialog(advancedReplaceStruct advanced, QWidget *parent = nullptr);
|
||||||
|
~replaceAdvancedDialog();
|
||||||
|
|
||||||
|
void setAdvancedStruct(advancedReplaceStruct advanced);
|
||||||
|
advancedReplaceStruct advancedStruct() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void fillWhatComboBox(int index);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_m_who_cb_currentIndexChanged(int index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::replaceAdvancedDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // REPLACEADVANCEDDIALOG_H
|
||||||
113
sources/SearchAndReplace/ui/replaceadvanceddialog.ui
Normal file
113
sources/SearchAndReplace/ui/replaceadvanceddialog.ui
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>replaceAdvancedDialog</class>
|
||||||
|
<widget class="QDialog" name="replaceAdvancedDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>508</width>
|
||||||
|
<height>178</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Rechercher/Remplacer avancé</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0">
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QLineEdit" name="m_replace_le">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>par :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remplacer :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="4">
|
||||||
|
<widget class="QDialogButtonBox" name="m_button_box">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Qui :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="m_search_le">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Texte ou expression régulière</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QComboBox" name="m_what_cb"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="m_who_cb">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Folio</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Élément</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Conducteur</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Texte indépendant</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Quoi :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -68,9 +68,7 @@ DiagramContext ReplaceElementDialog::context() const
|
|||||||
|
|
||||||
void ReplaceElementDialog::buildWidget()
|
void ReplaceElementDialog::buildWidget()
|
||||||
{
|
{
|
||||||
ui->m_button_box->disconnect();
|
connect(ui->m_button_box, &QDialogButtonBox::clicked, [this](QAbstractButton *button_) {
|
||||||
connect(ui->m_button_box, &QDialogButtonBox::clicked, [this](QAbstractButton *button_)
|
|
||||||
{
|
|
||||||
this->done(ui->m_button_box->buttonRole(button_));
|
this->done(ui->m_button_box->buttonRole(button_));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>280</width>
|
<width>284</width>
|
||||||
<height>351</height>
|
<height>346</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="m_scroll_layout"/>
|
<layout class="QVBoxLayout" name="m_scroll_layout"/>
|
||||||
@@ -48,38 +48,5 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections/>
|
||||||
<connection>
|
|
||||||
<sender>m_button_box</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>ReplaceElementDialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>248</x>
|
|
||||||
<y>254</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>m_button_box</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>ReplaceElementDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>316</x>
|
|
||||||
<y>260</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "replaceelementdialog.h"
|
#include "replaceelementdialog.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
#include "replaceconductordialog.h"
|
#include "replaceconductordialog.h"
|
||||||
|
#include "replaceadvanceddialog.h"
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
@@ -214,6 +215,7 @@ void SearchAndReplaceWidget::setHideAdvanced(bool hide) const
|
|||||||
ui->m_replace_all_pb ->setHidden(hide);
|
ui->m_replace_all_pb ->setHidden(hide);
|
||||||
ui->m_mode_cb ->setHidden(hide);
|
ui->m_mode_cb ->setHidden(hide);
|
||||||
ui->m_case_sensitive_cb->setHidden(hide);
|
ui->m_case_sensitive_cb->setHidden(hide);
|
||||||
|
ui->m_advanced_replace_pb->setHidden(hide);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -630,6 +632,94 @@ void SearchAndReplaceWidget::activateNextChecked()
|
|||||||
ui->m_next_pb->isEnabled());
|
ui->m_next_pb->isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SearchAndReplaceWidget::selectedDiagram
|
||||||
|
* @return The list of visible and selected diagram in the tree widget
|
||||||
|
*/
|
||||||
|
QList<Diagram *> SearchAndReplaceWidget::selectedDiagram() const
|
||||||
|
{
|
||||||
|
QList <Diagram *> diagram_list;
|
||||||
|
|
||||||
|
for (QTreeWidgetItem *qtwi : m_diagram_hash.keys())
|
||||||
|
{
|
||||||
|
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
||||||
|
{
|
||||||
|
QPointer <Diagram> p = m_diagram_hash.value(qtwi);
|
||||||
|
if (p) {
|
||||||
|
diagram_list.append(p.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return diagram_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SearchAndReplaceWidget::selectedElement
|
||||||
|
* @return The list of visible and selected element in the tree widget
|
||||||
|
*/
|
||||||
|
QList<Element *> SearchAndReplaceWidget::selectedElement() const
|
||||||
|
{
|
||||||
|
QList <Element *> element_list;
|
||||||
|
|
||||||
|
for (QTreeWidgetItem *qtwi : m_element_hash.keys())
|
||||||
|
{
|
||||||
|
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
||||||
|
{
|
||||||
|
QPointer <Element> p = m_element_hash.value(qtwi);
|
||||||
|
if (p) {
|
||||||
|
element_list.append(p.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return element_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SearchAndReplaceWidget::selectedConductor
|
||||||
|
* @return The list of visible and selected conductor in the tree widget
|
||||||
|
*/
|
||||||
|
QList<Conductor *> SearchAndReplaceWidget::selectedConductor() const
|
||||||
|
{
|
||||||
|
QList <Conductor *> conductor_list;
|
||||||
|
|
||||||
|
for (QTreeWidgetItem *qtwi : m_conductor_hash.keys())
|
||||||
|
{
|
||||||
|
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
||||||
|
{
|
||||||
|
QPointer <Conductor> c = m_conductor_hash.value(qtwi);
|
||||||
|
if (c) {
|
||||||
|
conductor_list.append(c.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return conductor_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SearchAndReplaceWidget::selectedText
|
||||||
|
* @return The list of visible and selected independant text in the tree widget
|
||||||
|
*/
|
||||||
|
QList<IndependentTextItem *> SearchAndReplaceWidget::selectedText() const
|
||||||
|
{
|
||||||
|
QList <IndependentTextItem *> text_list;
|
||||||
|
|
||||||
|
for(QTreeWidgetItem *qtwi : m_text_hash.keys())
|
||||||
|
{
|
||||||
|
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
||||||
|
{
|
||||||
|
QPointer<IndependentTextItem> t = m_text_hash.value(qtwi);
|
||||||
|
if (t) {
|
||||||
|
text_list.append(t.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return text_list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SearchAndReplaceWidget::searchTerms
|
* @brief SearchAndReplaceWidget::searchTerms
|
||||||
* @param diagram
|
* @param diagram
|
||||||
@@ -919,7 +1009,48 @@ void SearchAndReplaceWidget::on_m_replace_pb_clicked()
|
|||||||
m_worker.replaceConductor(c.data());
|
m_worker.replaceConductor(c.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Replace advanced
|
||||||
|
if (ui->m_advanced_replace_pb->text().endsWith(tr(" [édité]")))
|
||||||
|
{
|
||||||
|
QList <Diagram *>dl;
|
||||||
|
QList <Element *>el;
|
||||||
|
QList <IndependentTextItem *>tl;
|
||||||
|
QList <Conductor *>cl;
|
||||||
|
|
||||||
|
if (m_diagram_hash.keys().contains(qtwi))
|
||||||
|
{
|
||||||
|
QPointer<Diagram> d = m_diagram_hash.value(qtwi);
|
||||||
|
if (d) {
|
||||||
|
dl.append(d.data());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (m_element_hash.keys().contains(qtwi))
|
||||||
|
{
|
||||||
|
QPointer<Element> e = m_element_hash.value(qtwi);
|
||||||
|
if (e) {
|
||||||
|
el.append(e.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_text_hash.keys().contains(qtwi))
|
||||||
|
{
|
||||||
|
QPointer<IndependentTextItem> t = m_text_hash.value(qtwi);
|
||||||
|
if (t) {
|
||||||
|
tl.append(t.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_conductor_hash.keys().contains(qtwi))
|
||||||
|
{
|
||||||
|
QPointer<Conductor> c = m_conductor_hash.value(qtwi);
|
||||||
|
if (c) {
|
||||||
|
cl.append(c.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_worker.replaceAdvanced(dl, el, tl, cl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
activateNextChecked();
|
activateNextChecked();
|
||||||
ui->m_replace_pb->setEnabled(ui->m_next_pb->isEnabled());
|
ui->m_replace_pb->setEnabled(ui->m_next_pb->isEnabled());
|
||||||
}
|
}
|
||||||
@@ -930,71 +1061,22 @@ void SearchAndReplaceWidget::on_m_replace_pb_clicked()
|
|||||||
*/
|
*/
|
||||||
void SearchAndReplaceWidget::on_m_replace_all_pb_clicked()
|
void SearchAndReplaceWidget::on_m_replace_all_pb_clicked()
|
||||||
{
|
{
|
||||||
//Replace folio
|
if (ui->m_folio_pb->text().endsWith(tr(" [édité]"))) {
|
||||||
if (ui->m_folio_pb->text().endsWith(tr(" [édité]")))
|
m_worker.replaceDiagram(selectedDiagram());
|
||||||
{
|
|
||||||
QList <Diagram *> diagram_list;
|
|
||||||
for (QTreeWidgetItem *qtwi : m_diagram_hash.keys())
|
|
||||||
{
|
|
||||||
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
|
||||||
{
|
|
||||||
QPointer <Diagram> p = m_diagram_hash.value(qtwi);
|
|
||||||
if (p) {
|
|
||||||
diagram_list.append(p.data());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_worker.replaceDiagram(diagram_list);
|
|
||||||
}
|
|
||||||
//Replace text
|
|
||||||
if (ui->m_element_pb->text().endsWith(tr(" [édité]")))
|
|
||||||
{
|
|
||||||
QList <Element *> element_list;
|
|
||||||
for (QTreeWidgetItem *qtwi : m_element_hash.keys())
|
|
||||||
{
|
|
||||||
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
|
||||||
{
|
|
||||||
QPointer <Element> p = m_element_hash.value(qtwi);
|
|
||||||
if (p) {
|
|
||||||
element_list.append(p.data());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_worker.replaceElement(element_list);
|
|
||||||
}
|
|
||||||
//Replace indi text
|
|
||||||
if (!ui->m_replace_le->text().isEmpty())
|
|
||||||
{
|
|
||||||
QList <IndependentTextItem*> text_list;
|
|
||||||
for(QTreeWidgetItem *qtwi : m_text_hash.keys())
|
|
||||||
{
|
|
||||||
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
|
||||||
{
|
|
||||||
QPointer<IndependentTextItem> t = m_text_hash.value(qtwi);
|
|
||||||
if (t) {
|
|
||||||
text_list.append(t.data());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (ui->m_element_pb->text().endsWith(tr(" [édité]"))) {
|
||||||
|
m_worker.replaceElement(selectedElement());
|
||||||
}
|
}
|
||||||
|
if (!ui->m_replace_le->text().isEmpty()) {
|
||||||
m_worker.m_indi_text = ui->m_replace_le->text();
|
m_worker.m_indi_text = ui->m_replace_le->text();
|
||||||
m_worker.replaceIndiText(text_list );
|
m_worker.replaceIndiText(selectedText() );
|
||||||
}
|
}
|
||||||
|
if (ui->m_conductor_pb->text().endsWith(tr(" [édité]"))) {
|
||||||
|
m_worker.replaceConductor(selectedConductor());
|
||||||
|
}
|
||||||
|
if (ui->m_advanced_replace_pb->text().endsWith(tr(" [édité]"))) {
|
||||||
|
|
||||||
//Replace conductor
|
m_worker.replaceAdvanced(selectedDiagram(), selectedElement(), selectedText(), selectedConductor());
|
||||||
if (ui->m_conductor_pb->text().endsWith(tr(" [édité]")))
|
|
||||||
{
|
|
||||||
QList <Conductor *> conductor_list;
|
|
||||||
for (QTreeWidgetItem *qtwi : m_conductor_hash.keys())
|
|
||||||
{
|
|
||||||
if (!qtwi->isHidden() && qtwi->checkState(0) == Qt::Checked)
|
|
||||||
{
|
|
||||||
QPointer <Conductor> c = m_conductor_hash.value(qtwi);
|
|
||||||
if (c) {
|
|
||||||
conductor_list.append(c.data());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_worker.replaceConductor(conductor_list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Change was made, we reload the panel
|
//Change was made, we reload the panel
|
||||||
@@ -1081,3 +1163,32 @@ void SearchAndReplaceWidget::on_m_conductor_pb_clicked()
|
|||||||
m_worker.m_conductor_properties = m_worker.invalidConductorProperties();
|
m_worker.m_conductor_properties = m_worker.invalidConductorProperties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SearchAndReplaceWidget::on_m_advanced_replace_pb_clicked
|
||||||
|
* Open the advanced editor.
|
||||||
|
*/
|
||||||
|
void SearchAndReplaceWidget::on_m_advanced_replace_pb_clicked()
|
||||||
|
{
|
||||||
|
replaceAdvancedDialog *dialog = new replaceAdvancedDialog(m_worker.m_advanced_struct, this);
|
||||||
|
int result = dialog->exec();
|
||||||
|
|
||||||
|
if (result == QDialogButtonBox::AcceptRole)
|
||||||
|
{
|
||||||
|
QString text = ui->m_advanced_replace_pb->text();
|
||||||
|
if (!text.endsWith(tr(" [édité]"))) {
|
||||||
|
text.append(tr(" [édité]"));
|
||||||
|
}
|
||||||
|
ui->m_advanced_replace_pb->setText(text);
|
||||||
|
m_worker.m_advanced_struct = dialog->advancedStruct();
|
||||||
|
}
|
||||||
|
else if (result == QDialogButtonBox::ResetRole)
|
||||||
|
{
|
||||||
|
QString text = ui->m_advanced_replace_pb->text();
|
||||||
|
if (text.endsWith(tr(" [édité]"))) {
|
||||||
|
text.remove(tr(" [édité]"));
|
||||||
|
}
|
||||||
|
ui->m_advanced_replace_pb->setText(text);
|
||||||
|
m_worker.m_advanced_struct = advancedReplaceStruct();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ class SearchAndReplaceWidget : public QWidget
|
|||||||
void setChildCheckState(QTreeWidgetItem *item, Qt::CheckState check, bool deep = true);
|
void setChildCheckState(QTreeWidgetItem *item, Qt::CheckState check, bool deep = true);
|
||||||
void updateParentCheckState(QTreeWidgetItem *item, bool all_parents = true);
|
void updateParentCheckState(QTreeWidgetItem *item, bool all_parents = true);
|
||||||
void activateNextChecked();
|
void activateNextChecked();
|
||||||
|
QList<Diagram *> selectedDiagram() const;
|
||||||
|
QList<Element *> selectedElement() const;
|
||||||
|
QList<Conductor *> selectedConductor() const;
|
||||||
|
QList<IndependentTextItem *> selectedText() const;
|
||||||
|
|
||||||
static QStringList searchTerms(Diagram *diagram);
|
static QStringList searchTerms(Diagram *diagram);
|
||||||
static QStringList searchTerms(Element *element);
|
static QStringList searchTerms(Element *element);
|
||||||
static QStringList searchTerms(Conductor *conductor);
|
static QStringList searchTerms(Conductor *conductor);
|
||||||
@@ -80,6 +85,7 @@ class SearchAndReplaceWidget : public QWidget
|
|||||||
void on_m_mode_cb_currentIndexChanged(int index);
|
void on_m_mode_cb_currentIndexChanged(int index);
|
||||||
void on_m_case_sensitive_cb_stateChanged(int arg1);
|
void on_m_case_sensitive_cb_stateChanged(int arg1);
|
||||||
void on_m_conductor_pb_clicked();
|
void on_m_conductor_pb_clicked();
|
||||||
|
void on_m_advanced_replace_pb_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SearchAndReplaceWidget *ui;
|
Ui::SearchAndReplaceWidget *ui;
|
||||||
|
|||||||
@@ -13,7 +13,14 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,1" columnstretch="0,0,1,0,0,0,0,0,0,0,0,0">
|
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,1" columnstretch="0,0,1,0,0,0,0,0,0,0,0,0,0">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="m_search">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chercher :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="m_quit_button">
|
<widget class="QPushButton" name="m_quit_button">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -31,14 +38,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="7">
|
||||||
<widget class="QLabel" name="m_search">
|
|
||||||
<property name="text">
|
|
||||||
<string>Chercher :</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="6">
|
|
||||||
<widget class="QComboBox" name="m_mode_cb">
|
<widget class="QComboBox" name="m_mode_cb">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Mode</string>
|
<string>Mode</string>
|
||||||
@@ -58,14 +58,21 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="7">
|
<item row="0" column="8">
|
||||||
<widget class="QCheckBox" name="m_case_sensitive_cb">
|
<widget class="QCheckBox" name="m_case_sensitive_cb">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sensible à la casse</string>
|
<string>Sensible à la casse</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="8">
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="m_replace">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remplacer :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="9">
|
||||||
<widget class="QPushButton" name="m_next_pb">
|
<widget class="QPushButton" name="m_next_pb">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Aller à la correspondance suivante</string>
|
<string>Aller à la correspondance suivante</string>
|
||||||
@@ -82,7 +89,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="9">
|
<item row="0" column="10">
|
||||||
<widget class="QPushButton" name="m_previous_pb">
|
<widget class="QPushButton" name="m_previous_pb">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Aller à la correspondance précédente</string>
|
<string>Aller à la correspondance précédente</string>
|
||||||
@@ -99,24 +106,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="10">
|
<item row="0" column="12">
|
||||||
<widget class="QPushButton" name="m_reload_pb">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Actualiser</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../../qelectrotech.qrc">
|
|
||||||
<normaloff>:/ico/16x16/view-refresh.png</normaloff>:/ico/16x16/view-refresh.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="11">
|
|
||||||
<widget class="QPushButton" name="m_advanced_pb">
|
<widget class="QPushButton" name="m_advanced_pb">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Afficher les options avancées</p></body></html></string>
|
<string><html><head/><body><p>Afficher les options avancées</p></body></html></string>
|
||||||
@@ -139,10 +129,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="11">
|
||||||
<widget class="QLabel" name="m_replace">
|
<widget class="QPushButton" name="m_reload_pb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Actualiser</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remplacer :</string>
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/16x16/view-refresh.png</normaloff>:/ico/16x16/view-refresh.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -189,7 +189,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="8" colspan="2">
|
<item row="1" column="9" colspan="2">
|
||||||
<widget class="QPushButton" name="m_replace_pb">
|
<widget class="QPushButton" name="m_replace_pb">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@@ -202,7 +202,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="10" colspan="2">
|
<item row="1" column="11" colspan="2">
|
||||||
<widget class="QPushButton" name="m_replace_all_pb">
|
<widget class="QPushButton" name="m_replace_all_pb">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@@ -215,14 +215,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2" colspan="4">
|
<item row="2" column="0" colspan="13">
|
||||||
<widget class="QLineEdit" name="m_search_le">
|
|
||||||
<property name="clearButtonEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="12">
|
|
||||||
<widget class="QTreeWidget" name="m_tree_widget">
|
<widget class="QTreeWidget" name="m_tree_widget">
|
||||||
<property name="uniformRowHeights">
|
<property name="uniformRowHeights">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@@ -243,6 +236,20 @@
|
|||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
|
<widget class="QPushButton" name="m_advanced_replace_pb">
|
||||||
|
<property name="text">
|
||||||
|
<string>avancé</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" colspan="5">
|
||||||
|
<widget class="QLineEdit" name="m_search_le">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
|||||||
@@ -378,6 +378,72 @@ QString QETApp::elementInfoToVar(const QString &info)
|
|||||||
return (QString ("%{void}"));
|
return (QString ("%{void}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETApp::conductorInfoKeys
|
||||||
|
* @return the conductor information keys
|
||||||
|
*/
|
||||||
|
QStringList QETApp::conductorInfoKeys()
|
||||||
|
{
|
||||||
|
QStringList keys;
|
||||||
|
keys.append("formula");
|
||||||
|
keys.append("text");
|
||||||
|
keys.append("function");
|
||||||
|
keys.append("tension/protocol");
|
||||||
|
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETApp::conductorTranslatedInfoKey
|
||||||
|
* @param key
|
||||||
|
* @return the translated information key given by @key
|
||||||
|
* If @key don't match, return an empty string
|
||||||
|
*/
|
||||||
|
QString QETApp::conductorTranslatedInfoKey(const QString &key)
|
||||||
|
{
|
||||||
|
if (key == "formula") return tr("Formule du texte");
|
||||||
|
else if (key == "text") return tr("Texte");
|
||||||
|
else if (key == "function") return tr("Fonction");
|
||||||
|
else if (key == "tension/protocol") return tr("Tension / Protocole");
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETApp::diagramInfoKeys
|
||||||
|
* @return the diagram default information keys
|
||||||
|
*/
|
||||||
|
QStringList QETApp::diagramInfoKeys()
|
||||||
|
{
|
||||||
|
QStringList list;
|
||||||
|
list.append("title");
|
||||||
|
list.append("author");
|
||||||
|
list.append("filename");
|
||||||
|
list.append("folio");
|
||||||
|
list.append("plant");
|
||||||
|
list.append("locmach");
|
||||||
|
list.append("indexrev");
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETApp::diagramTranslatedInfoKey
|
||||||
|
* @param key
|
||||||
|
* @return the translated information key given by @key
|
||||||
|
* If @key don't match, return an empty string
|
||||||
|
*/
|
||||||
|
QString QETApp::diagramTranslatedInfoKey(const QString &key)
|
||||||
|
{
|
||||||
|
if (key == "title") return tr("Titre");
|
||||||
|
else if (key == "author") return tr("Auteur");
|
||||||
|
else if (key == "filename") return tr("Fichier");
|
||||||
|
else if (key == "folio") return tr("Folio");
|
||||||
|
else if (key == "plant") return tr("Installation");
|
||||||
|
else if (key == "locmach") return tr("Localisation");
|
||||||
|
else if (key == "indexrev") return tr("Indice Rev");
|
||||||
|
else return QString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return the common title block templates collection, i.e. the one provided
|
@return the common title block templates collection, i.e. the one provided
|
||||||
by QElecrotTech
|
by QElecrotTech
|
||||||
|
|||||||
@@ -76,6 +76,12 @@ class QETApp : public QObject
|
|||||||
static QString elementTranslatedInfoKey(const QString &);
|
static QString elementTranslatedInfoKey(const QString &);
|
||||||
static QString elementInfoToVar(const QString &info);
|
static QString elementInfoToVar(const QString &info);
|
||||||
|
|
||||||
|
static QStringList conductorInfoKeys();
|
||||||
|
static QString conductorTranslatedInfoKey(const QString &key);
|
||||||
|
|
||||||
|
static QStringList diagramInfoKeys();
|
||||||
|
static QString diagramTranslatedInfoKey(const QString &key);
|
||||||
|
|
||||||
static TitleBlockTemplatesFilesCollection *commonTitleBlockTemplatesCollection();
|
static TitleBlockTemplatesFilesCollection *commonTitleBlockTemplatesCollection();
|
||||||
static TitleBlockTemplatesFilesCollection *customTitleBlockTemplatesCollection();
|
static TitleBlockTemplatesFilesCollection *customTitleBlockTemplatesCollection();
|
||||||
static QList<TitleBlockTemplatesCollection *> availableTitleBlockTemplatesCollections();
|
static QList<TitleBlockTemplatesCollection *> availableTitleBlockTemplatesCollections();
|
||||||
|
|||||||
Reference in New Issue
Block a user