fort/src/ui/conf/addressgroup.cpp

104 lines
2.0 KiB
C++
Raw Normal View History

2017-09-02 10:17:51 +00:00
#include "addressgroup.h"
AddressGroup::AddressGroup(QObject *parent) :
QObject(parent),
2019-10-23 12:03:59 +00:00
m_edited(false),
m_includeAll(true),
2020-01-01 11:28:59 +00:00
m_excludeAll(false)
2017-09-02 10:17:51 +00:00
{
}
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
}
}
2020-02-13 09:11:25 +00:00
void AddressGroup::addIncludeZone(int zoneId, bool sorting)
{
addZone(m_includeZones, zoneId, sorting);
}
void AddressGroup::removeIncludeZone(int zoneId)
{
removeZone(m_includeZones, zoneId);
}
void AddressGroup::addExcludeZone(int zoneId, bool sorting)
{
addZone(m_excludeZones, zoneId, sorting);
}
void AddressGroup::removeExcludeZone(int zoneId)
{
removeZone(m_excludeZones, zoneId);
}
void AddressGroup::addZone(QVector<int> &zones, int zoneId, bool sorting)
{
zones.append(zoneId);
if (sorting) {
std::sort(zones.begin(), zones.end());
}
setEdited(true);
}
void AddressGroup::removeZone(QVector<int> &zones, int zoneId)
{
zones.removeOne(zoneId);
setEdited(true);
}
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
m_includeText = o.includeText();
m_excludeText = o.excludeText();
2020-02-13 09:11:25 +00:00
m_includeZones = o.includeZones();
m_excludeZones = o.excludeZones();
2019-10-23 12:03:59 +00:00
}