mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
GCS ConnectionManager: When plugging in a new device don't glitch the connectionwq
This commit is contained in:
parent
9912432e84
commit
3563c7376f
@ -296,7 +296,7 @@ void ConnectionManager::updateConnectionList(IConnection *connection)
|
||||
// See if device exists in the updated availability list
|
||||
bool found = false;
|
||||
foreach (IConnection::device dev, availableDev)
|
||||
if (false) // TODO: Need some way of indicating a IOConnection::device matches a devListItem
|
||||
if (iter->device == dev) // TODO: Need some way of indicating a IOConnection::device matches a devListItem
|
||||
found = true;
|
||||
|
||||
if (!found) {
|
||||
@ -307,7 +307,8 @@ void ConnectionManager::updateConnectionList(IConnection *connection)
|
||||
}
|
||||
|
||||
iter = m_devList.erase(iter);
|
||||
}
|
||||
} else
|
||||
++iter;
|
||||
}
|
||||
else
|
||||
++iter;
|
||||
@ -321,13 +322,11 @@ void ConnectionManager::updateConnectionList(IConnection *connection)
|
||||
{
|
||||
bool found = false;
|
||||
foreach (devListItem devList, m_devList)
|
||||
if (false)
|
||||
if (devList.device == dev)
|
||||
found = true;
|
||||
|
||||
if (!found) {
|
||||
QString cbName = connection->shortName() + ": " + dev.name;
|
||||
QString disp = connection->shortName() + " : " + dev.displayName;
|
||||
registerDevice(connection,cbName,dev.name,disp);
|
||||
registerDevice(connection,dev);
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,13 +338,14 @@ void ConnectionManager::updateConnectionList(IConnection *connection)
|
||||
* @param disp is the name that is displayed in the dropdown menu
|
||||
* @param name is the actual device name
|
||||
*/
|
||||
void ConnectionManager::registerDevice(IConnection *conn, const QString &devN, const QString &name, const QString &disp)
|
||||
void ConnectionManager::registerDevice(IConnection *conn, IConnection::device device)
|
||||
{
|
||||
devListItem d;
|
||||
d.connection = conn;
|
||||
d.devName = devN;
|
||||
d.Name = name;
|
||||
d.displayName=disp;
|
||||
d.device = device;
|
||||
d.devName = conn->shortName() + ": " + device.name;
|
||||
d.Name = device.name;
|
||||
d.displayName = conn->shortName() + " : " + device.displayName;
|
||||
m_devList.append(d);
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <QWidget>
|
||||
#include "mainwindow.h"
|
||||
#include "generalsettings.h"
|
||||
#include <coreplugin/iconnection.h>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QIODevice>
|
||||
#include <QtCore/QLinkedList>
|
||||
@ -58,6 +59,7 @@ namespace Internal {
|
||||
struct devListItem
|
||||
{
|
||||
IConnection *connection;
|
||||
IConnection::device device;
|
||||
QString devName;
|
||||
QString Name;
|
||||
QString displayName;
|
||||
@ -82,7 +84,7 @@ public:
|
||||
|
||||
protected:
|
||||
void updateConnectionList(IConnection *connection);
|
||||
void registerDevice(IConnection *conn, const QString &devN, const QString &name, const QString &disp);
|
||||
void registerDevice(IConnection *conn, IConnection::device device);
|
||||
devListItem findDevice(const QString &devName);
|
||||
|
||||
signals:
|
||||
|
Loading…
x
Reference in New Issue
Block a user