Telescope.cpp   Telescope.cpp 
skipping to change at line 24 skipping to change at line 24
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include "Telescope.hpp" #include "Telescope.hpp"
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
Telescope::Telescope(QSqlRecord record) Telescope::Telescope()
{ {
telescopeID = record.value("id").toInt(); }
name = record.value("name").toString();
focalLength = record.value("focalLength").toDouble(); Telescope::Telescope(const QObject& other)
diameter = record.value("diameter").toDouble(); {
hFlipped = record.value("hFlip").toBool(); this->m_diameter = other.property("diameter").toDouble();
vFlipped = record.value("vFlip").toBool(); this->m_focalLength = other.property("focalLength").toDouble();
this->m_hFlipped = other.property("hFlipped").toBool();
this->m_vFlipped = other.property("vFlipped").toBool();
this->m_name = other.property("name").toString();
} }
Telescope::~Telescope() Telescope::~Telescope()
{ {
} }
static QMap<int, QString> mapping;
QMap<int, QString> Telescope::propertyMap()
{
if(mapping.isEmpty()) {
mapping = QMap<int, QString>();
mapping[0] = "name";
mapping[1] = "diameter";
mapping[2] = "focalLength";
mapping[3] = "hFlipped";
mapping[4] = "vFlipped";
}
return mapping;
}
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Accessors & Mutators #pragma mark Accessors & Mutators
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
const QString Telescope::getName() const QString Telescope::name() const
{
return m_name;
}
void Telescope::setName(QString theValue)
{
m_name = theValue;
}
double Telescope::focalLength() const
{
return m_focalLength;
}
void Telescope::setFocalLength(double theValue)
{
m_focalLength = theValue;
}
double Telescope::diameter() const
{
return m_diameter;
}
void Telescope::setDiameter(double theValue)
{ {
return name; m_diameter = theValue;
} }
double Telescope::getFocalLength() bool Telescope::isHFlipped() const
{ {
return focalLength; return m_hFlipped;
} }
int Telescope::getTelescopeID() void Telescope::setHFlipped(bool flipped)
{ {
return telescopeID; m_hFlipped = flipped;
} }
double Telescope::getDiameter() bool Telescope::isVFlipped() const
{ {
return diameter; return m_vFlipped;
} }
bool Telescope::isHFlipped() void Telescope::setVFlipped(bool flipped)
{ {
return hFlipped; m_vFlipped = flipped;
} }
bool Telescope::isVFlipped() /* ********************************************************************* */
#if 0
#pragma mark -
#pragma mark Static Methods
#endif
/* ********************************************************************* */
Telescope* Telescope::telescopeFromSettings(QSettings* theSettings, int tel
escopeIndex)
{ {
return vFlipped; Telescope* telescope = new Telescope();
QString prefix = "telescope/" + QVariant(telescopeIndex).toString()
+ "/";
telescope->setName(theSettings->value(prefix + "name", "").toString(
));
telescope->setFocalLength(theSettings->value(prefix + "focalLength",
"0").toDouble());
telescope->setDiameter(theSettings->value(prefix + "diameter", "0").
toDouble());
telescope->setHFlipped(theSettings->value(prefix + "hFlip").toBool()
);
telescope->setVFlipped(theSettings->value(prefix + "vFlip").toBool()
);
return telescope;
}
Telescope* Telescope::telescopeModel()
{
Telescope* model = new Telescope();
model->setName("My Telescope");
model->setDiameter(80);
model->setFocalLength(500);
model->setHFlipped(true);
model->setVFlipped(true);
return model;
} }
 End of changes. 15 change blocks. 
19 lines changed or deleted 94 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/