1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

OP-1119 Added some progress indication with cursors and disabling of controls during operation.

This commit is contained in:
m_thread 2013-11-26 17:00:01 +01:00
parent 5738a87141
commit 7bb127445d
3 changed files with 30 additions and 1 deletions

View File

@ -119,6 +119,7 @@ Rectangle {
ComboBox {
id: flightCombo
enabled: !logManager.disableControls
property ListModel dataModel: ListModel {}
model: dataModel
Component.onCompleted: {
@ -137,6 +138,7 @@ Rectangle {
}
Button {
text: qsTr("Download logs")
enabled: !logManager.disableControls
activeFocusOnPress: true
onClicked: logManager.retrieveLogs(flightCombo.currentIndex - 1)
}
@ -151,6 +153,7 @@ Rectangle {
height: 40
Button {
id: exportButton
enabled: !logManager.disableControls
text: qsTr("Export...")
activeFocusOnPress: true
onClicked: logManager.exportLogs()
@ -160,6 +163,7 @@ Rectangle {
}
Button {
id: okButton
enabled: !logManager.disableControls
text: qsTr("OK")
activeFocusOnPress: true
onClicked: dialog.close()

View File

@ -34,7 +34,7 @@
#include "uavobjecthelper.h"
FlightLogManager::FlightLogManager(QObject *parent) :
QObject(parent)
QObject(parent), m_disableControls(false)
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
@ -86,6 +86,9 @@ QQmlListProperty<ExtendedDebugLogEntry> FlightLogManager::logEntries()
void FlightLogManager::clearAllLogs()
{
setDisableControls(true);
QApplication::setOverrideCursor(Qt::WaitCursor);
// Clear on flight side
UAVObjectUpdaterHelper updateHelper;
@ -99,10 +102,14 @@ void FlightLogManager::clearAllLogs()
}
emit logEntriesChanged();
}
QApplication::restoreOverrideCursor();
setDisableControls(false);
}
void FlightLogManager::retrieveLogs(int flightToRetrieve)
{
setDisableControls(true);
QApplication::setOverrideCursor(Qt::WaitCursor);
UAVObjectUpdaterHelper updateHelper;
@ -151,6 +158,7 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve)
}
emit logEntriesChanged();
QApplication::restoreOverrideCursor();
setDisableControls(false);
}
void FlightLogManager::exportLogs()

View File

@ -69,6 +69,7 @@ private:
class FlightLogManager : public QObject {
Q_OBJECT Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus)
Q_PROPERTY(QQmlListProperty<ExtendedDebugLogEntry> logEntries READ logEntries NOTIFY logEntriesChanged)
Q_PROPERTY(bool disableControls READ disableControls WRITE setDisableControls NOTIFY disableControlsChanged)
public:
explicit FlightLogManager(QObject *parent = 0);
@ -81,14 +82,29 @@ public:
return m_flightLogStatus;
}
bool disableControls() const
{
return m_disableControls;
}
signals:
void logEntriesChanged();
void disableControlsChanged(bool arg);
public slots:
void clearAllLogs();
void retrieveLogs(int flightToRetrieve = -1);
void exportLogs();
void setDisableControls(bool arg)
{
if (m_disableControls != arg) {
m_disableControls = arg;
emit disableControlsChanged(arg);
}
}
private:
UAVObjectManager *m_objectManager;
DebugLogControl *m_flightLogControl;
@ -97,6 +113,7 @@ private:
QList<ExtendedDebugLogEntry *> m_logEntries;
static const int UAVTALK_TIMEOUT = 4000;
bool m_disableControls;
};
#endif // FLIGHTLOGMANAGER_H