Feature Class Reference

#include <feature.h>

Inheritance diagram for Feature:

Inheritance graph
[legend]
Collaboration diagram for Feature:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 52 of file feature.h.

Signals

void changed ()

Public Member Functions

QString key () const
void setTitle (const QString &title)
QString title () const
void setSection (const QString &section)
QString section () const
void setDescription (const QString &description)
QString description () const
void addRelation (const QString &key)
void setRelations (const QStringList &keys)
QList< Feature * > relations () const
void addDependency (const QString &dependency)
void setDependencies (const QStringList &dependencies)
QList< Feature * > dependencies () const
QList< Feature * > supports () const
QString getDocumentation () const
void setEnabled (bool on)
bool enabled () const
bool selectable () const
QString toHtml () const
 ~Feature ()

Static Public Member Functions

static FeaturegetInstance (const QString &key)
static void clear ()

Private Member Functions

 Feature (const QString &key)
void updateSelectable ()

Private Attributes

FeaturePrivated

Static Private Attributes

static QMap< QString, Feature * > instances


Constructor & Destructor Documentation

Feature::~Feature (  ) 

Definition at line 40 of file feature.cpp.

References d.

00041 {
00042     delete d;
00043 }

Feature::Feature ( const QString key  )  [private]

Definition at line 122 of file feature.cpp.

Referenced by getInstance().

00122 : d(new FeaturePrivate(key)) {}


Member Function Documentation

Feature * Feature::getInstance ( const QString key  )  [static]

Definition at line 32 of file feature.cpp.

References QMap< Key, T >::contains(), Feature(), instances, key(), and QString::toUpper().

Referenced by addDependency(), addRelation(), Main::loadFeatures(), FeatureTreeModel::readConfig(), and Main::showInfo().

00033 {
00034     QString ukey = key.toUpper();
00035     if (!instances.contains(ukey))
00036         instances[ukey] = new Feature(ukey);
00037     return instances[ukey];
00038 }

Here is the call graph for this function:

void Feature::clear (  )  [static]

Definition at line 45 of file feature.cpp.

References QMap< Key, T >::clear(), instances, and QMap< Key, T >::values().

Referenced by FeatureTreeModel::clear(), and Main::loadFeatures().

00046 {
00047     foreach (Feature *f, instances.values())
00048         delete f;
00049     instances.clear();
00050 }

Here is the call graph for this function:

QString Feature::key (  )  const [inline]

Definition at line 61 of file feature.h.

References d, and FeaturePrivate::key.

Referenced by addDependency(), addRelation(), FeatureTreeModel::data(), FeatureTreeModel::findDisabled(), getInstance(), listToHtml(), nodePtrLessThan(), setDependencies(), setRelations(), and toHtml().

00061 { return d->key; }

void Feature::setTitle ( const QString title  ) 

Definition at line 124 of file feature.cpp.

References d, FeaturePrivate::title, and title().

Referenced by Main::loadFeatures().

00125 {
00126     d->title = title;
00127 }

Here is the call graph for this function:

QString Feature::title (  )  const [inline]

Definition at line 64 of file feature.h.

References d, and FeaturePrivate::title.

Referenced by FeatureTreeModel::data(), setTitle(), and toHtml().

00064 { return d->title; }

void Feature::setSection ( const QString section  ) 

Definition at line 129 of file feature.cpp.

References d, section(), and FeaturePrivate::section.

Referenced by Main::loadFeatures().

00130 {
00131     d->section = section;
00132 }

Here is the call graph for this function:

QString Feature::section (  )  const [inline]

Definition at line 67 of file feature.h.

References d, and FeaturePrivate::section.

Referenced by FeatureTreeModel::addFeature(), setSection(), and toHtml().

00067 { return d->section; }

void Feature::setDescription ( const QString description  ) 

Definition at line 134 of file feature.cpp.

References d, description(), and FeaturePrivate::description.

Referenced by Main::loadFeatures().

00135 {
00136     d->description = description;
00137 }

Here is the call graph for this function:

QString Feature::description (  )  const [inline]

Definition at line 70 of file feature.h.

References d, and FeaturePrivate::description.

Referenced by Main::loadFeatures(), setDescription(), and toHtml().

00070 { return d->description; };

void Feature::addRelation ( const QString key  ) 

Definition at line 139 of file feature.cpp.

References d, getInstance(), QSet< T >::insert(), key(), and FeaturePrivate::relations.

Referenced by setRelations().

00140 {
00141     d->relations.insert(getInstance(key));
00142 }

Here is the call graph for this function:

void Feature::setRelations ( const QStringList keys  ) 

Definition at line 144 of file feature.cpp.

References addRelation(), and key().

Referenced by Main::loadFeatures().

00145 {
00146     foreach(QString key, keys)
00147         if (key != "???")
00148             addRelation(key);
00149 }

Here is the call graph for this function:

QList< Feature * > Feature::relations (  )  const

Definition at line 151 of file feature.cpp.

References d, FeaturePrivate::relations, and QSet< T >::toList().

Referenced by toHtml().

00152 {
00153     return d->relations.toList();
00154 }

Here is the call graph for this function:

void Feature::addDependency ( const QString dependency  ) 

Definition at line 156 of file feature.cpp.

References d, FeaturePrivate::dependencies, getInstance(), QSet< T >::insert(), key(), and FeaturePrivate::supports.

Referenced by setDependencies().

00157 {
00158     Feature *f = getInstance(key);
00159     d->dependencies.insert(f);
00160     f->d->supports.insert(this);
00161 }

Here is the call graph for this function:

void Feature::setDependencies ( const QStringList dependencies  ) 

Definition at line 163 of file feature.cpp.

References addDependency(), and key().

Referenced by Main::loadFeatures().

00164 {
00165     foreach(QString key, keys)
00166         addDependency(key);
00167 }

Here is the call graph for this function:

QList< Feature * > Feature::dependencies (  )  const

Definition at line 169 of file feature.cpp.

References d, FeaturePrivate::dependencies, and QSet< T >::toList().

Referenced by toHtml(), and updateSelectable().

00170 {
00171     return d->dependencies.toList();
00172 }

Here is the call graph for this function:

QList< Feature * > Feature::supports (  )  const

Definition at line 174 of file feature.cpp.

References d, FeaturePrivate::supports, and QSet< T >::toList().

Referenced by Node::insert(), setEnabled(), toHtml(), and updateSelectable().

00175 {
00176     return d->supports.toList();
00177 }

Here is the call graph for this function:

QString Feature::getDocumentation (  )  const

Definition at line 182 of file feature.cpp.

References d, and FeaturePrivate::title.

00183 {
00184     return QString() + "<h2>" + d->title + "</h2>";
00185 
00186 }

void Feature::setEnabled ( bool  on  ) 

Definition at line 188 of file feature.cpp.

References changed(), d, emit, FeaturePrivate::enabled, supports(), and updateSelectable().

Referenced by FeatureTreeModel::readConfig(), and FeatureTreeModel::setData().

00189 {
00190     if (on == d->enabled)
00191         return;
00192 
00193     d->enabled = on;
00194     foreach (Feature *f, supports())
00195   f->updateSelectable();
00196     emit changed();
00197 }

Here is the call graph for this function:

bool Feature::enabled (  )  const [inline]

Definition at line 84 of file feature.h.

References d, and FeaturePrivate::enabled.

Referenced by FeatureTreeModel::data(), FeatureTreeModel::findDisabled(), listToHtml(), and updateSelectable().

00084 { return d->enabled; };

bool Feature::selectable (  )  const [inline]

Definition at line 86 of file feature.h.

References d, and FeaturePrivate::selectable.

Referenced by FeatureTreeModel::data(), listToHtml(), and updateSelectable().

00086 { return d->selectable; }

QString Feature::toHtml (  )  const

Definition at line 104 of file feature.cpp.

References dependencies(), description(), isEmpty(), key(), linkify(), listToHtml(), relations(), section(), QTest::stream, supports(), and title().

00105 {
00106     QString str;
00107     QTextStream stream(&str);
00108 
00109     stream << "<h2><font size=\"+2\" color=\"darkBlue\">"
00110            << key() << "</font></h2>"
00111      << "<h2><font size=\"+2\">" << title() << "</font></h2>";
00112     if (!description().isEmpty())
00113         stream << "<p>" << description() << "</p>";
00114     stream << listToHtml("Section", QStringList(section()))
00115      << listToHtml("Requires", dependencies())
00116      << listToHtml("Required for", supports())
00117      << listToHtml("See also", relations());
00118 
00119     return linkify(str);
00120 }

Here is the call graph for this function:

void Feature::changed (  )  [signal]

Referenced by setEnabled(), and updateSelectable().

void Feature::updateSelectable (  )  [private]

Definition at line 203 of file feature.cpp.

References changed(), d, dependencies(), emit, enabled(), FeaturePrivate::selectable, selectable(), supports(), and updateSelectable().

Referenced by setEnabled(), and updateSelectable().

00204 {
00205     bool selectable = true;
00206     foreach (Feature *f, dependencies())
00207         if (!f->selectable() || !f->enabled())
00208             selectable = false;
00209     if (selectable != d->selectable) {
00210         d->selectable = selectable;
00211         foreach (Feature *f, supports())
00212             f->updateSelectable();
00213         emit changed();
00214     }
00215 }

Here is the call graph for this function:


Member Data Documentation

QMap< QString, Feature * > Feature::instances [static, private]

Definition at line 99 of file feature.h.

Referenced by clear(), and getInstance().

FeaturePrivate* Feature::d [private]

Definition at line 100 of file feature.h.

Referenced by addDependency(), addRelation(), dependencies(), description(), enabled(), getDocumentation(), key(), relations(), section(), selectable(), setDescription(), setEnabled(), setSection(), setTitle(), supports(), title(), updateSelectable(), and ~Feature().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 14:58:46 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1