QElectroTech  0.8-dev
searchandreplaceworker.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef SEARCHANDREPLACEWORKER_H
19 #define SEARCHANDREPLACEWORKER_H
20 
21 #include <QDate>
22 
23 #include "titleblockproperties.h"
24 #include "conductorproperties.h"
25 
26 class Diagram;
27 class Element;
29 class Conductor;
30 class QLineEdit;
31 class QCheckBox;
32 
34 {
35  //Who :
36  // 0 == diagram
37  // 1 == element
38  // 2 == conductor
39  // 3 == independant text
40  int who = -1;
41  QString what;
42  QString search;
43  QString replace;
44 };
45 
52 {
53  public:
55 
56  void replaceDiagram(QList <Diagram *> diagram_list);
57  void replaceDiagram(Diagram *diagram);
58  void replaceElement(QList <Element *> list);
59  void replaceElement(Element *element);
60  void replaceIndiText(QList<IndependentTextItem *> list);
62  void replaceConductor(QList <Conductor *> list);
63  void replaceConductor(Conductor *conductor);
64  void replaceAdvanced (
65  QList<Diagram *> diagrams = QList<Diagram *>(),
66  QList<Element *> elements = QList<Element *>(),
67  QList<IndependentTextItem *>
68  texts = QList<IndependentTextItem *>(),
69  QList<Conductor *>
70  conductors = QList<Conductor *>());
71 
72  static QString eraseText()
73  {return QString("XXXXXXXXXXXXXXXXXXX");}
74  static QDate eraseDate() {return QDate(1900, 1, 1);}
75  static void setupLineEdit(QLineEdit *l,
76  QCheckBox *cb,
77  QString str);
79 
81  const ConductorProperties &original,
82  const ConductorProperties &change);
83  static QString applyChange(const QString &original,
84  const QString &change);
85 
86  private:
90 
93  QString m_indi_text;
96 
97  friend class SearchAndReplaceWidget;
98 };
99 
100 #endif // SEARCHANDREPLACEWORKER_H
Element::Terminale
@ Terminale
Definition: element.h:57
ConductorProperties::m_show_text
bool m_show_text
Definition: conductorproperties.h:103
advancedReplaceStruct::who
int who
Definition: searchandreplaceworker.h:40
ChangeTitleBlockCommand
The ChangeTitleBlockCommand class This command changes the title block properties for a particular di...
Definition: changetitleblockcommand.h:31
ConductorProperties::color
QColor color
Definition: conductorproperties.h:85
QETProject::undoStack
QUndoStack * undoStack()
Definition: qetproject.h:168
ConductorProperties::style
Qt::PenStyle style
Definition: conductorproperties.h:110
diagramcommands.h
SearchAndReplaceWorker::m_indi_text
QString m_indi_text
Definition: searchandreplaceworker.h:93
SearchAndReplaceWorker::replaceConductor
void replaceConductor(QList< Conductor * > list)
SearchAndReplaceWorker::replaceConductor Replace all properties of each conductor in list All conduct...
Definition: searchandreplaceworker.cpp:197
SearchAndReplaceWorker::m_conductor_properties
ConductorProperties m_conductor_properties
Definition: searchandreplaceworker.h:94
SearchAndReplaceWidget
Definition: searchandreplacewidget.h:38
titleblockproperties.h
Element::elementInformations
DiagramContext elementInformations() const
Definition: element.h:97
SearchAndReplaceWorker::replaceIndiText
void replaceIndiText(QList< IndependentTextItem * > list)
SearchAndReplaceWorker::replaceIndiText Replace all displayed text of independent text of list Each m...
Definition: searchandreplaceworker.cpp:158
advancedReplaceStruct::what
QString what
Definition: searchandreplaceworker.h:41
QETApp::elementInfoKeys
static QStringList elementInfoKeys()
QETApp::elementInfoKeys.
Definition: qetapp.cpp:366
SearchAndReplaceWorker::eraseText
static QString eraseText()
Definition: searchandreplaceworker.h:72
changeelementinformationcommand.h
SearchAndReplaceWorker::replaceDiagram
void replaceDiagram(QList< Diagram * > diagram_list)
SearchAndReplaceWorker::replaceDiagram Replace all properties of each diagram in diagram_list,...
Definition: searchandreplaceworker.cpp:41
Element::Simple
@ Simple
Definition: element.h:51
TitleBlockProperties::date
QDate date
Date (displayed by the default template)
Definition: titleblockproperties.h:56
ConductorProperties::verti_rotate_text
double verti_rotate_text
Definition: conductorproperties.h:100
Diagram::border_and_titleblock
BorderTitleBlock border_and_titleblock
Diagram dimensions and title block.
Definition: diagram.h:83
qetapp.h
ConductorProperties::m_dash_size
int m_dash_size
Definition: conductorproperties.h:97
TitleBlockProperties::context
DiagramContext context
Container for the additional, user-defined fields.
Definition: titleblockproperties.h:66
TitleBlockProperties::title
QString title
Folio title (displayed by the default template)
Definition: titleblockproperties.h:54
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
changetitleblockcommand.h
ConductorProperties::text_size
int text_size
Definition: conductorproperties.h:96
TitleBlockProperties
Definition: titleblockproperties.h:29
ConductorProperties::singleLineProperties
SingleLineProperties singleLineProperties
Definition: conductorproperties.h:112
TitleBlockProperties::locmach
QString locmach
Location(displayed by the default template)
Definition: titleblockproperties.h:59
BorderTitleBlock::exportTitleBlock
TitleBlockProperties exportTitleBlock()
BorderTitleBlock::exportTitleBlock.
Definition: bordertitleblock.cpp:279
Element::Master
@ Master
Definition: element.h:55
TitleBlockProperties::plant
QString plant
Plant (displayed by the default template)
Definition: titleblockproperties.h:58
element.h
Conductor::properties
ConductorProperties properties
Definition: conductor.h:48
SearchAndReplaceWorker::SearchAndReplaceWorker
SearchAndReplaceWorker()
Definition: searchandreplaceworker.cpp:29
qpropertyundocommand.h
advancedReplaceStruct::search
QString search
Definition: searchandreplaceworker.h:42
DiagramContext::value
QVariant value(const QString &key) const
Definition: diagramcontext.cpp:100
ConductorProperties::m_vertical_alignment
Qt::Alignment m_vertical_alignment
Definition: conductorproperties.h:108
Element
Definition: element.h:41
ConductorProperties::m_function
QString m_function
Definition: conductorproperties.h:90
SearchAndReplaceWorker::invalidConductorProperties
static ConductorProperties invalidConductorProperties()
Definition: searchandreplaceworker.cpp:380
TitleBlockProperties::filename
QString filename
Filename (displayed by the default template)
Definition: titleblockproperties.h:57
conductorproperties.h
ConductorProperties::horiz_rotate_text
double horiz_rotate_text
Definition: conductorproperties.h:101
SearchAndReplaceWorker
The SearchAndReplaceWorker class This class is the worker use to change properties when use the searc...
Definition: searchandreplaceworker.h:52
ConductorProperties::m_horizontal_alignment
Qt::Alignment m_horizontal_alignment
Definition: conductorproperties.h:107
independenttextitem.h
ConductorProperties::m_color_2
QColor m_color_2
Definition: conductorproperties.h:86
QETProject
Definition: qetproject.h:51
ConductorProperties::cond_size
double cond_size
Definition: conductorproperties.h:99
SearchAndReplaceWorker::eraseDate
static QDate eraseDate()
Definition: searchandreplaceworker.h:74
ChangeDiagramTextCommand
The ChangeDiagramTextCommand class This commad modifies a text item.
Definition: diagramcommands.h:206
ConductorProperties::m_formula
QString m_formula
Definition: conductorproperties.h:94
TitleBlockProperties::author
QString author
Author of the diagram/folio (displayed by the default template)
Definition: titleblockproperties.h:55
SearchAndReplaceWorker::applyChange
static ConductorProperties applyChange(const ConductorProperties &original, const ConductorProperties &change)
SearchAndReplaceWorker::applyChange.
Definition: searchandreplaceworker.cpp:406
ChangeElementInformationCommand
The ChangeElementInformationCommand class This class manage undo/redo to change the element informati...
Definition: changeelementinformationcommand.h:31
ConductorProperties
The ConductorProperties class This class represents the functional properties of a particular conduct...
Definition: conductorproperties.h:68
SearchAndReplaceWorker::m_advanced_struct
advancedReplaceStruct m_advanced_struct
Definition: searchandreplaceworker.h:95
IndependentTextItem
Definition: independenttextitem.h:28
DiagramContext::add
void add(DiagramContext other)
DiagramContext::add Add all value of other to this. If a key already exist, the value is replaced....
Definition: diagramcontext.cpp:31
searchandreplaceworker.h
advancedReplaceStruct
Definition: searchandreplaceworker.h:34
DiagramContext::contains
bool contains(const QString &) const
Definition: diagramcontext.cpp:70
SearchAndReplaceWorker::replaceAdvanced
void replaceAdvanced(QList< Diagram * > diagrams=QList< Diagram * >(), QList< Element * > elements=QList< Element * >(), QList< IndependentTextItem * > texts=QList< IndependentTextItem * >(), QList< Conductor * > conductors=QList< Conductor * >())
SearchAndReplaceWorker::replaceAdvanced Apply the change of text according to the current advancedStr...
Definition: searchandreplaceworker.cpp:249
ConductorProperties::m_bicolor
bool m_bicolor
Definition: conductorproperties.h:105
advancedReplaceStruct::replace
QString replace
Definition: searchandreplaceworker.h:43
Conductor
Definition: conductor.h:43
TitleBlockProperties::indexrev
QString indexrev
Revision Index (displayed by the default template)
Definition: titleblockproperties.h:60
ConductorProperties::m_wire_color
QString m_wire_color
Definition: conductorproperties.h:92
SearchAndReplaceWorker::m_element_context
DiagramContext m_element_context
Definition: searchandreplaceworker.h:92
QPropertyUndoCommand
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition: qpropertyundocommand.h:34
ConductorProperties::text
QString text
Definition: conductorproperties.h:89
ConductorProperties::m_tension_protocol
QString m_tension_protocol
Definition: conductorproperties.h:91
DiagramContext::addValue
bool addValue(const QString &, const QVariant &, bool show=true)
Definition: diagramcontext.cpp:91
TitleBlockProperties::folio
QString folio
Folio information (displayed by the default template)
Definition: titleblockproperties.h:62
SearchAndReplaceWorker::m_titleblock_properties
TitleBlockProperties m_titleblock_properties
Definition: searchandreplaceworker.h:91
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
ConductorProperties::m_wire_section
QString m_wire_section
Definition: conductorproperties.h:93
SearchAndReplaceWorker::setupLineEdit
static void setupLineEdit(QLineEdit *l, QCheckBox *cb, QString str)
SearchAndReplaceWorker::setupLineEdit With search and replace, when the variable to edit is a text,...
Definition: searchandreplaceworker.cpp:371
DiagramContext
Definition: diagramcontext.h:56
diagram.h
SearchAndReplaceWorker::replaceElement
void replaceElement(QList< Element * > list)
SearchAndReplaceWorker::replaceElement Replace all properties of each elements in list All element mu...
Definition: searchandreplaceworker.cpp:103