mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-16 08:29:15 +01:00
LP-29 add state save/restore to PFD Qml gadget
This commit is contained in:
parent
f11e9c6e41
commit
a93f182582
@ -278,6 +278,15 @@ void PfdQmlContext::loadConfiguration(PfdQmlGadgetConfiguration *config)
|
||||
setBackgroundImageFile(config->backgroundImageFile());
|
||||
}
|
||||
|
||||
|
||||
void PfdQmlContext::saveState(QSettings *settings)
|
||||
{
|
||||
}
|
||||
|
||||
void PfdQmlContext::restoreState(QSettings *settings)
|
||||
{
|
||||
}
|
||||
|
||||
void PfdQmlContext::apply(QQmlContext *context)
|
||||
{
|
||||
QStringList objectsToExport;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "pfdqmlgadgetconfiguration.h"
|
||||
|
||||
class QQmlContext;
|
||||
class QSettings;
|
||||
|
||||
class PfdQmlContext : public QObject {
|
||||
Q_OBJECT Q_PROPERTY(QString speedUnit READ speedUnit WRITE setSpeedUnit NOTIFY speedUnitChanged)
|
||||
@ -94,6 +95,9 @@ public:
|
||||
Q_INVOKABLE void resetConsumedEnergy();
|
||||
|
||||
void loadConfiguration(PfdQmlGadgetConfiguration *config);
|
||||
void saveState(QSettings *);
|
||||
void restoreState(QSettings *);
|
||||
|
||||
void apply(QQmlContext *context);
|
||||
|
||||
signals:
|
||||
|
@ -51,3 +51,13 @@ void PfdQmlGadget::loadConfiguration(IUAVGadgetConfiguration *config)
|
||||
|
||||
m_qmlGadgetWidget->loadConfiguration(m);
|
||||
}
|
||||
|
||||
void PfdQmlGadget::saveState(QSettings *settings)
|
||||
{
|
||||
m_qmlGadgetWidget->saveState(settings);
|
||||
}
|
||||
|
||||
void PfdQmlGadget::restoreState(QSettings *settings)
|
||||
{
|
||||
m_qmlGadgetWidget->restoreState(settings);
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
QWidget *widget();
|
||||
|
||||
void loadConfiguration(IUAVGadgetConfiguration *config);
|
||||
void saveState(QSettings *);
|
||||
void restoreState(QSettings *);
|
||||
|
||||
private:
|
||||
PfdQmlGadgetWidget *m_qmlGadgetWidget;
|
||||
|
@ -93,6 +93,16 @@ void PfdQmlGadgetWidget::loadConfiguration(PfdQmlGadgetConfiguration *config)
|
||||
setQmlFile(config->qmlFile());
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::saveState(QSettings *settings)
|
||||
{
|
||||
m_pfdQmlContext->saveState(settings);
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::restoreState(QSettings *settings)
|
||||
{
|
||||
m_pfdQmlContext->restoreState(settings);
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setQmlFile(QString fn)
|
||||
{
|
||||
qDebug() << "PfdQmlGadgetWidget::setQmlFile" << fn;
|
||||
@ -117,6 +127,7 @@ void PfdQmlGadgetWidget::setQmlFile(QString fn)
|
||||
|
||||
QUrl url = QUrl::fromLocalFile(fn);
|
||||
engine()->setBaseUrl(url);
|
||||
|
||||
setSource(url);
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
class QQmlEngine;
|
||||
class QSettings;
|
||||
class QuickWidgetProxy;
|
||||
class PfdQmlContext;
|
||||
|
||||
@ -45,6 +46,8 @@ public:
|
||||
virtual ~PfdQmlGadgetWidget();
|
||||
|
||||
void loadConfiguration(PfdQmlGadgetConfiguration *config);
|
||||
void saveState(QSettings *);
|
||||
void restoreState(QSettings *);
|
||||
|
||||
private:
|
||||
void setQmlFile(QString);
|
||||
|
Loading…
x
Reference in New Issue
Block a user