Commit 2ebc129d authored by Samikshan Bairagya's avatar Samikshan Bairagya

Show type of sky-object or sky-object list in the UI

parent 06726cd6
......@@ -4,6 +4,7 @@ Rectangle {
id : base
width: 333
height: 575
anchors.fill: parent
gradient: Gradient {
GradientStop {
position: 0
......@@ -261,6 +262,7 @@ Rectangle {
y: 285
width: 80
height: 15
color: "#ffffff"
text: qsTr("text")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
......@@ -268,4 +270,22 @@ Rectangle {
}
}
}
Text {
id: soTypeText
objectName: "soTypeTextObj"
x: 189
y: 46
width: 130
height: 20
color: "#568656"
text: qsTr("text")
font.underline: true
font.italic: true
font.bold: true
verticalAlignment: Text.AlignBottom
horizontalAlignment: Text.AlignRight
font.pixelSize: 12
visible: false
}
}
......@@ -32,6 +32,8 @@ WIView::WIView ( QObject *parent) : QObject(parent)
baseView->setSource(QUrl("/home/sam/kstars/kstars/tools/WhatsInteresting/Base.qml"));
baseObj = dynamic_cast<QObject *> (baseView->rootObject());
soTypeTextObj = baseObj->findChild<QObject *>("soTypeTextObj") ;
catListObj = baseObj->findChild<QObject *>("container")->findChild<QObject *>("catListObj");
connect(catListObj, SIGNAL(catListItemClicked(QString)), this, SLOT(onCatListItemClicked(QString)));
soListObj = baseObj->findChild<QObject *>("container")->findChild<QObject *>("soListObj");
......@@ -41,6 +43,7 @@ WIView::WIView ( QObject *parent) : QObject(parent)
nextObj = baseObj->findChild<QObject *>("nextObj");
connect(nextObj, SIGNAL(nextObjTextClicked()), this, SLOT(onNextObjTextClicked()));
baseView->setResizeMode(QDeclarativeView::SizeRootObjectToView);
baseView->show();
}
......@@ -52,46 +55,62 @@ void WIView::onCatListItemClicked(QString category)
{
kDebug()<<"Planetary Objects";
ctxt->setContextProperty("catListModel", QVariant::fromValue(m->returnCatListModel( ModelManager::PlanetaryObjects )));
soTypeTextObj->setProperty("text", category);
soTypeTextObj->setProperty("visible", true);
}
else if (category == "Deep-sky Objects")
{
ctxt->setContextProperty("catListModel", QVariant::fromValue(m->returnCatListModel( ModelManager::DeepSkyObjects )));
soTypeTextObj->setProperty("text", category);
soTypeTextObj->setProperty("visible", true);
}
else if (category == "Planets")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Planets ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
soTypeTextObj->setProperty("text", category);
soTypeTextObj->setProperty("visible", true);
}
else if (category == "Stars")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Stars ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
soTypeTextObj->setProperty("text", category);
soTypeTextObj->setProperty("visible", true);
}
else if (category == "Galaxies")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Galaxies ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
soTypeTextObj->setProperty("text", category);
soTypeTextObj->setProperty("visible", true);
}
else if (category == "Constellations")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Constellations ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
soTypeTextObj->setProperty("text", category);
soTypeTextObj->setProperty("visible", true);
}
else if (category == "Star Clusters")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Star_Clusters ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
soTypeTextObj->setProperty("text", category);
soTypeTextObj->setProperty("visible", true);
}
else if (category == "Nebulae")
{
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Nebulae ));
catListObj->setProperty("visible", false);
soListObj->setProperty("visible", true);
soTypeTextObj->setProperty("text", category);
soTypeTextObj->setProperty("visible", true);
}
}
......@@ -110,6 +129,8 @@ void WIView::onSoListItemClicked(QString type, int index)
return;
}
kDebug()<<soitem->getName()<<soitem->getType();
soTypeTextObj->setProperty("text", type);
soTypeTextObj->setProperty("visible", true);
soListObj->setProperty("visible", false);
loadDetailsView(soitem , index);
......
......@@ -38,7 +38,7 @@ public slots:
void onSoListItemClicked(QString, int index);
void onNextObjTextClicked();
private:
QObject *baseObj, *catListObj, *soListObj, *detailsViewObj, *nextObj;
QObject *baseObj, *catListObj, *soListObj, *detailsViewObj, *nextObj, *soTypeTextObj;
QDeclarativeContext *ctxt;
QDeclarativeView *baseListView;
QDeclarativeView *planetaryListView;
......
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