Commit 809d29c8 authored by Don Gagne's avatar Don Gagne

In progress indicator for vehicle sync

parent 470a46f8
...@@ -762,6 +762,7 @@ void MissionController::_autoSyncSend(void) ...@@ -762,6 +762,7 @@ void MissionController::_autoSyncSend(void)
void MissionController::_inProgressChanged(bool inProgress) void MissionController::_inProgressChanged(bool inProgress)
{ {
emit syncInProgressChanged(inProgress);
if (!inProgress && _queuedSend) { if (!inProgress && _queuedSend) {
_autoSyncSend(); _autoSyncSend();
} }
...@@ -891,3 +892,9 @@ QStringList MissionController::getMobileMissionFiles(void) ...@@ -891,3 +892,9 @@ QStringList MissionController::getMobileMissionFiles(void)
return missionFiles; return missionFiles;
} }
bool MissionController::syncInProgress(void)
{
qDebug() << _activeVehicle->missionManager()->inProgress();
return _activeVehicle->missionManager()->inProgress();
}
...@@ -43,6 +43,7 @@ public: ...@@ -43,6 +43,7 @@ public:
Q_PROPERTY(QmlObjectListModel* missionItems READ missionItems NOTIFY missionItemsChanged) Q_PROPERTY(QmlObjectListModel* missionItems READ missionItems NOTIFY missionItemsChanged)
Q_PROPERTY(QmlObjectListModel* waypointLines READ waypointLines NOTIFY waypointLinesChanged) Q_PROPERTY(QmlObjectListModel* waypointLines READ waypointLines NOTIFY waypointLinesChanged)
Q_PROPERTY(bool autoSync READ autoSync WRITE setAutoSync NOTIFY autoSyncChanged) Q_PROPERTY(bool autoSync READ autoSync WRITE setAutoSync NOTIFY autoSyncChanged)
Q_PROPERTY(bool syncInProgress READ syncInProgress NOTIFY syncInProgressChanged)
Q_INVOKABLE void start(bool editMode); Q_INVOKABLE void start(bool editMode);
Q_INVOKABLE void getMissionItems(void); Q_INVOKABLE void getMissionItems(void);
...@@ -64,12 +65,14 @@ public: ...@@ -64,12 +65,14 @@ public:
QmlObjectListModel* waypointLines(void) { return &_waypointLines; } QmlObjectListModel* waypointLines(void) { return &_waypointLines; }
bool autoSync(void) { return _autoSync; } bool autoSync(void) { return _autoSync; }
void setAutoSync(bool autoSync); void setAutoSync(bool autoSync);
bool syncInProgress(void);
signals: signals:
void missionItemsChanged(void); void missionItemsChanged(void);
void waypointLinesChanged(void); void waypointLinesChanged(void);
void autoSyncChanged(bool autoSync); void autoSyncChanged(bool autoSync);
void newItemsFromVehicle(void); void newItemsFromVehicle(void);
void syncInProgressChanged(bool syncInProgress);
private slots: private slots:
void _newMissionItemsAvailableFromVehicle(); void _newMissionItemsAvailableFromVehicle();
......
...@@ -9,7 +9,8 @@ Item { ...@@ -9,7 +9,8 @@ Item {
id: _root id: _root
signal clicked() signal clicked()
property alias buttonImage: button.source property alias buttonImage: roundButton.buttonImage
property alias rotateImage: roundButton.rotateImage
property real radius: ScreenTools.defaultFontPixelHeight * 1.5 property real radius: ScreenTools.defaultFontPixelHeight * 1.5
property int dropDirection: dropDown property int dropDirection: dropDown
property alias dropDownComponent: dropDownLoader.sourceComponent property alias dropDownComponent: dropDownLoader.sourceComponent
...@@ -38,7 +39,7 @@ Item { ...@@ -38,7 +39,7 @@ Item {
// Set up ExclusiveGroup support. We use the checked property to drive visibility of drop down. // Set up ExclusiveGroup support. We use the checked property to drive visibility of drop down.
property bool checked: false property alias checked: roundButton.checked
property ExclusiveGroup exclusiveGroup: null property ExclusiveGroup exclusiveGroup: null
onExclusiveGroupChanged: { onExclusiveGroupChanged: {
...@@ -77,7 +78,7 @@ Item { ...@@ -77,7 +78,7 @@ Item {
dropItemHolderRect.y = 0 dropItemHolderRect.y = 0
} else { } else {
dropDownItem.y = button.height + _dropMargin dropDownItem.y = roundButton.height + _dropMargin
dropItemHolderRect.y = _arrowPointHeight dropItemHolderRect.y = _arrowPointHeight
} }
...@@ -87,7 +88,7 @@ Item { ...@@ -87,7 +88,7 @@ Item {
dropDownItem.x = Math.min(dropDownItem.x + dropDownItem.width, _viewportMaxRight) - dropDownItem.width dropDownItem.x = Math.min(dropDownItem.x + dropDownItem.width, _viewportMaxRight) - dropDownItem.width
// Arrow points // Arrow points
arrowCanvas.arrowPoint.x = (button.x + radius) - dropDownItem.x arrowCanvas.arrowPoint.x = (roundButton.x + radius) - dropDownItem.x
if (dropDirection == dropUp) { if (dropDirection == dropUp) {
arrowCanvas.arrowPoint.y = dropDownItem.height arrowCanvas.arrowPoint.y = dropDownItem.height
arrowCanvas.arrowBase1.x = arrowCanvas.arrowPoint.x - (_arrowBaseWidth / 2) arrowCanvas.arrowBase1.x = arrowCanvas.arrowPoint.x - (_arrowBaseWidth / 2)
...@@ -113,7 +114,7 @@ Item { ...@@ -113,7 +114,7 @@ Item {
dropItemHolderRect.x = 0 dropItemHolderRect.x = 0
} else { } else {
dropDownItem.x = button.width + _dropMargin dropDownItem.x = roundButton.width + _dropMargin
dropItemHolderRect.x = _arrowPointHeight dropItemHolderRect.x = _arrowPointHeight
} }
...@@ -123,7 +124,7 @@ Item { ...@@ -123,7 +124,7 @@ Item {
dropDownItem.y = Math.min(dropDownItem.y + dropDownItem.height, _viewportMaxBottom) - dropDownItem.height dropDownItem.y = Math.min(dropDownItem.y + dropDownItem.height, _viewportMaxBottom) - dropDownItem.height
// Arrow points // Arrow points
arrowCanvas.arrowPoint.y = (button.y + radius) - dropDownItem.y arrowCanvas.arrowPoint.y = (roundButton.y + radius) - dropDownItem.y
if (dropDirection == dropLeft) { if (dropDirection == dropLeft) {
arrowCanvas.arrowPoint.x = dropDownItem.width arrowCanvas.arrowPoint.x = dropDownItem.width
arrowCanvas.arrowBase1.x = arrowCanvas.arrowPoint.x - _arrowPointHeight arrowCanvas.arrowBase1.x = arrowCanvas.arrowPoint.x - _arrowPointHeight
...@@ -155,29 +156,13 @@ Item { ...@@ -155,29 +156,13 @@ Item {
} }
} }
// Button RoundButton {
Rectangle { id: roundButton
anchors.fill: parent radius: parent.width / 2
radius: width / 2
border.width: ScreenTools.defaultFontPixelHeight * 0.0625
border.color: "white"
color: checked ? qgcPal.mapButtonHighlight : qgcPal.mapButton
Image { onClicked: {
id: button _root.clicked()
anchors.fill: parent }
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
MouseArea {
anchors.fill: parent
onClicked: {
checked = !checked
_root.clicked()
}
}
} // Image - button
} }
Item { Item {
......
...@@ -11,6 +11,7 @@ Item { ...@@ -11,6 +11,7 @@ Item {
signal clicked() signal clicked()
property alias buttonImage: button.source property alias buttonImage: button.source
property real radius: ScreenTools.defaultFontPixelHeight * 1.5 property real radius: ScreenTools.defaultFontPixelHeight * 1.5
property bool rotateImage: false
width: radius * 2 width: radius * 2
height: radius * 2 height: radius * 2
...@@ -26,6 +27,15 @@ Item { ...@@ -26,6 +27,15 @@ Item {
} }
} }
onRotateImageChanged: {
if (rotateImage) {
imageRotation.running = true
} else {
imageRotation.running = false
button.rotation = 0
}
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
radius: width / 2 radius: width / 2
...@@ -39,6 +49,14 @@ Item { ...@@ -39,6 +49,14 @@ Item {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
mipmap: true mipmap: true
smooth: true smooth: true
RotationAnimation on rotation {
id: imageRotation
loops: Animation.Infinite
from: 0
to: 360
duration: 500
running: false
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
......
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