File indexing completed on 2024-04-21 15:08:00

0001 // Copyright (c) 2003 Rob Kaper <cap@capsi.com>
0002 //
0003 // This library is free software; you can redistribute it and/or
0004 // modify it under the terms of the GNU Lesser General Public
0005 // License version 2.1 as published by the Free Software Foundation.
0006 //
0007 // This library is distributed in the hope that it will be useful,
0008 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0010 // Lesser General Public License for more details.
0011 //
0012 // You should have received a copy of the GNU Lesser General Public License
0013 // along with this library; see the file COPYING.LIB.  If not, write to
0014 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0015 // Boston, MA 02110-1301, USA.
0016 
0017 #include "configoption.h"
0018 
0019 ConfigOption::ConfigOption(int configId)
0020     : QObject()
0021     , m_id(configId)
0022     , m_changed(false)
0023     , m_edit(false)
0024 {
0025 }
0026 
0027 int ConfigOption::id() const
0028 {
0029     return m_id;
0030 }
0031 
0032 void ConfigOption::setName(const QString &name)
0033 {
0034     if (m_name != name)
0035     {
0036         m_name = name;
0037         m_changed = true;
0038     }
0039 }
0040 
0041 QString ConfigOption::name() const
0042 {
0043     return m_name;
0044 }
0045 
0046 void ConfigOption::setDescription(const QString &description)
0047 {
0048     if (m_description != description)
0049     {
0050         m_description = description;
0051         m_changed = true;
0052     }
0053 }
0054 
0055 QString ConfigOption::description() const
0056 {
0057     return m_description;
0058 }
0059 
0060 void ConfigOption::setEdit(bool edit)
0061 {
0062     if (m_edit != edit)
0063     {
0064         m_edit = edit;
0065         m_changed = true;
0066     }
0067 }
0068 
0069 bool ConfigOption::edit() const
0070 {
0071     return m_edit;
0072 }
0073 
0074 void ConfigOption::setType(const QString &type)
0075 {
0076     if (m_type != type)
0077     {
0078         m_type = type;
0079         m_changed = true;
0080     }
0081 }
0082 
0083 QString ConfigOption::type() const
0084 {
0085     return m_type;
0086 }
0087 
0088 void ConfigOption::setValue(const QString &value)
0089 {
0090     if (m_value != value)
0091     {
0092         m_value = value;
0093         m_changed = true;
0094     }
0095 }
0096 
0097 QString ConfigOption::value() const
0098 {
0099     return m_value;
0100 }
0101 
0102 void ConfigOption::update(bool force)
0103 {
0104     if (m_changed || force)
0105     {
0106         Q_EMIT changed(this);
0107         m_changed = false;
0108     }
0109 }
0110 
0111 #include "moc_configoption.cpp"