Commit c0d3e385 authored by Samikshan Bairagya's avatar Samikshan Bairagya

Do not slew the skymap to sky-object on selecting it from the ListView. Rather...

Do not slew the skymap to sky-object on selecting it from the ListView. Rather have a button in the details-view
to let the user do this after having a look at the details. Also changed the way the details-view looks in the
QML interface by rearranging its different components and by adding different components like surface brightness,
size and a new button "More object details".
parent b782780a
......@@ -449,17 +449,16 @@ Rectangle {
border.width: 4
border.color: "#000000"
anchors.left: categoryView.right
Text {
id: soname
objectName: "sonameObj"
x: 5
y: 5
y: 8
width: 273
height: 44
height: 22
color: "#ffffff"
text: qsTr("text")
anchors.left: parent.left
anchors.leftMargin: 8
font.bold: true
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
......@@ -470,7 +469,7 @@ Rectangle {
id: posText
x: 10
objectName: "posTextObj"
y: 49
y: 35
anchors.right: parent.right
anchors.rightMargin: 10
width: 320
......@@ -488,11 +487,13 @@ Rectangle {
Rectangle {
id: descTextBox
x: 0
y: 95
y: 160
width: parent.width
height: 175
color: "#00000000"
radius: 10
anchors.horizontalCenterOffset: 0
anchors.horizontalCenter: parent.horizontalCenter
border.color: "#585454"
Flickable {
id: flickableDescText
......@@ -529,20 +530,6 @@ Rectangle {
}
}
Text {
id: magText
objectName: "magTextObj"
x: 130
y: 277
width: 80
height: 15
color: "#ffffff"
text: qsTr("text")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 12
}
Rectangle {
id: nextObjRect
objectName: "nextObj"
......@@ -552,6 +539,8 @@ Rectangle {
height: 28
color: "#00000000"
radius: 5
anchors.right: parent.right
anchors.rightMargin: 10
signal nextObjClicked()
......@@ -612,12 +601,13 @@ Rectangle {
Rectangle {
id: prevObjRect
objectName: "prevObj"
x: 10
y: 347
width: 147
height: 28
color: "#00000000"
radius: 5
anchors.left: parent.left
anchors.leftMargin: 8
signal prevObjClicked()
......@@ -673,6 +663,109 @@ Rectangle {
source: "previous.png"
}
}
Text {
id: magText
objectName: "magTextObj"
y: 72
width: 164
height: 15
color: "#ffffff"
text: qsTr("Magnitude: ")
anchors.left: parent.left
anchors.leftMargin: 8
font.family: "Cantarell"
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
font.pixelSize: 12
}
Text {
id: sbText
objectName: "sbTextObj"
x: 8
y: 104
width: 164
height: 15
color: "#ffffff"
text: qsTr("Surface Brightness:")
anchors.left: parent.left
anchors.leftMargin: 8
font.pixelSize: 12
font.family: "Cantarell"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
Text {
id: sizeText
objectName: "sizeTextObj"
y: 136
width: 164
height: 15
color: "#ffffff"
text: qsTr("Size: ")
anchors.left: parent.left
anchors.leftMargin: 8
font.pixelSize: 12
font.family: "Cantarell"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
Text {
id: slewButton
objectName: "slewButtonObj"
x: 211
y: 135
width: 119
height: 16
color: "white"
text: qsTr("Slew map to object")
anchors.right: parent.right
anchors.rightMargin: 10
font.underline: true
verticalAlignment: Text.AlignVCenter
font.pixelSize: 12
signal slewButtonClicked()
MouseArea {
id: slewObjMouseArea
hoverEnabled: true
anchors.fill: parent
onEntered: slewButton.color = "yellow"
onExited: slewButton.color = "white"
onClicked: slewButton.slewButtonClicked()
}
}
Text {
id: detailsButton
objectName: "detailsButtonObj"
x: 211
y: 104
width: 119
height: 16
font.underline: true
anchors.rightMargin: 10
anchors.right: parent.right
verticalAlignment: Text.AlignVCenter
color: "white"
text: qsTr("More object details")
font.pixelSize: 12
signal detailsButtonClicked()
MouseArea {
id: detailsMouseArea
hoverEnabled: true
anchors.fill: parent
onEntered: detailsButton.color = "yellow"
onExited: detailsButton.color = "white"
onClicked: detailsButton.detailsButtonClicked()
}
}
} //end of detailsView
} //end of detailsViewContainer
......
......@@ -120,8 +120,3 @@ QString SkyObjItem::getDesc() const
return QString("No Description found for selected sky-object");
}
QString SkyObjItem::getMagnitude() const
{
return QString("Magnitude : ") + (QString::number(m_So->mag()));
}
......@@ -105,9 +105,21 @@ public:
/**
* \brief Get magnitude of sky-object associated with the SkyObjItem.
* \return Magnitude of sky-object associated with the SkyObjItem as a QString.
* \return Magnitude of sky-object associated with the SkyObjItem.
*/
QString getMagnitude() const;
inline float getMagnitude() const { return m_So->mag(); }
/**
* \brief Get surface-brightness of sky-object associated with the SkyObjItem.
* \return Surface-brightness of sky-object associated with the SkyObjItem.
*/
inline float getSurfaceBrightness() const { return 0.0; }
/**
* \brief Get size of sky-object associated with the SkyObjItem.
* \return Size of sky-object associated with the SkyObjItem.
*/
inline float getSize() const { return 0.0; }
/**
* \brief Set current position of the sky-object in the sky.
......
......@@ -51,6 +51,9 @@ WIView::WIView(QWidget *parent, ObsConditions *obs) : QWidget(parent)
m_PrevObj = m_BaseObj->findChild<QObject *>("prevObj");
connect(m_PrevObj, SIGNAL(prevObjClicked()), this, SLOT(onPrevObjClicked()));
m_SlewButtonObj = m_BaseObj->findChild<QObject *>("slewButtonObj");
connect(m_SlewButtonObj, SIGNAL(slewButtonClicked()), this, SLOT(onSlewButtonClicked()));
QObject *closeButtonObj = m_BaseObj->findChild<QObject *>("closeButtonObj");
connect(closeButtonObj, SIGNAL(closeButtonClicked()), baseView, SLOT(close()));
......@@ -114,20 +117,18 @@ void WIView::loadDetailsView(SkyObjItem *soitem, int index)
QObject *posTextObj = m_DetailsViewObj->findChild<QObject *>("posTextObj");
QObject *descTextObj = m_DetailsViewObj->findChild<QObject *>("descTextObj");
QObject *magTextObj = m_DetailsViewObj->findChild<QObject *>("magTextObj");
// QObject *sbTextObj = m_DetailsViewObj->findChild<QObject *>("sbTextObj");
// QObject *sizeTextObj = m_DetailsViewObj->findChild<QObject *>("sizeTextObj");
QString magText = QString("Magnitude: ") + QString::number(soitem->getMagnitude());
sonameObj->setProperty("text", soitem->getLongName());
posTextObj->setProperty("text", soitem->getPosition());
descTextObj->setProperty("text", soitem->getDesc());
magTextObj->setProperty("text", soitem->getMagnitude());
///Slew map to selected sky-object
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());
}
magTextObj->setProperty("text", magText);
/*
sbTextObj->setProperty("text", magText);
sizeTextObj->setProperty("text", soitem->getSize());*/
}
void WIView::onNextObjClicked()
......@@ -143,3 +144,16 @@ void WIView::onPrevObjClicked()
SkyObjItem *prevItem = m->returnModel(m_CurSoItem->getType())->getSkyObjItem((m_CurIndex-1+modelSize)%modelSize);
loadDetailsView(prevItem, (m_CurIndex-1+modelSize)%modelSize);
}
void WIView::onSlewButtonClicked()
{
///Slew map to selected sky-object
SkyObject* so = m_CurSoItem->getSkyObject();
KStars* data = KStars::Instance();
if (so != 0)
{
data->map()->setFocusPoint(so);
data->map()->setFocusObject(so);
data->map()->setDestination(*data->map()->focusPoint());
}
}
......@@ -85,8 +85,14 @@ public slots:
*/
void onPrevObjClicked();
/**
* \brief public slot - Slew map to current sky-object in the details view.
*/
void onSlewButtonClicked();
private:
QObject *m_BaseObj, *m_ViewsRowObj, *m_SoListObj, *m_DetailsViewObj, *m_NextObj, *m_PrevObj;
QObject *m_BaseObj, *m_ViewsRowObj, *m_SoListObj, *m_DetailsViewObj,
*m_NextObj, *m_PrevObj, *m_SlewButtonObj, *m_DetailsButtonObj;
QDeclarativeContext *ctxt;
ModelManager *m;
SkyObjItem *m_CurSoItem; ///Current sky-object item.
......
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