QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
projectDataBase Class Reference

The projectDataBase class This class wraps a sqlite data base where you can find several things about the content of a project. More...

#include <projectdatabase.h>

Inherits QObject.

Collaboration diagram for projectDataBase:
Collaboration graph

Signals

void dataBaseUpdated ()

Public Member Functions

 projectDataBase (QETProject *project, QObject *parent=nullptr)
 projectDataBase::projectDataBase Default constructor
virtual ~projectDataBase () override
 projectDataBase::~projectDataBase Destructor
void updateDB ()
 projectDataBase::updateDB Up to date the content of the data base. Emit the signal dataBaseUpdated
QETProjectproject () const
 projectDataBase::project
QSqlQuery newQuery (const QString &query=QString())
 projectDataBase::newQuery
void addElement (Element *element)
 projectDataBase::addElement
void removeElement (Element *element)
 projectDataBase::removeElement
void elementInfoChanged (Element *element)
 projectDataBase::elementInfoChanged
void elementInfoChanged (QList< Element * > elements)
void addDiagram (Diagram *diagram)
void removeDiagram (Diagram *diagram)
void diagramInfoChanged (Diagram *diagram)
void diagramOrderChanged ()
void addConductor (Conductor *conductor)
 projectDataBase::addConductor
void removeConductor (Conductor *conductor)
 projectDataBase::removeConductor
void updateConductor (Conductor *conductor)
 projectDataBase::updateConductor Refresh the mutable columns of an already-inserted conductor.

Private Slots

void conductorPropertiesChanged ()
 projectDataBase::conductorPropertiesChanged

Private Member Functions

bool createDataBase ()
 projectDataBase::createDataBase Create the data base
void createElementNomenclatureView ()
 projectDataBase::createElementNomenclatureView
void createSummaryView ()
 projectDataBase::createSummaryView
void populateDiagramTable ()
void populateElementTable ()
 projectDataBase::populateElementTable Populate the element table
void populateElementInfoTable ()
 projectDataBase::populateElementInfoTable Populate the element info table
void populateDiagramInfoTable ()
void populateConductorTable ()
 projectDataBase::populateConductorTable Populate the terminal and conductor tables. Terminals only matter here in the context of a conductor referencing them, so their population is folded into this method rather than tracked independently.
void bindConductorValues (QSqlQuery &query, Conductor *conductor, Diagram *diagram)
 projectDataBase::bindConductorValues One binder for both insert paths, so a conductor added to a live diagram and one read from a file can never drift apart – the same reason bindElementValues() exists for elements.
void watchConductor (Conductor *conductor)
 projectDataBase::watchConductor Keep this conductor's row in step with its properties.
void insertTerminal (Terminal *terminal)
 projectDataBase::insertTerminal Insert (or, if already present – e.g. a junction shared by several conductors – silently keep) @terminal in the terminal table.
void prepareQuery ()
void bindDiagramInfoValues (QSqlQuery &query, Diagram *diagram)

Static Private Member Functions

static QHash< QString, QString > elementInfoToString (Element *elmt)
 projectDataBase::elementInfoToString

Private Attributes

QPointer< QETProjectm_project
QSqlDatabase m_data_base
QSqlQuery m_insert_elements_query
QSqlQuery m_insert_element_info_query
QSqlQuery m_remove_element_query
QSqlQuery m_update_element_query
QSqlQuery m_insert_diagram_query
QSqlQuery m_remove_diagram_query
QSqlQuery m_insert_diagram_info_query
QSqlQuery m_update_diagram_info_query
QSqlQuery m_diagram_order_changed
QSqlQuery m_diagram_info_order_changed
QSqlQuery m_insert_terminal_query
QSqlQuery m_insert_conductor_query
QSqlQuery m_update_conductor_query
QSqlQuery m_remove_conductor_query
QSqlQuery m_cascade_remove_element_info_query
QSqlQuery m_cascade_remove_terminal_query
QSqlQuery m_cascade_remove_conductor_query
QSqlQuery m_cascade_remove_element_query

Detailed Description

The projectDataBase class This class wraps a sqlite data base where you can find several things about the content of a project.

Note
this class is still in development.

Constructor & Destructor Documentation

◆ projectDataBase()

projectDataBase::projectDataBase ( QETProject * project,
QObject * parent = nullptr )

projectDataBase::projectDataBase Default constructor

Parameters
project: project from the database work
parent: parent QObject
Here is the call graph for this function:

◆ ~projectDataBase()

projectDataBase::~projectDataBase ( )
overridevirtual

Member Function Documentation

◆ addConductor()

void projectDataBase::addConductor ( Conductor * conductor)

projectDataBase::addConductor

Parameters
conductor
Here is the call graph for this function:

◆ addDiagram()

void projectDataBase::addDiagram ( Diagram * diagram)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addElement()

void projectDataBase::addElement ( Element * element)

projectDataBase::addElement

Parameters
element
Here is the call graph for this function:

◆ bindConductorValues()

void projectDataBase::bindConductorValues ( QSqlQuery & query,
Conductor * conductor,
Diagram * diagram )
private

projectDataBase::bindConductorValues One binder for both insert paths, so a conductor added to a live diagram and one read from a file can never drift apart – the same reason bindElementValues() exists for elements.

Parameters
query
conductor
diagram: the diagram the conductor belongs to
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bindDiagramInfoValues()

void projectDataBase::bindDiagramInfoValues ( QSqlQuery & query,
Diagram * diagram )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ conductorPropertiesChanged

void projectDataBase::conductorPropertiesChanged ( )
privateslot

projectDataBase::conductorPropertiesChanged

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createDataBase()

bool projectDataBase::createDataBase ( )
private

projectDataBase::createDataBase Create the data base

Returns
: true if the data base was successfully created.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createElementNomenclatureView()

void projectDataBase::createElementNomenclatureView ( )
private

projectDataBase::createElementNomenclatureView

Here is the caller graph for this function:

◆ createSummaryView()

void projectDataBase::createSummaryView ( )
private

projectDataBase::createSummaryView

Here is the caller graph for this function:

◆ dataBaseUpdated

void projectDataBase::dataBaseUpdated ( )
signal
Here is the caller graph for this function:

◆ diagramInfoChanged()

void projectDataBase::diagramInfoChanged ( Diagram * diagram)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ diagramOrderChanged()

void projectDataBase::diagramOrderChanged ( )

◆ elementInfoChanged() [1/2]

void projectDataBase::elementInfoChanged ( Element * element)

projectDataBase::elementInfoChanged

Parameters
element
Here is the call graph for this function:
Here is the caller graph for this function:

◆ elementInfoChanged() [2/2]

void projectDataBase::elementInfoChanged ( QList< Element * > elements)
Here is the call graph for this function:

◆ elementInfoToString()

QHash< QString, QString > projectDataBase::elementInfoToString ( Element * elmt)
staticprivate

projectDataBase::elementInfoToString

Parameters
elmt
Returns
the element information in hash as key for the info name and value as the information value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertTerminal()

void projectDataBase::insertTerminal ( Terminal * terminal)
private

projectDataBase::insertTerminal Insert (or, if already present – e.g. a junction shared by several conductors – silently keep) @terminal in the terminal table.

Parameters
terminal
Here is the call graph for this function:
Here is the caller graph for this function:

◆ newQuery()

QSqlQuery projectDataBase::newQuery ( const QString & query = QString())

projectDataBase::newQuery

Returns
a QSqlquery with query as query and the internal database of this class as database to use.
Here is the caller graph for this function:

◆ populateConductorTable()

void projectDataBase::populateConductorTable ( )
private

projectDataBase::populateConductorTable Populate the terminal and conductor tables. Terminals only matter here in the context of a conductor referencing them, so their population is folded into this method rather than tracked independently.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ populateDiagramInfoTable()

void projectDataBase::populateDiagramInfoTable ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ populateDiagramTable()

void projectDataBase::populateDiagramTable ( )
private
Here is the caller graph for this function:

◆ populateElementInfoTable()

void projectDataBase::populateElementInfoTable ( )
private

projectDataBase::populateElementInfoTable Populate the element info table

Here is the call graph for this function:
Here is the caller graph for this function:

◆ populateElementTable()

void projectDataBase::populateElementTable ( )
private

projectDataBase::populateElementTable Populate the element table

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepareQuery()

void projectDataBase::prepareQuery ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ project()

QETProject * projectDataBase::project ( ) const

projectDataBase::project

Returns
the project of this database
Here is the caller graph for this function:

◆ removeConductor()

void projectDataBase::removeConductor ( Conductor * conductor)

projectDataBase::removeConductor

Parameters
conductor
Here is the call graph for this function:

◆ removeDiagram()

void projectDataBase::removeDiagram ( Diagram * diagram)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeElement()

void projectDataBase::removeElement ( Element * element)

projectDataBase::removeElement

Parameters
element
Here is the call graph for this function:

◆ updateConductor()

void projectDataBase::updateConductor ( Conductor * conductor)

projectDataBase::updateConductor Refresh the mutable columns of an already-inserted conductor.

Only the text (the wire number) can change without the conductor being removed and re-added: its endpoints are fixed for its lifetime. Without this, renaming a wire left the database holding the old number and the wiring list showed a stale value until the next full repopulate.

Parameters
conductor
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateDB()

void projectDataBase::updateDB ( )

projectDataBase::updateDB Up to date the content of the data base. Emit the signal dataBaseUpdated

Here is the call graph for this function:
Here is the caller graph for this function:

◆ watchConductor()

void projectDataBase::watchConductor ( Conductor * conductor)
private

projectDataBase::watchConductor Keep this conductor's row in step with its properties.

Conductor::setProperties() has a dozen call sites (auto-numbering, the properties dialog, element moves, deletion re-links...), so listening to the signal it already emits is the only way to catch them all – and the only way to catch the ones added later. Qt::UniqueConnection makes a repeated insert or a full repopulate harmless.

Parameters
conductor
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_cascade_remove_conductor_query

QSqlQuery projectDataBase::m_cascade_remove_conductor_query
private

◆ m_cascade_remove_element_info_query

QSqlQuery projectDataBase::m_cascade_remove_element_info_query
private

◆ m_cascade_remove_element_query

QSqlQuery projectDataBase::m_cascade_remove_element_query
private

◆ m_cascade_remove_terminal_query

QSqlQuery projectDataBase::m_cascade_remove_terminal_query
private

◆ m_data_base

QSqlDatabase projectDataBase::m_data_base
private

◆ m_diagram_info_order_changed

QSqlQuery projectDataBase::m_diagram_info_order_changed
private

◆ m_diagram_order_changed

QSqlQuery projectDataBase::m_diagram_order_changed
private

◆ m_insert_conductor_query

QSqlQuery projectDataBase::m_insert_conductor_query
private

◆ m_insert_diagram_info_query

QSqlQuery projectDataBase::m_insert_diagram_info_query
private

◆ m_insert_diagram_query

QSqlQuery projectDataBase::m_insert_diagram_query
private

◆ m_insert_element_info_query

QSqlQuery projectDataBase::m_insert_element_info_query
private

◆ m_insert_elements_query

QSqlQuery projectDataBase::m_insert_elements_query
private

◆ m_insert_terminal_query

QSqlQuery projectDataBase::m_insert_terminal_query
private

◆ m_project

QPointer<QETProject> projectDataBase::m_project
private

◆ m_remove_conductor_query

QSqlQuery projectDataBase::m_remove_conductor_query
private

◆ m_remove_diagram_query

QSqlQuery projectDataBase::m_remove_diagram_query
private

◆ m_remove_element_query

QSqlQuery projectDataBase::m_remove_element_query
private

◆ m_update_conductor_query

QSqlQuery projectDataBase::m_update_conductor_query
private

◆ m_update_diagram_info_query

QSqlQuery projectDataBase::m_update_diagram_info_query
private

◆ m_update_element_query

QSqlQuery projectDataBase::m_update_element_query
private

The documentation for this class was generated from the following files: