File indexing completed on 2024-04-21 05:30:46

0001 /*
0002     SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #include "layoutstable.h"
0007 
0008 #include <QDebug>
0009 
0010 namespace Latte {
0011 namespace Data {
0012 
0013 LayoutsTable::LayoutsTable()
0014     : GenericTable<Layout>()
0015 {
0016 }
0017 
0018 LayoutsTable::LayoutsTable(LayoutsTable &&o)
0019     : GenericTable<Layout>(o)
0020 {
0021 
0022 }
0023 
0024 LayoutsTable::LayoutsTable(const LayoutsTable &o)
0025     : GenericTable<Layout>(o)
0026 {
0027 
0028 }
0029 
0030 //! Operators
0031 LayoutsTable &LayoutsTable::operator=(const LayoutsTable &rhs)
0032 {
0033     m_list = rhs.m_list;
0034     return (*this);
0035 }
0036 
0037 LayoutsTable &LayoutsTable::operator=(LayoutsTable &&rhs)
0038 {
0039     m_list = rhs.m_list;
0040     return (*this);
0041 }
0042 
0043 LayoutsTable LayoutsTable::subtracted(const LayoutsTable &rhs) const
0044 {
0045     LayoutsTable subtract;
0046 
0047     if ((*this) == rhs) {
0048         return subtract;
0049     }
0050 
0051     for(int i=0; i<m_list.count(); ++i) {
0052         if (!rhs.containsId(m_list[i].id)) {
0053             subtract << m_list[i];
0054         }
0055     }
0056 
0057     return subtract;
0058 }
0059 
0060 void LayoutsTable::setLayoutForFreeActivities(const QString &id)
0061 {
0062     int row = indexOf(id);
0063 
0064 
0065     if (row>=0) {
0066         m_list[row].activities = QStringList(Data::Layout::FREEACTIVITIESID);
0067     }
0068 }
0069 
0070 }
0071 }