mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-11 10:49:58 +01:00
merge
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,12 +16,14 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementcollectionhandler.h"
|
||||
#include "renamedialog.h"
|
||||
|
||||
#include "../qetproject.h"
|
||||
#include "../qetxml.h"
|
||||
#include "ui/renamedialog.h"
|
||||
#include "xmlelementcollection.h"
|
||||
#include "qetproject.h"
|
||||
#include "qetxml.h"
|
||||
#include <QFile>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
|
||||
/******************************************************/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,8 +18,8 @@
|
||||
#ifndef ELEMENTCOLLECTIONHANDLER_H
|
||||
#define ELEMENTCOLLECTIONHANDLER_H
|
||||
|
||||
#include "../NameList/nameslist.h"
|
||||
#include "elementslocation.h"
|
||||
#include "nameslist.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,13 +16,14 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementscollectionmodel.h"
|
||||
|
||||
#include "../qetapp.h"
|
||||
#include "../qetproject.h"
|
||||
#include "elementcollectionhandler.h"
|
||||
#include "elementcollectionitem.h"
|
||||
#include "fileelementcollectionitem.h"
|
||||
#include "xmlprojectelementcollectionitem.h"
|
||||
#include "qetapp.h"
|
||||
#include "xmlelementcollection.h"
|
||||
#include "qetproject.h"
|
||||
#include "elementcollectionhandler.h"
|
||||
#include "xmlprojectelementcollectionitem.h"
|
||||
|
||||
#include <QFutureWatcher>
|
||||
#include <QtConcurrent>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,27 +16,31 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementscollectionwidget.h"
|
||||
#include "elementscollectionmodel.h"
|
||||
#include "elementcollectionitem.h"
|
||||
#include "qeticons.h"
|
||||
#include "fileelementcollectionitem.h"
|
||||
#include "elementslocation.h"
|
||||
#include "qetapp.h"
|
||||
#include "qetmessagebox.h"
|
||||
#include "elementscategoryeditor.h"
|
||||
#include "newelementwizard.h"
|
||||
#include "xmlprojectelementcollectionitem.h"
|
||||
#include "qetproject.h"
|
||||
#include "qetelementeditor.h"
|
||||
#include "elementstreeview.h"
|
||||
#include "qetdiagrameditor.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QMenu>
|
||||
#include "../editor/ui/qetelementeditor.h"
|
||||
#include "../elementscategoryeditor.h"
|
||||
#include "../newelementwizard.h"
|
||||
#include "../qetapp.h"
|
||||
#include "../qetdiagrameditor.h"
|
||||
#include "../qeticons.h"
|
||||
#include "../qetmessagebox.h"
|
||||
#include "../qetproject.h"
|
||||
#include "elementcollectionitem.h"
|
||||
#include "elementscollectionmodel.h"
|
||||
#include "elementslocation.h"
|
||||
#include "elementstreeview.h"
|
||||
#include "fileelementcollectionitem.h"
|
||||
#include "xmlprojectelementcollectionitem.h"
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QMenu>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QVBoxLayout>
|
||||
#include <QtGlobal>
|
||||
#include <QProgressBar>
|
||||
#include <QStatusBar>
|
||||
#include <QLineEdit>
|
||||
|
||||
/**
|
||||
@brief ElementsCollectionWidget::ElementsCollectionWidget
|
||||
@@ -740,17 +744,22 @@ void ElementsCollectionWidget::search()
|
||||
return;
|
||||
}
|
||||
|
||||
//start the search when text have at least 3 letters.
|
||||
if (text.count() < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
hideCollection(true);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||
QStringList text_list = text.split("+", QString::SkipEmptyParts);
|
||||
const QStringList text_list = text.split("+", QString::SkipEmptyParts);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||
#endif
|
||||
QStringList text_list = text.split("+", Qt::SkipEmptyParts);
|
||||
const QStringList text_list = text.split("+", Qt::SkipEmptyParts);
|
||||
#endif
|
||||
QModelIndexList match_index;
|
||||
foreach (QString txt, text_list) {
|
||||
for (QString txt : text_list) {
|
||||
match_index << m_model->match(m_showed_index.isValid()
|
||||
? m_model->index(0,0,m_showed_index)
|
||||
: m_model->index(0,0),
|
||||
@@ -761,7 +770,7 @@ void ElementsCollectionWidget::search()
|
||||
| Qt::MatchRecursive);
|
||||
}
|
||||
|
||||
foreach(QModelIndex index, match_index)
|
||||
for(QModelIndex index : match_index)
|
||||
showAndExpandItem(index);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,15 +16,16 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementslocation.h"
|
||||
#include "qetapp.h"
|
||||
|
||||
#include "../elementscollectioncache.h"
|
||||
#include "../factory/elementpicturefactory.h"
|
||||
#include "../qetapp.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
#include "../qetproject.h"
|
||||
#include "../qetxml.h"
|
||||
#include "xmlelementcollection.h"
|
||||
#include "qetproject.h"
|
||||
#include "elementscollectioncache.h"
|
||||
#include "elementpicturefactory.h"
|
||||
#include "element.h"
|
||||
#include "qetxml.h"
|
||||
|
||||
#include <QPicture>
|
||||
#include <QDebug>
|
||||
|
||||
// make this class usable with QVariant
|
||||
int ElementsLocation::MetaTypeId = qRegisterMetaType<ElementsLocation>("ElementsLocation");
|
||||
@@ -676,28 +677,24 @@ pugi::xml_document ElementsLocation::pugiXml() const
|
||||
#endif
|
||||
if (!m_project)
|
||||
{
|
||||
if (docu.load_file(m_file_system_path.toStdString().c_str()))
|
||||
{
|
||||
#ifndef Q_OS_LINUX
|
||||
if (docu.load_file(m_file_system_path.toStdString().c_str())) {
|
||||
docu.save(m_string_stream);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
docu.load_file(m_file_system_path.toStdString().c_str());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
QString str = m_collection_path;
|
||||
//Get the xml dom from Qt xml and copie to pugi xml
|
||||
QDomElement element = m_project
|
||||
->embeddedElementCollection()
|
||||
->element(str.remove("embed://"));
|
||||
//Get the xml dom from Qt xml and copie to pugi xml
|
||||
QDomDocument qdoc;
|
||||
if (isElement())
|
||||
{
|
||||
qdoc.appendChild(qdoc.importNode(
|
||||
element.firstChildElement(
|
||||
"definition"),
|
||||
true));
|
||||
QString str = m_collection_path;
|
||||
if (isElement()) {
|
||||
QDomElement element = m_project->embeddedElementCollection()->element(str.remove("embed://"));
|
||||
qdoc.appendChild(qdoc.importNode(element.firstChildElement("definition"),true));
|
||||
} else {
|
||||
QDomElement element = m_project->embeddedElementCollection()->directory(str.remove("embed://"));
|
||||
qdoc.appendChild(qdoc.importNode(element, true));
|
||||
}
|
||||
docu.load_string(qdoc.toString(4).toStdString().c_str());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,11 +18,12 @@
|
||||
#ifndef ELEMENTS_LOCATION_H
|
||||
#define ELEMENTS_LOCATION_H
|
||||
|
||||
#include "nameslist.h"
|
||||
#include "diagramcontext.h"
|
||||
#include "pugixml.hpp"
|
||||
#include <QString>
|
||||
#include "../NameList/nameslist.h"
|
||||
#include "../diagramcontext.h"
|
||||
#include "../pugixml/pugixml.hpp"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
|
||||
#ifndef Q_OS_LINUX
|
||||
#include "sstream"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,11 +16,12 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementstreeview.h"
|
||||
|
||||
#include "../factory/elementfactory.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
#include "../qeticons.h"
|
||||
#include "elementcollectionitem.h"
|
||||
#include "elementslocation.h"
|
||||
#include "elementfactory.h"
|
||||
#include "qeticons.h"
|
||||
#include "element.h"
|
||||
|
||||
#include <QDrag>
|
||||
#include <QStandardItemModel>
|
||||
@@ -69,10 +70,9 @@ void ElementsTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
*/
|
||||
void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
||||
{
|
||||
if (!location.exist())
|
||||
return;
|
||||
if (! location.exist()) return;
|
||||
|
||||
QDrag *drag = new QDrag(this);
|
||||
QScopedPointer<QDrag> drag(new QDrag(this));
|
||||
|
||||
QString location_str = location.toString();
|
||||
QMimeData *mime_data = new QMimeData();
|
||||
@@ -91,14 +91,12 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
||||
|
||||
//Build the element for set the pixmap of the QDrag
|
||||
int elmt_creation_state;
|
||||
Element *temp_elmt = ElementFactory::Instance()->createElement(
|
||||
location, nullptr,
|
||||
&elmt_creation_state);
|
||||
if (elmt_creation_state)
|
||||
{
|
||||
delete temp_elmt;
|
||||
return;
|
||||
}
|
||||
QScopedPointer<Element> temp_elmt(
|
||||
ElementFactory::Instance()->createElement(
|
||||
location,
|
||||
nullptr,
|
||||
&elmt_creation_state));
|
||||
if (elmt_creation_state) { return; }
|
||||
|
||||
QPixmap elmt_pixmap(temp_elmt->pixmap());
|
||||
QPoint elmt_hotspot(temp_elmt->hotspot());
|
||||
@@ -123,9 +121,6 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
||||
|
||||
drag->setPixmap(elmt_pixmap);
|
||||
drag->setHotSpot(elmt_hotspot);
|
||||
|
||||
|
||||
delete temp_elmt;
|
||||
}
|
||||
|
||||
drag->setMimeData(mime_data);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -17,9 +17,10 @@
|
||||
*/
|
||||
|
||||
#include "fileelementcollectionitem.h"
|
||||
|
||||
#include "../qetapp.h"
|
||||
#include "../qeticons.h"
|
||||
#include "elementslocation.h"
|
||||
#include "qetapp.h"
|
||||
#include "qeticons.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
@@ -282,9 +283,8 @@ void FileElementCollectionItem::setUpData()
|
||||
ElementsLocation loc(collectionPath());
|
||||
DiagramContext context = loc.elementInformations();
|
||||
QStringList search_list;
|
||||
for (QString key : context.keys()) {
|
||||
search_list.append(context.value(key).toString());
|
||||
}
|
||||
for (QString& key : context.keys())
|
||||
{ search_list.append(context.value(key).toString()); }
|
||||
search_list.append(localName(loc));
|
||||
setData(search_list.join(" "));
|
||||
}
|
||||
@@ -352,8 +352,8 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
||||
QDir dir (fileSystemPath());
|
||||
|
||||
//Get all directory in this directory.
|
||||
for(auto str : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot,
|
||||
QDir::Name))
|
||||
for (auto& str :
|
||||
dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
appendRow(feci);
|
||||
@@ -367,8 +367,8 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
||||
|
||||
//Get all elmt file in this directory
|
||||
dir.setNameFilters(QStringList() << "*.elmt");
|
||||
for(auto str : dir.entryList(QDir::Files | QDir::NoDotAndDotDot,
|
||||
QDir::Name))
|
||||
for (auto& str :
|
||||
dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
appendRow(feci);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,8 +18,9 @@
|
||||
#ifndef RENAMEDIALOG_H
|
||||
#define RENAMEDIALOG_H
|
||||
|
||||
#include "../../qet.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include "qet.h"
|
||||
|
||||
namespace Ui {
|
||||
class RenameDialog;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,10 +16,11 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "xmlelementcollection.h"
|
||||
#include "nameslist.h"
|
||||
#include "qetxml.h"
|
||||
|
||||
#include "../NameList/nameslist.h"
|
||||
#include "../qetproject.h"
|
||||
#include "../qetxml.h"
|
||||
#include "elementslocation.h"
|
||||
#include "qetproject.h"
|
||||
|
||||
/**
|
||||
@brief XmlElementCollection::XmlElementCollection
|
||||
@@ -45,19 +46,44 @@ XmlElementCollection::XmlElementCollection(QETProject *project) :
|
||||
collection.appendChild(import);
|
||||
|
||||
NamesList names;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
|
||||
const QChar russian_data[24] = { 0x0418, 0x043C, 0x043F, 0x043E, 0x0440,
|
||||
0x0442, 0x0438, 0x0440, 0x043E, 0x0432,
|
||||
0x0430, 0x043D, 0x043D, 0x044B, 0x0435,
|
||||
0x0020, 0x044D, 0x043B, 0x0435, 0x043C,
|
||||
0x0435, 0x043D, 0x0442, 0x044B };
|
||||
const QChar greek_data[18] = { 0x0395, 0x03b9, 0x03c3, 0x03b7, 0x03b3,
|
||||
0x03bc, 0x03ad, 0x03bd, 0x03b1, 0x0020,
|
||||
0x03c3, 0x03c4, 0x03bf, 0x03b9, 0x03c7,
|
||||
0x03b5, 0x03af, 0x03b1 };
|
||||
const QChar turkish_data[12] ={ 0x0130, 0x0074, 0x0068, 0x0061, 0x006C,
|
||||
0x0020, 0x00F6, 0x011F, 0x0065, 0x006C,
|
||||
0x0065, 0x0072 };
|
||||
const QChar russian_data[24] = {
|
||||
0x0418, 0x043C, 0x043F, 0x043E, 0x0440, 0x0442, 0x0438, 0x0440,
|
||||
0x043E, 0x0432, 0x0430, 0x043D, 0x043D, 0x044B, 0x0435, 0x0020,
|
||||
0x044D, 0x043B, 0x0435, 0x043C, 0x0435, 0x043D, 0x0442, 0x044B};
|
||||
const QChar greek_data[18] = {
|
||||
0x0395,
|
||||
0x03b9,
|
||||
0x03c3,
|
||||
0x03b7,
|
||||
0x03b3,
|
||||
0x03bc,
|
||||
0x03ad,
|
||||
0x03bd,
|
||||
0x03b1,
|
||||
0x0020,
|
||||
0x03c3,
|
||||
0x03c4,
|
||||
0x03bf,
|
||||
0x03b9,
|
||||
0x03c7,
|
||||
0x03b5,
|
||||
0x03af,
|
||||
0x03b1};
|
||||
const QChar turkish_data[12] = {
|
||||
0x0130,
|
||||
0x0074,
|
||||
0x0068,
|
||||
0x0061,
|
||||
0x006C,
|
||||
0x0020,
|
||||
0x00F6,
|
||||
0x011F,
|
||||
0x0065,
|
||||
0x006C,
|
||||
0x0065,
|
||||
0x0072};
|
||||
names.addName("fr", "Éléments importés");
|
||||
names.addName("en", "Imported elements");
|
||||
names.addName("de", "Importierte elemente");
|
||||
@@ -76,7 +102,27 @@ XmlElementCollection::XmlElementCollection(QETProject *project) :
|
||||
names.addName("da", "Importerede elementer");
|
||||
names.addName("hr", "Uvezeni elementi");
|
||||
names.addName("sl", "Uvoženi elementi");
|
||||
|
||||
#else
|
||||
# if TODO_LIST
|
||||
# pragma message("@TODO remove code for QT 6 or later")
|
||||
# endif
|
||||
qDebug() << "Help code for QT 6 or later";
|
||||
names.addName("fr", "Éléments importés");
|
||||
names.addName("en", "Imported elements");
|
||||
names.addName("de", "Importierte elemente");
|
||||
names.addName("es", "Elementos importados");
|
||||
names.addName("cs", "Zavedené prvky");
|
||||
names.addName("pl", "Elementy importowane");
|
||||
names.addName("pt", "elementos importados");
|
||||
names.addName("it", "Elementi importati");
|
||||
names.addName("nl", "Elementen geïmporteerd");
|
||||
names.addName("hr", "Uvezeni elementi");
|
||||
names.addName("ca", "Elements importats");
|
||||
names.addName("ro", "Elemente importate");
|
||||
names.addName("da", "Importerede elementer");
|
||||
names.addName("hr", "Uvezeni elementi");
|
||||
names.addName("sl", "Uvoženi elementi");
|
||||
#endif
|
||||
|
||||
import.appendChild(names.toXml(m_dom_document));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -15,11 +15,12 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "qetproject.h"
|
||||
#include "xmlelementcollection.h"
|
||||
#include "qeticons.h"
|
||||
#include "xmlprojectelementcollectionitem.h"
|
||||
|
||||
#include "../qeticons.h"
|
||||
#include "../qetproject.h"
|
||||
#include "xmlelementcollection.h"
|
||||
|
||||
/**
|
||||
@brief XmlProjectElementCollectionItem::XmlProjectElementCollectionItem
|
||||
Constructor
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,8 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "nameslist.h"
|
||||
#include "qetapp.h"
|
||||
|
||||
#include "../qetapp.h"
|
||||
|
||||
// make this class usable with QVariant
|
||||
int NamesList::MetaTypeId = qRegisterMetaType<NamesList>("NamesList");
|
||||
@@ -229,28 +230,25 @@ bool NamesList::operator==(const NamesList &nl) const
|
||||
}
|
||||
|
||||
/**
|
||||
Return the adequate name regarding the current system locale.
|
||||
By order of preference, this function chooses:
|
||||
- the name in the system language
|
||||
- the English name
|
||||
- the provided fallback name if non-empty
|
||||
- the first language encountered in the list
|
||||
- an empty string
|
||||
@param fallback_name name to be returned when no adequate name has been found
|
||||
@return The adequate name regarding the current system locale.
|
||||
*/
|
||||
* @brief NamesList::name
|
||||
* Return the adequate name regarding the current system locale.
|
||||
* By order of preference, this function chooses:
|
||||
* - the name in the system language
|
||||
* - the English name
|
||||
* - the provided fallback name if non-empty
|
||||
* - the first language encountered in the list
|
||||
* - an empty string
|
||||
* @param fallback_name
|
||||
* name to be returned when no adequate name has been found
|
||||
* @return The adequate name regarding the current system locale.
|
||||
*/
|
||||
QString NamesList::name(const QString &fallback_name) const
|
||||
{
|
||||
QString system_language = QETApp::langFromSetting();
|
||||
QString returned_name;
|
||||
if (!hash_names[system_language].isEmpty()) {
|
||||
returned_name = hash_names[system_language];
|
||||
} else if (!hash_names["en"].isEmpty()) {
|
||||
returned_name = hash_names["en"];
|
||||
} else if (!fallback_name.isEmpty()) {
|
||||
returned_name = fallback_name;
|
||||
} else if (hash_names.count()) {
|
||||
returned_name = hash_names.value(hash_names.keys().first());
|
||||
}
|
||||
return(returned_name);
|
||||
if (! hash_names[system_language].isEmpty())
|
||||
return (hash_names[system_language]);
|
||||
if (! hash_names["en"].isEmpty()) return (hash_names["en"]);
|
||||
if (! fallback_name.isEmpty()) return (fallback_name);
|
||||
if (hash_names.count()) return (hash_names.begin().value());
|
||||
return (QString(""));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -17,8 +17,9 @@
|
||||
*/
|
||||
#ifndef NAMES_LIST_H
|
||||
#define NAMES_LIST_H
|
||||
#include "../pugixml/pugixml.hpp"
|
||||
|
||||
#include <QtXml>
|
||||
#include "pugixml.hpp"
|
||||
/**
|
||||
Cette classe represente une liste de noms, utilisee
|
||||
par les elements et categories pour embarquer un meme nom en plusieurs
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,10 +18,10 @@
|
||||
#ifndef NAMELISTWIDGET_H
|
||||
#define NAMELISTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHash>
|
||||
#include "../nameslist.h"
|
||||
|
||||
#include "nameslist.h"
|
||||
#include <QHash>
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class NameListWidget;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,15 +16,16 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "searchandreplaceworker.h"
|
||||
#include "diagram.h"
|
||||
#include "changetitleblockcommand.h"
|
||||
#include "changeelementinformationcommand.h"
|
||||
#include "element.h"
|
||||
#include "qetapp.h"
|
||||
#include "independenttextitem.h"
|
||||
#include "diagramcommands.h"
|
||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
|
||||
#include "../QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "../diagram.h"
|
||||
#include "../diagramcommands.h"
|
||||
#include "../qetapp.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
#include "../qetgraphicsitem/independenttextitem.h"
|
||||
#include "../qetinformation.h"
|
||||
#include "../undocommand/changeelementinformationcommand.h"
|
||||
#include "../undocommand/changetitleblockcommand.h"
|
||||
|
||||
SearchAndReplaceWorker::SearchAndReplaceWorker()
|
||||
{
|
||||
@@ -126,7 +127,7 @@ void SearchAndReplaceWorker::replaceElement(QList<Element *> list)
|
||||
{
|
||||
DiagramContext old_context;
|
||||
DiagramContext new_context = old_context = elmt->elementInformations();
|
||||
for (QString key : QETApp::elementInfoKeys())
|
||||
for (QString key : QETInformation::elementInfoKeys())
|
||||
{
|
||||
new_context.addValue(key, applyChange(old_context.value(key).toString(),
|
||||
m_element_context.value(key).toString()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,10 +18,10 @@
|
||||
#ifndef SEARCHANDREPLACEWORKER_H
|
||||
#define SEARCHANDREPLACEWORKER_H
|
||||
|
||||
#include <QDate>
|
||||
#include "../conductorproperties.h"
|
||||
#include "../titleblockproperties.h"
|
||||
|
||||
#include "titleblockproperties.h"
|
||||
#include "conductorproperties.h"
|
||||
#include <QDate>
|
||||
|
||||
class Diagram;
|
||||
class Element;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,8 +16,10 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "replaceadvanceddialog.h"
|
||||
|
||||
#include "../../qetapp.h"
|
||||
#include "../../qetinformation.h"
|
||||
#include "ui_replaceadvanceddialog.h"
|
||||
#include "qetapp.h"
|
||||
|
||||
#include <QAbstractButton>
|
||||
|
||||
@@ -93,18 +95,18 @@ void replaceAdvancedDialog::fillWhatComboBox(int index)
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
for (QString str : QETApp::diagramInfoKeys()) {
|
||||
ui->m_what_cb->addItem(QETApp::diagramTranslatedInfoKey(str), str);
|
||||
for (QString str : QETInformation::diagramInfoKeys()) {
|
||||
ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str);
|
||||
}
|
||||
}
|
||||
else if (index == 1) {
|
||||
for (QString str : QETApp::elementInfoKeys()) {
|
||||
ui->m_what_cb->addItem(QETApp::elementTranslatedInfoKey(str), str);
|
||||
for (QString str : QETInformation::elementInfoKeys()) {
|
||||
ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str);
|
||||
}
|
||||
}
|
||||
else if (index == 2) {
|
||||
for (QString str : QETApp::conductorInfoKeys()) {
|
||||
ui->m_what_cb->addItem(QETApp::conductorTranslatedInfoKey(str), str);
|
||||
for (auto str : QETInformation::conductorInfoKeys()) {
|
||||
ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef REPLACEADVANCEDDIALOG_H
|
||||
#define REPLACEADVANCEDDIALOG_H
|
||||
|
||||
#include "searchandreplaceworker.h"
|
||||
#include "../searchandreplaceworker.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,11 +16,12 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "replaceconductordialog.h"
|
||||
#include "ui_replaceconductordialog.h"
|
||||
#include "searchandreplaceworker.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include "../searchandreplaceworker.h"
|
||||
#include "ui_replaceconductordialog.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QPainter>
|
||||
|
||||
typedef SearchAndReplaceWorker sarw;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef REPLACECONDUCTORDIALOG_H
|
||||
#define REPLACECONDUCTORDIALOG_H
|
||||
|
||||
#include "conductorproperties.h"
|
||||
#include "../../conductorproperties.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,11 +16,13 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "replaceelementdialog.h"
|
||||
#include "ui_replaceelementdialog.h"
|
||||
|
||||
#include "../../qetapp.h"
|
||||
#include "../../qetinformation.h"
|
||||
#include "../../ui/elementinfopartwidget.h"
|
||||
#include "../searchandreplaceworker.h"
|
||||
#include "replaceelementdialog.h"
|
||||
#include "elementinfopartwidget.h"
|
||||
#include "qetapp.h"
|
||||
#include "searchandreplaceworker.h"
|
||||
#include "ui_replaceelementdialog.h"
|
||||
|
||||
#include <QAbstractButton>
|
||||
|
||||
@@ -72,9 +74,9 @@ void ReplaceElementDialog::buildWidget()
|
||||
this->done(ui->m_button_box->buttonRole(button_));
|
||||
});
|
||||
|
||||
for (QString str : QETApp::elementInfoKeys())
|
||||
for (QString str : QETInformation::elementInfoKeys())
|
||||
{
|
||||
ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETApp::elementTranslatedInfoKey(str), this);
|
||||
ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETInformation::translatedInfoKey(str), this);
|
||||
eipw->setEraseTextVisible(true);
|
||||
eipw->setPlaceHolderText(tr("Ne pas modifier"));
|
||||
ui->m_scroll_layout->addWidget(eipw);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,8 +18,9 @@
|
||||
#ifndef REPLACEELEMENTDIALOG_H
|
||||
#define REPLACEELEMENTDIALOG_H
|
||||
|
||||
#include "../../diagramcontext.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include "diagramcontext.h"
|
||||
|
||||
class ElementInfoPartWidget;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,9 +16,10 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "replacefoliowidget.h"
|
||||
|
||||
#include "../../ui/diagramcontextwidget.h"
|
||||
#include "../searchandreplaceworker.h"
|
||||
#include "ui_replacefoliowidget.h"
|
||||
#include "diagramcontextwidget.h"
|
||||
#include "searchandreplaceworker.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,11 +18,11 @@
|
||||
#ifndef REPLACEFOLIOWIDGET_H
|
||||
#define REPLACEFOLIOWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include "../../diagramcontext.h"
|
||||
#include "../../titleblockproperties.h"
|
||||
|
||||
#include "diagramcontext.h"
|
||||
#include "titleblockproperties.h"
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
|
||||
class DiagramContextWidget;
|
||||
class QDialogButtonBox;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
/*
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,22 +16,25 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "searchandreplacewidget.h"
|
||||
#include "ui_searchandreplacewidget.h"
|
||||
#include "qetdiagrameditor.h"
|
||||
#include "qetproject.h"
|
||||
#include "diagram.h"
|
||||
#include "qeticons.h"
|
||||
#include "element.h"
|
||||
#include "independenttextitem.h"
|
||||
#include "conductor.h"
|
||||
#include "replacefoliowidget.h"
|
||||
#include "replaceelementdialog.h"
|
||||
#include "qetapp.h"
|
||||
#include "replaceconductordialog.h"
|
||||
|
||||
#include "../../QWidgetAnimation/qwidgetanimation.h"
|
||||
#include "../../diagram.h"
|
||||
#include "../../diagramcontent.h"
|
||||
#include "../../qetapp.h"
|
||||
#include "../../qetdiagrameditor.h"
|
||||
#include "../../qetgraphicsitem/conductor.h"
|
||||
#include "../../qetgraphicsitem/dynamicelementtextitem.h"
|
||||
#include "../../qetgraphicsitem/element.h"
|
||||
#include "../../qetgraphicsitem/elementtextitemgroup.h"
|
||||
#include "../../qetgraphicsitem/independenttextitem.h"
|
||||
#include "../../qeticons.h"
|
||||
#include "../../qetinformation.h"
|
||||
#include "../../qetproject.h"
|
||||
#include "replaceadvanceddialog.h"
|
||||
#include "dynamicelementtextitem.h"
|
||||
#include "elementtextitemgroup.h"
|
||||
#include "QWidgetAnimation/qwidgetanimation.h"
|
||||
#include "replaceconductordialog.h"
|
||||
#include "replaceelementdialog.h"
|
||||
#include "replacefoliowidget.h"
|
||||
#include "ui_searchandreplacewidget.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
@@ -61,9 +64,8 @@ SearchAndReplaceWidget::SearchAndReplaceWidget(QWidget *parent) :
|
||||
|
||||
setHideAdvanced(true);
|
||||
setUpTreeItems();
|
||||
|
||||
connect(ui->m_search_le, &QLineEdit::textEdited,
|
||||
this, &SearchAndReplaceWidget::search);
|
||||
setUpActions();
|
||||
setUpConenctions();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,6 +251,16 @@ void SearchAndReplaceWidget::fillItemsList()
|
||||
connect(project_, &QETProject::destroyed, this,
|
||||
&SearchAndReplaceWidget::on_m_reload_pb_clicked);
|
||||
|
||||
m_root_qtwi ->setCheckState(0, Qt::Checked);
|
||||
m_folio_qtwi ->setCheckState(0, Qt::Checked);
|
||||
m_elements_qtwi ->setCheckState(0, Qt::Checked);
|
||||
m_simple_elmt_qtwi ->setCheckState(0, Qt::Checked);
|
||||
m_report_elmt_qtwi ->setCheckState(0, Qt::Checked);
|
||||
m_master_elmt_qtwi ->setCheckState(0, Qt::Checked);
|
||||
m_slave_elmt_qtwi ->setCheckState(0, Qt::Checked);
|
||||
m_terminal_elmt_qtwi->setCheckState(0, Qt::Checked);
|
||||
m_indi_text_qtwi ->setCheckState(0, Qt::Checked);
|
||||
m_conductor_qtwi ->setCheckState(0, Qt::Checked);
|
||||
|
||||
DiagramContent dc;
|
||||
for (Diagram *diagram : project_->diagrams())
|
||||
@@ -259,7 +271,7 @@ void SearchAndReplaceWidget::fillItemsList()
|
||||
if (settings.value("genericpanel/folio", true).toBool()) {
|
||||
str = diagram->border_and_titleblock.finalfolio();
|
||||
} else {
|
||||
str = QString::number(diagram->folioIndex());
|
||||
str = QString::number(diagram->folioIndex()+1);
|
||||
}
|
||||
|
||||
str.append(" " + diagram->title());
|
||||
@@ -291,6 +303,7 @@ void SearchAndReplaceWidget::fillItemsList()
|
||||
qtwi->setData(0, Qt::UserRole, iti->toPlainText());
|
||||
m_text_hash.insert(qtwi, QPointer<IndependentTextItem>(iti));
|
||||
}
|
||||
|
||||
m_indi_text_qtwi->sortChildren(0, Qt::AscendingOrder);
|
||||
|
||||
for (Conductor *c : dc.m_potential_conductors)
|
||||
@@ -440,6 +453,69 @@ void SearchAndReplaceWidget::search()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::setUpActions
|
||||
* Setup some actions used in this widget
|
||||
*/
|
||||
void SearchAndReplaceWidget::setUpActions()
|
||||
{
|
||||
m_select_elements = new QAction(QET::Icons::Element, tr("Sélectionner les éléments de ce folio"), ui->m_tree_widget);
|
||||
m_select_conductors = new QAction(QET::Icons::Conductor, tr("Sélectionner les conducteurs de ce folio"), ui->m_tree_widget);
|
||||
m_select_texts = new QAction(QET::Icons::PartText, tr("Sélectionner les textes de ce folio"), ui->m_tree_widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SearchAndReplaceWidget::setUpConenctions
|
||||
* Setup some connection used in this widget
|
||||
*/
|
||||
void SearchAndReplaceWidget::setUpConenctions()
|
||||
{
|
||||
connect(ui->m_search_le, &QLineEdit::textEdited,
|
||||
this, &SearchAndReplaceWidget::search);
|
||||
|
||||
connect(ui->m_tree_widget, &QTreeWidget::customContextMenuRequested, [this](const QPoint &pos)
|
||||
{
|
||||
if (m_diagram_hash.keys().contains(ui->m_tree_widget->currentItem()))
|
||||
{
|
||||
QMenu *menu = new QMenu(ui->m_tree_widget);
|
||||
menu->addAction(m_select_elements);
|
||||
menu->addAction(m_select_conductors);
|
||||
menu->addAction(m_select_texts);
|
||||
menu->popup(ui->m_tree_widget->mapToGlobal(pos));
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_select_elements, &QAction::triggered, [this]()
|
||||
{
|
||||
DiagramContent dc(m_diagram_hash.value(ui->m_tree_widget->currentItem()), false);
|
||||
for (auto elmt : dc.m_elements) {
|
||||
if (auto item = m_element_hash.key(elmt)) {
|
||||
item->setCheckState(0, Qt::Checked);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_select_conductors, &QAction::triggered, [this]()
|
||||
{
|
||||
DiagramContent dc(m_diagram_hash.value(ui->m_tree_widget->currentItem()), false);
|
||||
for (auto cond : dc.conductors()) {
|
||||
if (auto item = m_conductor_hash.key(cond)) {
|
||||
item->setCheckState(0, Qt::Checked);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_select_texts, &QAction::triggered, [this]()
|
||||
{
|
||||
DiagramContent dc(m_diagram_hash.value(ui->m_tree_widget->currentItem()), false);
|
||||
for (auto text : dc.m_text_fields) {
|
||||
if (auto item = m_text_hash.key(text)) {
|
||||
item->setCheckState(0, Qt::Checked);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@brief SearchAndReplaceWidget::setVisibleAllParents
|
||||
Set visible all parents of item until the invisible root item
|
||||
@@ -582,7 +658,7 @@ void SearchAndReplaceWidget::updateNextPreviousButtons()
|
||||
*/
|
||||
void SearchAndReplaceWidget::itemChanged(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
Q_UNUSED(column);
|
||||
Q_UNUSED(column)
|
||||
ui->m_tree_widget->blockSignals(true);
|
||||
|
||||
setChildCheckState(item, item->checkState(0));
|
||||
@@ -798,7 +874,7 @@ QStringList SearchAndReplaceWidget::searchTerms(Element *element)
|
||||
{
|
||||
QStringList list;
|
||||
DiagramContext context = element->elementInformations();
|
||||
for (QString key : QETApp::elementInfoKeys())
|
||||
for (QString key : QETInformation::elementInfoKeys())
|
||||
{
|
||||
QString str = context.value(key).toString();
|
||||
if (!str.isEmpty()) {
|
||||
@@ -928,7 +1004,7 @@ void SearchAndReplaceWidget::on_m_tree_widget_currentItemChanged(
|
||||
QTreeWidgetItem *current,
|
||||
QTreeWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(previous);
|
||||
Q_UNUSED(previous)
|
||||
|
||||
if(m_highlighted_element) {
|
||||
m_highlighted_element.data()->setHighlighted(false);
|
||||
@@ -1222,7 +1298,7 @@ void SearchAndReplaceWidget::on_m_element_pb_clicked()
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_mode_cb_currentIndexChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
Q_UNUSED(index)
|
||||
search();
|
||||
}
|
||||
|
||||
@@ -1233,7 +1309,7 @@ void SearchAndReplaceWidget::on_m_mode_cb_currentIndexChanged(int index)
|
||||
*/
|
||||
void SearchAndReplaceWidget::on_m_case_sensitive_cb_stateChanged(int arg1)
|
||||
{
|
||||
Q_UNUSED(arg1);
|
||||
Q_UNUSED(arg1)
|
||||
search();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,21 +18,23 @@
|
||||
#ifndef SEARCHANDREPLACEWIDGET_H
|
||||
#define SEARCHANDREPLACEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTreeWidgetItemIterator>
|
||||
#include "../../QWidgetAnimation/qwidgetanimation.h"
|
||||
#include "../../qetgraphicsitem/element.h"
|
||||
#include "../../qetgraphicsitem/independenttextitem.h"
|
||||
#include "../searchandreplaceworker.h"
|
||||
|
||||
#include "element.h"
|
||||
#include "independenttextitem.h"
|
||||
#include "searchandreplaceworker.h"
|
||||
#include "QWidgetAnimation/qwidgetanimation.h"
|
||||
#include <QTreeWidgetItemIterator>
|
||||
#include <QWidget>
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class QETDiagramEditor;
|
||||
class QAction;
|
||||
|
||||
namespace Ui {
|
||||
class SearchAndReplaceWidget;
|
||||
}
|
||||
|
||||
class QETDiagramEditor;
|
||||
|
||||
|
||||
class SearchAndReplaceWidget : public QWidget
|
||||
{
|
||||
@@ -52,17 +54,22 @@ class SearchAndReplaceWidget : public QWidget
|
||||
void fillItemsList();
|
||||
void addElement(Element *element);
|
||||
void search();
|
||||
void setUpActions();
|
||||
void setUpConenctions();
|
||||
|
||||
void setVisibleAllParents(QTreeWidgetItem *item,
|
||||
bool expend_parent = true);
|
||||
|
||||
QTreeWidgetItem *nextItem(
|
||||
QTreeWidgetItem *item=nullptr,
|
||||
QTreeWidgetItemIterator::IteratorFlag flags
|
||||
= QTreeWidgetItemIterator::All) const;
|
||||
|
||||
QTreeWidgetItem *previousItem(
|
||||
QTreeWidgetItem *item=nullptr,
|
||||
QTreeWidgetItemIterator::IteratorFlag flags
|
||||
= QTreeWidgetItemIterator::All) const;
|
||||
|
||||
void updateNextPreviousButtons();
|
||||
void itemChanged(QTreeWidgetItem *item, int column);
|
||||
void setChildCheckState(QTreeWidgetItem *item,
|
||||
@@ -126,6 +133,10 @@ class SearchAndReplaceWidget : public QWidget
|
||||
SearchAndReplaceWorker m_worker;
|
||||
QWidgetAnimation *m_vertical_animation;
|
||||
QWidgetAnimation *m_horizontal_animation;
|
||||
|
||||
QAction *m_select_elements = nullptr,
|
||||
*m_select_conductors = nullptr,
|
||||
*m_select_texts = nullptr;
|
||||
};
|
||||
|
||||
#endif // SEARCHANDREPLACEWIDGET_H
|
||||
|
||||
@@ -295,6 +295,9 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,14 +16,15 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "assignvariables.h"
|
||||
#include "diagram.h"
|
||||
#include "element.h"
|
||||
#include "diagramposition.h"
|
||||
#include "qetapp.h"
|
||||
#include "qetxml.h"
|
||||
|
||||
#include <QVariant>
|
||||
#include "../diagram.h"
|
||||
#include "../diagramposition.h"
|
||||
#include "../qetapp.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
#include "../qetxml.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <utility>
|
||||
|
||||
namespace autonum
|
||||
@@ -603,14 +604,14 @@ namespace autonum
|
||||
for (int j=i; j<= dirLevel; j = j +1)
|
||||
{
|
||||
//if there is a prefix available apply prefix
|
||||
if(rxml.name()=="prefix")
|
||||
if(rxml.name().toString()=="prefix")
|
||||
{
|
||||
return rxml.readElementText();
|
||||
}
|
||||
//if there isn't a prefix available, find parent prefix in parent folder
|
||||
else
|
||||
{
|
||||
while (rxml.readNextStartElement() && rxml.name()!="prefix")
|
||||
while (rxml.readNextStartElement() && rxml.name().toString()!="prefix")
|
||||
{
|
||||
rxml.skipCurrentElement();
|
||||
rxml.readNext();
|
||||
@@ -646,14 +647,14 @@ namespace autonum
|
||||
for (int j=i; j<= dirLevel; j = j +1)
|
||||
{
|
||||
//if there is a prefix available apply prefix
|
||||
if(rxml.name()=="prefix")
|
||||
if(rxml.name().toString()=="prefix")
|
||||
{
|
||||
return rxml.readElementText();
|
||||
}
|
||||
//if there isn't a prefix available, find parent prefix in parent folder
|
||||
else
|
||||
{
|
||||
while (rxml.readNextStartElement() && rxml.name()!="prefix")
|
||||
while (rxml.readNextStartElement() && rxml.name().toString()!="prefix")
|
||||
{
|
||||
rxml.skipCurrentElement();
|
||||
rxml.readNext();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -17,13 +17,12 @@
|
||||
*/
|
||||
#ifndef ASSIGNVARIABLES_H
|
||||
#define ASSIGNVARIABLES_H
|
||||
|
||||
#include <QString>
|
||||
#include <QPointF>
|
||||
#include <QStringList>
|
||||
|
||||
#include "../diagramcontext.h"
|
||||
#include "numerotationcontext.h"
|
||||
#include "diagramcontext.h"
|
||||
|
||||
#include <QPointF>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
class Diagram;
|
||||
class Element;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,10 +16,11 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "numerotationcontext.h"
|
||||
#include "qet.h"
|
||||
|
||||
#include <utility>
|
||||
#include "../qet.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
Constructor
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,8 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "numerotationcontextcommands.h"
|
||||
#include "diagram.h"
|
||||
|
||||
#include "../diagram.h"
|
||||
|
||||
/**
|
||||
@brief Constructor
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,13 +16,14 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "autonumberingdockwidget.h"
|
||||
#include "qetapp.h"
|
||||
|
||||
#include "../../diagram.h"
|
||||
#include "../../diagramview.h"
|
||||
#include "../../qetapp.h"
|
||||
#include "../../titleblockproperties.h"
|
||||
#include "../../ui/projectpropertiesdialog.h"
|
||||
#include "../numerotationcontext.h"
|
||||
#include "ui_autonumberingdockwidget.h"
|
||||
#include "diagramview.h"
|
||||
#include "diagram.h"
|
||||
#include "titleblockproperties.h"
|
||||
#include "numerotationcontext.h"
|
||||
#include "projectpropertiesdialog.h"
|
||||
|
||||
/**
|
||||
@brief AutoNumberingDockWidget::AutoNumberingDockWidget
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,8 +18,9 @@
|
||||
#ifndef AUTONUMBERINGDOCKWIDGET_H
|
||||
#define AUTONUMBERINGDOCKWIDGET_H
|
||||
|
||||
#include "qetproject.h"
|
||||
#include "projectview.h"
|
||||
#include "../../projectview.h"
|
||||
#include "../../qetproject.h"
|
||||
|
||||
#include <QDockWidget>
|
||||
|
||||
namespace Ui {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,15 +16,17 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "autonumberingmanagementw.h"
|
||||
#include "ui_autonumberingmanagementw.h"
|
||||
#include "numparteditorw.h"
|
||||
#include <QMessageBox>
|
||||
#include "numerotationcontextcommands.h"
|
||||
|
||||
#include "../../diagram.h"
|
||||
#include "../../qetproject.h"
|
||||
#include "../numerotationcontextcommands.h"
|
||||
#include "formulaautonumberingw.h"
|
||||
#include "ui_formulaautonumberingw.h"
|
||||
#include "numparteditorw.h"
|
||||
#include "qdebug.h"
|
||||
#include "qetproject.h"
|
||||
#include "diagram.h"
|
||||
#include "ui_autonumberingmanagementw.h"
|
||||
#include "ui_formulaautonumberingw.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
/**
|
||||
@brief AutoNumberingManagementW::AutoNumberingManagementW
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,12 +16,14 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "folioautonumbering.h"
|
||||
|
||||
#include "../../diagram.h"
|
||||
#include "../../qetproject.h"
|
||||
#include "ui_folioautonumbering.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QtWidgets>
|
||||
#include "qetproject.h"
|
||||
#include "diagram.h"
|
||||
/**
|
||||
Constructor
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,8 +18,9 @@
|
||||
#ifndef FOLIOAUTONUMBERING_H
|
||||
#define FOLIOAUTONUMBERING_H
|
||||
|
||||
#include "../numerotationcontext.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
class NumPartEditorW;
|
||||
class QAbstractButton;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,9 +18,10 @@
|
||||
#ifndef NUMPARTEDITORW_H
|
||||
#define NUMPARTEDITORW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "../numerotationcontext.h"
|
||||
|
||||
#include <QValidator>
|
||||
#include "numerotationcontext.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class NumPartEditorW;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,14 +16,15 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "selectautonumw.h"
|
||||
#include "ui_selectautonumw.h"
|
||||
#include "numparteditorw.h"
|
||||
#include <QMessageBox>
|
||||
#include "numerotationcontextcommands.h"
|
||||
#include "formulaautonumberingw.h"
|
||||
#include "ui_formulaautonumberingw.h"
|
||||
#include "assignvariables.h"
|
||||
|
||||
#include "../assignvariables.h"
|
||||
#include "../numerotationcontextcommands.h"
|
||||
#include "formulaautonumberingw.h"
|
||||
#include "numparteditorw.h"
|
||||
#include "ui_formulaautonumberingw.h"
|
||||
#include "ui_selectautonumw.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
/**
|
||||
@brief SelectAutonumW::SelectAutonumW
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,10 +18,11 @@
|
||||
#ifndef SELECTAUTONUMW_H
|
||||
#define SELECTAUTONUMW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "numerotationcontext.h"
|
||||
#include "../numerotationcontext.h"
|
||||
#include "formulaautonumberingw.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class NumPartEditorW;
|
||||
class QAbstractButton;
|
||||
class FormulaAutonumberingW;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -15,18 +15,19 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <QPainter>
|
||||
#include <utility>
|
||||
#include <QLocale>
|
||||
|
||||
#include "titleblocktemplate.h"
|
||||
#include "titleblocktemplaterenderer.h"
|
||||
#include "bordertitleblock.h"
|
||||
#include "diagramposition.h"
|
||||
#include "qetapp.h"
|
||||
#include "math.h"
|
||||
|
||||
#include "createdxf.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramposition.h"
|
||||
#include "math.h"
|
||||
#include "qetapp.h"
|
||||
#include "titleblocktemplate.h"
|
||||
#include "titleblocktemplaterenderer.h"
|
||||
|
||||
#include <QLocale>
|
||||
#include <QPainter>
|
||||
#include <utility>
|
||||
|
||||
#define MIN_COLUMN_COUNT 3
|
||||
#define MIN_ROW_COUNT 3
|
||||
@@ -978,7 +979,14 @@ QString BorderTitleBlock::incrementLetters(const QString &string) {
|
||||
if (last_digit != 'Z') {
|
||||
// increments the last digit
|
||||
// incremente le dernier digit
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
last_digit = last_digit.toLatin1() + 1;
|
||||
#else
|
||||
# if TODO_LIST
|
||||
# pragma message("@TODO remove code for QT 6 or later")
|
||||
# endif
|
||||
qDebug() << "Help code for QT 6 or later";
|
||||
#endif
|
||||
return(first_digits + QString(last_digit));
|
||||
} else {
|
||||
return(incrementLetters(first_digits) + "A");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -17,13 +17,14 @@
|
||||
*/
|
||||
#ifndef BORDERTITLEBLOCK_H
|
||||
#define BORDERTITLEBLOCK_H
|
||||
#include "autoNum/numerotationcontext.h"
|
||||
#include "borderproperties.h"
|
||||
#include "diagramcontext.h"
|
||||
#include "titleblockproperties.h"
|
||||
#include "borderproperties.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QObject>
|
||||
#include <QRectF>
|
||||
#include <QDate>
|
||||
#include "numerotationcontext.h"
|
||||
class QPainter;
|
||||
class DiagramPosition;
|
||||
class TitleBlockTemplate;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech team
|
||||
Copyright 2006-2021 The QElectroTech team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,14 +16,15 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "conductorautonumerotation.h"
|
||||
#include "numerotationcontextcommands.h"
|
||||
#include "qetdiagrameditor.h"
|
||||
#include "conductor.h"
|
||||
|
||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "autoNum/assignvariables.h"
|
||||
#include "autoNum/numerotationcontextcommands.h"
|
||||
#include "diagram.h"
|
||||
#include "qet.h"
|
||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "potentialselectordialog.h"
|
||||
#include "assignvariables.h"
|
||||
#include "qetdiagrameditor.h"
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
#include "ui/potentialselectordialog.h"
|
||||
|
||||
/**
|
||||
@brief ConductorAutoNumerotation::ConductorAutoNumerotation
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech team
|
||||
Copyright 2006-2021 The QElectroTech team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -18,8 +18,9 @@
|
||||
#ifndef CONDUCTORAUTONUMEROTATION_H
|
||||
#define CONDUCTORAUTONUMEROTATION_H
|
||||
|
||||
#include "autoNum/assignvariables.h"
|
||||
|
||||
#include <QList>
|
||||
#include "assignvariables.h"
|
||||
|
||||
class Diagram;
|
||||
class Conductor;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,12 +16,13 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "conductornumexport.h"
|
||||
|
||||
#include "diagram.h"
|
||||
#include "diagramcontent.h"
|
||||
#include "conductor.h"
|
||||
#include "terminal.h"
|
||||
#include "element.h"
|
||||
#include "conductortextitem.h"
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
#include "qetgraphicsitem/conductortextitem.h"
|
||||
#include "qetgraphicsitem/element.h"
|
||||
#include "qetgraphicsitem/terminal.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,9 +16,10 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "conductorprofile.h"
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
|
||||
#include "conductorsegmentprofile.h"
|
||||
#include "terminal.h"
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
#include "qetgraphicsitem/terminal.h"
|
||||
|
||||
/// Constructeur
|
||||
ConductorProfile::ConductorProfile()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,25 +16,26 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QFontDialog>
|
||||
#include "configpages.h"
|
||||
|
||||
#include "NameList/nameslist.h"
|
||||
#include "bordertitleblock.h"
|
||||
#include "exportpropertieswidget.h"
|
||||
#include "properties/reportproperties.h"
|
||||
#include "qetapp.h"
|
||||
#include "qeticons.h"
|
||||
#include "qetproject.h"
|
||||
#include "ui/borderpropertieswidget.h"
|
||||
#include "ui/conductorpropertieswidget.h"
|
||||
#include "ui/reportpropertiewidget.h"
|
||||
#include "ui/titleblockpropertieswidget.h"
|
||||
#include "ui/xrefpropertieswidget.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QFontDialog>
|
||||
#include <QSizePolicy>
|
||||
#include <utility>
|
||||
|
||||
#include "configpages.h"
|
||||
#include "borderpropertieswidget.h"
|
||||
#include "conductorpropertieswidget.h"
|
||||
#include "titleblockpropertieswidget.h"
|
||||
#include "bordertitleblock.h"
|
||||
#include "qeticons.h"
|
||||
#include "exportpropertieswidget.h"
|
||||
#include "ui/reportpropertiewidget.h"
|
||||
#include "ui/xrefpropertieswidget.h"
|
||||
#include "qetproject.h"
|
||||
#include "reportproperties.h"
|
||||
#include "qetapp.h"
|
||||
#include "nameslist.h"
|
||||
|
||||
/**
|
||||
@brief NewDiagramPage::NewDiagramPage
|
||||
Default constructor
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -17,11 +17,12 @@
|
||||
*/
|
||||
#ifndef CONFIG_PAGES_H
|
||||
#define CONFIG_PAGES_H
|
||||
#include <QtWidgets>
|
||||
#include <QDialog>
|
||||
#include "configpage.h"
|
||||
#include "projectpropertiesdialog.h"
|
||||
#include "titleblockpropertieswidget.h"
|
||||
#include "ui/projectpropertiesdialog.h"
|
||||
#include "ui/titleblockpropertieswidget.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtWidgets>
|
||||
class BorderPropertiesWidget;
|
||||
class ConductorPropertiesWidget;
|
||||
class TitleBlockPropertiesWidget;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 QElectroTech Team
|
||||
/*
|
||||
Copyright 2006-2021 QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,15 +16,17 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "projectdatabase.h"
|
||||
#include "qetapp.h"
|
||||
#include "qetproject.h"
|
||||
#include "elementprovider.h"
|
||||
#include "element.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramposition.h"
|
||||
|
||||
#include <QSqlError>
|
||||
#include "../diagram.h"
|
||||
#include "../diagramposition.h"
|
||||
#include "../elementprovider.h"
|
||||
#include "../qetapp.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
#include "../qetinformation.h"
|
||||
#include "../qetproject.h"
|
||||
|
||||
#include <QLocale>
|
||||
#include <QSqlError>
|
||||
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_WINDOWS)
|
||||
#include <QSqlDriver>
|
||||
@@ -42,6 +44,28 @@ projectDataBase::projectDataBase(QETProject *project, QObject *parent) :
|
||||
m_project(project)
|
||||
{
|
||||
createDataBase();
|
||||
connect(m_project, &QETProject::diagramAdded, [this](QETProject *, Diagram *diagram) {
|
||||
this->addDiagram(diagram);
|
||||
});
|
||||
connect(m_project, &QETProject::diagramRemoved, [this](QETProject *, Diagram *diagram) {
|
||||
this->removeDiagram(diagram);
|
||||
});
|
||||
connect(m_project, &QETProject::projectDiagramsOrderChanged, [this]()
|
||||
{
|
||||
for (auto diagram : m_project->diagrams())
|
||||
{
|
||||
m_diagram_order_changed.bindValue(":pos", m_project->folioIndex(diagram)+1);
|
||||
m_diagram_order_changed.bindValue(":uuid", diagram->uuid());
|
||||
m_diagram_order_changed.exec();
|
||||
|
||||
|
||||
m_diagram_info_order_changed.bindValue(":folio", diagram->border_and_titleblock.titleblockInformation().value("folio"));
|
||||
m_diagram_info_order_changed.bindValue(":uuid", diagram->uuid());
|
||||
m_diagram_info_order_changed.exec();
|
||||
|
||||
}
|
||||
emit dataBaseUpdated();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +161,7 @@ void projectDataBase::removeElement(Element *element)
|
||||
void projectDataBase::elementInfoChanged(Element *element)
|
||||
{
|
||||
auto hash = elementInfoToString(element);
|
||||
for (auto str : QETApp::elementInfoKeys()) {
|
||||
for (auto str : QETInformation::elementInfoKeys()) {
|
||||
m_update_element_query.bindValue(":" + str, hash.value(str));
|
||||
}
|
||||
m_update_element_query.bindValue(":uuid", element->uuid().toString());
|
||||
@@ -148,37 +172,48 @@ void projectDataBase::elementInfoChanged(Element *element)
|
||||
}
|
||||
}
|
||||
|
||||
void projectDataBase::elementInfoChanged(QList<Element *> elements)
|
||||
{
|
||||
this->blockSignals(true);
|
||||
//Block signal for not emit dataBaseUpdated at
|
||||
//each call of the method elementInfoChanged(Element *element)
|
||||
|
||||
m_data_base.transaction();
|
||||
for (auto elmt : elements) {
|
||||
elementInfoChanged(elmt);
|
||||
}
|
||||
m_data_base.commit();
|
||||
|
||||
this->blockSignals(false);
|
||||
emit dataBaseUpdated();
|
||||
}
|
||||
|
||||
void projectDataBase::addDiagram(Diagram *diagram)
|
||||
{
|
||||
m_insert_diagram_query.bindValue(":uuid", diagram->uuid().toString());
|
||||
m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram));
|
||||
m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)+1);
|
||||
if(!m_insert_diagram_query.exec()) {
|
||||
qDebug() << "projectDataBase::addDiagram insert error : " << m_insert_diagram_query.lastError();
|
||||
}
|
||||
|
||||
|
||||
m_insert_diagram_info_query.bindValue(":uuid", diagram->uuid());
|
||||
auto infos = diagram->border_and_titleblock.titleblockInformation();
|
||||
for (auto key : QETApp::diagramInfoKeys())
|
||||
{
|
||||
if (key == "date") {
|
||||
m_insert_diagram_info_query.bindValue(
|
||||
":date",
|
||||
QLocale::system().toString(
|
||||
infos.value("date").toDate(),
|
||||
QLocale::ShortFormat));
|
||||
} else {
|
||||
auto value = infos.value(key);
|
||||
auto bind = key.prepend(":");
|
||||
m_insert_diagram_info_query.bindValue(bind, value);
|
||||
}
|
||||
}
|
||||
bindDiagramInfoValues(m_insert_diagram_info_query, diagram);
|
||||
|
||||
if (!m_insert_diagram_info_query.exec()) {
|
||||
qDebug() << "projectDataBase::addDiagram insert info error : " << m_insert_diagram_info_query.lastError();
|
||||
} else {
|
||||
emit dataBaseUpdated();
|
||||
}
|
||||
|
||||
//The information "folio" of other existing diagram can have the variable %total,
|
||||
//so when a new diagram is added this variable change.
|
||||
//We need to update this information in the database.
|
||||
for (auto diagram : project()->diagrams())
|
||||
{
|
||||
m_diagram_info_order_changed.bindValue(":folio", diagram->border_and_titleblock.titleblockInformation().value("folio"));
|
||||
m_diagram_info_order_changed.bindValue(":uuid", diagram->uuid());
|
||||
if (!m_diagram_info_order_changed.exec()) {
|
||||
qDebug() << "projectDataBase::addDiagram update diagram infp order error : " << m_diagram_info_order_changed.lastError();
|
||||
}
|
||||
}
|
||||
emit dataBaseUpdated();
|
||||
}
|
||||
|
||||
void projectDataBase::removeDiagram(Diagram *diagram)
|
||||
@@ -191,6 +226,21 @@ void projectDataBase::removeDiagram(Diagram *diagram)
|
||||
}
|
||||
}
|
||||
|
||||
void projectDataBase::diagramInfoChanged(Diagram *diagram)
|
||||
{
|
||||
bindDiagramInfoValues(m_update_diagram_info_query, diagram);
|
||||
|
||||
if (!m_update_diagram_info_query.exec()) {
|
||||
qDebug() << "projectDataBase::diagramInfoChanged update error : " << m_update_diagram_info_query.lastError();
|
||||
} else {
|
||||
emit dataBaseUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
void projectDataBase::diagramOrderChanged()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@brief projectDataBase::createDataBase
|
||||
Create the data base
|
||||
@@ -236,7 +286,7 @@ bool projectDataBase::createDataBase()
|
||||
//Create the diagram info table
|
||||
QString diagram_info_table("CREATE TABLE diagram_info (diagram_uuid VARCHAR(50) PRIMARY KEY NOT NULL, ");
|
||||
first_ = true;
|
||||
for (auto string : QETApp::diagramInfoKeys())
|
||||
for (auto string : QETInformation::diagramInfoKeys())
|
||||
{
|
||||
if (first_) {
|
||||
first_ = false;
|
||||
@@ -253,7 +303,7 @@ bool projectDataBase::createDataBase()
|
||||
//Create the element info table
|
||||
QString element_info_table("CREATE TABLE element_info(element_uuid VARCHAR(50) PRIMARY KEY NOT NULL,");
|
||||
first_=true;
|
||||
for (auto string : QETApp::elementInfoKeys())
|
||||
for (auto string : QETInformation::elementInfoKeys())
|
||||
{
|
||||
if (first_) {
|
||||
first_ = false;
|
||||
@@ -343,7 +393,7 @@ void projectDataBase::populateDiagramTable()
|
||||
for (auto diagram : m_project->diagrams())
|
||||
{
|
||||
m_insert_diagram_query.bindValue(":uuid", diagram->uuid().toString());
|
||||
m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram));
|
||||
m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)+1);
|
||||
if(!m_insert_diagram_query.exec()) {
|
||||
qDebug() << "projectDataBase::populateDiagramTable insert error : " << m_insert_diagram_query.lastError();
|
||||
}
|
||||
@@ -418,23 +468,7 @@ void projectDataBase::populateDiagramInfoTable()
|
||||
|
||||
for (auto *diagram : m_project->diagrams())
|
||||
{
|
||||
m_insert_diagram_info_query.bindValue(":uuid", diagram->uuid());
|
||||
|
||||
auto infos = diagram->border_and_titleblock.titleblockInformation();
|
||||
for (auto key : QETApp::diagramInfoKeys())
|
||||
{
|
||||
if (key == "date") {
|
||||
m_insert_diagram_info_query.bindValue(
|
||||
":date",
|
||||
QLocale::system().toString(
|
||||
infos.value("date").toDate(),
|
||||
QLocale::ShortFormat));
|
||||
} else {
|
||||
auto value = infos.value(key);
|
||||
auto bind = key.prepend(":");
|
||||
m_insert_diagram_info_query.bindValue(bind, value);
|
||||
}
|
||||
}
|
||||
bindDiagramInfoValues(m_insert_diagram_info_query, diagram);
|
||||
|
||||
if (!m_insert_diagram_info_query.exec()) {
|
||||
qDebug() << "projectDataBase::populateDiagramInfoTable insert error : " << m_insert_diagram_info_query.lastError();
|
||||
@@ -455,16 +489,32 @@ void projectDataBase::prepareQuery()
|
||||
//INSERT DIAGRAM INFO
|
||||
m_insert_diagram_info_query = QSqlQuery(m_data_base);
|
||||
QStringList bind_diag_info_values;
|
||||
for (auto key : QETApp::diagramInfoKeys()) {
|
||||
for (auto key : QETInformation::diagramInfoKeys()) {
|
||||
bind_diag_info_values << key.prepend(":");
|
||||
}
|
||||
QString insert_diag_info("INSERT INTO diagram_info (diagram_uuid, " +
|
||||
QETApp::diagramInfoKeys().join(", ") +
|
||||
QETInformation::diagramInfoKeys().join(", ") +
|
||||
") VALUES (:uuid, " +
|
||||
bind_diag_info_values.join(", ") +
|
||||
")");
|
||||
m_insert_diagram_info_query.prepare(insert_diag_info);
|
||||
|
||||
//UPDATE DIAGRAM INFO
|
||||
QString update_diagram_str("UPDATE diagram_info SET ");
|
||||
for (auto str : QETInformation::diagramInfoKeys()) {
|
||||
update_diagram_str.append(str + " = :" + str + ", ");
|
||||
}
|
||||
update_diagram_str.remove(update_diagram_str.length()-2, 2); //Remove the last ", "
|
||||
update_diagram_str.append(" WHERE diagram_uuid = :uuid");
|
||||
m_update_diagram_info_query = QSqlQuery(m_data_base);
|
||||
m_update_diagram_info_query.prepare(update_diagram_str);
|
||||
|
||||
//UPDATE DIAGRAM ORDER
|
||||
m_diagram_order_changed = QSqlQuery(m_data_base);
|
||||
m_diagram_order_changed.prepare("UPDATE diagram SET pos = :pos WHERE uuid = :uuid");
|
||||
m_diagram_info_order_changed = QSqlQuery(m_data_base);
|
||||
m_diagram_info_order_changed.prepare("UPDATE diagram_info SET folio = :folio WHERE diagram_uuid = :uuid");
|
||||
|
||||
//INSERT ELEMENT
|
||||
QString insert_element_query("INSERT INTO element (uuid, diagram_uuid, pos, type, sub_type) VALUES (:uuid, :diagram_uuid, :pos, :type, :sub_type)");
|
||||
m_insert_elements_query = QSqlQuery(m_data_base);
|
||||
@@ -473,11 +523,11 @@ void projectDataBase::prepareQuery()
|
||||
|
||||
//INSERT ELEMENT INFO
|
||||
QStringList bind_values;
|
||||
for (auto key : QETApp::elementInfoKeys()) {
|
||||
for (auto key : QETInformation::elementInfoKeys()) {
|
||||
bind_values << key.prepend(":");
|
||||
}
|
||||
QString insert_element_info("INSERT INTO element_info (element_uuid," +
|
||||
QETApp::elementInfoKeys().join(", ") +
|
||||
QETInformation::elementInfoKeys().join(", ") +
|
||||
") VALUES (:uuid," +
|
||||
bind_values.join(", ") +
|
||||
")");
|
||||
@@ -491,7 +541,7 @@ void projectDataBase::prepareQuery()
|
||||
|
||||
//UPDATE ELEMENT INFO
|
||||
QString update_str("UPDATE element_info SET ");
|
||||
for (auto string : QETApp::elementInfoKeys()) {
|
||||
for (auto string : QETInformation::elementInfoKeys()) {
|
||||
update_str.append(string + " = :" + string + ", ");
|
||||
}
|
||||
update_str.remove(update_str.length()-2, 2); //Remove the last ", "
|
||||
@@ -508,7 +558,7 @@ void projectDataBase::prepareQuery()
|
||||
QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
|
||||
{
|
||||
QHash<QString, QString> hash; //Store the value for each columns
|
||||
for (auto key : QETApp::elementInfoKeys())
|
||||
for (auto key : QETInformation::elementInfoKeys())
|
||||
{
|
||||
if (key == "label") {
|
||||
hash.insert(key, elmt->actualLabel());
|
||||
@@ -521,6 +571,25 @@ QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
|
||||
return hash;
|
||||
}
|
||||
|
||||
void projectDataBase::bindDiagramInfoValues(QSqlQuery &query, Diagram *diagram)
|
||||
{
|
||||
query.bindValue(":uuid", diagram->uuid());
|
||||
|
||||
auto infos = diagram->border_and_titleblock.titleblockInformation();
|
||||
for (auto key : QETInformation::diagramInfoKeys())
|
||||
{
|
||||
if (key == "date") {
|
||||
query.bindValue( ":date",
|
||||
QLocale::system().toDate(infos.value("date").toString(),
|
||||
QLocale::ShortFormat));
|
||||
} else {
|
||||
auto value = infos.value(key);
|
||||
auto bind = key.prepend(":");
|
||||
query.bindValue(bind, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef QET_EXPORT_PROJECT_DB
|
||||
/**
|
||||
@brief projectDataBase::sqliteHandle
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 QElectroTech Team
|
||||
Copyright 2006-2021 QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -47,11 +47,16 @@ class projectDataBase : public QObject
|
||||
void updateDB();
|
||||
QETProject *project() const;
|
||||
QSqlQuery newQuery(const QString &query = QString());
|
||||
void addElement(Element *element);
|
||||
void removeElement(Element *element);
|
||||
void elementInfoChanged(Element *element);
|
||||
void addDiagram(Diagram *diagram);
|
||||
void removeDiagram(Diagram *diagram);
|
||||
|
||||
void addElement (Element *element);
|
||||
void removeElement (Element *element);
|
||||
void elementInfoChanged (Element *element);
|
||||
void elementInfoChanged (QList<Element *> elements);
|
||||
|
||||
void addDiagram (Diagram *diagram);
|
||||
void removeDiagram (Diagram *diagram);
|
||||
void diagramInfoChanged (Diagram *diagram);
|
||||
void diagramOrderChanged();
|
||||
|
||||
signals:
|
||||
void dataBaseUpdated();
|
||||
@@ -67,6 +72,7 @@ class projectDataBase : public QObject
|
||||
void prepareQuery();
|
||||
static QHash<QString, QString> elementInfoToString(
|
||||
Element *elmt);
|
||||
void bindDiagramInfoValues(QSqlQuery &query, Diagram *diagram);
|
||||
|
||||
private:
|
||||
QPointer<QETProject> m_project;
|
||||
@@ -77,7 +83,10 @@ class projectDataBase : public QObject
|
||||
m_update_element_query,
|
||||
m_insert_diagram_query,
|
||||
m_remove_diagram_query,
|
||||
m_insert_diagram_info_query;
|
||||
m_insert_diagram_info_query,
|
||||
m_update_diagram_info_query,
|
||||
m_diagram_order_changed,
|
||||
m_diagram_info_order_changed;
|
||||
|
||||
#ifdef QET_EXPORT_PROJECT_DB
|
||||
public:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,8 +16,10 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementquerywidget.h"
|
||||
|
||||
#include "../../qetapp.h"
|
||||
#include "../../qetinformation.h"
|
||||
#include "ui_elementquerywidget.h"
|
||||
#include "qetapp.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
@@ -444,12 +446,12 @@ QStringList ElementQueryWidget::selectedKeys() const
|
||||
*/
|
||||
void ElementQueryWidget::setUpItems()
|
||||
{
|
||||
for(QString key : QETApp::elementInfoKeys())
|
||||
for(QString key : QETInformation::elementInfoKeys())
|
||||
{
|
||||
if (key == "formula")
|
||||
continue;
|
||||
|
||||
auto item = new QListWidgetItem(QETApp::elementTranslatedInfoKey(key), ui->m_var_list);
|
||||
auto item = new QListWidgetItem(QETInformation::translatedInfoKey(key), ui->m_var_list);
|
||||
item->setData(Qt::UserRole, key);
|
||||
m_items_list << item;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -16,8 +16,10 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "summaryquerywidget.h"
|
||||
|
||||
#include "../../qetapp.h"
|
||||
#include "../../qetinformation.h"
|
||||
#include "ui_summaryquerywidget.h"
|
||||
#include "qetapp.h"
|
||||
|
||||
#include <QListWidgetItem>
|
||||
|
||||
@@ -61,6 +63,7 @@ QString SummaryQueryWidget::queryStr() const
|
||||
QStringList keys = selectedKeys();
|
||||
|
||||
QString select ="SELECT ";
|
||||
QString order_by = " ORDER BY ";
|
||||
|
||||
QString column;
|
||||
bool first = true;
|
||||
@@ -69,13 +72,15 @@ QString SummaryQueryWidget::queryStr() const
|
||||
first = false;
|
||||
} else {
|
||||
column += ", ";
|
||||
order_by +=", ";
|
||||
}
|
||||
column += key;
|
||||
order_by += key;
|
||||
}
|
||||
|
||||
QString from = " FROM project_summary_view";
|
||||
|
||||
QString q(select + column + from);
|
||||
QString q(select + column + from + order_by);
|
||||
return q;
|
||||
}
|
||||
|
||||
@@ -118,12 +123,12 @@ void SummaryQueryWidget::setQuery(const QString &query)
|
||||
*/
|
||||
void SummaryQueryWidget::setUpItems()
|
||||
{
|
||||
for (auto key : QETApp::diagramInfoKeys())
|
||||
for (auto key : QETInformation::diagramInfoKeys())
|
||||
{
|
||||
if (key == "filename" || key == "display_folio") {
|
||||
continue;
|
||||
}
|
||||
auto item = new QListWidgetItem(QETApp::diagramTranslatedInfoKey(key), ui->m_available_list);
|
||||
auto item = new QListWidgetItem(QETInformation::translatedInfoKey(key), ui->m_available_list);
|
||||
item->setData(Qt::UserRole, key);
|
||||
m_items_list << item;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -15,32 +15,34 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <cassert>
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
#include "qetgraphicsitem/conductortextitem.h"
|
||||
#include "factory/elementfactory.h"
|
||||
#include "diagram.h"
|
||||
|
||||
#include "ElementsCollection/elementcollectionhandler.h"
|
||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "diagramcommands.h"
|
||||
#include "diagramcontent.h"
|
||||
#include "diagramevent/diagrameventinterface.h"
|
||||
#include "diagramposition.h"
|
||||
#include "exportdialog.h"
|
||||
#include "qetgraphicsitem/independenttextitem.h"
|
||||
#include "qetgraphicsitem/diagramimageitem.h"
|
||||
#include "qetgraphicsitem/qetshapeitem.h"
|
||||
#include "terminal.h"
|
||||
#include "diagrameventinterface.h"
|
||||
#include "qetapp.h"
|
||||
#include "elementcollectionhandler.h"
|
||||
#include "element.h"
|
||||
#include "diagramview.h"
|
||||
#include "dynamicelementtextitem.h"
|
||||
#include "elementtextitemgroup.h"
|
||||
#include "undocommand/addelementtextcommand.h"
|
||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||
#include "qetgraphicstableitem.h"
|
||||
#include "qetxml.h"
|
||||
#include "elementprovider.h"
|
||||
#include "exportdialog.h"
|
||||
#include "factory/elementfactory.h"
|
||||
#include "qetapp.h"
|
||||
#include "qetgraphicsitem/ViewItem/qetgraphicstableitem.h"
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
#include "qetgraphicsitem/conductortextitem.h"
|
||||
#include "qetgraphicsitem/diagramimageitem.h"
|
||||
#include "qetgraphicsitem/dynamicelementtextitem.h"
|
||||
#include "qetgraphicsitem/element.h"
|
||||
#include "qetgraphicsitem/elementtextitemgroup.h"
|
||||
#include "qetgraphicsitem/independenttextitem.h"
|
||||
#include "qetgraphicsitem/qetshapeitem.h"
|
||||
#include "qetgraphicsitem/terminal.h"
|
||||
#include "qetxml.h"
|
||||
#include "undocommand/addelementtextcommand.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <math.h>
|
||||
|
||||
int Diagram::xGrid = 10;
|
||||
int Diagram::yGrid = 10;
|
||||
@@ -1655,6 +1657,8 @@ void Diagram::setTitleBlockTemplate(const QString &template_name)
|
||||
|
||||
if (template_name != current_name)
|
||||
emit(usedTitleBlockTemplateChanged(template_name));
|
||||
|
||||
project()->dataBase()->diagramInfoChanged(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1694,10 +1698,26 @@ void Diagram::invertSelection()
|
||||
if (items().isEmpty()) return;
|
||||
|
||||
blockSignals(true);
|
||||
foreach (QGraphicsItem *item,
|
||||
items()) item -> setSelected(!item -> isSelected());
|
||||
|
||||
//Get only allowed graphics item
|
||||
//because some item can be deleted between the
|
||||
//call of items() and the use of the item in the second 'for' loop
|
||||
//and crash Qet with a segfault.
|
||||
QVector<QGraphicsItem *> item_list;
|
||||
for (auto item : items())
|
||||
{
|
||||
if (dynamic_cast<QetGraphicsItem *>(item) ||
|
||||
dynamic_cast<DiagramTextItem *>(item) ||
|
||||
dynamic_cast<Conductor *>(item)) {
|
||||
item_list << item;
|
||||
}
|
||||
}
|
||||
for (auto item : qAsConst(item_list)) {
|
||||
item -> setSelected(!item -> isSelected());
|
||||
}
|
||||
|
||||
blockSignals(false);
|
||||
emit(selectionChanged());
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
Copyright 2006-2021 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -17,20 +17,20 @@
|
||||
*/
|
||||
#ifndef DIAGRAM_H
|
||||
#define DIAGRAM_H
|
||||
#include <QtWidgets>
|
||||
#include <QtXml>
|
||||
#include <QHash>
|
||||
#include <QUuid>
|
||||
|
||||
#include "autoNum/numerotationcontext.h"
|
||||
#include "bordertitleblock.h"
|
||||
#include "conductorproperties.h"
|
||||
#include "exportproperties.h"
|
||||
#include "qgimanager.h"
|
||||
#include "numerotationcontext.h"
|
||||
#include "qetproject.h"
|
||||
#include "properties/xrefproperties.h"
|
||||
#include "elementsmover.h"
|
||||
#include "elementtextsmover.h"
|
||||
#include "exportproperties.h"
|
||||
#include "properties/xrefproperties.h"
|
||||
#include "qetproject.h"
|
||||
#include "qgimanager.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QUuid>
|
||||
#include <QtWidgets>
|
||||
#include <QtXml>
|
||||
|
||||
class Conductor;
|
||||
class CustomElement;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user