Commit fbd8d66b authored by Don Gagne's avatar Don Gagne

Progress bar for parameter load

parent 0e492f00
...@@ -39,6 +39,8 @@ void QGCUASParamManager::connectToModelAndComms() ...@@ -39,6 +39,8 @@ void QGCUASParamManager::connectToModelAndComms()
this, SIGNAL(parameterStatusMsgUpdated(QString,int))); this, SIGNAL(parameterStatusMsgUpdated(QString,int)));
connect(&paramCommsMgr, SIGNAL(parameterListUpToDate()), this, SLOT(_parameterListUpToDate())); connect(&paramCommsMgr, SIGNAL(parameterListUpToDate()), this, SLOT(_parameterListUpToDate()));
connect(&paramCommsMgr, SIGNAL(parameterListProgress(float)), this, SIGNAL(parameterListProgress(float)));
// Pass along data model updates // Pass along data model updates
connect(&paramDataModel, SIGNAL(parameterUpdated(int, QString , QVariant )), connect(&paramDataModel, SIGNAL(parameterUpdated(int, QString , QVariant )),
......
...@@ -78,6 +78,7 @@ signals: ...@@ -78,6 +78,7 @@ signals:
void parameterStatusMsgUpdated(QString msg, int level); void parameterStatusMsgUpdated(QString msg, int level);
/** @brief We have received a complete list of all parameters onboard the MAV */ /** @brief We have received a complete list of all parameters onboard the MAV */
void parameterListUpToDate(); void parameterListUpToDate();
void parameterListProgress(float percentComplete);
/** @brief We've received an update of a parameter's value */ /** @brief We've received an update of a parameter's value */
void parameterUpdated(int compId, QString paramName, QVariant value); void parameterUpdated(int compId, QString paramName, QVariant value);
......
...@@ -52,6 +52,7 @@ public slots: ...@@ -52,6 +52,7 @@ public slots:
signals: signals:
void parameterStatusMsgUpdated(QString msg, int level); void parameterStatusMsgUpdated(QString msg, int level);
void parameterListUpToDate(); void parameterListUpToDate();
void parameterListProgress(float percentComplete);
void parameterUpdated(int compId, QString paramName, QVariant value); void parameterUpdated(int compId, QString paramName, QVariant value);
void pendingParamUpdate(int compId, const QString& paramName, QVariant value, bool isPending); void pendingParamUpdate(int compId, const QString& paramName, QVariant value, bool isPending);
}; };
......
...@@ -447,6 +447,16 @@ void UASParameterCommsMgr::receivedParameterUpdate(int uas, int compId, int para ...@@ -447,6 +447,16 @@ void UASParameterCommsMgr::receivedParameterUpdate(int uas, int compId, int para
compMissingReads->insert(i); compMissingReads->insert(i);
} }
} }
int progDiv = paramCount / 100;
if ((paramId % progDiv) == 0) {
qDebug() << paramId << paramCount;
emit parameterListProgress((float)paramId / (float)paramCount);
}
if (paramId == paramCount) {
qDebug() << "List complete";
emit parameterListProgress(0.0f);
}
} }
......
...@@ -63,6 +63,8 @@ signals: ...@@ -63,6 +63,8 @@ signals:
/** @brief We have received a complete list of all parameters onboard the MAV */ /** @brief We have received a complete list of all parameters onboard the MAV */
void parameterListUpToDate(); void parameterListUpToDate();
void parameterListProgress(float percentComplete);
void parameterUpdateRequested(int component, const QString& parameter); void parameterUpdateRequested(int component, const QString& parameter);
void parameterUpdateRequestedById(int componentId, int paramId); void parameterUpdateRequestedById(int componentId, int paramId);
......
...@@ -60,6 +60,7 @@ MainToolBar::MainToolBar(QWidget* parent) ...@@ -60,6 +60,7 @@ MainToolBar::MainToolBar(QWidget* parent)
, _showMav(true) , _showMav(true)
, _showMessages(true) , _showMessages(true)
, _showBattery(true) , _showBattery(true)
, _progressBarValue(0.0f)
, _rollDownMessages(0) , _rollDownMessages(0)
{ {
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
...@@ -312,6 +313,9 @@ void MainToolBar::_setActiveUAS(UASInterface* active) ...@@ -312,6 +313,9 @@ void MainToolBar::_setActiveUAS(UASInterface* active)
if(pUas) { if(pUas) {
disconnect(pUas, &UAS::satelliteCountChanged, this, &MainToolBar::_setSatelliteCount); disconnect(pUas, &UAS::satelliteCountChanged, this, &MainToolBar::_setSatelliteCount);
} }
QGCUASParamManagerInterface* paramMgr = _mav->getParamManager();
Q_ASSERT(paramMgr);
disconnect(paramMgr, SIGNAL(parameterListProgress(float)), this, SLOT(_setProgressBarValue(float)));
} }
// Connect new system // Connect new system
_mav = active; _mav = active;
...@@ -338,6 +342,9 @@ void MainToolBar::_setActiveUAS(UASInterface* active) ...@@ -338,6 +342,9 @@ void MainToolBar::_setActiveUAS(UASInterface* active)
_setSatelliteCount(pUas->getSatelliteCount(), QString("")); _setSatelliteCount(pUas->getSatelliteCount(), QString(""));
connect(pUas, &UAS::satelliteCountChanged, this, &MainToolBar::_setSatelliteCount); connect(pUas, &UAS::satelliteCountChanged, this, &MainToolBar::_setSatelliteCount);
} }
QGCUASParamManagerInterface* paramMgr = _mav->getParamManager();
Q_ASSERT(paramMgr);
connect(paramMgr, SIGNAL(parameterListProgress(float)), this, SLOT(_setProgressBarValue(float)));
} }
// Let toolbar know about it // Let toolbar know about it
emit mavPresentChanged(_mav != NULL); emit mavPresentChanged(_mav != NULL);
...@@ -645,3 +652,9 @@ void MainToolBar::_setSatLoc(UASInterface*, int fix) ...@@ -645,3 +652,9 @@ void MainToolBar::_setSatLoc(UASInterface*, int fix)
emit satelliteLockChanged(_satelliteLock); emit satelliteLockChanged(_satelliteLock);
} }
} }
void MainToolBar::_setProgressBarValue(float value)
{
_progressBarValue = value;
emit progressBarValueChanged(value);
}
...@@ -75,51 +75,31 @@ public: ...@@ -75,51 +75,31 @@ public:
Q_INVOKABLE void onEnterMessageArea(int x, int y); Q_INVOKABLE void onEnterMessageArea(int x, int y);
Q_INVOKABLE QString getMavIconColor(); Q_INVOKABLE QString getMavIconColor();
Q_PROPERTY(int connectionCount READ connectionCount NOTIFY connectionCountChanged) Q_PROPERTY(int connectionCount MEMBER _connectionCount NOTIFY connectionCountChanged)
Q_PROPERTY(double batteryVoltage READ batteryVoltage NOTIFY batteryVoltageChanged) Q_PROPERTY(double batteryVoltage MEMBER _batteryVoltage NOTIFY batteryVoltageChanged)
Q_PROPERTY(double batteryPercent READ batteryPercent NOTIFY batteryPercentChanged) Q_PROPERTY(double batteryPercent MEMBER _batteryPercent NOTIFY batteryPercentChanged)
Q_PROPERTY(ViewType_t currentView READ currentView NOTIFY currentViewChanged) Q_PROPERTY(ViewType_t currentView MEMBER _currentView NOTIFY currentViewChanged)
Q_PROPERTY(QStringList configList READ configList NOTIFY configListChanged) Q_PROPERTY(QStringList configList MEMBER _linkConfigurations NOTIFY configListChanged)
Q_PROPERTY(bool systemArmed READ systemArmed NOTIFY systemArmedChanged) Q_PROPERTY(bool systemArmed MEMBER _systemArmed NOTIFY systemArmedChanged)
Q_PROPERTY(unsigned int heartbeatTimeout READ heartbeatTimeout NOTIFY heartbeatTimeoutChanged) Q_PROPERTY(unsigned int heartbeatTimeout MEMBER _currentHeartbeatTimeout NOTIFY heartbeatTimeoutChanged)
Q_PROPERTY(QString currentMode READ currentMode NOTIFY currentModeChanged) Q_PROPERTY(QString currentMode MEMBER _currentMode NOTIFY currentModeChanged)
Q_PROPERTY(MessageType_t messageType READ messageType NOTIFY messageTypeChanged) Q_PROPERTY(MessageType_t messageType MEMBER _currentMessageType NOTIFY messageTypeChanged)
Q_PROPERTY(int newMessageCount READ newMessageCount NOTIFY newMessageCountChanged) Q_PROPERTY(int newMessageCount MEMBER _currentMessageCount NOTIFY newMessageCountChanged)
Q_PROPERTY(int messageCount READ messageCount NOTIFY messageCountChanged) Q_PROPERTY(int messageCount MEMBER _messageCount NOTIFY messageCountChanged)
Q_PROPERTY(QString currentConfig READ currentConfig NOTIFY currentConfigChanged) Q_PROPERTY(QString currentConfig MEMBER _currentConfig NOTIFY currentConfigChanged)
Q_PROPERTY(QString systemPixmap READ systemPixmap NOTIFY systemPixmapChanged) Q_PROPERTY(QString systemPixmap MEMBER _systemPixmap NOTIFY systemPixmapChanged)
Q_PROPERTY(int satelliteCount READ satelliteCount NOTIFY satelliteCountChanged) Q_PROPERTY(int satelliteCount MEMBER _satelliteCount NOTIFY satelliteCountChanged)
Q_PROPERTY(QStringList connectedList READ connectedList NOTIFY connectedListChanged) Q_PROPERTY(QStringList connectedList MEMBER _connectedList NOTIFY connectedListChanged)
Q_PROPERTY(bool mavPresent READ mavPresent NOTIFY mavPresentChanged) Q_PROPERTY(bool mavPresent READ mavPresent NOTIFY mavPresentChanged)
Q_PROPERTY(QString currentState READ currentState NOTIFY currentStateChanged) Q_PROPERTY(QString currentState MEMBER _currentState NOTIFY currentStateChanged)
Q_PROPERTY(int satelliteLock READ satelliteLock NOTIFY satelliteLockChanged) Q_PROPERTY(int satelliteLock MEMBER _satelliteLock NOTIFY satelliteLockChanged)
Q_PROPERTY(bool showGPS READ showGPS NOTIFY showGPSChanged) Q_PROPERTY(bool showGPS MEMBER _showGPS NOTIFY showGPSChanged)
Q_PROPERTY(bool showMav READ showMav NOTIFY showMavChanged) Q_PROPERTY(bool showMav MEMBER _showMav NOTIFY showMavChanged)
Q_PROPERTY(bool showMessages READ showMessages NOTIFY showMessagesChanged) Q_PROPERTY(bool showMessages MEMBER _showMessages NOTIFY showMessagesChanged)
Q_PROPERTY(bool showBattery READ showBattery NOTIFY showBatteryChanged) Q_PROPERTY(bool showBattery MEMBER _showBattery NOTIFY showBatteryChanged)
Q_PROPERTY(float progressBarValue MEMBER _progressBarValue NOTIFY progressBarValueChanged)
int connectionCount () { return _connectionCount; }
double batteryVoltage () { return _batteryVoltage; }
double batteryPercent () { return _batteryPercent; }
ViewType_t currentView () { return _currentView; }
QStringList configList () { return _linkConfigurations; }
bool systemArmed () { return _systemArmed; }
unsigned int heartbeatTimeout () { return _currentHeartbeatTimeout; }
QString currentMode () { return _currentMode; }
MessageType_t messageType () { return _currentMessageType; }
int newMessageCount () { return _currentMessageCount; }
int messageCount () { return _messageCount; }
QString currentConfig () { return _currentConfig; }
QString systemPixmap () { return _systemPixmap; }
int satelliteCount () { return _satelliteCount; }
QStringList connectedList () { return _connectedList; }
bool mavPresent () { return _mav != NULL; } bool mavPresent () { return _mav != NULL; }
QString currentState () { return _currentState; }
int satelliteLock () { return _satelliteLock; }
bool showGPS () { return _showGPS; }
bool showMav () { return _showMav; }
bool showMessages () { return _showMessages; }
bool showBattery () { return _showBattery; }
void setCurrentView (int currentView); void setCurrentView (int currentView);
void viewStateChanged (const QString& key, bool value); void viewStateChanged (const QString& key, bool value);
...@@ -147,6 +127,7 @@ signals: ...@@ -147,6 +127,7 @@ signals:
void showMavChanged (bool value); void showMavChanged (bool value);
void showMessagesChanged (bool value); void showMessagesChanged (bool value);
void showBatteryChanged (bool value); void showBatteryChanged (bool value);
void progressBarValueChanged (float value);
private slots: private slots:
void _setActiveUAS (UASInterface* active); void _setActiveUAS (UASInterface* active);
...@@ -166,7 +147,7 @@ private slots: ...@@ -166,7 +147,7 @@ private slots:
void _setSatelliteCount (double val, QString name); void _setSatelliteCount (double val, QString name);
void _leaveMessageView (); void _leaveMessageView ();
void _setSatLoc (UASInterface* uas, int fix); void _setSatLoc (UASInterface* uas, int fix);
void _setProgressBarValue (float value);
private: private:
void _updateConnection (LinkInterface *disconnectedLink = NULL); void _updateConnection (LinkInterface *disconnectedLink = NULL);
...@@ -203,6 +184,7 @@ private: ...@@ -203,6 +184,7 @@ private:
bool _showMav; bool _showMav;
bool _showMessages; bool _showMessages;
bool _showBattery; bool _showBattery;
float _progressBarValue;
UASMessageViewRollDown* _rollDownMessages; UASMessageViewRollDown* _rollDownMessages;
}; };
......
...@@ -526,5 +526,15 @@ Rectangle { ...@@ -526,5 +526,15 @@ Rectangle {
} }
} }
// Progress bar
Rectangle {
readonly property int progressBarHeight: 3
y: parent.height - progressBarHeight
height: progressBarHeight
width: parent.width * mainToolBar.progressBarValue
color: qgcPal.text
}
} }
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