File indexing completed on 2024-05-19 05:40:35
0001 /*************************************************************************** 0002 * Copyright (C) 2019 by Renaud Guezennec * 0003 * http://www.rolisteam.org/contact * 0004 * * 0005 * This software 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 "controller/view_controller/mediacontrollerbase.h" 0021 0022 MediaControllerBase::MediaControllerBase(const QString& id, Core::ContentType contentType, QObject* parent) 0023 : QObject(parent), m_uuid(id), m_name(tr("Unknown")), m_type(contentType) 0024 { 0025 } 0026 0027 MediaControllerBase::~MediaControllerBase()= default; 0028 0029 QString MediaControllerBase::name() const 0030 { 0031 return m_name; 0032 } 0033 0034 QString MediaControllerBase::uuid() const 0035 { 0036 return m_uuid; 0037 } 0038 0039 QString MediaControllerBase::title() const 0040 { 0041 return name(); 0042 } 0043 0044 bool MediaControllerBase::isActive() const 0045 { 0046 return m_active; 0047 } 0048 0049 bool MediaControllerBase::localGM() const 0050 { 0051 return m_localGM; 0052 } 0053 0054 bool MediaControllerBase::modified() const 0055 { 0056 return m_modified; 0057 } 0058 0059 QUrl MediaControllerBase::url() const 0060 { 0061 return m_url; 0062 } 0063 0064 Core::ContentType MediaControllerBase::contentType() const 0065 { 0066 return m_type; 0067 } 0068 0069 QString MediaControllerBase::ownerId() const 0070 { 0071 return m_ownerId; 0072 } 0073 0074 QString MediaControllerBase::localId() const 0075 { 0076 return m_localId; 0077 } 0078 0079 void MediaControllerBase::setLocalGM(bool b) 0080 { 0081 if(m_localGM == b) 0082 return; 0083 m_localGM= b; 0084 emit localGMChanged(m_localGM); 0085 } 0086 0087 void MediaControllerBase::setUuid(const QString& id) 0088 { 0089 if(m_uuid == id) 0090 return; 0091 m_uuid= id; 0092 emit uuidChanged(id); 0093 } 0094 0095 void MediaControllerBase::setOwnerId(const QString& id) 0096 { 0097 if(id == m_ownerId) 0098 return; 0099 m_ownerId= id; 0100 emit ownerIdChanged(m_ownerId); 0101 } 0102 0103 bool MediaControllerBase::localIsOwner() const 0104 { 0105 return (m_ownerId == m_localId); 0106 } 0107 0108 bool MediaControllerBase::remote() const 0109 { 0110 return m_remote; 0111 } 0112 0113 void MediaControllerBase::setLocalId(const QString& id) 0114 { 0115 if(id == m_localId) 0116 return; 0117 m_localId= id; 0118 emit localIdChanged(m_ownerId); 0119 } 0120 0121 void MediaControllerBase::setModified(bool b) 0122 { 0123 if(b == m_modified) 0124 return; 0125 0126 m_modified= b; 0127 emit modifiedChanged(m_modified); 0128 } 0129 0130 void MediaControllerBase::askToClose() 0131 { 0132 emit closeMe(uuid()); 0133 } 0134 0135 void MediaControllerBase::aboutToClose() 0136 { 0137 emit closeContainer(); 0138 } 0139 0140 void MediaControllerBase::setActive(bool b) 0141 { 0142 if(b == m_active) 0143 return; 0144 m_active= b; 0145 emit activeChanged(); 0146 } 0147 void MediaControllerBase::setName(const QString& name) 0148 { 0149 if(name == m_name) 0150 return; 0151 m_name= name; 0152 emit nameChanged(m_name); 0153 } 0154 void MediaControllerBase::setUrl(const QUrl& url) 0155 { 0156 if(url == m_url) 0157 return; 0158 m_url= url; 0159 emit urlChanged(m_url); 0160 } 0161 0162 void MediaControllerBase::setRemote(bool remote) 0163 { 0164 m_remote= remote; 0165 } 0166 0167 bool MediaControllerBase::pasteData(const QMimeData& mimeData) 0168 { 0169 Q_UNUSED(mimeData); 0170 return false; 0171 } 0172 0173 const QColor &MediaControllerBase::localColor() const 0174 { 0175 return m_localColor; 0176 } 0177 0178 void MediaControllerBase::setLocalColor(const QColor &newLocalColor) 0179 { 0180 if (m_localColor == newLocalColor) 0181 return; 0182 m_localColor = newLocalColor; 0183 emit localColorChanged(); 0184 }