summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Fedoskin <afedoskin3@gmail.com>2016-07-20 20:45:14 (GMT)
committerArtem Fedoskin <afedoskin3@gmail.com>2016-07-20 20:45:14 (GMT)
commit7cd2ae86cc875247528cf4e1235147f0864e101e (patch)
tree4f2aa39bfefc8736c67692a7a68c6194a2e03643
parent4200b2589b5670a2a17f681b0a0724621b1be769 (diff)
Added INDI Client for KStars Lite. Currently working - telescope control
(motion, slewing rate, slew to target), switches, multiple device handling.
-rw-r--r--CMakeLists.txt3
-rw-r--r--apk/AndroidManifest.xml3
-rw-r--r--cmake/modules/FindCFitsio.cmake10
-rw-r--r--cmake/modules/FindINDI.cmake75
-rw-r--r--cmake/modules/FindNova.cmake4
-rw-r--r--kstars/CMakeLists.txt138
-rw-r--r--kstars/indi/clientmanagerlite.cpp541
-rw-r--r--kstars/indi/clientmanagerlite.h116
-rw-r--r--kstars/indi/drivermanager.cpp5
-rw-r--r--kstars/indi/drivermanager.h2
-rw-r--r--kstars/indi/drivermanager.ui.autosave383
-rw-r--r--kstars/indi/indiproperty.cpp2
-rw-r--r--kstars/indi/inditelescope.cpp1
-rw-r--r--kstars/indi/inditelescope.h3
-rw-r--r--kstars/indi/inditelescopelite.cpp705
-rw-r--r--kstars/indi/inditelescopelite.h112
-rw-r--r--kstars/kstarsdata.cpp9
-rw-r--r--kstars/kstarslite.cpp40
-rw-r--r--kstars/kstarslite.h15
m---------kstars/kstarslite/kirigami0
-rw-r--r--kstars/kstarslite/qml/CMakeLists.txt11
-rw-r--r--kstars/kstarslite/qml/indi/CMakeLists.txt17
-rw-r--r--kstars/kstarslite/qml/indi/DevicePanel.qml80
-rw-r--r--kstars/kstarslite/qml/indi/INDIControlPanel.qml181
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSButton.qml13
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSButtonsRow.qml59
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSCheckBox.qml11
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSComboBox.qml33
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSINDINumber.qml37
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSINDINumberField.qml20
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSINDIText.qml39
-rw-r--r--kstars/kstarslite/qml/indi/modules/KSTab.qml36
-rw-r--r--kstars/kstarslite/qml/indi/modules/Led.qml23
-rw-r--r--kstars/kstarslite/qml/indi/modules/MotionControl.qml300
-rw-r--r--kstars/kstarslite/qml/indi/modules/Property.qml119
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/CMakeLists.txt6
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/green.pngbin0 -> 45228 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/grey.pngbin0 -> 36790 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/hdpi/CMakeLists.txt5
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/hdpi/green.pngbin0 -> 3202 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/hdpi/grey.pngbin0 -> 2741 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/hdpi/red.pngbin0 -> 3191 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/hdpi/yellow.pngbin0 -> 3090 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/ldpi/CMakeLists.txt5
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/ldpi/green.pngbin0 -> 880 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/ldpi/grey.pngbin0 -> 833 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/ldpi/red.pngbin0 -> 870 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/ldpi/yellow.pngbin0 -> 867 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/mdpi/CMakeLists.txt5
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/mdpi/green.pngbin0 -> 2175 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/mdpi/grey.pngbin0 -> 1945 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/mdpi/red.pngbin0 -> 2157 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/mdpi/yellow.pngbin0 -> 2132 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/red.pngbin0 -> 44559 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xhdpi/CMakeLists.txt5
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xhdpi/green.pngbin0 -> 4893 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xhdpi/grey.pngbin0 -> 4106 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xhdpi/red.pngbin0 -> 4843 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xhdpi/yellow.pngbin0 -> 4724 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxhdpi/CMakeLists.txt5
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxhdpi/green.pngbin0 -> 6793 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxhdpi/grey.pngbin0 -> 5536 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxhdpi/red.pngbin0 -> 6712 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxhdpi/yellow.pngbin0 -> 6390 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxxhdpi/CMakeLists.txt5
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxxhdpi/green.pngbin0 -> 10725 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxxhdpi/grey.pngbin0 -> 8479 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxxhdpi/red.pngbin0 -> 10596 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/xxxhdpi/yellow.pngbin0 -> 12128 bytes
-rw-r--r--kstars/kstarslite/qml/indi/modules/images/yellow.pngbin0 -> 42234 bytes
-rw-r--r--kstars/kstarslite/qml/main.qml377
-rw-r--r--kstars/kstarslite/qml/modules/ContextDrawer.qml122
-rw-r--r--kstars/kstarslite/qml/modules/ContextDrawerMenu.qml18
-rw-r--r--kstars/kstarslite/qml/modules/GlobalDrawer.qml122
-rw-r--r--kstars/kstarslite/qml/modules/KSPage.qml127
-rw-r--r--kstars/kstarslite/qml/modules/KSScrollablePage.qml82
-rw-r--r--kstars/kstarslite/qml/modules/TelescopeControlMenu.qml23
-rw-r--r--kstars/kstarslite/qml/modules/helpers/DrawerColorScheme.qml106
-rw-r--r--kstars/kstarslite/qml/modules/helpers/DrawerElem.qml26
-rw-r--r--kstars/kstarslite/qml/modules/images/back.pngbin0 -> 3389 bytes
-rw-r--r--kstars/kstarslite/qml/modules/images/backl.pngbin0 -> 288 bytes
-rw-r--r--kstars/kstarslite/qml/modules/images/hdpi/icons/CMakeLists.txt1
-rw-r--r--kstars/kstarslite/qml/modules/images/hdpi/icons/back.pngbin0 -> 344 bytes
-rw-r--r--kstars/kstarslite/qml/modules/images/ldpi/icons/CMakeLists.txt1
-rw-r--r--kstars/kstarslite/qml/modules/images/ldpi/icons/back.pngbin0 -> 288 bytes
-rw-r--r--kstars/kstarslite/qml/modules/images/mdpi/icons/CMakeLists.txt1
-rw-r--r--kstars/kstarslite/qml/modules/images/mdpi/icons/back.pngbin0 -> 316 bytes
-rw-r--r--kstars/kstarslite/qml/modules/images/xhdpi/icons/CMakeLists.txt1
-rw-r--r--kstars/kstarslite/qml/modules/images/xhdpi/icons/back.pngbin0 -> 356 bytes
-rw-r--r--kstars/kstarslite/qml/modules/images/xxhdpi/icons/CMakeLists.txt1
-rw-r--r--kstars/kstarslite/qml/modules/images/xxhdpi/icons/back.pngbin0 -> 397 bytes
-rw-r--r--kstars/kstarslite/qml/modules/images/xxxhdpi/icons/CMakeLists.txt1
-rw-r--r--kstars/kstarslite/qml/modules/images/xxxhdpi/icons/back.pngbin0 -> 450 bytes
-rw-r--r--kstars/kstarslite/qml/modules/led_off.pngbin0 -> 15835 bytes
-rw-r--r--kstars/kstarslite/qml/modules/led_on.pngbin0 -> 19285 bytes
-rw-r--r--kstars/kstarslite/qml/modules/on-off-green-light-hi.pngbin0 -> 37277 bytes
-rw-r--r--kstars/kstarslite/skyitems/constellationartitem.cpp28
-rw-r--r--kstars/kstarslite/skyitems/deepskyitem.cpp12
-rw-r--r--kstars/kstarslite/skyitems/deepskyitem.h1
-rw-r--r--kstars/kstarslite/skyitems/deepstaritem.cpp2
-rw-r--r--kstars/kstarslite/skyitems/labelsitem.cpp14
-rw-r--r--kstars/kstarslite/skyitems/labelsitem.h1
-rw-r--r--kstars/kstarslite/skyitems/lines/eclipticitem.cpp29
-rw-r--r--kstars/kstarslite/skyitems/lines/equatoritem.cpp28
-rw-r--r--kstars/kstarslite/skyitems/lines/linesitem.cpp109
-rw-r--r--kstars/kstarslite/skyitems/lines/milkywayitem.cpp22
-rw-r--r--kstars/kstarslite/skyitems/rootnode.cpp19
-rw-r--r--kstars/kstarslite/skyitems/rootnode.h10
-rw-r--r--kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp1
-rw-r--r--kstars/kstarslite/skyitems/skynodes/crosshairnode.cpp142
-rw-r--r--kstars/kstarslite/skyitems/skynodes/crosshairnode.h54
-rw-r--r--kstars/kstarslite/skyitems/skynodes/deepskynode.cpp3
-rw-r--r--kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp6
-rw-r--r--kstars/kstarslite/skyitems/skynodes/labelnode.cpp17
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/ellipsenode.h1
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp56
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/linenode.h2
-rw-r--r--kstars/kstarslite/skyitems/skynodes/trixelnode.cpp6
-rw-r--r--kstars/kstarslite/skyitems/skynodes/trixelnode.h10
-rw-r--r--kstars/kstarslite/skyitems/staritem.cpp11
-rw-r--r--kstars/kstarslite/skyitems/telescopesymbolsitem.cpp83
-rw-r--r--kstars/kstarslite/skyitems/telescopesymbolsitem.h57
-rw-r--r--kstars/kstarslite/skyobjectlite.cpp37
-rw-r--r--kstars/kstarslite/skyobjectlite.h42
-rw-r--r--kstars/kstarslite/skypointlite.cpp27
-rw-r--r--kstars/kstarslite/skypointlite.h47
-rw-r--r--kstars/main.cpp16
-rw-r--r--kstars/skycomponents/constellationartcomponent.cpp57
-rw-r--r--kstars/skycomponents/constellationartcomponent.h6
-rw-r--r--kstars/skycomponents/deepstarcomponent.cpp3
-rw-r--r--kstars/skycomponents/horizontalcoordinategrid.cpp7
-rw-r--r--kstars/skycomponents/linelistindex.h1
-rw-r--r--kstars/skycomponents/skymapcomposite.cpp4
-rw-r--r--kstars/skycomponents/starcomponent.cpp2
-rw-r--r--kstars/skymaplite.cpp59
-rw-r--r--kstars/skymaplite.h27
-rw-r--r--kstars/skymapliteevents.cpp72
137 files changed, 4493 insertions, 829 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba2963d..770009a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,6 +56,7 @@ else(BUILD_KSTARS_LITE)
KIO
XmlGui
Plotting
+ Notifications
#IconThemes
)
endif(BUILD_KSTARS_LITE)
@@ -76,11 +77,11 @@ find_package(INDI 1.2.0)
#FIXME is there a better way to do this?
if (INDI_FOUND)
#FIXME is the following the right way of doing this?
-find_package(KF5 REQUIRED COMPONENTS Notifications)
SET(HAVE_INDI 1)
else(INDI_FOUND)
SET(HAVE_INDI 0)
endif(INDI_FOUND)
+
set_package_properties(INDI PROPERTIES DESCRIPTION "Astronomical instrumentation control" URL "http://www.indilib.org" TYPE OPTIONAL PURPOSE "Support for controlling astronomical devices on Linux with KStars.")
find_package(WCSLIB)
diff --git a/apk/AndroidManifest.xml b/apk/AndroidManifest.xml
index 8daa418..2ba5bfb 100644
--- a/apk/AndroidManifest.xml
+++ b/apk/AndroidManifest.xml
@@ -38,5 +38,8 @@
</activity>
</application>
<supports-screens android:anyDensity="true" android:normalScreens="true" android:smallScreens="true" android:largeScreens="true"/>
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19"/>
</manifest>
diff --git a/cmake/modules/FindCFitsio.cmake b/cmake/modules/FindCFitsio.cmake
index dc50f16..826072f 100644
--- a/cmake/modules/FindCFitsio.cmake
+++ b/cmake/modules/FindCFitsio.cmake
@@ -35,9 +35,13 @@ else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
find_library(CFITSIO_LIBRARIES NAMES cfitsio libcfitsio
PATHS
- ${PC_CFITSIO_LIBRARY_DIRS}
- ${_obLinkDir}
- ${GNUWIN32_DIR}/lib
+ if(ANDROID)
+ ${CMAKE_SOURCE_DIR}/android_lib
+ else(ANDROID)
+ ${PC_CFITSIO_INCLUDE_DIRS}
+ ${_obIncDir}
+ ${GNUWIN32_DIR}/include
+ endif(ANDROID)
)
if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
diff --git a/cmake/modules/FindINDI.cmake b/cmake/modules/FindINDI.cmake
index 1b7b439..b09b730 100644
--- a/cmake/modules/FindINDI.cmake
+++ b/cmake/modules/FindINDI.cmake
@@ -3,6 +3,9 @@
#
# INDI_FOUND - system has INDI
# INDI_INCLUDE_DIR - the INDI include directory
+# For Android
+# INDI_CLIENT_ANDROID_LIBRARIES - Link to these for INDI Android client
+# For other platforms
# INDI_LIBRARIES - Link to these for XML and INDI Common support
# INDI_CLIENT_LIBRARIES - Link to these to build INDI clients
# INDI_CLIENT_QT_LIBRARIES - Link to these to build INDI clients with Qt5 backend
@@ -48,12 +51,12 @@ if (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND (INDI_CLIENT_LIBRARIES OR INDI_CLIEN
else (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_CLIENT_LIBRARIES)
- if (NOT WIN32)
+ if (NOT WIN32 AND NOT ANDROID)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_INDI INDI)
endif (PKG_CONFIG_FOUND)
- endif (NOT WIN32)
+ endif (NOT WIN32 AND NOT ANDROID)
find_path(INDI_INCLUDE_DIR indidevapi.h
PATH_SUFFIXES libindi
@@ -65,28 +68,44 @@ else (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_CLIENT_LIBRARIES)
if (INDI_INCLUDE_DIR)
_INDI_check_version()
- find_library(INDI_LIBRARIES NAMES indi
- PATHS
- ${PC_INDI_LIBRARY_DIRS}
- ${_obLinkDir}
- ${GNUWIN32_DIR}/lib
- )
-
- find_library(INDI_CLIENT_LIBRARIES NAMES indiclient
- PATHS
- ${PC_INDI_LIBRARY_DIRS}
- ${_obLinkDir}
- ${GNUWIN32_DIR}/lib
- )
-
- find_library(INDI_CLIENT_QT_LIBRARIES NAMES indiclientqt
- PATHS
- ${PC_INDI_LIBRARY_DIRS}
- ${_obLinkDir}
- ${GNUWIN32_DIR}/lib
- )
+ if(ANDROID)
+ find_library(INDI_CLIENT_ANDROID_LIBRARIES NAMES indiclientandroid
+ PATHS
+ ${CMAKE_SOURCE_DIR}/android_lib
+ )
+
+ else(ANDROID)
+ find_library(INDI_LIBRARIES NAMES indi
+ PATHS
+ ${PC_INDI_LIBRARY_DIRS}
+ ${_obLinkDir}
+ ${GNUWIN32_DIR}/lib
+ )
+
+ find_library(INDI_CLIENT_LIBRARIES NAMES indiclient
+ PATHS
+ ${PC_INDI_LIBRARY_DIRS}
+ ${_obLinkDir}
+ ${GNUWIN32_DIR}/lib
+ )
+
+ find_library(INDI_CLIENT_QT_LIBRARIES NAMES indiclientqt
+ PATHS
+ ${PC_INDI_LIBRARY_DIRS}
+ ${_obLinkDir}
+ ${GNUWIN32_DIR}/lib
+ )
+
+ endif(ANDROID)
+
endif(INDI_INCLUDE_DIR)
-
+if(ANDROID)
+ if(INDI_CLIENT_ANDROID_LIBRARIES)
+ set(INDI_FOUND TRUE)
+ else(INDI_CLIENT_ANDROID_LIBRARIES)
+ set(INDI_FOUND FALSE)
+ endif(INDI_CLIENT_ANDROID_LIBRARIES)
+else(ANDROID)
if (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND (INDI_CLIENT_LIBRARIES OR INDI_CLIENT_QT_LIBRARIES))
# If INDI is found we need to make sure on WIN32 we have INDI Client Qt backend otherwise we can't use INDI
if (WIN32)
@@ -101,16 +120,22 @@ endif(INDI_INCLUDE_DIR)
else (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND (INDI_CLIENT_LIBRARIES OR INDI_CLIENT_QT_LIBRARIES))
set(INDI_FOUND FALSE)
endif (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND (INDI_CLIENT_LIBRARIES OR INDI_CLIENT_QT_LIBRARIES))
+endif(ANDROID)
if (INDI_FOUND)
if (NOT INDI_FIND_QUIETLY)
+ if(ANDROID)
+ message(STATUS "Found INDI Android Client: ${INDI_CLIENT_ANDROID_LIBRARIES}")
+ else(ANDROID)
message(STATUS "Found INDI: ${INDI_LIBRARIES}, ${INDI_INCLUDE_DIR}")
+
if (INDI_CLIENT_LIBRARIES)
message(STATUS "Found INDI Client Library: ${INDI_CLIENT_LIBRARIES}")
endif (INDI_CLIENT_LIBRARIES)
if (INDI_CLIENT_QT_LIBRARIES)
message(STATUS "Found INDI Qt5 Client Library: ${INDI_CLIENT_QT_LIBRARIES}")
endif (INDI_CLIENT_QT_LIBRARIES)
+ endif(ANDROID)
endif (NOT INDI_FIND_QUIETLY)
else (INDI_FOUND)
if (INDI_FIND_REQUIRED)
@@ -118,6 +143,10 @@ endif(INDI_INCLUDE_DIR)
endif (INDI_FIND_REQUIRED)
endif (INDI_FOUND)
+ if(ANDROID)
+ mark_as_advanced(INDI_INCLUDE_DIR INDI_CLIENT_ANDROID_LIBRARIES)
+ else(ANDROID)
mark_as_advanced(INDI_INCLUDE_DIR INDI_LIBRARIES INDI_CLIENT_LIBRARIES INDI_CLIENT_QT_LIBRARIES)
+ endif(ANDROID)
endif (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND (INDI_CLIENT_LIBRARIES OR INDI_CLIENT_QT_LIBRARIES))
diff --git a/cmake/modules/FindNova.cmake b/cmake/modules/FindNova.cmake
index 8ea8433..6328828 100644
--- a/cmake/modules/FindNova.cmake
+++ b/cmake/modules/FindNova.cmake
@@ -27,8 +27,12 @@ else (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES)
find_library(NOVA_LIBRARIES NAMES nova libnova
PATHS
+ if(ANDROID)
+ ${CMAKE_SOURCE_DIR}/android_lib
+ else(ANDROID)
${_obLinkDir}
${GNUWIN32_DIR}/lib
+ endif(ANDROID)
)
set(CMAKE_REQUIRED_INCLUDES ${NOVA_INCLUDE_DIR})
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 16bc68f..4b48133 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -61,8 +61,47 @@ if(NOT BUILD_KSTARS_LITE)
)
include_directories(${CFITSIO_INCLUDE_DIR})
endif(CFITSIO_FOUND)
+endif(NOT BUILD_KSTARS_LITE)
- if (INDI_FOUND)
+if (INDI_FOUND)
+if(BUILD_KSTARS_LITE)
+ set (indi_SRCS
+ indi/clientmanagerlite.cpp
+ indi/inditelescopelite.cpp
+ #indi/drivermanager.cpp
+ #indi/servermanager.cpp
+ #indi/clientmanager.cpp
+ #indi/guimanager.cpp
+ #indi/driverinfo.cpp
+ #indi/deviceinfo.cpp
+ #indi/indidevice.cpp
+ #indi/indigroup.cpp
+ #indi/indiproperty.cpp
+ #indi/indielement.cpp
+ #indi/indistd.cpp
+ #indi/indilistener.cpp
+ #indi/inditelescope.cpp
+ #indi/indiccd.cpp
+ #indi/indifocuser.cpp
+ #indi/indifilter.cpp
+ #indi/indidome.cpp
+ #indi/indiweather.cpp
+ #indi/indicap.cpp
+ #indi/indilightbox.cpp
+ #indi/indidbus.cpp
+ #indi/opsindi.cpp
+ #indi/telescopewizardprocess.cpp
+ #indi/streamwg.cpp
+ )
+ set(indiui_SRCS
+ indi/drivermanager.ui
+ #indi/opsindi.ui
+ #indi/indihostconf.ui
+ #indi/streamform.ui
+ #indi/telescopewizard.ui
+ )
+ include_directories(${INDI_INCLUDE_DIR})
+elseif(BUILD_KSTARS_LITE)
set (indi_SRCS
indi/drivermanager.cpp
indi/servermanager.cpp
@@ -145,10 +184,10 @@ if(NOT BUILD_KSTARS_LITE)
)
endif(CFITSIO_FOUND)
+endif(BUILD_KSTARS_LITE)
+endif (INDI_FOUND)
- include_directories(${INDI_INCLUDE_DIR})
- endif(INDI_FOUND)
-
+if(NOT BUILD_KSTARS_LITE)
if (WCSLIB_FOUND)
include_directories( ${WCSLIB_INCLUDE_DIR} )
endif (WCSLIB_FOUND)
@@ -539,11 +578,24 @@ if(NOT BUILD_KSTARS_LITE)
endif(NOT BUILD_KSTARS_LITE)
if(BUILD_KSTARS_LITE)
+ add_definitions(-DQML_IMPORT="${CMAKE_CURRENT_SOURCE_DIR}")
+
+ if(INDI_FOUND)
+ set(indi_lite_SRCS
+ kstarslite/skyitems/skynodes/crosshairnode.cpp
+ kstarslite/skyitems/telescopesymbolsitem.cpp
+ )
+ endif(INDI_FOUND)
+
set(kstarslite_SRCS
kstarslite.cpp
kstarsliteinit.cpp
skymaplite.cpp
skymapliteevents.cpp
+ ${indi_lite_SRCS}
+ #Wrappers
+ kstarslite/skypointlite.cpp
+ kstarslite/skyobjectlite.cpp
#RootNode
kstarslite/skyitems/rootnode.cpp
kstarslite/skyitems/skyopacitynode.cpp
@@ -608,28 +660,35 @@ if(BUILD_KSTARS_LITE)
libtess/glu.h
libtess/tessellate.c
)
- add_definitions(-DANSI_DECLARATORS) #Needed for Triangle
- add_definitions(-DTRILIBRARY)
- add_definitions(-DREDUCED)
- #add_definitions(-DCDT_ONLY)
- if(NOT ANDROID)
- add_definitions(-DLINUX)
- endif()
#Qml files will be probably moved to user's data dir, but for use
#with QtCreator it is more convenient to have them here
set(kstarsliteqml_SRCS
kstarslite/qml/main.qml
kstarslite/qml/constants/Constants.qml
kstarslite/qml/modules/BottomMenu.qml
- kstarslite/qml/modules/ContextDrawer.qml
- kstarslite/qml/modules/GlobalDrawer.qml
+ kstarslite/qml/modules/KSPage.qml
+ kstarslite/qml/modules/KSScrollablePage.qml
kstarslite/qml/modules/TopMenu.qml
- kstarslite/qml/modules/helpers/DrawerColorScheme.qml
- kstarslite/qml/modules/helpers/DrawerElem.qml
kstarslite/qml/modules/helpers/TopMenuButton.qml
kstarslite/qml/modules/Splash.qml
+ kstarslite/qml/modules/ContextDrawerMenu.qml
+ kstarslite/qml/modules/TelescopeControlMenu.qml
+ kstarslite/qml/indi/INDIControlPanel.qml
+ kstarslite/qml/indi/DevicePanel.qml
+ kstarslite/qml/indi/modules/MotionControl.qml
+ kstarslite/qml/indi/modules/Led.qml
+ kstarslite/qml/indi/modules/Property.qml
+ kstarslite/qml/indi/modules/KSTab.qml
+ kstarslite/qml/indi/modules/KSComboBox.qml
+ kstarslite/qml/indi/modules/KSButton.qml
+ kstarslite/qml/indi/modules/KSCheckBox.qml
+ kstarslite/qml/indi/modules/KSINDIText.qml
+ kstarslite/qml/indi/modules/KSINDINumber.qml
+ kstarslite/qml/indi/modules/KSINDINumberField.qml
+ kstarslite/qml/indi/modules/KSButtonsRow.qml
)
add_subdirectory(kstarslite/qml)
+ add_subdirectory(kstarslite/kirigami)
if(ANDROID)
add_subdirectory(kstarslite/res)
endif()
@@ -776,10 +835,6 @@ else(BUILD_KSTARS_LITE)
)
endif(BUILD_KSTARS_LITE)
-add_executable(kstars main.cpp)
-
-target_link_libraries(kstars KStarsLib)
-
if(NOT WIN32)
target_link_libraries(KStarsLib m)
endif(NOT WIN32)
@@ -787,23 +842,34 @@ if (CFITSIO_FOUND)
target_link_libraries(KStarsLib ${CFITSIO_LIBRARIES})
endif(CFITSIO_FOUND)
-
if(INDI_FOUND)
- target_link_libraries(KStarsLib ${CMAKE_THREAD_LIBS_INIT} KF5::Notifications)
+ add_definitions(-DINDI_FOUND)
+ if(BUILD_KSTARS_LITE)
+ find_package(Nova REQUIRED)
+ target_link_libraries(KStarsLib ${CMAKE_THREAD_LIBS_INIT} ${NOVA_LIBRARIES})
+ else(BUILD_KSTARS_LITE)
+ target_link_libraries(KStarsLib ${CMAKE_THREAD_LIBS_INIT} KF5::Notifications)
+ endif(BUILD_KSTARS_LITE)
- if(WIN32)
+ if(ANDROID)
add_definitions(-DUSE_QT5_INDI)
- find_package(Nova REQUIRED)
- target_link_libraries(KStarsLib ${NOVA_LIBRARIES} ${INDI_LIBRARIES} ${INDI_CLIENT_QT_LIBRARIES})
- else(WIN32)
- # If INDI Qt5 Client is found, use it.
- if (INDI_CLIENT_QT_LIBRARIES)
+ target_link_libraries(KStarsLib ${INDI_CLIENT_ANDROID_LIBRARIES})
+ else(ANDROID)
+ if(WIN32)
add_definitions(-DUSE_QT5_INDI)
- target_link_libraries(KStarsLib ${INDI_LIBRARIES} ${INDI_CLIENT_QT_LIBRARIES})
- else(INDI_CLIENT_QT_LIBRARIES)
- target_link_libraries(KStarsLib ${INDI_LIBRARIES} ${INDI_CLIENT_LIBRARIES})
- endif(INDI_CLIENT_QT_LIBRARIES)
- endif(WIN32)
+ find_package(Nova REQUIRED)
+ target_link_libraries(KStarsLib ${NOVA_LIBRARIES} ${INDI_LIBRARIES} ${INDI_CLIENT_QT_LIBRARIES})
+ else(WIN32)
+ # If INDI Qt5 Client is found, use it.
+
+ if (INDI_CLIENT_QT_LIBRARIES)
+ add_definitions(-DUSE_QT5_INDI)
+ target_link_libraries(KStarsLib ${INDI_LIBRARIES} ${INDI_CLIENT_QT_LIBRARIES} z)
+ else(INDI_CLIENT_QT_LIBRARIES)
+ target_link_libraries(KStarsLib ${INDI_LIBRARIES} ${INDI_CLIENT_LIBRARIES} z)
+ endif(INDI_CLIENT_QT_LIBRARIES)
+ endif(WIN32)
+ endif(ANDROID)
endif(INDI_FOUND)
@@ -834,9 +900,6 @@ ecm_add_app_icon(KSTARS_APP_SRCS ICONS
if(NOT BUILD_KSTARS_LITE)
qt5_add_resources(KSTARS_APP_SRCS data/kstars.qrc)
-add_executable(kstars ${KSTARS_APP_SRCS})
-target_link_libraries(kstars KStarsLib)
-
install(TARGETS kstars ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
@@ -847,4 +910,7 @@ install(FILES kstars.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
#install(FILES fitsviewer.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kstars)
install(FILES kstars.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
endif(NOT BUILD_KSTARS_LITE)
->>>>>>> master
+
+add_executable(kstars ${KSTARS_APP_SRCS})
+target_link_libraries(kstars KStarsLib)
+
diff --git a/kstars/indi/clientmanagerlite.cpp b/kstars/indi/clientmanagerlite.cpp
new file mode 100644
index 0000000..8a1029d
--- /dev/null
+++ b/kstars/indi/clientmanagerlite.cpp
@@ -0,0 +1,541 @@
+/** *************************************************************************
+ clientmanagerlite.cpp - K Desktop Planetarium
+ -------------------
+ begin : 10/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "clientmanagerlite.h"
+#include "Options.h"
+#include "basedevice.h"
+#include "kstarslite.h"
+#include <QQmlApplicationEngine>
+#include <KLocalizedString>
+#include "indicom.h"
+#include "skymaplite.h"
+#include "kstarslite/skyitems/telescopesymbolsitem.h"
+
+
+DeviceInfoLite::DeviceInfoLite(INDI::BaseDevice *dev)
+ :device(dev), telescope(nullptr)
+{
+
+}
+
+ClientManagerLite::ClientManagerLite()
+ :m_connected(false)
+{
+ qmlRegisterType<TelescopeLite>("TelescopeLiteEnums", 1, 0, "TelescopeNS");
+ qmlRegisterType<TelescopeLite>("TelescopeLiteEnums", 1, 0, "TelescopeWE");
+ qmlRegisterType<TelescopeLite>("TelescopeLiteEnums", 1, 0, "TelescopeCommand");
+}
+
+ClientManagerLite::~ClientManagerLite()
+{
+
+}
+
+bool ClientManagerLite::setHost(QString ip, unsigned int port) {
+ if(!isConnected()) {
+ setServer(ip.toStdString().c_str(), port);
+ qDebug() << ip << port;
+ if(connectServer()) {
+ setConnectedHost(ip + ":" + QString::number(port));
+ return true;
+ }
+ }
+ return false;
+}
+
+void ClientManagerLite::disconnectHost() {
+ disconnectServer();
+ setConnectedHost("");
+ m_devices.clear();
+}
+
+TelescopeLite *ClientManagerLite::getTelescope(QString deviceName) {
+ foreach(DeviceInfoLite *devInfo, m_devices) {
+ if(devInfo->device->getDeviceName() == deviceName) {
+ return devInfo->telescope;
+ }
+ }
+ return nullptr;
+}
+
+void ClientManagerLite::setConnectedHost(QString connectedHost) {
+ m_connectedHost = connectedHost;
+ setConnected(m_connectedHost.size() > 0);
+
+ emit connectedHostChanged(connectedHost);
+}
+
+void ClientManagerLite::setConnected(bool connected) {
+ m_connected = connected;
+ emit connectedChanged(connected);
+}
+
+QString ClientManagerLite::updateLED(QString device, QString property) {
+ foreach(DeviceInfoLite *devInfo, m_devices) {
+ if(devInfo->device->getDeviceName() == device) {
+ INDI::Property *prop = devInfo->device->getProperty(property.toStdString().c_str());
+ if(prop) {
+ switch (prop->getState())
+ {
+ case IPS_IDLE:
+ return "grey";
+ break;
+
+ case IPS_OK:
+ return "green";
+ break;
+
+ case IPS_BUSY:
+ return "yellow";
+ break;
+
+ case IPS_ALERT:
+ return "red";
+ break;
+
+ default:
+ return "grey";
+ break;
+ }
+ }
+ }
+ }
+ return "grey";
+}
+
+void ClientManagerLite::buildTextGUI(Property * property) {
+ {
+ ITextVectorProperty *tvp = property->getText();
+ if (tvp == NULL)
+ return;
+
+ for (int i=0; i < tvp->ntp; i++)
+ {
+ IText *tp = &(tvp->tp[i]);
+ QString name = tp->name;
+ QString label = tp->label;
+ QString text = tp->text;
+ bool read = false;
+ bool write = false;
+ /*if (tp->label[0])
+ label = i18nc(libindi_strings_context, itp->label);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")
+ label = itp->label;*/
+
+ if (label.isEmpty())
+ label = tvp->name;
+ /*label = i18nc(libindi_strings_context, itp->name);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")*/
+
+ //setupElementLabel();
+
+ /*if (tp->text[0])
+ text = i18nc(libindi_strings_context, tp->text);*/
+
+ switch (property->getPermission())
+ {
+ case IP_RW:
+ read = true;
+ write = true;
+
+ break;
+
+ case IP_RO:
+ read = true;
+ write = false;
+ break;
+
+ case IP_WO:
+ read = false;
+ write = true;
+ break;
+ }
+ emit createINDIText(property->getDeviceName(), property->getName(), label, text, read, write);
+ }
+ }
+}
+
+void ClientManagerLite::buildNumberGUI(Property * property) {
+ {
+ INumberVectorProperty *nvp = property->getNumber();
+ if (nvp == NULL)
+ return;
+
+ for (int i=0; i < nvp->nnp; i++)
+ {
+ bool scale = false;
+ char iNumber[MAXINDIFORMAT];
+
+ INumber *np = &(nvp->np[i]);
+ QString name = np->name;
+ QString label = np->label;
+ QString text;
+ bool read = false;
+ bool write = false;
+ /*if (tp->label[0])
+ label = i18nc(libindi_strings_context, itp->label);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")
+ label = itp->label;*/
+
+ if (label.isEmpty())
+ label = np->name;
+
+ numberFormat(iNumber, np->format, np->value);
+ text = iNumber;
+
+ /*label = i18nc(libindi_strings_context, itp->name);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")*/
+
+ //setupElementLabel();
+
+ /*if (tp->text[0])
+ text = i18nc(libindi_strings_context, tp->text);*/
+
+ if (np->step != 0 && (np->max - np->min)/np->step <= 100)
+ scale = true;
+
+ switch (property->getPermission())
+ {
+ case IP_RW:
+ read = true;
+ write = true;
+
+ break;
+
+ case IP_RO:
+ read = true;
+ write = false;
+ break;
+
+ case IP_WO:
+ read = false;
+ write = true;
+ break;
+ }
+ emit createINDINumber(property->getDeviceName(), property->getName(), label, text, read, write, scale);
+ }
+ }
+}
+
+void ClientManagerLite::buildMenuGUI(INDI::Property * property) {
+ QStringList menuOptions;
+ QString oneOption;
+ int onItem=-1;
+ ISwitchVectorProperty *svp = property->getSwitch();
+
+ if (svp == NULL)
+ return;
+
+ for (int i=0; i < svp->nsp; i++)
+ {
+ ISwitch *tp = &(svp->sp[i]);
+
+ buildSwitch(false,tp,property);
+
+ /*if (tp->s == ISS_ON)
+ onItem = i;
+
+ lp = new INDI_E(this, dataProp);
+
+ lp->buildMenuItem(tp);
+
+ oneOption = i18nc(libindi_strings_context, lp->getLabel().toUtf8());
+
+ if (oneOption == "(I18N_EMPTY_MESSAGE)")
+ oneOption = lp->getLabel().toUtf8();
+
+ menuOptions.append(oneOption);
+
+ elementList.append(lp);*/
+ }
+}
+
+void ClientManagerLite::buildSwitchGUI(INDI::Property * property, PGui guiType) {
+ ISwitchVectorProperty *svp = property->getSwitch();
+ bool exclusive = false;
+
+ if (svp == NULL)
+ return;
+
+ if (guiType == PG_BUTTONS)
+ {
+ if (svp->r == ISR_1OFMANY)
+ exclusive = true;
+ else
+ exclusive = false;
+ }
+ else if (guiType == PG_RADIO)
+ exclusive = false;
+
+ /*if (svp->p != IP_RO)
+ QObject::connect(groupB, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(newSwitch(QAbstractButton *)));*/
+
+ for (int i=0; i < svp->nsp; i++)
+ {
+ ISwitch *sp = &(svp->sp[i]);
+ buildSwitch(true, sp, property, exclusive, guiType);
+ }
+}
+
+void ClientManagerLite::buildSwitch(bool buttonGroup, ISwitch *sw, INDI::Property * property, bool exclusive, PGui guiType) {
+ QString name = sw->name;
+ QString label = sw->label;//i18nc(libindi_strings_context, sw->label);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")
+ label = sw->label;
+
+ if (label.isEmpty())
+ label = sw->name;
+ //label = i18nc(libindi_strings_context, sw->name);
+
+ if (label == "(I18N_EMPTY_MESSAGE)")
+ label = sw->name;
+
+ if (!buttonGroup) {
+ bool isSelected = false;
+ if(sw->s == ISS_ON) isSelected = true;
+ emit createINDIMenu(property->getDeviceName(),property->getName(), label, sw->name, isSelected);
+ return;
+ }
+
+ bool enabled = true;
+
+ if (sw->svp->p == IP_RO)
+ enabled = (sw->s == ISS_ON);
+
+ switch (guiType)
+ {
+ case PG_BUTTONS:
+ emit createINDIButton(property->getDeviceName(),property->getName(),label,name,true,true,exclusive,sw->s == ISS_ON, enabled);
+ break;
+
+ case PG_RADIO:
+ emit createINDIRadio(property->getDeviceName(),property->getName(),label,name,true,true,exclusive, sw->s == ISS_ON, enabled);
+ /*check_w = new QCheckBox(label, guiProp->getGroup()->getContainer());
+ groupB->addButton(check_w);
+
+ syncSwitch();
+
+ guiProp->addWidget(check_w);
+
+ check_w->show();
+
+ if (sw->svp->p == IP_RO)
+ check_w->setEnabled(sw->s == ISS_ON);
+
+ break;*/
+
+ default:
+ break;
+
+ }
+}
+
+void ClientManagerLite::sendNewINDISwitch(QString deviceName, QString propName, QString name) {
+ foreach(DeviceInfoLite *devInfo, m_devices) {
+ INDI::BaseDevice *device = devInfo->device;
+ if(device->getDeviceName() == deviceName) {
+ INDI::Property *property = device->getProperty(propName.toStdString().c_str());
+ if(property) {
+
+ ISwitchVectorProperty *svp = property->getSwitch();
+
+ if (svp == NULL)
+ return;
+
+ ISwitch *sp = IUFindSwitch(svp, name.toLatin1().constData());
+
+ if (sp == NULL)
+ return;
+
+ if (svp->r == ISR_1OFMANY)
+ {
+ IUResetSwitch(svp);
+ sp->s = ISS_ON;
+ }
+ else
+ {
+ if (svp->r == ISR_ATMOST1)
+ {
+ ISState prev_state = sp->s;
+ IUResetSwitch(svp);
+ sp->s = prev_state;
+ }
+
+ sp->s = (sp->s == ISS_ON) ? ISS_OFF : ISS_ON;
+ }
+ sendNewSwitch(svp);
+ }
+ }
+ }
+}
+
+void ClientManagerLite::sendNewINDISwitch(QString deviceName, QString propName, int index) {
+ if(index >= 0) {
+ foreach(DeviceInfoLite *devInfo, m_devices) {
+ INDI::BaseDevice *device = devInfo->device;
+ if(device->getDeviceName() == deviceName) {
+ INDI::Property *property = device->getProperty(propName.toStdString().c_str());
+ if(property) {
+
+ ISwitchVectorProperty *svp = property->getSwitch();
+
+ if (svp == NULL)
+ return;
+
+ if (index >= svp->nsp)
+ return;
+
+ ISwitch *sp = &(svp->sp[index]);
+
+ IUResetSwitch(svp);
+ sp->s = ISS_ON;
+
+ sendNewSwitch(svp);
+ }
+ }
+ }
+ }
+}
+
+bool ClientManagerLite::isDeviceConnected(QString deviceName) {
+ INDI::BaseDevice * device = getDevice(deviceName.toStdString().c_str());
+ if(device != NULL) {
+ return device->isConnected();
+ }
+ return false;
+}
+
+void ClientManagerLite::newDevice(INDI::BaseDevice *dp)
+{
+ setBLOBMode(B_ALSO, dp->getDeviceName());
+
+ QString deviceName = dp->getDeviceName();
+
+ if (deviceName.isEmpty())
+ {
+ qWarning() << "Received invalid device with empty name! Ignoring the device...";
+ return;
+ }
+
+ if (Options::verboseLogging())
+ qDebug() << "Received new device " << deviceName;
+ emit newINDIDevice(deviceName);
+
+
+ DeviceInfoLite *devInfo = new DeviceInfoLite(dp);
+ //Think about it!
+ //devInfo->telescope = new TelescopeLite(dp);
+ m_devices.append(devInfo);
+}
+
+void ClientManagerLite::removeDevice(BaseDevice *dp) {
+ emit removeINDIDevice(QString(dp->getDeviceName()));
+}
+
+void ClientManagerLite::newProperty(INDI::Property *property)
+{
+ QString deviceName = property->getDeviceName();
+ QString name = property->getName();
+ QString groupName = property->getGroupName();
+ QString type = QString(property->getType());
+ QString label = property->getLabel();
+
+ DeviceInfoLite *devInfo = NULL;
+
+ foreach(DeviceInfoLite *di, m_devices) {
+ if(di->device->getDeviceName() == deviceName) {
+ devInfo = di;
+ }
+ }
+
+ if(devInfo) {
+ if ((!strcmp(property->getName(), "EQUATORIAL_EOD_COORD") ||
+ !strcmp(property->getName(), "HORIZONTAL_COORD")) ) {
+ devInfo->telescope = new TelescopeLite(devInfo->device);
+ emit telescopeAdded(devInfo->telescope);
+ }
+ }
+
+ emit newINDIProperty(deviceName, name, groupName, type, label);
+ PGui guiType;
+ switch (property->getType())
+ {
+ case INDI_SWITCH:
+ if (property->getSwitch()->r == ISR_NOFMANY)
+ guiType = PG_RADIO;
+ else if (property->getSwitch()->nsp > 4)
+ guiType = PG_MENU;
+ else
+ guiType = PG_BUTTONS;
+
+ if (guiType == PG_MENU)
+ buildMenuGUI(property);
+ else
+ buildSwitchGUI(property, guiType);
+ break;
+
+ case INDI_TEXT:
+ buildTextGUI(property);
+ break;
+ case INDI_NUMBER:
+ buildNumberGUI(property);
+ break;
+
+ case INDI_LIGHT:
+ //buildLightGUI();
+ break;
+
+ case INDI_BLOB:
+ //buildBLOBGUI();
+ break;
+
+ default:
+ break;
+ }
+}
+
+void ClientManagerLite::removeProperty(INDI::Property *property) {
+ emit removeINDIProperty(property->getGroupName(),property->getName());
+}
+
+void ClientManagerLite::newSwitch(ISwitchVectorProperty *svp) {
+ for(int i = 0; i < svp->nsp; ++i) {
+ ISwitch *sw = &(svp->sp[i]);
+ if(QString(sw->name) == QString("CONNECT")) {
+ emit deviceConnected(svp->device, sw->s == ISS_ON);
+ }
+ if(sw != NULL) {
+ emit newINDISwitch(svp->device, svp->name, sw->name, sw->s == ISS_ON);
+ }
+ }
+}
+
+void ClientManagerLite::newNumber(INumberVectorProperty *nvp)
+{
+ if ((!strcmp(nvp->name, "EQUATORIAL_EOD_COORD") ||
+ !strcmp(nvp->name, "HORIZONTAL_COORD")) ) {
+ KStarsLite::Instance()->map()->update(); // Update SkyMap if position of telescope is changed
+ }
+}
+
+void ClientManagerLite::serverDisconnected(int exit_code) {
+ setConnected(false);
+}
diff --git a/kstars/indi/clientmanagerlite.h b/kstars/indi/clientmanagerlite.h
new file mode 100644
index 0000000..ab7f4a0
--- /dev/null
+++ b/kstars/indi/clientmanagerlite.h
@@ -0,0 +1,116 @@
+/** *************************************************************************
+ clientmanagerlite.h - K Desktop Planetarium
+ -------------------
+ begin : 10/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CLIENTMANAGERLITE_H
+#define CLIENTMANAGERLITE_H
+
+#include <baseclientqt.h>
+#include "inditelescopelite.h"
+#include "indicommon.h"
+
+using namespace INDI;
+class TelescopeLite;
+
+struct DeviceInfoLite {
+ DeviceInfoLite(INDI::BaseDevice *dev);
+ INDI::BaseDevice *device;
+
+ //Motion control
+ TelescopeLite *telescope;
+};
+
+/**
+ * @class ClientManagerLite
+ *
+ * @author Artem Fedoskin
+ * @version 1.0
+ */
+class ClientManagerLite : public INDI::BaseClientQt
+{
+ Q_OBJECT
+ Q_PROPERTY(QString connectedHost READ connectedHost WRITE setConnectedHost NOTIFY connectedHostChanged)
+ Q_PROPERTY(bool connected READ isConnected WRITE setConnected NOTIFY connectedChanged)
+public:
+ ClientManagerLite();
+ virtual ~ClientManagerLite();
+ Q_INVOKABLE bool setHost(QString ip, unsigned int port);
+ Q_INVOKABLE void disconnectHost();
+
+ Q_INVOKABLE TelescopeLite *getTelescope(QString deviceName);
+
+ QString connectedHost() { return m_connectedHost; }
+ void setConnectedHost(QString connectedHost);
+ void setConnected(bool connected);
+ Q_INVOKABLE QString updateLED(QString device, QString property);
+
+ void buildTextGUI(INDI::Property * property);
+ void buildNumberGUI(INDI::Property * property);
+ void buildMenuGUI(INDI::Property * property);
+ void buildSwitchGUI(INDI::Property * property, PGui guiType);
+ void buildSwitch(bool buttonGroup, ISwitch *sw, INDI::Property *property, bool exclusive = false, PGui guiType = PG_BUTTONS);
+
+ Q_INVOKABLE void sendNewINDISwitch(QString deviceName, QString propName, QString name);
+ Q_INVOKABLE void sendNewINDISwitch(QString deviceName, QString propName, int index);
+
+ bool isConnected() { return m_connected; }
+ Q_INVOKABLE bool isDeviceConnected(QString deviceName);
+
+ QList<DeviceInfoLite *> getDevices() { return m_devices; }
+
+protected:
+ virtual void newDevice(INDI::BaseDevice *dp);
+ virtual void removeDevice(INDI::BaseDevice *dp);
+ virtual void newProperty(INDI::Property *property);
+ virtual void removeProperty(INDI::Property *property);
+ virtual void newBLOB(IBLOB *bp) {}
+ virtual void newSwitch(ISwitchVectorProperty *svp);
+ virtual void newNumber(INumberVectorProperty *nvp);
+ virtual void newMessage(INDI::BaseDevice *dp, int messageID) { }
+ virtual void newText(ITextVectorProperty *tvp) {}
+ virtual void newLight(ILightVectorProperty *lvp) {}
+ virtual void serverConnected() {}
+ virtual void serverDisconnected(int exit_code);
+signals:
+ //Device
+ void newINDIDevice(QString deviceName);
+ void removeINDIDevice(QString deviceName);
+ void deviceConnected(QString deviceName, bool isConnected);
+
+ void newINDIProperty(QString deviceName, QString propName, QString groupName, QString type, QString label);
+
+ void createINDIText(QString deviceName, QString propName, QString propLabel, QString propText, bool read, bool write);
+ void createINDINumber(QString deviceName, QString propName, QString propLabel, QString propText, bool read, bool write, bool scale);
+
+ void createINDIButton(QString deviceName, QString propName, QString propText, QString switchName, bool read, bool write, bool exclusive, bool checked, bool checkable);
+ void createINDIRadio(QString deviceName, QString propName, QString propText, QString switchName, bool read, bool write, bool exclusive, bool checked, bool enabled);
+
+ void createINDIMenu(QString deviceName, QString propName, QString switchLabel, QString switchName, bool isSelected);
+
+ void removeINDIProperty(QString groupName, QString propName);
+
+ //Update signals
+ void newINDISwitch(QString deviceName, QString propName, QString switchName, bool isOn);
+
+ void connectedHostChanged(QString);
+ void connectedChanged(bool);
+ void telescopeAdded(TelescopeLite *newTelescope);
+private:
+ QList<DeviceInfoLite *> m_devices;
+ QString m_connectedHost;
+ bool m_connected;
+};
+
+#endif // CLIENTMANAGERLITE_H
diff --git a/kstars/indi/drivermanager.cpp b/kstars/indi/drivermanager.cpp
index e0c637a..a779280 100644
--- a/kstars/indi/drivermanager.cpp
+++ b/kstars/indi/drivermanager.cpp
@@ -23,13 +23,16 @@
#include <QPushButton>
#include <QTcpServer>
+#ifndef KSTARS_LITE
#include <KMessageBox>
#include <KActionCollection>
#include <KNotifications/KNotification>
+#endif
#include "oal/log.h"
#include "oal/scope.h"
+
#include "ui_indihostconf.h"
#include "servermanager.h"
#include "guimanager.h"
@@ -123,7 +126,7 @@ DriverManager::DriverManager()
QObject::connect(ui->localTreeWidget, SIGNAL(expanded(const QModelIndex &)), this, SLOT(resizeDeviceColumn()));
if (Options::indiDriversDir().isEmpty())
- Options::setIndiDriversDir(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "indi", QStandardPaths::LocateDirectory));
+ Options::setIndiDriversDir(KSPaths::locate(QStandardPaths::GenericDataLocation, "indi", QStandardPaths::LocateDirectory));
readXMLDrivers();
diff --git a/kstars/indi/drivermanager.h b/kstars/indi/drivermanager.h
index 62753d0..b21ad02 100644
--- a/kstars/indi/drivermanager.h
+++ b/kstars/indi/drivermanager.h
@@ -128,8 +128,8 @@ private:
static DriverManager * _DriverManager;
ServerMode connectionMode;
- DriverManagerUI *ui;
+ DriverManagerUI *ui;
QList<DriverInfo *> driversList;
QList<ServerManager *> servers;
QList<ClientManager *> clients;
diff --git a/kstars/indi/drivermanager.ui.autosave b/kstars/indi/drivermanager.ui.autosave
new file mode 100644
index 0000000..35a098c
--- /dev/null
+++ b/kstars/indi/drivermanager.ui.autosave
@@ -0,0 +1,383 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DriverManager</class>
+ <widget class="QWidget" name="DriverManager">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>519</width>
+ <height>492</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Device Manager</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="leftMargin">
+ <number>2</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
+ </property>
+ <item>
+ <widget class="QTabWidget" name="ConfTabWidget">
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="LocalTab">
+ <attribute name="title">
+ <string>Local/Server</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTreeWidget" name="localTreeWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ <column>
+ <property name="text">
+ <string>Device</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Status</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Mode</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Version</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="serverLogBox">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>180</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Server Log</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QTextEdit" name="serverLogText">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Mode</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="localR">
+ <property name="text">
+ <string>Local</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="serverR">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Server</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="runServiceB">
+ <property name="text">
+ <string>Run Service</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="stopServiceB">
+ <property name="text">
+ <string>Stop Service</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>61</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="clientTab">
+ <attribute name="title">
+ <string>Client</string>
+ </attribute>
+ <layout class="QGridLayout">
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
+ <number>9</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="2" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1">
+ <widget class="QGroupBox" name="h">
+ <property name="title">
+ <string>Hosts</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="addB">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="modifyB">
+ <property name="text">
+ <string>Modify...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="removeB">
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="0" rowspan="3">
+ <widget class="QTreeWidget" name="clientTreeWidget">
+ <column>
+ <property name="text">
+ <string>Status</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>Connection</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="bottomMargin">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="connectHostB">
+ <property name="text">
+ <string>Connect</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="disconnectHostB">
+ <property name="text">
+ <string>Disconnect</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/kstars/indi/indiproperty.cpp b/kstars/indi/indiproperty.cpp
index 2ce7563..03ce9b6 100644
--- a/kstars/indi/indiproperty.cpp
+++ b/kstars/indi/indiproperty.cpp
@@ -151,7 +151,7 @@ void INDI_P::initGUI ()
switch (dataProp->getType())
{
- case INDI_SWITCH:
+ case INDI_SWITCH:
if (dataProp->getSwitch()->r == ISR_NOFMANY)
guiType = PG_RADIO;
else if (dataProp->getSwitch()->nsp > 4)
diff --git a/kstars/indi/inditelescope.cpp b/kstars/indi/inditelescope.cpp
index 4b9a886..54b7249 100644
--- a/kstars/indi/inditelescope.cpp
+++ b/kstars/indi/inditelescope.cpp
@@ -26,6 +26,7 @@ Telescope::Telescope(GDInterface *iPtr) : DeviceDecorator(iPtr)
minAlt=-1;
maxAlt=-1;
IsParked=false;
+ dType = KSTARS_UNKNOWN;
}
Telescope::~Telescope()
diff --git a/kstars/indi/inditelescope.h b/kstars/indi/inditelescope.h
index a2747b7..b835181 100644
--- a/kstars/indi/inditelescope.h
+++ b/kstars/indi/inditelescope.h
@@ -22,7 +22,7 @@ namespace ISD
*
* @author Jasem Mutlaq
*/
-class Telescope : public DeviceDecorator
+class Telescope : public QObject
{
Q_OBJECT
@@ -73,6 +73,7 @@ private:
SkyPoint currentCoord;
double minAlt,maxAlt;
bool IsParked;
+ DeviceFamily dType;
};
diff --git a/kstars/indi/inditelescopelite.cpp b/kstars/indi/inditelescopelite.cpp
new file mode 100644
index 0000000..29642a9
--- /dev/null
+++ b/kstars/indi/inditelescopelite.cpp
@@ -0,0 +1,705 @@
+/* INDI CCD
+ Copyright (C) 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#include <indi/indidevice.h>
+
+#include "Options.h"
+
+#include "clientmanagerlite.h"
+#include "inditelescopelite.h"
+
+#include "kstarslite.h"
+#include "skymaplite.h"
+
+TelescopeLite::TelescopeLite(INDI::BaseDevice *device)
+ :slewRateIndex(0)
+{
+ baseDevice = device;
+ minAlt=-1;
+ maxAlt=-1;
+ IsParked=false;
+ clientManager = KStarsLite::Instance()->clientManagerLite();
+
+ setSlewDecreasable(false);
+ setSlewIncreasable(true);
+}
+
+TelescopeLite::~TelescopeLite()
+{
+
+}
+
+void TelescopeLite::setSlewDecreasable(bool slewDecreasable) {
+ if(m_slewDecreasable != slewDecreasable) {
+ m_slewDecreasable = slewDecreasable;
+ emit slewDecreasableChanged(slewDecreasable);
+ }
+}
+
+void TelescopeLite::setSlewIncreasable(bool slewIncreasable) {
+ if(m_slewIncreasable != slewIncreasable) {
+ m_slewIncreasable = slewIncreasable;
+ emit slewIncreasableChanged(slewIncreasable);
+ }
+}
+
+void TelescopeLite::registerProperty(INDI::Property *prop)
+{
+ if (!strcmp(prop->getName(), "TELESCOPE_INFO"))
+ {
+ INumberVectorProperty *ti = prop->getNumber();
+ if (ti == NULL)
+ return;
+
+ bool aperture_ok=false, focal_ok=false;
+ double temp=0;
+ }
+
+ if (!strcmp(prop->getName(), "TELESCOPE_PARK"))
+ {
+ ISwitchVectorProperty *svp = prop->getSwitch();
+
+ if (svp)
+ {
+ ISwitch *sp = IUFindSwitch(svp, "PARK");
+ if (sp)
+ {
+ IsParked = ( (sp->s == ISS_ON) && svp->s == IPS_OK);
+ }
+ }
+ }
+
+}
+
+void TelescopeLite::processNumber(INumberVectorProperty *nvp)
+{
+
+ if (!strcmp(nvp->name, "EQUATORIAL_EOD_COORD"))
+ {
+ INumber *RA = IUFindNumber(nvp, "RA");
+ INumber *DEC = IUFindNumber(nvp, "DEC");
+ if (RA == NULL || DEC == NULL)
+ return;
+
+ currentCoord.setRA(RA->value);
+ currentCoord.setDec(DEC->value);
+
+ //KStarsLite::Instance()->map()->update();
+
+ //emit numberUpdated(nvp);
+
+ return;
+ }
+
+ if (!strcmp(nvp->name, "HORIZONTAL_COORD"))
+ {
+ INumber *Az = IUFindNumber(nvp, "AZ");
+ INumber *Alt = IUFindNumber(nvp, "ALT");
+ if (Az == NULL || Alt == NULL)
+ return;
+
+ currentCoord.setAz(Az->value);
+ currentCoord.setAlt(Alt->value);
+ currentCoord.HorizontalToEquatorial( KStarsLite::Instance()->data()->lst(), KStarsLite::Instance()->data()->geo()->lat() );
+
+ //KStarsLite::Instance()->map()->update();
+
+ //emit numberUpdated(nvp);
+
+ return;
+ }
+
+ //DeviceDecorator::processNumber(nvp);
+
+}
+
+void TelescopeLite::processSwitch(ISwitchVectorProperty *svp)
+{
+
+ if (!strcmp(svp->name, "TELESCOPE_PARK"))
+ {
+ ISwitch *sp = IUFindSwitch(svp, "PARK");
+ if (sp)
+ {
+ IsParked = ( (sp->s == ISS_ON) && svp->s == IPS_OK);
+ }
+
+ //emit switchUpdated(svp);
+
+ return;
+
+ }
+
+ //DeviceDecorator::processSwitch(svp);
+}
+
+void TelescopeLite::processText(ITextVectorProperty *tvp)
+{
+
+ //DeviceDecorator::processText(tvp);
+}
+
+bool TelescopeLite::canGuide()
+{
+ INumberVectorProperty *raPulse = baseDevice->getNumber("TELESCOPE_TIMED_GUIDE_WE");
+ INumberVectorProperty *decPulse = baseDevice->getNumber("TELESCOPE_TIMED_GUIDE_NS");
+
+ if (raPulse && decPulse)
+ return true;
+ else
+ return false;
+}
+
+bool TelescopeLite::canSync()
+{
+ ISwitchVectorProperty *motionSP = baseDevice->getSwitch("ON_COORD_SET");
+ if (motionSP == NULL)
+ return false;
+
+ ISwitch *syncSW = IUFindSwitch(motionSP, "SYNC");
+
+ return (syncSW != NULL);
+}
+
+bool TelescopeLite::canPark()
+{
+ ISwitchVectorProperty *parkSP = baseDevice->getSwitch("TELESCOPE_PARK");
+ if (parkSP == NULL)
+ return false;
+
+ ISwitch *parkSW = IUFindSwitch(parkSP, "PARK");
+
+ return (parkSW != NULL);
+}
+
+bool TelescopeLite::isSlewing()
+{
+ INumberVectorProperty *EqProp(NULL);
+
+ EqProp = baseDevice->getNumber("EQUATORIAL_EOD_COORD");
+ if (EqProp == NULL)
+ return false;
+
+ return (EqProp->s == IPS_BUSY);
+}
+
+bool TelescopeLite::isInMotion()
+{
+ ISwitchVectorProperty *movementSP(NULL);
+ bool inMotion=false;
+ bool inSlew=isSlewing();
+
+ movementSP = baseDevice->getSwitch("TELESCOPE_MOTION_NS");
+ if (movementSP)
+ inMotion = (movementSP->s == IPS_BUSY);
+
+ movementSP = baseDevice->getSwitch("TELESCOPE_MOTION_WE");
+ if (movementSP)
+ inMotion = ((movementSP->s == IPS_BUSY) || inMotion);
+
+ return (inSlew || inMotion);
+}
+
+/*bool TelescopeLite::doPulse(GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs )
+{
+ if (canGuide() == false)
+ return false;
+
+ bool raOK=false, decOK=false;
+ raOK = doPulse(ra_dir, ra_msecs);
+ decOK = doPulse(dec_dir, dec_msecs);
+
+ if (raOK && decOK)
+ return true;
+ else
+ return false;
+}
+
+bool TelescopeLite::doPulse(GuideDirection dir, int msecs )
+{
+ INumberVectorProperty *raPulse = baseDevice->getNumber("TELESCOPE_TIMED_GUIDE_WE");
+ INumberVectorProperty *decPulse = baseDevice->getNumber("TELESCOPE_TIMED_GUIDE_NS");
+ INumberVectorProperty *npulse = NULL;
+ INumber *dirPulse=NULL;
+
+ if (raPulse == NULL || decPulse == NULL)
+ return false;
+
+ switch(dir)
+ {
+ case RA_INC_DIR:
+ dirPulse = IUFindNumber(raPulse, "TIMED_GUIDE_W");
+ if (dirPulse == NULL)
+ return false;
+
+ npulse = raPulse;
+ break;
+
+ case RA_DEC_DIR:
+ dirPulse = IUFindNumber(raPulse, "TIMED_GUIDE_E");
+ if (dirPulse == NULL)
+ return false;
+
+ npulse = raPulse;
+ break;
+
+ case DEC_INC_DIR:
+ dirPulse = IUFindNumber(decPulse, "TIMED_GUIDE_N");
+ if (dirPulse == NULL)
+ return false;
+
+ npulse = decPulse;
+ break;
+
+ case DEC_DEC_DIR:
+ dirPulse = IUFindNumber(decPulse, "TIMED_GUIDE_S");
+ if (dirPulse == NULL)
+ return false;
+
+ npulse = decPulse;
+ break;
+
+ default:
+ return false;
+
+ }
+
+ if (dirPulse == NULL || npulse == NULL)
+ return false;
+
+ dirPulse->value = msecs;
+
+ clientManager->sendNewNumber(npulse);
+
+ //qDebug() << "Sending pulse for " << npulse->name << " in direction " << dirPulse->name << " for " << msecs << " ms " << endl;
+
+ return true;
+
+
+}*/
+
+bool TelescopeLite::runCommand(int command, void *ptr)
+{
+ //qDebug() << "Telescope run command is called!!!" << endl;
+
+ /*switch (command)
+ {
+ case INDI_SEND_COORDS:
+ if (ptr == NULL)
+ sendCoords(KStarsLite::Instance()->map()->clickedPoint());
+ else
+ sendCoords(static_cast<SkyPoint *> (ptr));
+
+ break;
+
+
+ case INDI_ENGAGE_TRACKING:
+ KStarsLite::Instance()->map()->setClickedPoint(&currentCoord);
+ KStarsLite::Instance()->map()->slotCenter();
+ break;
+
+ default:
+ return DeviceDecorator::runCommand(command, ptr);
+ break;
+
+ }*/
+
+ return true;
+
+}
+
+bool TelescopeLite::sendCoords(SkyPoint *ScopeTarget)
+{
+
+ INumber *RAEle(NULL), *DecEle(NULL), *AzEle(NULL), *AltEle(NULL);
+ INumberVectorProperty *EqProp(NULL), *HorProp(NULL);
+ double currentRA=0, currentDEC=0, currentAlt=0, currentAz=0, targetAlt=0;
+ bool useJ2000 (false);
+
+ EqProp = baseDevice->getNumber("EQUATORIAL_EOD_COORD");
+ if (EqProp == NULL)
+ {
+ // J2000 Property
+ EqProp = baseDevice->getNumber("EQUATORIAL_COORD");
+ if (EqProp)
+ useJ2000 = true;
+
+ }
+
+ HorProp = baseDevice->getNumber("HORIZONTAL_COORD");
+
+ if (EqProp && EqProp->p == IP_RO)
+ EqProp = NULL;
+
+ if (HorProp && HorProp->p == IP_RO)
+ HorProp = NULL;
+
+ //qDebug() << "Skymap click - RA: " << scope_target->ra().toHMSString() << " DEC: " << scope_target->dec().toDMSString();
+
+ if (EqProp)
+ {
+ RAEle = IUFindNumber(EqProp, "RA");
+ if (!RAEle) return false;
+ DecEle = IUFindNumber(EqProp, "DEC");
+ if (!DecEle) return false;
+
+ if (useJ2000)
+ ScopeTarget->apparentCoord(KStarsLite::Instance()->data()->ut().djd(), (long double) J2000);
+
+ currentRA = RAEle->value;
+ currentDEC = DecEle->value;
+
+ ScopeTarget->EquatorialToHorizontal(KStarsData::Instance()->lst(), KStarsData::Instance()->geo()->lat());
+ }
+
+ if (HorProp)
+ {
+ AzEle = IUFindNumber(HorProp, "AZ");
+ if (!AzEle) return false;
+ AltEle = IUFindNumber(HorProp,"ALT");
+ if (!AltEle) return false;
+
+ currentAz = AzEle->value;
+ currentAlt = AltEle->value;
+ }
+
+ /* Could not find either properties! */
+ if (EqProp == NULL && HorProp == NULL)
+ return false;
+
+ //targetAz = ScopeTarget->az().Degrees();
+ targetAlt= ScopeTarget->altRefracted().Degrees();
+
+ if (minAlt != -1 && maxAlt != -1)
+ {
+ if (targetAlt < minAlt || targetAlt > maxAlt)
+ {
+ //KMessageBox::error(NULL, i18n("Requested altitude %1 is outside the specified altitude limit boundary (%2,%3).", QString::number(targetAlt, 'g', 3), QString::number(minAlt, 'g', 3), QString::number(maxAlt, 'g', 3)),
+ // i18n("Telescope Motion"));
+ return false;
+ }
+ }
+
+ if (targetAlt < 0)
+ {
+ if (false/*KMessageBox::warningContinueCancel(NULL, i18n("Requested altitude is below the horizon. Are you sure you want to proceed?"), i18n("Telescope Motion"),
+ KStandardGuiItem::cont(), KStandardGuiItem::cancel(), QString("telescope_coordintes_below_horizon_warning")) == KMessageBox::Cancel*/)
+ {
+ if (EqProp)
+ {
+ RAEle->value = currentRA;
+ DecEle->value = currentDEC;
+ }
+ if (HorProp)
+ {
+ AzEle->value = currentAz;
+ AltEle->value = currentAlt;
+ }
+
+ return false;
+ }
+ }
+
+ if (EqProp)
+ {
+ RAEle->value = ScopeTarget->ra().Hours();
+ DecEle->value = ScopeTarget->dec().Degrees();
+ clientManager->sendNewNumber(EqProp);
+
+ if (Options::iNDILogging())
+ qDebug() << "ISD:Telescope: Sending coords RA " << RAEle->value << " DEC " << DecEle->value;
+
+ RAEle->value = currentRA;
+ DecEle->value = currentDEC;
+ }
+ // Only send Horizontal Coord property if Equatorial is not available.
+ else if (HorProp)
+ {
+ AzEle->value = ScopeTarget->az().Degrees();
+ AltEle->value = ScopeTarget->alt().Degrees();
+ clientManager->sendNewNumber(HorProp);
+ AzEle->value = currentAz;
+ AltEle->value = currentAlt;
+ }
+
+ return true;
+
+}
+
+bool TelescopeLite::slew(double ra, double dec)
+{
+ SkyPoint target;
+
+ target.setRA(ra);
+ target.setDec(dec);
+
+ return slew(&target);
+}
+
+bool TelescopeLite::slew(SkyPoint *ScopeTarget)
+{
+ abort();
+ ISwitchVectorProperty *motionSP = baseDevice->getSwitch("ON_COORD_SET");
+ if (motionSP == NULL)
+ return false;
+
+ ISwitch *slewSW = IUFindSwitch(motionSP, "TRACK");
+ if (slewSW == NULL)
+ slewSW = IUFindSwitch(motionSP, "SLEW");
+
+ if (slewSW == NULL)
+ return false;
+
+ if (slewSW->s != ISS_ON)
+ {
+ IUResetSwitch(motionSP);
+ slewSW->s = ISS_ON;
+ clientManager->sendNewSwitch(motionSP);
+
+ if (Options::iNDILogging())
+ qDebug() << "ISD:Telescope: " << slewSW->name;
+ }
+
+ return sendCoords(ScopeTarget);
+
+}
+
+bool TelescopeLite::sync(double ra, double dec)
+{
+ SkyPoint target;
+
+ target.setRA(ra);
+ target.setDec(dec);
+
+ return sync(&target);
+}
+
+bool TelescopeLite::sync(SkyPoint *ScopeTarget)
+{
+ abort();
+ ISwitchVectorProperty *motionSP = baseDevice->getSwitch("ON_COORD_SET");
+ if (motionSP == NULL)
+ return false;
+
+ ISwitch *syncSW = IUFindSwitch(motionSP, "SYNC");
+ if (syncSW == NULL)
+ return false;
+
+ if (syncSW->s != ISS_ON)
+ {
+ IUResetSwitch(motionSP);
+ syncSW->s = ISS_ON;
+ clientManager->sendNewSwitch(motionSP);
+
+ if (Options::iNDILogging())
+ qDebug() << "ISD:Telescope: Syncing...";
+ }
+
+ return sendCoords(ScopeTarget);
+}
+
+bool TelescopeLite::abort()
+{
+ ISwitchVectorProperty *motionSP = baseDevice->getSwitch("TELESCOPE_ABORT_MOTION");
+ if (motionSP == NULL)
+ return false;
+
+ ISwitch *abortSW = IUFindSwitch(motionSP, "ABORT");
+ if (abortSW == NULL)
+ return false;
+
+ if (Options::iNDILogging())
+ qDebug() << "ISD:Telescope: Aborted." << endl;
+
+ abortSW->s = ISS_ON;
+ clientManager->sendNewSwitch(motionSP);
+
+ return true;
+}
+
+
+bool TelescopeLite::park()
+{
+ ISwitchVectorProperty *parkSP = baseDevice->getSwitch("TELESCOPE_PARK");
+ if (parkSP == NULL)
+ return false;
+
+ ISwitch *parkSW = IUFindSwitch(parkSP, "PARK");
+ if (parkSW == NULL)
+ return false;
+
+ if (Options::iNDILogging())
+ qDebug() << "ISD:Telescope: Parking..." << endl;
+
+ IUResetSwitch(parkSP);
+ parkSW->s = ISS_ON;
+ clientManager->sendNewSwitch(parkSP);
+
+ return true;
+}
+
+bool TelescopeLite::unPark()
+{
+ ISwitchVectorProperty *parkSP = baseDevice->getSwitch("TELESCOPE_PARK");
+ if (parkSP == NULL)
+ return false;
+
+ ISwitch *parkSW = IUFindSwitch(parkSP, "UNPARK");
+ if (parkSW == NULL)
+ return false;
+
+ if (Options::iNDILogging())
+ qDebug() << "ISD:Telescope: UnParking..." << endl;
+
+ IUResetSwitch(parkSP);
+ parkSW->s = ISS_ON;
+ clientManager->sendNewSwitch(parkSP);
+
+ return true;
+}
+
+bool TelescopeLite::getEqCoords(double *ra, double *dec)
+{
+ INumberVectorProperty *EqProp(NULL);
+ INumber *RAEle(NULL), *DecEle(NULL);
+
+ EqProp = baseDevice->getNumber("EQUATORIAL_EOD_COORD");
+ if (EqProp == NULL)
+ return false;
+
+ RAEle = IUFindNumber(EqProp, "RA");
+ if (!RAEle)
+ return false;
+ DecEle = IUFindNumber(EqProp, "DEC");
+ if (!DecEle)
+ return false;
+
+ *ra = RAEle->value;
+ *dec = DecEle->value;
+
+ return true;
+
+}
+
+bool TelescopeLite::moveNS(TelescopeMotionNS dir, TelescopeMotionCommand cmd)
+{
+ ISwitchVectorProperty *motionSP = baseDevice->getSwitch("TELESCOPE_MOTION_NS");
+ if (motionSP == NULL)
+ return false;
+
+ ISwitch *motionNorth = IUFindSwitch(motionSP, "MOTION_NORTH");
+ ISwitch *motionSouth = IUFindSwitch(motionSP, "MOTION_SOUTH");
+
+ if (motionNorth == NULL || motionSouth == NULL)
+ return false;
+
+ // If same direction, return
+ if (dir == MOTION_NORTH && motionNorth->s == ((cmd == MOTION_START) ? ISS_ON : ISS_OFF))
+ return true;
+
+ if (dir == MOTION_SOUTH && motionSouth->s == ((cmd == MOTION_START) ? ISS_ON : ISS_OFF))
+ return true;
+
+ IUResetSwitch(motionSP);
+
+ if (cmd == MOTION_START)
+ {
+ if (dir == MOTION_NORTH)
+ motionNorth->s = ISS_ON;
+ else
+ motionSouth->s = ISS_ON;
+ }
+
+ clientManager->sendNewSwitch(motionSP);
+
+ return true;
+}
+
+bool TelescopeLite::moveWE(TelescopeMotionWE dir, TelescopeMotionCommand cmd)
+{
+ ISwitchVectorProperty *motionSP = baseDevice->getSwitch("TELESCOPE_MOTION_WE");
+ if (motionSP == NULL)
+ return false;
+
+ ISwitch *motionWest = IUFindSwitch(motionSP, "MOTION_WEST");
+ ISwitch *motionEast = IUFindSwitch(motionSP, "MOTION_EAST");
+
+ if (motionWest == NULL || motionEast == NULL)
+ return false;
+
+ // If same direction, return
+ if (dir == MOTION_WEST && motionWest->s == ((cmd == MOTION_START) ? ISS_ON : ISS_OFF))
+ return true;
+
+ if (dir == MOTION_EAST && motionEast->s == ((cmd == MOTION_START) ? ISS_ON : ISS_OFF))
+ return true;
+
+ IUResetSwitch(motionSP);
+
+ if (cmd == MOTION_START)
+ {
+ if (dir == MOTION_WEST)
+ motionWest->s = ISS_ON;
+ else
+ motionEast->s = ISS_ON;
+ }
+
+ clientManager->sendNewSwitch(motionSP);
+
+ return true;
+}
+
+bool TelescopeLite::setSlewRate(int index)
+{
+ ISwitchVectorProperty *slewRateSP = baseDevice->getSwitch("TELESCOPE_SLEW_RATE");
+ if (slewRateSP == NULL) {
+ return false;
+ }
+
+ int maxSlewRate = slewRateSP->nsp;
+
+ if (index < 0) {
+ index = 0;
+ } else if( index >= maxSlewRate) {
+ index = maxSlewRate - 1;
+ }
+
+ if(slewRateSP->sp[index].s != ISS_ON || index != slewRateIndex) {
+ IUResetSwitch(slewRateSP);
+
+ slewRateSP->sp[index].s = ISS_ON;
+
+ slewRateIndex = index;
+ setSlewDecreasable(index != 0);
+ setSlewIncreasable(index != maxSlewRate - 1);
+
+ clientManager->sendNewSwitch(slewRateSP);
+ }
+
+ return true;
+}
+
+bool TelescopeLite::decreaseSlewRate() {
+ return setSlewRate(slewRateIndex - 1);
+}
+
+bool TelescopeLite::increaseSlewRate() {
+ return setSlewRate(slewRateIndex + 1);
+}
+
+void TelescopeLite::setAltLimits(double minAltitude, double maxAltitude)
+{
+ minAlt=minAltitude;
+ maxAlt=maxAltitude;
+}
+
+bool TelescopeLite::isParked()
+{
+ return IsParked;
+}
diff --git a/kstars/indi/inditelescopelite.h b/kstars/indi/inditelescopelite.h
new file mode 100644
index 0000000..1507ab6
--- /dev/null
+++ b/kstars/indi/inditelescopelite.h
@@ -0,0 +1,112 @@
+/* INDI CCD
+ Copyright (C) 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef INDITELESCOPE_H
+#define INDITELESCOPE_H
+
+#include "skypoint.h"
+#include <QObject>
+#include "basedevice.h"
+#include "kstarslite/skypointlite.h"
+#include "kstarslite/skyobjectlite.h"
+
+class ClientManagerLite;
+class INDI::BaseDevice;
+
+/**
+ * @class Telescope
+ * device handle controlling telescope. It can slew and sync to a specific sky point and supports all standard propreties with INDI
+ * telescope device.
+ *
+ * @author Jasem Mutlaq
+ */
+class TelescopeLite : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool slewDecreasable READ isSlewDecreasable WRITE setSlewDecreasable NOTIFY slewDecreasableChanged)
+ Q_PROPERTY(bool slewIncreasable READ isSlewIncreasable WRITE setSlewIncreasable NOTIFY slewIncreasableChanged)
+public:
+ TelescopeLite(INDI::BaseDevice *device);
+ TelescopeLite() { }
+ ~TelescopeLite();
+
+ enum TelescopeMotionNS { MOTION_NORTH, MOTION_SOUTH };
+ enum TelescopeMotionWE { MOTION_WEST, MOTION_EAST };
+ enum TelescopeMotionCommand { MOTION_START, MOTION_STOP };
+
+ Q_ENUMS(TelescopeMotionNS)
+ Q_ENUMS(TelescopeMotionWE)
+ Q_ENUMS(TelescopeMotionCommand)
+
+ void registerProperty(INDI::Property *prop);
+ void processSwitch(ISwitchVectorProperty *svp);
+ void processText(ITextVectorProperty* tvp);
+ void processNumber(INumberVectorProperty *nvp);
+
+ INDI::BaseDevice *getDevice() { return baseDevice; }
+ Q_INVOKABLE QString getDeviceName() { return baseDevice->getDeviceName(); }
+
+ bool isSlewDecreasable() { return m_slewDecreasable; }
+ bool isSlewIncreasable() { return m_slewIncreasable; }
+
+ void setSlewDecreasable(bool slewDecreasable);
+ void setSlewIncreasable(bool slewIncreasable);
+
+ Q_INVOKABLE bool decreaseSlewRate();
+ Q_INVOKABLE bool increaseSlewRate();
+
+ // Common Commands
+ Q_INVOKABLE bool slew(SkyPointLite *ScopeTarget) { return slew(ScopeTarget->getPoint()); }
+ Q_INVOKABLE bool slew(SkyPoint *ScopeTarget);
+ bool slew(double ra, double dec);
+ Q_INVOKABLE bool sync(SkyPointLite *ScopeTarget) { return sync(ScopeTarget->getPoint()); }
+ Q_INVOKABLE bool sync(SkyPoint *ScopeTarget);
+ bool sync(double ra, double dec);
+ Q_INVOKABLE bool moveNS(TelescopeMotionNS dir, TelescopeMotionCommand cmd);
+ Q_INVOKABLE bool moveWE(TelescopeMotionWE dir, TelescopeMotionCommand cmd);
+ bool canGuide();
+ bool canSync();
+ bool canPark();
+ bool isSlewing();
+ bool isParked();
+ bool isInMotion();
+ /*bool doPulse(GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs );
+ bool doPulse(GuideDirection dir, int msecs );*/
+ bool getEqCoords(double *ra, double *dec);
+ void setAltLimits(double minAltitude, double maxAltitude);
+ Q_INVOKABLE bool isConnected() { return baseDevice->isConnected(); }
+
+protected:
+ bool sendCoords(SkyPoint *ScopeTarget);
+
+public slots:
+ virtual bool runCommand(int command, void *ptr=NULL);
+ Q_INVOKABLE bool abort();
+ bool park();
+ bool unPark();
+ bool setSlewRate(int index);
+
+signals:
+ void slewDecreasableChanged(bool);
+ void slewIncreasableChanged(bool);
+ void newTelescopeLiteCreated(TelescopeLite *);
+
+private:
+ SkyPoint currentCoord;
+ double minAlt,maxAlt;
+ bool IsParked;
+ ClientManagerLite *clientManager;
+ INDI::BaseDevice *baseDevice;
+ int slewRateIndex;
+
+ bool m_slewDecreasable;
+ bool m_slewIncreasable;
+};
+
+#endif // INDITELESCOPE_H
diff --git a/kstars/kstarsdata.cpp b/kstars/kstarsdata.cpp
index 50b012a..1b09d67 100644
--- a/kstars/kstarsdata.cpp
+++ b/kstars/kstarsdata.cpp
@@ -172,7 +172,8 @@ bool KStarsData::initialize() {
emit progressText(i18n("Loading sky objects" ) );
m_SkyComposite = new SkyMapComposite(0);
//Load Image URLs//
-
+#ifndef Q_OS_ANDROID
+ //On Android these 2 calls produce segfault. FIX IT!
emit progressText( i18n("Loading Image URLs" ) );
if( !readURLData( "image_url.dat", 0 ) && !nonFatalErrorMessage( "image_url.dat" ) )
return false;
@@ -181,7 +182,7 @@ bool KStarsData::initialize() {
emit progressText( i18n("Loading Information URLs" ) );
if( !readURLData( "info_url.dat", 1 ) && !nonFatalErrorMessage( "info_url.dat" ) )
return false;
-
+#endif
emit progressText( i18n("Loading Variable Stars" ) );
//Update supernovae list if enabled
@@ -193,11 +194,11 @@ bool KStarsData::initialize() {
#ifndef KSTARS_LITE
//Initialize Observing List
m_ObservingList = new ObservingList();
- #endif
+
readUserLog();
readADVTreeData();
-
+ #endif
return true;
}
diff --git a/kstars/kstarslite.cpp b/kstars/kstarslite.cpp
index 8c3d644..a754385 100644
--- a/kstars/kstarslite.cpp
+++ b/kstars/kstarslite.cpp
@@ -21,6 +21,7 @@
#include <QApplication>
#include <QQuickWindow>
#include <QSurfaceFormat>
+#include "indi/clientmanagerlite.h"
#include "kspaths.h"
@@ -38,17 +39,39 @@ KStarsLite::KStarsLite( bool doSplash, bool startClock, const QString &startDate
else
KSUtils::Logging::UseDefault();
+ // Set pinstance to yourself
+ // Unlike KStars class we set pinstance at the beginning because SkyMapLite needs access to ClientManagerLite
+ pinstance = this;
+
m_KStarsData = KStarsData::Create();
Q_ASSERT( m_KStarsData );
+#ifdef INDI_FOUND
+ //INDI Android Client
+ m_clientManager = new ClientManagerLite;
+ m_Engine.rootContext()->setContextProperty("ClientManagerLite", m_clientManager);
+#endif
+
//Make instance of KStarsLite and KStarsData available to QML
m_Engine.rootContext()->setContextProperty("KStarsLite", this);
m_Engine.rootContext()->setContextProperty("KStarsData", m_KStarsData);
m_Engine.rootContext()->setContextProperty("Options", Options::self());
- /*Register SkyMapLite for use within QML
- qmlRegisterType<SkyMapLite>("skymaplite",1,0,"SkyMapLite");*/
+ //Set Geographic Location from Options
+ m_KStarsData->setLocationFromOptions();
+
+ /*SkyMapLite has to be loaded before KStarsData is initialized because SkyComponents derived classes
+ have to add SkyItems to the SkyMapLite*/
+ m_SkyMapLite = SkyMapLite::createInstance();
+
+ m_Engine.rootContext()->setContextProperty("SkyMapLite", m_SkyMapLite);
+ //qmlRegisterType<SkyPoint>("skymaplite",1,0,"SkyMapLite");
+
+#ifdef Q_OS_ANDROID
QString main = KSPaths::locate(QStandardPaths::AppDataLocation, "kstarslite/qml/main.qml");
+#else
+ QString main = QString(QML_IMPORT) + QString("/kstarslite/qml/main.qml");
+#endif
m_Engine.load(QUrl(main));
Q_ASSERT_X(m_Engine.rootObjects().size(),"loading root object of main.qml",
@@ -57,6 +80,7 @@ KStarsLite::KStarsLite( bool doSplash, bool startClock, const QString &startDate
m_RootObject = m_Engine.rootObjects()[0];
QQuickItem *skyMapLiteWrapper = m_RootObject->findChild<QQuickItem*>("skyMapLiteWrapper");
+ m_SkyMapLite->setParentItem(skyMapLiteWrapper);
//QQuickWindow *mainWindow = m_RootObject->findChild<QQuickWindow*>("mainWindow");
QQuickWindow *mainWindow = static_cast<QQuickWindow *>(m_Engine.rootObjects()[0]);
@@ -66,18 +90,6 @@ KStarsLite::KStarsLite( bool doSplash, bool startClock, const QString &startDate
format.setSwapBehavior (QSurfaceFormat::TripleBuffer);
mainWindow->setFormat(format);
- //Set Geographic Location from Options
- m_KStarsData->setLocationFromOptions();
-
- /*SkyMapLite has to be loaded before KStarsData is initialized because SkyComponents derived classes
- have to add SkyItems to the SkyMapLite*/
- m_SkyMapLite = SkyMapLite::createInstance(skyMapLiteWrapper);
-
- m_Engine.rootContext()->setContextProperty("SkyMapLite", m_SkyMapLite);
-
- // Set pinstance to yourself
- pinstance = this;
-
connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( slotAboutToQuit() ) );
//Initialize Time and Date
diff --git a/kstars/kstarslite.h b/kstars/kstarslite.h
index da66951..757d0ee 100644
--- a/kstars/kstarslite.h
+++ b/kstars/kstarslite.h
@@ -27,6 +27,9 @@ class KStarsData;
class SkyMapLite;
class SkyPoint;
class GeoLocation;
+#ifdef INDI_FOUND
+class ClientManagerLite;
+#endif
class QQuickItem;
@@ -72,15 +75,22 @@ public:
/** Destructor. Does nothing yet*/
virtual ~KStarsLite() { }
- /** @return pointer to SkyMapLite object which contains application data. */
+ /** @return pointer to SkyMapLite object which draws SkyMap. */
inline SkyMapLite* map() const { return m_SkyMapLite; }
/** @return pointer to KStarsData object which contains application data. */
inline KStarsData* data() const { return m_KStarsData; }
+ inline QQmlApplicationEngine *qmlEngine() { return &m_Engine; }
+
/** @short used from QML to update positions of sky objects and update SkyMapLite */
Q_INVOKABLE void fullUpdate();
+ #ifdef INDI_FOUND
+ /** @return pointer to KStarsData object which handles connection to INDI server. */
+ inline ClientManagerLite *clientManagerLite() const { return m_clientManager; }
+ #endif
+
signals:
/** Sent when KStarsData finishes loading data */
void dataLoadFinished();
@@ -126,6 +136,9 @@ private:
bool StartClockRunning;
KStarsData* m_KStarsData;
+#ifdef INDI_FOUND
+ ClientManagerLite *m_clientManager;
+#endif
};
#endif
diff --git a/kstars/kstarslite/kirigami b/kstars/kstarslite/kirigami
new file mode 160000
+Subproject 7f11cdf9fbd9d9ed280ad6b16965c331d778c97
diff --git a/kstars/kstarslite/qml/CMakeLists.txt b/kstars/kstarslite/qml/CMakeLists.txt
index 727868e..ca51d9c 100644
--- a/kstars/kstarslite/qml/CMakeLists.txt
+++ b/kstars/kstarslite/qml/CMakeLists.txt
@@ -7,15 +7,16 @@ install( FILES constants/Constants.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/constants )
install( FILES modules/BottomMenu.qml
- modules/ContextDrawer.qml
- modules/GlobalDrawer.qml
modules/Splash.qml
modules/TopMenu.qml
+ modules/KSPage.qml
+ modules/KSScrollablePage.qml
+ modules/ContextDrawerMenu.qml
+ modules/TelescopeControlMenu.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules )
-install( FILES modules/helpers/DrawerColorScheme.qml
- modules/helpers/DrawerElem.qml
- modules/helpers/TopMenuButton.qml
+install( FILES modules/helpers/TopMenuButton.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules/helpers )
add_subdirectory(modules/images)
+add_subdirectory(indi)
diff --git a/kstars/kstarslite/qml/indi/CMakeLists.txt b/kstars/kstarslite/qml/indi/CMakeLists.txt
new file mode 100644
index 0000000..8d82e42
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/CMakeLists.txt
@@ -0,0 +1,17 @@
+#install_files
+install( FILES INDIControlPanel.qml
+ DevicePanel.qml
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/indi )
+
+install( FILES modules/MotionControl.qml
+ modules/Led.qml
+ modules/Property.qml
+ modules/KSTab.qml
+ modules/KSButton.qml
+ modules/KSINDIText.qml
+ modules/KSINDINumber.qml
+ modules/KSINDINumberField.qml
+ modules/KSCheckBox.qml
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/indi/modules )
+
+add_subdirectory(modules/images)
diff --git a/kstars/kstarslite/qml/indi/DevicePanel.qml b/kstars/kstarslite/qml/indi/DevicePanel.qml
new file mode 100644
index 0000000..0ce87f4
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/DevicePanel.qml
@@ -0,0 +1,80 @@
+import QtQuick 2.4
+import QtQuick.Window 2.2
+import "../modules"
+import "../constants" 1.0
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 1.4
+import org.kde.kirigami 1.0 as Kirigami
+
+KSPage {
+ id: devicesPage
+ contentItem: deviceTabView
+ TabView {
+ id: deviceTabView
+
+ property var groups: []
+ property var properties: []
+ property var tabs: []
+
+ Component.onCompleted: {
+ if(Qt.platform.os != "android") {
+ anchors.topMargin = 10 * num.dp
+ anchors.leftMargin = 5 * num.dp
+ anchors.rightMargin = 5 * num.dp
+ }
+ anchors.bottomMargin = 5 * num.dp
+ anchors.bottom = parent.bottom
+ }
+
+ Connections {
+ target: ClientManagerLite
+ onNewINDIProperty: {
+ if(devicesPage.title === deviceName) {
+ if(deviceTabView.groups.indexOf(groupName) == -1) {
+ deviceTabView.groups.push(groupName)
+ var newTabComp = Qt.createComponent("modules/KSTab.qml");
+ var newTab = newTabComp.createObject(deviceTabView)
+ newTab.title = groupName
+
+ deviceTabView.tabs.push(newTab)
+ if(groupName == "Motion Control") {
+ var component = Qt.createComponent("modules/MotionControl.qml");
+ var motionControl = component.createObject(newTab)
+ motionControl.deviceName = deviceName
+ }
+ }
+ if(groupName != "Motion Control") {
+ for(var i = 0; i < deviceTabView.count; ++i) {
+ var tab = deviceTabView.getTab(i)
+ if(tab.title === groupName) {
+ var propComp = Qt.createComponent("modules/Property.qml");
+ var property = propComp.createObject(tab.columnItem)
+ property.name = propName
+ property.label = label
+ property.device = deviceName
+ }
+ }
+ }
+ }
+ }
+ onRemoveINDIProperty: {
+ for(var i = 0; i < deviceTabView.tabs.length; ++i) {
+ var tab = deviceTabView.tabs[i]
+ if(tab.title === groupName && groupName != "Motion Control") {
+ var columnItem = deviceTabView.tabs[i].columnItem
+ for(var c = 0; c < columnItem.children.length; ++c) {
+ if(columnItem.children[c].name === propName) {
+ columnItem.children[c].destroy()
+ }
+ }
+ if(columnItem.children.length == 0) {
+ var groups = deviceTabView.groups
+ groups.splice(groups.indexOf(groupName), 1)
+ tab.destroy()
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/INDIControlPanel.qml b/kstars/kstarslite/qml/indi/INDIControlPanel.qml
new file mode 100644
index 0000000..e0f2f2c
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/INDIControlPanel.qml
@@ -0,0 +1,181 @@
+import QtQuick 2.4
+import QtQuick.Window 2.2
+import "../modules"
+import "../constants" 1.0
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 1.4 as Controls
+import org.kde.kirigami 1.0 as Kirigami
+
+KSPage {
+ id: indiPage
+ title: "INDI Control Panel"
+ objectName: "indiControlPanel"
+
+ property bool connected: ClientManagerLite.connected
+
+ Component.onCompleted: {
+ ClientManagerLite.setHost("localhost", parseInt(7624))
+ }
+
+ onHeightChanged: {
+ devicesPage.height = indiPage.height - devicesPage.y
+ }
+
+ onConnectedChanged: {
+ if(!connected) {
+ for(var i = 0; i < devicesModel.count; ++i) {
+ devicesModel.get(i).panel.destroy()
+ }
+ devicesModel.clear()
+ //showPage()
+ showPassiveNotification("Disconnected from the server")
+ }
+ }
+ contentItem: cPanelColumn
+
+ ColumnLayout {
+ id: cPanelColumn
+
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ topMargin: 5 * num.dp
+ leftMargin: 25 * num.dp
+ rightMargin: 25 * num.dp
+ }
+
+ ColumnLayout {
+ visible: !connected
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ Kirigami.Label {
+ text: "INDI Host"
+ }
+
+ RowLayout {
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ Controls.TextField {
+ id:ipHost
+ placeholderText: "IP"
+ Layout.alignment: Qt.AlignHCenter
+ implicitWidth: parent.width*0.8
+ }
+
+ Controls.TextField {
+ id:portHost
+ placeholderText: "Port"
+ Layout.alignment: Qt.AlignHCenter
+ implicitWidth: parent.width*0.2
+ }
+ }
+ }
+
+ Kirigami.Label {
+ id: connectedTo
+ visible: connected
+ text: "Connected to " + ClientManagerLite.connectedHost
+ }
+
+ Controls.Button {
+ text: connected ? "Disconnect" : "Connect"
+ onClicked: {
+ if(!connected) {
+ if(ClientManagerLite.setHost(ipHost.text, parseInt(portHost.text))) {
+ showPassiveNotification("Successfully connected to the server")
+ } else {
+ showPassiveNotification("Couldn't connect to the server")
+ }
+ } else {
+ ClientManagerLite.disconnectHost()
+ }
+ Qt.inputMethod.hide()
+ }
+ }
+
+ ColumnLayout {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ visible : connected
+
+ Component.onCompleted: {
+ for(var i = 0; i < 100; ++i) {
+ console.log(height)
+ }
+ }
+
+ Rectangle {
+ Layout.fillWidth: true
+ height: 1 * num.dp
+ color: "gray"
+ }
+
+ Kirigami.Label {
+ id: devicesLabel
+ text: "Available Devices"
+ }
+
+ ListModel {
+ id: devicesModel
+ }
+
+ Connections {
+ target: ClientManagerLite
+ onNewINDIDevice: {
+ var component = Qt.createComponent(Qt.resolvedUrl("./DevicePanel.qml"));
+ var devicePanel = component.createObject(pagesWindow);
+ devicePanel.title = deviceName
+ devicesModel.append({ name: deviceName, panel: devicePanel })
+ }
+ onRemoveINDIDevice: {
+ for(i = 0; i < devicesModel.count; ++i) {
+ if(devicesModel.get(i).name == deviceName) {
+ devicesModel.panel.destroy()
+ devicesModel.remove(i)
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Kirigami.ScrollablePage {
+ id:devicesPage
+ anchors {
+ top: cPanelColumn.bottom
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ topMargin: 5 * num.dp
+ leftMargin: 25 * num.dp
+ rightMargin: 25 * num.dp
+ bottomMargin: 25 * num.dp
+ }
+
+ leftPadding: 0
+ rightPadding: 0
+ topPadding: 0
+ bottomPadding: 0
+
+ ListView {
+ id: list
+
+ model: devicesModel
+ delegate: Kirigami.BasicListItem {
+ label: model.name
+ enabled: true
+ onClicked: {
+ model.panel.showPage(false)
+ }
+ }
+ }
+
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/KSButton.qml b/kstars/kstarslite/qml/indi/modules/KSButton.qml
new file mode 100644
index 0000000..dedb200
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/KSButton.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.4
+import QtQuick.Controls 1.4
+
+Button {
+ property string switchName: ""
+ property Row parentRow
+ checkable: true
+
+ onClicked: {
+ parentRow.sendNewSwitch(switchName, null)
+ checked = true
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/KSButtonsRow.qml b/kstars/kstarslite/qml/indi/modules/KSButtonsRow.qml
new file mode 100644
index 0000000..ba62c26
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/KSButtonsRow.qml
@@ -0,0 +1,59 @@
+import QtQuick 2.4
+import QtQuick.Controls 1.4
+
+Row {
+ id:buttonsRow
+ property bool checkBox: false
+ property string propName: ""
+ property string deviceName: ""
+ property bool exclusive: false
+ spacing: 5
+
+ Connections {
+ target: ClientManagerLite
+ onNewINDISwitch: {
+ if(buttonsRow.deviceName == deviceName) {
+ if(buttonsRow.propName == propName) {
+ for(var i = 0; i < children.length; ++i) {
+ if(children[i].switchName == switchName) {
+ children[i].checked = isOn
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ function addButton(propText, switchName, initChecked, enabled) {
+ var buttonComp = Qt.createComponent("KSButton.qml");
+ var button = buttonComp.createObject(this)
+ button.text = propText
+ button.switchName = switchName
+ button.parentRow = this
+ button.checked = initChecked
+ button.enabled = enabled
+ }
+
+ function addCheckBox(propText, switchName, initChecked, enabled) {
+ var checkBoxComp = Qt.createComponent("KSCheckBox.qml");
+ var checkBox = checkBoxComp.createObject(this)
+ checkBox.text = propText
+ checkBox.switchName = switchName
+ checkBox.parentRow = this
+ checkBox.checked = initChecked
+ checkBox.enabled = enabled
+ }
+
+ function sendNewSwitch(switchName, button) {
+ ClientManagerLite.sendNewINDISwitch(deviceName,propName,switchName)
+ if(exclusive && button != null) {
+ for(var i = 0; i < children.length; ++i) {
+ if(children[i] !== button) {
+ children[i].checked = false
+ }
+ }
+ }
+ }
+}
+
diff --git a/kstars/kstarslite/qml/indi/modules/KSCheckBox.qml b/kstars/kstarslite/qml/indi/modules/KSCheckBox.qml
new file mode 100644
index 0000000..04e86df
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/KSCheckBox.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.4
+import QtQuick.Controls 1.4
+
+CheckBox {
+ property string switchName: ""
+ property Row parentRow
+
+ onClicked: {
+ parentRow.sendNewSwitch(switchName, null)
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/KSComboBox.qml b/kstars/kstarslite/qml/indi/modules/KSComboBox.qml
new file mode 100644
index 0000000..cf371ba
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/KSComboBox.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.4
+import QtQuick.Controls 1.4
+
+ComboBox {
+ property string deviceName: ""
+ property string propName: ""
+
+ Connections {
+ target: ClientManagerLite
+ onNewINDISwitch: {
+ if(deviceName == device) {
+ if(name == propName) {
+ for(var i = 0; i < model.count; ++i) {
+ if(model.get(i).name == switchName && isOn) {
+ currentIndex = i;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ onActivated: {
+ if(index >= 0) {
+ ClientManagerLite.sendNewINDISwitch(deviceName,propName,index)
+ }
+ }
+
+ model: ListModel {
+
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/KSINDINumber.qml b/kstars/kstarslite/qml/indi/modules/KSINDINumber.qml
new file mode 100644
index 0000000..d1ce9a0
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/KSINDINumber.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.4
+import QtQuick.Layouts 1.2
+import "../../constants" 1.0
+import org.kde.kirigami 1.0 as Kirigami
+
+Column {
+ Layout.fillHeight: true
+ spacing: 5 * num.dp
+ width: parent.width
+ property string propLabel: ""
+
+ Kirigami.Label {
+ text: propLabel
+ }
+
+ Rectangle {
+ id:separator
+ color: "grey"
+ height: 1 * num.dp
+ width: parent.width
+ }
+
+ function addText(propText, writable) {
+ var textItem
+ if(writable) {
+ var textComp = Qt.createComponent("KSINDINumberField.qml");
+ textItem = textComp.createObject(columnProp)
+ } else {
+ textItem = Qt.createQmlObject('import QtQuick 2.4
+ import QtQuick.Layouts 1.2
+ Text {
+ }', this)
+ }
+ textItem.textField.text = propText
+ //textItem.anchors.top = separator.bottom
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/KSINDINumberField.qml b/kstars/kstarslite/qml/indi/modules/KSINDINumberField.qml
new file mode 100644
index 0000000..6547bb5
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/KSINDINumberField.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.4
+import QtQuick.Layouts 1.2
+import "../../constants" 1.0
+import org.kde.kirigami 1.0 as Kirigami
+
+import QtQuick 2.4
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.4
+
+RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ property Item textField: field
+ TextField {
+ id: field
+ }
+ Button {
+ text:"Set"
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/KSINDIText.qml b/kstars/kstarslite/qml/indi/modules/KSINDIText.qml
new file mode 100644
index 0000000..b535be9
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/KSINDIText.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.4
+import QtQuick.Layouts 1.2
+import "../../constants" 1.0
+import org.kde.kirigami 1.0 as Kirigami
+
+Column {
+ Layout.fillHeight: true
+ spacing: 5 * num.dp
+ width: parent.width
+ property string propLabel: ""
+
+ Kirigami.Label {
+ text: propLabel
+ }
+
+ Rectangle {
+ id:separator
+ color: "grey"
+ height: 1 * num.dp
+ width: parent.width
+ }
+
+ function addText(propText, writable) {
+ var textItem
+ if(writable) {
+ textItem = Qt.createQmlObject('import QtQuick 2.4
+ import QtQuick.Controls 1.4
+ TextField {
+ }', this)
+ } else {
+ textItem = Qt.createQmlObject('import QtQuick 2.4
+ import QtQuick.Layouts 1.2
+ Text {
+ }', this)
+ }
+ textItem.text = propText
+ //textItem.anchors.top = separator.bottom
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/KSTab.qml b/kstars/kstarslite/qml/indi/modules/KSTab.qml
new file mode 100644
index 0000000..2dc5a37
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/KSTab.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.4
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 1.4
+import org.kde.kirigami 1.0 as Kirigami
+import "../../constants" 1.0
+
+Tab {
+ id: tab
+ anchors {
+ fill: parent
+ leftMargin: 5 * num.dp
+ rightMargin: 5 * num.dp
+ bottomMargin: 5 * num.dp
+ }
+ active: true
+
+ property Item columnItem
+
+ ScrollView {
+ anchors.fill: parent
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+
+ Component.onCompleted: {
+ contentItem: column
+ }
+
+ Column {
+ id: column
+ anchors.leftMargin: 5 * num.dp
+
+ Component.onCompleted: {
+ tab.columnItem = this
+ }
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/Led.qml b/kstars/kstarslite/qml/indi/modules/Led.qml
new file mode 100644
index 0000000..c3d51f1
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/Led.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.4
+import "../../constants" 1.0
+
+Image {
+ property string color: "grey"
+ width: 16 * num.dp
+ height: 16 * num.dp
+ sourceSize.height: 16 * num.dp
+ sourceSize.width: 16 * num.dp
+
+ source: "images/" + num.density + "/grey.png"
+ onColorChanged: {
+ if(color == "red") {
+ source = "images/" + num.density + "/red.png"
+ } else if(color == "green") {
+ source = "images/" + num.density + "/green.png"
+ } else if(color == "yellow") {
+ source = "images/" + num.density + "/yellow.png"
+ } else if(color == "grey") {
+ source = "images/" + num.density + "/grey.png"
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/MotionControl.qml b/kstars/kstarslite/qml/indi/modules/MotionControl.qml
new file mode 100644
index 0000000..0836db1
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/MotionControl.qml
@@ -0,0 +1,300 @@
+import QtQuick 2.4
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 1.4
+import org.kde.kirigami 1.0 as Kirigami
+import TelescopeLiteEnums 1.0
+import "../../constants" 1.0
+
+ColumnLayout {
+ id: motionCColumn
+ anchors {
+ fill: parent
+ topMargin: 5 * num.dp
+ bottomMargin: 5 * num.dp
+ }
+ spacing: 5 * num.dp
+
+ enabled: buttonsEnabled
+
+ property string deviceName
+ property var telescope
+
+ Connections {
+ target: ClientManagerLite
+ onDeviceConnected: {
+ if(motionCColumn.deviceName == deviceName) {
+ buttonsEnabled = isConnected
+ }
+ }
+ onTelescopeAdded: {
+ if(newTelescope.getDeviceName() == motionCColumn.deviceName) {
+ telescope = newTelescope
+ }
+ }
+ }
+
+ property bool buttonsEnabled: ClientManagerLite.isDeviceConnected(deviceName)
+
+ //Row 1
+ RowLayout {
+ Layout.fillHeight: true
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ Button {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+
+
+ onPressedChanged: {
+ if(telescope) {
+ if(pressed) {
+ telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_START)
+ telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_START)
+ } else {
+ telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_STOP)
+ telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_STOP)
+ }
+ }
+ }
+
+ text: "NW"
+ }
+
+ Button {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+
+
+ onPressedChanged: {
+
+ if(telescope) {
+ if(pressed) {
+ telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_START)
+ } else {
+ telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_STOP)
+ }
+ }
+ }
+
+ text: "N"
+ }
+
+ Button {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+
+
+ onPressedChanged: {
+
+ if(telescope) {
+ if(pressed) {
+ telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_START)
+ telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_START)
+ } else {
+ telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_STOP)
+ telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_STOP)
+ }
+ }
+ }
+
+ text: "NE"
+ }
+ }
+
+ //Row 2
+ RowLayout {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ Button {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+
+
+ onPressedChanged: {
+
+ if(telescope) {
+ if(pressed) {
+ telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_START)
+ } else {
+ telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_STOP)
+ }
+ }
+ }
+
+ text: "W"
+ }
+
+ Button {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+
+
+ onPressedChanged: {
+
+ if(telescope) {
+ telescope.abort();
+ }
+ }
+
+ text: "Stop"
+ }
+
+ Button {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+
+
+ onPressedChanged: {
+
+ if(telescope) {
+ if(pressed) {
+ telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_START)
+ } else {
+ telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_STOP)
+ }
+ }
+ }
+
+ text: "E"
+ }
+ }
+
+ //Row 3
+ RowLayout {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ Button {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+ onPressedChanged: {
+
+ if(telescope) {
+ if(pressed) {
+ telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_START)
+ telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_START)
+ } else {
+ telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_STOP)
+ telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_STOP)
+ }
+ }
+ }
+
+ text: "SW"
+ }
+
+ Button {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+
+
+ text: "S"
+
+ onPressedChanged: {
+
+ if(telescope) {
+ if(pressed) {
+ telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_START)
+ } else {
+ telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_STOP)
+ }
+ }
+ }
+ }
+
+ Button {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+
+
+ onPressedChanged: {
+
+ if(telescope) {
+ if(pressed) {
+ telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_START)
+ telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_START)
+ } else {
+ telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_STOP)
+ telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_STOP)
+ }
+ }
+ }
+
+ text: "SE"
+ }
+ }
+
+ //Slewing
+ RowLayout {
+ id: slewingRateRow
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ Button {
+ id: decreaseSlew
+ height: motionCColumn.height * 0.15
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+ enabled: telescope.slewDecreasable
+
+ Connections {
+ target: telescope
+ onSlewDecreasableChanged: {
+ decreaseSlew.enabled = telescope.slewDecreasable
+ }
+ }
+
+ onClicked: {
+ if(telescope) {
+ telescope.decreaseSlewRate()
+ }
+ }
+
+ text: "-"
+ }
+ Text {
+ height: parent.height * 0.15
+ Layout.fillWidth: true
+ horizontalAlignment: Text.AlignHCenter
+
+ text: "Slewing speed control"
+ }
+
+ Button {
+ id: increaseSlew
+ height: motionCColumn.height * 0.15
+ Layout.fillWidth: true
+ activeFocusOnTab: false
+ enabled: telescope.slewIncreasable
+
+ Connections {
+ target: telescope
+ onSlewIncreasableChanged: {
+ increaseSlew.enabled = telescope.slewIncreasable
+ }
+ }
+
+ onClicked: {
+ if(telescope) {
+ telescope.increaseSlewRate()
+ }
+ }
+
+ text: "+"
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/Property.qml b/kstars/kstarslite/qml/indi/modules/Property.qml
new file mode 100644
index 0000000..1c26568
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/Property.qml
@@ -0,0 +1,119 @@
+import QtQuick 2.4
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 1.4
+import "../../constants"
+import org.kde.kirigami 1.0 as Kirigami
+import TelescopeLiteEnums 1.0
+
+ColumnLayout {
+ id: columnProp
+
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ property string name: ""
+ property string device: ""
+ property string label: ""
+ property ComboBox comboBox: null
+ property Row buttonRow: null
+
+ Row {
+ id: labelRow
+ spacing: 5
+ Led {
+ id: led
+ color: ClientManagerLite.updateLED(device, name)
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ Kirigami.Label {
+ text: label
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Rectangle {
+ height: num.dp
+ color: "grey"
+ width: Screen.width
+ }
+
+ Connections {
+ target: ClientManagerLite
+ onNewINDISwitch: {
+ if(deviceName == device) {
+ if(name == propName) {
+ led.color = ClientManagerLite.updateLED(device, name)
+ }
+ }
+ }
+ onCreateINDIButton: {
+ if(deviceName == device) {
+ if(name == propName) {
+ if(buttonRow == null) {
+ var buttonRowComp = Qt.createComponent("KSButtonsRow.qml");
+ buttonRow = buttonRowComp.createObject(columnProp)
+ buttonRow.deviceName = device
+ buttonRow.propName = name
+ buttonRow.exclusive = exclusive
+ }
+ buttonRow.addButton(propText, switchName, checked, enabled)
+ }
+ }
+ }
+ onCreateINDIRadio: {
+ if(deviceName == device) {
+ if(name == propName) {
+ if(buttonRow == null) {
+ var buttonRowComp = Qt.createComponent("KSButtonsRow.qml");
+ buttonRow = buttonRowComp.createObject(columnProp)
+ buttonRow.deviceName = device
+ buttonRow.propName = name
+ buttonRow.exclusive = exclusive
+ buttonRow.checkBox = true
+ }
+ buttonRow.addCheckBox(propText, switchName, checked, enabled)
+ }
+ }
+ }
+ onCreateINDIMenu: {
+ if(device == deviceName) {
+ if(name == propName) {
+ if(comboBox == null) {
+ var CBoxComponent = Qt.createComponent("KSComboBox.qml");
+ comboBox = CBoxComponent.createObject(columnProp)
+ comboBox.deviceName = deviceName
+ comboBox.propName = propName
+ comboBox.textRole = "text"
+ }
+ comboBox.model.append({"text": switchLabel, "name": switchName})
+ if(isSelected) {
+ comboBox.currentIndex = comboBox.model.length - 1
+ }
+ }
+ }
+ }
+
+ onCreateINDIText: {
+ if(deviceName == device) {
+ if(name == propName) {
+ var indiTextComp = Qt.createComponent("KSINDIText.qml");
+ var indiText = indiTextComp.createObject(columnProp)
+ indiText.addText(propText, write)
+ indiText.propLabel = propLabel
+ }
+ }
+ }
+ onCreateINDINumber: {
+ if(deviceName == device) {
+ if(name == propName) {
+ var indiNumComp = Qt.createComponent("KSINDINumber.qml");
+ var indiNum = indiNumComp.createObject(columnProp)
+ indiNum.addText(propText, write)
+ indiNum.propLabel = propLabel
+ }
+ }
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/indi/modules/images/CMakeLists.txt b/kstars/kstarslite/qml/indi/modules/images/CMakeLists.txt
new file mode 100644
index 0000000..b7cd90d
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_subdirectory(hdpi)
+add_subdirectory(ldpi)
+add_subdirectory(mdpi)
+add_subdirectory(xhdpi)
+add_subdirectory(xxhdpi)
+add_subdirectory(xxxhdpi)
diff --git a/kstars/kstarslite/qml/indi/modules/images/green.png b/kstars/kstarslite/qml/indi/modules/images/green.png
new file mode 100644
index 0000000..95b0ea1
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/green.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/grey.png b/kstars/kstarslite/qml/indi/modules/images/grey.png
new file mode 100644
index 0000000..b3f5d7b
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/grey.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/hdpi/CMakeLists.txt b/kstars/kstarslite/qml/indi/modules/images/hdpi/CMakeLists.txt
new file mode 100644
index 0000000..77754c0
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/hdpi/CMakeLists.txt
@@ -0,0 +1,5 @@
+install( FILES green.png
+ red.png
+ yellow.png
+ grey.png
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/indi/modules/images/hdpi )
diff --git a/kstars/kstarslite/qml/indi/modules/images/hdpi/green.png b/kstars/kstarslite/qml/indi/modules/images/hdpi/green.png
new file mode 100644
index 0000000..e1a01b6
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/hdpi/green.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/hdpi/grey.png b/kstars/kstarslite/qml/indi/modules/images/hdpi/grey.png
new file mode 100644
index 0000000..abfbef0
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/hdpi/grey.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/hdpi/red.png b/kstars/kstarslite/qml/indi/modules/images/hdpi/red.png
new file mode 100644
index 0000000..21a66ca
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/hdpi/red.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/hdpi/yellow.png b/kstars/kstarslite/qml/indi/modules/images/hdpi/yellow.png
new file mode 100644
index 0000000..ffe4dbe
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/hdpi/yellow.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/ldpi/CMakeLists.txt b/kstars/kstarslite/qml/indi/modules/images/ldpi/CMakeLists.txt
new file mode 100644
index 0000000..449753b
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/ldpi/CMakeLists.txt
@@ -0,0 +1,5 @@
+install( FILES green.png
+ red.png
+ yellow.png
+ grey.png
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/indi/modules/images/ldpi )
diff --git a/kstars/kstarslite/qml/indi/modules/images/ldpi/green.png b/kstars/kstarslite/qml/indi/modules/images/ldpi/green.png
new file mode 100644
index 0000000..59b0362
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/ldpi/green.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/ldpi/grey.png b/kstars/kstarslite/qml/indi/modules/images/ldpi/grey.png
new file mode 100644
index 0000000..3021d77
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/ldpi/grey.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/ldpi/red.png b/kstars/kstarslite/qml/indi/modules/images/ldpi/red.png
new file mode 100644
index 0000000..4c5c064
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/ldpi/red.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/ldpi/yellow.png b/kstars/kstarslite/qml/indi/modules/images/ldpi/yellow.png
new file mode 100644
index 0000000..30af352
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/ldpi/yellow.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/mdpi/CMakeLists.txt b/kstars/kstarslite/qml/indi/modules/images/mdpi/CMakeLists.txt
new file mode 100644
index 0000000..dcd988f
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/mdpi/CMakeLists.txt
@@ -0,0 +1,5 @@
+install( FILES green.png
+ red.png
+ yellow.png
+ grey.png
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/indi/modules/images/mdpi )
diff --git a/kstars/kstarslite/qml/indi/modules/images/mdpi/green.png b/kstars/kstarslite/qml/indi/modules/images/mdpi/green.png
new file mode 100644
index 0000000..28d63dc
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/mdpi/green.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/mdpi/grey.png b/kstars/kstarslite/qml/indi/modules/images/mdpi/grey.png
new file mode 100644
index 0000000..064bead
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/mdpi/grey.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/mdpi/red.png b/kstars/kstarslite/qml/indi/modules/images/mdpi/red.png
new file mode 100644
index 0000000..3e8a37b
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/mdpi/red.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/mdpi/yellow.png b/kstars/kstarslite/qml/indi/modules/images/mdpi/yellow.png
new file mode 100644
index 0000000..ed792c1
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/mdpi/yellow.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/red.png b/kstars/kstarslite/qml/indi/modules/images/red.png
new file mode 100644
index 0000000..9a2368c
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/red.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xhdpi/CMakeLists.txt b/kstars/kstarslite/qml/indi/modules/images/xhdpi/CMakeLists.txt
new file mode 100644
index 0000000..9da9e9f
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xhdpi/CMakeLists.txt
@@ -0,0 +1,5 @@
+install( FILES green.png
+ red.png
+ yellow.png
+ grey.png
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/indi/modules/images/xhdpi )
diff --git a/kstars/kstarslite/qml/indi/modules/images/xhdpi/green.png b/kstars/kstarslite/qml/indi/modules/images/xhdpi/green.png
new file mode 100644
index 0000000..6e9d8e8
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xhdpi/green.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xhdpi/grey.png b/kstars/kstarslite/qml/indi/modules/images/xhdpi/grey.png
new file mode 100644
index 0000000..28faad5
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xhdpi/grey.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xhdpi/red.png b/kstars/kstarslite/qml/indi/modules/images/xhdpi/red.png
new file mode 100644
index 0000000..81f0fd8
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xhdpi/red.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xhdpi/yellow.png b/kstars/kstarslite/qml/indi/modules/images/xhdpi/yellow.png
new file mode 100644
index 0000000..af15040
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xhdpi/yellow.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxhdpi/CMakeLists.txt b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/CMakeLists.txt
new file mode 100644
index 0000000..2725983
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/CMakeLists.txt
@@ -0,0 +1,5 @@
+install( FILES green.png
+ red.png
+ yellow.png
+ grey.png
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/indi/modules/images/xxhdpi )
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxhdpi/green.png b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/green.png
new file mode 100644
index 0000000..01cc8b8
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/green.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxhdpi/grey.png b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/grey.png
new file mode 100644
index 0000000..c1a6e88
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/grey.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxhdpi/red.png b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/red.png
new file mode 100644
index 0000000..c944f38
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/red.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxhdpi/yellow.png b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/yellow.png
new file mode 100644
index 0000000..a11ea80
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxhdpi/yellow.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/CMakeLists.txt b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/CMakeLists.txt
new file mode 100644
index 0000000..c602de1
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/CMakeLists.txt
@@ -0,0 +1,5 @@
+install( FILES green.png
+ red.png
+ yellow.png
+ grey.png
+ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/indi/modules/images/xxxhdpi )
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/green.png b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/green.png
new file mode 100644
index 0000000..8ec9468
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/green.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/grey.png b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/grey.png
new file mode 100644
index 0000000..c9afe2c
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/grey.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/red.png b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/red.png
new file mode 100644
index 0000000..86a1908
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/red.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/yellow.png b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/yellow.png
new file mode 100644
index 0000000..efa8cd6
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/xxxhdpi/yellow.png
Binary files differ
diff --git a/kstars/kstarslite/qml/indi/modules/images/yellow.png b/kstars/kstarslite/qml/indi/modules/images/yellow.png
new file mode 100644
index 0000000..7c643d9
--- /dev/null
+++ b/kstars/kstarslite/qml/indi/modules/images/yellow.png
Binary files differ
diff --git a/kstars/kstarslite/qml/main.qml b/kstars/kstarslite/qml/main.qml
index 45846ce..6ee7ec5 100644
--- a/kstars/kstarslite/qml/main.qml
+++ b/kstars/kstarslite/qml/main.qml
@@ -1,13 +1,16 @@
import QtQuick 2.4
import QtQuick.Window 2.2
+import QtQuick.Layouts 1.1
import "modules"
+import "indi"
import "constants" 1.0
+import QtQuick.Controls 1.4 as Controls
+import org.kde.kirigami 1.0 as Kirigami
-Window {
+Kirigami.ApplicationWindow {
id: mainWindow
width: Screen.desktopAvailableWidth
height: Screen.desktopAvailableHeight
- visible: true
property double shadowBgOpacity
property int drawersOrder: 2
property int bgOrder: 1
@@ -15,194 +18,280 @@ Window {
property int topMenuOrder: 0
objectName: "mainWindow"
- Splash {
- z:1
- anchors.fill:parent
- onTimeout: content.visible = true
+ property Item initPage: initPage
+
+ pageStack.initialPage: initPage
+
+ property var contextActions: []
+
+ property var telescopes: []
+
+ //pageStack.currentIndex: initPage
+
+ property Item currentPage: initPage
+
+ controlsVisible: false
+
+ header: Kirigami.ApplicationHeader {
+ visible: false
}
- /*content is made Rectangle to allow z-index ordering
- (for some reason it doesn't work with plain Item)*/
- Rectangle {
- id: content
+ property bool loaded: false
+
+ contentItem.anchors.topMargin: 0
+ wideScreen: true
+
+
+ Item {
+ id: pagesWindow
anchors.fill: parent
- visible: false
+ }
- Rectangle {
- id: skyMapLiteWrapper
- color: "#000"
- objectName: "skyMapLiteWrapper"
- anchors.fill: parent
- }
+ globalDrawer: Kirigami.GlobalDrawer {
+ bannerImageSource: "modules/images/kstars.png"
+ visible: loaded
+ actions: [
+ Kirigami.Action {
+ text: "Sky Map"
+
+ onTriggered: {
+ mainWindow.currentPage = initPage
+ initPage.showPage(true)
+ globalDrawer.close()
+ }
+ },
+ Kirigami.Action {
+ text: "INDI Control Panel"
- GlobalDrawer{
- id: globalDrawer
- width: parent.width < parent.height ? parent.width * 0.65 + dragWidth: parent.width * 0.4 + dragWidth
- z: drawersOrder
- anchors {
- top: parent.top
- bottom: parent.bottom
+ onTriggered: {
+ //mainWindow.currentPage = initPage
+ indiControlPanel.showPage(true)
+ globalDrawer.close()
+ }
}
+ ]
+ }
+
+ contextDrawer: Kirigami.ContextDrawer {
+ id: contextDrawer
+ property Item contextMenu
+
+ Component.onCompleted: {
+ var contDrawMenuComp = Qt.createComponent("modules/ContextDrawerMenu.qml");
+ contextMenu = contDrawMenuComp.createObject(contentItem)
}
+ }
- MouseArea {
- property int posY
- anchors {
- left: parent.left
- right: parent.right
- top: parent.top
- }
- height: parent.height * 0.10
+ INDIControlPanel {
+ id: indiControlPanel
+ }
- onPressed: {
- posY = mouseY
+ KSPage {
+ id: initPage
+ title: "Main Screen"
+ visible:true
+
+ onVisibleChanged: {
+ if(visible) {
+ SkyMapLite.update() //Update SkyMapLite once user opened initPage
}
+ }
+
+ property bool isClickedObject: false
+ Connections {
+ target: SkyMapLite
+ onObjectChanged: {
+ contextDrawer.title = ClickedObject.translatedName
+ contextDrawer.open()
+ initPage.isClickedObject = true
+ }
onPositionChanged: {
- var ratio = 0.05
- var delta = mouseY - posY
- if (delta > parent.height * ratio) {
- if(topMenu.state != "open") topMenu.state = "open"
- } else if (delta < - (parent.height * ratio)) {
- if(topMenu.state != "") topMenu.state = ""
- }
+ contextDrawer.title = "Point"
+ contextDrawer.open()
+ initPage.isClickedObject = false
+ }
+ }
+
+ property bool telescopeLoaded: false
+ Connections {
+ target: ClientManagerLite
+ onTelescopeAdded: {
+ telescopes.push(newTelescope)
+ initPage.telescopeLoaded = true
}
- TopMenu {
- z: topMenuOrder
- id: topMenu
- anchors.horizontalCenter: parent.horizontalCenter
- Connections {
- target: mainWindow
-
- function setOrientation() {
- if (width < topMenu.width) {
- topMenu.state = "portrait"
- }
- else topMenu.state = "landscape"
- }
+ }
- Component.onCompleted: {
- setOrientation()
+ actions {
+ contextualActions: [
+ Kirigami.Action {
+ enabled: telescopeLoaded
+ text: "Slew to object"
+ onTriggered: {
+ var isConnected = false
+ for(var i = 0; i < telescopes.length; ++i) {
+ if(telescopes[i].isConnected()) {
+ isConnected = true
+ if(initPage.isClickedObject) {
+ telescopes[i].slew(ClickedObject)
+ } else {
+ telescopes[i].slew(ClickedPoint)
+ }
+ }
+ }
+ if(!isConnected) telescopeLoaded = false
+ else telescopeLoaded = true
}
-
- onWidthChanged: {
- setOrientation()
+ },
+ Kirigami.Action {
+ enabled: telescopeLoaded
+ text: "Sync"
+ onTriggered: {
+ var isConnected = false
+ for(var i = 0; i < telescopes.length; ++i) {
+ if(telescopes[i].isConnected()) {
+ if(initPage.isClickedObject) {
+ telescopes[i].sync(ClickedObject)
+ } else {
+ telescopes[i].sync(ClickedPoint)
+ }
+ }
+ }
+ if(!isConnected) telescopeLoaded = false
+ else telescopeLoaded = true
}
}
+ ]
+ }
+
+ Splash {
+ z:1
+ anchors.fill:parent
+ onTimeout: {
+ loaded = true
+ mainWindow.controlsVisible = true
}
}
- Rectangle {
- id: shadowBg
- z: bgOrder
+
+ /*content is made Rectangle to allow z-index ordering
+ (for some reason it doesn't work with plain Item)*/
+ Item {
+ id: content
anchors.fill: parent
- color: "black"
- opacity: 0
- property double minOpacity: 0.35
-
- Connections {
- target: globalDrawer
- onBgOpacityChanged: {
- var bgOpacity = globalDrawer.bgOpacity
- if (bgOpacity < shadowBg.minOpacity && contextDrawer.state != "open") shadowBg.opacity = bgOpacity
- }
- onStateChanged: {
- if(globalDrawer.state == "open") contextDrawer.state = ""
- }
- }
+ visible: loaded
+
+ Rectangle {
+ id: skyMapLiteWrapper
+ clip: true
+ objectName: "skyMapLiteWrapper"
+ anchors.fill: parent
+ color: "black"
- Connections {
- target: contextDrawer
- onBgOpacityChanged: {
- var bgOpacity = contextDrawer.bgOpacity
- if (bgOpacity < shadowBg.minOpacity && globalDrawer.state != "open") shadowBg.opacity = bgOpacity
+ onWidthChanged: {
+ SkyMapLite.width = width
}
- onStateChanged: {
- if(contextDrawer.state == "open") globalDrawer.state = ""
+ onHeightChanged: {
+ SkyMapLite.height = height
}
}
MouseArea {
- anchors.fill: parent
+ property int posY
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: parent.top
+ }
+ height: parent.height * 0.10
+
onPressed: {
- if(globalDrawer.state == "open") {
- globalDrawer.state = ""
- mouse.accepted = true
- return
+ posY = mouseY
+ }
+
+ onPositionChanged: {
+ var ratio = 0.05
+ var delta = mouseY - posY
+ if (delta > parent.height * ratio) {
+ if(topMenu.state != "open") topMenu.state = "open"
+ } else if (delta < - (parent.height * ratio)) {
+ if(topMenu.state != "") topMenu.state = ""
}
- if(contextDrawer.state == "open") {
- contextDrawer.state = ""
- mouse.accepted = true
- return
+
+ }
+ TopMenu {
+ z: topMenuOrder
+ id: topMenu
+ anchors.horizontalCenter: parent.horizontalCenter
+ Connections {
+ target: mainWindow
+
+ function setOrientation() {
+ if (width < topMenu.width) {
+ topMenu.state = "portrait"
+ }
+ else topMenu.state = "landscape"
+ }
+
+ Component.onCompleted: {
+ setOrientation()
+ }
+
+ onWidthChanged: {
+ setOrientation()
+ }
}
- mouse.accepted = false
}
}
- Behavior on opacity {
- PropertyAnimation {
- duration: 300
+ MouseArea {
+ property int posY
+ anchors {
+ bottom: parent.bottom
+ horizontalCenter: parent.horizontalCenter
}
- }
- }
+ width: bottomMenu.width
+ height: parent.height *0.10
- MouseArea {
- property int posY
- anchors {
- bottom: parent.bottom
- horizontalCenter: parent.horizontalCenter
- }
- width: bottomMenu.width
- height: parent.height *0.10
+ onPressed: {
+ posY = mouseY
+ }
- onPressed: {
- posY = mouseY
- }
+ onPositionChanged: {
+ var ratio = 0.05
+ var delta = mouseY - posY
+ if (delta < parent.height * ratio) {
+ if(bottomMenu.state != "open") bottomMenu.state = "open"
+ } else if (delta > - (parent.height * ratio)) {
+ if(bottomMenu.state != "") bottomMenu.state = ""
+ }
- onPositionChanged: {
- var ratio = 0.05
- var delta = mouseY - posY
- if (delta < parent.height * ratio) {
- if(bottomMenu.state != "open") bottomMenu.state = "open"
- } else if (delta > - (parent.height * ratio)) {
- if(bottomMenu.state != "") bottomMenu.state = ""
}
+ BottomMenu {
+ z: topMenuOrder
+ id: bottomMenu
- }
- BottomMenu {
- z: topMenuOrder
- id: bottomMenu
-
- anchors.horizontalCenter: parent.horizontalCenter
- Connections {
- target: mainWindow
+ anchors.horizontalCenter: parent.horizontalCenter
+ Connections {
+ target: mainWindow
- function setOrientation() {
- if (width < topMenu.width) {
- bottomMenu.state = "portrait"
+ function setOrientation() {
+ if (width < topMenu.width) {
+ bottomMenu.state = "portrait"
+ }
+ else bottomMenu.state = "landscape"
}
- else bottomMenu.state = "landscape"
- }
- Component.onCompleted: {
- setOrientation()
- }
+ Component.onCompleted: {
+ setOrientation()
+ }
- onWidthChanged: {
- setOrientation()
+ onWidthChanged: {
+ setOrientation()
+ }
}
}
}
}
-
- ContextDrawer{
- id: contextDrawer
- width: parent.width < parent.height ? parent.width * 0.65 + dragWidth: parent.width * 0.4 + dragWidth
- z: drawersOrder
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
- }
}
}
diff --git a/kstars/kstarslite/qml/modules/ContextDrawer.qml b/kstars/kstarslite/qml/modules/ContextDrawer.qml
deleted file mode 100644
index 41aad2d..0000000
--- a/kstars/kstarslite/qml/modules/ContextDrawer.qml
+++ /dev/null
@@ -1,122 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.1
-import QtGraphicalEffects 1.0
-import "helpers"
-import "../constants" 1.0
-
-Item {
- id: contextDrawer
- property int dragWidth: num.dp * 50
- property int minX: parent.width - width
- property int maxX: parent.width - globShadow.anchors.leftMargin - dragWidth
- property double bgOpacity: 1 + (x - minX)/(minX-maxX)
- x: maxX
-
- states: [
- State {
- name: "open"
- PropertyChanges {
- target: contextDrawer
- x: minX
- }
- },
- State {
- name: ""
- PropertyChanges {
- target: contextDrawer
- x: maxX
- }
- }
- ]
-
- Behavior on x {
- PropertyAnimation {
- duration: 150
- }
- }
-
- MouseArea {
- id: globDrag
- anchors.fill: parent
- drag {
- target: contextDrawer
- axis: Drag.XAxis
- minimumX: contextDrawer.minX
- maximumX: contextDrawer.maxX
- onActiveChanged: {
- if (contextDrawer.state == "") {
- if (contextDrawer.x < maxX*0.8) {
- contextDrawer.state = "open"
- }
- else contextDrawer.x = maxX
- }
- else if (contextDrawer.state == "open"){
- if (contextDrawer.x > minX + maxX*0.15) {
- contextDrawer.state = ""
- }
- else contextDrawer.x = minX
- }
- }
- }
-
- }
-
- BorderImage {
- id: globShadow
- anchors {
- top: parentRect.top
- bottom: parentRect.bottom
- left: parentRect.left
- }
- anchors { topMargin: -2; leftMargin: -8; bottomMargin: -2 }
- border { top: 10; right: 10; bottom: 10 }
- source: "images/shadow.png"
- }
-
- Rectangle {
- anchors {
- fill: parent
- leftMargin: contextDrawer.dragWidth
- }
-
- id: parentRect
-
- ColumnLayout {
- anchors {
- left: parent.left
- right: parent.right
- top: parent.top
- topMargin: num.dp * 10
- leftMargin: num.dp * 10
- }
- spacing: num.dp * 10
-
- Text {
- id: contextHeader
- text: "Mars"
- font.family: "Oxygen Normal"
- font.pixelSize: num.dp * 44
- color: "#31363b"
- }
-
- ColumnLayout {
- anchors {
- top: contextHeader.bottom
- topMargin: num.dp * 30
- }
- spacing: num.dp * 30
-
-
- DrawerElem {
- iconSrc: num.iconpath + "/compass.png"
- title: "Center & Track"
- }
-
- DrawerElem {
- iconSrc: num.iconpath + "/games-config-custom.png"
- title: "Details"
- }
- }
- }
- }
-}
diff --git a/kstars/kstarslite/qml/modules/ContextDrawerMenu.qml b/kstars/kstarslite/qml/modules/ContextDrawerMenu.qml
new file mode 100644
index 0000000..f5c706d
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/ContextDrawerMenu.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.4
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.4
+import org.kde.kirigami 1.0 as Kirigami
+
+ColumnLayout {
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: parent.top
+ }
+
+ Text {
+ id: contextText
+ Layout.fillWidth: true
+ }
+}
diff --git a/kstars/kstarslite/qml/modules/GlobalDrawer.qml b/kstars/kstarslite/qml/modules/GlobalDrawer.qml
deleted file mode 100644
index e327a91..0000000
--- a/kstars/kstarslite/qml/modules/GlobalDrawer.qml
+++ /dev/null
@@ -1,122 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.1
-import QtGraphicalEffects 1.0
-import "helpers"
-import "../constants" 1.0
-
-Item {
- id: globalDrawer
- property int dragWidth: num.dp * 50
- property int maxX: 0
- property int minX: dragWidth - width + globShadow.anchors.rightMargin
- property double bgOpacity: 1 - (x/minX)
- x: minX
-
- states: [
- State {
- name: "open"
- PropertyChanges {
- target: globalDrawer
- x: maxX
- }
- },
- State {
- name: ""
- PropertyChanges {
- target: globalDrawer
- x: minX
- }
- }
- ]
-
- Behavior on x {
- PropertyAnimation {
- duration: 150
- }
- }
-
- MouseArea {
- id: globDrag
- anchors {
- fill: parent
- }
-
- drag {
- target: globalDrawer
- axis: Drag.XAxis
- minimumX: globalDrawer.minX
- maximumX: globalDrawer.maxX
- onActiveChanged: {
- if (globalDrawer.state == "") {
- if (globalDrawer.x > minX*0.8) {
- globalDrawer.state = "open"
- }
- else globalDrawer.x = minX
- }
- else if (globalDrawer.state == "open"){
- if (globalDrawer.x < minX*0.3) {
- globalDrawer.state = ""
- }
- else globalDrawer.x = maxX
- }
- }
- }
-
-
- BorderImage {
- id: globShadow
- anchors {
- top: parentRect.top
- bottom: parentRect.bottom
- right: parentRect.right
- }
- anchors { topMargin: -2; rightMargin: -8; bottomMargin: -2 }
- border { top: 10; right: 10; bottom: 10 }
- source: "images/shadow.png"
- }
-
- Rectangle {
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
- width: parent.width - dragWidth
-
- id: parentRect
-
- Image {
- id: contextHeader
- source: "images/kstars.png"
- fillMode: Image.PreserveAspectFit
- width: parentRect.width
- }
-
- ColumnLayout {
- anchors {
- left: parent.left
- right: parent.right
- top: contextHeader.bottom
- topMargin: num.dp * 10
- leftMargin: num.dp * 10
- }
- spacing: num.dp * 30
-
- DrawerElem {
- iconSrc: num.iconpath + "/system-search.png"
- title: "Search"
- }
-
- DrawerColorScheme {
-
- }
-
- DrawerElem {
- iconSrc: num.iconpath + "/applications-system.png"
- title: "Settings"
- }
- }
-
- }
-
- }
-}
diff --git a/kstars/kstarslite/qml/modules/KSPage.qml b/kstars/kstarslite/qml/modules/KSPage.qml
new file mode 100644
index 0000000..5f0dc53
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/KSPage.qml
@@ -0,0 +1,127 @@
+import QtQuick 2.4
+import QtQuick.Layouts 1.1
+import QtGraphicalEffects 1.0
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.4 as Controls
+import org.kde.kirigami 1.0 as Kirigami
+import "../constants" 1.0
+
+Kirigami.Page {
+ leftPadding: 0
+ rightPadding: 0
+ topPadding: 0
+ bottomPadding: 0
+ anchors.fill: parent
+ visible: false
+
+ property Item contentItem: null
+ property Item prevPage: null
+
+ function showPage(backtoInit) {
+ if(backtoInit) {
+ mainWindow.currentPage.visible = false // Hide current page
+ prevPage = mainWindow.initPage // Go back to SkyMap
+ } else {
+ prevPage = mainWindow.currentPage
+ }
+ prevPage.visible = false
+ visible = true
+ mainWindow.currentPage = this
+ }
+
+ function goBack() {
+ prevPage.visible = true
+ visible = false
+ mainWindow.currentPage = prevPage
+ prevPage = null
+ }
+
+ Connections {
+ target: mainWindow
+ onClosing: {
+ if (Qt.platform.os == "android" && visible) {
+ if(prevPage !== null) {
+ close.accepted = false;
+ goBack()
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ id: headerRect
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ }
+ height: Screen.height * 0.07 + headerSeparator.height
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#207ce5" }
+ GradientStop { position: 0.70; color: "#499bea" }
+ }
+
+ RowLayout {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+
+ Image {
+ id: backButton
+ visible: prevPage !== null
+ source: "images/" + num.density + "/icons/back.png"
+ anchors {
+ left: parent.left
+ top: parent.top
+ bottom: parent.bottom
+ }
+
+ Component.onCompleted: {
+ console.log(num.density)
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ goBack()
+ }
+ onPressedChanged: {
+ if(pressed) {
+ backButton.opacity = 0.6
+ } else {
+ backButton.opacity = 1
+ }
+ }
+ }
+ }
+
+ Text {
+ visible: prevPage !== null
+ text: title
+ color: "white"
+ anchors.left: backButton.right
+ anchors.leftMargin: 20
+ }
+ }
+ Rectangle {
+ id: headerSeparator
+ anchors {
+ top: parent.bottom
+ left: parent.left
+ right: parent.right
+ }
+ height: 5 * num.dp
+ color: "#c5c5c5"
+ }
+ }
+
+ Component.onCompleted: {
+ if(contentItem !== null) {
+ contentItem.anchors.top = headerRect.bottom
+ contentItem.anchors.left = contentItem.parent.left
+ contentItem.anchors.right = contentItem.parent.right
+ //contentItem.anchors.leftMargin = 25
+ //contentItem.anchors.rightMargin = 25
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/modules/KSScrollablePage.qml b/kstars/kstarslite/qml/modules/KSScrollablePage.qml
new file mode 100644
index 0000000..42b54d2
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/KSScrollablePage.qml
@@ -0,0 +1,82 @@
+import QtQuick 2.4
+import QtQuick.Layouts 1.1
+import QtGraphicalEffects 1.0
+import QtQuick.Window 2.2
+import QtQuick.Controls 1.4 as Controls
+import org.kde.kirigami 1.0 as Kirigami
+
+Kirigami.ScrollablePage {
+ leftPadding: 0
+ rightPadding: 0
+ topPadding: 0
+ bottomPadding: 0
+ anchors.fill: parent
+ visible: false
+
+ property Item contentItem: null
+ property Item prevPage: null
+
+ function showPage() {
+ prevPage = mainWindow.currentPage
+ prevPage.visible = false
+ visible = true
+ mainWindow.currentPage = this
+ }
+
+ function goBack() {
+ prevPage.visible = true
+ visible = false
+ mainWindow.currentPage = prevPage
+ prevPage = null
+ }
+
+ Rectangle {
+ id: headerRect
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ }
+ height: Screen.height * 0.05
+ color: "#2d5b9a"
+
+ RowLayout {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+
+ Text {
+ id: backButton
+ visible: prevPage !== null
+ text: "Back"
+ color: "white"
+
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ goBack()
+ }
+ }
+ }
+
+ Text {
+ visible: prevPage !== null
+ text: "Back"
+ color: "white"
+ anchors.left: backButton.right
+ anchors.leftMargin: 20
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ if(contentItem !== null) {
+ contentItem.anchors.top = headerRect.bottom
+ contentItem.anchors.left = contentItem.parent.left
+ contentItem.anchors.right = contentItem.parent.right
+ contentItem.anchors.leftMargin = 25
+ contentItem.anchors.rightMargin = 25
+ }
+ }
+}
diff --git a/kstars/kstarslite/qml/modules/TelescopeControlMenu.qml b/kstars/kstarslite/qml/modules/TelescopeControlMenu.qml
new file mode 100644
index 0000000..575df7c
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/TelescopeControlMenu.qml
@@ -0,0 +1,23 @@
+/*import QtQuick 2.4
+import org.kde.kirigami 1.0 as Kirigami
+
+Item {
+ property string telescopeName
+
+ property var actions: [
+ Kirigami.Action {
+ text: "Action text"
+ onTriggered: {
+ console.log("DSd")
+ }
+ },
+ Kirigami.Action {
+ text: "Action text"
+ enabled: false
+ onTriggered: {
+ console.log("SDS")
+ }
+ }
+ ]
+}
+*/
diff --git a/kstars/kstarslite/qml/modules/helpers/DrawerColorScheme.qml b/kstars/kstarslite/qml/modules/helpers/DrawerColorScheme.qml
deleted file mode 100644
index e4e985d..0000000
--- a/kstars/kstarslite/qml/modules/helpers/DrawerColorScheme.qml
+++ /dev/null
@@ -1,106 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.1
-import "../../constants" 1.0
-
-ColumnLayout {
- property var iconSrc: ""
- property string title: ""
- anchors {
- left: parent.left
- right: parent.right
- }
- DrawerElem {
- iconSrc: num.iconpath + "/color-management.png"
- title: "Color Scheme"
-
- MouseArea {
- anchors.fill: parent
- onPressed: {
- if (!colorSchemes.Layout.minimumHeight) colorSchemes.Layout.minimumHeight = colorsFlow.childrenRect.height
- else colorSchemes.Layout.minimumHeight = 0
- }
-
- Image {
- source: num.iconpath + "/arrow-right.png"
- anchors.right: parent.right
- }
- }
-
- }
-
- Rectangle {
- id:colorSchemes
- Layout.minimumHeight: 0
- Layout.fillWidth: true
-
- Behavior on Layout.minimumHeight {
- NumberAnimation {
- duration: 400
- easing.type: Easing.InOutQuad
- }
- }
-
- transitions: Transition {
- NumberAnimation {
- properties: "Layout.minimumHeight"
- easing.type: Easing.InOutQuad
- }
- }
-
- Flow {
- id: colorsFlow
- height: parent.height
- anchors {
- left: parent.left
- leftMargin: num.dp * 55
- top: parent.top
- topMargin: num.dp * 10
- right: parent.right
- rightMargin: num.dp * 20
- }
-
- clip: true
- property double rectSize: num.dp * 80
- spacing: num.dp * 20
- Rectangle {
- width: parent.rectSize
- height: parent.rectSize
- color: "#000022"
- border {
- width: 1
- color: "black"
- }
- }
-
- Rectangle {
- width: parent.rectSize
- height: parent.rectSize
- color: "#ffffff"
- border {
- width: 1
- color: "black"
- }
- }
-
- Rectangle {
- width: parent.rectSize
- height: parent.rectSize
- color: "#880000"
- border {
- width: 1
- color: "black"
- }
- }
-
- Rectangle {
- width: parent.rectSize
- height: parent.rectSize
- color: "black"
- border {
- width: 1
- color: "black"
- }
- }
- }
- }
-}
diff --git a/kstars/kstarslite/qml/modules/helpers/DrawerElem.qml b/kstars/kstarslite/qml/modules/helpers/DrawerElem.qml
deleted file mode 100644
index 441ecf5..0000000
--- a/kstars/kstarslite/qml/modules/helpers/DrawerElem.qml
+++ /dev/null
@@ -1,26 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Layouts 1.1
-import "../../constants" 1.0
-
-RowLayout {
- property var iconSrc: ""
- property string title: ""
- spacing: 25 * num.dp
- anchors {
- left: parent.left
- right: parent.right
- }
-
- Image {
- source: iconSrc
- fillMode: Image.PreserveAspectFit
- }
-
- Text {
- text: title
- font.family: "Oxygen Normal"
- font.pixelSize: num.dp * 28
- color: "#31363b"
- anchors.verticalCenter: parent.verticalCenter
- }
-}
diff --git a/kstars/kstarslite/qml/modules/images/back.png b/kstars/kstarslite/qml/modules/images/back.png
new file mode 100644
index 0000000..4512093
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/images/back.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/images/backl.png b/kstars/kstarslite/qml/modules/images/backl.png
new file mode 100644
index 0000000..76bae2e
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/images/backl.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/images/hdpi/icons/CMakeLists.txt b/kstars/kstarslite/qml/modules/images/hdpi/icons/CMakeLists.txt
index 4eef98c..e575016 100644
--- a/kstars/kstarslite/qml/modules/images/hdpi/icons/CMakeLists.txt
+++ b/kstars/kstarslite/qml/modules/images/hdpi/icons/CMakeLists.txt
@@ -22,4 +22,5 @@ install( FILES icon.png
sc-actions-kstars_planets.png
sc-actions-kstars_stars.png
system-search.png
+ back.png
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules/images/hdpi/icons )
diff --git a/kstars/kstarslite/qml/modules/images/hdpi/icons/back.png b/kstars/kstarslite/qml/modules/images/hdpi/icons/back.png
new file mode 100644
index 0000000..f5dcb5e
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/images/hdpi/icons/back.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/images/ldpi/icons/CMakeLists.txt b/kstars/kstarslite/qml/modules/images/ldpi/icons/CMakeLists.txt
index 39c443e..68b307a 100644
--- a/kstars/kstarslite/qml/modules/images/ldpi/icons/CMakeLists.txt
+++ b/kstars/kstarslite/qml/modules/images/ldpi/icons/CMakeLists.txt
@@ -22,4 +22,5 @@ install( FILES icon.png
sc-actions-kstars_planets.png
sc-actions-kstars_stars.png
system-search.png
+ back.png
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules/images/ldpi/icons )
diff --git a/kstars/kstarslite/qml/modules/images/ldpi/icons/back.png b/kstars/kstarslite/qml/modules/images/ldpi/icons/back.png
new file mode 100644
index 0000000..76bae2e
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/images/ldpi/icons/back.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/images/mdpi/icons/CMakeLists.txt b/kstars/kstarslite/qml/modules/images/mdpi/icons/CMakeLists.txt
index e9ff6a2..8d319f9 100644
--- a/kstars/kstarslite/qml/modules/images/mdpi/icons/CMakeLists.txt
+++ b/kstars/kstarslite/qml/modules/images/mdpi/icons/CMakeLists.txt
@@ -22,4 +22,5 @@ install( FILES icon.png
sc-actions-kstars_planets.png
sc-actions-kstars_stars.png
system-search.png
+ back.png
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules/images/mdpi/icons )
diff --git a/kstars/kstarslite/qml/modules/images/mdpi/icons/back.png b/kstars/kstarslite/qml/modules/images/mdpi/icons/back.png
new file mode 100644
index 0000000..deebe72
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/images/mdpi/icons/back.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/images/xhdpi/icons/CMakeLists.txt b/kstars/kstarslite/qml/modules/images/xhdpi/icons/CMakeLists.txt
index 80ca5b4..a3e8c07 100644
--- a/kstars/kstarslite/qml/modules/images/xhdpi/icons/CMakeLists.txt
+++ b/kstars/kstarslite/qml/modules/images/xhdpi/icons/CMakeLists.txt
@@ -22,4 +22,5 @@ install( FILES icon.png
sc-actions-kstars_planets.png
sc-actions-kstars_stars.png
system-search.png
+ back.png
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules/images/xhdpi/icons )
diff --git a/kstars/kstarslite/qml/modules/images/xhdpi/icons/back.png b/kstars/kstarslite/qml/modules/images/xhdpi/icons/back.png
new file mode 100644
index 0000000..0c326d5
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/images/xhdpi/icons/back.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/images/xxhdpi/icons/CMakeLists.txt b/kstars/kstarslite/qml/modules/images/xxhdpi/icons/CMakeLists.txt
index 8399510..62cda1c 100644
--- a/kstars/kstarslite/qml/modules/images/xxhdpi/icons/CMakeLists.txt
+++ b/kstars/kstarslite/qml/modules/images/xxhdpi/icons/CMakeLists.txt
@@ -22,4 +22,5 @@ install( FILES icon.png
sc-actions-kstars_planets.png
sc-actions-kstars_stars.png
system-search.png
+ back.png
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules/images/xxhdpi/icons )
diff --git a/kstars/kstarslite/qml/modules/images/xxhdpi/icons/back.png b/kstars/kstarslite/qml/modules/images/xxhdpi/icons/back.png
new file mode 100644
index 0000000..233d8e6
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/images/xxhdpi/icons/back.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/images/xxxhdpi/icons/CMakeLists.txt b/kstars/kstarslite/qml/modules/images/xxxhdpi/icons/CMakeLists.txt
index 0d1ec98..ec79117 100644
--- a/kstars/kstarslite/qml/modules/images/xxxhdpi/icons/CMakeLists.txt
+++ b/kstars/kstarslite/qml/modules/images/xxxhdpi/icons/CMakeLists.txt
@@ -22,4 +22,5 @@ install( FILES icon.png
sc-actions-kstars_planets.png
sc-actions-kstars_stars.png
system-search.png
+ back.png
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/kstarslite/qml/modules/images/xxxhdpi/icons )
diff --git a/kstars/kstarslite/qml/modules/images/xxxhdpi/icons/back.png b/kstars/kstarslite/qml/modules/images/xxxhdpi/icons/back.png
new file mode 100644
index 0000000..2cfa51d
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/images/xxxhdpi/icons/back.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/led_off.png b/kstars/kstarslite/qml/modules/led_off.png
new file mode 100644
index 0000000..f91c504
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/led_off.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/led_on.png b/kstars/kstarslite/qml/modules/led_on.png
new file mode 100644
index 0000000..4cf18a1
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/led_on.png
Binary files differ
diff --git a/kstars/kstarslite/qml/modules/on-off-green-light-hi.png b/kstars/kstarslite/qml/modules/on-off-green-light-hi.png
new file mode 100644
index 0000000..5a426e3
--- /dev/null
+++ b/kstars/kstarslite/qml/modules/on-off-green-light-hi.png
Binary files differ
diff --git a/kstars/kstarslite/skyitems/constellationartitem.cpp b/kstars/kstarslite/skyitems/constellationartitem.cpp
index c162561..447d40c 100644
--- a/kstars/kstarslite/skyitems/constellationartitem.cpp
+++ b/kstars/kstarslite/skyitems/constellationartitem.cpp
@@ -30,17 +30,29 @@ ConstellationArtItem::ConstellationArtItem(ConstellationArtComponent *artComp, R
}
void ConstellationArtItem::update() {
- if(Options::showConstellationArt() && SkyMapLite::IsSlewing() == false)
- {
- show();
- //Traverse all children nodes of RootNode
+ if(Options::showConstellationArt()) {
+ m_artComp->loadData();
+ if (SkyMapLite::IsSlewing() == false) {
+ show();
+ //Traverse all children nodes of RootNode
+ QSGNode *n = firstChild();
+ while(n != 0) {
+ ConstellationArtNode *artNode = static_cast<ConstellationArtNode *>(n);
+ artNode->update();
+ n = n->nextSibling();
+ }
+ } else {
+ hide();
+ }
+ } else {
+ //Delete all images if we don't need to draw constellation art and save ~50 MB.
+ m_artComp->deleteData();
QSGNode *n = firstChild();
while(n != 0) {
- ConstellationArtNode *artNode = static_cast<ConstellationArtNode *>(n);
- artNode->update();
+ QSGNode *d = n;
n = n->nextSibling();
+ removeChildNode(d);
+ delete d;
}
- } else {
- hide();
}
}
diff --git a/kstars/kstarslite/skyitems/deepskyitem.cpp b/kstars/kstarslite/skyitems/deepskyitem.cpp
index 7e6a27e..c9588df 100644
--- a/kstars/kstarslite/skyitems/deepskyitem.cpp
+++ b/kstars/kstarslite/skyitems/deepskyitem.cpp
@@ -46,7 +46,7 @@ void DSOIndexNode::show() {
}
DSOTrixelNode::DSOTrixelNode(Trixel trixelID)
- :trixel(trixelID)
+ :TrixelNode(trixelID)
{
}
@@ -228,7 +228,7 @@ void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, co
double delLim = SkyMapLite::deleteLimit();
while( trixel != 0 ) {
- if(trixel->trixel < regionID) {
+ if(trixel->trixelID() < regionID) {
trixel->hide();
trixel->m_labels->hide();
@@ -246,11 +246,7 @@ void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, co
i++;
}
}
-
- trixel = static_cast<DSOTrixelNode *>(trixel->nextSibling());
- continue;
-
- } else if(trixel->trixel > regionID) {
+ } else if(trixel->trixelID() > regionID) {
if (region->hasNext()) {
regionID = region->next();
} else {
@@ -340,7 +336,7 @@ void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, co
DSOSymbolNode *dsoSymbol = new DSOSymbolNode(dsoObj, indexNode->m_color);
trixel->m_symbols->appendChildNode(dsoSymbol);
- DeepSkyNode *dsoNode = new DeepSkyNode(dsoObj, dsoSymbol, trixel->trixel, indexNode->m_labelType);
+ DeepSkyNode *dsoNode = new DeepSkyNode(dsoObj, dsoSymbol, trixel->trixelID(), indexNode->m_labelType);
trixel->appendChildNode(dsoNode);
*i = QPair<SkyObject *, SkyNode *>((*i).first, static_cast<SkyNode *>(dsoNode));
diff --git a/kstars/kstarslite/skyitems/deepskyitem.h b/kstars/kstarslite/skyitems/deepskyitem.h
index 02034ab..a7188f6 100644
--- a/kstars/kstarslite/skyitems/deepskyitem.h
+++ b/kstars/kstarslite/skyitems/deepskyitem.h
@@ -40,7 +40,6 @@ public:
DSOTrixelNode(Trixel trixelID);
TrixelNode *m_labels;
QSGNode *m_symbols;
- Trixel trixel;
};
/** @class StarItem
diff --git a/kstars/kstarslite/skyitems/deepstaritem.cpp b/kstars/kstarslite/skyitems/deepstaritem.cpp
index c02e19b..879264b 100644
--- a/kstars/kstarslite/skyitems/deepstaritem.cpp
+++ b/kstars/kstarslite/skyitems/deepstaritem.cpp
@@ -41,7 +41,7 @@ DeepStarItem::DeepStarItem(DeepStarComponent *deepStarComp, RootNode *rootNode)
Options::setShowStarNames(true);
if(m_staticStars) {
for(int c = 0; c < m_starBlockList->size(); ++c) {
- TrixelNode *trixel = new TrixelNode;
+ TrixelNode *trixel = new TrixelNode(m_starBlockList->at( c )->getTrixel());
appendChildNode(trixel);
int blockCount = m_starBlockList->at( c )->getBlockCount();
diff --git a/kstars/kstarslite/skyitems/labelsitem.cpp b/kstars/kstarslite/skyitems/labelsitem.cpp
index e54b65b..02341e2 100644
--- a/kstars/kstarslite/skyitems/labelsitem.cpp
+++ b/kstars/kstarslite/skyitems/labelsitem.cpp
@@ -37,8 +37,7 @@ LabelsItem::LabelsItem()
int trixelNum = SkyMesh::Instance()->size();
for(int i = 0; i < trixelNum; ++i) {
- TrixelNode *trixel = new TrixelNode;
- trixel->m_trixel = i;
+ TrixelNode *trixel = new TrixelNode(i);
stars->appendChildNode(trixel);
}
@@ -112,6 +111,10 @@ LabelsItem::LabelsItem()
appendChildNode(ecliptic);
m_labelsLists.insert(label_t::ECLIPTIC_LABEL, ecliptic);
+ LabelTypeNode *telescopeSymbol = new LabelTypeNode;
+ appendChildNode(telescopeSymbol);
+ m_labelsLists.insert(label_t::TELESCOPE_SYMBOL, telescopeSymbol);
+
skyLabeler = SkyLabeler::Instance();
skyLabeler->reset();
}
@@ -129,7 +132,7 @@ LabelNode *LabelsItem::addLabel(SkyObject *skyObject, label_t labelType, Trixel
LabelNode *label = 0;
while(triNode != 0) {
- if(triNode->m_trixel == trixel) {
+ if(triNode->trixelID() == trixel) {
label = new LabelNode(skyObject, labelType);
triNode->appendChildNode(label);
break;
@@ -152,8 +155,7 @@ GuideLabelNode *LabelsItem::addGuideLabel(QString name, label_t labelType) {
}
TrixelNode *LabelsItem::addTrixel(label_t labelType, Trixel trixel) {
- TrixelNode *triNode = new TrixelNode;
- triNode->m_trixel = trixel;
+ TrixelNode *triNode = new TrixelNode(trixel);
getLabelNode(labelType)->appendChildNode(triNode);
return triNode;
}
@@ -162,6 +164,8 @@ void LabelsItem::update() {
SkyLabeler * skyLabeler = SkyLabeler::Instance();
skyLabeler->reset();
+ updateChildLabels(label_t::TELESCOPE_SYMBOL);
+
updateChildLabels(label_t::HORIZON_LABEL);
updateChildLabels(label_t::EQUATOR_LABEL);
diff --git a/kstars/kstarslite/skyitems/labelsitem.h b/kstars/kstarslite/skyitems/labelsitem.h
index 718e9a8..9a6d2c6 100644
--- a/kstars/kstarslite/skyitems/labelsitem.h
+++ b/kstars/kstarslite/skyitems/labelsitem.h
@@ -90,6 +90,7 @@ public:
HORIZON_LABEL,
EQUATOR_LABEL,
ECLIPTIC_LABEL,
+ TELESCOPE_SYMBOL,
NO_LABEL //used in LinesItem
};
diff --git a/kstars/kstarslite/skyitems/lines/eclipticitem.cpp b/kstars/kstarslite/skyitems/lines/eclipticitem.cpp
index 112ea4f..a7c8b56 100644
--- a/kstars/kstarslite/skyitems/lines/eclipticitem.cpp
+++ b/kstars/kstarslite/skyitems/lines/eclipticitem.cpp
@@ -32,14 +32,17 @@ EclipticItem::EclipticItem(Ecliptic *eclipticComp, RootNode *rootNode)
while( i != trixels->end()) {
LineListList *linesList = *i;
- if(linesList->size()) {
- TrixelNode *trixel = new TrixelNode;
- appendChildNode(trixel);
+ QList<LineList *> addedLines;
+ if(linesList->size()) {
QColor schemeColor = KStarsData::Instance()->colorScheme()->colorNamed("EclColor");
for(int c = 0; c < linesList->size(); ++c) {
- LineNode * ln = new LineNode(linesList->at(c), 0, schemeColor, 1, Qt::SolidLine);
- trixel->appendChildNode(ln);
+ LineList *lines = linesList->at(c);
+ if(!addedLines.contains(lines)) {
+ LineNode * ln = new LineNode(lines, 0, schemeColor, 1, Qt::SolidLine);
+ appendChildNode(ln);
+ addedLines.append(lines);
+ }
}
}
++i;
@@ -68,33 +71,19 @@ EclipticItem::EclipticItem(Ecliptic *eclipticComp, RootNode *rootNode)
void EclipticItem::update() {
if(m_eclipticComp->selected()) {
show();
- QSGNode *n = firstChild();
-
- DrawID drawID = SkyMesh::Instance()->drawID();
UpdateID updateID = KStarsData::Instance()->updateID();
- while(n != 0) {
- TrixelNode * trixel = static_cast<TrixelNode *>(n);
- trixel->show();
- n = n->nextSibling();
-
- QSGNode *l = trixel->firstChild();
+ QSGNode *l = firstChild();
while(l != 0) {
LineNode * lines = static_cast<LineNode *>(l);
l = l->nextSibling();
LineList * lineList = lines->lineList();
- if ( lineList->drawID == drawID ) {
- lines->hide();
- continue;
- }
if ( lineList->updateID != updateID )
m_eclipticComp->JITupdate( lineList );
- lineList->drawID = drawID;
lines->updateGeometry();
}
- }
const Projector *proj = SkyMapLite::Instance()->projector();
KStarsData *data = KStarsData::Instance();
diff --git a/kstars/kstarslite/skyitems/lines/equatoritem.cpp b/kstars/kstarslite/skyitems/lines/equatoritem.cpp
index 5ad1d0b..75b9c3a 100644
--- a/kstars/kstarslite/skyitems/lines/equatoritem.cpp
+++ b/kstars/kstarslite/skyitems/lines/equatoritem.cpp
@@ -36,14 +36,17 @@ EquatorItem::EquatorItem(Equator *equatorComp, RootNode *rootNode)
while( i != trixels->end()) {
LineListList *linesList = *i;
- if(linesList->size()) {
- TrixelNode *trixel = new TrixelNode;
- appendChildNode(trixel);
+ QList<LineList *> addedLines;
+ if(linesList->size()) {
QColor schemeColor = KStarsData::Instance()->colorScheme()->colorNamed("EqColor");
for(int c = 0; c < linesList->size(); ++c) {
- LineNode * ln = new LineNode(linesList->at(c), 0, schemeColor, 1, Qt::SolidLine);
- trixel->appendChildNode(ln);
+ LineList *lines = linesList->at(c);
+ if(!addedLines.contains(lines)) {
+ LineNode * ln = new LineNode(linesList->at(c), 0, schemeColor, 1, Qt::SolidLine);
+ appendChildNode(ln);
+ addedLines.append(lines);
+ }
}
}
++i;
@@ -64,33 +67,20 @@ EquatorItem::EquatorItem(Equator *equatorComp, RootNode *rootNode)
void EquatorItem::update() {
if(m_equatorComp->selected()) {
show();
- QSGNode *n = firstChild();
- DrawID drawID = SkyMesh::Instance()->drawID();
UpdateID updateID = KStarsData::Instance()->updateID();
- while(n != 0) {
- TrixelNode * trixel = static_cast<TrixelNode *>(n);
- trixel->show();
- n = n->nextSibling();
-
- QSGNode *l = trixel->firstChild();
+ QSGNode *l = firstChild();
while(l != 0) {
LineNode * lines = static_cast<LineNode *>(l);
l = l->nextSibling();
LineList * lineList = lines->lineList();
- if ( lineList->drawID == drawID ) {
- lines->hide();
- continue;
- }
if ( lineList->updateID != updateID )
m_equatorComp->JITupdate( lineList );
- lineList->drawID = drawID;
lines->updateGeometry();
}
- }
const Projector *proj = SkyMapLite::Instance()->projector();
KStarsData *data = KStarsData::Instance();
diff --git a/kstars/kstarslite/skyitems/lines/linesitem.cpp b/kstars/kstarslite/skyitems/lines/linesitem.cpp
index 28252a5..1974cfc 100644
--- a/kstars/kstarslite/skyitems/lines/linesitem.cpp
+++ b/kstars/kstarslite/skyitems/lines/linesitem.cpp
@@ -35,21 +35,32 @@ void LinesItem::addLinesComponent(LineListIndex *linesComp, QString color, int w
appendChildNode(node);
m_lineIndexes.insert(node, linesComp);
- LineListHash *trixels = linesComp->lineIndex();
+ LineListHash *list = linesComp->lineIndex();
+ //Sort by trixels
+ QMap<Trixel, LineListList*> trixels;
+
+ QHash< Trixel, LineListList *>::const_iterator s = list->begin();
+ while(s != list->end()) {
+ trixels.insert(s.key(), *s);
+ s++;
+ }
- QHash< Trixel, LineListList *>::const_iterator i = trixels->begin();
- while( i != trixels->end()) {
+ QMap< Trixel, LineListList *>::const_iterator i = trixels.begin();
+ QList<LineList *> addedLines;
+ while( i != trixels.end()) {
LineListList *linesList = *i;
if(linesList->size()) {
- TrixelNode *trixel = new TrixelNode;
+ TrixelNode *trixel = new TrixelNode(i.key());
node->appendChildNode(trixel);
QColor schemeColor = KStarsData::Instance()->colorScheme()->colorNamed(color);
for(int c = 0; c < linesList->size(); ++c) {
- //LineNode * ln = new LineNode(linesList->at(c), schemeColor, width, style);
- /*trixel->appendChildNode(ln);*/
- trixel->appendChildNode(new LineNode(linesList->at(c), 0, schemeColor, width, style));
+ LineList *list = linesList->at(c);
+ if(!addedLines.contains(list)) {
+ trixel->appendChildNode(new LineNode(linesList->at(c), 0, schemeColor, width, style));
+ addedLines.append(list);
+ }
}
}
++i;
@@ -58,24 +69,28 @@ void LinesItem::addLinesComponent(LineListIndex *linesComp, QString color, int w
void LinesItem::update() {
QMap< LineIndexNode *, LineListIndex *>::const_iterator i = m_lineIndexes.begin();
- while( i != m_lineIndexes.end()) {
- //QVector<Trixel> visTrixels;
- SkyMesh * mesh = SkyMesh::Instance();
- SkyMapLite *map = SkyMapLite::Instance();
- double radius = map->projector()->fov();
- if ( radius > 180.0 )
- radius = 180.0;
- if(mesh) {
- //mesh->aperture(map->focus(), radius);
- }
- /*MeshIterator region (mesh,DRAW_BUF);
- while ( region.hasNext() ) {
- visTrixels.append(region.next());
- }*/
+ //SkyMesh * mesh = SkyMesh::Instance();
+ SkyMapLite *map = SkyMapLite::Instance();
- DrawID drawID = SkyMesh::Instance()->drawID();
- UpdateID updateID = KStarsData::Instance()->updateID();
+ double radius = map->projector()->fov();
+ if ( radius > 90.0 ) radius = 90.0;
+
+ UpdateID updateID = KStarsData::Instance()->updateID();
+
+ SkyPoint* focus = map->focus();
+ //mesh->aperture( focus, radius + 1.0, DRAW_BUF ); // divide by 2 for testing
+ //Doesn't work stable
+
+// MeshIterator region(mesh, DRAW_BUF);
+
+ while( i != m_lineIndexes.end()) {
+// int count = 0;
+ int regionID = -1;
+ /*if(region.hasNext()) {
+ regionID = region.next();
+ count++;
+ }*/
LineIndexNode * node = i.key();
if(i.value()->selected()) {
@@ -84,37 +99,41 @@ void LinesItem::update() {
QSGNode *n = node->firstChild();
while(n != 0) {
TrixelNode * trixel = static_cast<TrixelNode *>(n);
- trixel->show();
-
- n = n->nextSibling();
+ //qDebug() << trixel->trixelID() << regionID;
+ /*if(trixel->trixelID() < regionID) {
+ trixel->hide();
+ } else if(trixel->trixelID() > regionID) {
+ if(region.hasNext()) {
+ regionID = region.next();
+ count++;
+ } else {
+ //Hide all trixels that has greater ID than regionID
+ regionID = mesh->size();
+ }
+ continue;
+ } else {*/
+ trixel->show();
- //if(visTrixels.contains(c)) {
+ QSGNode *l = trixel->firstChild();
+ while(l != 0) {
+ LineNode * lines = static_cast<LineNode *>(l);
+ l = l->nextSibling();
- QSGNode *l = trixel->firstChild();
- while(l != 0) {
- LineNode * lines = static_cast<LineNode *>(l);
- l = l->nextSibling();
+ LineList * lineList = lines->lineList();
+ if ( lineList->updateID != updateID )
+ i.value()->JITupdate( lineList );
- LineList * lineList = lines->lineList();
- if ( lineList->drawID == drawID ) {
- lines->hide();
- continue;
+ lines->updateGeometry();
}
- if ( lineList->updateID != updateID )
- i.value()->JITupdate( lineList );
-
- lineList->drawID = drawID;
- lines->updateGeometry();
- }
-
- /* } else {
- trixel->hide();
- }*/
+ //}
+ n = n->nextSibling();
}
} else {
node->hide();
}
++i;
+ //region.reset();
+ //qDebug() << count;
}
}
diff --git a/kstars/kstarslite/skyitems/lines/milkywayitem.cpp b/kstars/kstarslite/skyitems/lines/milkywayitem.cpp
index 0592228..2a9568a 100644
--- a/kstars/kstarslite/skyitems/lines/milkywayitem.cpp
+++ b/kstars/kstarslite/skyitems/lines/milkywayitem.cpp
@@ -37,24 +37,28 @@ void MilkyWayItem::initialize() {
while(QSGNode *n = firstChild()) { removeChildNode(n); delete n; }
QHash< Trixel, LineListList *>::const_iterator i = trixels->begin();
+ QList<LineList *> addedLines;
while( i != trixels->end()) {
LineListList *linesList = *i;
if(linesList->size()) {
- TrixelNode *trixel = new TrixelNode;
+ TrixelNode *trixel = new TrixelNode(i.key());
appendChildNode(trixel);
QColor schemeColor = KStarsData::Instance()->colorScheme()->colorNamed("MWColor");
for(int c = 0; c < linesList->size(); ++c) {
LineList *list = linesList->at(c);
- if(m_filled) {
- SkyPolygonNode *poly = new SkyPolygonNode(list);
- schemeColor.setAlpha(0.7*255);
- poly->setColor(schemeColor);
- trixel->appendChildNode(poly);
- } else {
- LineNode * ln = new LineNode(list, m_MWComp->skipList(list), schemeColor, 3, Qt::SolidLine);
- trixel->appendChildNode(ln);
+ if(!addedLines.contains(list)) {
+ if(m_filled) {
+ SkyPolygonNode *poly = new SkyPolygonNode(list);
+ schemeColor.setAlpha(0.7*255);
+ poly->setColor(schemeColor);
+ trixel->appendChildNode(poly);
+ } else {
+ LineNode * ln = new LineNode(list, m_MWComp->skipList(list), schemeColor, 3, Qt::SolidLine);
+ trixel->appendChildNode(ln);
+ }
+ addedLines.append(list);
}
}
}
diff --git a/kstars/kstarslite/skyitems/rootnode.cpp b/kstars/kstarslite/skyitems/rootnode.cpp
index 3fa2c04..3f5ea8d 100644
--- a/kstars/kstarslite/skyitems/rootnode.cpp
+++ b/kstars/kstarslite/skyitems/rootnode.cpp
@@ -37,9 +37,11 @@
#include "kstarslite/skyitems/lines/eclipticitem.h"
#include "kstarslite/skyitems/lines/milkywayitem.h"
+//Symbols
+#include "kstarslite/skyitems/telescopesymbolsitem.h"
+
RootNode::RootNode()
- :m_skyMapLite(SkyMapLite::Instance()),
- m_clipGeometry(0)
+ :m_skyMapLite(SkyMapLite::Instance()), m_clipGeometry(0)
{
SkyMapLite::setRootNode(this);
genCachedTextures();
@@ -62,7 +64,7 @@ RootNode::RootNode()
m_linesItem->addLinesComponent( m_skyComposite->constellationBoundary(), "CBoundColor", 1, Qt::SolidLine );
}
- //m_artItem = new ConstellationArtItem(m_skyComposite->constellationArt(), this);
+ m_artItem = new ConstellationArtItem(m_skyComposite->constellationArt(), this);
m_linesItem->addLinesComponent( m_skyComposite->constellationLines(), "CLineColor", 1, Qt::SolidLine );
@@ -85,6 +87,10 @@ RootNode::RootNode()
m_horizonItem = new HorizonItem(m_skyComposite->horizon(), this);
+#ifdef INDI_FOUND
+ m_telescopeSymbols = new TelescopeSymbolsItem(this);
+#endif
+
setIsRectangular(false);
updateClipPoly();
@@ -200,7 +206,7 @@ void RootNode::update() {
m_MWItem->update();
- // m_artItem->update();
+ m_artItem->update();
m_linesItem->update();
@@ -244,6 +250,11 @@ void RootNode::update() {
m_snovaItem->update();
m_horizonItem->update();
+
+#ifdef INDI_FOUND
+ m_telescopeSymbols->update();
+#endif
+
m_labelsItem->update();
}
diff --git a/kstars/kstarslite/skyitems/rootnode.h b/kstars/kstarslite/skyitems/rootnode.h
index 487c0f9..56e5f31 100644
--- a/kstars/kstarslite/skyitems/rootnode.h
+++ b/kstars/kstarslite/skyitems/rootnode.h
@@ -42,6 +42,9 @@ class MilkyWayItem;
class SkyMapComposite;
class SolarSystemComposite;
+#ifdef INDI_FOUND
+class TelescopeSymbolsItem;
+#endif
/** @class RootNode
*
@@ -84,6 +87,10 @@ public:
inline LabelsItem *labelsItem() { return m_labelsItem; }
inline StarItem *starItem() { return m_starItem; }
+
+#ifdef INDI_FOUND
+ inline TelescopeSymbolsItem *telescopeSymbolsItem() { return m_telescopeSymbols; }
+#endif
private:
/**
* @short initializes textureCache with cached images of stars from SkyMapLite
@@ -117,5 +124,8 @@ private:
SkyMapComposite *m_skyComposite;
SolarSystemComposite *m_solarSystem;
+#ifdef INDI_FOUND
+ TelescopeSymbolsItem *m_telescopeSymbols;
+#endif
};
#endif
diff --git a/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp b/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp
index d2c29be..f350d97 100644
--- a/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp
@@ -31,6 +31,7 @@ ConstellationArtNode::ConstellationArtNode(ConstellationsArt *obj)
:SkyNode(obj), m_art(obj), m_texture(new QSGSimpleTextureNode)
{
m_texture->setTexture(SkyMapLite::Instance()->window()->createTextureFromImage(m_art->image(), QQuickWindow::TextureCanUseAtlas));
+ m_texture->setFiltering(QSGTexture::Linear);
m_opacity->appendChildNode(m_texture);
update();
}
diff --git a/kstars/kstarslite/skyitems/skynodes/crosshairnode.cpp b/kstars/kstarslite/skyitems/skynodes/crosshairnode.cpp
new file mode 100644
index 0000000..50b33e5
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/crosshairnode.cpp
@@ -0,0 +1,142 @@
+/** *************************************************************************
+ crosshairnode.cpp - K Desktop Planetarium
+ -------------------
+ begin : 18/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "crosshairnode.h"
+#include "Options.h"
+#include "ksutils.h"
+#include "nodes/ellipsenode.h"
+#include "labelnode.h"
+#include "../labelsitem.h"
+
+#include <QSGFlatColorMaterial>
+
+CrosshairNode::CrosshairNode(INDI::BaseDevice *baseDevice, RootNode *rootNode)
+ :el1(new EllipseNode), el2(new EllipseNode), bd(baseDevice), lines(new QSGGeometryNode)
+{
+ addChildNode(el1);
+ addChildNode(el2);
+
+ QSGGeometry *linesGeo = new QSGGeometry (QSGGeometry::defaultAttributes_Point2D(),0);
+
+ lines->setGeometry(linesGeo);
+ lines->setFlag(QSGNode::OwnsGeometry);
+
+ material = new QSGFlatColorMaterial;
+
+ lines->setMaterial(material);
+ lines->setFlag(QSGNode::OwnsMaterial);
+
+ linesGeo->setDrawingMode(GL_LINES);
+ linesGeo->allocate(8);
+
+ addChildNode(lines);
+ labelsItem = rootNode->labelsItem();
+ label = labelsItem->addLabel(bd->getDeviceName(), LabelsItem::TELESCOPE_SYMBOL);
+}
+
+CrosshairNode::~CrosshairNode() {
+ labelsItem->deleteLabel(label);
+}
+
+void CrosshairNode::setColor(QColor color) {
+ if(material->color() != color) {
+ material->setColor(color);
+ lines->markDirty(QSGNode::DirtyMaterial);
+ }
+ el1->setColor(color);
+ el2->setColor(color);
+}
+
+void CrosshairNode::update() {
+ SkyPoint indi_sp;
+ KStarsData *m_KStarsData = KStarsData::Instance();
+
+ //psky.setPen( QPen( QColor( m_KStarsData->colorScheme()->colorNamed("TargetColor" ) ) ) );
+ float pxperdegree = Options::zoomFactor()/57.3;
+
+ INumberVectorProperty *coordNP = bd->getNumber("EQUATORIAL_EOD_COORD");
+
+ if (coordNP == NULL)
+ {
+ coordNP = bd->getNumber("HORIZONTAL_COORD");
+ if (coordNP == NULL)
+ hide();
+ else
+ {
+ INumber *np = IUFindNumber(coordNP, "AZ");
+ if (np == NULL)
+ hide();
+ indi_sp.setAz(np->value);
+
+ np = IUFindNumber(coordNP, "ALT");
+ if (np == NULL)
+ hide();
+ indi_sp.setAlt(np->value);
+ indi_sp.HorizontalToEquatorial( m_KStarsData->lst(), m_KStarsData->geo()->lat() );
+ }
+ }
+ else
+ {
+ INumber *np = IUFindNumber(coordNP, "RA");
+ if (np == NULL)
+ hide();
+ indi_sp.setRA(np->value);
+
+ np = IUFindNumber(coordNP, "DEC");
+ if (np == NULL)
+ hide();
+ indi_sp.setDec(np->value);
+ }
+
+ if ( Options::useAltAz() )
+ indi_sp.EquatorialToHorizontal( m_KStarsData->lst(), m_KStarsData->geo()->lat() );
+
+
+ if (std::isnan(indi_sp.ra().Degrees()) || std::isnan(indi_sp.dec().Degrees()))
+ hide();
+
+ QPointF P = SkyMapLite::Instance()->projector()->toScreen( &indi_sp );
+ float s1 = 0.5*pxperdegree;
+ float s2 = pxperdegree;
+ float s3 = 2.0*pxperdegree;
+
+ float x0 = P.x(); float y0 = P.y();
+ float x1 = x0 - 0.5*s1; float y1 = y0 - 0.5*s1;
+ //float x2 = x0 - 0.5*s2; float y2 = y0 - 0.5*s2;
+ float x3 = x0 - 0.5*s3; float y3 = y0 - 0.5*s3;
+
+ //Draw radial lines
+
+ QSGGeometry::Point2D * vertex = lines->geometry()->vertexDataAsPoint2D();
+
+ vertex[0].set(x1, y0); vertex[1].set(x3, y0);
+ vertex[2].set(x0 + s2, y0); vertex[3].set(x0+0.5*s1, y0);
+ vertex[4].set(x0, y1); vertex[5].set(x0, y3);
+ vertex[6].set(x0, y0+0.5*s1); vertex[7].set(x0, y0+s2);
+
+ lines->markDirty(QSGNode::DirtyGeometry);
+
+ //material
+ //Draw circles at 0.5 & 1 degrees*/
+ el1->updateGeometry(x0,y0,s1,s1,false);
+ el2->updateGeometry(x0,y0,s2,s2,false);
+
+ label->setLabelPos(QPointF(x0+s2+2., y0));
+}
+
+void CrosshairNode::hide() {
+ SkyNode::hide();
+ label->hide();
+}
diff --git a/kstars/kstarslite/skyitems/skynodes/crosshairnode.h b/kstars/kstarslite/skyitems/skynodes/crosshairnode.h
new file mode 100644
index 0000000..3cb3fe4
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/crosshairnode.h
@@ -0,0 +1,54 @@
+/** *************************************************************************
+ crosshairnode.h - K Desktop Planetarium
+ -------------------
+ begin : 18/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef CROSSHAIRNODE_H_
+#define CROSSHAIRNODE_H_
+#include "skynode.h"
+
+/** @class CrossHairNode
+ *
+ *@version 1.0
+ */
+
+class EllipseNode;
+class LineNode;
+class LabelNode;
+class QSGFlatColorMaterial;
+
+class CrosshairNode : public SkyNode {
+public:
+ CrosshairNode(INDI::BaseDevice *baseDevice, RootNode *rootNode);
+ ~CrosshairNode();
+ virtual void update() override;
+ void setColor(QColor color);
+ virtual void hide() override;
+private:
+ EllipseNode *el1;
+ EllipseNode *el2;
+
+ QSGGeometryNode *lines;
+ QSGFlatColorMaterial *material;
+
+ LabelNode *label;
+
+ LabelsItem *labelsItem;
+
+ INDI::BaseDevice *bd;
+};
+
+
+#endif
+
+
diff --git a/kstars/kstarslite/skyitems/skynodes/deepskynode.cpp b/kstars/kstarslite/skyitems/skynodes/deepskynode.cpp
index 03743a0..39c1182 100644
--- a/kstars/kstarslite/skyitems/skynodes/deepskynode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/deepskynode.cpp
@@ -32,7 +32,7 @@ DeepSkyNode::DeepSkyNode(DeepSkyObject * skyObject, DSOSymbolNode *symbol, Trixe
:m_dso(skyObject),m_objImg(0), m_symbol(symbol), m_trixel(trixel), m_labelType(labelType),
m_label(0)
{
-
+ m_symbol->hide();
}
void DeepSkyNode::destroy() {
@@ -108,7 +108,6 @@ void DeepSkyNode::update(bool drawImage, bool drawLabel, QPointF pos) {
//Draw symbol
m_symbol->update(size, pos, m_angle);
- m_symbol->show();
// Draw label
if(drawLabel) {
diff --git a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp
index c8fb429..f7d7176 100644
--- a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp
@@ -404,11 +404,13 @@ void DSOSymbolNode::changePos(float size, const QPointF &pos, float positionangl
}
void DSOSymbolNode::update(float size, const QPointF &pos, float positionangle) {
- show();
initSymbol();
if(m_symbol) {
m_symbol->updateSymbol(pos.x(), pos.y(), m_dso->e(), size);
+ show();
+ changePos(size, pos, positionangle);
+ } else {
+ hide();
}
- changePos(size, pos, positionangle);
}
diff --git a/kstars/kstarslite/skyitems/skynodes/labelnode.cpp b/kstars/kstarslite/skyitems/skynodes/labelnode.cpp
index d65e497..d397248 100644
--- a/kstars/kstarslite/skyitems/skynodes/labelnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/labelnode.cpp
@@ -54,6 +54,7 @@ void LabelNode::initialize() {
case LabelsItem::label_t::DSO_NGC_LABEL:
case LabelsItem::label_t::DSO_IC_LABEL:
case LabelsItem::label_t::DSO_OTHER_LABEL:
+ case LabelsItem::label_t::TELESCOPE_SYMBOL:
m_zoomFont = true;
break;
default:
@@ -66,6 +67,7 @@ void LabelNode::initialize() {
void LabelNode::createTexture() {
QColor color;
+ KStarsData *m_KStarsData = KStarsData::Instance();
switch(m_labelType) {
case LabelsItem::label_t::SATURN_MOON_LABEL:
@@ -77,29 +79,32 @@ void LabelNode::createTexture() {
}
switch(m_labelType) {
+ case LabelsItem::label_t::TELESCOPE_SYMBOL:
+ color = m_KStarsData->colorScheme()->colorNamed("TargetColor" );
+ break;
case LabelsItem::label_t::PLANET_LABEL:
case LabelsItem::label_t::SATURN_MOON_LABEL:
case LabelsItem::label_t::JUPITER_MOON_LABEL:
case LabelsItem::label_t::COMET_LABEL:
case LabelsItem::label_t::RUDE_LABEL:
case LabelsItem::label_t::ASTEROID_LABEL:
- color = KStarsData::Instance()->colorScheme()->colorNamed( "PNameColor" );
+ color = m_KStarsData->colorScheme()->colorNamed( "PNameColor" );
break;
case LabelsItem::label_t::CONSTEL_NAME_LABEL:
- color = KStarsData::Instance()->colorScheme()->colorNamed( "CNameColor" );
+ color = m_KStarsData->colorScheme()->colorNamed( "CNameColor" );
break;
case LabelsItem::label_t::DEEP_SKY_LABEL:
case LabelsItem::label_t::DSO_MESSIER_LABEL:
case LabelsItem::label_t::DSO_NGC_LABEL:
case LabelsItem::label_t::DSO_IC_LABEL:
case LabelsItem::label_t::DSO_OTHER_LABEL:
- color = KStarsData::Instance()->colorScheme()->colorNamed( "DSNameColor" );
+ color = m_KStarsData->colorScheme()->colorNamed( "DSNameColor" );
break;
case LabelsItem::label_t::STAR_LABEL:
- color = KStarsData::Instance()->colorScheme()->colorNamed( "SNameColor" );
+ color = m_KStarsData->colorScheme()->colorNamed( "SNameColor" );
break;
default:
- color = KStarsData::Instance()->colorScheme()->colorNamed( "UserLabelColor" );
+ color = m_KStarsData->colorScheme()->colorNamed( "UserLabelColor" );
}
QSGTexture *oldTexture = m_textTexture->texture();
@@ -140,7 +145,7 @@ void LabelNode::setLabelPos(QPointF pos) {
//We need to subtract the height of texture from final y to follow the way QPainter draws the text
if(m_skyObject) labelPos = QPointF(pos.x() + m_skyObject->labelOffset(), pos.y() + m_skyObject->labelOffset() - m_textSize.height());
- else labelPos = QPointF(pos.x()-(m_textSize.width()/2.0), pos.y());
+ else labelPos = QPointF(pos.x(), pos.y());
}
void LabelNode::update() {
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/ellipsenode.h b/kstars/kstarslite/skyitems/skynodes/nodes/ellipsenode.h
index 112f741..3e68700 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/ellipsenode.h
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/ellipsenode.h
@@ -17,6 +17,7 @@
#define ELLIPSENODE_H_
//#include "../../skyopacitynode.h"
#include <QSGNode>
+#include <QColor>
/** @class PolyNode
*
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
index 3b7dce7..9c55190 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
@@ -77,31 +77,69 @@ void LineNode::updateGeometry() {
QPointF oLast = m_proj->toScreen( points->first(), true, &isVisibleLast );
// & with the result of checkVisibility to clip away things below horizon
isVisibleLast &= m_proj->checkVisibility( points->first() );
- QPointF oThis, oThis2;
+ QPointF oThis;
QLinkedList<QPointF> newPoints;
for ( int j = 1 ; j < points->size() ; j++ ) {
SkyPoint* pThis = points->at( j );
+ /*In regular KStars we first call checkVisibility and then toScreen
+ Here we minimize the number of calls to toScreen by proceeding only if
+ checkVisibility is true*/
+ //bool vis = false;
+ //if( vis ) {
+ oThis = m_proj->toScreen( pThis, true, &isVisible );
+ // & with the result of checkVisibility to clip away things below horizon
+ isVisible &= m_proj->checkVisibility(pThis);
+ bool doSkip = false;
+ if( m_skipList ) {
+ doSkip = m_skipList->skip(j);
+ }
+
+ if ( !doSkip ) {
+ //if ( (isVisible && isVisibleLast) ) {
+ if ( (isVisible ) ) {
+ newPoints.append(oLast);
+ newPoints.append(oThis);
+ //if ( label )
+ // label->updateLabelCandidates( oThis.x(), oThis.y(), list, j );
+ }
+ }
+ oLast = oThis;
+ isVisibleLast = isVisible;
+// }
+ }
+
+
+ /*SkyList *points = list->points();
+ bool isVisible, isVisibleLast;
+
+ QPointF oLast = m_proj->toScreen( points->first(), true, &isVisibleLast );
+ // & with the result of checkVisibility to clip away things below horizon
+ isVisibleLast &= m_proj->checkVisibility( points->first() );
+ QPointF oThis, oThis2;
+
+ for ( int j = 1 ; j < points->size() ; j++ ) {
+ SkyPoint* pThis = points->at( j );
oThis2 = oThis = m_proj->toScreen( pThis, true, &isVisible );
// & with the result of checkVisibility to clip away things below horizon
isVisible &= m_proj->checkVisibility(pThis);
bool doSkip = false;
- if( m_skipList ) {
- doSkip = m_skipList->skip(j);
+ if( skipList ) {
+ doSkip = skipList->skip(j);
}
if ( !doSkip ) {
- if ( (isVisible) ) {
- newPoints.append(oLast);
- newPoints.append(oThis);
- //if ( label )
- // label->updateLabelCandidates( oThis.x(), oThis.y(), list, j );
+ if ( isVisible && isVisibleLast ) {
+ drawLine( oLast, oThis );
+ if ( label )
+ label->updateLabelCandidates( oThis.x(), oThis.y(), list, j );
}
}
+
oLast = oThis2;
isVisibleLast = isVisible;
- }
+ }*/
int size = newPoints.size();
m_geometry->allocate(size);
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
index b2f73aa..b5dbedf 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
@@ -67,6 +67,8 @@ private:
Qt::PenStyle m_drawStyle;
QColor m_color;
+
+ QSGTransformNode *debug;
};
#endif
diff --git a/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp b/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
index 98ead52..26e63e3 100644
--- a/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
@@ -16,6 +16,12 @@
#include "skymaplite.h"
#include "trixelnode.h"
+#include <QSGSimpleTextureNode>
+
+TrixelNode::TrixelNode(Trixel trixel)
+ :m_trixel(trixel)
+{
+}
void TrixelNode::hide() {
m_hideCount++;
diff --git a/kstars/kstarslite/skyitems/skynodes/trixelnode.h b/kstars/kstarslite/skyitems/skynodes/trixelnode.h
index 21a684e..95ec593 100644
--- a/kstars/kstarslite/skyitems/skynodes/trixelnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/trixelnode.h
@@ -24,16 +24,20 @@ class SkyNode;
class TrixelNode : public SkyOpacityNode {
public:
- Trixel m_trixel;
-
- QLinkedList<QPair<SkyObject *, SkyNode *>> m_nodes;
+ TrixelNode(Trixel trixel);
inline int hideCount() { return m_hideCount; }
inline void resetHideCount() { m_hideCount = 0; }
void virtual hide() override;
void virtual show() override;
+
+ inline Trixel trixelID() { return m_trixel; }
+
+ QLinkedList<QPair<SkyObject *, SkyNode *>> m_nodes;
+
private:
+ Trixel m_trixel;
int m_hideCount;
};
diff --git a/kstars/kstarslite/skyitems/staritem.cpp b/kstars/kstarslite/skyitems/staritem.cpp
index 3be7de6..7c72585 100644
--- a/kstars/kstarslite/skyitems/staritem.cpp
+++ b/kstars/kstarslite/skyitems/staritem.cpp
@@ -43,7 +43,7 @@ StarItem::StarItem(StarComponent *starComp, RootNode *rootNode)
for(int i = 0; i < trixels->size(); ++i) {
StarList *skyList = trixels->at(i);
- TrixelNode *trixel = new TrixelNode;
+ TrixelNode *trixel = new TrixelNode(i);
m_stars->appendChildNode(trixel);
for(int c = 0; c < skyList->size(); ++c) {
@@ -207,8 +207,11 @@ void StarItem::update() {
trixel->show();
label->show();
+
+
if(region.hasNext()) {
regionID = region.next();
+ //count++;
}
QLinkedList<QPair<SkyObject *, SkyNode *>> *nodes = &trixel->m_nodes;
@@ -283,17 +286,11 @@ void StarItem::update() {
deepStars->update();
}
- /*int count = 0;
QSGNode *n = m_stars->firstChild();
while(n != 0) {
- count += n->childCount();
n = n->nextSibling();
}
-
- qDebug() << delLim << "delLim";
- qDebug() << count << "Nodes";*/
-
m_skyMesh->inDraw( false );
}
diff --git a/kstars/kstarslite/skyitems/telescopesymbolsitem.cpp b/kstars/kstarslite/skyitems/telescopesymbolsitem.cpp
new file mode 100644
index 0000000..812f42e
--- /dev/null
+++ b/kstars/kstarslite/skyitems/telescopesymbolsitem.cpp
@@ -0,0 +1,83 @@
+/** *************************************************************************
+ telescopesymbolsitem.cpp - K Desktop Planetarium
+ -------------------
+ begin : 17/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "skynodes/crosshairnode.h"
+
+#include "indi/clientmanagerlite.h"
+
+#include "telescopesymbolsitem.h"
+
+#include "Options.h"
+#include "projections/projector.h"
+
+#include "kstarslite/skyitems/rootnode.h"
+
+#include "labelsitem.h"
+
+TelescopeSymbolsItem::TelescopeSymbolsItem(RootNode *rootNode)
+ :SkyItem(LabelsItem::label_t::TELESCOPE_SYMBOL, rootNode)
+{
+ m_clientManager = KStarsLite::Instance()->clientManagerLite();
+ m_KStarsData = KStarsData::Instance();
+}
+
+void TelescopeSymbolsItem::addTelescope(INDI::BaseDevice *bd) {
+ CrosshairNode *crossHair = new CrosshairNode(bd, rootNode());
+ appendChildNode(crossHair);
+ m_telescopes.insert(bd, crossHair);
+}
+
+void TelescopeSymbolsItem::removeTelescope(QString deviceName) {
+ QHash<INDI::BaseDevice *, CrosshairNode *>::iterator i = m_telescopes.begin();
+ while(i != m_telescopes.end()) {
+ if(i.key()->getDeviceName() == deviceName) {
+ delete i.value();
+ m_telescopes.remove(i.key());
+ }
+ i++;
+ }
+}
+
+void TelescopeSymbolsItem::update() {
+ QHash<INDI::BaseDevice *, CrosshairNode *>::iterator i;
+ bool deleteAll = !m_clientManager->isConnected();
+
+ QColor color = m_KStarsData->colorScheme()->colorNamed("TargetColor" );
+
+ bool show = Options::showTargetCrosshair();
+ if(!show) {
+ hide();
+ }
+
+ for (i = m_telescopes.begin(); i != m_telescopes.end(); ++i) {
+ CrosshairNode *crossHair = i.value();
+ if(deleteAll) {
+ removeChildNode(crossHair);
+ delete crossHair;
+ } else if(show) {
+ if(i.key()->isConnected()){
+ crossHair->setColor(color);
+ crossHair->update();
+ } else {
+ crossHair->hide();
+ }
+ }
+ }
+ if(deleteAll) {
+ m_telescopes.clear();
+ }
+
+}
diff --git a/kstars/kstarslite/skyitems/telescopesymbolsitem.h b/kstars/kstarslite/skyitems/telescopesymbolsitem.h
new file mode 100644
index 0000000..1726b69
--- /dev/null
+++ b/kstars/kstarslite/skyitems/telescopesymbolsitem.h
@@ -0,0 +1,57 @@
+/** *************************************************************************
+ telescopesymbolsitem.h - K Desktop Planetarium
+ -------------------
+ begin : 17/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef TELESCOPESYMBOLSITEM_H_
+#define TELESCOPESYMBOLSITEM_H_
+
+#include "skyitem.h"
+#include "basedevice.h"
+
+class KSAsteroid;
+class SkyObject;
+class RootNode;
+class EllipseNode;
+class LineNode;
+class CrosshairNode;
+class ClientManagerLite;
+
+ /**
+ * @class TelescopeSymbolsItem
+ * This class handles telescope symbols in SkyMapLite
+ *
+ * @author Artem Fedoskin
+ * @version 1.0
+ */
+
+class TelescopeSymbolsItem : public SkyItem {
+public:
+ /**
+ * @short Constructor
+ * @param asteroidsList const reference to list of asteroids
+ * @param rootNode parent RootNode that instantiates PlanetsItem
+ */
+ TelescopeSymbolsItem(RootNode *rootNode);
+
+ virtual void update() override;
+ void addTelescope(INDI::BaseDevice *bd);
+ void removeTelescope(QString deviceName);
+
+private:
+ QHash<INDI::BaseDevice *, CrosshairNode *> m_telescopes;
+ ClientManagerLite *m_clientManager;
+ QColor m_color;
+ KStarsData *m_KStarsData;
+};
+#endif
diff --git a/kstars/kstarslite/skyobjectlite.cpp b/kstars/kstarslite/skyobjectlite.cpp
new file mode 100644
index 0000000..bac3115
--- /dev/null
+++ b/kstars/kstarslite/skyobjectlite.cpp
@@ -0,0 +1,37 @@
+/** *************************************************************************
+ skyobjectlite.cpp - K Desktop Planetarium
+ -------------------
+ begin : 20/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "skyobjectlite.h"
+
+SkyObjectLite::SkyObjectLite()
+ :SkyPointLite(), object(NULL)
+{
+
+}
+
+void SkyObjectLite::setObject(SkyObject *obj) {
+ object = obj;
+ setPoint(obj);
+}
+
+QString SkyObjectLite::getTranslatedName() {
+ if(object) {
+ return object->translatedName();
+ } else {
+ return "";
+ }
+}
+
+
diff --git a/kstars/kstarslite/skyobjectlite.h b/kstars/kstarslite/skyobjectlite.h
new file mode 100644
index 0000000..74f7eec
--- /dev/null
+++ b/kstars/kstarslite/skyobjectlite.h
@@ -0,0 +1,42 @@
+/** *************************************************************************
+ skyobjectlite.h - K Desktop Planetarium
+ -------------------
+ begin : 20/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef SKYOBJECTLITE_H_
+#define SKYOBJECTLITE_H_
+
+#include "skyobject.h"
+#include "skypointlite.h"
+#include <QObject>
+
+ /**
+ * @class SkyPointLite
+ * Wrapper for SkyPoint to allow access of some of its properties from QML
+ *
+ * @author Artem Fedoskin
+ * @version 1.0
+ */
+class SkyObjectLite : public SkyPointLite {
+ Q_OBJECT
+ Q_PROPERTY(QString translatedName READ getTranslatedName)
+public:
+ SkyObjectLite();
+ void setObject(SkyObject *object);
+ Q_INVOKABLE QString getTranslatedName();
+private:
+ SkyObject *object;
+};
+#endif
+
+
diff --git a/kstars/kstarslite/skypointlite.cpp b/kstars/kstarslite/skypointlite.cpp
new file mode 100644
index 0000000..9e1bbb9
--- /dev/null
+++ b/kstars/kstarslite/skypointlite.cpp
@@ -0,0 +1,27 @@
+/** *************************************************************************
+ skypointlite.cpp - K Desktop Planetarium
+ -------------------
+ begin : 20/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "skypointlite.h"
+#include "skyobject.h"
+
+SkyPointLite::SkyPointLite()
+ :point(NULL)
+{
+
+}
+
+void SkyPointLite::setPoint(SkyPoint *p) {
+ point = p;
+}
diff --git a/kstars/kstarslite/skypointlite.h b/kstars/kstarslite/skypointlite.h
new file mode 100644
index 0000000..e5df1ae
--- /dev/null
+++ b/kstars/kstarslite/skypointlite.h
@@ -0,0 +1,47 @@
+/** *************************************************************************
+ skypointlite.h - K Desktop Planetarium
+ -------------------
+ begin : 20/07/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef SKYPOINTLITE_H_
+#define SKYPOINTLITE_H_
+
+#include "skypoint.h"
+#include <QObject>
+
+class SkyObject;
+
+ /**
+ * @class SkyPointLite
+ * Wrapper for SkyPoint to allow access of some of its properties from QML
+ *
+ * @author Artem Fedoskin
+ * @version 1.0
+ */
+
+class SkyPointLite : public QObject {
+ Q_OBJECT
+public:
+ SkyPointLite();
+
+ void setPoint(SkyPoint *point);
+ /**
+ * @return SkyPoint that is being wrapped
+ */
+ Q_INVOKABLE SkyPoint *getPoint() { return point; }
+
+private:
+ SkyPoint *point;
+};
+#endif
+
diff --git a/kstars/main.cpp b/kstars/main.cpp
index f7525b7..8b6f0af 100644
--- a/kstars/main.cpp
+++ b/kstars/main.cpp
@@ -31,11 +31,14 @@
#include <KAboutData>
#include <KCrash>
#include <KLocalizedString>
-#include "kspaths.h"
#include "kstars.h"
#include "skymap.h"
#endif
+//DELETE!
+#include "projections/projector.h"
+
+#include "kspaths.h"
#include "kstarsdata.h"
#include "kstarsdatetime.h"
@@ -53,12 +56,12 @@ static const char notice[] =
int main(int argc, char *argv[])
{
- QApplication app(argc, argv);
+ QGuiApplication app(argc, argv);
app.setApplicationVersion(KSTARS_VERSION);
/**
* enable high dpi support
*/
- app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
+ // app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QByteArray data = "1";
//qputenv("QSG_RENDER_TIMING", data);
@@ -258,7 +261,7 @@ int main(int argc, char *argv[])
Options::setShowSupernovae(true);
Options::setShowMilkyWay(true);
- Options::setShowConstellationArt(true);
+ Options::setShowConstellationArt(false);
//Labels
Options::setShowCometNames(true);
@@ -272,15 +275,18 @@ int main(int argc, char *argv[])
Options::setAutoSelectGrid(false);
+ Options::setProjection(Projector::Lambert);
+
Options::setHideCBounds(true);
Options::setHideCLines(false);
Options::setHideOnSlew(true);
Options::setHideGrids(false);
+
// Create writable data dir if it does not exist
QDir writableDir;
-#ifndef KSTARS_LITE
writableDir.mkdir(KSPaths::writableLocation(QStandardPaths::GenericDataLocation));
+#ifndef KSTARS_LITE
KStars::createInstance( true, ! parser.isSet( "paused" ), datestring );
diff --git a/kstars/skycomponents/constellationartcomponent.cpp b/kstars/skycomponents/constellationartcomponent.cpp
index 5b27901..ba0737d 100644
--- a/kstars/skycomponents/constellationartcomponent.cpp
+++ b/kstars/skycomponents/constellationartcomponent.cpp
@@ -40,7 +40,15 @@ ConstellationArtComponent::~ConstellationArtComponent()
}
}
+void ConstellationArtComponent::deleteData()
+{ while( !m_ConstList.isEmpty() ) {
+ ConstellationsArt *o = m_ConstList.takeFirst();
+ delete o;
+ }
+}
+
void ConstellationArtComponent::loadData(){
+ if(m_ConstList.isEmpty()) {
QSqlDatabase skydb = QSqlDatabase::addDatabase("QSQLITE", "skycultures");
QString dbfile = KSPaths::locate(QStandardPaths::GenericDataLocation, "skycultures.sqlite");
@@ -56,7 +64,7 @@ void ConstellationArtComponent::loadData(){
{
if (!get_query.exec("SELECT * FROM western"))
{
- qDebug() << get_query.lastError();
+ qDebug() << get_query.lastError();
return;
}
}
@@ -64,32 +72,33 @@ void ConstellationArtComponent::loadData(){
{
if (!get_query.exec("SELECT * FROM inuit"))
{
- qDebug() << get_query.lastError();
+ qDebug() << get_query.lastError();
return;
}
}
- while (get_query.next())
- {
- QString abbreviation = get_query.value("Abbreviation").toString();
- QString filename = get_query.value("Filename").toString();
- QString midpointRA = get_query.value("MidpointRA").toString();
- QString midpointDEC = get_query.value("MidpointDEC").toString();
- double pa = get_query.value("Position Angle").toDouble();
- double w = get_query.value("Width").toDouble();
- double h = get_query.value("Height").toDouble();
+ while (get_query.next())
+ {
+ QString abbreviation = get_query.value("Abbreviation").toString();
+ QString filename = get_query.value("Filename").toString();
+ QString midpointRA = get_query.value("MidpointRA").toString();
+ QString midpointDEC = get_query.value("MidpointDEC").toString();
+ double pa = get_query.value("Position Angle").toDouble();
+ double w = get_query.value("Width").toDouble();
+ double h = get_query.value("Height").toDouble();
- dms midpointra = dms::fromString(midpointRA,false);
- dms midpointdec = dms::fromString(midpointDEC,true);
+ dms midpointra = dms::fromString(midpointRA,false);
+ dms midpointdec = dms::fromString(midpointDEC,true);
- // appends constellation info
- ConstellationsArt *ca = new ConstellationsArt(midpointra, midpointdec, pa, w,h, abbreviation, filename);
- m_ConstList.append(ca);
- //qDebug()<<"Successsfully read skyculture.sqlite"<<abbreviation<<filename<<midpointRA<<midpointDEC<<pa<<w<<h;
- records++;
- }
- //qDebug()<<"Successfully processed"<<records<<"records for"<<cultureName<<"sky culture";
+ // appends constellation info
+ ConstellationsArt *ca = new ConstellationsArt(midpointra, midpointdec, pa, w,h, abbreviation, filename);
+ m_ConstList.append(ca);
+ //qDebug()<<"Successsfully read skyculture.sqlite"<<abbreviation<<filename<<midpointRA<<midpointDEC<<pa<<w<<h;
+ records++;
+ }
+ //qDebug()<<"Successfully processed"<<records<<"records for"<<cultureName<<"sky culture";
skydb.close();
+ }
}
void ConstellationArtComponent::showList()
@@ -103,13 +112,13 @@ void ConstellationArtComponent::showList()
}
void ConstellationArtComponent::draw(SkyPainter *skyp){
- #ifndef KSTARS_LITE
+#ifndef KSTARS_LITE
if(Options::showConstellationArt() && SkyMap::IsSlewing() == false)
{
- for(int i =0; i<records; i++)
- skyp->drawConstellationArtImage(m_ConstList[i]);
+ for(int i =0; i<records; i++)
+ skyp->drawConstellationArtImage(m_ConstList[i]);
}
//Loops through the QList containing all data required to draw constellations.
- #endif
+#endif
}
diff --git a/kstars/skycomponents/constellationartcomponent.h b/kstars/skycomponents/constellationartcomponent.h
index 6e1e5c9..ce6ba07 100644
--- a/kstars/skycomponents/constellationartcomponent.h
+++ b/kstars/skycomponents/constellationartcomponent.h
@@ -54,6 +54,12 @@ public:
void loadData();
/**
+ * @short deletes all created ConstellationsArt objects.
+ * Used in KStars Lite to reduce memory consumption if Constellation Art is switched off
+ */
+ void deleteData();
+
+ /**
* @short Shows the details of the constellations
* selected skyculture
*/
diff --git a/kstars/skycomponents/deepstarcomponent.cpp b/kstars/skycomponents/deepstarcomponent.cpp
index f28aef5..d1f432d 100644
--- a/kstars/skycomponents/deepstarcomponent.cpp
+++ b/kstars/skycomponents/deepstarcomponent.cpp
@@ -384,6 +384,9 @@ SkyObject* DeepStarComponent::objectNearest( SkyPoint *p, double &maxrad )
{
StarObject *oBest = 0;
+#ifdef KSTARS_LITE
+ m_zoomMagLimit = StarComponent::zoomMagnitudeLimit();
+#endif
if( !fileOpened )
return NULL;
diff --git a/kstars/skycomponents/horizontalcoordinategrid.cpp b/kstars/skycomponents/horizontalcoordinategrid.cpp
index 127bcd8..14948ce 100644
--- a/kstars/skycomponents/horizontalcoordinategrid.cpp
+++ b/kstars/skycomponents/horizontalcoordinategrid.cpp
@@ -39,7 +39,7 @@ HorizontalCoordinateGrid::HorizontalCoordinateGrid( SkyComposite *parent )
: CoordinateGrid( parent, i18n("Horizontal Coordinate Grid" ) )
{
//KStarsData *data = KStarsData::Instance();
-
+
intro();
double eps = 0.1;
@@ -55,8 +55,7 @@ HorizontalCoordinateGrid::HorizontalCoordinateGrid( SkyComposite *parent )
double max, alt, alt2, az, az2;
LineList* lineList;
-
-
+
for ( az = minAz; az < maxAz; az += dAz ) {
for ( alt = -90.0; alt < maxAlt - eps; alt += dAlt ) {
lineList = new LineList();
@@ -77,7 +76,7 @@ HorizontalCoordinateGrid::HorizontalCoordinateGrid( SkyComposite *parent )
// Do not paint the line on the horizon
if ( alt < 0.1 && alt > -0.1 )
continue;
-
+
// Adjust point density
int nPoints = int(round( fabs(cos(alt* dms::PI / 180.0)) * dAz / dAz2 ));
if ( nPoints < 5 )
diff --git a/kstars/skycomponents/linelistindex.h b/kstars/skycomponents/linelistindex.h
index 7f16fcd..bc721bf 100644
--- a/kstars/skycomponents/linelistindex.h
+++ b/kstars/skycomponents/linelistindex.h
@@ -38,6 +38,7 @@ class SkipList;
*/
class LineListIndex : public SkyComponent
{
+ friend class LinesItem; //Needs access to reindexLines
public:
/** @short Constructor
* Simply set the internal skyMesh, parent, and name.
diff --git a/kstars/skycomponents/skymapcomposite.cpp b/kstars/skycomponents/skymapcomposite.cpp
index 5333ad0..92d46f4 100644
--- a/kstars/skycomponents/skymapcomposite.cpp
+++ b/kstars/skycomponents/skymapcomposite.cpp
@@ -635,10 +635,10 @@ bool SkyMapComposite::isLocalCNames() {
void SkyMapComposite::emitProgressText( const QString &message ) {
emit progressText( message );
-//#ifdef ANDROID
+#ifndef Q_OS_ANDROID
//Can cause crashes on Android, investigate it
qApp->processEvents(); // -jbb: this seemed to make it work.
-//#endif
+#endif
//qDebug() << QString("PROGRESS TEXT: %1\n").arg( message );
}
diff --git a/kstars/skycomponents/starcomponent.cpp b/kstars/skycomponents/starcomponent.cpp
index 1bb4e6f..a8d0247 100644
--- a/kstars/skycomponents/starcomponent.cpp
+++ b/kstars/skycomponents/starcomponent.cpp
@@ -592,6 +592,8 @@ StarObject *StarComponent::findByHDIndex( int HDnum ) {
//
SkyObject* StarComponent::objectNearest( SkyPoint *p, double &maxrad )
{
+ m_zoomMagLimit = zoomMagnitudeLimit();
+
SkyObject *oBest = 0;
MeshIterator region( m_skyMesh, OBJ_NEAREST_BUF );
diff --git a/kstars/skymaplite.cpp b/kstars/skymaplite.cpp
index 2d52f34..fbb3c22 100644
--- a/kstars/skymaplite.cpp
+++ b/kstars/skymaplite.cpp
@@ -18,6 +18,12 @@
#include "kstarsdata.h"
#include "kstarslite.h"
+#ifdef INDI_FOUND
+#include "indi/inditelescopelite.h"
+#include "indi/clientmanagerlite.h"
+#include "kstarslite/skyitems/telescopesymbolsitem.h"
+#endif
+
#include "projections/projector.h"
#include "projections/lambertprojector.h"
#include "projections/gnomonicprojector.h"
@@ -26,6 +32,9 @@
#include "projections/azimuthalequidistantprojector.h"
#include "projections/equirectangularprojector.h"
+#include "kstarslite/skypointlite.h"
+#include "kstarslite/skyobjectlite.h"
+
#include "skylabeler.h"
#include "Options.h"
#include "skymesh.h"
@@ -42,6 +51,7 @@
#include <QSGTexture>
#include <QQuickWindow>
#include <QLinkedList>
+#include <QQmlContext>
namespace {
@@ -107,6 +117,12 @@ SkyMapLite::SkyMapLite(QQuickItem* parent)
ClickedObject = NULL;
FocusObject = NULL;
+ ClickedObjectLite = new SkyObjectLite;
+ ClickedPointLite = new SkyPointLite;
+
+ KStarsLite::Instance()->qmlEngine()->rootContext()->setContextProperty("ClickedObject",ClickedObjectLite);
+ KStarsLite::Instance()->qmlEngine()->rootContext()->setContextProperty("ClickedPoint",ClickedPointLite);
+
m_timer.setInterval(1000);
m_timer.start();
@@ -115,10 +131,10 @@ SkyMapLite::SkyMapLite(QQuickItem* parent)
setupProjector();
// Whenever the wrapper's(parent) dimensions changed, change SkyMapLite too
- connect(parent, &QQuickItem::widthChanged, this, &SkyMapLite::resizeItem);
- connect(parent, &QQuickItem::heightChanged, this, &SkyMapLite::resizeItem);
+ //connect(parent, &QQuickItem::widthChanged, this, &SkyMapLite::resizeItem);
+ //connect(parent, &QQuickItem::heightChanged, this, &SkyMapLite::resizeItem);
- resizeItem(); /* Set initial size. Without it on Android SkyMapLite is not displayed until screen
+ /*resizeItem(); /* Set initial size. Without it on Android SkyMapLite is not displayed until screen
orientation is not changed */
//Initialize images for stars
@@ -126,12 +142,27 @@ SkyMapLite::SkyMapLite(QQuickItem* parent)
// Set pinstance to yourself
pinstance = this;
+#ifdef INDI_FOUND
+ ClientManagerLite *clientMng = KStarsLite::Instance()->clientManagerLite();
+
+ connect(clientMng, &ClientManagerLite::telescopeAdded, [this](TelescopeLite *newTelescope){ this->m_newTelescopes.append(newTelescope); });
+ connect(clientMng, &ClientManagerLite::removeINDIDevice, [this](QString deviceName){ this->m_delTelescopes.append(deviceName); });
+#endif
+
}
void SkyMapLite::setUpdateCounter() {
m_updatesCount = m_updatesCountTemp; m_updatesCountTemp = 0;
}
+void SkyMapLite::addTelescope(TelescopeLite *) {
+
+}
+
+void SkyMapLite::removeDevice(QString device) {
+
+}
+
QSGNode* SkyMapLite::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) {
Q_UNUSED(updatePaintNodeData);
RootNode *n = static_cast<RootNode*>(oldNode);
@@ -144,7 +175,19 @@ QSGNode* SkyMapLite::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *upda
n = new RootNode();
m_rootNode = n;
}
- m_updatesCountTemp++;
+ if(m_newTelescopes.count() > 0) {
+ foreach(TelescopeLite *telescope, m_newTelescopes) {
+ n->telescopeSymbolsItem()->addTelescope(telescope->getDevice());
+ }
+ m_newTelescopes.clear();
+ }
+
+ if(m_delTelescopes.count() > 0) {
+ foreach(QString deviceName, m_delTelescopes) {
+ n->telescopeSymbolsItem()->removeTelescope(deviceName);
+ }
+ m_delTelescopes.clear();
+ }
n->update();
}
@@ -238,10 +281,12 @@ void SkyMapLite::setDestinationAltAz( const dms &alt, const dms &az) {
void SkyMapLite::setClickedPoint( SkyPoint *f ) {
ClickedPoint = *f;
+ ClickedPointLite->setPoint(f);
}
void SkyMapLite::setClickedObject( SkyObject *o ) {
ClickedObject = o;
+ ClickedObjectLite->setObject(o);
}
void SkyMapLite::setFocusObject( SkyObject *o ) {
@@ -397,8 +442,10 @@ void SkyMapLite::slotClockSlewing() {
}*/
void SkyMapLite::resizeItem() {
- setWidth(parentItem()->width());
- setHeight(parentItem()->height());
+ if(parentItem()) {
+ setWidth(parentItem()->width());
+ setHeight(parentItem()->height());
+ }
forceUpdate();
}
diff --git a/kstars/skymaplite.h b/kstars/skymaplite.h
index 21c5ce8..34939f2 100644
--- a/kstars/skymaplite.h
+++ b/kstars/skymaplite.h
@@ -30,6 +30,10 @@
#include "kstarsdata.h"
#include "kstarslite/skyitems/rootnode.h"
+#ifdef INDI_FOUND
+#include "basedevice.h"
+#endif
+
class dms;
class KStarsData;
class SkyObject;
@@ -43,6 +47,10 @@ class HorizonItem;
class LinesItem;
class SkyNode;
class RootNode;
+class TelescopeLite;
+
+class SkyObjectLite;
+class SkyPointLite;
class QSGTexture;
@@ -433,17 +441,16 @@ signals:
void zoomChanged();
/** Emitted when current object changed. */
- void objectChanged(SkyObject*);
+ void objectChanged(SkyObjectLite *obj);
/** Emitted when pointing changed. (At least should) */
- void positionChanged(SkyPoint*);
+ void positionChanged(SkyPointLite *point);
/** Emitted when position under mouse changed. */
void mousePointChanged(SkyPoint*);
/** Emitted when a position is clicked */
void positionClicked(SkyPoint*);
-
protected:
/** Process keystrokes:
* @li arrow keys Slew the map
@@ -513,6 +520,12 @@ private slots:
/** resets updates counter **/
void setUpdateCounter();
+ /** adds telescope to TelescopeSymbolsItem **/
+ void addTelescope(TelescopeLite *);
+
+ /** deletes all device-related SkyItems or SkyNodes **/
+ void removeDevice(QString device);
+
private:
/** @short Sets the shape of the default mouse cursor to a cross. */
@@ -592,6 +605,9 @@ private:
SkyPoint Focus, ClickedPoint, FocusPoint, Destination;
SkyObject *ClickedObject, *FocusObject;
+ SkyPointLite *ClickedPointLite;
+ SkyObjectLite *ClickedObjectLite;
+
//SkyLine AngularRuler; //The line for measuring angles in the map
QRect ZoomRect; //The manual-focus circle.
@@ -638,6 +654,11 @@ private:
QVector<QVector<QPixmap*>> imageCache;
//Textures created from cached star images
QVector<QVector<QSGTexture*>> textureCache;
+
+#ifdef INDI_FOUND
+ QList<TelescopeLite *> m_newTelescopes;
+ QList<QString> m_delTelescopes;
+#endif
};
#endif
diff --git a/kstars/skymapliteevents.cpp b/kstars/skymapliteevents.cpp
index eb9026d..bb358a4 100644
--- a/kstars/skymapliteevents.cpp
+++ b/kstars/skymapliteevents.cpp
@@ -4,6 +4,9 @@
#include <QtMath>
+#include "kstarslite/skypointlite.h"
+#include "kstarslite/skyobjectlite.h"
+
#include "kstarslite/skyitems/planetsitem.h"
#include "Options.h"
#include "projections/projector.h"
@@ -51,15 +54,15 @@ void SkyMapLite::mousePressEvent( QMouseEvent *e ) {
switch( e->button() ) {
case Qt::LeftButton:
{
- QString name;
+ /*QString name;
if( clickedObject() )
- name = clickedObject()->translatedLongName();
+ //name = clickedObject()->translatedLongName();
else
- name = i18n( "Empty sky" );
+ //name = i18n( "Empty sky" );
//kstars->statusBar()->changeItem(name, 0 );
//kstars->statusBar()->showMessage(name, 0 );
- emit positionClicked(&m_MousePoint);
+ emit positionClicked(&m_MousePoint);*/
}
break;
@@ -70,8 +73,9 @@ void SkyMapLite::mousePressEvent( QMouseEvent *e ) {
} else {*/
// Show popup menu
if( clickedObject() ) {
- //clickedObject()->showPopupMenu( pmenu, QCursor::pos() );
+ emit objectChanged(ClickedObjectLite);
} else {
+ emit positionChanged(ClickedPointLite);
/* pmenu->createEmptyMenu( clickedPoint() );
pmenu->popup( QCursor::pos() );*/
}
@@ -184,7 +188,7 @@ void SkyMapLite::mouseMoveEvent( QMouseEvent *e ) {
if( !slewing ) {
slewing = true;
//stopTracking(); //toggle tracking off
- }
+ }
//Update focus such that the sky coords at mouse cursor remain approximately constant
if ( Options::useAltAz() ) {
@@ -314,29 +318,47 @@ void SkyMapLite::touchEvent( QTouchEvent *e) {
mouseButtonDown = false;
} else {
//If only pan is needed we just use the first touch point
- QPointF newFocus = points[0].pos();
- QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, newFocus,
- Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier);
- if(e->type() == QEvent::TouchBegin) {
- if(mouseButtonDown) mouseButtonDown = false;
- }
+ if(e->touchPointStates() & Qt::TouchPointMoved || slewing) {
+ QPointF newFocus = points[0].pos();
+ QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, newFocus,
+ Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier);
+ if(e->type() == QEvent::TouchBegin) {
+ if(mouseButtonDown) mouseButtonDown = false;
+ }
- mousePressEvent(event);
- mouseMoveEvent(event);
-
- if(e->type() == QEvent::TouchEnd) {
- if (mouseButtonDown) {
- mouseButtonDown = false;
- if ( slewing ) {
- slewing = false;
- if ( Options::useAltAz() )
- setDestinationAltAz( focus()->alt(), focus()->az() );
- else
- setDestination( *focus() );
+ mousePressEvent(event);
+ mouseMoveEvent(event);
+
+ if(e->type() == QEvent::TouchEnd) {
+ if (mouseButtonDown) {
+ mouseButtonDown = false;
+ if ( slewing ) {
+ slewing = false;
+ if ( Options::useAltAz() )
+ setDestinationAltAz( focus()->alt(), focus()->az() );
+ else
+ setDestination( *focus() );
+ }
}
}
+ delete event;
+ } else if((e->touchPointStates() & (Qt::TouchPointReleased))) { //&& !slewing && points.length() == 1) {
+ //determine RA, Dec of touch
+ m_MousePoint = projector()->fromScreen( points[0].pos() , data->lst(), data->geo()->lat() );
+ setClickedPoint( &m_MousePoint );
+
+ //Find object nearest to clickedPoint()
+ double maxrad = 1000.0/Options::zoomFactor();
+ SkyObject* obj = data->skyComposite()->objectNearest( clickedPoint(), maxrad );
+ setClickedObject( obj );
+ if( obj ) setClickedPoint( obj );
+
+ if( clickedObject() ) {
+ emit objectChanged(ClickedObjectLite);
+ } else {
+ emit positionChanged(ClickedPointLite);
+ }
}
- delete event;
}
}
}