Commit 6b11855c authored by Tomaz Canabrava's avatar Tomaz Canabrava Committed by Daniel Agar

LinkConfiguration: use qobject_cast instead of dynamic_cast

qobject_cast is times faster dynamic_cast for objects that
inherit QObject. also, use auto keyword to not duplicate
class names.
parent ea87ffca
...@@ -118,26 +118,26 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc ...@@ -118,26 +118,26 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc
switch(source->type()) { switch(source->type()) {
#ifndef NO_SERIAL_LINK #ifndef NO_SERIAL_LINK
case TypeSerial: case TypeSerial:
dupe = new SerialConfiguration(dynamic_cast<SerialConfiguration*>(source)); dupe = new SerialConfiguration(qobject_cast<SerialConfiguration*>(source));
break; break;
#endif #endif
case TypeUdp: case TypeUdp:
dupe = new UDPConfiguration(dynamic_cast<UDPConfiguration*>(source)); dupe = new UDPConfiguration(qobject_cast<UDPConfiguration*>(source));
break; break;
case TypeTcp: case TypeTcp:
dupe = new TCPConfiguration(dynamic_cast<TCPConfiguration*>(source)); dupe = new TCPConfiguration(qobject_cast<TCPConfiguration*>(source));
break; break;
#ifdef QGC_ENABLE_BLUETOOTH #ifdef QGC_ENABLE_BLUETOOTH
case TypeBluetooth: case TypeBluetooth:
dupe = new BluetoothConfiguration(dynamic_cast<BluetoothConfiguration*>(source)); dupe = new BluetoothConfiguration(qobject_cast<BluetoothConfiguration*>(source));
break; break;
#endif #endif
case TypeLogReplay: case TypeLogReplay:
dupe = new LogReplayLinkConfiguration(dynamic_cast<LogReplayLinkConfiguration*>(source)); dupe = new LogReplayLinkConfiguration(qobject_cast<LogReplayLinkConfiguration*>(source));
break; break;
#ifdef QT_DEBUG #ifdef QT_DEBUG
case TypeMock: case TypeMock:
dupe = new MockConfiguration(dynamic_cast<MockConfiguration*>(source)); dupe = new MockConfiguration(qobject_cast<MockConfiguration*>(source));
break; break;
#endif #endif
case TypeLast: case TypeLast:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment