mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-03 11:00:53 +01:00
Merge remote-tracking branch 'origin/QetGraphicsTableItem'
This commit is contained in:
457
sources/dataBase/projectdatabase.cpp
Normal file
457
sources/dataBase/projectdatabase.cpp
Normal file
@@ -0,0 +1,457 @@
|
||||
/*
|
||||
Copyright 2006-2020 QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "projectdatabase.h"
|
||||
#include "qetapp.h"
|
||||
#include "qetproject.h"
|
||||
#include "elementprovider.h"
|
||||
#include "element.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramposition.h"
|
||||
|
||||
#include <QSqlError>
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::projectDataBase
|
||||
* Default constructor
|
||||
* @param project : project from the database work
|
||||
* @param parent : parent QObject
|
||||
*/
|
||||
projectDataBase::projectDataBase(QETProject *project, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_project(project)
|
||||
{
|
||||
createDataBase();
|
||||
}
|
||||
|
||||
projectDataBase::projectDataBase(QETProject *project, const QString &connection_name, const QString &path, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_project(project)
|
||||
{
|
||||
createDataBase(connection_name, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::~projectDataBase
|
||||
* Destructor
|
||||
*/
|
||||
projectDataBase::~projectDataBase() {
|
||||
m_data_base.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::elementsInfoFromQuery
|
||||
* @param query
|
||||
* @return quickly return all information about elements from @query, ensure that all
|
||||
* record returned by the query can be casted to string.
|
||||
* Each item of the Qvector represent an element and each value of the QStringList represent the recorded value.
|
||||
*/
|
||||
QVector<QStringList> projectDataBase::elementsInfoFromQuery(const QString &query)
|
||||
{
|
||||
QVector<QStringList> result_;
|
||||
|
||||
QSqlQuery query_(query, m_data_base);
|
||||
if (!query_.exec()) {
|
||||
qDebug() << "Query error : " << query_.lastError();
|
||||
}
|
||||
|
||||
while (query_.next())
|
||||
{
|
||||
QStringList record_;
|
||||
auto i=0;
|
||||
while (query_.value(i).isValid())
|
||||
{
|
||||
record_ << query_.value(i).toString();
|
||||
++i;
|
||||
}
|
||||
result_ << record_;
|
||||
}
|
||||
|
||||
return result_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::headersFromElementsInfoQuery
|
||||
* @param query
|
||||
* @return the header according to @query.
|
||||
* Header can be false, notably when user create is own query.
|
||||
*/
|
||||
QStringList projectDataBase::headersFromElementsInfoQuery(const QString &query)
|
||||
{
|
||||
QStringList header_string;
|
||||
if (!query.startsWith("SELECT ") && !query.contains("FROM")) {
|
||||
return header_string;
|
||||
}
|
||||
|
||||
auto header = query;
|
||||
header.remove(0, 7); //Remove SELECT from the string;
|
||||
header.truncate(header.indexOf("FROM")); //Now we only have the string between SELECT and FROM
|
||||
header.replace(" ", ""); //remove white space
|
||||
QStringList list = header.split(","); //split each column
|
||||
|
||||
if (list.isEmpty()) {
|
||||
return header_string;
|
||||
}
|
||||
|
||||
for (int i=0 ; i<list.size() ; i++)
|
||||
{
|
||||
auto str = list.at(i);
|
||||
|
||||
if(str == "e.pos") { //Query in element table wich have only pose use in this case
|
||||
header_string.append(tr("Position"));
|
||||
}
|
||||
else if (str.contains("ei.")) //Query in element_info table
|
||||
{
|
||||
str.remove(0,3);
|
||||
header_string.append(QETApp::elementTranslatedInfoKey(str));
|
||||
}
|
||||
else if (str == "d.pos") { //query in diagram table wich have only pos use in this case
|
||||
header_string.append(tr("Position du folio"));
|
||||
}
|
||||
else if (str.contains("di.")) //query in diagram_info table
|
||||
{
|
||||
str.remove(0,3);
|
||||
header_string.append(QETApp::diagramTranslatedInfoKey(str));
|
||||
}
|
||||
else //Default case
|
||||
{
|
||||
if (str == "pos") {
|
||||
header_string.append(tr("Position"));
|
||||
} else if (QETApp::elementInfoKeys().contains(str)) {
|
||||
header_string.append(QETApp::elementTranslatedInfoKey(str));
|
||||
} else {
|
||||
header_string.append(QETApp::diagramTranslatedInfoKey(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return header_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::updateDB
|
||||
* Up to date the content of the data base.
|
||||
* Except at the creation of this class,
|
||||
* call this method each time you want to query the data base
|
||||
* to be sure that the content reflect the current state of the project.
|
||||
* Emit the singal dataBaseUpdated
|
||||
*/
|
||||
void projectDataBase::updateDB()
|
||||
{
|
||||
populateDiagramTable();
|
||||
populateDiagramInfoTable();
|
||||
populateElementTable();
|
||||
populateElementInfoTable();
|
||||
emit dataBaseUpdated();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::project
|
||||
* @return the project of this database
|
||||
*/
|
||||
QETProject *projectDataBase::project() const {
|
||||
return m_project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::createDataBase
|
||||
* Create the data base
|
||||
* @return : true if the data base was successfully created.
|
||||
*/
|
||||
bool projectDataBase::createDataBase(const QString &connection_name, const QString &name)
|
||||
{
|
||||
|
||||
QString connect_name=connection_name;
|
||||
if (connect_name.isEmpty()) {
|
||||
connect_name = "qet_project_db_" + m_project->uuid().toString();
|
||||
}
|
||||
if (m_data_base.connectionNames().contains(connect_name)) {
|
||||
m_data_base = QSqlDatabase::database(connect_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data_base = QSqlDatabase::addDatabase("QSQLITE", connect_name);
|
||||
m_data_base.setDatabaseName(name);
|
||||
if(!m_data_base.open()) {
|
||||
m_data_base.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_data_base.exec("PRAGMA temp_store = MEMORY");
|
||||
m_data_base.exec("PRAGMA journal_mode = MEMORY");
|
||||
m_data_base.exec("PRAGMA synchronous = OFF");
|
||||
|
||||
QSqlQuery query_(m_data_base);
|
||||
bool first_ = true;
|
||||
|
||||
//Create diagram table
|
||||
QString diagram_table("CREATE TABLE diagram ("
|
||||
"uuid VARCHAR(50) PRIMARY KEY NOT NULL,"
|
||||
"pos INTEGER)");
|
||||
if (!query_.exec(diagram_table)) {
|
||||
qDebug() << "diagram_table query : "<< query_.lastError();
|
||||
}
|
||||
|
||||
//Create the table element
|
||||
QString element_table("CREATE TABLE element"
|
||||
"( "
|
||||
"uuid VARCHAR(50) PRIMARY KEY NOT NULL, "
|
||||
"diagram_uuid VARCHAR(50) NOT NULL,"
|
||||
"pos VARCHAR(6) NOT NULL,"
|
||||
"type VARCHAR(50),"
|
||||
"sub_type VARCHAR(50),"
|
||||
"FOREIGN KEY (diagram_uuid) REFERENCES diagram (uuid)"
|
||||
")");
|
||||
if (!query_.exec(element_table)) {
|
||||
qDebug() <<" element_table query : "<< query_.lastError();
|
||||
}
|
||||
|
||||
//Create the diagram info table
|
||||
QString diagram_info_table("CREATE TABLE diagram_info (diagram_uuid VARCHAR(50) PRIMARY KEY NOT NULL, ");
|
||||
first_ = true;
|
||||
for (auto string : QETApp::diagramInfoKeys())
|
||||
{
|
||||
if (first_) {
|
||||
first_ = false;
|
||||
} else {
|
||||
diagram_info_table += ", ";
|
||||
}
|
||||
diagram_info_table += string += string=="date" ? " DATE" : " VARCHAR(100)";
|
||||
}
|
||||
diagram_info_table += ", FOREIGN KEY (diagram_uuid) REFERENCES diagram (uuid))";
|
||||
if (!query_.exec(diagram_info_table)) {
|
||||
qDebug() << "diagram_info_table query : " << query_.lastError();
|
||||
}
|
||||
|
||||
//Create the element info table
|
||||
QString element_info_table("CREATE TABLE element_info(element_uuid VARCHAR(50) PRIMARY KEY NOT NULL,");
|
||||
first_=true;
|
||||
for (auto string : QETApp::elementInfoKeys())
|
||||
{
|
||||
if (first_) {
|
||||
first_ = false;
|
||||
} else {
|
||||
element_info_table += ",";
|
||||
}
|
||||
|
||||
element_info_table += string += " VARCHAR(100)";
|
||||
}
|
||||
element_info_table += ", FOREIGN KEY (element_uuid) REFERENCES element (uuid));";
|
||||
|
||||
if (!query_.exec(element_info_table)) {
|
||||
qDebug() << " element_info_table query : " << query_.lastError();
|
||||
}
|
||||
}
|
||||
|
||||
updateDB();
|
||||
return true;
|
||||
}
|
||||
|
||||
void projectDataBase::populateDiagramTable()
|
||||
{
|
||||
QSqlQuery query_(m_data_base);
|
||||
query_.exec("DELETE FROM diagram");
|
||||
|
||||
QString insert_("INSERT INTO diagram (uuid, pos) VALUES (:uuid, :pos)");
|
||||
query_.prepare(insert_);
|
||||
for (auto diagram : m_project->diagrams())
|
||||
{
|
||||
query_.bindValue(":uuid", diagram->uuid().toString());
|
||||
query_.bindValue(":pos", m_project->folioIndex(diagram));
|
||||
if(!query_.exec()) {
|
||||
qDebug() << "projectDataBase::populateDiagramTable insert error : " << query_.lastError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::populateElementTable
|
||||
* Populate the element table
|
||||
*/
|
||||
void projectDataBase::populateElementTable()
|
||||
{
|
||||
QSqlQuery query_(m_data_base);
|
||||
query_.exec("DELETE FROM element");
|
||||
|
||||
QString insert_("INSERT INTO element (uuid, diagram_uuid, pos, type, sub_type) VALUES (:uuid, :diagram_uuid, :pos, :type, :sub_type)");
|
||||
query_.prepare(insert_);
|
||||
|
||||
for (auto diagram : m_project->diagrams())
|
||||
{
|
||||
ElementProvider ep(diagram);
|
||||
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master);
|
||||
//Insert all value into the database
|
||||
for (auto elmt : elements_list)
|
||||
{
|
||||
query_.bindValue(":uuid", elmt->uuid().toString());
|
||||
query_.bindValue(":diagram_uuid", diagram->uuid().toString());
|
||||
query_.bindValue(":pos", diagram->convertPosition(elmt->scenePos()).toString());
|
||||
query_.bindValue(":type", elmt->linkTypeToString());
|
||||
query_.bindValue(":sub_type", elmt->kindInformations()["type"].toString());
|
||||
if (!query_.exec()) {
|
||||
qDebug() << "projectDataBase::populateElementTable insert error : " << query_.lastError();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::populateElementsTable
|
||||
* Populate the elements table
|
||||
*/
|
||||
void projectDataBase::populateElementInfoTable()
|
||||
{
|
||||
QSqlQuery query(m_data_base);
|
||||
query.exec("DELETE FROM element_info");
|
||||
|
||||
|
||||
//Prepare the query used for insert new record
|
||||
QStringList bind_values;
|
||||
for (auto key : QETApp::elementInfoKeys()) {
|
||||
bind_values << key.prepend(":");
|
||||
}
|
||||
QString insert("INSERT INTO element_info (element_uuid," +
|
||||
QETApp::elementInfoKeys().join(", ") +
|
||||
") VALUES (:uuid," +
|
||||
bind_values.join(", ") +
|
||||
")");
|
||||
|
||||
query.prepare(insert);
|
||||
|
||||
for (auto *diagram : m_project->diagrams())
|
||||
{
|
||||
ElementProvider ep(diagram);
|
||||
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master);
|
||||
|
||||
//Insert all value into the database
|
||||
for (auto elmt : elements_list)
|
||||
{
|
||||
query.bindValue(":uuid", elmt->uuid().toString());
|
||||
auto hash = elementInfoToString(elmt);
|
||||
for (auto key : hash.keys())
|
||||
{
|
||||
QString value = hash.value(key);
|
||||
QString bind = key.prepend(":");
|
||||
query.bindValue(bind, value);
|
||||
}
|
||||
|
||||
if (!query.exec()) {
|
||||
qDebug() << "projectDataBase::populateElementInfoTable insert error : " << query.lastError();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void projectDataBase::populateDiagramInfoTable()
|
||||
{
|
||||
QSqlQuery query(m_data_base);
|
||||
query.exec("DELETE FROM diagram_info");
|
||||
|
||||
//Prepare the query used for insert new record
|
||||
QStringList bind_values;
|
||||
for (auto key : QETApp::diagramInfoKeys()) {
|
||||
bind_values << key.prepend(":");
|
||||
}
|
||||
QString insert("INSERT INTO diagram_info (diagram_uuid, " +
|
||||
QETApp::diagramInfoKeys().join(", ") +
|
||||
") VALUES (:uuid, " +
|
||||
bind_values.join(", ") +
|
||||
")");
|
||||
|
||||
query.prepare(insert);
|
||||
|
||||
for (auto *diagram : m_project->diagrams())
|
||||
{
|
||||
query.bindValue(":uuid", diagram->uuid());
|
||||
|
||||
auto infos = diagram->border_and_titleblock.titleblockInformation();
|
||||
for (auto key : QETApp::diagramInfoKeys())
|
||||
{
|
||||
if (key == "date") {
|
||||
query.bindValue(":date", QDate::fromString(infos.value("date").toString(), Qt::SystemLocaleShortDate));
|
||||
} else {
|
||||
auto value = infos.value(key);
|
||||
auto bind = key.prepend(":");
|
||||
query.bindValue(bind, value);
|
||||
}
|
||||
}
|
||||
|
||||
if (!query.exec()) {
|
||||
qDebug() << "projectDataBase::populateDiagramInfoTable insert error : " << query.lastError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::elementInfoToString
|
||||
* @param elmt
|
||||
* @return the element information in hash as key for the info name and value as the information value.
|
||||
*/
|
||||
QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
|
||||
{
|
||||
QHash<QString, QString> hash; //Store the value for each columns
|
||||
for (auto key : QETApp::elementInfoKeys())
|
||||
{
|
||||
if (key == "label") {
|
||||
hash.insert(key, elmt->actualLabel());
|
||||
}
|
||||
else {
|
||||
hash.insert(key, elmt->elementInformations()[key].toString());
|
||||
}
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief projectDataBase::exportDb
|
||||
* @param parent
|
||||
* @param caption
|
||||
* @param dir
|
||||
* @param filter
|
||||
* @param selectedFilter
|
||||
* @param options
|
||||
*/
|
||||
void projectDataBase::exportDb(projectDataBase *db, QWidget *parent, const QString &caption, const QString &dir)
|
||||
{
|
||||
auto caption_ = caption;
|
||||
if (caption_.isEmpty()) {
|
||||
caption_ = tr("Exporter la base de données interne du projet");
|
||||
}
|
||||
|
||||
auto dir_ = dir;
|
||||
if(dir_.isEmpty()) {
|
||||
dir_ = db->project()->filePath();
|
||||
if (dir_.isEmpty()) {
|
||||
dir_ = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first();
|
||||
dir_ += QString("/") += tr("sans_nom") += ".sqlite";
|
||||
} else {
|
||||
dir_.remove(".qet");
|
||||
dir_.append(".sqlite");
|
||||
}
|
||||
}
|
||||
|
||||
auto path_ = QFileDialog::getSaveFileName(parent, caption_, dir_, "*.sqlite");
|
||||
if (path_.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Database is filled at creation, work is done.
|
||||
QString connection_name("export_project_db_" + db->project()->uuid().toString());
|
||||
projectDataBase file_db(db->project(), connection_name, path_);
|
||||
QSqlDatabase::removeDatabase(connection_name);
|
||||
}
|
||||
74
sources/dataBase/projectdatabase.h
Normal file
74
sources/dataBase/projectdatabase.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright 2006-2020 QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PROJECTDATABASE_H
|
||||
#define PROJECTDATABASE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
#include <QPointer>
|
||||
#include <QFileDialog>
|
||||
|
||||
class Element;
|
||||
class QETProject;
|
||||
|
||||
/**
|
||||
* @brief The projectDataBase class
|
||||
* This class wrap a sqlite data base where you can find several thing about
|
||||
* the content of a project.
|
||||
*
|
||||
* NOTE this class is still in developement.
|
||||
*/
|
||||
class projectDataBase : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
projectDataBase(QETProject *project, QObject *parent = nullptr);
|
||||
private:
|
||||
projectDataBase(QETProject *project, const QString &connection_name, const QString &path, QObject *parent = nullptr);
|
||||
public:
|
||||
virtual ~projectDataBase() override;
|
||||
|
||||
QVector<QStringList> elementsInfoFromQuery(const QString &query);
|
||||
void updateDB();
|
||||
QETProject *project() const;
|
||||
|
||||
static QStringList headersFromElementsInfoQuery(const QString &query);
|
||||
|
||||
signals:
|
||||
void dataBaseUpdated();
|
||||
|
||||
private:
|
||||
bool createDataBase(const QString &connection_name= QString(), const QString &name = QString());
|
||||
void populateDiagramTable();
|
||||
void populateElementTable();
|
||||
void populateElementInfoTable();
|
||||
void populateDiagramInfoTable();
|
||||
static QHash<QString, QString> elementInfoToString(Element *elmt);
|
||||
|
||||
private:
|
||||
QPointer<QETProject> m_project;
|
||||
QSqlDatabase m_data_base;
|
||||
QSqlQuery m_insert_elements_query;
|
||||
|
||||
public:
|
||||
static void exportDb(projectDataBase *db, QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString());
|
||||
};
|
||||
|
||||
#endif // PROJECTDATABASE_H
|
||||
364
sources/dataBase/ui/elementquerywidget.cpp
Normal file
364
sources/dataBase/ui/elementquerywidget.cpp
Normal file
@@ -0,0 +1,364 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementquerywidget.h"
|
||||
#include "ui_elementquerywidget.h"
|
||||
#include "qetapp.h"
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::ElementQueryWidget
|
||||
* @param parent
|
||||
*/
|
||||
ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ElementQueryWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_export_info.insert("e.pos", tr("Position"));
|
||||
m_export_info.insert("di.title", tr("Titre du folio"));
|
||||
m_export_info.insert("d.pos", tr("Position du folio"));
|
||||
m_export_info.insert("di.folio", tr("Numéro du folio"));
|
||||
|
||||
m_button_group.setExclusive(false);
|
||||
m_button_group.addButton(ui->m_all_cb, 0);
|
||||
m_button_group.addButton(ui->m_terminal_cb, 1);
|
||||
m_button_group.addButton(ui->m_simple_cb, 2);
|
||||
m_button_group.addButton(ui->m_button_cb, 3);
|
||||
m_button_group.addButton(ui->m_coil_cb, 4);
|
||||
m_button_group.addButton(ui->m_protection_cb, 5);
|
||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
|
||||
{
|
||||
auto check_box = static_cast<QCheckBox *>(m_button_group.button(0));
|
||||
if (id == 0)
|
||||
{
|
||||
switch (check_box->checkState()) {
|
||||
case Qt::Checked :
|
||||
for (auto button : m_button_group.buttons()) {
|
||||
button->setChecked(true);
|
||||
}
|
||||
break;
|
||||
case Qt::Unchecked :
|
||||
for (auto button : m_button_group.buttons()) {
|
||||
button->setChecked(false);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int checked = 0;
|
||||
for (int i=1 ; i<5 ; ++i) {
|
||||
if (m_button_group.button(i)->isChecked()) {++checked;}
|
||||
}
|
||||
|
||||
switch (checked)
|
||||
{
|
||||
case 0 :
|
||||
check_box->setCheckState(Qt::Unchecked);
|
||||
break;
|
||||
case 5:
|
||||
check_box->setCheckState(Qt::Checked);
|
||||
break;
|
||||
default:
|
||||
check_box->setCheckState(Qt::PartiallyChecked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
updateQueryLine();
|
||||
});
|
||||
|
||||
setUpItems();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::~ElementQueryWidget
|
||||
*/
|
||||
ElementQueryWidget::~ElementQueryWidget() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::queryStr
|
||||
* @return The current query
|
||||
*/
|
||||
QString ElementQueryWidget::queryStr() const
|
||||
{
|
||||
//User define is own query
|
||||
if (ui->m_edit_sql_query_cb->isChecked()) {
|
||||
return ui->m_sql_query->text();
|
||||
}
|
||||
//Made a string list with the colomns (keys) choosen by the user
|
||||
QStringList keys = selectedKeys();
|
||||
|
||||
QString select ="SELECT ";
|
||||
QString order_by = " ORDER BY ";
|
||||
QString filter_;
|
||||
|
||||
QString column;
|
||||
bool first = true;
|
||||
for (auto key: keys) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
column += ", ";
|
||||
order_by += ", ";
|
||||
}
|
||||
column += key;
|
||||
order_by += key;
|
||||
|
||||
auto f = FilterFor(key);
|
||||
switch (f.first)
|
||||
{
|
||||
case 0: //No filter
|
||||
break;
|
||||
case 1: //Not empty
|
||||
filter_ += QString(" AND ") += key += " IS NOT NULL";
|
||||
break;
|
||||
case 2: //empty
|
||||
filter_ += QString(" AND ") += key += " IS NULL";
|
||||
break;
|
||||
case 3: // contain
|
||||
filter_ += QString(" AND ") += key += QString(" LIKE'%") += f.second += "%'";
|
||||
break;
|
||||
case 4: // not contain
|
||||
filter_ += QString(" AND ") += key += QString(" NOT LIKE'%") += f.second += "%'";
|
||||
break;
|
||||
case 5: // is equal
|
||||
filter_ += QString(" AND ") += key += QString("='") += f.second += "'";
|
||||
break;
|
||||
case 6: // is not equal
|
||||
filter_ += QString(" AND ") += key += QString("!='") += f.second += "'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QString from = " FROM element_info ei, element e, diagram d, diagram_info di";
|
||||
QString where = " WHERE ei.element_uuid = e.uuid"
|
||||
" AND di.diagram_uuid = d.uuid"
|
||||
" AND e.diagram_uuid = d.uuid";
|
||||
|
||||
if (ui->m_all_cb->checkState() == Qt::PartiallyChecked)
|
||||
{
|
||||
if (ui->m_terminal_cb->isChecked()) {where += " AND e.type = 'Terminale'";}
|
||||
if (ui->m_simple_cb->isChecked()) {where += " AND e.type = 'Simple'";}
|
||||
if (ui->m_button_cb->isChecked()) {where += " AND e.sub_type = 'commutator'";}
|
||||
if (ui->m_coil_cb->isChecked()) {where += " AND e.sub_type = 'coil'";}
|
||||
if (ui->m_protection_cb->isChecked()) {where += " AND e.sub_type = 'protection'";}
|
||||
}
|
||||
|
||||
|
||||
QString q(select + column + from + where + filter_ + order_by);
|
||||
return q;
|
||||
}
|
||||
|
||||
QStringList ElementQueryWidget::header() const
|
||||
{
|
||||
//Made a string list with the colomns (keys) choosen by the user
|
||||
QStringList headers;
|
||||
int row = 0;
|
||||
while (auto *item = ui->m_choosen_list->item(row))
|
||||
{
|
||||
headers.append(item->data(Qt::DisplayRole).toString());
|
||||
++row;
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::updateQueryLine
|
||||
*/
|
||||
void ElementQueryWidget::updateQueryLine() {
|
||||
ui->m_sql_query->setText(queryStr());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::selectedKeys
|
||||
* @return the current keys of selected infos to be exported
|
||||
*/
|
||||
QStringList ElementQueryWidget::selectedKeys() const
|
||||
{
|
||||
//Made a string list with the colomns (keys) choosen by the user
|
||||
QStringList keys;
|
||||
int row = 0;
|
||||
while (auto *item = ui->m_choosen_list->item(row))
|
||||
{
|
||||
keys.append(item->data(Qt::UserRole).toString());
|
||||
++row;
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
void ElementQueryWidget::setUpItems()
|
||||
{
|
||||
for(QString key : QETApp::elementInfoKeys())
|
||||
{
|
||||
auto item = new QListWidgetItem(QETApp::elementTranslatedInfoKey(key), ui->m_var_list);
|
||||
item->setData(Qt::UserRole, "ei." + key);
|
||||
m_items_list << item;
|
||||
}
|
||||
|
||||
|
||||
for (auto key : m_export_info.keys())
|
||||
{
|
||||
auto item = new QListWidgetItem(m_export_info.value(key), ui->m_var_list);
|
||||
item->setData(Qt::UserRole, key);
|
||||
m_items_list << item;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::FilterFor
|
||||
* @param key
|
||||
* @return the filter associated to key
|
||||
*/
|
||||
QPair<int, QString> ElementQueryWidget::FilterFor(const QString &key) const {
|
||||
return m_filter.value(key, qMakePair(0, QString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_up_pb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_up_pb_clicked()
|
||||
{
|
||||
auto row = ui->m_choosen_list->currentRow();
|
||||
if(row <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto *item = ui->m_choosen_list->takeItem(row);
|
||||
ui->m_choosen_list->insertItem(row-1, item);
|
||||
ui->m_choosen_list->setCurrentItem(item);
|
||||
|
||||
updateQueryLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_add_pb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_add_pb_clicked()
|
||||
{
|
||||
if (auto *item = ui->m_var_list->takeItem(ui->m_var_list->currentRow())) {
|
||||
ui->m_choosen_list->addItem(item);
|
||||
}
|
||||
|
||||
updateQueryLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_remove_pb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_remove_pb_clicked()
|
||||
{
|
||||
if (auto *item = ui->m_choosen_list->takeItem(ui->m_choosen_list->currentRow())) {
|
||||
ui->m_var_list->addItem(item);
|
||||
}
|
||||
|
||||
updateQueryLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_down_pb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_down_pb_clicked()
|
||||
{
|
||||
auto row = ui->m_choosen_list->currentRow();
|
||||
if (row == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto *item = ui->m_choosen_list->takeItem(row);
|
||||
ui->m_choosen_list->insertItem(row+1, item);
|
||||
ui->m_choosen_list->setCurrentItem(item);
|
||||
|
||||
updateQueryLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementQueryWidget::on_m_edit_sql_query_cb_clicked
|
||||
*/
|
||||
void ElementQueryWidget::on_m_edit_sql_query_cb_clicked()
|
||||
{
|
||||
ui->m_sql_query->setEnabled(ui->m_edit_sql_query_cb->isChecked());
|
||||
ui->m_info_widget->setDisabled(ui->m_edit_sql_query_cb->isChecked());
|
||||
ui->m_parametre_widget->setDisabled(ui->m_edit_sql_query_cb->isChecked());
|
||||
|
||||
if (ui->m_edit_sql_query_cb->isChecked() && !m_custom_query.isEmpty())
|
||||
{
|
||||
ui->m_sql_query->setText(m_custom_query);
|
||||
}
|
||||
else if (!ui->m_edit_sql_query_cb->isChecked())
|
||||
{
|
||||
m_custom_query = ui->m_sql_query->text();
|
||||
updateQueryLine();
|
||||
}
|
||||
}
|
||||
|
||||
void ElementQueryWidget::on_m_plant_textChanged(const QString &arg1) {
|
||||
Q_UNUSED(arg1)
|
||||
updateQueryLine();
|
||||
}
|
||||
|
||||
void ElementQueryWidget::on_m_location_textChanged(const QString &arg1) {
|
||||
Q_UNUSED(arg1)
|
||||
updateQueryLine();
|
||||
}
|
||||
|
||||
void ElementQueryWidget::on_m_filter_le_textEdited(const QString &arg1)
|
||||
{
|
||||
if (auto item = ui->m_choosen_list->currentItem())
|
||||
{
|
||||
auto key = item->data(Qt::UserRole).toString();
|
||||
auto type = ui->m_filter_type_cb->currentIndex();
|
||||
auto value = arg1;
|
||||
|
||||
m_filter.insert(key, qMakePair(type, value));
|
||||
updateQueryLine();
|
||||
}
|
||||
}
|
||||
|
||||
void ElementQueryWidget::on_m_filter_type_cb_activated(int index)
|
||||
{
|
||||
if (auto item = ui->m_choosen_list->currentItem())
|
||||
{
|
||||
auto key = item->data(Qt::UserRole).toString();
|
||||
auto type = index;
|
||||
auto value = ui->m_filter_le->text();
|
||||
|
||||
m_filter.insert(key, qMakePair(type, value));
|
||||
ui->m_filter_le->setDisabled(index <= 2);
|
||||
updateQueryLine();
|
||||
}
|
||||
}
|
||||
|
||||
void ElementQueryWidget::on_m_choosen_list_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(previous)
|
||||
|
||||
if (!current)
|
||||
return;
|
||||
|
||||
auto key = current->data(Qt::UserRole).toString();
|
||||
auto p = FilterFor(key);
|
||||
ui->m_filter_type_cb->setCurrentIndex(p.first);
|
||||
ui->m_filter_le->setText(p.second);
|
||||
ui->m_filter_le->setEnabled(p.first>=3);
|
||||
}
|
||||
73
sources/dataBase/ui/elementquerywidget.h
Normal file
73
sources/dataBase/ui/elementquerywidget.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ELEMENTQUERYWIDGET_H
|
||||
#define ELEMENTQUERYWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QButtonGroup>
|
||||
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace Ui {
|
||||
class ElementQueryWidget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The ElementQueryWidget class
|
||||
* A widget use to edit a sql query for get element information
|
||||
* This widget only work to get information from ProjectDataBase
|
||||
*/
|
||||
class ElementQueryWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElementQueryWidget(QWidget *parent = nullptr);
|
||||
~ElementQueryWidget();
|
||||
|
||||
QString queryStr() const;
|
||||
QStringList header() const;
|
||||
|
||||
private slots:
|
||||
void on_m_up_pb_clicked();
|
||||
void on_m_add_pb_clicked();
|
||||
void on_m_remove_pb_clicked();
|
||||
void on_m_down_pb_clicked();
|
||||
void on_m_edit_sql_query_cb_clicked();
|
||||
void on_m_plant_textChanged(const QString &arg1);
|
||||
void on_m_location_textChanged(const QString &arg1);
|
||||
void on_m_filter_le_textEdited(const QString &arg1);
|
||||
void on_m_filter_type_cb_activated(int index);
|
||||
|
||||
void updateQueryLine();
|
||||
QStringList selectedKeys() const;
|
||||
void setUpItems();
|
||||
QPair<int, QString> FilterFor(const QString &key) const;
|
||||
|
||||
void on_m_choosen_list_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
|
||||
private:
|
||||
Ui::ElementQueryWidget *ui;
|
||||
QHash <QString, QString> m_export_info;
|
||||
QButtonGroup m_button_group;
|
||||
QList <QListWidgetItem *> m_items_list;
|
||||
QString m_custom_query;
|
||||
QHash <QString, QPair<int, QString>> m_filter;
|
||||
};
|
||||
|
||||
#endif // ELEMENTQUERYWIDGET_H
|
||||
418
sources/dataBase/ui/elementquerywidget.ui
Normal file
418
sources/dataBase/ui/elementquerywidget.ui
Normal file
@@ -0,0 +1,418 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ElementQueryWidget</class>
|
||||
<widget class="QWidget" name="ElementQueryWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>341</width>
|
||||
<height>527</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="m_info_widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Informations disponibles</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Informations à exporter</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="m_var_list"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QListWidget" name="m_choosen_list"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_up_pb">
|
||||
<property name="toolTip">
|
||||
<string>Monter la sélection</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/go-up.png</normaloff>:/ico/16x16/go-up.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_add_pb">
|
||||
<property name="toolTip">
|
||||
<string>Ajouter la sélection</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/list-add.png</normaloff>:/ico/16x16/list-add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_remove_pb">
|
||||
<property name="toolTip">
|
||||
<string>Supprimer la sélection</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/list-remove.png</normaloff>:/ico/16x16/list-remove.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_down_pb">
|
||||
<property name="toolTip">
|
||||
<string>Descendre la sélection</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/go-down.png</normaloff>:/ico/16x16/go-down.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_filter_type_cb">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pas de filtre</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>N'est pas vide</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Est vide</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Contient</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ne contient pas</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Est égal à</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>N'est pas égale à</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="m_filter_le"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Filtre :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_parametre_widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Type d'éléments</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="m_simple_cb">
|
||||
<property name="text">
|
||||
<string>Simples</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="m_all_cb">
|
||||
<property name="text">
|
||||
<string>Tous</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="m_coil_cb">
|
||||
<property name="text">
|
||||
<string>Contacteurs et relais</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="m_button_cb">
|
||||
<property name="text">
|
||||
<string>Boutons et commutateurs</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="m_terminal_cb">
|
||||
<property name="text">
|
||||
<string>Borniers</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="m_protection_cb">
|
||||
<property name="text">
|
||||
<string>Organes de protection</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Configuration</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_load_pb">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Ouvrir la configuration sélectionné</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/folder-open.png</normaloff>:/ico/16x16/folder-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="m_conf_cb">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="m_save_name_le"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="m_save_current_conf_pb">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Sauvegarder la configuration actuelle</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/document-save.png</normaloff>:/ico/16x16/document-save.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_edit_sql_query_cb">
|
||||
<property name="toolTip">
|
||||
<string>Requête SQL personnalisée</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Requête SQL :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_sql_query">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../qelectrotech.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user