File indexing completed on 2024-04-21 14:43:54

0001 /*************************************************************************************
0002  *  Copyright (C) 2010-2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com> *
0003  *                                                                                   *
0004  *  This program is free software; you can redistribute it and/or                    *
0005  *  modify it under the terms of the GNU General Public License                      *
0006  *  as published by the Free Software Foundation; either version 2                   *
0007  *  of the License, or (at your option) any later version.                           *
0008  *                                                                                   *
0009  *  This program is distributed in the hope that it will be useful,                  *
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
0012  *  GNU General Public License for more details.                                     *
0013  *                                                                                   *
0014  *  You should have received a copy of the GNU General Public License                *
0015  *  along with this program; if not, write to the Free Software                      *
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
0017  *************************************************************************************/
0018 
0019 #include "spaceitem.h"
0020 
0021 //local includes
0022 #include "spacesmodel.h"
0023 
0024 SpaceItem::SpaceItem(Analitza::Dimension dimension)
0025     : m_dimension(dimension)
0026     , m_model(nullptr)
0027 {
0028     m_dateTime = QDateTime::currentDateTime();
0029     
0030     m_id = QUuid::createUuid();
0031 }
0032 
0033 SpaceItem::~SpaceItem()
0034 {
0035 }
0036 
0037 void SpaceItem::setName(const QString& name)
0038 {
0039     m_name = name;
0040     
0041     emitDataChanged();
0042 }
0043 
0044 void SpaceItem::setDescription(const QString& description)
0045 {
0046     m_description = description; 
0047     
0048     emitDataChanged();
0049 }
0050 
0051 void SpaceItem::setThumbnail(const QPixmap& thumbnail)
0052 {
0053     m_thumbnail = thumbnail;
0054     
0055     emitDataChanged();
0056 }
0057 
0058 void SpaceItem::stamp()
0059 {
0060     m_dateTime = QDateTime::currentDateTime();
0061     
0062     emitDataChanged(); // actualimos las vistas itemviews
0063 }
0064 
0065 
0066 void SpaceItem::setModel(SpacesModel * m)
0067 {
0068     Q_ASSERT(m);
0069     Q_ASSERT(m != m_model);
0070     
0071     m_model = m;
0072 }
0073 
0074 void SpaceItem::emitDataChanged()
0075 {
0076     if (m_model) {
0077         m_model->emitChanged(this);
0078     }
0079 }