File indexing completed on 2024-05-05 05:40:26

0001 /***************************************************************************
0002  *  Copyright (C) 2009 by Renaud Guezennec                             *
0003  *   https://rolisteam.org/contact                   *
0004  *                                                                         *
0005  *   Rolisteam is free software; you can redistribute it and/or modify     *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
0019  ***************************************************************************/
0020 
0021 #include "data/resourcesnode.h"
0022 
0023 #include <QUuid>
0024 
0025 ResourcesNode::ResourcesNode(TypeResource type, const QString& uuid) : m_uuid(uuid), m_type(type)
0026 {
0027     if(m_uuid.isEmpty())
0028         m_uuid= QUuid::createUuid().toString(QUuid::WithoutBraces);
0029 }
0030 
0031 ResourcesNode::~ResourcesNode() {}
0032 
0033 QString ResourcesNode::uuid() const
0034 {
0035     return m_uuid;
0036 }
0037 
0038 void ResourcesNode::setUuid(const QString& uuid)
0039 {
0040     if(uuid == m_uuid)
0041         return;
0042 
0043     m_uuid= uuid;
0044     emit uuidChanged(m_uuid);
0045 }
0046 QString ResourcesNode::name() const
0047 {
0048     return m_name;
0049 }
0050 
0051 void ResourcesNode::setName(const QString& name)
0052 {
0053     if(name == m_name)
0054         return;
0055     m_name= name;
0056     emit nameChanged();
0057 }
0058 
0059 QString ResourcesNode::value() const
0060 {
0061     return m_value;
0062 }
0063 
0064 void ResourcesNode::setValue(QString value)
0065 {
0066     if(value == m_value)
0067         return;
0068     m_value= value;
0069     emit valueChanged();
0070 }
0071 
0072 ResourcesNode* ResourcesNode::getChildAt(int) const
0073 {
0074     return nullptr;
0075 }
0076 
0077 QIcon ResourcesNode::icon() const
0078 {
0079     return QIcon();
0080 }
0081 
0082 ResourcesNode::TypeResource ResourcesNode::type() const
0083 {
0084     return m_type;
0085 }
0086 
0087 ResourcesNode* ResourcesNode::parentNode() const
0088 {
0089     return m_parent;
0090 }
0091 
0092 void ResourcesNode::setParentNode(ResourcesNode* parent)
0093 {
0094     if(parent == m_parent)
0095         return;
0096     m_parent= parent;
0097     emit parentNodeChanged();
0098 }
0099 
0100 int ResourcesNode::rowInParent()
0101 {
0102     if(nullptr != m_parent)
0103     {
0104         return m_parent->indexOf(this);
0105     }
0106     return 0;
0107 }
0108 
0109 int ResourcesNode::indexOf(ResourcesNode*) const
0110 {
0111     return 0;
0112 }
0113 
0114 int ResourcesNode::childrenCount() const
0115 {
0116     return 0;
0117 }
0118 
0119 bool ResourcesNode::isLeaf() const
0120 {
0121     return true;
0122 }
0123 
0124 bool ResourcesNode::hasChildren() const
0125 {
0126     return false;
0127 }
0128 bool ResourcesNode::contains(const QString& id)
0129 {
0130     Q_UNUSED(id)
0131     return false;
0132 }
0133 bool ResourcesNode::removeChild(ResourcesNode*)
0134 {
0135     return false;
0136 }
0137 
0138 void ResourcesNode::insertChildAt(int, ResourcesNode*) {}
0139 
0140 ResourcesNode* ResourcesNode::findNode(const QString& id)
0141 {
0142     Q_UNUSED(id)
0143     return nullptr;
0144 }