2023-06-12 10:46:54 +02:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
|
|
|
|
* Copyright (C) 2023 Tom Zander <tom@flowee.org>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2023-06-11 19:06:16 +02:00
|
|
|
#include "ModuleInfo.h"
|
|
|
|
|
|
|
|
|
|
ModuleInfo::ModuleInfo(QObject *parent)
|
|
|
|
|
: QObject(parent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString ModuleInfo::id() const
|
|
|
|
|
{
|
|
|
|
|
return m_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModuleInfo::setId(const QString &newId)
|
|
|
|
|
{
|
|
|
|
|
m_id = newId;
|
|
|
|
|
}
|
2023-06-12 10:46:54 +02:00
|
|
|
|
2023-06-12 15:26:31 +02:00
|
|
|
QString ModuleInfo::title() const
|
|
|
|
|
{
|
|
|
|
|
return m_title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModuleInfo::setTitle(const QString &newTitle)
|
|
|
|
|
{
|
|
|
|
|
m_title = newTitle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString ModuleInfo::description() const
|
|
|
|
|
{
|
|
|
|
|
return m_description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModuleInfo::addSection(ModuleSection *section)
|
|
|
|
|
{
|
|
|
|
|
// defensive programming here...
|
|
|
|
|
assert(section);
|
|
|
|
|
if (!section)
|
|
|
|
|
return;
|
|
|
|
|
section->setParent(this);
|
2023-06-12 23:43:22 +02:00
|
|
|
if (m_sections.contains(section))
|
|
|
|
|
return;
|
2023-06-12 15:26:31 +02:00
|
|
|
m_sections.append(section);
|
2023-06-12 23:43:22 +02:00
|
|
|
connect (section, SIGNAL(enabledChanged()), this, SIGNAL(enabledChanged()));
|
2023-06-12 15:26:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModuleInfo::setDescription(const QString &newDescription)
|
|
|
|
|
{
|
|
|
|
|
m_description = newDescription;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<ModuleSection*> ModuleInfo::sections() const
|
|
|
|
|
{
|
|
|
|
|
return m_sections;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ModuleInfo::enabled() const
|
|
|
|
|
{
|
2023-06-12 23:43:22 +02:00
|
|
|
for (auto s : m_sections) {
|
|
|
|
|
if (s->enabled())
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2023-06-12 15:26:31 +02:00
|
|
|
}
|
|
|
|
|
|
2023-06-12 23:43:22 +02:00
|
|
|
QString ModuleInfo::iconSource() const
|
2023-06-12 15:26:31 +02:00
|
|
|
{
|
2023-06-12 23:43:22 +02:00
|
|
|
return m_iconSource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ModuleInfo::setIconSource(const QString &newIconSource)
|
|
|
|
|
{
|
|
|
|
|
m_iconSource = newIconSource;
|
2023-06-12 15:26:31 +02:00
|
|
|
}
|