From b70a9414f5ea592fe4de7bbe9caf34bba72aceaa Mon Sep 17 00:00:00 2001 From: Robert Lancaster Date: Sat, 27 May 2017 02:03:52 +0300 Subject: [PATCH] This patch will add the tracking feature option to Whats Interesting that I mentioned before as well as clarifying the auto center feature a bit. --- kstars/tools/whatsinteresting/qml/wiview.qml | 27 ++++++++++++++++++-- kstars/tools/whatsinteresting/wiview.cpp | 10 +++++--- kstars/tools/whatsinteresting/wiview.h | 4 +-- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/kstars/tools/whatsinteresting/qml/wiview.qml b/kstars/tools/whatsinteresting/qml/wiview.qml index 87ebe331f..7454541d1 100644 --- a/kstars/tools/whatsinteresting/qml/wiview.qml +++ b/kstars/tools/whatsinteresting/qml/wiview.qml @@ -978,7 +978,7 @@ Rectangle { verticalAlignment: Text.AlignVCenter color: "white" - text: xi18n("Center in Map") + text: xi18n("Center in Map \n") font { underline: true family: "Cantarell" @@ -996,14 +996,37 @@ Rectangle { onExited: centerButton.color = (nightVision.state == "active") ? "red" : "white" onClicked: centerButton.centerButtonClicked() } + + Text { + text: xi18n(" Auto Track ") + color: "white" + font { + family: "Cantarell" + pixelSize: 14 + } + y: 15 + } + CheckBox { id: autoCenter objectName: "autoCenterCheckbox" - x: 100 + x: 37 + y: 15 checked: true } + + CheckBox { + id: autoTrack + objectName: "autoTrackCheckbox" + x: 97 + y: 15 + checked: false + onClicked: centerButton.centerButtonClicked() + } + } + Text { id: slewTelescopeButton objectName: "slewTelescopeButtonObj" diff --git a/kstars/tools/whatsinteresting/wiview.cpp b/kstars/tools/whatsinteresting/wiview.cpp index be3a002af..6d11ad764 100644 --- a/kstars/tools/whatsinteresting/wiview.cpp +++ b/kstars/tools/whatsinteresting/wiview.cpp @@ -111,6 +111,9 @@ WIView::WIView(QWidget * parent) : QWidget(parent), m_CurrentObjectListName(-1) m_CenterButtonObj = m_BaseObj->findChild("centerButtonObj"); connect(m_CenterButtonObj, SIGNAL(centerButtonClicked()), this, SLOT(onCenterButtonClicked())); + autoCenterCheckbox = m_DetailsViewObj->findChild("autoCenterCheckbox"); + autoTrackCheckbox = m_DetailsViewObj->findChild("autoTrackCheckbox"); + m_SlewTelescopeButtonObj = m_BaseObj->findChild("slewTelescopeButtonObj"); connect(m_SlewTelescopeButtonObj, SIGNAL(slewTelescopeButtonClicked()), this, SLOT(onSlewTelescopeButtonClicked())); @@ -280,11 +283,12 @@ void WIView::onCenterButtonClicked() ///Center map on selected sky-object SkyObject * so = m_CurSoItem->getSkyObject(); KStars * kstars = KStars::Instance(); - if (so != 0) + if (so) { kstars->map()->setFocusPoint(so); kstars->map()->setFocusObject(so); kstars->map()->setDestination(*kstars->map()->focusPoint()); + Options::setIsTracking(autoTrackCheckbox->property("checked")==true); } } @@ -491,7 +495,7 @@ void WIView::loadDetailsView(SkyObjItem * soitem, int index) QObject * posTextObj = m_DetailsViewObj->findChild("posTextObj"); QObject * detailImage = m_DetailsViewObj->findChild("detailImage"); QObject * detailsTextObj = m_DetailsViewObj->findChild("detailsTextObj"); - QObject * autoCenterCheckBox = m_DetailsViewObj->findChild("autoCenterCheckbox"); + sonameObj->setProperty("text", soitem->getDescName()); posTextObj->setProperty("text", soitem->getPosition()); @@ -517,7 +521,7 @@ void WIView::loadDetailsView(SkyObjItem * soitem, int index) QString details = summary + "
" + sbText + "
" + magText + "
" + sizeText; detailsTextObj->setProperty("text", details); - if(autoCenterCheckBox->property("checked")==true){ + if(autoCenterCheckbox->property("checked")==true){ QTimer::singleShot(500, this, SLOT(onCenterButtonClicked())); } diff --git a/kstars/tools/whatsinteresting/wiview.h b/kstars/tools/whatsinteresting/wiview.h index dc6da0d28..6a4f79a03 100644 --- a/kstars/tools/whatsinteresting/wiview.h +++ b/kstars/tools/whatsinteresting/wiview.h @@ -151,9 +151,9 @@ class WIView : public QWidget private: QQuickItem * m_BaseObj, *m_ViewsRowObj, *m_CategoryTitle, *m_SoListObj, *m_DetailsViewObj, *m_skyObjView, *m_ContainerObj, *m_ProgressBar, *m_loadingMessage, - *m_NextObj, *m_PrevObj, *m_CenterButtonObj, *m_SlewTelescopeButtonObj, *m_DetailsButtonObj, * inspectIconObj, * visibleIconObj, * favoriteIconObj; + *m_NextObj, *m_PrevObj, *m_CenterButtonObj, *m_SlewTelescopeButtonObj, *m_DetailsButtonObj, * inspectIconObj, * visibleIconObj, * favoriteIconObj; QQmlContext * m_Ctxt; - QObject * infoBoxText, * descTextObj, * nightVision; + QObject * infoBoxText, * descTextObj, * nightVision, *autoTrackCheckbox, *autoCenterCheckbox; QQuickView * m_BaseView; ObsConditions * m_Obs = nullptr; -- GitLab