Commit 0c5447b3 authored by Samikshan Bairagya's avatar Samikshan Bairagya

Modified WIView class to manage the listviews for category selection and sky-object selection.

Also changed the QML interface to get rid of the for-now-dormant details-view.
parent 488c04cd
......@@ -2,7 +2,7 @@ import QtQuick 1.0
Rectangle {
id : base
width: 800
width: 333
height: 550
gradient: Gradient {
GradientStop {
......@@ -143,13 +143,4 @@ Rectangle {
model: soListModel
}
}
Rectangle {
id: rectangle2
x: 422
y: 86
width: 342
height: 412
color: "#1d4397"
}
}
......@@ -21,7 +21,6 @@
WIView::WIView ( QObject *parent) : QObject(parent)
{
kDebug()<<"In constructor";
m = new ModelManager();
......@@ -63,8 +62,6 @@ WIView::~WIView() {}
void WIView::onCatListItemClicked(QString category)
{
kDebug()<<"inSlot";
kDebug()<<category;
if (category == "Planetary Objects")
{
kDebug()<<"Planetary Objects";
......@@ -77,25 +74,37 @@ void WIView::onCatListItemClicked(QString category)
else if (category == "Planets")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Planets ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
}
else if (category == "Stars")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Stars ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
}
else if (category == "Galaxies")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Galaxies ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
}
else if (category == "Constellations")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Constellations ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
}
else if (category == "Star Clusters")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Star_Clusters ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
}
else if (category == "Nebulae")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Nebulae ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
}
}
......@@ -15,7 +15,6 @@
* *
***************************************************************************/
//#include "skyobjectitem.h"
#include "QtDeclarative/QDeclarativeView"
#include "QModelIndex"
#include "skyobject.h"
......
......@@ -17,7 +17,6 @@
#include "ksfilereader.h"
#include "modelmanager.h"
//#include "skyobjectitem.h"
#include "kstarsdata.h"
#include "skymapcomposite.h"
#include "skyobject.h"
......@@ -43,7 +42,7 @@ void ModelManager::updateModels()
{
KStarsData *data = KStarsData::Instance();
int count = 0;
// int count = 0;
baseCatList<<"Planetary Objects"<<"Deep-sky Objects" ;
planetaryList<<"Planets"<<"Satellites";
......@@ -87,38 +86,38 @@ void ModelManager::updateModels()
foreach(SkyObject *so, initobjects.value(SkyObject::STAR))
{
kDebug()<<so->name()<<so->mag();
//kDebug()<<so->name()<<so->mag();
starsModel->addSkyObject(so);
}
foreach(SkyObject *so, initobjects.value(SkyObject::GALAXY))
{
kDebug()<<so->name()<<so->mag();
//kDebug()<<so->name()<<so->mag();
galModel->addSkyObject(so);
}
foreach(SkyObject *so, initobjects.value(SkyObject::CONSTELLATION))
{
kDebug()<<so->name()<<so->mag();
//kDebug()<<so->name()<<so->mag();
conModel->addSkyObject(so);
}
foreach(SkyObject *so, initobjects.value(SkyObject::OPEN_CLUSTER))
{
kDebug()<<so->name()<<so->mag();
//kDebug()<<so->name()<<so->mag();
starClustModel->addSkyObject(so);
}
foreach(SkyObject *so, initobjects.value(SkyObject::PLANETARY_NEBULA))
{
kDebug()<<so->name()<<so->mag();
//kDebug()<<so->name()<<so->mag();
nebModel->addSkyObject(so);
}
foreach ( const QString &name, data->skyComposite()->objectNames( SkyObject::PLANET ) )
{
SkyObject *so = data->skyComposite()->findByName( name );
kDebug()<<so->name()<<so->mag();
//kDebug()<<so->name()<<so->mag();
if (so->mag() < 7)
{
// SkyObjectItem *planetItem = new SkyObjectItem(o);
......
......@@ -51,3 +51,8 @@ QVariant SkyObjListModel::data(const QModelIndex& index, int role) const
return QVariant();
}
QList< SkyObject* > SkyObjListModel::getSkyObjects()
{
return skyObjList;
}
......@@ -30,6 +30,7 @@ public:
void addSkyObject(SkyObject *sobj);
int rowCount( const QModelIndex& parent = QModelIndex()) const;
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole) const;
QList<SkyObject *> getSkyObjects();
private:
QList<SkyObject *> skyObjList;
......
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