Commit 3f202b3a authored by Samikshan Bairagya's avatar Samikshan Bairagya

Disble "Settings" button on sky-object listview and details-view in QML UI for WI.

This is to allow the listview models to be reloaded when settings are changed.
parent a8eb262a
......@@ -823,6 +823,17 @@ Rectangle {
target: listToDetailsRotation
angle: 180
}
PropertyChanges {
target: settingsMouseArea
opacity: 1
enabled: false
}
PropertyChanges {
target: settingsIcon
opacity: 0.200
}
when: skyObjView.flipped
}
]
......@@ -1352,6 +1363,17 @@ Rectangle {
target: backButton
x: container.width - 105
}
PropertyChanges {
target: settingsMouseArea
opacity: 1
enabled: false
}
PropertyChanges {
target: settingsIcon
opacity: 0.200
}
},
State {
name: "dsoTypeSelected"
......@@ -1447,6 +1469,17 @@ Rectangle {
target: nebText
color: "#e4800d"
}
PropertyChanges {
target: settingsMouseArea
opacity: 1
enabled: false
}
PropertyChanges {
target: settingsIcon
opacity: 0.200
}
}
]
......
......@@ -17,7 +17,6 @@
#include "QDeclarativeView"
#include "QDeclarativeContext"
#include "QGraphicsObject"
#include "wiview.h"
#include "skymap.h"
......@@ -89,47 +88,6 @@ void WIView::onSoListItemClicked(int type, QString typeName, int index)
loadDetailsView(soitem, index);
}
void WIView::loadDetailsView(SkyObjItem *soitem, int index)
{
m_CurSoItem = soitem;
m_CurIndex = index;
int modelSize = m_ModManager->returnModel(m_CurSoItem->getType())->rowCount();
SkyObjItem *nextItem = m_ModManager->returnModel(m_CurSoItem->getType())->getSkyObjItem((m_CurIndex+1)%modelSize);
SkyObjItem *prevItem = m_ModManager->returnModel(m_CurSoItem->getType())->getSkyObjItem((m_CurIndex-1+modelSize)%modelSize);
QObject *nextTextObj = m_NextObj->findChild<QObject *>("nextTextObj");
nextTextObj->setProperty("text", nextItem->getName());
QObject *prevTextObj = m_PrevObj->findChild<QObject *>("prevTextObj");
prevTextObj->setProperty("text", prevItem->getName());
QObject *sonameObj = m_DetailsViewObj->findChild<QObject *>("sonameObj");
QObject *posTextObj = m_DetailsViewObj->findChild<QObject *>("posTextObj");
QObject *descTextObj = m_DetailsViewObj->findChild<QObject *>("descTextObj");
QObject *descSrcTextObj = m_DetailsViewObj->findChild<QObject *>("descSrcTextObj");
QObject *magTextObj = m_DetailsViewObj->findChild<QObject *>("magTextObj");
QObject *sbTextObj = m_DetailsViewObj->findChild<QObject *>("sbTextObj");
QObject *sizeTextObj = m_DetailsViewObj->findChild<QObject *>("sizeTextObj");
sonameObj->setProperty("text", soitem->getLongName());
posTextObj->setProperty("text", soitem->getPosition());
descTextObj->setProperty("text", soitem->getDesc());
descSrcTextObj->setProperty("text", soitem->getDescSource());
QString magText;
if (soitem->getType() == SkyObjItem::Constellation)
magText = i18n("Magnitude: --");
else
magText = i18n("Magnitude: ") + KGlobal::locale()->formatNumber(soitem->getMagnitude(), 2) + " mag";
magTextObj->setProperty("text", magText);
QString sbText = i18n("Surface Brightness") + ": " + soitem->getSurfaceBrightness();
sbTextObj->setProperty("text", sbText);
QString sizeText = i18n("Size") + ": " + soitem->getSize();
sizeTextObj->setProperty("text", sizeText);
}
void WIView::onNextObjClicked()
{
int modelSize = m_ModManager->returnModel(m_CurSoItem->getType())->rowCount();
......@@ -172,3 +130,56 @@ void WIView::onSettingsIconClicked()
KStars *kstars = KStars::Instance();
kstars->showWISettingsUI();
}
void WIView::updateModels(ObsConditions* obs)
{
m_Obs = obs;
m_ModManager->updateModels(m_Obs);
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(0));
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(1));
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(2));
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(3));
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(4));
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(5));
}
void WIView::loadDetailsView(SkyObjItem *soitem, int index)
{
m_CurSoItem = soitem;
m_CurIndex = index;
int modelSize = m_ModManager->returnModel(m_CurSoItem->getType())->rowCount();
SkyObjItem *nextItem = m_ModManager->returnModel(m_CurSoItem->getType())->getSkyObjItem((m_CurIndex+1)%modelSize);
SkyObjItem *prevItem = m_ModManager->returnModel(m_CurSoItem->getType())->getSkyObjItem((m_CurIndex-1+modelSize)%modelSize);
QObject *nextTextObj = m_NextObj->findChild<QObject *>("nextTextObj");
nextTextObj->setProperty("text", nextItem->getName());
QObject *prevTextObj = m_PrevObj->findChild<QObject *>("prevTextObj");
prevTextObj->setProperty("text", prevItem->getName());
QObject *sonameObj = m_DetailsViewObj->findChild<QObject *>("sonameObj");
QObject *posTextObj = m_DetailsViewObj->findChild<QObject *>("posTextObj");
QObject *descTextObj = m_DetailsViewObj->findChild<QObject *>("descTextObj");
QObject *descSrcTextObj = m_DetailsViewObj->findChild<QObject *>("descSrcTextObj");
QObject *magTextObj = m_DetailsViewObj->findChild<QObject *>("magTextObj");
QObject *sbTextObj = m_DetailsViewObj->findChild<QObject *>("sbTextObj");
QObject *sizeTextObj = m_DetailsViewObj->findChild<QObject *>("sizeTextObj");
sonameObj->setProperty("text", soitem->getLongName());
posTextObj->setProperty("text", soitem->getPosition());
descTextObj->setProperty("text", soitem->getDesc());
descSrcTextObj->setProperty("text", soitem->getDescSource());
QString magText;
if (soitem->getType() == SkyObjItem::Constellation)
magText = i18n("Magnitude: --");
else
magText = i18n("Magnitude: ") + KGlobal::locale()->formatNumber(soitem->getMagnitude(), 2) + " mag";
magTextObj->setProperty("text", magText);
QString sbText = i18n("Surface Brightness") + ": " + soitem->getSurfaceBrightness();
sbTextObj->setProperty("text", sbText);
QString sizeText = i18n("Size") + ": " + soitem->getSize();
sizeTextObj->setProperty("text", sizeText);
}
......@@ -19,8 +19,8 @@
#define WIVIEW_H
class QDeclarativeView;
class QDeclarativeContext;
#include "QDeclarativeContext"
#include "skyobject.h"
#include "modelmanager.h"
#include "skyobjlistmodel.h"
......@@ -59,7 +59,7 @@ public:
/**
* \brief Updates sky-object list models
*/
inline void updateModels(ObsConditions *obs) { m_Obs = obs; m_ModManager->updateModels(m_Obs); }
void updateModels(ObsConditions *obs);
inline QDeclarativeView *getWIBaseView() const { return m_BaseView; }
......
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