2014-04-11 09:51:21 +00:00
|
|
|
/*
|
2020-06-15 17:42:37 +02:00
|
|
|
Copyright 2006-2020 The QElectroTech Team
|
2014-04-11 09:51:21 +00:00
|
|
|
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"
|
2014-07-07 14:36:53 +00:00
|
|
|
#include <QStringList>
|
2014-04-11 09:51:21 +00:00
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief The XRefProperties class
|
|
|
|
this class store properties used by XrefItem
|
|
|
|
*/
|
2014-04-11 09:51:21 +00:00
|
|
|
class XRefProperties : public PropertiesInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
XRefProperties();
|
|
|
|
|
2014-04-28 15:41:58 +00:00
|
|
|
enum DisplayHas {
|
|
|
|
Cross,
|
|
|
|
Contacts
|
|
|
|
};
|
|
|
|
|
2014-06-27 18:34:18 +00:00
|
|
|
enum SnapTo {
|
|
|
|
Bottom,
|
|
|
|
Label
|
|
|
|
};
|
|
|
|
|
2017-08-05 02:10:01 +00:00
|
|
|
void toSettings (QSettings &settings, const QString = QString()) const override;
|
|
|
|
void fromSettings (const QSettings &settings, const QString = QString()) override;
|
2020-05-24 22:09:04 +02:00
|
|
|
QDomElement toXml (QDomDocument &xml_document) const override;
|
|
|
|
bool fromXml(const QDomElement &xml_element) override;
|
2014-04-11 09:51:21 +00:00
|
|
|
|
2014-10-26 11:57:38 +00:00
|
|
|
static QHash<QString, XRefProperties> defaultProperties();
|
|
|
|
|
2014-04-11 09:51:21 +00:00
|
|
|
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;}
|
|
|
|
|
2014-06-27 18:34:18 +00:00
|
|
|
void setDisplayHas (const DisplayHas dh) {m_display = dh;}
|
|
|
|
DisplayHas displayHas () const {return m_display;}
|
|
|
|
|
|
|
|
void setSnapTo (const SnapTo st) {m_snap_to = st;}
|
|
|
|
SnapTo snapTo () const {return m_snap_to;}
|
2014-04-28 15:41:58 +00:00
|
|
|
|
2019-08-31 07:37:34 +02:00
|
|
|
void setXrefPos(const Qt::AlignmentFlag xref) {m_xref_pos = xref;}
|
|
|
|
Qt::AlignmentFlag getXrefPos() const {return m_xref_pos;}
|
2014-05-07 20:56:51 +00:00
|
|
|
void setPrefix (const QString &key, const QString &value) {m_prefix.insert(key, value);}
|
|
|
|
QString prefix (const QString &key) const {return m_prefix.value(key);}
|
|
|
|
|
2016-05-23 22:01:22 +00:00
|
|
|
void setMasterLabel (const QString master) {m_master_label = master;}
|
|
|
|
QString masterLabel () const {return m_master_label;}
|
|
|
|
|
|
|
|
void setSlaveLabel(const QString slave) {m_slave_label = slave;}
|
|
|
|
QString slaveLabel () const {return m_slave_label;}
|
|
|
|
|
2016-06-07 17:01:59 +00:00
|
|
|
void setOffset(const int offset) {m_offset = offset;}
|
|
|
|
int offset() const {return m_offset;}
|
|
|
|
|
2020-05-24 22:09:04 +02:00
|
|
|
void setKey(QString& key) {m_key = key;}
|
|
|
|
|
2014-04-11 09:51:21 +00:00
|
|
|
private:
|
|
|
|
bool m_show_power_ctc;
|
2014-04-28 15:41:58 +00:00
|
|
|
DisplayHas m_display;
|
2014-06-27 18:34:18 +00:00
|
|
|
SnapTo m_snap_to;
|
2019-08-31 07:37:34 +02:00
|
|
|
Qt::AlignmentFlag m_xref_pos;
|
2014-05-07 20:56:51 +00:00
|
|
|
QHash <QString, QString> m_prefix;
|
2014-07-07 14:36:53 +00:00
|
|
|
QStringList m_prefix_keys;
|
2016-05-23 22:01:22 +00:00
|
|
|
QString m_master_label;
|
|
|
|
QString m_slave_label;
|
2016-06-07 17:01:59 +00:00
|
|
|
int m_offset;
|
2020-05-24 22:09:04 +02:00
|
|
|
QString m_key;
|
2014-04-11 09:51:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // XREFPROPERTIES_H
|