Commit 1dd3381f authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq

This patch includes the previous 2. It also modifies the first screen of whats...

This patch includes the previous 2. It also modifies the first screen of whats interesting and adds Messier objects to the list. As a part of that, I also had to add a way to identify that the object was below the horizon.
parent 83430ff8
...@@ -30,12 +30,16 @@ ModelManager::ModelManager(ObsConditions * obs) ...@@ -30,12 +30,16 @@ ModelManager::ModelManager(ObsConditions * obs)
m_ConModel = new SkyObjListModel(); m_ConModel = new SkyObjListModel();
m_ClustModel = new SkyObjListModel(); m_ClustModel = new SkyObjListModel();
m_NebModel = new SkyObjListModel(); m_NebModel = new SkyObjListModel();
m_MessierModel = new SkyObjListModel();
m_SharplessModel = new SkyObjListModel();
m_InitObjects[Star_Model] = QList<SkyObject *>(); m_InitObjects[Star_Model] = QList<SkyObject *>();
m_InitObjects[Galaxy_Model] = QList<SkyObject *>(); m_InitObjects[Galaxy_Model] = QList<SkyObject *>();
m_InitObjects[Constellation_Model] = QList<SkyObject *>(); m_InitObjects[Constellation_Model] = QList<SkyObject *>();
m_InitObjects[Cluster_Model] = QList<SkyObject *>(); m_InitObjects[Cluster_Model] = QList<SkyObject *>();
m_InitObjects[Nebula_Model] = QList<SkyObject *>(); m_InitObjects[Nebula_Model] = QList<SkyObject *>();
m_InitObjects[Messier_Model] = QList<SkyObject *>();
m_InitObjects[Sharpless_Model] = QList<SkyObject *>();
updateModels(obs); updateModels(obs);
} }
...@@ -47,6 +51,8 @@ ModelManager::~ModelManager() ...@@ -47,6 +51,8 @@ ModelManager::~ModelManager()
delete m_ConModel; delete m_ConModel;
delete m_ClustModel; delete m_ClustModel;
delete m_NebModel; delete m_NebModel;
delete m_MessierModel;
delete m_SharplessModel;
} }
void ModelManager::updateModels(ObsConditions * obs) void ModelManager::updateModels(ObsConditions * obs)
...@@ -148,6 +154,21 @@ void ModelManager::updateModels(ObsConditions * obs) ...@@ -148,6 +154,21 @@ void ModelManager::updateModels(ObsConditions * obs)
m_PlanetsModel->addSkyObject(new SkyObjItem(so)); m_PlanetsModel->addSkyObject(new SkyObjItem(so));
} }
} }
for(int i=1;i<=110;i++)
{
SkyObject * o;
if ((o = data->skyComposite()->findByName("M " + QString::number(i))))
m_MessierModel->addSkyObject(new SkyObjItem(o));
}
/**
for(int i=1;i<=350;i++)
{
SkyObject * o;
if ((o = data->skyComposite()->findByName("Sh2 " + QString::number(i))))
m_SharplessModel->addSkyObject(new SkyObjItem(o));
}
**/
} }
void ModelManager::resetModels() void ModelManager::resetModels()
...@@ -158,6 +179,8 @@ void ModelManager::resetModels() ...@@ -158,6 +179,8 @@ void ModelManager::resetModels()
m_GalModel->resetModel(); m_GalModel->resetModel();
m_ClustModel->resetModel(); m_ClustModel->resetModel();
m_NebModel->resetModel(); m_NebModel->resetModel();
m_MessierModel->resetModel();
m_SharplessModel->resetModel();
} }
SkyObjListModel * ModelManager::returnModel(int type) SkyObjListModel * ModelManager::returnModel(int type)
...@@ -176,6 +199,10 @@ SkyObjListModel * ModelManager::returnModel(int type) ...@@ -176,6 +199,10 @@ SkyObjListModel * ModelManager::returnModel(int type)
return m_ClustModel; return m_ClustModel;
case 5: //Nebula type case 5: //Nebula type
return m_NebModel; return m_NebModel;
case 6: //Messier Objects
return m_MessierModel;
case 7: //Sharpless Objects
return m_SharplessModel;
default: default:
return 0; return 0;
} }
......
...@@ -34,7 +34,7 @@ class ModelManager ...@@ -34,7 +34,7 @@ class ModelManager
* \enum ModelType * \enum ModelType
* \brief Model type for different types of sky-objects. * \brief Model type for different types of sky-objects.
*/ */
enum ModelType {Planet_Model, Star_Model, Constellation_Model, Galaxy_Model, Cluster_Model, Nebula_Model}; enum ModelType {Planet_Model, Star_Model, Constellation_Model, Galaxy_Model, Cluster_Model, Nebula_Model, Messier_Model, Sharpless_Model};
/** /**
* \brief Constructor - Creates models for different sky-object types. * \brief Constructor - Creates models for different sky-object types.
...@@ -66,7 +66,7 @@ class ModelManager ...@@ -66,7 +66,7 @@ class ModelManager
private: private:
ObsConditions * m_ObsConditions; ObsConditions * m_ObsConditions;
SkyObjListModel * m_PlanetsModel, *m_StarsModel, *m_GalModel, *m_ConModel, *m_ClustModel, *m_NebModel; SkyObjListModel * m_PlanetsModel, *m_StarsModel, *m_GalModel, *m_ConModel, *m_ClustModel, *m_NebModel, *m_MessierModel, *m_SharplessModel;
QHash< ModelType, QList <SkyObject *> > m_InitObjects; QHash< ModelType, QList <SkyObject *> > m_InitObjects;
}; };
......
...@@ -63,7 +63,7 @@ Rectangle { ...@@ -63,7 +63,7 @@ Rectangle {
x: 0 x: 0
y: 31 y: 31
width: parent.width width: parent.width
height: 351 height: 500
Rectangle { Rectangle {
id: background id: background
...@@ -87,6 +87,24 @@ Rectangle { ...@@ -87,6 +87,24 @@ Rectangle {
color: "black" color: "black"
} }
} }
Item {
id: nakedEyeItem
width: nakedEyeText.width
height: nakedEyeText.height
anchors{
verticalCenterOffset: -180
horizontalCenterOffset: 0
centerIn: parent
}
CategoryTitle {
id: nakedEyeText
color: "yellow"
title: xi18n("Naked-Eye Objects")
anchors.centerIn: parent
}
}
Item { Item {
id: planetItem id: planetItem
...@@ -178,7 +196,7 @@ Rectangle { ...@@ -178,7 +196,7 @@ Rectangle {
Item { Item {
id: dsoContainer id: dsoContainer
y: 172 y: 172
height: 166 height: 200
anchors { anchors {
right: parent.right right: parent.right
rightMargin: 35 rightMargin: 35
...@@ -192,24 +210,16 @@ Rectangle { ...@@ -192,24 +210,16 @@ Rectangle {
height: dsoText.height height: dsoText.height
anchors { anchors {
verticalCenterOffset: -54 verticalCenterOffset: -30
horizontalCenterOffset: 0 horizontalCenterOffset: 0
centerIn: parent centerIn: parent
} }
CategoryTitle { CategoryTitle {
id: dsoText id: dsoText
color: "yellow"
title: xi18n("Deep-sky Objects") title: xi18n("Deep-sky Objects")
anchors.centerIn: parent anchors.centerIn: parent
MouseArea {
id: dsoMouseArea
hoverEnabled: true
anchors.fill: parent
onEntered: container.state = "dsoAreaEntered"
onClicked: container.state = "dsoAreaClicked"
}
} }
} }
...@@ -220,7 +230,7 @@ Rectangle { ...@@ -220,7 +230,7 @@ Rectangle {
height: galText.height height: galText.height
anchors { anchors {
verticalCenterOffset: -4 verticalCenterOffset: 26
horizontalCenterOffset: -77 horizontalCenterOffset: -77
centerIn: parent centerIn: parent
} }
...@@ -228,7 +238,6 @@ Rectangle { ...@@ -228,7 +238,6 @@ Rectangle {
CategoryTitle { CategoryTitle {
id: galText id: galText
color: disabledColor
title: xi18n("Galaxies") title: xi18n("Galaxies")
anchors { anchors {
centerIn: parent centerIn: parent
...@@ -237,8 +246,7 @@ Rectangle { ...@@ -237,8 +246,7 @@ Rectangle {
MouseArea { MouseArea {
id: galMouseArea id: galMouseArea
enabled: false hoverEnabled: true
hoverEnabled: false
anchors.fill: parent anchors.fill: parent
onEntered: container.state = "galAreaEntered" onEntered: container.state = "galAreaEntered"
onClicked: { onClicked: {
...@@ -256,7 +264,7 @@ Rectangle { ...@@ -256,7 +264,7 @@ Rectangle {
height: nebText.height height: nebText.height
anchors { anchors {
verticalCenterOffset: 52 verticalCenterOffset: 82
horizontalCenterOffset: -17 horizontalCenterOffset: -17
centerIn: parent centerIn: parent
} }
...@@ -264,14 +272,12 @@ Rectangle { ...@@ -264,14 +272,12 @@ Rectangle {
CategoryTitle { CategoryTitle {
id: nebText id: nebText
color: disabledColor
title: xi18n("Nebulae") title: xi18n("Nebulae")
anchors.centerIn: parent anchors.centerIn: parent
MouseArea { MouseArea {
id: nebMouseArea id: nebMouseArea
enabled: false hoverEnabled: true
hoverEnabled: false
anchors.fill: parent anchors.fill: parent
onEntered: container.state = "nebAreaEntered" onEntered: container.state = "nebAreaEntered"
onClicked: { onClicked: {
...@@ -289,7 +295,7 @@ Rectangle { ...@@ -289,7 +295,7 @@ Rectangle {
height: clustText.height height: clustText.height
anchors { anchors {
verticalCenterOffset: 8 verticalCenterOffset: 38
horizontalCenterOffset: 69 horizontalCenterOffset: 69
centerIn: parent centerIn: parent
} }
...@@ -297,14 +303,12 @@ Rectangle { ...@@ -297,14 +303,12 @@ Rectangle {
CategoryTitle { CategoryTitle {
id: clustText id: clustText
color: disabledColor
title: xi18n("Clusters") title: xi18n("Clusters")
anchors.centerIn: parent anchors.centerIn: parent
MouseArea { MouseArea {
id: clustMouseArea id: clustMouseArea
enabled: false hoverEnabled: true
hoverEnabled: false
anchors.fill: parent anchors.fill: parent
onEntered: container.state = "clustAreaEntered" onEntered: container.state = "clustAreaEntered"
onClicked: { onClicked: {
...@@ -314,6 +318,83 @@ Rectangle { ...@@ -314,6 +318,83 @@ Rectangle {
} }
} }
} }
Item {
id: catalogsItem
width: catalogText.width
height: catalogText.height
anchors{
verticalCenterOffset: 130
horizontalCenterOffset: 0
centerIn: parent
}
CategoryTitle {
id: catalogText
color: "yellow"
title: xi18n("Explore Catalogs")
anchors.centerIn: parent
}
}
Item {
id: messierItem
width: messierText.width
height: messierText.height
anchors {
verticalCenterOffset: 160
horizontalCenterOffset: 69
centerIn: parent
}
opacity: categoryTitleOpacity
CategoryTitle {
id: messierText
title: xi18n("Messier Objects")
anchors.centerIn: parent
MouseArea {
id: messierMouseArea
hoverEnabled: true
anchors.fill: parent
onEntered: container.state = "messierAreaEntered"
onClicked: {
viewsRow.categorySelected(6)
container.state = "dsoTypeSelected"
}
}
}
}
// Item {
// id: sh2Item
//
// width: sh2Text.width
// height: sh2Text.height
//
// anchors {
// verticalCenterOffset: 190
// horizontalCenterOffset: 69
// centerIn: parent
// }
// opacity: categoryTitleOpacity
//
// CategoryTitle {
// id: sh2Text
// title: xi18n("Sharpless Objects")
// anchors.centerIn: parent
//
// MouseArea {
// id: sh2MouseArea
// hoverEnabled: true
// anchors.fill: parent
// onEntered: container.state = "sh2AreaEntered"
// onClicked: {
// viewsRow.categorySelected(7)
// container.state = "dsoTypeSelected"
// }
// }
// }
// }
} }
} //end of categoryView } //end of categoryView
...@@ -491,9 +572,9 @@ Rectangle { ...@@ -491,9 +572,9 @@ Rectangle {
right: parent.right right: parent.right
rightMargin: 10 rightMargin: 10
} }
textFormat: Text.RichText
width: parent.width width: parent.width
height: 16 height: 16
color: "#f7f7ac"
text: xi18n("text") text: xi18n("text")
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font{ font{
...@@ -568,32 +649,18 @@ Rectangle { ...@@ -568,32 +649,18 @@ Rectangle {
clip: true clip: true
wrapMode: Text.WrapAtWordBoundaryOrAnywhere wrapMode: Text.WrapAtWordBoundaryOrAnywhere
width: parent.width width: parent.width
textFormat: Text.RichText
font{ font{
family: "Cantarell" family: "Cantarell"
pixelSize: 13 pixelSize: 13
} }
}
Text {
id: descSrcText
objectName: "descSrcTextObj"
color: "#18885f"
text: xi18n("Source: ")
clip: true
horizontalAlignment: Text.AlignRight
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
width: parent.width
onLinkActivated: Qt.openUrlExternally(link) onLinkActivated: Qt.openUrlExternally(link)
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
} }
font{ }
family: "Cantarell"
pixelSize: 13
italic: true
} //font
} //text
} //column } //column
} //item } //item
} //flickable } //flickable
...@@ -914,6 +981,12 @@ Rectangle { ...@@ -914,6 +981,12 @@ Rectangle {
onExited: slewButton.color = "white" onExited: slewButton.color = "white"
onClicked: slewButton.slewButtonClicked() onClicked: slewButton.slewButtonClicked()
} }
CheckBox {
id: autoCenter
objectName: "autoCenterCheckbox"
x: 100
checked: true
}
} }
Text { Text {
...@@ -1059,7 +1132,7 @@ Rectangle { ...@@ -1059,7 +1132,7 @@ Rectangle {
} }
} else if (container.state == "dsoTypeSelected") { } else if (container.state == "dsoTypeSelected") {
if (!skyObjView.flipped) { if (!skyObjView.flipped) {
container.state = "dsoAreaClicked" container.state = "base"
} else if (skyObjView.flipped) { } else if (skyObjView.flipped) {
skyObjView.flipped = false skyObjView.flipped = false
} }
...@@ -1196,11 +1269,10 @@ Rectangle { ...@@ -1196,11 +1269,10 @@ Rectangle {
} }
}, },
State { State {
name: "dsoAreaClicked" name: "galAreaEntered"
PropertyChanges { PropertyChanges {
target: dsoText target: dsoText
state:"selected" state: "selectedNoBold"
} }
PropertyChanges { PropertyChanges {
...@@ -1217,6 +1289,11 @@ Rectangle { ...@@ -1217,6 +1289,11 @@ Rectangle {
target: clustItem target: clustItem
opacity: 1 opacity: 1
} }
PropertyChanges {
target: messierItem
opacity: 1
}
PropertyChanges { PropertyChanges {
target: planetItem target: planetItem
...@@ -1234,35 +1311,37 @@ Rectangle { ...@@ -1234,35 +1311,37 @@ Rectangle {
} }
PropertyChanges { PropertyChanges {
target: clustMouseArea target: galText
hoverEnabled: true state: "selected"
enabled: true color: activeColor
} }
PropertyChanges { PropertyChanges {
target: galMouseArea target: clustMouseArea
hoverEnabled: true hoverEnabled: true
enabled: true enabled: true
} }
PropertyChanges { PropertyChanges {
target: nebMouseArea target: messierMouseArea
hoverEnabled: true hoverEnabled: true
enabled: true enabled: true
} }
PropertyChanges { PropertyChanges {
target: dsoMouseArea target: galMouseArea
hoverEnabled: false hoverEnabled: true
enabled: true
} }
PropertyChanges { PropertyChanges {
target: dsoContainer target: nebMouseArea
y: 160 hoverEnabled: true
enabled: true
} }
PropertyChanges { PropertyChanges {
target: galText target: nebText
color: activeColor color: activeColor
} }
...@@ -1270,14 +1349,9 @@ Rectangle { ...@@ -1270,14 +1349,9 @@ Rectangle {
target: clustText target: clustText
color: activeColor color: activeColor
} }
PropertyChanges {
target: nebText
color: activeColor
}
}, },
State { State {
name: "galAreaEntered" name: "nebAreaEntered"
PropertyChanges { PropertyChanges {
target: dsoText target: dsoText
state: "selectedNoBold" state: "selectedNoBold"
...@@ -1297,6 +1371,11 @@ Rectangle { ...@@ -1297,6 +1371,11 @@ Rectangle {
target: clustItem