Commit 6395454f authored by Artem Fedoskin's avatar Artem Fedoskin
Browse files

Excluded KDECompilerSettings from CMakeLists.txt because it causes the

Android build to crash on startup. Added icons for different DPI and set
Android style splash screen.
parent f3cbe01c
......@@ -2,7 +2,7 @@ PROJECT(kstars CXX C)
set (KStars_VERSION_MAJOR 2)
set (KStars_VERSION_MINOR 6)
set (KStars_VERSION_REVISION 0)
set (CMAKE_CXX_STANDARD 11)
#Build KStars Lite with -DKSTARS_LITE=ON
option(BUILD_KSTARS_LITE "Build KStars Lite" OFF)
if(BUILD_KSTARS_LITE)
......@@ -17,14 +17,23 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
if(CMAKE_SYSTEM_NAME STREQUAL Android)
add_definitions(-DANDROID )
endif()
find_package(ECM 1.7.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
find_package(Qt5 5.4 REQUIRED COMPONENTS Gui Qml Quick Xml Sql Svg Network PrintSupport)
#set(KDE_SKIP_RPATH_SETTINGS TRUE)
include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
if(NOT ANDROID)
message("CHECK ANDROID DEFINITION")
#We get error "could not find main method" with this module
include(KDECompilerSettings NO_POLICY_SCOPE)
endif()
include(KDECMakeSettings)
include(ECMInstallIcons)
include(FeatureSummary)
......
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.0.3" package="org.kde.hellokandroid" android:installLocation="auto" android:versionCode="7">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.0.3" package="org.kde.kstars" android:installLocation="auto" android:versionCode="7">
<application android:name="org.qtproject.qt5.android.bindings.QtApplication"
android:label="KStars Lite"
android:icon="@drawable/kde">
android:icon="@drawable/icon">
<activity android:name="org.qtproject.qt5.android.bindings.QtActivity"
android:label="KStars Lite"
android:screenOrientation="unspecified"
android:theme="@style/AppTheme"
android:launchMode="singleTop"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
......@@ -16,6 +18,9 @@
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
<!-- Splash screen -->
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash"/>
<!-- Splash screen -->
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#FFFFFFFF"/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/icon" android:gravity="center" />
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#FFFFFFFF"/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/icon" android:gravity="center" />
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#FFFFFFFF"/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/icon" android:gravity="center" />
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#FFFFFFFF"/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/icon" android:gravity="center" />
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#FFFFFFFF"/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/icon" android:gravity="center" />
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#FFFFFFFF"/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/icon" android:gravity="center" />
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash</item>
</style>
</resources>
......@@ -733,16 +733,15 @@ endif (WCSLIB_FOUND)
target_link_libraries(kstars KStarsLib)
if(NOT BUILD_KSTARS_LITE)
install(TARGETS kstars ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS kstars ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
########### install files ###############
install( FILES kstars.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR} )
install( FILES kstars.knsrc DESTINATION ${KDE_INSTALL_CONFDIR} )
ecm_install_icons(${KDE_INSTALL_ICONDIR})
install( FILES kstars.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR} )
install( FILES kstars.knsrc DESTINATION ${KDE_INSTALL_CONFDIR} )
ecm_install_icons(${KDE_INSTALL_ICONDIR})
if(NOT CMAKE_SYSTEM_NAME STREQUAL Android)
install( PROGRAMS org.kde.kstars.desktop DESTINATION ${KDE_INSTALL_APPDIR} )
if (INDI_FOUND)
install( FILES kstarsui-indi.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kstars RENAME kstarsui.rc)
......@@ -752,7 +751,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Android)
install( FILES fitsviewer.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kstars )
if (WIN32)
install( FILES kstarsui-win.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kstars )
install( FILES kstarsui-win.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kstars )
endif (WIN32)
install(FILES kstars.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
endif(NOT CMAKE_SYSTEM_NAME STREQUAL Android)
endif(NOT BUILD_KSTARS_LITE)
......@@ -2,41 +2,46 @@ import QtQuick 2.4
import QtQuick.Window 2.2
import "modules"
import "constants" 1.0
import skymaplite 1.0
//import skymaplite 1.0
Window {
id: mainWindow
visible: false
width: Screen.desktopAvailableWidth
height: Screen.desktopAvailableHeight
visible: true
property double shadowBgOpacity
property int drawersOrder: 2
property int bgOrder: 1
property int skyMapOrder: 0
property int topMenuOrder: 0
property Splash splash: Splash {
onTimeout: mainWindow.visible = true
Splash {
onTimeout: content.visible = true
}
Rectangle {
id: skyMapLiteWrapper
color: "#000"
objectName: "skyMapLiteWrapper"
Item{
id: content
anchors.fill: parent
}
visible: false
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
Rectangle {
id: skyMapLiteWrapper
color: "#000"
objectName: "skyMapLiteWrapper"
anchors.fill: parent
}
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
}
}
}
/*Image {
/*Image {
anchors.fill: parent
z: skyMapOrder
source: "modules/images/SkyMap.png"
......@@ -53,169 +58,170 @@ Window {
}
}*/
// The instance of SkyMapLite is reparanted to this item and fill it
// The instance of SkyMapLite is reparanted to this item and fill it
//SkyMapLite {
//SkyMapLite {
//anchors.fill: parent
//}
MouseArea {
property int posY
anchors {
left: parent.left
right: parent.right
top: parent.top
}
height: parent.height * 0.25
//}
onPressed: {
posY = mouseY
}
MouseArea {
property int posY
anchors {
left: parent.left
right: parent.right
top: parent.top
}
height: parent.height * 0.25
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 = ""
onPressed: {
posY = mouseY
}
}
TopMenu {
z: topMenuOrder
id: topMenu
anchors.horizontalCenter: parent.horizontalCenter
Connections {
target: mainWindow
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 = ""
}
function setOrientation() {
if (width < topMenu.width) {
topMenu.state = "portrait"
}
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"
}
else topMenu.state = "landscape"
}
Component.onCompleted: {
setOrientation()
}
Component.onCompleted: {
setOrientation()
}
onWidthChanged: {
setOrientation()
onWidthChanged: {
setOrientation()
}
}
}
}
}
Rectangle {
id: shadowBg
z: bgOrder
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 = ""
}
}
Rectangle {
id: shadowBg
z: bgOrder
anchors.fill: parent
color: "black"
opacity: 0
property double minOpacity: 0.35
Connections {
target: contextDrawer
onBgOpacityChanged: {
var bgOpacity = contextDrawer.bgOpacity
if (bgOpacity < shadowBg.minOpacity && globalDrawer.state != "open") shadowBg.opacity = bgOpacity
}
onStateChanged: {
if(contextDrawer.state == "open") globalDrawer.state = ""
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 = ""
}
}
}
MouseArea {
anchors.fill: parent
onPressed: {
if(globalDrawer.state == "open") {
globalDrawer.state = ""
mouse.accepted = true
return
Connections {
target: contextDrawer
onBgOpacityChanged: {
var bgOpacity = contextDrawer.bgOpacity
if (bgOpacity < shadowBg.minOpacity && globalDrawer.state != "open") shadowBg.opacity = bgOpacity
}
if(contextDrawer.state == "open") {
contextDrawer.state = ""
mouse.accepted = true
return
onStateChanged: {
if(contextDrawer.state == "open") globalDrawer.state = ""
}
mouse.accepted = false
}
}
Behavior on opacity {
PropertyAnimation {
duration: 300
MouseArea {
anchors.fill: parent
onPressed: {
if(globalDrawer.state == "open") {
globalDrawer.state = ""
mouse.accepted = true
return
}
if(contextDrawer.state == "open") {
contextDrawer.state = ""
mouse.accepted = true
return
}
mouse.accepted = false
}
}
}
}
MouseArea {
property int posY
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: parent.height *0.25
onPressed: {
posY = mouseY
Behavior on opacity {
PropertyAnimation {
duration: 300
}
}
}
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 = ""
MouseArea {
property int posY
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: parent.height *0.25
}
BottomMenu {
z: topMenuOrder
id: bottomMenu
onPressed: {
posY = mouseY
}
anchors.horizontalCenter: parent.horizontalCenter
Connections {
target: mainWindow
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 = ""
}
function setOrientation() {
if (width < topMenu.width) {
bottomMenu.state = "portrait"
}
BottomMenu {
z: topMenuOrder
id: bottomMenu
anchors.horizontalCenter: parent.horizontalCenter
Connections {
target: mainWindow
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
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
}
}
}
}
import QtQuick 2.4
import QtQuick.Window 2.2
import "../constants"
Window {
Item {
id: splash
color: "transparent"
title: "Splash Window"
modality: Qt.ApplicationModal
flags: Qt.SplashScreen
//color: "transparent"
//title: "Splash Window"
//modality: Qt.ApplicationModal
//flags: Qt.SplashScreen
signal timeout
x: (Screen.width - splashImage.width) / 2
......@@ -15,14 +16,37 @@ Window {
width: splashImage.width
height: splashImage.height
Timer {
interval: 3500;
running: true;
onTriggered: {
splash.timeout();
visible = false
}
}
Timer {
id: progressText
interval: 500
running: true
repeat: true
}
Image {
id: splashImage
source: "images/kstars.png"
source: "images/" + num.density + "/icons/icon.png"
Text {
id: progress
color: "#FFF"
Connections {
target: progressText
onTriggered: {
progress.text = progress.text + "a"
}
}
anchors {
top: parent.top
left: parent.left
......@@ -30,7 +54,7 @@ Window {
}
}
}