1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00
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:
zedamota 2012-01-10 17:03:58 +00:00
parent dbd9fcda28
commit 63bb2874d7
4 changed files with 25 additions and 3 deletions

View File

@ -177,7 +177,7 @@ PluginManager *PluginManager::instance()
Create a plugin manager. Should be done only once per application.
*/
PluginManager::PluginManager()
: d(new PluginManagerPrivate(this))
: d(new PluginManagerPrivate(this)),m_allPluginsLoaded(false)
{
m_instance = this;
}
@ -586,6 +586,8 @@ void PluginManagerPrivate::loadPlugins()
loadPlugin(it.previous(), PluginSpec::Running);
}
emit q->pluginsChanged();
q->m_allPluginsLoaded=true;
emit q->pluginsLoadEnded();
}
/*!

View File

@ -56,7 +56,7 @@ class EXTENSIONSYSTEM_EXPORT PluginManager : public QObject
public:
static PluginManager *instance();
bool allPluginsLoaded(){return m_allPluginsLoaded;}
PluginManager();
virtual ~PluginManager();
@ -115,6 +115,7 @@ signals:
void aboutToRemoveObject(QObject *obj);
void pluginsChanged();
void pluginsLoadEnded();
private slots:
void startTests();
@ -122,6 +123,7 @@ private:
Internal::PluginManagerPrivate *d;
static PluginManager *m_instance;
mutable QReadWriteLock m_lock;
bool m_allPluginsLoaded;
friend class Internal::PluginManagerPrivate;
};

View File

@ -38,6 +38,7 @@
#include <QLabel>
#include <QHBoxLayout>
#include <QComboBox>
#include <QEventLoop>
namespace Core {
@ -333,6 +334,12 @@ void ConnectionManager::registerDevice(IConnection *conn, const QString &devN, c
*/
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
m_availableDevList->clear();
@ -381,4 +388,14 @@ void ConnectionManager::devChanged(IConnection *connection)
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

View File

@ -98,7 +98,7 @@ private slots:
// void onConnectionClosed(QObject *obj);
void onConnectionDestroyed(QObject *obj);
void connectionsCallBack(); //used to call devChange after all the plugins are loaded
protected:
QComboBox *m_availableDevList;
QPushButton *m_connectBtn;
@ -114,6 +114,7 @@ protected:
private:
bool connectDevice();
Internal::MainWindow *m_mainWindow;
QList <IConnection *> connectionBackup;
};