mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-608
Camera Stabilization settings not being read from CC board into GCS if CC is started first. Created connection callback only to be called after all plugins are loaded.
This commit is contained in:
parent
dbd9fcda28
commit
63bb2874d7
@ -177,7 +177,7 @@ PluginManager *PluginManager::instance()
|
|||||||
Create a plugin manager. Should be done only once per application.
|
Create a plugin manager. Should be done only once per application.
|
||||||
*/
|
*/
|
||||||
PluginManager::PluginManager()
|
PluginManager::PluginManager()
|
||||||
: d(new PluginManagerPrivate(this))
|
: d(new PluginManagerPrivate(this)),m_allPluginsLoaded(false)
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
}
|
}
|
||||||
@ -586,6 +586,8 @@ void PluginManagerPrivate::loadPlugins()
|
|||||||
loadPlugin(it.previous(), PluginSpec::Running);
|
loadPlugin(it.previous(), PluginSpec::Running);
|
||||||
}
|
}
|
||||||
emit q->pluginsChanged();
|
emit q->pluginsChanged();
|
||||||
|
q->m_allPluginsLoaded=true;
|
||||||
|
emit q->pluginsLoadEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -56,7 +56,7 @@ class EXTENSIONSYSTEM_EXPORT PluginManager : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static PluginManager *instance();
|
static PluginManager *instance();
|
||||||
|
bool allPluginsLoaded(){return m_allPluginsLoaded;}
|
||||||
PluginManager();
|
PluginManager();
|
||||||
virtual ~PluginManager();
|
virtual ~PluginManager();
|
||||||
|
|
||||||
@ -115,6 +115,7 @@ signals:
|
|||||||
void aboutToRemoveObject(QObject *obj);
|
void aboutToRemoveObject(QObject *obj);
|
||||||
|
|
||||||
void pluginsChanged();
|
void pluginsChanged();
|
||||||
|
void pluginsLoadEnded();
|
||||||
private slots:
|
private slots:
|
||||||
void startTests();
|
void startTests();
|
||||||
|
|
||||||
@ -122,6 +123,7 @@ private:
|
|||||||
Internal::PluginManagerPrivate *d;
|
Internal::PluginManagerPrivate *d;
|
||||||
static PluginManager *m_instance;
|
static PluginManager *m_instance;
|
||||||
mutable QReadWriteLock m_lock;
|
mutable QReadWriteLock m_lock;
|
||||||
|
bool m_allPluginsLoaded;
|
||||||
|
|
||||||
friend class Internal::PluginManagerPrivate;
|
friend class Internal::PluginManagerPrivate;
|
||||||
};
|
};
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QEventLoop>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
@ -333,6 +334,12 @@ void ConnectionManager::registerDevice(IConnection *conn, const QString &devN, c
|
|||||||
*/
|
*/
|
||||||
void ConnectionManager::devChanged(IConnection *connection)
|
void ConnectionManager::devChanged(IConnection *connection)
|
||||||
{
|
{
|
||||||
|
if(!ExtensionSystem::PluginManager::instance()->allPluginsLoaded())
|
||||||
|
{
|
||||||
|
connectionBackup.append(connection);
|
||||||
|
connect(ExtensionSystem::PluginManager::instance(),SIGNAL(pluginsLoadEnded()),this,SLOT(connectionsCallBack()),Qt::UniqueConnection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
//clear device list combobox
|
//clear device list combobox
|
||||||
m_availableDevList->clear();
|
m_availableDevList->clear();
|
||||||
|
|
||||||
@ -381,4 +388,14 @@ void ConnectionManager::devChanged(IConnection *connection)
|
|||||||
m_connectBtn->setEnabled(false);
|
m_connectBtn->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::ConnectionManager::connectionsCallBack()
|
||||||
|
{
|
||||||
|
foreach(IConnection * con,connectionBackup)
|
||||||
|
{
|
||||||
|
devChanged(con);
|
||||||
|
}
|
||||||
|
connectionBackup.clear();
|
||||||
|
disconnect(ExtensionSystem::PluginManager::instance(),SIGNAL(pluginsLoadEnded()),this,SLOT(connectionsCallBack()));
|
||||||
} //namespace Core
|
} //namespace Core
|
||||||
|
@ -98,7 +98,7 @@ private slots:
|
|||||||
|
|
||||||
// void onConnectionClosed(QObject *obj);
|
// void onConnectionClosed(QObject *obj);
|
||||||
void onConnectionDestroyed(QObject *obj);
|
void onConnectionDestroyed(QObject *obj);
|
||||||
|
void connectionsCallBack(); //used to call devChange after all the plugins are loaded
|
||||||
protected:
|
protected:
|
||||||
QComboBox *m_availableDevList;
|
QComboBox *m_availableDevList;
|
||||||
QPushButton *m_connectBtn;
|
QPushButton *m_connectBtn;
|
||||||
@ -114,6 +114,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
bool connectDevice();
|
bool connectDevice();
|
||||||
Internal::MainWindow *m_mainWindow;
|
Internal::MainWindow *m_mainWindow;
|
||||||
|
QList <IConnection *> connectionBackup;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user