Skip to content

Commit

Permalink
Cleanup, removed old extension instantiation.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek committed Jan 6, 2022
1 parent eba275f commit f9565ea
Show file tree
Hide file tree
Showing 20 changed files with 5 additions and 123 deletions.
14 changes: 0 additions & 14 deletions lib/channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,20 +279,6 @@ Channel::populate(YAML::Node &node, const Context &context) {
return true;
}

/*ConfigItem *
Channel::allocateChild(QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err) {
Q_UNUSED(node); Q_UNUSED(ctx)
if (0 == strcmp("openGD77", prop.name())) {
return new OpenGD77ChannelExtension();
} else if (0 == strcmp("tyt", prop.name())) {
return new TyTChannelExtension();
}
errMsg(err) << "Cannot allocate instance for unknown child '" << prop.name() << "'.";
return nullptr;
}
*/

bool
Channel::parse(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err) {
if (! node)
Expand Down
1 change: 0 additions & 1 deletion lib/channel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public:
void setTyTChannelExtension(TyTChannelExtension *ext);

public:
//ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());

Expand Down
15 changes: 0 additions & 15 deletions lib/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -340,21 +340,6 @@ Config::readYAML(const QString &filename, const ErrorStack &err) {
return true;
}

/*ConfigItem *
Config::allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err)
{
if (ConfigItem *item = ConfigItem::allocateChild(prop, node, ctx, err))
return item;
logDebug() << "Manual instantiation of extensions.";
if (0==strcmp("tytExtension", prop.name())) {
return new TyTConfigExtension(this);
}
return nullptr;
}*/

bool
Config::parse(const YAML::Node &node, Context &ctx, const ErrorStack &err)
{
Expand Down
2 changes: 0 additions & 2 deletions lib/config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ public:
/** Imports a configuration from the given YAML file. */
bool readYAML(const QString &filename, const ErrorStack &err=ErrorStack());

/*ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err=ErrorStack());*/
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());

Expand Down
4 changes: 2 additions & 2 deletions lib/configobject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ ConfigItem::allocateChild(QMetaProperty &prop, const YAML::Node &node, const Con
}

const QMetaObject *propType = type.metaObject();
logDebug() << "Try to instantiate child of type " << prop.typeName()
/*logDebug() << "Try to instantiate child of type " << prop.typeName()
<< " for element " << prop.name()
<< " in " << this->metaObject()->className() << ".";
<< " in " << this->metaObject()->className() << ".";*/

ConfigItem *item = qobject_cast<ConfigItem *>(
propType->newInstance(Q_ARG(QObject *,this)));
Expand Down
4 changes: 3 additions & 1 deletion lib/configobject.hh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ public:
* The complete configuration must be labeled first. */
virtual YAML::Node serialize(const Context &context);

/** Allocates an instance for the given property on the given YAML node. */
/** Allocates an instance for the given property on the given YAML node.
* This is usually done automatically based on the meta-type of the property. To be able to
* instantiate the item, its default constructor must be Q_INVOKABLE. */
virtual ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err=ErrorStack());
/** Parses the given YAML node, updates the given object and updates the given context (IDs). */
Expand Down
17 changes: 0 additions & 17 deletions lib/contact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ Contact::setRing(bool enable) {
emit modified(this);
}

/*ConfigItem *
Contact::allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err) {
Q_UNUSED(prop); Q_UNUSED(node); Q_UNUSED(ctx); Q_UNUSED(err)
// There are no children yet
return nullptr;
}*/

bool
Contact::parse(const YAML::Node &node, Context &ctx, const ErrorStack &err) {
if (! node)
Expand Down Expand Up @@ -178,15 +170,6 @@ DigitalContact::setNumber(unsigned number) {
return true;
}

/*ConfigItem *
DigitalContact::allocateChild(QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err) {
Q_UNUSED(node); Q_UNUSED(ctx); Q_UNUSED(err)
if (0 == strcmp("openGD77", prop.name()))
return new OpenGD77ContactExtension();
return nullptr;
}*/

YAML::Node
DigitalContact::serialize(const Context &context) {
YAML::Node node = Contact::serialize(context);
Expand Down
3 changes: 0 additions & 3 deletions lib/contact.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public:
}

public:
/*ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err=ErrorStack());*/
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());

Expand Down Expand Up @@ -156,7 +154,6 @@ public:
void setOpenGD77ContactExtension(OpenGD77ContactExtension *ext);

public:
//ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err);
YAML::Node serialize(const Context &context);

protected:
Expand Down
7 changes: 0 additions & 7 deletions lib/gpssystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ PositioningSystem::populate(YAML::Node &node, const ConfigItem::Context &context
return true;
}

/*ConfigItem *
PositioningSystem::allocateChild(QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err) {
Q_UNUSED(prop); Q_UNUSED(node); Q_UNUSED(ctx); Q_UNUSED(err)
// No children yet
return nullptr;
}*/

bool
PositioningSystem::parse(const YAML::Node &node, Context &ctx, const ErrorStack &err) {
if (! node)
Expand Down
1 change: 0 additions & 1 deletion lib/gpssystem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public:
void setPeriod(unsigned period);

public:
//ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());

Expand Down
9 changes: 0 additions & 9 deletions lib/radioid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ RadioID::serialize(const Context &context) {
return type;
}

/*ConfigItem *
RadioID::allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err)
{
Q_UNUSED(prop); Q_UNUSED(node); Q_UNUSED(ctx); Q_UNUSED(err)
// No extensions defined yet for RadioID
return nullptr;
}*/

bool
RadioID::parse(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err) {
if (! node)
Expand Down
2 changes: 0 additions & 2 deletions lib/radioid.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public:
void setNumber(uint32_t number);

YAML::Node serialize(const Context &context);
/*ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err=ErrorStack());*/
bool parse(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
bool link(const YAML::Node &node, const ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());

Expand Down
6 changes: 0 additions & 6 deletions lib/roaming.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ RoamingZone::channels() {
return &_channel;
}

/*ConfigItem *
RoamingZone::allocateChild(QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err) {
Q_UNUSED(prop); Q_UNUSED(node); Q_UNUSED(ctx); Q_UNUSED(err)
return nullptr;
}*/


/* ********************************************************************************************* *
* Implementation of DefaultRoamingZone
Expand Down
4 changes: 0 additions & 4 deletions lib/roaming.hh
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ public:
/** Retruns the list of digital channels in this roaming zone. */
DigitalChannelRefList *channels();

public:
/*ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err=ErrorStack());*/

protected:
/** Holds the actual channels of the roaming zone. */
DigitalChannelRefList _channel;
Expand Down
8 changes: 0 additions & 8 deletions lib/rxgrouplist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ RXGroupList::serialize(const Context &context) {
return node;
}

/*ConfigItem *
RXGroupList::allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err) {
Q_UNUSED(prop); Q_UNUSED(node); Q_UNUSED(ctx); Q_UNUSED(err)
// There are no children yet.
return nullptr;
}*/

void
RXGroupList::onModified() {
emit modified(this);
Expand Down
2 changes: 0 additions & 2 deletions lib/rxgrouplist.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public:

public:
YAML::Node serialize(const Context &context);
/*ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err=ErrorStack());*/

protected slots:
/** Internal used callback to handle list modifications. */
Expand Down
14 changes: 0 additions & 14 deletions lib/scanlist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,6 @@ ScanList::setTyTScanListExtension(TyTScanListExtension *tyt) {
_tyt->setParent(this);
}

/*ConfigItem *
ScanList::allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err)
{
Q_UNUSED(node); Q_UNUSED(ctx); Q_UNUSED(err)
if (0 == strcmp("tyt", prop.name())) {
return new TyTScanListExtension();
}
errMsg(err) << "Cannot allocate instance for unknown child '" << prop.name() << "'.";
return nullptr;
}*/


/* ********************************************************************************************* *
* Implementation of ScanLists
Expand Down
4 changes: 0 additions & 4 deletions lib/scanlist.hh
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ public:
/** Sets the TyT scan-list extension. */
void setTyTScanListExtension(TyTScanListExtension *tyt);

public:
/*ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err=ErrorStack());*/

protected:
/** The channel list. */
ChannelRefList _channels;
Expand Down
7 changes: 0 additions & 7 deletions lib/zone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ ChannelRefList *Zone::B() {
return &_B;
}

/*ConfigItem *
Zone::allocateChild(QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err) {
Q_UNUSED(prop); Q_UNUSED(node); Q_UNUSED(ctx); Q_UNUSED(err)
// There are no children yet.
return nullptr;
}*/


/* ********************************************************************************************* *
* Implementation of ZoneList
Expand Down
4 changes: 0 additions & 4 deletions lib/zone.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ signals:
/** Gets emitted whenever the zone gets modified. */
void modified();

public:
/*ConfigItem *allocateChild(QMetaProperty &prop, const YAML::Node &node,
const Context &ctx, const ErrorStack &err=ErrorStack());*/

protected:
/** List of channels for VFO A. */
ChannelRefList _A;
Expand Down

0 comments on commit f9565ea

Please sign in to comment.