QElectroTech  0.70
searchandreplaceworker.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 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 
51 {
52  public:
54 
55  void replaceDiagram(QList <Diagram *> diagram_list);
56  void replaceDiagram(Diagram *diagram);
57  void replaceElement(QList <Element *> list);
58  void replaceElement(Element *element);
59  void replaceIndiText(QList<IndependentTextItem *> list);
61  void replaceConductor(QList <Conductor *> list);
62  void replaceConductor(Conductor *conductor);
63  void replaceAdvanced (QList<Diagram *> diagrams = QList<Diagram *>(), QList<Element *> elements = QList<Element *>(),\
64  QList<IndependentTextItem *> texts = QList<IndependentTextItem *>(), QList<Conductor *> conductors = QList<Conductor *>());
65 
66  static QString eraseText() {return QString("XXXXXXXXXXXXXXXXXXX");}
67  static QDate eraseDate() {return QDate(1900, 1, 1);}
68  static void setupLineEdit(QLineEdit *l, QCheckBox *cb, QString str);
70 
71  static ConductorProperties applyChange(const ConductorProperties &original, const ConductorProperties &change);
72  static QString applyChange(const QString &original, const QString &change);
73 
74  private:
78 
81  QString m_indi_text;
84 
85  friend class SearchAndReplaceWidget;
86 };
87 
88 #endif // SEARCHANDREPLACEWORKER_H
void replaceDiagram(QList< Diagram *> diagram_list)
SearchAndReplaceWorker::replaceDiagram Replace all properties of each diagram in , by the current titleblock propertie of this worker.
advancedReplaceStruct m_advanced_struct
static ConductorProperties invalidConductorProperties()
static ConductorProperties applyChange(const ConductorProperties &original, const ConductorProperties &change)
SearchAndReplaceWorker::applyChange.
void replaceIndiText(QList< IndependentTextItem *> list)
SearchAndReplaceWorker::replaceIndiText Replace all displayed text of independent text of Each must ...
void replaceElement(QList< Element *> list)
SearchAndReplaceWorker::replaceElement Replace all properties of each elements in All element must b...
static void setupLineEdit(QLineEdit *l, QCheckBox *cb, QString str)
SearchAndReplaceWorker::setupLineEdit With search and replace, when the variable to edit is a text...
The SearchAndReplaceWorker class This class is the worker use to change properties when use the searc...
TitleBlockProperties m_titleblock_properties
void replaceConductor(QList< Conductor *> list)
SearchAndReplaceWorker::replaceConductor Replace all properties of each conductor in All conductor m...
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...
ConductorProperties m_conductor_properties