1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

GCS - Changes reload button behavior, now loads data from persistence memory.

This commit is contained in:
zedamota 2012-05-07 14:02:58 +01:00
parent 40e215ae27
commit 9481be90af
2 changed files with 18 additions and 4 deletions

View File

@ -31,7 +31,7 @@
/**
* Constructor
*/
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);")
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);"),timeOut(NULL)
{
pm = ExtensionSystem::PluginManager::instance();
objManager = pm->getObject<UAVObjectManager>();
@ -175,6 +175,10 @@ ConfigTaskWidget::~ConfigTaskWidget()
if(oTw)
delete oTw;
}
if(timeOut)
{
delete timeOut;
}
}
void ConfigTaskWidget::saveObjectToSD(UAVObject *obj)
@ -780,7 +784,7 @@ void ConfigTaskWidget::reloadButtonClicked()
if(!list)
return;
ObjectPersistence* objper = dynamic_cast<ObjectPersistence*>( getObjectManager()->getObject(ObjectPersistence::NAME) );
QTimer * timeOut=new QTimer(this);
timeOut=new QTimer(this);
QEventLoop * eventLoop=new QEventLoop(this);
connect(timeOut, SIGNAL(timeout()),eventLoop,SLOT(quit()));
connect(objper, SIGNAL(objectUpdated(UAVObject*)), eventLoop, SLOT(quit()));
@ -799,13 +803,22 @@ void ConfigTaskWidget::reloadButtonClicked()
eventLoop->exec();
if(timeOut->isActive())
{
oTw->object->requestUpdate();
setWidgetFromField(oTw->widget,oTw->field,oTw->index,oTw->scale,oTw->isLimited);
}
timeOut->stop();
}
}
delete eventLoop;
delete timeOut;
if(eventLoop)
{
delete eventLoop;
eventLoop=NULL;
}
if(timeOut)
{
delete timeOut;
timeOut=NULL;
}
}
/**

View File

@ -164,6 +164,7 @@ private:
void disconnectWidgetUpdatesToSlot(QWidget *widget, const char *function);
void loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, double sclale);
QString outOfLimitsStyle;
QTimer * timeOut;
protected slots:
virtual void disableObjUpdates();
virtual void enableObjUpdates();