mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 16:50:53 +01:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b5887f994 | ||
|
|
ea978c5e24 | ||
|
|
5925c227ab | ||
|
|
0f95edc5e6 | ||
|
|
67637acaab | ||
|
|
242c53e3be | ||
|
|
6775930e81 | ||
|
|
54b53b4086 | ||
|
|
e765cf037c | ||
|
|
39cff98649 | ||
|
|
13041720df | ||
|
|
d7a49b9e74 | ||
|
|
ecf783332a | ||
|
|
fbb97cb686 | ||
|
|
4aaa8eebe4 | ||
|
|
4b6e0ad8e5 | ||
|
|
86c8a2d45b | ||
|
|
43e3c9a998 | ||
|
|
349765a90c | ||
|
|
a4ca872158 | ||
|
|
6602c65679 | ||
|
|
fc870e7afc | ||
|
|
04226a5dee | ||
|
|
164536c3ef | ||
|
|
0915d946c5 | ||
|
|
959f088306 | ||
|
|
ea2638acad | ||
|
|
89aa2fbf63 | ||
|
|
86f8b85a78 | ||
|
|
491efe7b1d | ||
|
|
86552e481a | ||
|
|
b58482a0d5 | ||
|
|
875eaac766 | ||
|
|
fa9f6b9c03 |
@@ -19,7 +19,7 @@ include(cmake/hoto_update_cmake_message.cmake)
|
|||||||
cmake_minimum_required(VERSION 3.14...3.19 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.14...3.19 FATAL_ERROR)
|
||||||
|
|
||||||
project(qelectrotech
|
project(qelectrotech
|
||||||
VERSION 0.8.0
|
VERSION 0.9.0
|
||||||
DESCRIPTION "QET is a CAD/CAE editor focusing on schematics drawing features."
|
DESCRIPTION "QET is a CAD/CAE editor focusing on schematics drawing features."
|
||||||
HOMEPAGE_URL "https://qelectrotech.org/"
|
HOMEPAGE_URL "https://qelectrotech.org/"
|
||||||
LANGUAGES CXX)
|
LANGUAGES CXX)
|
||||||
@@ -131,3 +131,28 @@ target_include_directories(
|
|||||||
${QET_DIR}/sources/factory/ui
|
${QET_DIR}/sources/factory/ui
|
||||||
${QET_DIR}/sources/print
|
${QET_DIR}/sources/print
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install(TARGETS ${PROJECT_NAME})
|
||||||
|
install(DIRECTORY ico/breeze-icons/16x16 DESTINATION ${QET_ICONS_PATH})
|
||||||
|
install(DIRECTORY ico/breeze-icons/22x22 DESTINATION ${QET_ICONS_PATH})
|
||||||
|
install(DIRECTORY ico/breeze-icons/32x32 DESTINATION ${QET_ICONS_PATH})
|
||||||
|
install(DIRECTORY ico/breeze-icons/48x48 DESTINATION ${QET_ICONS_PATH})
|
||||||
|
install(DIRECTORY ico/breeze-icons/64x64 DESTINATION ${QET_ICONS_PATH})
|
||||||
|
install(DIRECTORY ico/breeze-icons/128x128 DESTINATION ${QET_ICONS_PATH})
|
||||||
|
install(DIRECTORY ico/breeze-icons/256x256 DESTINATION ${QET_ICONS_PATH})
|
||||||
|
install(DIRECTORY elements DESTINATION share/qelectrotech)
|
||||||
|
install(DIRECTORY examples DESTINATION share/qelectrotech)
|
||||||
|
install(DIRECTORY titleblocks DESTINATION share/qelectrotech)
|
||||||
|
install(FILES LICENSE ELEMENTS.LICENSE CREDIT README ChangeLog DESTINATION share/doc/qelectrotech)
|
||||||
|
install(FILES misc/qelectrotech.desktop DESTINATION share/applications)
|
||||||
|
install(FILES misc/x-qet-element.xml
|
||||||
|
misc/x-qet-project.xml
|
||||||
|
misc/x-qet-titleblock.xml
|
||||||
|
DESTINATION share/mime/application)
|
||||||
|
install(FILES misc/x-qet-element.desktop
|
||||||
|
misc/x-qet-project.desktop
|
||||||
|
misc/x-qet-titleblock.desktop
|
||||||
|
DESTINATION share/mimelnk/application)
|
||||||
|
install(FILES misc/qelectrotech.xml DESTINATION share/mime/packages)
|
||||||
|
install(FILES misc/qelectrotech.appdata.xml DESTINATION ${QET_APPDATA_PATH})
|
||||||
|
install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ message(" - fetch_kdeaddons")
|
|||||||
if(DEFINED BUILD_WITH_KF5)
|
if(DEFINED BUILD_WITH_KF5)
|
||||||
Include(FetchContent)
|
Include(FetchContent)
|
||||||
|
|
||||||
set(BUILD_KF5_YES "YES")
|
option(BUILD_KF5 "Build KF5 libraries, use system ones otherwise" YES)
|
||||||
|
|
||||||
if(DEFINED BUILD_KF5_YES)
|
if(BUILD_KF5)
|
||||||
|
|
||||||
if(NOT DEFINED KF5_GIT_TAG)
|
if(NOT DEFINED KF5_GIT_TAG)
|
||||||
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
|
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
|
||||||
|
|||||||
@@ -18,9 +18,16 @@ message(" - fetch_pugixml")
|
|||||||
|
|
||||||
Include(FetchContent)
|
Include(FetchContent)
|
||||||
|
|
||||||
FetchContent_Declare(
|
option(BUILD_PUGIXML "Build pugixml library, use system one otherwise" YES)
|
||||||
pugixml
|
|
||||||
GIT_REPOSITORY https://github.com/zeux/pugixml.git
|
|
||||||
GIT_TAG v1.11.1)
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(pugixml)
|
if(BUILD_PUGIXML)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
pugixml
|
||||||
|
GIT_REPOSITORY https://github.com/zeux/pugixml.git
|
||||||
|
GIT_TAG v1.11.4)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(pugixml)
|
||||||
|
else()
|
||||||
|
find_package(pugixml REQUIRED)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ Include(FetchContent)
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
SingleApplication
|
SingleApplication
|
||||||
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
GIT_REPOSITORY https://github.com/itay-grudev/SingleApplication.git
|
||||||
GIT_TAG v3.1.5)
|
GIT_TAG v3.2.0)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(SingleApplication)
|
FetchContent_MakeAvailable(SingleApplication)
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
|||||||
# This strips terminating newline in the variable
|
# This strips terminating newline in the variable
|
||||||
string(REGEX REPLACE "\n$" "" GIT_COMMIT_SHA "${GIT_COMMIT_SHA}")
|
string(REGEX REPLACE "\n$" "" GIT_COMMIT_SHA "${GIT_COMMIT_SHA}")
|
||||||
|
|
||||||
# This adds to definitions => .cpp
|
|
||||||
add_definitions(-DGIT_COMMIT_SHA="${GIT_COMMIT_SHA}")
|
|
||||||
|
|
||||||
if(NOT GIT_COMMIT_RESULT EQUAL "0")
|
if(NOT GIT_COMMIT_RESULT EQUAL "0")
|
||||||
message(
|
message(
|
||||||
FATAL_ERROR
|
FATAL_ERROR
|
||||||
@@ -39,3 +36,6 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
|||||||
", please check")
|
", please check")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# This adds to definitions => .cpp
|
||||||
|
add_definitions(-DGIT_COMMIT_SHA="${GIT_COMMIT_SHA}")
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ set(QET_RES_FILES
|
|||||||
${QET_DIR}/sources/editor/ui/lineeditor.ui
|
${QET_DIR}/sources/editor/ui/lineeditor.ui
|
||||||
${QET_DIR}/sources/editor/ui/polygoneditor.ui
|
${QET_DIR}/sources/editor/ui/polygoneditor.ui
|
||||||
${QET_DIR}/sources/editor/ui/rectangleeditor.ui
|
${QET_DIR}/sources/editor/ui/rectangleeditor.ui
|
||||||
|
${QET_DIR}/sources/editor/ui/qetelementeditor.ui
|
||||||
|
${QET_DIR}/sources/editor/ui/terminaleditor.ui
|
||||||
${QET_DIR}/sources/ElementsCollection/ui/renamedialog.ui
|
${QET_DIR}/sources/ElementsCollection/ui/renamedialog.ui
|
||||||
${QET_DIR}/sources/factory/ui/addtabledialog.ui
|
${QET_DIR}/sources/factory/ui/addtabledialog.ui
|
||||||
${QET_DIR}/sources/NameList/ui/namelistdialog.ui
|
${QET_DIR}/sources/NameList/ui/namelistdialog.ui
|
||||||
@@ -260,12 +262,8 @@ set(QET_SRC_FILES
|
|||||||
${QET_DIR}/sources/editor/elementscene.h
|
${QET_DIR}/sources/editor/elementscene.h
|
||||||
${QET_DIR}/sources/editor/elementview.cpp
|
${QET_DIR}/sources/editor/elementview.cpp
|
||||||
${QET_DIR}/sources/editor/elementview.h
|
${QET_DIR}/sources/editor/elementview.h
|
||||||
${QET_DIR}/sources/editor/qetelementeditor.cpp
|
|
||||||
${QET_DIR}/sources/editor/qetelementeditor.h
|
|
||||||
${QET_DIR}/sources/editor/styleeditor.cpp
|
${QET_DIR}/sources/editor/styleeditor.cpp
|
||||||
${QET_DIR}/sources/editor/styleeditor.h
|
${QET_DIR}/sources/editor/styleeditor.h
|
||||||
${QET_DIR}/sources/editor/terminaleditor.cpp
|
|
||||||
${QET_DIR}/sources/editor/terminaleditor.h
|
|
||||||
|
|
||||||
${QET_DIR}/sources/editor/esevent/eseventaddarc.cpp
|
${QET_DIR}/sources/editor/esevent/eseventaddarc.cpp
|
||||||
${QET_DIR}/sources/editor/esevent/eseventaddarc.h
|
${QET_DIR}/sources/editor/esevent/eseventaddarc.h
|
||||||
@@ -320,8 +318,12 @@ set(QET_SRC_FILES
|
|||||||
${QET_DIR}/sources/editor/ui/polygoneditor.h
|
${QET_DIR}/sources/editor/ui/polygoneditor.h
|
||||||
${QET_DIR}/sources/editor/ui/rectangleeditor.cpp
|
${QET_DIR}/sources/editor/ui/rectangleeditor.cpp
|
||||||
${QET_DIR}/sources/editor/ui/rectangleeditor.h
|
${QET_DIR}/sources/editor/ui/rectangleeditor.h
|
||||||
|
${QET_DIR}/sources/editor/ui/terminaleditor.cpp
|
||||||
|
${QET_DIR}/sources/editor/ui/terminaleditor.h
|
||||||
${QET_DIR}/sources/editor/ui/texteditor.cpp
|
${QET_DIR}/sources/editor/ui/texteditor.cpp
|
||||||
${QET_DIR}/sources/editor/ui/texteditor.h
|
${QET_DIR}/sources/editor/ui/texteditor.h
|
||||||
|
${QET_DIR}/sources/editor/ui/qetelementeditor.h
|
||||||
|
${QET_DIR}/sources/editor/ui/qetelementeditor.cpp
|
||||||
|
|
||||||
${QET_DIR}/sources/editor/UndoCommand/pastepartscommand.cpp
|
${QET_DIR}/sources/editor/UndoCommand/pastepartscommand.cpp
|
||||||
${QET_DIR}/sources/editor/UndoCommand/pastepartscommand.h
|
${QET_DIR}/sources/editor/UndoCommand/pastepartscommand.h
|
||||||
@@ -371,6 +373,8 @@ set(QET_SRC_FILES
|
|||||||
${QET_DIR}/sources/print/projectprintwindow.cpp
|
${QET_DIR}/sources/print/projectprintwindow.cpp
|
||||||
${QET_DIR}/sources/print/projectprintwindow.h
|
${QET_DIR}/sources/print/projectprintwindow.h
|
||||||
|
|
||||||
|
${QET_DIR}/sources/properties/elementdata.cpp
|
||||||
|
${QET_DIR}/sources/properties/elementdata.h
|
||||||
${QET_DIR}/sources/properties/propertiesinterface.cpp
|
${QET_DIR}/sources/properties/propertiesinterface.cpp
|
||||||
${QET_DIR}/sources/properties/propertiesinterface.h
|
${QET_DIR}/sources/properties/propertiesinterface.h
|
||||||
${QET_DIR}/sources/properties/reportproperties.cpp
|
${QET_DIR}/sources/properties/reportproperties.cpp
|
||||||
@@ -379,6 +383,8 @@ set(QET_SRC_FILES
|
|||||||
${QET_DIR}/sources/properties/terminaldata.h
|
${QET_DIR}/sources/properties/terminaldata.h
|
||||||
${QET_DIR}/sources/properties/xrefproperties.cpp
|
${QET_DIR}/sources/properties/xrefproperties.cpp
|
||||||
${QET_DIR}/sources/properties/xrefproperties.h
|
${QET_DIR}/sources/properties/xrefproperties.h
|
||||||
|
${QET_DIR}/sources/properties/userproperties.cpp
|
||||||
|
${QET_DIR}/sources/properties/userproperties.h
|
||||||
|
|
||||||
${QET_DIR}/sources/PropertiesEditor/propertieseditordialog.h
|
${QET_DIR}/sources/PropertiesEditor/propertieseditordialog.h
|
||||||
${QET_DIR}/sources/PropertiesEditor/propertieseditordockwidget.cpp
|
${QET_DIR}/sources/PropertiesEditor/propertieseditordockwidget.cpp
|
||||||
|
|||||||
BIN
lang/qet_ru.qm
BIN
lang/qet_ru.qm
Binary file not shown.
2834
lang/qet_ru.ts
2834
lang/qet_ru.ts
File diff suppressed because it is too large
Load Diff
@@ -331,6 +331,7 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) {
|
|||||||
// through setFolioData(),
|
// through setFolioData(),
|
||||||
// which in turn calls updateDiagramContextForTitleBlock().
|
// which in turn calls updateDiagramContextForTitleBlock().
|
||||||
emit(needTitleBlockTemplate(ip.template_name));
|
emit(needTitleBlockTemplate(ip.template_name));
|
||||||
|
emit informationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -245,6 +245,12 @@ class BorderTitleBlock : public QObject
|
|||||||
since it does not know of its parent project.
|
since it does not know of its parent project.
|
||||||
*/
|
*/
|
||||||
void needTitleBlockTemplate(const QString &);
|
void needTitleBlockTemplate(const QString &);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief infoChanged
|
||||||
|
* Signal emitted when the informations changed.
|
||||||
|
*/
|
||||||
|
void informationChanged();
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
@param parent QWidget parent
|
@param parent QWidget parent
|
||||||
*/
|
*/
|
||||||
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
||||||
Machine_info *mymachineinfo= new Machine_info(this);
|
|
||||||
//ScrollArea for low screens
|
//ScrollArea for low screens
|
||||||
QScrollArea *scroll = new QScrollArea(this);
|
QScrollArea *scroll = new QScrollArea(this);
|
||||||
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
@@ -36,7 +35,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
|||||||
// liste des pages
|
// liste des pages
|
||||||
pages_list = new QListWidget();
|
pages_list = new QListWidget();
|
||||||
pages_list -> setViewMode(QListView::IconMode);
|
pages_list -> setViewMode(QListView::IconMode);
|
||||||
if(mymachineinfo->i_max_screen_height()<1000){
|
if(MachineInfo::instance()->i_max_screen_height()<1000){
|
||||||
pages_list -> setIconSize(QSize(64, 64));
|
pages_list -> setIconSize(QSize(64, 64));
|
||||||
} else {
|
} else {
|
||||||
pages_list -> setIconSize(QSize(128, 128));
|
pages_list -> setIconSize(QSize(128, 128));
|
||||||
@@ -80,8 +79,8 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
|||||||
connect(pages_list, SIGNAL(currentRowChanged(int)),
|
connect(pages_list, SIGNAL(currentRowChanged(int)),
|
||||||
pages_widget, SLOT(setCurrentIndex(int)));
|
pages_widget, SLOT(setCurrentIndex(int)));
|
||||||
|
|
||||||
setMaximumSize(mymachineinfo->i_max_screen_width(),
|
setMaximumSize(MachineInfo::instance()->i_max_screen_width(),
|
||||||
mymachineinfo->i_max_screen_height());
|
MachineInfo::instance()->i_max_screen_height());
|
||||||
resize(1400,1000);
|
resize(1400,1000);
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
|||||||
@@ -157,40 +157,41 @@ void ElementQueryWidget::setQuery(const QString &query)
|
|||||||
//Element type filter
|
//Element type filter
|
||||||
if (where.contains("element_sub_type") || where.contains("element_type"))
|
if (where.contains("element_sub_type") || where.contains("element_type"))
|
||||||
{
|
{
|
||||||
int c=0;
|
QRegularExpression rx("^(\\( .+?\\))");
|
||||||
ui->m_simple_cb->setChecked (where.contains("Simple") ? true : false);
|
auto rxm = rx.match(where);
|
||||||
if (ui->m_simple_cb->isChecked()) {
|
if (rxm.hasMatch())
|
||||||
++c;
|
{
|
||||||
where.remove("element_type = 'Simple' ");
|
auto str_type = rxm.captured(1);
|
||||||
}
|
where.remove(str_type);
|
||||||
ui->m_terminal_cb->setChecked (where.contains("Terminale") ? true : false);
|
|
||||||
if (ui->m_terminal_cb->isChecked()) {
|
|
||||||
++c;
|
|
||||||
where.remove("element_type = 'Terminale'");
|
|
||||||
}
|
|
||||||
ui->m_coil_cb->setChecked (where.contains("coil") ? true : false);
|
|
||||||
if (ui->m_coil_cb->isChecked()) {
|
|
||||||
++c;
|
|
||||||
where.remove("element_sub_type = 'coil' ");
|
|
||||||
}
|
|
||||||
ui->m_button_cb->setChecked (where.contains("commutator") ? true : false);
|
|
||||||
if (ui->m_button_cb->isChecked()) {
|
|
||||||
++c;
|
|
||||||
where.remove("element_sub_type = 'commutator' ");
|
|
||||||
}
|
|
||||||
ui->m_protection_cb->setChecked(where.contains("protection") ? true : false);
|
|
||||||
if (ui->m_protection_cb) {
|
|
||||||
++c;
|
|
||||||
where.remove("element_sub_type = 'protection'");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c == 5) {
|
int c=0;
|
||||||
ui->m_all_cb->setCheckState(Qt::Checked);
|
ui->m_simple_cb->setChecked (str_type.contains("Simple") ? true : false);
|
||||||
} else if (c > 0) {
|
if (ui->m_simple_cb->isChecked()) {
|
||||||
ui->m_all_cb->setCheckState(Qt::PartiallyChecked);
|
++c;
|
||||||
}
|
}
|
||||||
|
ui->m_terminal_cb->setChecked (str_type.contains("Terminale") ? true : false);
|
||||||
|
if (ui->m_terminal_cb->isChecked()) {
|
||||||
|
++c;
|
||||||
|
}
|
||||||
|
ui->m_coil_cb->setChecked (str_type.contains("coil") ? true : false);
|
||||||
|
if (ui->m_coil_cb->isChecked()) {
|
||||||
|
++c;
|
||||||
|
}
|
||||||
|
ui->m_button_cb->setChecked (str_type.contains("commutator") ? true : false);
|
||||||
|
if (ui->m_button_cb->isChecked()) {
|
||||||
|
++c;
|
||||||
|
}
|
||||||
|
ui->m_protection_cb->setChecked(str_type.contains("protection") ? true : false);
|
||||||
|
if (ui->m_protection_cb) {
|
||||||
|
++c;
|
||||||
|
}
|
||||||
|
|
||||||
where.remove("OR");
|
if (c == 5) {
|
||||||
|
ui->m_all_cb->setCheckState(Qt::Checked);
|
||||||
|
} else if (c > 0) {
|
||||||
|
ui->m_all_cb->setCheckState(Qt::PartiallyChecked);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // There is not "element_sub_type" or "element_type" that mean every element are selected
|
else // There is not "element_sub_type" or "element_type" that mean every element are selected
|
||||||
{
|
{
|
||||||
@@ -206,20 +207,16 @@ void ElementQueryWidget::setQuery(const QString &query)
|
|||||||
strl.append(item->data(Qt::UserRole).toString());
|
strl.append(item->data(Qt::UserRole).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString beginning_rx;
|
QString join_str = strl.join("|");
|
||||||
beginning_rx.append(QString("^(").append(strl.join("|")));
|
|
||||||
beginning_rx.append(")");
|
|
||||||
|
|
||||||
QRegularExpression rx_is_not_null(beginning_rx + " IS NOT NULL$");
|
|
||||||
QRegularExpression rx_is_null (beginning_rx + " IS NULL$");
|
|
||||||
QRegularExpression rx_like (beginning_rx + QString(" LIKE'%(.+)%'$"));
|
|
||||||
QRegularExpression rx_not_like (beginning_rx + QString(" NOT LIKE'%(.+)%'$"));
|
|
||||||
QRegularExpression rx_equal (beginning_rx + QString("='(.+)'$"));
|
|
||||||
QRegularExpression rx_not_equal (beginning_rx + QString("!='(.+)'$"));
|
|
||||||
|
|
||||||
|
QRegularExpression rx_is_not_null(QStringLiteral("^(%1) != ''$").arg(join_str));
|
||||||
|
QRegularExpression rx_is_null (QStringLiteral("^\\((%1) IS NULL OR (%1) = ''\\)").arg(join_str));
|
||||||
|
QRegularExpression rx_like (QStringLiteral("^(%1) LIKE'%(.+)%'$").arg(join_str));
|
||||||
|
QRegularExpression rx_not_like (QStringLiteral("^(%1) NOT LIKE'%(.+)%'$").arg(join_str));
|
||||||
|
QRegularExpression rx_equal (QStringLiteral("^(%1)='(.+)'$").arg(join_str));
|
||||||
|
QRegularExpression rx_not_equal (QStringLiteral("^(%1)!='(.+)'$").arg(join_str));
|
||||||
|
|
||||||
QStringList split_where;
|
QStringList split_where;
|
||||||
|
|
||||||
//Remove the white space at begin and end of each string
|
//Remove the white space at begin and end of each string
|
||||||
for (auto str : where.split("AND "))
|
for (auto str : where.split("AND "))
|
||||||
{
|
{
|
||||||
@@ -310,22 +307,22 @@ QString ElementQueryWidget::queryStr() const
|
|||||||
case 0: //No filter
|
case 0: //No filter
|
||||||
break;
|
break;
|
||||||
case 1: //Not empty
|
case 1: //Not empty
|
||||||
filter_ += QString(" AND ") += key += " IS NOT NULL";
|
filter_ += QStringLiteral(" AND ") += key += " != ''";
|
||||||
break;
|
break;
|
||||||
case 2: //empty
|
case 2: //empty
|
||||||
filter_ += QString(" AND ") += key += " IS NULL";
|
filter_ += QStringLiteral(" AND (%1 IS NULL OR %1 = '')").arg(key);
|
||||||
break;
|
break;
|
||||||
case 3: // contain
|
case 3: // contain
|
||||||
filter_ += QString(" AND ") += key += QString(" LIKE'%") += f.second += "%'";
|
filter_ += QStringLiteral(" AND ") += key += QStringLiteral(" LIKE'%") += f.second += "%'";
|
||||||
break;
|
break;
|
||||||
case 4: // not contain
|
case 4: // not contain
|
||||||
filter_ += QString(" AND ") += key += QString(" NOT LIKE'%") += f.second += "%'";
|
filter_ += QStringLiteral(" AND ") += key += QStringLiteral(" NOT LIKE'%") += f.second += "%'";
|
||||||
break;
|
break;
|
||||||
case 5: // is equal
|
case 5: // is equal
|
||||||
filter_ += QString(" AND ") += key += QString("='") += f.second += "'";
|
filter_ += QStringLiteral(" AND ") += key += QStringLiteral("='") += f.second += "'";
|
||||||
break;
|
break;
|
||||||
case 6: // is not equal
|
case 6: // is not equal
|
||||||
filter_ += QString(" AND ") += key += QString("!='") += f.second += "'";
|
filter_ += QStringLiteral(" AND ") += key += QStringLiteral("!='") += f.second += "'";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ Diagram::Diagram(QETProject *project) :
|
|||||||
pen.setColor(Qt::black);
|
pen.setColor(Qt::black);
|
||||||
conductor_setter_ -> setPen(pen);
|
conductor_setter_ -> setPen(pen);
|
||||||
|
|
||||||
|
connect(&border_and_titleblock,
|
||||||
|
&BorderTitleBlock::informationChanged,
|
||||||
|
this, &Diagram::diagramInformationChanged);
|
||||||
connect(&border_and_titleblock,
|
connect(&border_and_titleblock,
|
||||||
&BorderTitleBlock::needTitleBlockTemplate,
|
&BorderTitleBlock::needTitleBlockTemplate,
|
||||||
this, &Diagram::setTitleBlockTemplate);
|
this, &Diagram::setTitleBlockTemplate);
|
||||||
@@ -134,15 +137,20 @@ Diagram::~Diagram()
|
|||||||
delete m_event_interface;
|
delete m_event_interface;
|
||||||
|
|
||||||
// list removable items
|
// list removable items
|
||||||
QList<QGraphicsItem *> deletable_items;
|
QVector<QGraphicsItem *> deletable_items;
|
||||||
for(QGraphicsItem *qgi : items())
|
for(const auto &qgi : items())
|
||||||
{
|
{
|
||||||
if (qgi -> parentItem()) continue;
|
if (qgi->parentItem())
|
||||||
if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
|
continue;
|
||||||
deletable_items << qgi;
|
if (qgraphicsitem_cast<Conductor *>(qgi))
|
||||||
|
continue;
|
||||||
|
deletable_items.append(qgi);
|
||||||
|
}
|
||||||
|
for (const auto &item : qAsConst(deletable_items))
|
||||||
|
{
|
||||||
|
removeItem(item);
|
||||||
|
delete item;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDeleteAll (deletable_items);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -189,12 +197,12 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
|||||||
// If user allow zoom out beyond of folio,
|
// If user allow zoom out beyond of folio,
|
||||||
// we draw grid outside of border.
|
// we draw grid outside of border.
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
int xGrid = settings.value("diagrameditor/Xgrid",
|
int xGrid = settings.value(QStringLiteral("diagrameditor/Xgrid"),
|
||||||
Diagram::xGrid).toInt();
|
Diagram::xGrid).toInt();
|
||||||
int yGrid = settings.value("diagrameditor/Ygrid",
|
int yGrid = settings.value(QStringLiteral("diagrameditor/Ygrid"),
|
||||||
Diagram::yGrid).toInt();
|
Diagram::yGrid).toInt();
|
||||||
QRectF rect = settings.value(
|
QRectF rect = settings.value(
|
||||||
"diagrameditor/zoom-out-beyond-of-folio",
|
QStringLiteral("diagrameditor/zoom-out-beyond-of-folio"),
|
||||||
false).toBool() ? r
|
false).toBool() ? r
|
||||||
: border_and_titleblock
|
: border_and_titleblock
|
||||||
.insideBorderRect()
|
.insideBorderRect()
|
||||||
@@ -324,15 +332,6 @@ void Diagram::wheelEvent(QGraphicsSceneWheelEvent *event)
|
|||||||
*/
|
*/
|
||||||
void Diagram::keyPressEvent(QKeyEvent *event)
|
void Diagram::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
QSettings settings;
|
|
||||||
int xKeyGrid = settings.value("diagrameditor/key_Xgrid",
|
|
||||||
Diagram::xKeyGrid).toInt();
|
|
||||||
int yKeyGrid = settings.value("diagrameditor/key_Ygrid",
|
|
||||||
Diagram::yKeyGrid).toInt();
|
|
||||||
int xKeyGridFine = settings.value("diagrameditor/key_fine_Xgrid",
|
|
||||||
Diagram::xKeyGridFine).toInt();
|
|
||||||
int yKeyGridFine = settings.value("diagrameditor/key_fine_Ygrid",
|
|
||||||
Diagram::yKeyGridFine).toInt();
|
|
||||||
event->setAccepted(false);
|
event->setAccepted(false);
|
||||||
|
|
||||||
if (m_event_interface) {
|
if (m_event_interface) {
|
||||||
@@ -361,6 +360,11 @@ void Diagram::keyPressEvent(QKeyEvent *event)
|
|||||||
//Move item with the keyboard arrow
|
//Move item with the keyboard arrow
|
||||||
if(event->modifiers() == Qt::NoModifier)
|
if(event->modifiers() == Qt::NoModifier)
|
||||||
{
|
{
|
||||||
|
QSettings settings;
|
||||||
|
int xKeyGrid = settings.value(QStringLiteral("diagrameditor/key_Xgrid"),
|
||||||
|
Diagram::xKeyGrid).toInt();
|
||||||
|
int yKeyGrid = settings.value(QStringLiteral("diagrameditor/key_Ygrid"),
|
||||||
|
Diagram::yKeyGrid).toInt();
|
||||||
switch(event->key())
|
switch(event->key())
|
||||||
{
|
{
|
||||||
case Qt::Key_Left:
|
case Qt::Key_Left:
|
||||||
@@ -399,6 +403,11 @@ void Diagram::keyPressEvent(QKeyEvent *event)
|
|||||||
}
|
}
|
||||||
else if(event->modifiers() == Qt::AltModifier)
|
else if(event->modifiers() == Qt::AltModifier)
|
||||||
{
|
{
|
||||||
|
QSettings settings;
|
||||||
|
int xKeyGridFine = settings.value(QStringLiteral("diagrameditor/key_fine_Xgrid"),
|
||||||
|
Diagram::xKeyGridFine).toInt();
|
||||||
|
int yKeyGridFine = settings.value(QStringLiteral("diagrameditor/key_fine_Ygrid"),
|
||||||
|
Diagram::yKeyGridFine).toInt();
|
||||||
switch(event->key())
|
switch(event->key())
|
||||||
{
|
{
|
||||||
case Qt::Key_Left:
|
case Qt::Key_Left:
|
||||||
@@ -732,7 +741,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
|
|
||||||
// XML tree root
|
// XML tree root
|
||||||
// racine de l'arbre XML
|
// racine de l'arbre XML
|
||||||
auto dom_root = document.createElement("diagram");
|
auto dom_root = document.createElement(QStringLiteral("diagram"));
|
||||||
|
|
||||||
// schema properties
|
// schema properties
|
||||||
// proprietes du schema
|
// proprietes du schema
|
||||||
@@ -742,24 +751,24 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
|
|
||||||
// Default conductor properties
|
// Default conductor properties
|
||||||
QDomElement default_conductor =
|
QDomElement default_conductor =
|
||||||
document.createElement("defaultconductor");
|
document.createElement(QStringLiteral("defaultconductor"));
|
||||||
defaultConductorProperties.toXml(default_conductor);
|
defaultConductorProperties.toXml(default_conductor);
|
||||||
dom_root.appendChild(default_conductor);
|
dom_root.appendChild(default_conductor);
|
||||||
|
|
||||||
// Conductor autonum
|
// Conductor autonum
|
||||||
if (!m_conductors_autonum_name.isEmpty()) {
|
if (!m_conductors_autonum_name.isEmpty()) {
|
||||||
dom_root.setAttribute("conductorAutonum",
|
dom_root.setAttribute(QStringLiteral("conductorAutonum"),
|
||||||
m_conductors_autonum_name);
|
m_conductors_autonum_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Default New Element
|
//Default New Element
|
||||||
dom_root.setAttribute("freezeNewElement",
|
dom_root.setAttribute(QStringLiteral("freezeNewElement"),
|
||||||
m_freeze_new_elements ? "true" : "false");
|
m_freeze_new_elements ? QStringLiteral("true") : QStringLiteral("false"));
|
||||||
|
|
||||||
//Default New Conductor
|
//Default New Conductor
|
||||||
dom_root.setAttribute("freezeNewConductor",
|
dom_root.setAttribute(QStringLiteral("freezeNewConductor"),
|
||||||
m_freeze_new_conductors_
|
m_freeze_new_conductors_
|
||||||
? "true" : "false");
|
? QStringLiteral("true") : QStringLiteral("false"));
|
||||||
|
|
||||||
//Element Folio Sequential Variables
|
//Element Folio Sequential Variables
|
||||||
if (!m_elmt_unitfolio_max.isEmpty()
|
if (!m_elmt_unitfolio_max.isEmpty()
|
||||||
@@ -767,37 +776,37 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
|| !m_elmt_hundredfolio_max.isEmpty()) {
|
|| !m_elmt_hundredfolio_max.isEmpty()) {
|
||||||
QDomElement elmtfoliosequential =
|
QDomElement elmtfoliosequential =
|
||||||
document.createElement(
|
document.createElement(
|
||||||
"elementautonumfoliosequentials");
|
QStringLiteral("elementautonumfoliosequentials"));
|
||||||
if (!m_elmt_unitfolio_max.isEmpty()) {
|
if (!m_elmt_unitfolio_max.isEmpty()) {
|
||||||
QDomElement elmtfolioseq =
|
QDomElement elmtfolioseq =
|
||||||
document.createElement(
|
document.createElement(
|
||||||
"elementunitfolioseq");
|
QStringLiteral("elementunitfolioseq"));
|
||||||
folioSequentialsToXml(&m_elmt_unitfolio_max,
|
folioSequentialsToXml(&m_elmt_unitfolio_max,
|
||||||
&elmtfolioseq,
|
&elmtfolioseq,
|
||||||
"sequf_",
|
QStringLiteral("sequf_"),
|
||||||
"unitfolioseq",
|
QStringLiteral("unitfolioseq"),
|
||||||
&document);
|
&document);
|
||||||
elmtfoliosequential.appendChild(elmtfolioseq);
|
elmtfoliosequential.appendChild(elmtfolioseq);
|
||||||
}
|
}
|
||||||
if (!m_elmt_tenfolio_max.isEmpty()) {
|
if (!m_elmt_tenfolio_max.isEmpty()) {
|
||||||
QDomElement elmtfolioseq =
|
QDomElement elmtfolioseq =
|
||||||
document.createElement(
|
document.createElement(
|
||||||
"elementtenfolioseq");
|
QStringLiteral("elementtenfolioseq"));
|
||||||
folioSequentialsToXml(&m_elmt_tenfolio_max,
|
folioSequentialsToXml(&m_elmt_tenfolio_max,
|
||||||
&elmtfolioseq,
|
&elmtfolioseq,
|
||||||
"seqtf_",
|
QStringLiteral("seqtf_"),
|
||||||
"tenfolioseq",
|
QStringLiteral("tenfolioseq"),
|
||||||
&document);
|
&document);
|
||||||
elmtfoliosequential.appendChild(elmtfolioseq);
|
elmtfoliosequential.appendChild(elmtfolioseq);
|
||||||
}
|
}
|
||||||
if (!m_elmt_hundredfolio_max.isEmpty()) {
|
if (!m_elmt_hundredfolio_max.isEmpty()) {
|
||||||
QDomElement elmtfolioseq =
|
QDomElement elmtfolioseq =
|
||||||
document.createElement(
|
document.createElement(
|
||||||
"elementhundredfolioseq");
|
QStringLiteral("elementhundredfolioseq"));
|
||||||
folioSequentialsToXml(&m_elmt_hundredfolio_max,
|
folioSequentialsToXml(&m_elmt_hundredfolio_max,
|
||||||
&elmtfolioseq,
|
&elmtfolioseq,
|
||||||
"seqhf_",
|
QStringLiteral("seqhf_"),
|
||||||
"hundredfolioseq",
|
QStringLiteral("hundredfolioseq"),
|
||||||
&document);
|
&document);
|
||||||
elmtfoliosequential.appendChild(elmtfolioseq);
|
elmtfoliosequential.appendChild(elmtfolioseq);
|
||||||
}
|
}
|
||||||
@@ -809,38 +818,38 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
!m_cnd_hundredfolio_max.isEmpty()) {
|
!m_cnd_hundredfolio_max.isEmpty()) {
|
||||||
QDomElement cndfoliosequential =
|
QDomElement cndfoliosequential =
|
||||||
document.createElement(
|
document.createElement(
|
||||||
"conductorautonumfoliosequentials");
|
QStringLiteral("conductorautonumfoliosequentials"));
|
||||||
QHash<QString, QStringList>::iterator i;
|
QHash<QString, QStringList>::iterator i;
|
||||||
if (!m_cnd_unitfolio_max.isEmpty()) {
|
if (!m_cnd_unitfolio_max.isEmpty()) {
|
||||||
QDomElement cndfolioseq =
|
QDomElement cndfolioseq =
|
||||||
document.createElement(
|
document.createElement(
|
||||||
"conductorunitfolioseq");
|
QStringLiteral("conductorunitfolioseq"));
|
||||||
folioSequentialsToXml(&m_cnd_unitfolio_max,
|
folioSequentialsToXml(&m_cnd_unitfolio_max,
|
||||||
&cndfolioseq,
|
&cndfolioseq,
|
||||||
"sequf_",
|
QStringLiteral("sequf_"),
|
||||||
"unitfolioseq",
|
QStringLiteral("unitfolioseq"),
|
||||||
&document);
|
&document);
|
||||||
cndfoliosequential.appendChild(cndfolioseq);
|
cndfoliosequential.appendChild(cndfolioseq);
|
||||||
}
|
}
|
||||||
if (!m_cnd_tenfolio_max.isEmpty()) {
|
if (!m_cnd_tenfolio_max.isEmpty()) {
|
||||||
QDomElement cndfolioseq =
|
QDomElement cndfolioseq =
|
||||||
document.createElement(
|
document.createElement(
|
||||||
"conductortenfolioseq");
|
QStringLiteral("conductortenfolioseq"));
|
||||||
folioSequentialsToXml(&m_cnd_tenfolio_max,
|
folioSequentialsToXml(&m_cnd_tenfolio_max,
|
||||||
&cndfolioseq,
|
&cndfolioseq,
|
||||||
"seqtf_",
|
QStringLiteral("seqtf_"),
|
||||||
"tenfolioseq",
|
QStringLiteral("tenfolioseq"),
|
||||||
&document);
|
&document);
|
||||||
cndfoliosequential.appendChild(cndfolioseq);
|
cndfoliosequential.appendChild(cndfolioseq);
|
||||||
}
|
}
|
||||||
if (!m_cnd_hundredfolio_max.isEmpty()) {
|
if (!m_cnd_hundredfolio_max.isEmpty()) {
|
||||||
QDomElement cndfolioseq =
|
QDomElement cndfolioseq =
|
||||||
document.createElement(
|
document.createElement(
|
||||||
"conductorhundredfolioseq");
|
QStringLiteral("conductorhundredfolioseq"));
|
||||||
folioSequentialsToXml(&m_cnd_hundredfolio_max,
|
folioSequentialsToXml(&m_cnd_hundredfolio_max,
|
||||||
&cndfolioseq,
|
&cndfolioseq,
|
||||||
"seqhf_",
|
QStringLiteral("seqhf_"),
|
||||||
"hundredfolioseq",
|
QStringLiteral("hundredfolioseq"),
|
||||||
&document);
|
&document);
|
||||||
cndfoliosequential.appendChild(cndfolioseq);
|
cndfoliosequential.appendChild(cndfolioseq);
|
||||||
}
|
}
|
||||||
@@ -851,7 +860,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
//this method with whole_content to false,
|
//this method with whole_content to false,
|
||||||
//is often use to copy and paste the current selection
|
//is often use to copy and paste the current selection
|
||||||
//so we add the id of the project where copy occur.
|
//so we add the id of the project where copy occur.
|
||||||
dom_root.setAttribute("projectId", QETApp::projectId(m_project));
|
dom_root.setAttribute(QStringLiteral("projectId"), QETApp::projectId(m_project));
|
||||||
}
|
}
|
||||||
document.appendChild(dom_root);
|
document.appendChild(dom_root);
|
||||||
|
|
||||||
@@ -921,7 +930,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
QHash<Terminal *, int> table_adr_id;
|
QHash<Terminal *, int> table_adr_id;
|
||||||
|
|
||||||
if (!list_elements.isEmpty()) {
|
if (!list_elements.isEmpty()) {
|
||||||
auto dom_elements = document.createElement("elements");
|
auto dom_elements = document.createElement(QStringLiteral("elements"));
|
||||||
for (auto elmt : list_elements) {
|
for (auto elmt : list_elements) {
|
||||||
dom_elements.appendChild(elmt->toXml(document,
|
dom_elements.appendChild(elmt->toXml(document,
|
||||||
table_adr_id));
|
table_adr_id));
|
||||||
@@ -930,7 +939,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!list_conductors.isEmpty()) {
|
if (!list_conductors.isEmpty()) {
|
||||||
auto dom_conductors = document.createElement("conductors");
|
auto dom_conductors = document.createElement(QStringLiteral("conductors"));
|
||||||
for (auto cond : list_conductors) {
|
for (auto cond : list_conductors) {
|
||||||
dom_conductors.appendChild(cond->toXml(document,
|
dom_conductors.appendChild(cond->toXml(document,
|
||||||
table_adr_id));
|
table_adr_id));
|
||||||
@@ -939,7 +948,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!list_texts.isEmpty()) {
|
if (!list_texts.isEmpty()) {
|
||||||
auto dom_texts = document.createElement("inputs");
|
auto dom_texts = document.createElement(QStringLiteral("inputs"));
|
||||||
for (auto dti : list_texts) {
|
for (auto dti : list_texts) {
|
||||||
dom_texts.appendChild(dti->toXml(document));
|
dom_texts.appendChild(dti->toXml(document));
|
||||||
}
|
}
|
||||||
@@ -947,7 +956,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!list_images.isEmpty()) {
|
if (!list_images.isEmpty()) {
|
||||||
auto dom_images = document.createElement("images");
|
auto dom_images = document.createElement(QStringLiteral("images"));
|
||||||
for (auto dii : list_images) {
|
for (auto dii : list_images) {
|
||||||
dom_images.appendChild(dii->toXml(document));
|
dom_images.appendChild(dii->toXml(document));
|
||||||
}
|
}
|
||||||
@@ -955,7 +964,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!list_shapes.isEmpty()) {
|
if (!list_shapes.isEmpty()) {
|
||||||
auto dom_shapes = document.createElement("shapes");
|
auto dom_shapes = document.createElement(QStringLiteral("shapes"));
|
||||||
for (auto dii : list_shapes) {
|
for (auto dii : list_shapes) {
|
||||||
dom_shapes.appendChild(dii -> toXml(document));
|
dom_shapes.appendChild(dii -> toXml(document));
|
||||||
}
|
}
|
||||||
@@ -963,7 +972,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (table_vector.size()) {
|
if (table_vector.size()) {
|
||||||
auto tables = document.createElement("tables");
|
auto tables = document.createElement(QStringLiteral("tables"));
|
||||||
for (auto table : table_vector) {
|
for (auto table : table_vector) {
|
||||||
tables.appendChild(table->toXml(document));
|
tables.appendChild(table->toXml(document));
|
||||||
}
|
}
|
||||||
@@ -987,11 +996,15 @@ void Diagram::folioSequentialsToXml(QHash<QString,
|
|||||||
QDomElement *domElement,
|
QDomElement *domElement,
|
||||||
const QString& seq_type,
|
const QString& seq_type,
|
||||||
const QString& type,
|
const QString& type,
|
||||||
QDomDocument *doc) {
|
QDomDocument *doc)
|
||||||
|
{
|
||||||
QHash<QString, QStringList>::iterator i;
|
QHash<QString, QStringList>::iterator i;
|
||||||
for (i = hash->begin(); i != hash->end(); i++) {
|
|
||||||
|
for (i = hash->begin(); i != hash->end(); i++)
|
||||||
|
{
|
||||||
QDomElement folioseq = doc->createElement(type);
|
QDomElement folioseq = doc->createElement(type);
|
||||||
folioseq.setAttribute("title", i.key());
|
folioseq.setAttribute(QStringLiteral("title"), i.key());
|
||||||
|
|
||||||
for (int j = 0; j < i.value().size(); j++) {
|
for (int j = 0; j < i.value().size(); j++) {
|
||||||
folioseq.setAttribute(seq_type + QString::number(j+1),
|
folioseq.setAttribute(seq_type + QString::number(j+1),
|
||||||
i.value().at(j));
|
i.value().at(j));
|
||||||
@@ -1096,14 +1109,15 @@ bool Diagram::initFromXml(QDomElement &document,
|
|||||||
@return
|
@return
|
||||||
*/
|
*/
|
||||||
Terminal* findTerminal(int conductor_index,
|
Terminal* findTerminal(int conductor_index,
|
||||||
QDomElement& f,
|
QDomElement& f,
|
||||||
QHash<int,
|
QHash<int,Terminal *>& table_adr_id,
|
||||||
Terminal *>& table_adr_id,
|
QList<Element *>& added_elements)
|
||||||
QList<Element *>& added_elements) {
|
{
|
||||||
assert(conductor_index == 1 || conductor_index == 2);
|
assert(conductor_index == 1 || conductor_index == 2);
|
||||||
|
|
||||||
QString element_index = "element" + QString::number(conductor_index);
|
auto str_index = QString::number(conductor_index);
|
||||||
QString terminal_index = "terminal" + QString::number(conductor_index);
|
QString element_index = QStringLiteral("element") + str_index;
|
||||||
|
QString terminal_index = QStringLiteral("terminal") + str_index;
|
||||||
|
|
||||||
if (f.hasAttribute(element_index)) {
|
if (f.hasAttribute(element_index)) {
|
||||||
QUuid element_uuid = QUuid(f.attribute(element_index));
|
QUuid element_uuid = QUuid(f.attribute(element_index));
|
||||||
@@ -1185,10 +1199,13 @@ Terminal* findTerminal(int conductor_index,
|
|||||||
bool Diagram::fromXml(QDomElement &document,
|
bool Diagram::fromXml(QDomElement &document,
|
||||||
QPointF position,
|
QPointF position,
|
||||||
bool consider_informations,
|
bool consider_informations,
|
||||||
DiagramContent *content_ptr) {
|
DiagramContent *content_ptr)
|
||||||
|
{
|
||||||
const QDomElement& root = document;
|
const QDomElement& root = document;
|
||||||
// The first element must be a diagram
|
// The first element must be a diagram
|
||||||
if (root.tagName() != "diagram") return(false);
|
if (root.tagName() != QLatin1String("diagram")) {
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Read attributes of this diagram
|
// Read attributes of this diagram
|
||||||
if (consider_informations)
|
if (consider_informations)
|
||||||
@@ -1197,56 +1214,57 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
border_and_titleblock.titleBlockFromXml(root);
|
border_and_titleblock.titleBlockFromXml(root);
|
||||||
border_and_titleblock.borderFromXml(root);
|
border_and_titleblock.borderFromXml(root);
|
||||||
|
|
||||||
// Find the element "defaultconductor".
|
// Find the element "defaultconductor".
|
||||||
// If found, load default conductor properties.
|
// If found, load default conductor properties.
|
||||||
QDomElement default_conductor_elmt =
|
QDomElement default_conductor_elmt =
|
||||||
root.firstChildElement("defaultconductor");
|
root.firstChildElement(QStringLiteral("defaultconductor"));
|
||||||
if (!default_conductor_elmt.isNull()) {
|
if (!default_conductor_elmt.isNull()) {
|
||||||
defaultConductorProperties.fromXml(default_conductor_elmt);
|
defaultConductorProperties.fromXml(default_conductor_elmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the autonum
|
// Load the autonum
|
||||||
m_conductors_autonum_name = root.attribute("conductorAutonum");
|
m_conductors_autonum_name = root.attribute(QStringLiteral("conductorAutonum"));
|
||||||
|
|
||||||
// Load Freeze New Element
|
// Load Freeze New Element
|
||||||
m_freeze_new_elements = root.attribute("freezeNewElement").toInt();
|
m_freeze_new_elements = root.attribute(QStringLiteral("freezeNewElement")).toInt();
|
||||||
|
|
||||||
// Load Freeze New Conductor
|
// Load Freeze New Conductor
|
||||||
m_freeze_new_conductors_ = root.attribute("freezeNewConductor").toInt();
|
m_freeze_new_conductors_ = root.attribute(QStringLiteral("freezeNewConductor")).toInt();
|
||||||
|
|
||||||
//Load Element Folio Sequential
|
//Load Element Folio Sequential
|
||||||
folioSequentialsFromXml(root,
|
folioSequentialsFromXml(root,
|
||||||
&m_elmt_unitfolio_max,
|
&m_elmt_unitfolio_max,
|
||||||
"elementunitfolioseq",
|
QStringLiteral("elementunitfolioseq"),
|
||||||
"sequf_",
|
QStringLiteral("sequf_"),
|
||||||
"unitfolioseq",
|
QStringLiteral("unitfolioseq"),
|
||||||
"elementautonumfoliosequentials");
|
QStringLiteral("elementautonumfoliosequentials"));
|
||||||
folioSequentialsFromXml(root, &m_elmt_tenfolio_max,
|
folioSequentialsFromXml(root, &m_elmt_tenfolio_max,
|
||||||
"elementtenfolioseq",
|
QStringLiteral("elementtenfolioseq"),
|
||||||
"seqtf_",
|
QStringLiteral("seqtf_"),
|
||||||
"tenfolioseq",
|
QStringLiteral("tenfolioseq"),
|
||||||
"elementautonumfoliosequentials");
|
QStringLiteral("elementautonumfoliosequentials"));
|
||||||
folioSequentialsFromXml(root, &m_elmt_hundredfolio_max,
|
folioSequentialsFromXml(root, &m_elmt_hundredfolio_max,
|
||||||
"elementhundredfolioseq",
|
QStringLiteral("elementhundredfolioseq"),
|
||||||
"seqhf_",
|
QStringLiteral("seqhf_"),
|
||||||
"hundredfolioseq",
|
QStringLiteral("hundredfolioseq"),
|
||||||
"elementautonumfoliosequentials");
|
QStringLiteral("elementautonumfoliosequentials"));
|
||||||
|
|
||||||
//Load Conductor Folio Sequential
|
//Load Conductor Folio Sequential
|
||||||
folioSequentialsFromXml(root, &m_cnd_unitfolio_max,
|
folioSequentialsFromXml(root, &m_cnd_unitfolio_max,
|
||||||
"conductorunitfolioseq",
|
QStringLiteral("conductorunitfolioseq"),
|
||||||
"sequf_",
|
QStringLiteral("sequf_"),
|
||||||
"unitfolioseq",
|
QStringLiteral("unitfolioseq"),
|
||||||
"conductorautonumfoliosequentials");
|
QStringLiteral("conductorautonumfoliosequentials"));
|
||||||
folioSequentialsFromXml(root, &m_cnd_tenfolio_max,
|
folioSequentialsFromXml(root, &m_cnd_tenfolio_max,
|
||||||
"conductortenfolioseq",
|
QStringLiteral("conductortenfolioseq"),
|
||||||
"seqtf_","tenfolioseq",
|
QStringLiteral("seqtf_"),
|
||||||
"conductorautonumfoliosequentials");
|
QStringLiteral("tenfolioseq"),
|
||||||
|
QStringLiteral("conductorautonumfoliosequentials"));
|
||||||
folioSequentialsFromXml(root, &m_cnd_hundredfolio_max,
|
folioSequentialsFromXml(root, &m_cnd_hundredfolio_max,
|
||||||
"conductorhundredfolioseq",
|
QStringLiteral("conductorhundredfolioseq"),
|
||||||
"seqhf_",
|
QStringLiteral("seqhf_"),
|
||||||
"hundredfolioseq",
|
QStringLiteral("hundredfolioseq"),
|
||||||
"conductorautonumfoliosequentials");
|
QStringLiteral("conductorautonumfoliosequentials"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if child haven't got a child, loading is finish (diagram is empty)
|
// if child haven't got a child, loading is finish (diagram is empty)
|
||||||
@@ -1255,10 +1273,10 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//If paste from another project
|
//If paste from another project
|
||||||
if (root.hasAttribute("projectId")) {
|
if (root.hasAttribute(QStringLiteral("projectId")))
|
||||||
QETProject *other_project = QETApp::project(
|
{
|
||||||
root.attribute("projectId",
|
QETProject *other_project = QETApp::project(root.attribute(QStringLiteral("projectId"),
|
||||||
"-1").toInt());
|
QStringLiteral("-1")).toInt());
|
||||||
|
|
||||||
/* We try to paste from another project,
|
/* We try to paste from another project,
|
||||||
* then befor paste elements,
|
* then befor paste elements,
|
||||||
@@ -1266,17 +1284,18 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
* (owned by other project)
|
* (owned by other project)
|
||||||
* in the embedded collection of this project
|
* in the embedded collection of this project
|
||||||
*/
|
*/
|
||||||
if (other_project && other_project != m_project) {
|
if (other_project && other_project != m_project)
|
||||||
|
{
|
||||||
ElementCollectionHandler ech;
|
ElementCollectionHandler ech;
|
||||||
foreach (QDomElement element_xml,
|
for (auto element_xml :
|
||||||
QET::findInDomElement(root,
|
QET::findInDomElement(root,
|
||||||
"elements",
|
QStringLiteral("elements"),
|
||||||
"element")) {
|
QStringLiteral("element"))) {
|
||||||
if (!Element::valideXml(element_xml)) continue;
|
if (!Element::valideXml(element_xml)) continue;
|
||||||
|
|
||||||
QString type_id = element_xml.attribute("type");
|
QString type_id = element_xml.attribute(QStringLiteral("type"));
|
||||||
|
|
||||||
if (type_id.startsWith("embed://")) {
|
if (type_id.startsWith(QStringLiteral("embed://"))) {
|
||||||
ElementsLocation location(
|
ElementsLocation location(
|
||||||
type_id,
|
type_id,
|
||||||
other_project);
|
other_project);
|
||||||
@@ -1289,15 +1308,15 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
//Load all elements from the XML
|
//Load all elements from the XML
|
||||||
QList<Element *> added_elements;
|
QList<Element *> added_elements;
|
||||||
QHash<int, Terminal *> table_adr_id;
|
QHash<int, Terminal *> table_adr_id;
|
||||||
foreach (QDomElement element_xml,
|
for (auto element_xml :
|
||||||
QET::findInDomElement(root, "elements", "element"))
|
QET::findInDomElement(root, QStringLiteral("elements"), QStringLiteral("element")))
|
||||||
{
|
{
|
||||||
if (!Element::valideXml(element_xml)) continue;
|
if (!Element::valideXml(element_xml)) continue;
|
||||||
|
|
||||||
// cree un element dont le type correspond a l'id type
|
// cree un element dont le type correspond a l'id type
|
||||||
QString type_id = element_xml.attribute("type");
|
QString type_id = element_xml.attribute(QStringLiteral("type"));
|
||||||
ElementsLocation element_location;
|
ElementsLocation element_location;
|
||||||
if (type_id.startsWith("embed://")) {
|
if (type_id.startsWith(QStringLiteral("embed://"))) {
|
||||||
element_location = ElementsLocation(type_id, m_project);
|
element_location = ElementsLocation(type_id, m_project);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1326,8 +1345,7 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
{
|
{
|
||||||
removeItem(nvel_elmt);
|
removeItem(nvel_elmt);
|
||||||
delete nvel_elmt;
|
delete nvel_elmt;
|
||||||
qDebug() << "Diagram::fromXml() : Le chargement des "
|
qDebug() << QStringLiteral("Diagram::fromXml() : Le chargement des parametres d'un element a echoue");
|
||||||
"parametres d'un element a echoue";
|
|
||||||
} else {
|
} else {
|
||||||
added_elements << nvel_elmt;
|
added_elements << nvel_elmt;
|
||||||
}
|
}
|
||||||
@@ -1335,9 +1353,9 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
|
|
||||||
// Load text
|
// Load text
|
||||||
QList<IndependentTextItem *> added_texts;
|
QList<IndependentTextItem *> added_texts;
|
||||||
foreach (QDomElement text_xml, QET::findInDomElement(root,
|
for (auto text_xml : QET::findInDomElement(root,
|
||||||
"inputs",
|
QStringLiteral("inputs"),
|
||||||
"input")) {
|
QStringLiteral("input"))) {
|
||||||
IndependentTextItem *iti = new IndependentTextItem();
|
IndependentTextItem *iti = new IndependentTextItem();
|
||||||
iti -> fromXml(text_xml);
|
iti -> fromXml(text_xml);
|
||||||
addItem(iti);
|
addItem(iti);
|
||||||
@@ -1346,9 +1364,9 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
|
|
||||||
// Load image
|
// Load image
|
||||||
QList<DiagramImageItem *> added_images;
|
QList<DiagramImageItem *> added_images;
|
||||||
foreach (QDomElement image_xml, QET::findInDomElement(root,
|
for (auto image_xml : QET::findInDomElement(root,
|
||||||
"images",
|
QStringLiteral("images"),
|
||||||
"image")) {
|
QStringLiteral("image"))) {
|
||||||
DiagramImageItem *dii = new DiagramImageItem ();
|
DiagramImageItem *dii = new DiagramImageItem ();
|
||||||
dii -> fromXml(image_xml);
|
dii -> fromXml(image_xml);
|
||||||
addItem(dii);
|
addItem(dii);
|
||||||
@@ -1357,9 +1375,9 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
|
|
||||||
// Load shape
|
// Load shape
|
||||||
QList<QetShapeItem *> added_shapes;
|
QList<QetShapeItem *> added_shapes;
|
||||||
foreach (QDomElement shape_xml, QET::findInDomElement(root,
|
for (auto shape_xml : QET::findInDomElement(root,
|
||||||
"shapes",
|
QStringLiteral("shapes"),
|
||||||
"shape")) {
|
QStringLiteral("shape"))) {
|
||||||
QetShapeItem *dii = new QetShapeItem (QPointF(0,0));
|
QetShapeItem *dii = new QetShapeItem (QPointF(0,0));
|
||||||
dii -> fromXml(shape_xml);
|
dii -> fromXml(shape_xml);
|
||||||
addItem(dii);
|
addItem(dii);
|
||||||
@@ -1368,9 +1386,9 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
|
|
||||||
// Load conductor
|
// Load conductor
|
||||||
QList<Conductor *> added_conductors;
|
QList<Conductor *> added_conductors;
|
||||||
foreach (QDomElement f, QET::findInDomElement(root,
|
for (auto f : QET::findInDomElement(root,
|
||||||
"conductors",
|
QStringLiteral("conductors"),
|
||||||
"conductor"))
|
QStringLiteral("conductor")))
|
||||||
{
|
{
|
||||||
if (!Conductor::valideXml(f)) continue;
|
if (!Conductor::valideXml(f)) continue;
|
||||||
|
|
||||||
@@ -1395,10 +1413,9 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
|
|
||||||
//Load tables
|
//Load tables
|
||||||
QVector<QetGraphicsTableItem *> added_tables;
|
QVector<QetGraphicsTableItem *> added_tables;
|
||||||
for (auto dom_table
|
for (const auto &dom_table : QETXML::subChild(root,
|
||||||
: QETXML::subChild(root,
|
QStringLiteral("tables"),
|
||||||
"tables",
|
QetGraphicsTableItem::xmlTagName()))
|
||||||
QetGraphicsTableItem::xmlTagName()))
|
|
||||||
{
|
{
|
||||||
auto table = new QetGraphicsTableItem();
|
auto table = new QetGraphicsTableItem();
|
||||||
addItem(table);
|
addItem(table);
|
||||||
@@ -1410,12 +1427,12 @@ bool Diagram::fromXml(QDomElement &document,
|
|||||||
if (position != QPointF())
|
if (position != QPointF())
|
||||||
{
|
{
|
||||||
QVector <QGraphicsItem *> added_items;
|
QVector <QGraphicsItem *> added_items;
|
||||||
for (auto element : added_elements ) added_items << element;
|
for (auto element : qAsConst(added_elements )) added_items << element;
|
||||||
for (auto cond : added_conductors) added_items << cond;
|
for (auto cond : qAsConst(added_conductors )) added_items << cond;
|
||||||
for (auto shape : added_shapes ) added_items << shape;
|
for (auto shape : qAsConst(added_shapes )) added_items << shape;
|
||||||
for (auto text : added_texts ) added_items << text;
|
for (auto text : qAsConst(added_texts )) added_items << text;
|
||||||
for (auto image : added_images ) added_items << image;
|
for (auto image : qAsConst(added_images )) added_items << image;
|
||||||
for (auto table : added_tables ) added_items << table;
|
for (auto table : qAsConst(added_tables )) added_items << table;
|
||||||
|
|
||||||
//Get the top left corner of the rectangle that contain all added items
|
//Get the top left corner of the rectangle that contain all added items
|
||||||
QRectF items_rect;
|
QRectF items_rect;
|
||||||
@@ -1487,7 +1504,7 @@ void Diagram::folioSequentialsFromXml(const QDomElement &root,
|
|||||||
= folioSeqAutoNum.firstChildElement(type);
|
= folioSeqAutoNum.firstChildElement(type);
|
||||||
!folioseq.isNull();
|
!folioseq.isNull();
|
||||||
folioseq = folioseq.nextSiblingElement(type)) {
|
folioseq = folioseq.nextSiblingElement(type)) {
|
||||||
QString title = folioseq.attribute("title");
|
QString title = folioseq.attribute(QStringLiteral("title"));
|
||||||
QStringList list;
|
QStringList list;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (folioseq.hasAttribute(seq
|
while (folioseq.hasAttribute(seq
|
||||||
@@ -1871,10 +1888,10 @@ void Diagram::loadElmtFolioSeq()
|
|||||||
|| !m_elmt_unitfolio_max.contains(title)) {
|
|| !m_elmt_unitfolio_max.contains(title)) {
|
||||||
//Insert Initial Value
|
//Insert Initial Value
|
||||||
if (project()->elementAutoNumCurrentFormula().contains(
|
if (project()->elementAutoNumCurrentFormula().contains(
|
||||||
"%sequf_")) {
|
QStringLiteral("%sequf_"))) {
|
||||||
insertFolioSeqHash(&m_elmt_unitfolio_max,
|
insertFolioSeqHash(&m_elmt_unitfolio_max,
|
||||||
title,
|
title,
|
||||||
"unitfolio",
|
QStringLiteral("unitfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addElementAutoNum(title,nc);
|
project()->addElementAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
@@ -1882,10 +1899,10 @@ void Diagram::loadElmtFolioSeq()
|
|||||||
else if (m_elmt_unitfolio_max.contains(title)) {
|
else if (m_elmt_unitfolio_max.contains(title)) {
|
||||||
//Load Folio Current Value
|
//Load Folio Current Value
|
||||||
if (project()->elementAutoNumCurrentFormula().contains(
|
if (project()->elementAutoNumCurrentFormula().contains(
|
||||||
"%sequf_")) {
|
QStringLiteral("%sequf_"))) {
|
||||||
loadFolioSeqHash(&m_elmt_unitfolio_max,
|
loadFolioSeqHash(&m_elmt_unitfolio_max,
|
||||||
title,
|
title,
|
||||||
"unitfolio",
|
QStringLiteral("unitfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addElementAutoNum(title,nc);
|
project()->addElementAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
@@ -1896,10 +1913,10 @@ void Diagram::loadElmtFolioSeq()
|
|||||||
|| !m_elmt_tenfolio_max.contains(title)) {
|
|| !m_elmt_tenfolio_max.contains(title)) {
|
||||||
//Insert Initial Value
|
//Insert Initial Value
|
||||||
if (project()->elementAutoNumCurrentFormula().contains(
|
if (project()->elementAutoNumCurrentFormula().contains(
|
||||||
"%seqtf_")) {
|
QStringLiteral("%seqtf_"))) {
|
||||||
insertFolioSeqHash(&m_elmt_tenfolio_max,
|
insertFolioSeqHash(&m_elmt_tenfolio_max,
|
||||||
title,
|
title,
|
||||||
"tenfolio",
|
QStringLiteral("tenfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addElementAutoNum(title,nc);
|
project()->addElementAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
@@ -1907,10 +1924,10 @@ void Diagram::loadElmtFolioSeq()
|
|||||||
else if (m_elmt_tenfolio_max.contains(title)) {
|
else if (m_elmt_tenfolio_max.contains(title)) {
|
||||||
//Load Folio Current Value
|
//Load Folio Current Value
|
||||||
if (project()->elementAutoNumCurrentFormula().contains(
|
if (project()->elementAutoNumCurrentFormula().contains(
|
||||||
"%seqtf_")) {
|
QStringLiteral("%seqtf_"))) {
|
||||||
loadFolioSeqHash(&m_elmt_tenfolio_max,
|
loadFolioSeqHash(&m_elmt_tenfolio_max,
|
||||||
title,
|
title,
|
||||||
"tenfolio",
|
QStringLiteral("tenfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addElementAutoNum(title,nc);
|
project()->addElementAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
@@ -1921,10 +1938,10 @@ void Diagram::loadElmtFolioSeq()
|
|||||||
|| !m_elmt_hundredfolio_max.contains(title)) {
|
|| !m_elmt_hundredfolio_max.contains(title)) {
|
||||||
//Insert Initial Value
|
//Insert Initial Value
|
||||||
if (project()->elementAutoNumCurrentFormula().contains(
|
if (project()->elementAutoNumCurrentFormula().contains(
|
||||||
"%seqhf_")) {
|
QStringLiteral("%seqhf_"))) {
|
||||||
insertFolioSeqHash(&m_elmt_hundredfolio_max,
|
insertFolioSeqHash(&m_elmt_hundredfolio_max,
|
||||||
title,
|
title,
|
||||||
"hundredfolio",
|
QStringLiteral("hundredfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addElementAutoNum(title,nc);
|
project()->addElementAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
@@ -1932,10 +1949,10 @@ void Diagram::loadElmtFolioSeq()
|
|||||||
else if (m_elmt_hundredfolio_max.contains(title)) {
|
else if (m_elmt_hundredfolio_max.contains(title)) {
|
||||||
//Load Folio Current Value
|
//Load Folio Current Value
|
||||||
if (project()->elementAutoNumCurrentFormula().contains(
|
if (project()->elementAutoNumCurrentFormula().contains(
|
||||||
"%seqhf_")) {
|
QStringLiteral("%seqhf_"))) {
|
||||||
loadFolioSeqHash(&m_elmt_hundredfolio_max,
|
loadFolioSeqHash(&m_elmt_hundredfolio_max,
|
||||||
title,
|
title,
|
||||||
"hundredfolio",
|
QStringLiteral("hundredfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addElementAutoNum(title,nc);
|
project()->addElementAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
@@ -1958,20 +1975,20 @@ void Diagram::loadCndFolioSeq()
|
|||||||
if (m_cnd_unitfolio_max.isEmpty()
|
if (m_cnd_unitfolio_max.isEmpty()
|
||||||
|| !m_cnd_unitfolio_max.contains(title)) {
|
|| !m_cnd_unitfolio_max.contains(title)) {
|
||||||
//Insert Initial Value
|
//Insert Initial Value
|
||||||
if (formula.contains("%sequf_")) {
|
if (formula.contains(QStringLiteral("%sequf_"))) {
|
||||||
insertFolioSeqHash(&m_cnd_unitfolio_max,
|
insertFolioSeqHash(&m_cnd_unitfolio_max,
|
||||||
title,
|
title,
|
||||||
"unitfolio",
|
QStringLiteral("unitfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addConductorAutoNum(title,nc);
|
project()->addConductorAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_cnd_unitfolio_max.contains(title)) {
|
else if (m_cnd_unitfolio_max.contains(title)) {
|
||||||
//Load Folio Current Value
|
//Load Folio Current Value
|
||||||
if (formula.contains("%sequf_")) {
|
if (formula.contains(QStringLiteral("%sequf_"))) {
|
||||||
loadFolioSeqHash(&m_cnd_unitfolio_max,
|
loadFolioSeqHash(&m_cnd_unitfolio_max,
|
||||||
title,
|
title,
|
||||||
"unitfolio",
|
QStringLiteral("unitfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addConductorAutoNum(title,nc);
|
project()->addConductorAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
@@ -1981,20 +1998,20 @@ void Diagram::loadCndFolioSeq()
|
|||||||
if (m_cnd_tenfolio_max.isEmpty()
|
if (m_cnd_tenfolio_max.isEmpty()
|
||||||
|| !m_cnd_tenfolio_max.contains(title)) {
|
|| !m_cnd_tenfolio_max.contains(title)) {
|
||||||
//Insert Initial Value
|
//Insert Initial Value
|
||||||
if (formula.contains("%seqtf_")) {
|
if (formula.contains(QStringLiteral("%seqtf_"))) {
|
||||||
insertFolioSeqHash(&m_cnd_tenfolio_max,
|
insertFolioSeqHash(&m_cnd_tenfolio_max,
|
||||||
title,
|
title,
|
||||||
"tenfolio",
|
QStringLiteral("tenfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addConductorAutoNum(title,nc);
|
project()->addConductorAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_cnd_tenfolio_max.contains(title)) {
|
else if (m_cnd_tenfolio_max.contains(title)) {
|
||||||
//Load Folio Current Value
|
//Load Folio Current Value
|
||||||
if (formula.contains("%seqtf_")) {
|
if (formula.contains(QStringLiteral("%seqtf_"))) {
|
||||||
loadFolioSeqHash(&m_cnd_tenfolio_max,
|
loadFolioSeqHash(&m_cnd_tenfolio_max,
|
||||||
title,
|
title,
|
||||||
"tenfolio",
|
QStringLiteral("tenfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addConductorAutoNum(title,nc);
|
project()->addConductorAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
@@ -2004,20 +2021,20 @@ void Diagram::loadCndFolioSeq()
|
|||||||
if (m_cnd_hundredfolio_max.isEmpty()
|
if (m_cnd_hundredfolio_max.isEmpty()
|
||||||
|| !m_cnd_hundredfolio_max.contains(title)) {
|
|| !m_cnd_hundredfolio_max.contains(title)) {
|
||||||
//Insert Initial Value
|
//Insert Initial Value
|
||||||
if (formula.contains("%seqhf_")) {
|
if (formula.contains(QStringLiteral("%seqhf_"))) {
|
||||||
insertFolioSeqHash(&m_cnd_hundredfolio_max,
|
insertFolioSeqHash(&m_cnd_hundredfolio_max,
|
||||||
title,
|
title,
|
||||||
"hundredfolio",
|
QStringLiteral("hundredfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addConductorAutoNum(title,nc);
|
project()->addConductorAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_cnd_hundredfolio_max.contains(title)) {
|
else if (m_cnd_hundredfolio_max.contains(title)) {
|
||||||
//Load Folio Current Value
|
//Load Folio Current Value
|
||||||
if (formula.contains("%seqhf_")) {
|
if (formula.contains(QStringLiteral("%seqhf_"))) {
|
||||||
loadFolioSeqHash(&m_cnd_hundredfolio_max,
|
loadFolioSeqHash(&m_cnd_hundredfolio_max,
|
||||||
title,
|
title,
|
||||||
"hundredfolio",
|
QStringLiteral("hundredfolio"),
|
||||||
&nc);
|
&nc);
|
||||||
project()->addConductorAutoNum(title,nc);
|
project()->addConductorAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
@@ -2257,10 +2274,10 @@ DiagramPosition Diagram::convertPosition(const QPointF &pos) {
|
|||||||
QPointF Diagram::snapToGrid(const QPointF &p)
|
QPointF Diagram::snapToGrid(const QPointF &p)
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
int xGrid = settings.value("diagrameditor/Xgrid",
|
int xGrid = settings.value(QStringLiteral("diagrameditor/Xgrid"),
|
||||||
Diagram::xGrid).toInt();
|
Diagram::xGrid).toInt();
|
||||||
int yGrid = settings.value("diagrameditor/Ygrid",
|
int yGrid = settings.value(QStringLiteral("diagrameditor/Ygrid"),
|
||||||
Diagram::yGrid).toInt();
|
Diagram::yGrid).toInt();
|
||||||
|
|
||||||
//Return a point rounded to the nearest pixel
|
//Return a point rounded to the nearest pixel
|
||||||
if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier))
|
if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier))
|
||||||
@@ -2330,8 +2347,8 @@ QSet<Conductor *> Diagram::selectedConductors() const
|
|||||||
bool Diagram::clipboardMayContainDiagram()
|
bool Diagram::clipboardMayContainDiagram()
|
||||||
{
|
{
|
||||||
QString clipboard_text = QApplication::clipboard() -> text().trimmed();
|
QString clipboard_text = QApplication::clipboard() -> text().trimmed();
|
||||||
bool may_be_diagram = clipboard_text.startsWith("<diagram")
|
bool may_be_diagram = clipboard_text.startsWith(QStringLiteral("<diagram"))
|
||||||
&& clipboard_text.endsWith("</diagram>");
|
&& clipboard_text.endsWith(QStringLiteral("</diagram>"));
|
||||||
return(may_be_diagram);
|
return(may_be_diagram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ class Diagram : public QGraphicsScene
|
|||||||
void findElementRequired(const ElementsLocation &);
|
void findElementRequired(const ElementsLocation &);
|
||||||
|
|
||||||
void diagramActivated();
|
void diagramActivated();
|
||||||
|
void diagramInformationChanged();
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(Diagram *)
|
Q_DECLARE_METATYPE(Diagram *)
|
||||||
|
|
||||||
|
|||||||
@@ -1219,13 +1219,20 @@ QList<QAction *> DiagramView::contextMenuActions() const
|
|||||||
*/
|
*/
|
||||||
void DiagramView::contextMenuEvent(QContextMenuEvent *e)
|
void DiagramView::contextMenuEvent(QContextMenuEvent *e)
|
||||||
{
|
{
|
||||||
if (QGraphicsItem *qgi = m_diagram->itemAt(mapToScene(e->pos()), transform()))
|
if (auto qgi = m_diagram->itemAt(mapToScene(e->pos()), transform()))
|
||||||
{
|
{
|
||||||
if (!qgi -> isSelected()) {
|
if (!qgi->isSelected()) {
|
||||||
m_diagram->clearSelection();
|
m_diagram->clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
qgi->setSelected(true);
|
// At this step qgi can be deleted for exemple if qgi is a QetGraphicsHandlerItem.
|
||||||
|
// When we call clearSelection the parent item of the handler
|
||||||
|
// is deselected and so delete all handlers, in this case,
|
||||||
|
// qgi become a dangling pointer.
|
||||||
|
// we need to call again itemAt.
|
||||||
|
if (auto item_ = m_diagram->itemAt(mapToScene(e->pos()), transform())) {
|
||||||
|
item_->setSelected(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_diagram->selectedItems().isEmpty())
|
if (m_diagram->selectedItems().isEmpty())
|
||||||
|
|||||||
@@ -1308,14 +1308,29 @@ void CustomElementGraphicPart::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
|
|
||||||
void CustomElementGraphicPart::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void CustomElementGraphicPart::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if(event->button() == Qt::LeftButton)
|
if(event->button() == Qt::LeftButton) {
|
||||||
m_origin_pos = this->pos();
|
m_origin_pos = this->pos();
|
||||||
|
m_first_move = true;
|
||||||
|
}
|
||||||
|
|
||||||
QGraphicsObject::mousePressEvent(event);
|
QGraphicsObject::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomElementGraphicPart::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
void CustomElementGraphicPart::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
//m_first_move is used to avoid an unwanted behavior
|
||||||
|
//when the properties dock widget is displayed :
|
||||||
|
//1 there is no selection
|
||||||
|
//2 the dock widget width is set to minimum
|
||||||
|
//3 select a part, the dock widget gain new widgets used to edit
|
||||||
|
//the current selected part and the width of the dock grow
|
||||||
|
//so the width of the QGraphicsView is reduced and cause a mouse move event.
|
||||||
|
//When this case occur the part is moved but they should not. This bool fix it.
|
||||||
|
if (Q_UNLIKELY(m_first_move)) {
|
||||||
|
m_first_move = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if((event->buttons() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable))
|
if((event->buttons() & Qt::LeftButton) && (flags() & QGraphicsItem::ItemIsMovable))
|
||||||
{
|
{
|
||||||
QPointF pos = event->scenePos() + (m_origin_pos - event->buttonDownScenePos(Qt::LeftButton));
|
QPointF pos = event->scenePos() + (m_origin_pos - event->buttonDownScenePos(Qt::LeftButton));
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPar
|
|||||||
Color _color;
|
Color _color;
|
||||||
bool _antialiased;
|
bool _antialiased;
|
||||||
QPointF m_origin_pos;
|
QPointF m_origin_pos;
|
||||||
|
bool m_first_move;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef CustomElementGraphicPart CEGP;
|
typedef CustomElementGraphicPart CEGP;
|
||||||
|
|||||||
@@ -389,12 +389,12 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
|||||||
auto grid_layout = new QGridLayout(this);
|
auto grid_layout = new QGridLayout(this);
|
||||||
grid_layout->addWidget(new QLabel(tr("Contour :")), 0,0, Qt::AlignRight);
|
grid_layout->addWidget(new QLabel(tr("Contour :")), 0,0, Qt::AlignRight);
|
||||||
grid_layout->addWidget(outline_color, 0, 1);
|
grid_layout->addWidget(outline_color, 0, 1);
|
||||||
grid_layout->addWidget(new QLabel(tr("Remplissage :")), 0, 2, Qt::AlignRight);
|
grid_layout->addWidget(new QLabel(tr("Remplissage :")), 1, 0, Qt::AlignRight);
|
||||||
grid_layout->addWidget(filling_color, 0, 3);
|
grid_layout->addWidget(filling_color, 1, 1);
|
||||||
grid_layout->addWidget(new QLabel(tr("Style :")), 1, 0, Qt::AlignRight);
|
grid_layout->addWidget(new QLabel(tr("Style :")), 2, 0, Qt::AlignRight);
|
||||||
grid_layout->addWidget(line_style, 1, 1);
|
grid_layout->addWidget(line_style, 2, 1);
|
||||||
grid_layout->addWidget(new QLabel(tr("Épaisseur :")), 1, 2, Qt::AlignRight);
|
grid_layout->addWidget(new QLabel(tr("Épaisseur :")), 3, 0, Qt::AlignRight);
|
||||||
grid_layout->addWidget(size_weight, 1 ,3);
|
grid_layout->addWidget(size_weight, 3 ,1);
|
||||||
main_layout->addItem(grid_layout);
|
main_layout->addItem(grid_layout);
|
||||||
|
|
||||||
main_layout -> addWidget(antialiasing);
|
main_layout -> addWidget(antialiasing);
|
||||||
|
|||||||
@@ -79,10 +79,9 @@ void QetGraphicsTableFactory::create(Diagram *diagram, AddTableDialog *dialog)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add new table if needed and option checked
|
//Add new table if needed and option checked
|
||||||
dialog->addNewTableToNewDiagram();
|
if (dialog->addNewTableToNewDiagram()
|
||||||
table_->model()->rowCount();
|
&& table_->displayNRow() > 0
|
||||||
table_->displayNRow();
|
&& table_->model()->rowCount() > table_->displayNRow())
|
||||||
if (dialog->addNewTableToNewDiagram() && table_->model()->rowCount() > table_->displayNRow())
|
|
||||||
{
|
{
|
||||||
auto already_displayed_rows = table_->displayNRow();
|
auto already_displayed_rows = table_->displayNRow();
|
||||||
auto project_ = diagram->project();
|
auto project_ = diagram->project();
|
||||||
|
|||||||
@@ -29,20 +29,21 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "qet.h"
|
#include "qet.h"
|
||||||
|
|
||||||
|
MachineInfo *MachineInfo::m_instance = nullptr;
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::Machine_info
|
@brief MachineInfo::MachineInfo
|
||||||
@param parent
|
@param parent
|
||||||
*/
|
*/
|
||||||
Machine_info::Machine_info(QObject *parent) : QObject(parent)
|
MachineInfo::MachineInfo()
|
||||||
{
|
{
|
||||||
init_get_Screen_info();
|
init_get_Screen_info();
|
||||||
init_get_cpu_info();
|
init_get_cpu_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::send_info_to_debug
|
@brief MachineInfo::send_info_to_debug
|
||||||
*/
|
*/
|
||||||
void Machine_info::send_info_to_debug()
|
void MachineInfo::send_info_to_debug()
|
||||||
{
|
{
|
||||||
qInfo()<<"debugging enabled:"
|
qInfo()<<"debugging enabled:"
|
||||||
<< QLibraryInfo::isDebugBuild();
|
<< QLibraryInfo::isDebugBuild();
|
||||||
@@ -120,7 +121,7 @@ void Machine_info::send_info_to_debug()
|
|||||||
#endif
|
#endif
|
||||||
qInfo() << "GitRevision " + QString(GIT_COMMIT_SHA);
|
qInfo() << "GitRevision " + QString(GIT_COMMIT_SHA);
|
||||||
qInfo()<< "QElectroTech V " + QET::displayedVersion;
|
qInfo()<< "QElectroTech V " + QET::displayedVersion;
|
||||||
qInfo()<< tr("Compilation : ") + pc.built.version;
|
qInfo()<< QObject::tr("Compilation : ") + pc.built.version;
|
||||||
qInfo()<< "Built with Qt " + pc.built.QT
|
qInfo()<< "Built with Qt " + pc.built.QT
|
||||||
+ " - Date : " + pc.built.date
|
+ " - Date : " + pc.built.date
|
||||||
+ " : " + pc.built.time;
|
+ " : " + pc.built.time;
|
||||||
@@ -151,10 +152,10 @@ void Machine_info::send_info_to_debug()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_Screen_info
|
@brief MachineInfo::init_get_Screen_info
|
||||||
Finds the largest screen and saves the values
|
Finds the largest screen and saves the values
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_Screen_info()
|
void MachineInfo::init_get_Screen_info()
|
||||||
{
|
{
|
||||||
const auto screens = qApp->screens();
|
const auto screens = qApp->screens();
|
||||||
pc.screen.count=screens.count();
|
pc.screen.count=screens.count();
|
||||||
@@ -174,9 +175,9 @@ void Machine_info::init_get_Screen_info()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_cpu_info
|
@brief MachineInfo::init_get_cpu_info
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_cpu_info()
|
void MachineInfo::init_get_cpu_info()
|
||||||
{
|
{
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#ifdef __APPLE_CC__
|
#ifdef __APPLE_CC__
|
||||||
@@ -191,9 +192,9 @@ void Machine_info::init_get_cpu_info()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_cpu_info_linux
|
@brief MachineInfo::init_get_cpu_info_linux
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_cpu_info_linux()
|
void MachineInfo::init_get_cpu_info_linux()
|
||||||
{
|
{
|
||||||
QProcess linuxcpuinfo;
|
QProcess linuxcpuinfo;
|
||||||
linuxcpuinfo.start("bash", QStringList()
|
linuxcpuinfo.start("bash", QStringList()
|
||||||
@@ -237,9 +238,9 @@ void Machine_info::init_get_cpu_info_linux()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_cpu_info_winnt
|
@brief MachineInfo::init_get_cpu_info_winnt
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_cpu_info_winnt()
|
void MachineInfo::init_get_cpu_info_winnt()
|
||||||
{
|
{
|
||||||
QProcess wincpuinfo;
|
QProcess wincpuinfo;
|
||||||
wincpuinfo.start("wmic",
|
wincpuinfo.start("wmic",
|
||||||
@@ -291,9 +292,9 @@ void Machine_info::init_get_cpu_info_winnt()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_cpu_info_macos
|
@brief MachineInfo::init_get_cpu_info_macos
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_cpu_info_macos()
|
void MachineInfo::init_get_cpu_info_macos()
|
||||||
{
|
{
|
||||||
QProcess macoscpuinfo;
|
QProcess macoscpuinfo;
|
||||||
macoscpuinfo.start("bash",
|
macoscpuinfo.start("bash",
|
||||||
@@ -317,30 +318,28 @@ void Machine_info::init_get_cpu_info_macos()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::i_max_screen_width
|
@brief MachineInfo::i_max_screen_width
|
||||||
@return max screen width
|
@return max screen width
|
||||||
*/
|
*/
|
||||||
int32_t Machine_info::i_max_screen_width()
|
int32_t MachineInfo::i_max_screen_width() {
|
||||||
{
|
|
||||||
return pc.screen.Max_width;
|
return pc.screen.Max_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::i_max_screen_height
|
@brief MachineInfo::i_max_screen_height
|
||||||
@return max screen height
|
@return max screen height
|
||||||
*/
|
*/
|
||||||
int32_t Machine_info::i_max_screen_height()
|
int32_t MachineInfo::i_max_screen_height() {
|
||||||
{
|
|
||||||
return pc.screen.Max_height;
|
return pc.screen.Max_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::compilation_info
|
@brief MachineInfo::compilation_info
|
||||||
@return compilation_info
|
@return compilation_info
|
||||||
*/
|
*/
|
||||||
QString Machine_info::compilation_info()
|
QString MachineInfo::compilation_info()
|
||||||
{
|
{
|
||||||
QString compilation_info = "<br />" + tr("Compilation : ");
|
QString compilation_info = "<br />" + QObject::tr("Compilation : ");
|
||||||
compilation_info +=pc.built.version;
|
compilation_info +=pc.built.version;
|
||||||
compilation_info += "<br>Built with Qt " + pc.built.QT;
|
compilation_info += "<br>Built with Qt " + pc.built.QT;
|
||||||
compilation_info += " - Date : " + pc.built.date;
|
compilation_info += " - Date : " + pc.built.date;
|
||||||
|
|||||||
@@ -18,31 +18,57 @@
|
|||||||
#ifndef MACHINE_INFO_H
|
#ifndef MACHINE_INFO_H
|
||||||
#define MACHINE_INFO_H
|
#define MACHINE_INFO_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QMutex>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief The Machine_info class
|
@brief The MachineInfo class
|
||||||
This class hold information from your PC.
|
This class hold information from your PC.
|
||||||
*/
|
*/
|
||||||
class Machine_info : public QObject
|
class MachineInfo
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
static MachineInfo *m_instance;
|
||||||
public:
|
public:
|
||||||
explicit Machine_info(QObject *parent = nullptr);
|
static MachineInfo *instance()
|
||||||
int32_t i_max_screen_width();
|
{
|
||||||
int32_t i_max_screen_height();
|
static QMutex mutex;
|
||||||
QString compilation_info();
|
if (!m_instance)
|
||||||
void send_info_to_debug();
|
{
|
||||||
|
mutex.lock();
|
||||||
|
if (!m_instance) {
|
||||||
|
m_instance = new MachineInfo();
|
||||||
|
}
|
||||||
|
mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
return m_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dropInstance()
|
||||||
|
{
|
||||||
|
static QMutex mutex;
|
||||||
|
if (m_instance) {
|
||||||
|
mutex.lock();
|
||||||
|
delete m_instance;
|
||||||
|
m_instance = nullptr;
|
||||||
|
mutex.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t i_max_screen_width();
|
||||||
|
int32_t i_max_screen_height();
|
||||||
|
QString compilation_info();
|
||||||
|
void send_info_to_debug();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
MachineInfo();
|
||||||
|
void init_get_Screen_info();
|
||||||
|
void init_get_cpu_info();
|
||||||
|
void init_get_cpu_info_linux();
|
||||||
|
void init_get_cpu_info_winnt();
|
||||||
|
void init_get_cpu_info_macos();
|
||||||
|
|
||||||
private:
|
|
||||||
void init_get_Screen_info();
|
|
||||||
void init_get_cpu_info();
|
|
||||||
void init_get_cpu_info_linux();
|
|
||||||
void init_get_cpu_info_winnt();
|
|
||||||
void init_get_cpu_info_macos();
|
|
||||||
struct Pc
|
struct Pc
|
||||||
{
|
{
|
||||||
struct Screen
|
struct Screen
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "utils/macosxopenevent.h"
|
#include "utils/macosxopenevent.h"
|
||||||
|
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
|
#include <QtConcurrent>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief myMessageOutput
|
@brief myMessageOutput
|
||||||
@@ -200,16 +201,15 @@ int main(int argc, char **argv)
|
|||||||
QObject::connect(&app, &SingleApplication::receivedMessage,
|
QObject::connect(&app, &SingleApplication::receivedMessage,
|
||||||
&qetapp, &QETApp::receiveMessage);
|
&qetapp, &QETApp::receiveMessage);
|
||||||
|
|
||||||
// for debugging
|
QtConcurrent::run([=]()
|
||||||
qInstallMessageHandler(myMessageOutput);
|
{
|
||||||
qInfo("Start-up");
|
// for debugging
|
||||||
// delete old log files of max 7 days old.
|
qInstallMessageHandler(myMessageOutput);
|
||||||
delete_old_log_files(7);
|
qInfo("Start-up");
|
||||||
{
|
// delete old log files of max 7 days old.
|
||||||
Machine_info *my_ma =new Machine_info();
|
delete_old_log_files(7);
|
||||||
my_ma->send_info_to_debug();
|
MachineInfo::instance()->send_info_to_debug();
|
||||||
delete my_ma;
|
});
|
||||||
}
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -187,13 +187,14 @@ QHash<QString, XRefProperties> XRefProperties::defaultProperties()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool XRefProperties::operator ==(const XRefProperties &xrp) const{
|
bool XRefProperties::operator ==(const XRefProperties &xrp) const{
|
||||||
return (m_show_power_ctc == xrp.m_show_power_ctc &&
|
return (m_show_power_ctc == xrp.m_show_power_ctc
|
||||||
m_display == xrp.m_display &&
|
&& m_display == xrp.m_display
|
||||||
m_snap_to == xrp.m_snap_to &&
|
&& m_snap_to == xrp.m_snap_to
|
||||||
m_prefix == xrp.m_prefix &&
|
&& m_prefix == xrp.m_prefix
|
||||||
m_master_label == xrp.m_master_label &&
|
&& m_master_label== xrp.m_master_label
|
||||||
m_offset == xrp.m_offset &&
|
&& m_offset == xrp.m_offset
|
||||||
m_xref_pos == xrp.m_xref_pos );
|
&& m_xref_pos == xrp.m_xref_pos
|
||||||
|
&& m_slave_label == xrp.m_slave_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XRefProperties::operator !=(const XRefProperties &xrp) const
|
bool XRefProperties::operator !=(const XRefProperties &xrp) const
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ class QActionGroup;
|
|||||||
*/
|
*/
|
||||||
namespace QET {
|
namespace QET {
|
||||||
/// QElectroTech version (as string, used to mark projects and elements XML documents)
|
/// QElectroTech version (as string, used to mark projects and elements XML documents)
|
||||||
const QString version = "0.80";
|
const QString version = "0.81";
|
||||||
/// QElectroTech displayed version
|
/// QElectroTech displayed version
|
||||||
const QString displayedVersion = "0.80";
|
const QString displayedVersion = "0.81";
|
||||||
QString license();
|
QString license();
|
||||||
|
|
||||||
//Describe the current state of a graphic item
|
//Describe the current state of a graphic item
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "titleblocktemplate.h"
|
#include "titleblocktemplate.h"
|
||||||
#include "ui/aboutqetdialog.h"
|
#include "ui/aboutqetdialog.h"
|
||||||
#include "ui/configpage/generalconfigurationpage.h"
|
#include "ui/configpage/generalconfigurationpage.h"
|
||||||
|
#include "machine_info.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -70,6 +71,9 @@ QString QETApp::m_user_custom_elements_dir = QString();
|
|||||||
QString QETApp::m_user_custom_tbt_dir = QString();
|
QString QETApp::m_user_custom_tbt_dir = QString();
|
||||||
QETApp *QETApp::m_qetapp = nullptr;
|
QETApp *QETApp::m_qetapp = nullptr;
|
||||||
|
|
||||||
|
bool lang_is_set = false;
|
||||||
|
QString system_language = QString();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QETApp::QETApp
|
@brief QETApp::QETApp
|
||||||
@@ -146,6 +150,7 @@ QETApp::~QETApp()
|
|||||||
|
|
||||||
ElementFactory::dropInstance();
|
ElementFactory::dropInstance();
|
||||||
ElementPictureFactory::dropInstance();
|
ElementPictureFactory::dropInstance();
|
||||||
|
MachineInfo::dropInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -225,11 +230,16 @@ void QETApp::setLanguage(const QString &desired_language) {
|
|||||||
*/
|
*/
|
||||||
QString QETApp::langFromSetting()
|
QString QETApp::langFromSetting()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
if (!lang_is_set)
|
||||||
QString system_language = settings.value("lang", "system").toString();
|
{
|
||||||
if(system_language == "system") {
|
QSettings settings;
|
||||||
system_language = QLocale::system().name().left(2);
|
system_language = settings.value("lang", "system").toString();
|
||||||
|
if(system_language == "system") {
|
||||||
|
system_language = QLocale::system().name().left(2);
|
||||||
|
}
|
||||||
|
lang_is_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return system_language;
|
return system_language;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class QetGraphicsHeaderItem : public QGraphicsObject
|
|||||||
|
|
||||||
QRect m_current_rect;
|
QRect m_current_rect;
|
||||||
QRectF m_bounding_rect;
|
QRectF m_bounding_rect;
|
||||||
QAbstractItemModel *m_model = nullptr;
|
QPointer<QAbstractItemModel> m_model;
|
||||||
|
|
||||||
QVector<int>
|
QVector<int>
|
||||||
m_sections_minimum_width,
|
m_sections_minimum_width,
|
||||||
|
|||||||
@@ -156,7 +156,17 @@ QetGraphicsTableItem::QetGraphicsTableItem(QGraphicsItem *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
QetGraphicsTableItem::~QetGraphicsTableItem()
|
QetGraphicsTableItem::~QetGraphicsTableItem()
|
||||||
{}
|
{
|
||||||
|
if (m_previous_table) {
|
||||||
|
if (m_next_table) {
|
||||||
|
m_previous_table->setNextTable(m_next_table);
|
||||||
|
} else {
|
||||||
|
m_previous_table->setNextTable(nullptr);
|
||||||
|
}
|
||||||
|
} else if (m_next_table) {
|
||||||
|
m_next_table->setPreviousTable(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QetGraphicsTableItem::setModel
|
@brief QetGraphicsTableItem::setModel
|
||||||
@@ -175,7 +185,7 @@ void QetGraphicsTableItem::setModel(QAbstractItemModel *model)
|
|||||||
this, &QetGraphicsTableItem::modelReseted);
|
this, &QetGraphicsTableItem::modelReseted);
|
||||||
}
|
}
|
||||||
m_model = model;
|
m_model = model;
|
||||||
m_header_item->setModel(model);
|
m_header_item->setModel(m_model);
|
||||||
|
|
||||||
setUpColumnAndRowMinimumSize();
|
setUpColumnAndRowMinimumSize();
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -200,7 +210,7 @@ void QetGraphicsTableItem::setModel(QAbstractItemModel *model)
|
|||||||
*/
|
*/
|
||||||
QAbstractItemModel *QetGraphicsTableItem::model() const
|
QAbstractItemModel *QetGraphicsTableItem::model() const
|
||||||
{
|
{
|
||||||
return m_model;
|
return m_model.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -270,8 +280,8 @@ void QetGraphicsTableItem::paint(
|
|||||||
if (m_previous_table) //Remove the number of row already displayed by previous tables
|
if (m_previous_table) //Remove the number of row already displayed by previous tables
|
||||||
row_count -= m_previous_table->displayNRowOffset();
|
row_count -= m_previous_table->displayNRowOffset();
|
||||||
|
|
||||||
if (m_number_of_displayed_row > 0) //User override the number of row to display
|
if (m_number_of_row_to_display > 0) //User override the number of row to display
|
||||||
row_count = std::min(row_count, m_number_of_displayed_row);
|
row_count = std::min(row_count, m_number_of_row_to_display);
|
||||||
|
|
||||||
//Draw horizontal lines
|
//Draw horizontal lines
|
||||||
auto cell_height = static_cast<double>(m_current_size.height())/static_cast<double>(row_count);
|
auto cell_height = static_cast<double>(m_current_size.height())/static_cast<double>(row_count);
|
||||||
@@ -364,8 +374,8 @@ QSize QetGraphicsTableItem::minimumSize() const
|
|||||||
row_count -= m_previous_table->displayNRowOffset();
|
row_count -= m_previous_table->displayNRowOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_number_of_displayed_row > 0)
|
if (m_number_of_row_to_display > 0)
|
||||||
row_count = std::min(row_count, m_number_of_displayed_row);
|
row_count = std::min(row_count, m_number_of_row_to_display);
|
||||||
|
|
||||||
|
|
||||||
//m_minimum_column_width already take in count the minimum size of header
|
//m_minimum_column_width already take in count the minimum size of header
|
||||||
@@ -389,7 +399,7 @@ QSize QetGraphicsTableItem::minimumSize() const
|
|||||||
*/
|
*/
|
||||||
void QetGraphicsTableItem::setDisplayNRow(const int &number)
|
void QetGraphicsTableItem::setDisplayNRow(const int &number)
|
||||||
{
|
{
|
||||||
m_number_of_displayed_row = number;
|
m_number_of_row_to_display = number;
|
||||||
setToMinimumHeight();
|
setToMinimumHeight();
|
||||||
if (m_next_table)
|
if (m_next_table)
|
||||||
m_next_table->previousTableDisplayRowChanged();
|
m_next_table->previousTableDisplayRowChanged();
|
||||||
@@ -402,7 +412,7 @@ void QetGraphicsTableItem::setDisplayNRow(const int &number)
|
|||||||
*/
|
*/
|
||||||
int QetGraphicsTableItem::displayNRow() const
|
int QetGraphicsTableItem::displayNRow() const
|
||||||
{
|
{
|
||||||
return m_number_of_displayed_row;
|
return m_number_of_row_to_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -489,19 +499,41 @@ QString QetGraphicsTableItem::tableName() const
|
|||||||
*/
|
*/
|
||||||
int QetGraphicsTableItem::displayNRowOffset() const
|
int QetGraphicsTableItem::displayNRowOffset() const
|
||||||
{
|
{
|
||||||
auto offset_ = m_number_of_displayed_row;
|
auto offset_ = m_number_of_row_to_display;
|
||||||
if(m_previous_table)
|
if(m_previous_table)
|
||||||
offset_ += m_previous_table->displayNRowOffset();
|
offset_ += m_previous_table->displayNRowOffset();
|
||||||
|
|
||||||
return offset_;
|
return offset_;
|
||||||
}
|
}
|
||||||
|
|
||||||
QetGraphicsTableItem *QetGraphicsTableItem::previousTable() const
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::displayedRowCount
|
||||||
|
* @return the number of row displayed by this table
|
||||||
|
*/
|
||||||
|
int QetGraphicsTableItem::displayedRowCount() const
|
||||||
|
{
|
||||||
|
if (!m_model) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Calcule the number of rows to display.
|
||||||
|
auto row_count = m_model->rowCount();
|
||||||
|
|
||||||
|
if (m_previous_table) //Remove the number of row already displayed by previous tables
|
||||||
|
row_count -= m_previous_table->displayNRowOffset();
|
||||||
|
|
||||||
|
if (m_number_of_row_to_display > 0) //User override the number of row to display
|
||||||
|
row_count = std::min(row_count, m_number_of_row_to_display);
|
||||||
|
|
||||||
|
return row_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointer<QetGraphicsTableItem> QetGraphicsTableItem::previousTable() const
|
||||||
{
|
{
|
||||||
return m_previous_table;
|
return m_previous_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
QetGraphicsTableItem *QetGraphicsTableItem::nextTable() const
|
QPointer<QetGraphicsTableItem> QetGraphicsTableItem::nextTable() const
|
||||||
{
|
{
|
||||||
return m_next_table;
|
return m_next_table;
|
||||||
}
|
}
|
||||||
@@ -555,7 +587,7 @@ QDomElement QetGraphicsTableItem::toXml(QDomDocument &dom_document) const
|
|||||||
dom_table.setAttribute("height", QString::number(m_current_size.height()));
|
dom_table.setAttribute("height", QString::number(m_current_size.height()));
|
||||||
dom_table.setAttribute("uuid", m_uuid.toString());
|
dom_table.setAttribute("uuid", m_uuid.toString());
|
||||||
dom_table.setAttribute("name", m_name);
|
dom_table.setAttribute("name", m_name);
|
||||||
dom_table.setAttribute("display_n_row", QString::number(m_number_of_displayed_row));
|
dom_table.setAttribute("display_n_row", QString::number(m_number_of_row_to_display));
|
||||||
|
|
||||||
//Add the header xml
|
//Add the header xml
|
||||||
dom_table.appendChild(m_header_item->toXml(dom_document));
|
dom_table.appendChild(m_header_item->toXml(dom_document));
|
||||||
@@ -571,7 +603,7 @@ QDomElement QetGraphicsTableItem::toXml(QDomDocument &dom_document) const
|
|||||||
{
|
{
|
||||||
//Add model
|
//Add model
|
||||||
auto dom_model = dom_document.createElement("model");
|
auto dom_model = dom_document.createElement("model");
|
||||||
auto project_db_model = static_cast<ProjectDBModel *>(m_model);
|
auto project_db_model = static_cast<ProjectDBModel *>(m_model.data());
|
||||||
dom_model.appendChild(project_db_model->toXml(dom_document));
|
dom_model.appendChild(project_db_model->toXml(dom_document));
|
||||||
dom_table.appendChild(dom_model);
|
dom_table.appendChild(dom_model);
|
||||||
|
|
||||||
@@ -613,7 +645,7 @@ void QetGraphicsTableItem::fromXml(const QDomElement &dom_element)
|
|||||||
"uuid",
|
"uuid",
|
||||||
QUuid::createUuid().toString()));
|
QUuid::createUuid().toString()));
|
||||||
m_name = dom_element.attribute("name");
|
m_name = dom_element.attribute("name");
|
||||||
m_number_of_displayed_row = dom_element.attribute(
|
m_number_of_row_to_display = dom_element.attribute(
|
||||||
"display_n_row",
|
"display_n_row",
|
||||||
QString::number(0)).toInt();
|
QString::number(0)).toInt();
|
||||||
|
|
||||||
@@ -678,8 +710,8 @@ bool QetGraphicsTableItem::toDXF(const QString &filepath)
|
|||||||
if (m_previous_table) //Remove the number of row already displayed by previous tables
|
if (m_previous_table) //Remove the number of row already displayed by previous tables
|
||||||
row_count -= m_previous_table->displayNRowOffset();
|
row_count -= m_previous_table->displayNRowOffset();
|
||||||
|
|
||||||
if (m_number_of_displayed_row > 0) //User override the number of row to display
|
if (m_number_of_row_to_display > 0) //User override the number of row to display
|
||||||
row_count = std::min(row_count, m_number_of_displayed_row);
|
row_count = std::min(row_count, m_number_of_row_to_display);
|
||||||
|
|
||||||
//Draw horizontal lines
|
//Draw horizontal lines
|
||||||
auto cell_height = static_cast<double>(m_current_size.height())/static_cast<double>(row_count);
|
auto cell_height = static_cast<double>(m_current_size.height())/static_cast<double>(row_count);
|
||||||
@@ -806,13 +838,18 @@ QVariant QetGraphicsTableItem::itemChange(
|
|||||||
return QetGraphicsItem::itemChange(change, value);
|
return QetGraphicsItem::itemChange(change, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::modelReseted
|
||||||
|
*/
|
||||||
void QetGraphicsTableItem::modelReseted()
|
void QetGraphicsTableItem::modelReseted()
|
||||||
{
|
{
|
||||||
dataChanged(m_model->index(0,0), m_model->index(0,0), QVector<int>());
|
dataChanged(m_model->index(0,0), m_model->index(0,0), QVector<int>());
|
||||||
setToMinimumHeight();
|
setToMinimumHeight();
|
||||||
|
|
||||||
if (!previousTable()) { //this is the head table
|
if (!previousTable()) //this is the head table
|
||||||
|
{
|
||||||
checkInsufficientRowsCount(this);
|
checkInsufficientRowsCount(this);
|
||||||
|
removeUselessNextTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1046,3 +1083,24 @@ void QetGraphicsTableItem::previousTableDisplayRowChanged()
|
|||||||
m_next_table->previousTableDisplayRowChanged();
|
m_next_table->previousTableDisplayRowChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QetGraphicsTableItem::removeUselessNextTable
|
||||||
|
* Remove next table if useless, an useless table with 0 row displayed.
|
||||||
|
* If \p recursive is true check and remove for all sub next table.
|
||||||
|
* @param recursive
|
||||||
|
*/
|
||||||
|
void QetGraphicsTableItem::removeUselessNextTable(bool recursive)
|
||||||
|
{
|
||||||
|
if (m_next_table)
|
||||||
|
{
|
||||||
|
if (recursive) {
|
||||||
|
m_next_table->removeUselessNextTable();
|
||||||
|
}
|
||||||
|
if (m_next_table->displayedRowCount() <= 0)
|
||||||
|
{
|
||||||
|
m_next_table.data()->deleteLater();
|
||||||
|
m_next_table.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -79,8 +79,9 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
void setTableName(const QString &name);
|
void setTableName(const QString &name);
|
||||||
QString tableName() const;
|
QString tableName() const;
|
||||||
int displayNRowOffset() const;
|
int displayNRowOffset() const;
|
||||||
QetGraphicsTableItem *previousTable() const;
|
int displayedRowCount() const;
|
||||||
QetGraphicsTableItem *nextTable() const;
|
QPointer<QetGraphicsTableItem> previousTable() const;
|
||||||
|
QPointer<QetGraphicsTableItem> nextTable() const;
|
||||||
void setToMinimumHeight();
|
void setToMinimumHeight();
|
||||||
void initLink();
|
void initLink();
|
||||||
QUuid uuid() const {return m_uuid;}
|
QUuid uuid() const {return m_uuid;}
|
||||||
@@ -120,13 +121,14 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
void headerSectionResized();
|
void headerSectionResized();
|
||||||
void adjustSize();
|
void adjustSize();
|
||||||
void previousTableDisplayRowChanged();
|
void previousTableDisplayRowChanged();
|
||||||
|
void removeUselessNextTable(bool recursive = true);
|
||||||
|
|
||||||
QAbstractItemModel *m_model= nullptr;
|
QPointer<QAbstractItemModel> m_model;
|
||||||
|
|
||||||
QVector<int> m_minimum_column_width;
|
QVector<int> m_minimum_column_width;
|
||||||
int
|
int
|
||||||
m_minimum_row_height,
|
m_minimum_row_height,
|
||||||
m_number_of_displayed_row = 0,
|
m_number_of_row_to_display = 0,
|
||||||
m_br_margin = 10;
|
m_br_margin = 10;
|
||||||
|
|
||||||
QSize
|
QSize
|
||||||
@@ -139,9 +141,8 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
QetGraphicsHandlerItem m_handler_item;
|
QetGraphicsHandlerItem m_handler_item;
|
||||||
QetGraphicsHeaderItem *m_header_item = nullptr;
|
QetGraphicsHeaderItem *m_header_item = nullptr;
|
||||||
|
|
||||||
QetGraphicsTableItem
|
QPointer<QetGraphicsTableItem> m_previous_table,
|
||||||
*m_previous_table = nullptr,
|
m_next_table;
|
||||||
*m_next_table = nullptr;
|
|
||||||
|
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QUuid
|
QUuid
|
||||||
|
|||||||
@@ -128,6 +128,15 @@ void CrossRefItem::setUpConnection()
|
|||||||
m_update_connection << connect(m_element,
|
m_update_connection << connect(m_element,
|
||||||
&Element::linkedElementChanged,
|
&Element::linkedElementChanged,
|
||||||
this, &CrossRefItem::linkedChanged);
|
this, &CrossRefItem::linkedChanged);
|
||||||
|
|
||||||
|
auto diagram_ = dynamic_cast<Diagram *>(this->scene());
|
||||||
|
auto formula_ = m_properties.masterLabel();
|
||||||
|
if (diagram_ &&
|
||||||
|
formula_.contains("%F"))
|
||||||
|
{
|
||||||
|
m_update_connection << connect(diagram_ , &Diagram::diagramInformationChanged,
|
||||||
|
this, &CrossRefItem::updateLabel);
|
||||||
|
}
|
||||||
linkedChanged();
|
linkedChanged();
|
||||||
updateLabel();
|
updateLabel();
|
||||||
}
|
}
|
||||||
@@ -161,13 +170,9 @@ QPainterPath CrossRefItem::shape() const{
|
|||||||
QString CrossRefItem::elementPositionText(
|
QString CrossRefItem::elementPositionText(
|
||||||
const Element *elmt, const bool &add_prefix) const
|
const Element *elmt, const bool &add_prefix) const
|
||||||
{
|
{
|
||||||
XRefProperties xrp =
|
|
||||||
m_element->diagram()->project()->defaultXRefProperties(
|
|
||||||
m_element->kindInformations()["type"].toString());
|
|
||||||
QString formula = xrp.masterLabel();
|
|
||||||
autonum::sequentialNumbers seq;
|
autonum::sequentialNumbers seq;
|
||||||
QString txt = autonum::AssignVariables::formulaToLabel(
|
QString txt = autonum::AssignVariables::formulaToLabel(
|
||||||
formula,
|
m_properties.masterLabel(),
|
||||||
seq, elmt->diagram(),
|
seq, elmt->diagram(),
|
||||||
elmt);
|
elmt);
|
||||||
|
|
||||||
|
|||||||
@@ -1326,6 +1326,7 @@ void DynamicElementTextItem::updateXref()
|
|||||||
m_update_slave_Xref_connection << connect(m_master_element.data(), &Element::xChanged, this, &DynamicElementTextItem::updateXref);
|
m_update_slave_Xref_connection << connect(m_master_element.data(), &Element::xChanged, this, &DynamicElementTextItem::updateXref);
|
||||||
m_update_slave_Xref_connection << connect(m_master_element.data(), &Element::yChanged, this, &DynamicElementTextItem::updateXref);
|
m_update_slave_Xref_connection << connect(m_master_element.data(), &Element::yChanged, this, &DynamicElementTextItem::updateXref);
|
||||||
m_update_slave_Xref_connection << connect(m_master_element.data(), &Element::elementInfoChange, this, &DynamicElementTextItem::updateXref);
|
m_update_slave_Xref_connection << connect(m_master_element.data(), &Element::elementInfoChange, this, &DynamicElementTextItem::updateXref);
|
||||||
|
m_update_slave_Xref_connection << connect(diagram(), &Diagram::diagramInformationChanged, this, &DynamicElementTextItem::updateXref);
|
||||||
m_update_slave_Xref_connection << connect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &DynamicElementTextItem::updateXref);
|
m_update_slave_Xref_connection << connect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &DynamicElementTextItem::updateXref);
|
||||||
m_update_slave_Xref_connection << connect(diagram()->project(), &QETProject::diagramRemoved, this, &DynamicElementTextItem::updateXref);
|
m_update_slave_Xref_connection << connect(diagram()->project(), &QETProject::diagramRemoved, this, &DynamicElementTextItem::updateXref);
|
||||||
m_update_slave_Xref_connection << connect(diagram()->project(), &QETProject::XRefPropertiesChanged, this, &DynamicElementTextItem::updateXref);
|
m_update_slave_Xref_connection << connect(diagram()->project(), &QETProject::XRefPropertiesChanged, this, &DynamicElementTextItem::updateXref);
|
||||||
|
|||||||
@@ -736,50 +736,40 @@ bool Element::fromXml(
|
|||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, Terminal *> priv_id_adr;
|
QHash<int, Terminal *> priv_id_adr;
|
||||||
int terminals_non_trouvees = 0;
|
|
||||||
foreach(QGraphicsItem *qgi, childItems()) {
|
for (auto *qgi : childItems())
|
||||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
{
|
||||||
bool terminal_trouvee = false;
|
if (auto terminal_ = qgraphicsitem_cast<Terminal *>(qgi))
|
||||||
foreach(QDomElement qde, liste_terminals) {
|
{
|
||||||
if (p -> fromXml(qde)) {
|
for(auto qde : liste_terminals)
|
||||||
priv_id_adr.insert(
|
{
|
||||||
qde.attribute(
|
if (terminal_ -> fromXml(qde))
|
||||||
"id").toInt(),
|
{
|
||||||
p);
|
priv_id_adr.insert(qde.attribute(QStringLiteral("id")).toInt(),
|
||||||
terminal_trouvee = true;
|
terminal_);
|
||||||
// We used to break here, because we did not expect
|
|
||||||
// several terminals to share the same position.
|
|
||||||
// Of course, it finally happened.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!terminal_trouvee) ++ terminals_non_trouvees;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (terminals_non_trouvees > 0)
|
|
||||||
|
//Check that associated id/adress doesn't conflict with table_id_adr
|
||||||
|
for(auto found_id : priv_id_adr.keys())
|
||||||
{
|
{
|
||||||
m_state = QET::GIOK;
|
if (table_id_adr.contains(found_id))
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// verifie que les associations id / adr n'entrent pas en conflit avec table_id_adr
|
|
||||||
foreach(int id_trouve, priv_id_adr.keys())
|
|
||||||
{
|
{
|
||||||
if (table_id_adr.contains(id_trouve))
|
//This element got an id who is already referenced (= conflict)
|
||||||
{
|
m_state = QET::GIOK;
|
||||||
// cet element possede un id qui est deja reference (= conflit)
|
return(false);
|
||||||
m_state = QET::GIOK;
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// copie des associations id / adr
|
|
||||||
foreach(int id_trouve, priv_id_adr.keys()) {
|
|
||||||
table_id_adr.insert(id_trouve,
|
|
||||||
priv_id_adr.value(id_trouve));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Copie the association id/adress
|
||||||
|
for(auto found_id : priv_id_adr.keys()) {
|
||||||
|
table_id_adr.insert(found_id,
|
||||||
|
priv_id_adr.value(found_id));
|
||||||
|
}
|
||||||
|
|
||||||
//load uuid of connected elements
|
//load uuid of connected elements
|
||||||
QList <QDomElement> uuid_list = QET::findInDomElement(e,
|
QList <QDomElement> uuid_list = QET::findInDomElement(e,
|
||||||
"links_uuids",
|
"links_uuids",
|
||||||
|
|||||||
@@ -120,8 +120,19 @@ QETProject::QETProject(KAutoSaveFile *backup, QObject *parent) :
|
|||||||
*/
|
*/
|
||||||
QETProject::~QETProject()
|
QETProject::~QETProject()
|
||||||
{
|
{
|
||||||
for (auto diagram : m_diagrams_list)
|
//Each time a diagram is deleted we also remove it from m_diagram_list
|
||||||
|
//because a lot of thing append during the destructor of a diagram class
|
||||||
|
//and one of these thing (not directly in the destructor of the diagram
|
||||||
|
//but in another destructor called by the diagram destructor)
|
||||||
|
//is to get the diagram list of the project to make some updates @see QList<Diagram *> QETProject::diagrams() const.
|
||||||
|
//So we need to remove the freshly deleted diagram from the list
|
||||||
|
//in each iteration of the loop to avoid the use of a dangling pointer.
|
||||||
|
const auto diag_list = m_diagrams_list;
|
||||||
|
for (const auto &diagram : diag_list)
|
||||||
|
{
|
||||||
delete diagram;
|
delete diagram;
|
||||||
|
m_diagrams_list.removeOne(diagram);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +170,7 @@ void QETProject::init()
|
|||||||
writeBackup();
|
writeBackup();
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
int autosave_interval = settings.value("diagrameditor/autosave-interval", 0).toInt();
|
int autosave_interval = settings.value(QStringLiteral("diagrameditor/autosave-interval"), 0).toInt();
|
||||||
if(autosave_interval > 0)
|
if(autosave_interval > 0)
|
||||||
{
|
{
|
||||||
int ms = autosave_interval*60*1000;
|
int ms = autosave_interval*60*1000;
|
||||||
@@ -1280,13 +1291,13 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
|
|||||||
m_state = ProjectParsingRunning;
|
m_state = ProjectParsingRunning;
|
||||||
|
|
||||||
//The roots of the xml document must be a "project" element
|
//The roots of the xml document must be a "project" element
|
||||||
if (root_elmt.tagName() == "project")
|
if (root_elmt.tagName() == QLatin1String("project"))
|
||||||
{
|
{
|
||||||
//Normal opening mode
|
//Normal opening mode
|
||||||
if (root_elmt.hasAttribute("version"))
|
if (root_elmt.hasAttribute(QStringLiteral("version")))
|
||||||
{
|
{
|
||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
m_project_qet_version = root_elmt.attribute("version").toDouble(&conv_ok);
|
m_project_qet_version = root_elmt.attribute(QStringLiteral("version")).toDouble(&conv_ok);
|
||||||
#if TODO_LIST
|
#if TODO_LIST
|
||||||
#pragma message("@TODO use of version convert")
|
#pragma message("@TODO use of version convert")
|
||||||
#endif
|
#endif
|
||||||
@@ -1312,7 +1323,7 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTitle(root_elmt.attribute("title"));
|
setTitle(root_elmt.attribute(QStringLiteral("title")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1362,7 +1373,7 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Search the diagrams in the project
|
//Search the diagrams in the project
|
||||||
QDomNodeList diagram_nodes = xml_project.elementsByTagName("diagram");
|
QDomNodeList diagram_nodes = xml_project.elementsByTagName(QStringLiteral("diagram"));
|
||||||
|
|
||||||
if(dlgWaiting)
|
if(dlgWaiting)
|
||||||
dlgWaiting->setProgressBarRange(0, diagram_nodes.length()*3);
|
dlgWaiting->setProgressBarRange(0, diagram_nodes.length()*3);
|
||||||
@@ -1381,7 +1392,7 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
|
|||||||
|
|
||||||
int diagram_order = -1;
|
int diagram_order = -1;
|
||||||
if (!QET::attributeIsAnInteger(diagram_xml_element,
|
if (!QET::attributeIsAnInteger(diagram_xml_element,
|
||||||
"order",
|
QStringLiteral("order"),
|
||||||
&diagram_order))
|
&diagram_order))
|
||||||
diagram_order = 500000;
|
diagram_order = 500000;
|
||||||
|
|
||||||
@@ -1424,7 +1435,7 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
|
|||||||
void QETProject::readElementsCollectionXml(QDomDocument &xml_project)
|
void QETProject::readElementsCollectionXml(QDomDocument &xml_project)
|
||||||
{
|
{
|
||||||
//Get the embedded elements collection of the project
|
//Get the embedded elements collection of the project
|
||||||
QDomNodeList collection_roots = xml_project.elementsByTagName("collection");
|
QDomNodeList collection_roots = xml_project.elementsByTagName(QStringLiteral("collection"));
|
||||||
QDomElement collection_root;
|
QDomElement collection_root;
|
||||||
|
|
||||||
if (!collection_roots.isEmpty())
|
if (!collection_roots.isEmpty())
|
||||||
@@ -1449,8 +1460,8 @@ void QETProject::readElementsCollectionXml(QDomDocument &xml_project)
|
|||||||
*/
|
*/
|
||||||
void QETProject::readProjectPropertiesXml(QDomDocument &xml_project)
|
void QETProject::readProjectPropertiesXml(QDomDocument &xml_project)
|
||||||
{
|
{
|
||||||
foreach (QDomElement e, QET::findInDomElement(xml_project.documentElement(), "properties"))
|
for (auto dom_elmt : QET::findInDomElement(xml_project.documentElement(), QStringLiteral("properties")))
|
||||||
m_project_properties.fromXml(e);
|
m_project_properties.fromXml(dom_elmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1462,7 +1473,7 @@ void QETProject::readProjectPropertiesXml(QDomDocument &xml_project)
|
|||||||
void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
||||||
{
|
{
|
||||||
// Find xml element where is stored properties for new diagram
|
// Find xml element where is stored properties for new diagram
|
||||||
QDomNodeList newdiagrams_nodes = xml_project.elementsByTagName("newdiagrams");
|
QDomNodeList newdiagrams_nodes = xml_project.elementsByTagName(QStringLiteral("newdiagrams"));
|
||||||
if (newdiagrams_nodes.isEmpty()) return;
|
if (newdiagrams_nodes.isEmpty()) return;
|
||||||
|
|
||||||
QDomElement newdiagrams_elmt = newdiagrams_nodes.at(0).toElement();
|
QDomElement newdiagrams_elmt = newdiagrams_nodes.at(0).toElement();
|
||||||
@@ -1482,21 +1493,21 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
|||||||
QDomElement child_elmt = child.toElement();
|
QDomElement child_elmt = child.toElement();
|
||||||
if (child_elmt.isNull()) continue;
|
if (child_elmt.isNull()) continue;
|
||||||
|
|
||||||
if (child_elmt.tagName() == "border")
|
if (child_elmt.tagName() == QLatin1String("border"))
|
||||||
border_elmt = child_elmt;
|
border_elmt = child_elmt;
|
||||||
else if (child_elmt.tagName() == "inset")
|
else if (child_elmt.tagName() == QLatin1String("inset"))
|
||||||
titleblock_elmt = child_elmt;
|
titleblock_elmt = child_elmt;
|
||||||
else if (child_elmt.tagName() == "conductors")
|
else if (child_elmt.tagName() == QLatin1String("conductors"))
|
||||||
conductors_elmt = child_elmt;
|
conductors_elmt = child_elmt;
|
||||||
else if (child_elmt.tagName() == "report")
|
else if (child_elmt.tagName() == QLatin1String("report"))
|
||||||
report_elmt = child_elmt;
|
report_elmt = child_elmt;
|
||||||
else if (child_elmt.tagName() == "xrefs")
|
else if (child_elmt.tagName() == QLatin1String("xrefs"))
|
||||||
xref_elmt = child_elmt;
|
xref_elmt = child_elmt;
|
||||||
else if (child_elmt.tagName() == "conductors_autonums")
|
else if (child_elmt.tagName() == QLatin1String("conductors_autonums"))
|
||||||
conds_autonums = child_elmt;
|
conds_autonums = child_elmt;
|
||||||
else if (child_elmt.tagName()== "folio_autonums")
|
else if (child_elmt.tagName()== QLatin1String("folio_autonums"))
|
||||||
folio_autonums = child_elmt;
|
folio_autonums = child_elmt;
|
||||||
else if (child_elmt.tagName()== "element_autonums")
|
else if (child_elmt.tagName()== QLatin1String("element_autonums"))
|
||||||
element_autonums = child_elmt;
|
element_autonums = child_elmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1504,21 +1515,21 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
|||||||
if (!border_elmt.isNull()) default_border_properties_.fromXml(border_elmt);
|
if (!border_elmt.isNull()) default_border_properties_.fromXml(border_elmt);
|
||||||
if (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_elmt);
|
if (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_elmt);
|
||||||
if (!conductors_elmt.isNull()) default_conductor_properties_.fromXml(conductors_elmt);
|
if (!conductors_elmt.isNull()) default_conductor_properties_.fromXml(conductors_elmt);
|
||||||
if (!report_elmt.isNull()) setDefaultReportProperties(report_elmt.attribute("label"));
|
if (!report_elmt.isNull()) setDefaultReportProperties(report_elmt.attribute(QStringLiteral("label")));
|
||||||
if (!xref_elmt.isNull())
|
if (!xref_elmt.isNull())
|
||||||
{
|
{
|
||||||
foreach(QDomElement elmt, QET::findInDomElement(xref_elmt, "xref"))
|
for (auto elmt : QET::findInDomElement(xref_elmt, QStringLiteral("xref")))
|
||||||
{
|
{
|
||||||
XRefProperties xrp;
|
XRefProperties xrp;
|
||||||
xrp.fromXml(elmt);
|
xrp.fromXml(elmt);
|
||||||
m_default_xref_properties.insert(elmt.attribute("type"), xrp);
|
m_default_xref_properties.insert(elmt.attribute(QStringLiteral("type")), xrp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!conds_autonums.isNull())
|
if (!conds_autonums.isNull())
|
||||||
{
|
{
|
||||||
m_current_conductor_autonum = conds_autonums.attribute("current_autonum");
|
m_current_conductor_autonum = conds_autonums.attribute(QStringLiteral("current_autonum"));
|
||||||
m_freeze_new_conductors = conds_autonums.attribute("freeze_new_conductors") == "true";
|
m_freeze_new_conductors = conds_autonums.attribute(QStringLiteral("freeze_new_conductors")) == QLatin1String("true");
|
||||||
foreach (QDomElement elmt, QET::findInDomElement(conds_autonums, "conductor_autonum"))
|
for (auto elmt : QET::findInDomElement(conds_autonums, QStringLiteral("conductor_autonum")))
|
||||||
{
|
{
|
||||||
NumerotationContext nc;
|
NumerotationContext nc;
|
||||||
nc.fromXml(elmt);
|
nc.fromXml(elmt);
|
||||||
@@ -1527,22 +1538,22 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
|||||||
}
|
}
|
||||||
if (!folio_autonums.isNull())
|
if (!folio_autonums.isNull())
|
||||||
{
|
{
|
||||||
foreach (QDomElement elmt, QET::findInDomElement(folio_autonums, "folio_autonum"))
|
for (auto elmt : QET::findInDomElement(folio_autonums, QStringLiteral("folio_autonum")))
|
||||||
{
|
{
|
||||||
NumerotationContext nc;
|
NumerotationContext nc;
|
||||||
nc.fromXml(elmt);
|
nc.fromXml(elmt);
|
||||||
m_folio_autonum.insert(elmt.attribute("title"), nc);
|
m_folio_autonum.insert(elmt.attribute(QStringLiteral("title")), nc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!element_autonums.isNull())
|
if (!element_autonums.isNull())
|
||||||
{
|
{
|
||||||
m_current_element_autonum = element_autonums.attribute("current_autonum");
|
m_current_element_autonum = element_autonums.attribute(QStringLiteral("current_autonum"));
|
||||||
m_freeze_new_elements = element_autonums.attribute("freeze_new_elements") == "true";
|
m_freeze_new_elements = element_autonums.attribute(QStringLiteral("freeze_new_elements")) == QLatin1String("true");
|
||||||
foreach (QDomElement elmt, QET::findInDomElement(element_autonums, "element_autonum"))
|
for (auto elmt : QET::findInDomElement(element_autonums, QStringLiteral("element_autonum")))
|
||||||
{
|
{
|
||||||
NumerotationContext nc;
|
NumerotationContext nc;
|
||||||
nc.fromXml(elmt);
|
nc.fromXml(elmt);
|
||||||
m_element_autonum.insert(elmt.attribute("title"), nc);
|
m_element_autonum.insert(elmt.attribute(QStringLiteral("title")), nc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,8 +152,7 @@ void AboutQETDialog::setVersion()
|
|||||||
QString str = "<span style=\"font-weight:bold;font-size:16pt;\">QElectroTech V "
|
QString str = "<span style=\"font-weight:bold;font-size:16pt;\">QElectroTech V "
|
||||||
+ QET::displayedVersion
|
+ QET::displayedVersion
|
||||||
+ "</span>";
|
+ "</span>";
|
||||||
Machine_info *my_ma =new Machine_info(this);
|
ui->m_version_label->setText(str + MachineInfo::instance()->compilation_info());
|
||||||
ui->m_version_label->setText(str + my_ma->compilation_info());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user