fort/src/ui/conf/addressgroup.cpp

97 lines
1.9 KiB
C++
Raw Normal View History

2017-09-02 10:17:51 +00:00
#include "addressgroup.h"
AddressGroup::AddressGroup(QObject *parent) :
2020-08-20 09:36:41 +00:00
QObject(parent), m_edited(false), m_includeAll(true), m_excludeAll(false)
2017-09-02 10:17:51 +00:00
{
}
void AddressGroup::addIncludeZone(int zoneId)
{
addZone(m_includeZones, zoneId);
}
void AddressGroup::removeIncludeZone(int zoneId)
{
removeZone(m_includeZones, zoneId);
}
void AddressGroup::addExcludeZone(int zoneId)
{
addZone(m_excludeZones, zoneId);
}
void AddressGroup::removeExcludeZone(int zoneId)
{
removeZone(m_excludeZones, zoneId);
}
void AddressGroup::addZone(quint32 &zones, int zoneId)
{
zones |= (quint32(1) << (zoneId - 1));
setEdited(true);
}
void AddressGroup::removeZone(quint32 &zones, int zoneId)
{
zones &= ~(quint32(1) << (zoneId - 1));
setEdited(true);
}
void AddressGroup::setIncludeAll(bool includeAll)
2017-09-02 10:17:51 +00:00
{
if (m_includeAll != includeAll) {
m_includeAll = includeAll;
emit includeAllChanged();
2019-10-23 12:03:59 +00:00
setEdited(true);
2017-09-02 10:17:51 +00:00
}
}
void AddressGroup::setExcludeAll(bool excludeAll)
2017-09-02 10:17:51 +00:00
{
if (m_excludeAll != excludeAll) {
m_excludeAll = excludeAll;
emit excludeAllChanged();
2019-10-23 12:03:59 +00:00
setEdited(true);
}
}
void AddressGroup::setIncludeText(const QString &includeText)
{
if (m_includeText != includeText) {
m_includeText = includeText;
emit includeTextChanged();
2019-10-23 12:03:59 +00:00
setEdited(true);
}
}
void AddressGroup::setExcludeText(const QString &excludeText)
{
if (m_excludeText != excludeText) {
m_excludeText = excludeText;
emit excludeTextChanged();
2019-10-23 12:03:59 +00:00
setEdited(true);
2017-09-02 10:17:51 +00:00
}
}
2019-10-23 12:03:59 +00:00
void AddressGroup::copy(const AddressGroup &o)
{
2019-12-08 09:50:41 +00:00
m_edited = o.edited();
2019-10-23 12:03:59 +00:00
m_includeAll = o.includeAll();
m_excludeAll = o.excludeAll();
2019-10-27 15:12:59 +00:00
m_id = o.id();
2019-10-23 12:03:59 +00:00
2020-02-13 09:11:25 +00:00
m_includeZones = o.includeZones();
m_excludeZones = o.excludeZones();
m_includeText = o.includeText();
m_excludeText = o.excludeText();
2019-10-23 12:03:59 +00:00
}