-add class for store Xref properties

-add widget for edit it
-make link betwen QET -> QETproject -> Diagram, for transmit the xrefproperties
-xrefpropertie can save/load to xml and setting.
-XRefItem don't use the properties yet


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2983 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-04-11 09:51:21 +00:00
parent 457ecbc12c
commit c7aaf5b509
18 changed files with 498 additions and 64 deletions

View File

@@ -0,0 +1,22 @@
/*
Copyright 2006-2014 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 "propertiesinterface.h"
PropertiesInterface::PropertiesInterface()
{
}

View File

@@ -0,0 +1,41 @@
/*
Copyright 2006-2014 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 PROPERTIESINTERFACE_H
#define PROPERTIESINTERFACE_H
#include <QString>
#include <QSettings>
#include <QDomElement>
/**
* @brief The PropertiesInterface class
* This class is an interface for have common way to use properties in QElectroTech
*/
class PropertiesInterface
{
public:
PropertiesInterface();
// Save/load properties to setting file. QString is use for prefix a word befor the name of each paramètre
virtual void toSettings (QSettings &settings, const QString = QString()) const =0;
virtual void fromSettings (const QSettings &settings, const QString = QString()) =0;
// Save/load properties to xml element
virtual void toXml (QDomElement &xml_element) const =0;
virtual void fromXml (const QDomElement &xml_element) =0;
};
#endif // PROPERTIESINTERFACE_H

View File

@@ -0,0 +1,74 @@
/*
Copyright 2006-2014 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 "xrefproperties.h"
/**
* @brief XRefProperties::XRefProperties
* Default Constructor
*/
XRefProperties::XRefProperties()
{
}
/**
* @brief XRefProperties::toSettings
* Save to settings
* @param settings: QSettings to use
* @param prefix: prefix before properties name
*/
void XRefProperties::toSettings(QSettings &settings, const QString prefix) const {
settings.setValue(prefix + "showpowerctc", m_show_power_ctc);
}
/**
* @brief XRefProperties::fromSettings
* load from settings
* @param settings: QSettings to use
* @param prefix: prefix before properties name
*/
void XRefProperties::fromSettings(const QSettings &settings, const QString prefix) {
m_show_power_ctc = settings.value(prefix + "showpowerctc", false).toBool();
}
/**
* @brief XRefProperties::toXml
* Save to xml
* @param xml_element: QDomElement to use for saving
*/
void XRefProperties::toXml(QDomElement &xml_element) const {
xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "fasle");
}
/**
* @brief XRefProperties::fromXml
* Load from xml
* @param xml_element: QDomElement to use for load
*/
void XRefProperties::fromXml(const QDomElement &xml_element) {
m_show_power_ctc = xml_element.attribute("showpowerctc") == "true";
}
bool XRefProperties::operator ==(const XRefProperties &xrp) const{
return (m_show_power_ctc == xrp.m_show_power_ctc);
}
bool XRefProperties::operator !=(const XRefProperties &xrp) const {
return (! (*this == xrp));
}

View File

@@ -0,0 +1,47 @@
/*
Copyright 2006-2014 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 XREFPROPERTIES_H
#define XREFPROPERTIES_H
#include "propertiesinterface.h"
/**
* @brief The XRefProperties class
* this class store properties used by XrefItem
*/
class XRefProperties : public PropertiesInterface
{
public:
XRefProperties();
virtual void toSettings (QSettings &settings, const QString = QString()) const;
virtual void fromSettings (const QSettings &settings, const QString = QString());
virtual void toXml (QDomElement &xml_element) const;
virtual void fromXml (const QDomElement &xml_element);
bool operator == (const XRefProperties &xrp) const;
bool operator != (const XRefProperties &xrp) const;
void setShowPowerContac (const bool a) {m_show_power_ctc = a;}
bool showPowerContact () const {return m_show_power_ctc;}
private:
bool m_show_power_ctc;
};
#endif // XREFPROPERTIES_H