Commit 9136d539 authored by oberion's avatar oberion

Debug console bugfix

parent be676aed
......@@ -18,7 +18,7 @@
# -------------------------------------------------
message(Qt version $$[QT_VERSION])
message(Using Qt from $(QTDIR))
message(Using Qt from $$(QTDIR))
QT_DIR = $$(QTDIR)
......
......@@ -360,6 +360,7 @@ SOURCES += src/main.cc \
src/uas/UASManager.cc \
src/uas/UAS.cc \
src/comm/LinkManager.cc \
src/comm/LinkInterface.cpp \
src/comm/SerialLink.cc \
src/comm/SerialSimulationLink.cc \
src/comm/MAVLinkProtocol.cc \
......
#include "LinkInterface.h"
LinkInterface::~LinkInterface()
{
emit this->deleteLink(this);
}
\ No newline at end of file
......@@ -44,7 +44,7 @@ class LinkInterface : public QThread
Q_OBJECT
public:
LinkInterface(QObject* parent = 0) : QThread(parent) {}
//virtual ~LinkInterface() = 0;
virtual ~LinkInterface()=0;
/* Connection management */
......@@ -232,6 +232,9 @@ signals:
/** @brief Communication error occured */
void communicationError(const QString& linkname, const QString& error);
/** @brief destroying element */
void deleteLink(LinkInterface* const link);
protected:
static int getNextLinkId() {
static int nextId = 0;
......
......@@ -180,12 +180,12 @@ void DebugConsole::addLink(LinkInterface* link)
// Register for name changes
connect(link, SIGNAL(nameChanged(QString)), this, SLOT(updateLinkName(QString)));
connect(link, SIGNAL(destroyed(QObject*)), this, SLOT(removeLink(QObject*)));
connect(link, SIGNAL(deleteLink(LinkInterface* const)), this, SLOT(removeLink(LinkInterface* const)));
}
void DebugConsole::removeLink(QObject* link)
void DebugConsole::removeLink(LinkInterface* const linkInterface)
{
LinkInterface* linkInterface = dynamic_cast<LinkInterface*>(link);
//LinkInterface* linkInterface = dynamic_cast<LinkInterface*>(link);
// Add link to link list
if (links.contains(linkInterface)) {
int linkIndex = links.indexOf(linkInterface);
......@@ -194,7 +194,7 @@ void DebugConsole::removeLink(QObject* link)
m_ui->linkComboBox->removeItem(linkIndex);
}
if (link == currLink) currLink = NULL;
if (linkInterface == currLink) currLink = NULL;
}
void DebugConsole::linkSelected(int linkId)
......
......@@ -62,7 +62,7 @@ public slots:
/** @brief Add a link to the list of monitored links */
void addLink(LinkInterface* link);
/** @brief Remove a link from the list */
void removeLink(QObject* link);
void removeLink(LinkInterface* const link);
/** @brief Update a link name */
void updateLinkName(QString name);
/** @brief Select a link for the active view */
......
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