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

0001 /***************************************************************************
0002  *   Copyright (C) 2015 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 #include "data/characterstate.h"
0021 
0022 #include <QUuid>
0023 
0024 CharacterState::CharacterState() : m_id(QUuid::createUuid().toString(QUuid::WithoutBraces))
0025 {
0026     int a= 10;
0027     a= a + 10;
0028 }
0029 CharacterState::CharacterState(const CharacterState& copy)
0030 {
0031     m_id= copy.id();
0032     m_color= copy.color();
0033     m_label= copy.label();
0034     m_imagePath= copy.imagePath();
0035     m_pixmap= copy.pixmap();
0036 }
0037 
0038 QString CharacterState::id() const
0039 {
0040     return m_id;
0041 }
0042 
0043 void CharacterState::setId(const QString& id)
0044 {
0045     if(id.isEmpty())
0046         return;
0047     m_id= id;
0048 }
0049 
0050 void CharacterState::setLabel(QString str)
0051 {
0052     m_label= str;
0053 }
0054 
0055 void CharacterState::setColor(QColor str)
0056 {
0057     m_color= str;
0058 }
0059 
0060 void CharacterState::setImagePath(const QString& str)
0061 {
0062     m_imagePath= str;
0063     setPixmap(QPixmap(str));
0064 }
0065 
0066 void CharacterState::setPixmap(const QPixmap& pix)
0067 {
0068     m_pixmap= pix;
0069 }
0070 
0071 const QString& CharacterState::label() const
0072 {
0073     return m_label;
0074 }
0075 const QColor& CharacterState::color() const
0076 {
0077     return m_color;
0078 }
0079 const QString& CharacterState::imagePath() const
0080 {
0081     return m_imagePath;
0082 }
0083 const QPixmap& CharacterState::pixmap() const
0084 {
0085     return m_pixmap;
0086 }
0087 
0088 bool CharacterState::hasImage() const
0089 {
0090     return !m_pixmap.isNull();
0091 }