1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-11 13:18:13 +03:00

update layouts settings data classes

This commit is contained in:
Michail Vourlakos 2020-03-14 16:14:28 +02:00
parent 264b2b7568
commit 60d24144b5
4 changed files with 72 additions and 6 deletions

View File

@ -28,7 +28,19 @@ Layout::Layout()
{
}
Layout::~Layout()
Layout::Layout(Layout &&o)
: id(o.id),
m_editedName(o.m_editedName),
m_originalName(o.m_originalName),
color(o.color),
background(o.background),
textColor(o.textColor),
isActive(o.isActive),
isLocked(o.isLocked),
isShownInMenu(o.isShownInMenu),
hasDisabledBorders(o.hasDisabledBorders),
activities(o.activities),
shares(o.shares)
{
}
@ -48,6 +60,24 @@ Layout::Layout(const Layout &o)
{
}
Layout &Layout::operator=(Layout &&rhs)
{
id = rhs.id;
m_editedName = rhs.m_editedName;
m_originalName = rhs.m_originalName;
color = rhs.color;
background = rhs.background;
textColor = rhs.textColor;
isActive = rhs.isActive;
isLocked = rhs.isLocked;
isShownInMenu = rhs.isShownInMenu;
hasDisabledBorders = rhs.hasDisabledBorders;
activities = rhs.activities;
shares = rhs.shares;
return (*this);
}
Layout &Layout::operator=(const Layout &rhs)
{
id = rhs.id;
@ -63,7 +93,7 @@ Layout &Layout::operator=(const Layout &rhs)
activities = rhs.activities;
shares = rhs.shares;
return *this;
return (*this);
}
bool Layout::operator==(const Layout &rhs) const

View File

@ -34,8 +34,7 @@ class Layout
public:
Layout();
~Layout();
Layout(Layout &&o);
Layout(const Layout &o);
//! Layout data
@ -62,6 +61,7 @@ public:
//! Operators
Layout &operator=(const Layout &rhs);
Layout &operator=(Layout &&rhs);
bool operator==(const Layout &rhs) const;
bool operator!=(const Layout &rhs) const;

View File

@ -30,8 +30,16 @@ LayoutsTable::LayoutsTable()
{
}
LayoutsTable::~LayoutsTable()
LayoutsTable::LayoutsTable(LayoutsTable &&o)
: m_layouts(o.m_layouts)
{
}
LayoutsTable::LayoutsTable(const LayoutsTable &o)
: m_layouts(o.m_layouts)
{
}
//! Operators
@ -42,6 +50,12 @@ LayoutsTable &LayoutsTable::operator=(const LayoutsTable &rhs)
return (*this);
}
LayoutsTable &LayoutsTable::operator=(LayoutsTable &&rhs)
{
m_layouts = rhs.m_layouts;
return (*this);
}
LayoutsTable &LayoutsTable::operator<<(const Layout &rhs)
{
if (!rhs.id.isEmpty()) {
@ -113,6 +127,24 @@ const Layout LayoutsTable::operator[](const uint &index) const
return m_layouts[index];
}
LayoutsTable LayoutsTable::subtracted(const LayoutsTable &rhs) const
{
LayoutsTable subtract;
if ((*this) == rhs) {
return subtract;
}
for(int i=0; i<m_layouts.count(); ++i) {
if (!rhs.contains(m_layouts[i].id)) {
subtract << m_layouts[i];
}
}
return subtract;
}
bool LayoutsTable::contains(const QString &id) const
{
for(int i=0; i<m_layouts.count(); ++i) {

View File

@ -34,10 +34,12 @@ class LayoutsTable
public:
LayoutsTable();
~LayoutsTable();
LayoutsTable(LayoutsTable &&o);
LayoutsTable(const LayoutsTable &o);
//! Operators
LayoutsTable &operator=(const LayoutsTable &rhs);
LayoutsTable &operator=(LayoutsTable &&rhs);
LayoutsTable &operator<<(const Layout &rhs);
bool operator==(const LayoutsTable &rhs) const;
bool operator!=(const LayoutsTable &rhs) const;
@ -46,6 +48,8 @@ public:
Layout &operator[](const uint &index);
const Layout operator[](const uint &index) const;
LayoutsTable subtracted(const LayoutsTable &rhs) const;
bool contains(const QString &id) const;
bool rowExists(const int &row) const;