~ubuntu-branches/debian/experimental/stellarium/experimental

« back to all changes in this revision

Viewing changes to plugins/Oculars/src/Lens.cpp

  • Committer: Package Import Robot
  • Author(s): Tomasz Buchert
  • Date: 2013-04-23 18:31:29 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20130423183129-u1bus3c87vywlmku
Tags: 0.12.1-1
* Imported Upstream version 0.12.1
* Installing icons provided by upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2009 Timothy Reaves
 
3
 * Copyright (C) 2013 Pawel Stolowski
 
4
 * Copyright (C) 2013 Alexander Wolf
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU General Public License
 
8
 * as published by the Free Software Foundation; either version 2
 
9
 * of the License, or (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
 
19
 */
 
20
 
 
21
#include "Lens.hpp"
 
22
#include <QSettings>
 
23
 
 
24
Lens::Lens()
 
25
{
 
26
}
 
27
 
 
28
Lens::Lens(const QObject& other)
 
29
{
 
30
    this->m_multipler = other.property("multipler").toDouble();
 
31
    this->m_name = other.property("name").toString();
 
32
}
 
33
 
 
34
Lens::~Lens()
 
35
{
 
36
}
 
37
 
 
38
static QMap<int, QString> mapping;
 
39
QMap<int, QString> Lens::propertyMap()
 
40
{
 
41
    if(mapping.isEmpty()) {
 
42
        mapping = QMap<int, QString>();
 
43
        mapping[0] = "name";
 
44
        mapping[1] = "multipler";
 
45
     }
 
46
    return mapping;
 
47
}
 
48
 
 
49
const QString Lens::name() const
 
50
{
 
51
    return m_name;
 
52
}
 
53
 
 
54
void Lens::setName(const QString& theValue)
 
55
{
 
56
    m_name = theValue;
 
57
}
 
58
 
 
59
double Lens::multipler() const
 
60
{
 
61
    return m_multipler;
 
62
}
 
63
 
 
64
void Lens::setMultipler(double theValue)
 
65
{
 
66
    m_multipler = theValue;
 
67
}
 
68
 
 
69
/* ********************************************************************* */
 
70
#if 0
 
71
#pragma mark -
 
72
#pragma mark Static Methods
 
73
#endif
 
74
/* ********************************************************************* */
 
75
 
 
76
Lens* Lens:: lensFromSettings(QSettings* theSettings, int lensIndex)
 
77
{
 
78
    Lens* lens = new Lens();
 
79
    QString prefix = "lens/" + QVariant(lensIndex).toString() + "/";
 
80
 
 
81
    lens->setName(theSettings->value(prefix + "name", "").toString());
 
82
    lens->setMultipler(theSettings->value(prefix + "multipler", "1").toDouble());
 
83
 
 
84
    return lens;
 
85
}
 
86
 
 
87
Lens* Lens::lensModel()
 
88
{
 
89
    Lens* model = new Lens();
 
90
    model->setName("My Lens");
 
91
    model->setMultipler(2.0f);
 
92
    return model;
 
93
}