Commit 36f2536a authored by Samikshan Bairagya's avatar Samikshan Bairagya

Hopefully got rid of most inconsistencies with whitespaces.

parent d7971494
......@@ -54,21 +54,25 @@ void ModelManager::updateModels()
KStarsData *data = KStarsData::Instance();
KSFileReader fileReader;
if ( !fileReader.open("Interesting.dat") ) return;
if (!fileReader.open("Interesting.dat")) return;
while ( fileReader.hasMoreLines() )
while (fileReader.hasMoreLines())
{
QString soTypeName;
QString line = fileReader.readLine();
SkyObject *o;
if ((o = data->skyComposite()->findByName( line )))
if ((o = data->skyComposite()->findByName(line)))
{
if (o->type() == 3 || o->type() == 4 || o->type() == 14 )
if (o->type() == SkyObject::OPEN_CLUSTER ||
o->type() == SkyObject::GLOBULAR_CLUSTER ||
o->type() == SkyObject::GALAXY_CLUSTER)
{
initobjects["Cluster"].append(o);
}
else if (o->type() == 5 || o->type() == 6 || o->type() == 15)
else if (o->type() == SkyObject::PLANETARY_NEBULA ||
o->type() == SkyObject::DARK_NEBULA ||
o->type() == SkyObject::GASEOUS_NEBULA)
{
initobjects["Nebula"].append(o);
}
......@@ -82,7 +86,7 @@ void ModelManager::updateModels()
}
}
foreach(SkyObject *so, initobjects.value("Star"))
foreach (SkyObject *so, initobjects.value("Star"))
{
//kDebug()<<so->name()<<so->mag();
if (obsconditions->isVisible(data->geo(), data->lst(), so))
......@@ -91,7 +95,7 @@ void ModelManager::updateModels()
}
}
foreach(SkyObject *so, initobjects.value("Galaxy"))
foreach (SkyObject *so, initobjects.value("Galaxy"))
{
//kDebug()<<so->name()<<so->mag();
if (obsconditions->isVisible(data->geo(), data->lst(), so))
......@@ -100,7 +104,7 @@ void ModelManager::updateModels()
}
}
foreach(SkyObject *so, initobjects.value("Constellation"))
foreach (SkyObject *so, initobjects.value("Constellation"))
{
//kDebug()<<so->name()<<so->mag();
if (obsconditions->isVisible(data->geo(), data->lst(), so))
......@@ -109,7 +113,7 @@ void ModelManager::updateModels()
}
}
foreach(SkyObject *so, initobjects.value("Cluster"))
foreach (SkyObject *so, initobjects.value("Cluster"))
{
if (obsconditions->isVisible(data->geo(), data->lst(), so))
{
......@@ -117,7 +121,7 @@ void ModelManager::updateModels()
}
}
foreach(SkyObject *so, initobjects.value("Nebula"))
foreach (SkyObject *so, initobjects.value("Nebula"))
{
//kDebug()<<so->name()<<so->mag();
if (obsconditions->isVisible(data->geo(), data->lst(), so))
......@@ -126,9 +130,9 @@ void ModelManager::updateModels()
}
}
foreach ( const QString &name, data->skyComposite()->objectNames( SkyObject::PLANET ))
foreach (const QString &name, data->skyComposite()->objectNames(SkyObject::PLANET))
{
SkyObject *so = data->skyComposite()->findByName( name );
SkyObject *so = data->skyComposite()->findByName(name);
//kDebug()<<so->name()<<so->mag();
if (obsconditions->isVisible(data->geo(), data->lst(), so))
{
......
......@@ -26,11 +26,11 @@ public:
~ModelManager();
void updateModels();
SkyObjListModel* returnModel ( int type );
SkyObjListModel *returnModel (int type);
private:
ObsConditions *obsconditions;
SkyObjListModel *planetsModel, *starsModel, *galModel, *conModel, *clustModel, *nebModel;
QStringList baseCatList, planetaryList, deepSkyList;
QHash < QString, QList <SkyObject *> > initobjects;
QHash< QString, QList <SkyObject *> > initobjects;
};
......@@ -23,7 +23,7 @@ ObsConditions::ObsConditions(int bortle, double aperture, Equipment equip, Equip
m_BortleClass(bortle), m_Aperture(aperture), m_Equip(equip), m_EqType(eqType)
{
// 't' parameter
switch ( m_EqType )
switch (m_EqType)
{
case Reflector:
m_tParam = 0.7;
......@@ -39,7 +39,7 @@ ObsConditions::~ObsConditions() {}
void ObsConditions::setLimMagnitude()
{
switch ( m_BortleClass )
switch (m_BortleClass)
{
case 1:
m_LM = 7.8; //Excellent dark-sky site
......@@ -74,14 +74,12 @@ void ObsConditions::setLimMagnitude()
}
}
double ObsConditions::getOptimumMAG()
{
double power = ( 2.81 + 2.814 * m_LM - 0.3694 * pow( m_LM , 2 ) ) / 5;
return 0.1333 * m_Aperture * sqrt( m_tParam ) * pow( power , 10 );
double power = (2.81 + 2.814 * m_LM - 0.3694 * pow(m_LM, 2)) / 5;
return 0.1333 * m_Aperture * sqrt(m_tParam ) * pow(power, 10);
}
double ObsConditions::getTrueMagLim()
{
// kDebug()<< (4.12 + 2.5 * log10( pow(aperture,2)*t ));
......@@ -98,16 +96,16 @@ double ObsConditions::getTrueMagLim()
* telescope's aperture to eye's pupil surface ratio.
*/
//kDebug() << (LM + 5*log10(aperture/7.5));
return m_LM + 5*log10(m_Aperture/7.5);
return m_LM + 5 * log10(m_Aperture / 7.5);
}
bool ObsConditions::isVisible(GeoLocation* geo, dms* lst, SkyObject* so)
bool ObsConditions::isVisible(GeoLocation *geo, dms *lst, SkyObject *so)
{
KStarsDateTime ut = geo->LTtoUT( KStarsDateTime(KDateTime::currentLocalDateTime()) );
SkyPoint sp = so->recomputeCoords( ut, geo );
KStarsDateTime ut = geo->LTtoUT(KStarsDateTime(KDateTime::currentLocalDateTime()));
SkyPoint sp = so->recomputeCoords(ut, geo);
//check altitude of object at this time.
sp.EquatorialToHorizontal( lst, geo->lat() );
sp.EquatorialToHorizontal(lst, geo->lat());
return ( sp.alt().Degrees() > 6.0 && so->mag()<getTrueMagLim() );
return (sp.alt().Degrees() > 6.0 && so->mag() < getTrueMagLim());
}
......@@ -23,7 +23,7 @@
class ObsConditions
{
public:
enum Equipment {Telescope = 0, Binoculars, Both, None };
enum Equipment { Telescope = 0, Binoculars, Both, None };
enum EquipmentType { Reflector = 0, Refractor };
ObsConditions(int bortle, double aperture, Equipment equip, EquipmentType eqType);
~ObsConditions();
......@@ -32,7 +32,7 @@ public:
void setLimMagnitude();
double getOptimumMAG();
double getTrueMagLim();
bool isVisible(GeoLocation* geo, dms* lst, SkyObject* so);
bool isVisible(GeoLocation *geo, dms *lst, SkyObject *so);
private:
int m_BortleClass;
......
......@@ -19,7 +19,7 @@
#include "kstarsdata.h"
#include "skyobjitem.h"
SkyObjItem::SkyObjItem(SkyObject* so) : m_Name(so->name()), m_TypeName(so->typeName()), m_So(so)
SkyObjItem::SkyObjItem(SkyObject *so) : m_Name(so->name()), m_TypeName(so->typeName()), m_So(so)
{
switch (so->type())
{
......@@ -65,10 +65,10 @@ QVariant SkyObjItem::data(int role)
}
}
QHash< int, QByteArray > SkyObjItem::roleNames() const
QHash<int, QByteArray> SkyObjItem::roleNames() const
{
QHash<int, QByteArray > roles;
roles[DispNameRole]="dispName";
QHash<int, QByteArray> roles;
roles[DispNameRole] = "dispName";
roles[CategoryRole] = "type";
roles[CategoryNameRole] = "typeName";
return roles;
......@@ -83,15 +83,15 @@ void SkyObjItem::setPosition(SkyObject* so)
"W", "WNW", "NW", "NNW"
} ;
KStarsData *data = KStarsData::Instance();
KStarsDateTime ut = data->geo()->LTtoUT( KStarsDateTime(KDateTime::currentLocalDateTime()) );
SkyPoint sp = so->recomputeCoords( ut, data->geo() );
KStarsDateTime ut = data->geo()->LTtoUT(KStarsDateTime(KDateTime::currentLocalDateTime()));
SkyPoint sp = so->recomputeCoords(ut, data->geo());
//check altitude of object at this time.
sp.EquatorialToHorizontal( data->lst(), data->geo()->lat() );
sp.EquatorialToHorizontal(data->lst(), data->geo()->lat());
double rounded_altitude = (int)(sp.alt().Degrees()/5.0)*5.0;
int rounded_azimuth = (int)(sp.az().Degrees()/22.5);
m_Position = QString("Now visible: ")+(QString::number(rounded_altitude))+(" degrees above the ")+(cardinals[rounded_azimuth])+(" horizon ");
m_Position = QString("Now visible: ") + (QString::number(rounded_altitude)) + (" degrees above the ") + (cardinals[rounded_azimuth]) + (" horizon ");
}
QString SkyObjItem::getDesc() const
......@@ -99,10 +99,10 @@ QString SkyObjItem::getDesc() const
if (m_Type == Planet)
{
KSFileReader fileReader;
if ( !fileReader.open("PlanetFacts.dat") )
if (!fileReader.open("PlanetFacts.dat"))
return QString("No Description found for selected sky-object");
while ( fileReader.hasMoreLines() )
while (fileReader.hasMoreLines())
{
QString line = fileReader.readLine();
if (line.split("::")[0] == m_Name)
......@@ -123,5 +123,5 @@ QString SkyObjItem::getDesc() const
QString SkyObjItem::getMagnitude() const
{
return QString("Magnitude : ")+(QString::number(m_So->mag()));
return QString("Magnitude : ") + (QString::number(m_So->mag()));
}
......@@ -34,19 +34,19 @@ public:
* \enum SkyObjectRoles
* User-defined role for the SkyObjItem
*/
enum SkyObjectRoles {DispNameRole = Qt::UserRole + 1 , CategoryRole, CategoryNameRole };
enum SkyObjectRoles { DispNameRole = Qt::UserRole + 1, CategoryRole, CategoryNameRole };
/**
* \enum Type
* The type classification for the SkyObjItem
*/
enum Type {Planet, Star, Constellation, Galaxy, Cluster, Nebula};
enum Type { Planet, Star, Constellation, Galaxy, Cluster, Nebula };
/**
* \brief Constructor
* \param so Pointer to the SkyObject which the SkyObjItem represents.
*/
SkyObjItem( SkyObject *so=0);
SkyObjItem(SkyObject *so = 0);
/**
* \brief Get data associated with a particular role for the SkyObjItem
......@@ -107,7 +107,7 @@ public:
* \brief Set current position of the sky-object in the sky.
* \param so Pointer to SkyObject for which position information is required.
*/
void setPosition(SkyObject* so);
void setPosition(SkyObject *so);
private:
QString m_Name; ///Name of sky-object
......
......@@ -17,12 +17,12 @@
#include "skyobjlistmodel.h"
SkyObjListModel::SkyObjListModel(SkyObjItem* soitem, QObject* parent): QAbstractListModel(parent)
SkyObjListModel::SkyObjListModel(SkyObjItem *soitem, QObject *parent): QAbstractListModel(parent)
{
setRoleNames(soitem->roleNames());
}
void SkyObjListModel::addSkyObject(SkyObjItem* soitem)
void SkyObjListModel::addSkyObject(SkyObjItem *soitem)
{
beginInsertRows(QModelIndex(), rowCount(), rowCount());
soItemList.append(soitem);
......@@ -44,7 +44,7 @@ QVariant SkyObjListModel::data(const QModelIndex& index, int role) const
return soitem->data(role);
}
QList< SkyObjItem* > SkyObjListModel::getSkyObjItems()
QList< SkyObjItem *> SkyObjListModel::getSkyObjItems()
{
return soItemList;
}
......@@ -53,4 +53,3 @@ SkyObjItem* SkyObjListModel::getSkyObjItem(int index)
{
return soItemList[index];
}
......@@ -26,13 +26,12 @@ class SkyObjListModel : public QAbstractListModel
{
Q_OBJECT
public:
//enum SkyObjectRoles {DispNameRole = Qt::UserRole + 1 , CategoryRole };
explicit SkyObjListModel(SkyObjItem* soitem = 0, QObject* parent = 0);
explicit SkyObjListModel(SkyObjItem *soitem = 0, QObject *parent = 0);
void addSkyObject(SkyObjItem *sobj);
int rowCount( const QModelIndex& parent = QModelIndex()) const;
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole) const;
int rowCount(const QModelIndex& parent = QModelIndex()) const;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
QList<SkyObjItem *> getSkyObjItems();
SkyObjItem* getSkyObjItem ( int index );
SkyObjItem *getSkyObjItem(int index);
private:
QList<SkyObjItem *> soItemList;
......
......@@ -21,7 +21,7 @@
#include "obsconditions.h"
#include "kdebug.h"
WIUserSettings::WIUserSettings(QWidget* parent, Qt::WindowFlags flags): QWizard(parent, flags)
WIUserSettings::WIUserSettings(QWidget *parent, Qt::WindowFlags flags): QWizard(parent, flags)
{
setupUi(this);
makeConnections();
......@@ -34,9 +34,8 @@ void WIUserSettings::makeConnections()
connect(binocularsCheck, SIGNAL( toggled(bool)), this, SLOT(slotBinocularsCheck(bool)));
}
void WIUserSettings::slotFinished( int )
void WIUserSettings::slotFinished(int)
{
eq = noEquipCheck->isEnabled()
? (ObsConditions::None)
: (telescopeCheck->isChecked()
......
......@@ -24,11 +24,11 @@ class WIView;
#include <QWizard>
#include "ui_wiusersettings.h"
class WIUserSettings : public QWizard , public Ui::WIUserSettingsUI
class WIUserSettings : public QWizard, public Ui::WIUserSettingsUI
{
Q_OBJECT
public:
WIUserSettings(QWidget* parent = 0, Qt::WindowFlags flags = 0);
WIUserSettings(QWidget *parent = 0, Qt::WindowFlags flags = 0);
public slots:
void slotFinished(int);
......
......@@ -21,7 +21,7 @@
#include "kstandarddirs.h"
WIView::WIView ( QObject *parent, ObsConditions *obs) : QObject(parent)
WIView::WIView(QObject *parent, ObsConditions *obs) : QObject(parent)
{
m = new ModelManager(obs);
......@@ -35,7 +35,7 @@ WIView::WIView ( QObject *parent, ObsConditions *obs) : QObject(parent)
baseView->setSource(KStandardDirs::locate("appdata","tools/whatsinteresting/qml/wiview.qml"));
m_BaseObj = dynamic_cast<QObject *> (baseView->rootObject());
m_BaseObj = dynamic_cast<QObject *>(baseView->rootObject());
//soTypeTextObj = m_BaseObj->findChild<QObject *>("soTypeTextObj");
......@@ -46,7 +46,7 @@ WIView::WIView ( QObject *parent, ObsConditions *obs) : QObject(parent)
connect(m_SoListObj, SIGNAL(soListItemClicked(int, QString, int)), this, SLOT(onSoListItemClicked(int, QString, int)));
m_DetailsViewObj = m_BaseObj->findChild<QObject *>("detailsViewObj");
m_NextObj = m_BaseObj->findChild<QObject *>("nextObj");
m_NextObj = m_BaseObj->findChild<QObject *>("nextObj");
connect(m_NextObj, SIGNAL(nextObjTextClicked()), this, SLOT(onNextObjTextClicked()));
m_OptMag = obs->getOptimumMAG();
......@@ -64,19 +64,19 @@ WIView::~WIView()
void WIView::onCategorySelected(int type)
{
QString oMagText = QString("Suggested optimum magnification : ") + QString::number(m_OptMag);
QObject* oMagTextObj = m_BaseObj->findChild<QObject *>("oMagTextObj");
QObject *oMagTextObj = m_BaseObj->findChild<QObject *>("oMagTextObj");
switch(type)
{
case 0: ///Planet type
case 1: ///Star type
case 2: ///Constellation type
ctxt->setContextProperty("soListModel", m->returnModel( type ));
ctxt->setContextProperty("soListModel", m->returnModel(type));
break;
case 3: ///Galaxy type
case 4: ///Cluster type
case 5: ///Nebula type
ctxt->setContextProperty("soListModel", m->returnModel( type ));
ctxt->setContextProperty("soListModel", m->returnModel(type));
oMagTextObj->setProperty("text", oMagText);
break;
}
......@@ -86,20 +86,19 @@ void WIView::onSoListItemClicked(int type, QString typeName, int index)
{
SkyObjItem *soitem = m->returnModel(type)->getSkyObjItem(index);
kDebug()<<soitem->getName()<<soitem->getType();
// soTypeTextObj->setProperty("text", typeName);
// soTypeTextObj->setProperty("visible", true);
// soListObj->setProperty("visible", false);
loadDetailsView(soitem , index);
loadDetailsView(soitem, index);
}
void WIView::loadDetailsView(SkyObjItem* soitem, int index)
void WIView::loadDetailsView(SkyObjItem *soitem, int index)
{
QObject* sonameObj = m_DetailsViewObj->findChild<QObject *>("sonameObj");
QObject* posTextObj = m_DetailsViewObj->findChild<QObject *>("posTextObj");
QObject* descTextObj = m_DetailsViewObj->findChild<QObject *>("descTextObj");
QObject* magTextObj = m_DetailsViewObj->findChild<QObject *>("magTextObj");
QObject *sonameObj = m_DetailsViewObj->findChild<QObject *>("sonameObj");
QObject *posTextObj = m_DetailsViewObj->findChild<QObject *>("posTextObj");
QObject *descTextObj = m_DetailsViewObj->findChild<QObject *>("descTextObj");
QObject *magTextObj = m_DetailsViewObj->findChild<QObject *>("magTextObj");
sonameObj->setProperty("text", soitem->getName());
posTextObj->setProperty("text", soitem->getPosition());
descTextObj->setProperty("text", soitem->getDesc());
......@@ -109,9 +108,9 @@ void WIView::loadDetailsView(SkyObjItem* soitem, int index)
SkyObject* so = soitem->getSkyObject();
KStars* data = KStars::Instance();
if (so != 0) {
data->map()->setFocusPoint( so );
data->map()->setFocusObject( so );
data->map()->setDestination( *data->map()->focusPoint() );
data->map()->setFocusPoint(so);
data->map()->setFocusObject(so);
data->map()->setDestination(*data->map()->focusPoint());
}
m_CurSoItem = soitem;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment