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());
|
setBackgroundImageFile(config->backgroundImageFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PfdQmlContext::saveState(QSettings *settings)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PfdQmlContext::restoreState(QSettings *settings)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void PfdQmlContext::apply(QQmlContext *context)
|
void PfdQmlContext::apply(QQmlContext *context)
|
||||||
{
|
{
|
||||||
QStringList objectsToExport;
|
QStringList objectsToExport;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "pfdqmlgadgetconfiguration.h"
|
#include "pfdqmlgadgetconfiguration.h"
|
||||||
|
|
||||||
class QQmlContext;
|
class QQmlContext;
|
||||||
|
class QSettings;
|
||||||
|
|
||||||
class PfdQmlContext : public QObject {
|
class PfdQmlContext : public QObject {
|
||||||
Q_OBJECT Q_PROPERTY(QString speedUnit READ speedUnit WRITE setSpeedUnit NOTIFY speedUnitChanged)
|
Q_OBJECT Q_PROPERTY(QString speedUnit READ speedUnit WRITE setSpeedUnit NOTIFY speedUnitChanged)
|
||||||
@ -94,6 +95,9 @@ public:
|
|||||||
Q_INVOKABLE void resetConsumedEnergy();
|
Q_INVOKABLE void resetConsumedEnergy();
|
||||||
|
|
||||||
void loadConfiguration(PfdQmlGadgetConfiguration *config);
|
void loadConfiguration(PfdQmlGadgetConfiguration *config);
|
||||||
|
void saveState(QSettings *);
|
||||||
|
void restoreState(QSettings *);
|
||||||
|
|
||||||
void apply(QQmlContext *context);
|
void apply(QQmlContext *context);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -51,3 +51,13 @@ void PfdQmlGadget::loadConfiguration(IUAVGadgetConfiguration *config)
|
|||||||
|
|
||||||
m_qmlGadgetWidget->loadConfiguration(m);
|
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();
|
QWidget *widget();
|
||||||
|
|
||||||
void loadConfiguration(IUAVGadgetConfiguration *config);
|
void loadConfiguration(IUAVGadgetConfiguration *config);
|
||||||
|
void saveState(QSettings *);
|
||||||
|
void restoreState(QSettings *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PfdQmlGadgetWidget *m_qmlGadgetWidget;
|
PfdQmlGadgetWidget *m_qmlGadgetWidget;
|
||||||
|
@ -93,6 +93,16 @@ void PfdQmlGadgetWidget::loadConfiguration(PfdQmlGadgetConfiguration *config)
|
|||||||
setQmlFile(config->qmlFile());
|
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)
|
void PfdQmlGadgetWidget::setQmlFile(QString fn)
|
||||||
{
|
{
|
||||||
qDebug() << "PfdQmlGadgetWidget::setQmlFile" << fn;
|
qDebug() << "PfdQmlGadgetWidget::setQmlFile" << fn;
|
||||||
@ -117,6 +127,7 @@ void PfdQmlGadgetWidget::setQmlFile(QString fn)
|
|||||||
|
|
||||||
QUrl url = QUrl::fromLocalFile(fn);
|
QUrl url = QUrl::fromLocalFile(fn);
|
||||||
engine()->setBaseUrl(url);
|
engine()->setBaseUrl(url);
|
||||||
|
|
||||||
setSource(url);
|
setSource(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QQmlEngine;
|
class QQmlEngine;
|
||||||
|
class QSettings;
|
||||||
class QuickWidgetProxy;
|
class QuickWidgetProxy;
|
||||||
class PfdQmlContext;
|
class PfdQmlContext;
|
||||||
|
|
||||||
@ -45,6 +46,8 @@ public:
|
|||||||
virtual ~PfdQmlGadgetWidget();
|
virtual ~PfdQmlGadgetWidget();
|
||||||
|
|
||||||
void loadConfiguration(PfdQmlGadgetConfiguration *config);
|
void loadConfiguration(PfdQmlGadgetConfiguration *config);
|
||||||
|
void saveState(QSettings *);
|
||||||
|
void restoreState(QSettings *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setQmlFile(QString);
|
void setQmlFile(QString);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user