Commit aa2fb5ec authored by Samikshan Bairagya's avatar Samikshan Bairagya

Suggest optimum magnification for DSOs. Also make minor changes to how the...

Suggest optimum magnification for DSOs. Also make minor changes to how the text defining the position of the object looks so that it does not look hyperlink-type. Made some changes with regards to naming conventions as well.
parent 7ccc5256
......@@ -25,7 +25,8 @@ Rectangle {
Rectangle {
id: base
y: 89
height: 398
width: 370
height: 385
color: "transparent"
radius: 12
anchors.left: parent.left
......@@ -97,6 +98,7 @@ Rectangle {
onEntered: container.state = "planetAreaEntered"
onClicked: {
viewsRow.categorySelected(0)
oMagText.visible = false
container.state = "soTypeSelected"
}
}
......@@ -128,6 +130,7 @@ Rectangle {
onEntered: container.state = "starAreaEntered"
onClicked: {
viewsRow.categorySelected(1)
oMagText.visible = false
container.state = "soTypeSelected"
}
}
......@@ -159,6 +162,7 @@ Rectangle {
onEntered: container.state = "conAreaEntered"
onClicked: {
viewsRow.categorySelected(2)
oMagText.visible = false
container.state = "soTypeSelected"
}
}
......@@ -236,6 +240,7 @@ Rectangle {
onEntered: container.state = "galAreaEntered"
onClicked: {
viewsRow.categorySelected(3)
oMagText.visible = true
container.state = "soTypeSelected"
}
}
......@@ -275,6 +280,7 @@ Rectangle {
onEntered: container.state = "nebAreaEntered"
onClicked: {
viewsRow.categorySelected(5)
oMagText.visible = true
container.state = "soTypeSelected"
}
}
......@@ -314,6 +320,7 @@ Rectangle {
onEntered: container.state = "clustAreaEntered"
onClicked: {
viewsRow.categorySelected(4)
oMagText.visible = true
container.state = "soTypeSelected"
}
}
......@@ -428,22 +435,23 @@ Rectangle {
Text {
id: posText
objectName: "posTextObj"
x: 5
y: 49
anchors.right: parent.right
anchors.rightMargin: 10
width: 291
height: 26
color: "#ffffff"
height: 19
color: "#f7f7ac"
text: qsTr("text")
horizontalAlignment: Text.AlignRight
font.underline: true
font.italic: true
font.underline: false
font.italic: false
font.bold: true
font.pixelSize: 10
font.pixelSize: 11
}
Rectangle {
x: 0
y: 84
y: 95
width: parent.width
height: 175
color: "#00000000"
......@@ -514,12 +522,13 @@ Rectangle {
Text {
id: magText
objectName: "magTextObj"
x: 102
y: 285
x: 130
y: 277
width: 80
height: 15
color: "#ffffff"
text: qsTr("text")
anchors.horizontalCenterOffset: 0
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
......@@ -634,6 +643,22 @@ Rectangle {
}
}
Text {
id: oMagText
objectName: "oMagTextObj"
x: 8
y: 481
width: 297
height: 14
color: "#ffffff"
text: qsTr("")
opacity: 0
visible: false
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
font.pixelSize: 12
}
states: [
State {
name: "base"
......@@ -652,6 +677,11 @@ Rectangle {
target: clustText
color: "#6b6660"
}
PropertyChanges {
target: oMagText
visible: false
}
},
State {
name: "planetAreaEntered"
......@@ -1043,6 +1073,10 @@ Rectangle {
x: 236
}
PropertyChanges {
target: oMagText
opacity: 1
}
}
]
......@@ -1098,12 +1132,14 @@ Rectangle {
to: "soTypeSelected"
NumberAnimation { target: viewsRow; property: "x"; duration: 250; easing.type: Easing.InOutQuad }
NumberAnimation { target: backButton; property: "x"; duration: 250; easing.type: Easing.InOutQuad }
NumberAnimation { target: oMagText; property: "opacity"; duration: 1000; easing.type: Easing.InOutQuad }
},
Transition {
from: "soTypeSelected"
to: "base"
NumberAnimation { target: viewsRow; property: "x"; duration: 250; easing.type: Easing.InOutQuad }
NumberAnimation { target: backButton; property: "x"; duration: 250; easing.type: Easing.InOutQuad }
NumberAnimation { target: oMagText; property: "opacity"; duration: 100; easing.type: Easing.InOutQuad }
}
]
}
......@@ -46,6 +46,8 @@ WIView::WIView ( QObject *parent, ObsConditions *obs) : QObject(parent)
nextObj = baseObj->findChild<QObject *>("nextObj");
connect(nextObj, SIGNAL(nextObjTextClicked()), this, SLOT(onNextObjTextClicked()));
m_OptMag = obs->getOptimumMAG();
baseView->setResizeMode(QDeclarativeView::SizeRootObjectToView);
baseView->show();
}
......@@ -56,72 +58,15 @@ WIView::~WIView()
delete curSoItem;
}
//void WIView::onCatListItemClicked(QString category)
//{
// 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 == "Clusters")
// {
// ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::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);
// }
//}
void WIView::onCategorySelected(int type)
{
QString oMagText = QString("Suggested optimum magnification : ") + QString::number(m_OptMag);
QObject* oMagTextObj = baseObj->findChild<QObject *>("oMagTextObj");
switch(type)
{
case 0:
kDebug()<<"Planets Selected";
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Planets ));
kDebug()<<"Model created successfully";
break;
case 1:
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Stars ));
......@@ -131,12 +76,15 @@ void WIView::onCategorySelected(int type)
break;
case 3:
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Galaxies ));
oMagTextObj->setProperty("text", oMagText);
break;
case 4:
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Clusters ));
oMagTextObj->setProperty("text", oMagText);
break;
case 5:
ctxt->setContextProperty("soListModel", m->returnModel( ModelManager::Nebulae ));
oMagTextObj->setProperty("text", oMagText);
break;
}
}
......@@ -170,18 +118,6 @@ void WIView::onSoListItemClicked(int type, QString typeName, int index)
return;
}
// if (type == "Star")
// soitem = m->returnModel(ModelManager::Stars)->getSkyObjItem(index);
// else if (type == "Constellation")
// soitem = m->returnModel(ModelManager::Constellations)->getSkyObjItem(index);
// else if (type == "Planet")
// soitem = m->returnModel(ModelManager::Planets)->getSkyObjItem(index);
// else
// {
// kDebug()<<"Nothing for DSOs right now";
// return;
// }
kDebug()<<soitem->getName()<<soitem->getType();
// soTypeTextObj->setProperty("text", typeName);
// soTypeTextObj->setProperty("visible", true);
......@@ -211,12 +147,12 @@ void WIView::loadDetailsView(SkyObjItem* soitem, int index)
}
curSoItem = soitem;
curIndex = index;
m_CurIndex = index;
}
void WIView::onNextObjTextClicked()
{
int modelSize = m->returnModel(curSoItem->getTypeName())->rowCount();
SkyObjItem *nextItem = m->returnModel(curSoItem->getTypeName())->getSkyObjItem((curIndex+1)%modelSize);
loadDetailsView(nextItem, (curIndex+1)%modelSize);
SkyObjItem *nextItem = m->returnModel(curSoItem->getTypeName())->getSkyObjItem((m_CurIndex+1)%modelSize);
loadDetailsView(nextItem, (m_CurIndex+1)%modelSize);
}
......@@ -40,5 +40,6 @@ private:
QDeclarativeContext *ctxt;
ModelManager *m;
SkyObjItem *curSoItem;
int curIndex;
int m_CurIndex;
double m_OptMag;
};
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