1 /* 2 Copyright 2006-2019 The QElectroTech Team 3 This file is part of QElectroTech. 4 5 QElectroTech is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 2 of the License, or 8 (at your option) any later version. 9 10 QElectroTech is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 #ifndef XREFPROPERTIES_H 19 #define XREFPROPERTIES_H 20 21 #include "propertiesinterface.h" 22 #include <QStringList> 23 24 /** 25 * @brief The XRefProperties class 26 * this class store properties used by XrefItem 27 */ 28 class XRefProperties : public PropertiesInterface 29 { 30 public: 31 XRefProperties(); 32 33 enum DisplayHas { 34 Cross, 35 Contacts 36 }; 37 38 enum SnapTo { 39 Bottom, 40 Label 41 }; 42 43 void toSettings (QSettings &settings, const QString = QString()) const override; 44 void fromSettings (const QSettings &settings, const QString = QString()) override; 45 void toXml (QDomElement &xml_element) const override; 46 void fromXml (const QDomElement &xml_element) override; 47 48 static QHash<QString, XRefProperties> defaultProperties(); 49 50 bool operator == (const XRefProperties &xrp) const; 51 bool operator != (const XRefProperties &xrp) const; 52 setShowPowerContac(const bool a)53 void setShowPowerContac (const bool a) {m_show_power_ctc = a;} showPowerContact()54 bool showPowerContact () const {return m_show_power_ctc;} 55 setDisplayHas(const DisplayHas dh)56 void setDisplayHas (const DisplayHas dh) {m_display = dh;} displayHas()57 DisplayHas displayHas () const {return m_display;} 58 setSnapTo(const SnapTo st)59 void setSnapTo (const SnapTo st) {m_snap_to = st;} snapTo()60 SnapTo snapTo () const {return m_snap_to;} 61 setPrefix(const QString & key,const QString & value)62 void setPrefix (const QString &key, const QString &value) {m_prefix.insert(key, value);} prefix(const QString & key)63 QString prefix (const QString &key) const {return m_prefix.value(key);} 64 setMasterLabel(const QString master)65 void setMasterLabel (const QString master) {m_master_label = master;} masterLabel()66 QString masterLabel () const {return m_master_label;} 67 setSlaveLabel(const QString slave)68 void setSlaveLabel(const QString slave) {m_slave_label = slave;} slaveLabel()69 QString slaveLabel () const {return m_slave_label;} 70 setOffset(const int offset)71 void setOffset(const int offset) {m_offset = offset;} offset()72 int offset() const {return m_offset;} 73 74 private: 75 bool m_show_power_ctc; 76 DisplayHas m_display; 77 SnapTo m_snap_to; 78 QHash <QString, QString> m_prefix; 79 QStringList m_prefix_keys; 80 QString m_master_label; 81 QString m_slave_label; 82 int m_offset; 83 }; 84 85 #endif // XREFPROPERTIES_H 86