Minor revamp

Remove unused include.
QETproject : Default titleblock are set in the default constructor
instead of set by qetdiagrameditor.
conductor, border, report and xref propertie are now set in the header
of QETProject instead of set by the qetdiagrameditor just after the
creation of a new project.
This commit is contained in:
Claveau Joshua 2020-04-09 16:58:05 +02:00
parent 87f26ce691
commit 5c6f556ad3
3 changed files with 16 additions and 43 deletions

View File

@ -16,25 +16,12 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qetdiagrameditor.h"
#include "qetapp.h"
#include "diagramcontent.h"
#include "diagramview.h"
#include "diagram.h"
#include "qetgraphicsitem/element.h"
#include "elementspanelwidget.h"
#include "conductorpropertieswidget.h"
#include "qetproject.h"
#include "projectview.h"
#include "recentfiles.h"
#include "qeticons.h"
#include "qetelementeditor.h"
#include "qetmessagebox.h"
#include "qetresult.h"
#include "genericpanel.h"
#include "nomenclature.h"
#include "diagramfoliolist.h"
#include "qetshapeitem.h"
#include "reportproperties.h"
#include "diagrampropertieseditordockwidget.h"
#include "diagrameventaddshape.h"
#include "diagrameventaddimage.h"
@ -50,14 +37,10 @@
#include "addelementtextcommand.h"
#include "conductornumexport.h"
#include "qetgraphicstableitem.h"
#include <QMessageBox>
#include <QStandardPaths>
#include <KAutoSaveFile>
#include "elementscollectionmodel.h"
#include "bomexportdialog.h"
#include <KAutoSaveFile>
/**
* @brief QETDiagramEditor::QETDiagramEditor
@ -889,24 +872,14 @@ void QETDiagramEditor::saveAs() {
/**
* @brief QETDiagramEditor::newProject
* Create an empty project
* Create a new project with an empty diagram
* @return
*/
bool QETDiagramEditor::newProject() {
// create new project without diagram
QETProject *new_project = new QETProject(this);
// Set default properties for new diagram
new_project -> setDefaultBorderProperties (BorderProperties:: defaultProperties());
new_project -> setDefaultConductorProperties (ConductorProperties:: defaultProperties());
new_project -> setDefaultTitleBlockProperties (TitleBlockProperties::defaultProperties());
new_project -> setDefaultReportProperties (ReportProperties:: defaultProperties());
new_project -> setDefaultXRefProperties (XRefProperties:: defaultProperties());
// add new diagram
bool QETDiagramEditor::newProject()
{
auto new_project = new QETProject(this);
new_project -> addNewDiagram();
return(addProject(new_project));
return addProject(new_project);
}
/**

View File

@ -25,7 +25,6 @@
#include "titleblocktemplate.h"
#include "ui/dialogwaiting.h"
#include "numerotationcontext.h"
#include "reportproperties.h"
#include "integrationmovetemplateshandler.h"
#include "xmlelementcollection.h"
#include "importelementdialog.h"
@ -48,6 +47,8 @@ QETProject::QETProject(QObject *parent) :
QObject (parent),
m_titleblocks_collection(this)
{
setDefaultTitleBlockProperties(TitleBlockProperties::defaultProperties());
m_elements_collection = new XmlElementCollection(this);
init();
}
@ -438,12 +439,10 @@ void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titl
case QET::Embedded :
//Titleblock is already embedded to project
return;
default:
return;
}
QScopedPointer<IntegrationMoveTitleBlockTemplatesHandler> m(new IntegrationMoveTitleBlockTemplatesHandler);
integrateTitleBlockTemplate(collection -> location(titleblock.template_name), m.data());
IntegrationMoveTitleBlockTemplatesHandler m_;
integrateTitleBlockTemplate(collection -> location(titleblock.template_name), &m_);
}
emit defaultTitleBlockPropertiesChanged();
}

View File

@ -25,6 +25,7 @@
#include "titleblockproperties.h"
#include "templatescollection.h"
#include "properties/xrefproperties.h"
#include "reportproperties.h"
class Diagram;
class ElementsLocation;
@ -234,15 +235,15 @@ class QETProject : public QObject
/// Filepath for which this project is considered read only
QString read_only_file_path_;
/// Default dimensions and properties for new diagrams created within the project
BorderProperties default_border_properties_;
BorderProperties default_border_properties_ = BorderProperties::defaultProperties();
/// Default conductor properties for new diagrams created within the project
ConductorProperties default_conductor_properties_;
ConductorProperties default_conductor_properties_ = ConductorProperties::defaultProperties();
/// Default title block properties for new diagrams created within the project
TitleBlockProperties default_titleblock_properties_;
/// Default report properties
QString m_default_report_properties;
QString m_default_report_properties = ReportProperties::defaultProperties();
/// Default xref properties
QHash <QString, XRefProperties> m_default_xref_properties;
QHash <QString, XRefProperties> m_default_xref_properties = XRefProperties::defaultProperties();
/// Embedded title block templates collection
TitleBlockTemplatesProjectCollection m_titleblocks_collection;
/// project-wide variables that will be made available to child diagrams