mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
GCS-Made the UAVO browser view options persistent.
This commit is contained in:
parent
95fb9255cc
commit
3cb9d70298
@ -26,12 +26,13 @@
|
||||
*/
|
||||
#include "uavobjectbrowser.h"
|
||||
#include "uavobjectbrowserwidget.h"
|
||||
#include "uavobjectbrowserconfiguration.h"
|
||||
|
||||
UAVObjectBrowser::UAVObjectBrowser(QString classId, UAVObjectBrowserWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
m_widget(widget),
|
||||
m_config(NULL)
|
||||
{
|
||||
connect(m_widget,SIGNAL(viewOptionsChanged(bool,bool,bool)),this,SLOT(viewOptionsChangedSlot(bool,bool,bool)));
|
||||
}
|
||||
|
||||
UAVObjectBrowser::~UAVObjectBrowser()
|
||||
@ -42,9 +43,21 @@ UAVObjectBrowser::~UAVObjectBrowser()
|
||||
void UAVObjectBrowser::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
UAVObjectBrowserConfiguration *m = qobject_cast<UAVObjectBrowserConfiguration*>(config);
|
||||
m_config=m;
|
||||
m_widget->setRecentlyUpdatedColor(m->recentlyUpdatedColor());
|
||||
m_widget->setManuallyChangedColor(m->manuallyChangedColor());
|
||||
m_widget->setRecentlyUpdatedTimeout(m->recentlyUpdatedTimeout());
|
||||
m_widget->setOnlyHilightChangedValues(m->onlyHighlightChangedValues());
|
||||
m_widget->setViewOptions(m->categorizedView(),m->scientificView(),m->showMetaData());
|
||||
}
|
||||
|
||||
void UAVObjectBrowser::viewOptionsChangedSlot(bool categorized, bool scientific, bool metadata)
|
||||
{
|
||||
if(m_config)
|
||||
{
|
||||
m_config->setCategorizedView(categorized);
|
||||
m_config->setScientificView(scientific);
|
||||
m_config->setShowMetaData(metadata);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "uavobjectbrowserwidget.h"
|
||||
#include "uavobjectbrowserconfiguration.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
@ -47,9 +48,11 @@ public:
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private slots:
|
||||
void viewOptionsChangedSlot(bool categorized,bool scientific,bool metadata);
|
||||
private:
|
||||
UAVObjectBrowserWidget *m_widget;
|
||||
UAVObjectBrowserConfiguration *m_config;
|
||||
};
|
||||
|
||||
|
||||
|
@ -31,8 +31,11 @@ UAVObjectBrowserConfiguration::UAVObjectBrowserConfiguration(QString classId, QS
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
m_recentlyUpdatedColor(QColor(255, 230, 230)),
|
||||
m_manuallyChangedColor(QColor(230, 230, 255)),
|
||||
m_onlyHilightChangedValues(false),
|
||||
m_recentlyUpdatedTimeout(500),
|
||||
m_onlyHilightChangedValues(false)
|
||||
m_useCategorizedView(false),
|
||||
m_useScientificView(false),
|
||||
m_showMetaData(false)
|
||||
{
|
||||
//if a saved configuration exists load it
|
||||
if(qSettings != 0) {
|
||||
@ -41,6 +44,9 @@ UAVObjectBrowserConfiguration::UAVObjectBrowserConfiguration(QString classId, QS
|
||||
int timeout = qSettings->value("recentlyUpdatedTimeout").toInt();
|
||||
bool hilight = qSettings->value("onlyHilightChangedValues").toBool();
|
||||
|
||||
m_useCategorizedView = qSettings->value("CategorizedView").toBool();
|
||||
m_useScientificView = qSettings->value("ScientificView").toBool();
|
||||
m_showMetaData = qSettings->value("showMetaData").toBool();
|
||||
m_recentlyUpdatedColor = recent;
|
||||
m_manuallyChangedColor = manual;
|
||||
m_recentlyUpdatedTimeout = timeout;
|
||||
@ -55,6 +61,9 @@ IUAVGadgetConfiguration *UAVObjectBrowserConfiguration::clone()
|
||||
m->m_manuallyChangedColor = m_manuallyChangedColor;
|
||||
m->m_recentlyUpdatedTimeout = m_recentlyUpdatedTimeout;
|
||||
m->m_onlyHilightChangedValues = m_onlyHilightChangedValues;
|
||||
m->m_useCategorizedView = m_useCategorizedView;
|
||||
m->m_useScientificView = m_useScientificView;
|
||||
m->m_showMetaData = m_showMetaData;
|
||||
return m;
|
||||
}
|
||||
|
||||
@ -67,4 +76,7 @@ void UAVObjectBrowserConfiguration::saveConfig(QSettings* qSettings) const {
|
||||
qSettings->setValue("manuallyChangedColor", m_manuallyChangedColor);
|
||||
qSettings->setValue("recentlyUpdatedTimeout", m_recentlyUpdatedTimeout);
|
||||
qSettings->setValue("onlyHilightChangedValues", m_onlyHilightChangedValues);
|
||||
qSettings->setValue("CategorizedView", m_useCategorizedView);
|
||||
qSettings->setValue("ScientificView", m_useScientificView);
|
||||
qSettings->setValue("showMetaData", m_showMetaData);
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ Q_PROPERTY(QColor m_recentlyUpdatedColor READ recentlyUpdatedColor WRITE setRece
|
||||
Q_PROPERTY(QColor m_manuallyChangedColor READ manuallyChangedColor WRITE setManuallyChangedColor)
|
||||
Q_PROPERTY(int m_recentlyUpdatedTimeout READ recentlyUpdatedTimeout WRITE setRecentlyUpdatedTimeout)
|
||||
Q_PROPERTY(bool m_onlyHilightChangedValues READ onlyHighlightChangedValues WRITE setOnlyHighlightChangedValues)
|
||||
Q_PROPERTY(bool m_useCategorizedView READ categorizedView WRITE setCategorizedView)
|
||||
Q_PROPERTY(bool m_useScientificView READ scientificView WRITE setScientificView)
|
||||
Q_PROPERTY(bool m_showMetaData READ showMetaData WRITE setShowMetaData)
|
||||
public:
|
||||
explicit UAVObjectBrowserConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0);
|
||||
|
||||
@ -50,6 +53,9 @@ public:
|
||||
QColor manuallyChangedColor() const { return m_manuallyChangedColor; }
|
||||
int recentlyUpdatedTimeout() const { return m_recentlyUpdatedTimeout; }
|
||||
bool onlyHighlightChangedValues() const {return m_onlyHilightChangedValues;}
|
||||
bool categorizedView() const { return m_useCategorizedView; }
|
||||
bool scientificView() const { return m_useScientificView; }
|
||||
bool showMetaData() const { return m_showMetaData; }
|
||||
|
||||
signals:
|
||||
|
||||
@ -58,12 +64,18 @@ public slots:
|
||||
void setManuallyChangedColor(QColor color) { m_manuallyChangedColor = color; }
|
||||
void setRecentlyUpdatedTimeout(int timeout) { m_recentlyUpdatedTimeout = timeout; }
|
||||
void setOnlyHighlightChangedValues(bool hilight) { m_onlyHilightChangedValues = hilight; }
|
||||
void setCategorizedView(bool value) { m_useCategorizedView = value; }
|
||||
void setScientificView(bool value) { m_useScientificView = value; }
|
||||
void setShowMetaData(bool value) { m_showMetaData = value; }
|
||||
|
||||
private:
|
||||
QColor m_recentlyUpdatedColor;
|
||||
QColor m_manuallyChangedColor;
|
||||
int m_recentlyUpdatedTimeout;
|
||||
bool m_onlyHilightChangedValues;
|
||||
bool m_useCategorizedView;
|
||||
bool m_useScientificView;
|
||||
bool m_showMetaData;
|
||||
};
|
||||
|
||||
#endif // UAVOBJECTBROWSERCONFIGURATION_H
|
||||
|
@ -66,12 +66,22 @@ UAVObjectBrowserWidget::UAVObjectBrowserWidget(QWidget *parent) : QWidget(parent
|
||||
connect(m_browser->requestButton, SIGNAL(clicked()), this, SLOT(requestUpdate()));
|
||||
connect(m_browser->tbView,SIGNAL(clicked()),this,SLOT(viewSlot()));
|
||||
connect(m_viewoptions->cbScientific, SIGNAL(toggled(bool)), this, SLOT(useScientificNotation(bool)));
|
||||
connect(m_viewoptions->cbScientific, SIGNAL(toggled(bool)), this, SLOT(viewOptionsChangedSlot()));
|
||||
connect(m_viewoptions->cbMetaData, SIGNAL(toggled(bool)), this, SLOT(viewOptionsChangedSlot()));
|
||||
connect(m_viewoptions->cbCategorized, SIGNAL(toggled(bool)), this, SLOT(viewOptionsChangedSlot()));
|
||||
enableSendRequest(false);
|
||||
}
|
||||
|
||||
UAVObjectBrowserWidget::~UAVObjectBrowserWidget()
|
||||
{
|
||||
delete m_browser;
|
||||
delete m_browser;
|
||||
}
|
||||
|
||||
void UAVObjectBrowserWidget::setViewOptions(bool categorized, bool scientific, bool metadata)
|
||||
{
|
||||
m_viewoptions->cbCategorized->setChecked(categorized);
|
||||
m_viewoptions->cbMetaData->setChecked(metadata);
|
||||
m_viewoptions->cbScientific->setChecked(scientific);
|
||||
}
|
||||
|
||||
void UAVObjectBrowserWidget::showMetaData(bool show)
|
||||
@ -231,6 +241,11 @@ void UAVObjectBrowserWidget::viewSlot()
|
||||
}
|
||||
}
|
||||
|
||||
void UAVObjectBrowserWidget::viewOptionsChangedSlot()
|
||||
{
|
||||
emit viewOptionsChanged(m_viewoptions->cbCategorized->isChecked(),m_viewoptions->cbScientific->isChecked(),m_viewoptions->cbMetaData->isChecked());
|
||||
}
|
||||
|
||||
void UAVObjectBrowserWidget::enableSendRequest(bool enable)
|
||||
{
|
||||
m_browser->sendButton->setEnabled(enable);
|
||||
|
@ -49,8 +49,7 @@ public:
|
||||
void setManuallyChangedColor(QColor color) { m_manuallyChangedColor = color; m_model->setManuallyChangedColor(color); }
|
||||
void setRecentlyUpdatedTimeout(int timeout) { m_recentlyUpdatedTimeout = timeout; m_model->setRecentlyUpdatedTimeout(timeout); }
|
||||
void setOnlyHilightChangedValues(bool hilight) { m_onlyHilightChangedValues = hilight; m_model->setOnlyHilightChangedValues(hilight); }
|
||||
|
||||
|
||||
void setViewOptions(bool categorized,bool scientific,bool metadata);
|
||||
public slots:
|
||||
void showMetaData(bool show);
|
||||
void categorize(bool categorize);
|
||||
@ -64,6 +63,9 @@ private slots:
|
||||
void eraseObject();
|
||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void viewSlot();
|
||||
void viewOptionsChangedSlot();
|
||||
signals:
|
||||
void viewOptionsChanged(bool categorized,bool scientific,bool metadata);
|
||||
private:
|
||||
QPushButton *m_requestUpdate;
|
||||
QPushButton *m_sendUpdate;
|
||||
|
Loading…
x
Reference in New Issue
Block a user