mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-21 03:39:58 +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:
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>
|
||||
@@ -57,7 +57,7 @@ class ReplaceConductorDialog : public QDialog
|
||||
void on_m_color_pb_clicked();
|
||||
void on_m_color_2_pb_clicked();
|
||||
|
||||
private:
|
||||
private:
|
||||
Ui::ReplaceConductorDialog *ui;
|
||||
ConductorProperties m_properties;
|
||||
};
|
||||
|
||||
@@ -68,9 +68,7 @@ DiagramContext ReplaceElementDialog::context() const
|
||||
|
||||
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_));
|
||||
});
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>280</width>
|
||||
<height>351</height>
|
||||
<width>284</width>
|
||||
<height>346</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="m_scroll_layout"/>
|
||||
@@ -48,38 +48,5 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<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>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "replaceelementdialog.h"
|
||||
#include "qetapp.h"
|
||||
#include "replaceconductordialog.h"
|
||||
#include "replaceadvanceddialog.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
@@ -214,6 +215,7 @@ void SearchAndReplaceWidget::setHideAdvanced(bool hide) const
|
||||
ui->m_replace_all_pb ->setHidden(hide);
|
||||
ui->m_mode_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());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param diagram
|
||||
@@ -919,7 +1009,48 @@ void SearchAndReplaceWidget::on_m_replace_pb_clicked()
|
||||
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();
|
||||
ui->m_replace_pb->setEnabled(ui->m_next_pb->isEnabled());
|
||||
}
|
||||
@@ -930,72 +1061,23 @@ void SearchAndReplaceWidget::on_m_replace_pb_clicked()
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_replace_all_pb_clicked()
|
||||
{
|
||||
//Replace folio
|
||||
if (ui->m_folio_pb->text().endsWith(tr(" [édité]")))
|
||||
{
|
||||
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);
|
||||
if (ui->m_folio_pb->text().endsWith(tr(" [édité]"))) {
|
||||
m_worker.replaceDiagram(selectedDiagram());
|
||||
}
|
||||
//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);
|
||||
if (ui->m_element_pb->text().endsWith(tr(" [édité]"))) {
|
||||
m_worker.replaceElement(selectedElement());
|
||||
}
|
||||
//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_replace_le->text().isEmpty()) {
|
||||
m_worker.m_indi_text = ui->m_replace_le->text();
|
||||
m_worker.replaceIndiText(text_list );
|
||||
m_worker.replaceIndiText(selectedText() );
|
||||
}
|
||||
|
||||
//Replace conductor
|
||||
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);
|
||||
if (ui->m_conductor_pb->text().endsWith(tr(" [édité]"))) {
|
||||
m_worker.replaceConductor(selectedConductor());
|
||||
}
|
||||
if (ui->m_advanced_replace_pb->text().endsWith(tr(" [édité]"))) {
|
||||
|
||||
m_worker.replaceAdvanced(selectedDiagram(), selectedElement(), selectedText(), selectedConductor());
|
||||
}
|
||||
|
||||
//Change was made, we reload the panel
|
||||
//and search again to keep up to date the tree widget
|
||||
@@ -1081,3 +1163,32 @@ void SearchAndReplaceWidget::on_m_conductor_pb_clicked()
|
||||
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 updateParentCheckState(QTreeWidgetItem *item, bool all_parents = true);
|
||||
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(Element *element);
|
||||
static QStringList searchTerms(Conductor *conductor);
|
||||
@@ -80,8 +85,9 @@ class SearchAndReplaceWidget : public QWidget
|
||||
void on_m_mode_cb_currentIndexChanged(int index);
|
||||
void on_m_case_sensitive_cb_stateChanged(int arg1);
|
||||
void on_m_conductor_pb_clicked();
|
||||
void on_m_advanced_replace_pb_clicked();
|
||||
|
||||
private:
|
||||
private:
|
||||
Ui::SearchAndReplaceWidget *ui;
|
||||
QETDiagramEditor *m_editor;
|
||||
QTreeWidgetItem *m_root_qtwi = nullptr,
|
||||
|
||||
@@ -13,7 +13,14 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</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">
|
||||
<widget class="QPushButton" name="m_quit_button">
|
||||
<property name="toolTip">
|
||||
@@ -31,14 +38,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="m_search">
|
||||
<property name="text">
|
||||
<string>Chercher :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<item row="0" column="7">
|
||||
<widget class="QComboBox" name="m_mode_cb">
|
||||
<property name="toolTip">
|
||||
<string>Mode</string>
|
||||
@@ -58,14 +58,21 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<item row="0" column="8">
|
||||
<widget class="QCheckBox" name="m_case_sensitive_cb">
|
||||
<property name="text">
|
||||
<string>Sensible à la casse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<property name="toolTip">
|
||||
<string>Aller à la correspondance suivante</string>
|
||||
@@ -82,7 +89,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<item row="0" column="10">
|
||||
<widget class="QPushButton" name="m_previous_pb">
|
||||
<property name="toolTip">
|
||||
<string>Aller à la correspondance précédente</string>
|
||||
@@ -99,24 +106,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<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">
|
||||
<item row="0" column="12">
|
||||
<widget class="QPushButton" name="m_advanced_pb">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Afficher les options avancées</p></body></html></string>
|
||||
@@ -139,10 +129,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="m_replace">
|
||||
<item row="0" column="11">
|
||||
<widget class="QPushButton" name="m_reload_pb">
|
||||
<property name="toolTip">
|
||||
<string>Actualiser</string>
|
||||
</property>
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -189,7 +189,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="8" colspan="2">
|
||||
<item row="1" column="9" colspan="2">
|
||||
<widget class="QPushButton" name="m_replace_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@@ -202,7 +202,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="10" colspan="2">
|
||||
<item row="1" column="11" colspan="2">
|
||||
<widget class="QPushButton" name="m_replace_all_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@@ -215,14 +215,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="4">
|
||||
<widget class="QLineEdit" name="m_search_le">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="12">
|
||||
<item row="2" column="0" colspan="13">
|
||||
<widget class="QTreeWidget" name="m_tree_widget">
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
@@ -243,6 +236,20 @@
|
||||
</column>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<resources>
|
||||
|
||||
Reference in New Issue
Block a user