Telescope.cpp   Telescope.cpp 
skipping to change at line 29 skipping to change at line 29
#include "Telescope.hpp" #include "Telescope.hpp"
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
Telescope::Telescope() Telescope::Telescope()
: m_diameter(0.) : m_diameter(0.)
, m_focalLength(0.) , m_focalLength(0.)
, m_hFlipped(false) , m_hFlipped(false)
, m_vFlipped(false) , m_vFlipped(false)
, m_equatorial(false)
{ {
} }
Telescope::Telescope(const QObject& other) Telescope::Telescope(const QObject& other)
: m_name(other.property("name").toString()) : m_name(other.property("name").toString())
, m_diameter(other.property("diameter").toDouble()) , m_diameter(other.property("diameter").toDouble())
, m_focalLength(other.property("focalLength").toDouble()) , m_focalLength(other.property("focalLength").toDouble())
, m_hFlipped(other.property("hFlipped").toBool()) , m_hFlipped(other.property("hFlipped").toBool())
, m_vFlipped(other.property("vFlipped").toBool()) , m_vFlipped(other.property("vFlipped").toBool())
, m_equatorial(other.property("equatorial").toBool())
{ {
} }
Telescope::~Telescope() Telescope::~Telescope()
{ {
} }
static QMap<int, QString> mapping; static QMap<int, QString> mapping;
QMap<int, QString> Telescope::propertyMap() QMap<int, QString> Telescope::propertyMap()
{ {
if(mapping.isEmpty()) { if(mapping.isEmpty()) {
mapping = QMap<int, QString>(); mapping = QMap<int, QString>();
mapping[0] = "name"; mapping[0] = "name";
mapping[1] = "diameter"; mapping[1] = "diameter";
mapping[2] = "focalLength"; mapping[2] = "focalLength";
mapping[3] = "hFlipped"; mapping[3] = "hFlipped";
mapping[4] = "vFlipped"; mapping[4] = "vFlipped";
mapping[5] = "equatorial";
} }
return mapping; return mapping;
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Accessors & Mutators #pragma mark Accessors & Mutators
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
skipping to change at line 115 skipping to change at line 118
bool Telescope::isVFlipped() const bool Telescope::isVFlipped() const
{ {
return m_vFlipped; return m_vFlipped;
} }
void Telescope::setVFlipped(bool flipped) void Telescope::setVFlipped(bool flipped)
{ {
m_vFlipped = flipped; m_vFlipped = flipped;
} }
bool Telescope::isEquatorial() const
{
return m_equatorial;
}
void Telescope::setEquatorial(bool eq)
{
m_equatorial = eq;
}
void Telescope::writeToSettings(QSettings * settings, const int index) void Telescope::writeToSettings(QSettings * settings, const int index)
{ {
QString prefix = "telescope/" + QVariant(index).toString() + "/"; QString prefix = "telescope/" + QVariant(index).toString() + "/";
settings->setValue(prefix + "name", this->name()); settings->setValue(prefix + "name", this->name());
settings->setValue(prefix + "focalLength", this->focalLength()); settings->setValue(prefix + "focalLength", this->focalLength());
settings->setValue(prefix + "diameter", this->diameter()); settings->setValue(prefix + "diameter", this->diameter());
settings->setValue(prefix + "hFlip", this->isHFlipped()); settings->setValue(prefix + "hFlip", this->isHFlipped());
settings->setValue(prefix + "vFlip", this->isVFlipped()); settings->setValue(prefix + "vFlip", this->isVFlipped());
settings->setValue(prefix + "equatorial", this->isEquatorial());
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Static Methods #pragma mark Static Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
Telescope* Telescope::telescopeFromSettings(QSettings* theSettings, int tel escopeIndex) Telescope* Telescope::telescopeFromSettings(QSettings* theSettings, int tel escopeIndex)
{ {
Telescope* telescope = new Telescope(); Telescope* telescope = new Telescope();
QString prefix = "telescope/" + QVariant(telescopeIndex).toString() + "/"; QString prefix = "telescope/" + QVariant(telescopeIndex).toString() + "/";
telescope->setName(theSettings->value(prefix + "name", "").toString( )); telescope->setName(theSettings->value(prefix + "name", "").toString( ));
telescope->setFocalLength(theSettings->value(prefix + "focalLength", "0").toDouble()); telescope->setFocalLength(theSettings->value(prefix + "focalLength", "0").toDouble());
telescope->setDiameter(theSettings->value(prefix + "diameter", "0"). toDouble()); telescope->setDiameter(theSettings->value(prefix + "diameter", "0"). toDouble());
telescope->setHFlipped(theSettings->value(prefix + "hFlip").toBool() ); telescope->setHFlipped(theSettings->value(prefix + "hFlip").toBool() );
telescope->setVFlipped(theSettings->value(prefix + "vFlip").toBool() ); telescope->setVFlipped(theSettings->value(prefix + "vFlip").toBool() );
telescope->setEquatorial(theSettings->value(prefix + "equatorial").t oBool());
return telescope; return telescope;
} }
Telescope* Telescope::telescopeModel() Telescope* Telescope::telescopeModel()
{ {
Telescope* model = new Telescope(); Telescope* model = new Telescope();
model->setName("My Telescope"); model->setName("My Telescope");
model->setDiameter(80); model->setDiameter(80);
model->setFocalLength(500); model->setFocalLength(500);
model->setHFlipped(true); model->setHFlipped(true);
model->setVFlipped(true); model->setVFlipped(true);
model->setEquatorial(true);
return model; return model;
} }
 End of changes. 7 change blocks. 
1 lines changed or deleted 16 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/