67 lines
1.9 KiB
C++
67 lines
1.9 KiB
C++
#include "qggrifobeamupproperties.h"
|
|
|
|
#include <QMetaProperty>
|
|
|
|
QgGrifoBeamupProperties::QgGrifoBeamupProperties(QObject *parent) : QObject(parent)
|
|
{
|
|
m_simulator=false;
|
|
m_tftpFirstPort=50069;
|
|
m_tftpLastPort=0;
|
|
}
|
|
|
|
|
|
void QgGrifoBeamupProperties::saveSettings(const QString& fname)
|
|
{
|
|
QSettings s(fname, QSettings::IniFormat);
|
|
saveSettings(s);
|
|
}
|
|
|
|
QgGrifoBeamupProperties& QgGrifoBeamupProperties::instance()
|
|
{
|
|
static QgGrifoBeamupProperties theInstance(0);
|
|
return theInstance;
|
|
}
|
|
|
|
void QgGrifoBeamupProperties::saveSettings(QSettings& s)
|
|
{
|
|
s.beginGroup("GrifoBeamUp");
|
|
|
|
for(int i=metaObject()->propertyOffset(); i<this->metaObject()->propertyCount(); ++i)
|
|
{
|
|
if (metaObject()->property(i).isStored(this))
|
|
s.setValue(metaObject()->property(i).name(), this->property(metaObject()->property(i).name()));
|
|
}
|
|
//s.setValue("tftpFirstPort", m_tftpFirstPort);
|
|
//s.setValue("tftpLastPort", m_tftpLastPort<=m_tftpFirstPort ? 0 : m_tftpLastPort);
|
|
//s.setValue("simulator", m_simulator);
|
|
s.endGroup();
|
|
}
|
|
|
|
void QgGrifoBeamupProperties::restoreSettings(const QString& fname)
|
|
{
|
|
QSettings s(fname, QSettings::IniFormat);
|
|
}
|
|
|
|
void QgGrifoBeamupProperties::restoreSettings(QSettings& s)
|
|
{
|
|
s.beginGroup("GrifoBeamUp");
|
|
for(int i=metaObject()->propertyOffset(); i<this->metaObject()->propertyCount(); ++i)
|
|
{
|
|
if (metaObject()->property(i).isStored(this))
|
|
this->setProperty(metaObject()->property(i).name(), s.value(metaObject()->property(i).name()));
|
|
}
|
|
if (m_tftpFirstPort==0)
|
|
m_tftpFirstPort=50069;
|
|
//m_tftpFirstPort=s.value("tftpFirstPort", 50069).toInt();
|
|
//m_tftpLastPort=s.value("tftpLastPort", m_tftpFirstPort).toInt();
|
|
//m_simulator=s.value("simulator", false).toBool();
|
|
if (m_tftpLastPort<m_tftpFirstPort)
|
|
{
|
|
m_tftpLastPort=m_tftpFirstPort;
|
|
}
|
|
s.endGroup();
|
|
if (m_watchRemovablePath.isEmpty())
|
|
m_watchRemovablePath="GRIFO-E-Deploy";
|
|
}
|
|
|