Skip to content

Commit

Permalink
Merge branch 'v2.5' into snappy
Browse files Browse the repository at this point in the history
  • Loading branch information
janbar committed Jan 20, 2018
2 parents f24450e + a09a44c commit b82b7f4
Show file tree
Hide file tree
Showing 43 changed files with 604 additions and 108 deletions.
138 changes: 82 additions & 56 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,34 @@ cmake_minimum_required(VERSION 2.8.9)
set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

find_package(Qt5Core)
find_package(Qt5Qml)
find_package(Qt5Quick)
# find_package(ubuntu-sdk-libs)

# Automatically create moc files
set(CMAKE_AUTOMOC ON)

# Components PATH
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")

option(INSTALL_TESTS "Install the tests on make install" on)
option(CLICK_MODE "Installs to a contained location" on)

set(APP_VERSION 2.5.1)
set(APP_NAME noson)
set(APP_VERSION "2.6.0")
set(APP_NAME "noson")
set(APP_ID "noson.janbar")
set(MAIN_QML "Main.qml")
set(ICON "noson.png")
set(ICON_FILE "app/graphics/noson.png")
set(EXEC "noson-app")
set(ICON_FILE "noson.png")
set(DESKTOP_FILE_NAME "noson.desktop")

# Components PATH
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(LIBDIR "lib/${ARCH_TRIPLET}")

# Set install paths
if(CLICK_MODE)
set(NOSONAPP_DIR "share/qml/${APP_NAME}")
set(CMAKE_INSTALL_PREFIX /)
set(DATA_DIR /)
set(DATA_DIR ${CMAKE_INSTALL_PREFIX})
set(DESKTOP_DIR ${DATA_DIR})

set(EXEC "qmlscene $@ ${NOSONAPP_DIR}/${MAIN_QML}")
set(ICON "${ICON_FILE}")
set(PLUGINS_DIR "${LIBDIR}/${APP_NAME}")
set(NOSON_GUI "${PLUGINS_DIR}/noson-gui")

# This command figures out the target architecture for use in the manifest file
execute_process(
Expand All @@ -49,45 +41,79 @@ if(CLICK_MODE)
OUTPUT_STRIP_TRAILING_WHITESPACE
)

configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES "noson.apparmor" DESTINATION ${DATA_DIR})
install(FILES "noson-content.json" DESTINATION ${DATA_DIR})
configure_file(${DESKTOP_FILE_NAME}.in ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}.in)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}
DESTINATION ${DESKTOP_DIR})
configure_file(
manifest.json.in
${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(
FILES "noson.apparmor"
DESTINATION ${DATA_DIR})
install(
FILES "noson-content.json"
DESTINATION ${DATA_DIR})
configure_file(
${EXEC}.in
${CMAKE_CURRENT_BINARY_DIR}/${EXEC})
install(
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${EXEC}
DESTINATION ${DATA_DIR})
configure_file(
${DESKTOP_FILE_NAME}.in
${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}.in)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}
DESTINATION ${DESKTOP_DIR} RENAME ${APP_NAME}.desktop)
install(
FILES "app/graphics/${ICON_FILE}"
DESTINATION ${DATA_DIR})
else(CLICK_MODE)
# Standard install paths
include(GNUInstallDirs)
set(APP_HARDCODE "noson")
set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${APP_HARDCODE})
set(DESKTOP_DIR ${CMAKE_INSTALL_DATADIR}/applications)
set(NOSONAPP_DIR ${CMAKE_INSTALL_PREFIX}/${DATA_DIR})
set(ICON ${NOSONAPP_DIR}/${ICON})

set(EXEC ${APP_HARDCODE})

configure_file(${APP_HARDCODE}.in
${CMAKE_CURRENT_BINARY_DIR}/${APP_HARDCODE})
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${APP_HARDCODE}
DESTINATION ${CMAKE_INSTALL_BINDIR})
configure_file(${DESKTOP_FILE_NAME}.in ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}.in)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}
DESTINATION ${DESKTOP_DIR} RENAME ${APP_HARDCODE}.desktop)
install(FILES noson-content.json DESTINATION ${CMAKE_INSTALL_DATADIR}/content-hub/peers/ RENAME ${APP_HARDCODE})
# Standard install paths
include(GNUInstallDirs)
set(DESKTOP_DIR ${CMAKE_INSTALL_DATADIR}/applications)
set(ICON "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${APP_NAME}/${ICON_FILE}")
set(PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${APP_NAME}")
set(NOSON_GUI "${PLUGINS_DIR}/noson-gui")

configure_file(
${EXEC}.in
${CMAKE_CURRENT_BINARY_DIR}/${EXEC})
install(
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${EXEC}
DESTINATION ${CMAKE_INSTALL_BINDIR})
configure_file(
${DESKTOP_FILE_NAME}.in
${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}.in)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME}
DESTINATION ${DESKTOP_DIR} RENAME ${APP_NAME}.desktop)
install(
FILES noson-content.json
DESTINATION ${CMAKE_INSTALL_DATADIR}/content-hub/peers/ RENAME ${APP_NAME})
install(
FILES "app/graphics/${ICON_FILE}"
DESTINATION ${CMAKE_INSTALL_DATADIR}/${APP_NAME})
endif(CLICK_MODE)

install(FILES ${ICON_FILE} DESTINATION ${DATA_DIR})

add_subdirectory(app)
add_subdirectory(backend)
add_subdirectory(po)

add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend ${CMAKE_SOURCE_DIR}/app/Main.qml --debug
DEPENDS NosonAppbackend NosonAppbackend-qmldir
WORKING_DIRECTORY ./app)
add_custom_target("run" QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/backend ${CMAKE_BINARY_DIR}/app/noson-gui --debug
DEPENDS NosonAppbackend NosonAppbackend-qmldir
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

# No op custom target for all not compiled files, so they show up in the QtCreator project tree
add_custom_target("nosonapp_ClickFiles" ALL SOURCES "noson.apparmor" "manifest.json.in" "noson-content.json")


configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY
)

add_custom_target(
"uninstall"
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ Launch the *Noson* application from command line as follows.

Also that will write debug output into the file `noson.log`. **Please be carefull to not paste debug log on public area before cleaning it from any credentials**. Debugging registration of music services will log entered credentials.

### Ubuntu touch
## Ubuntu touch

## Build
#### Build
- `cmake -DCMAKE_BUILD_TYPE=Release -DCLICK_MODE=ON ..`
- `make -j5`
- `cmake --build . --target all`
## Package
#### Package
- `make DESTDIR=./ubuntu-deploy install`
- `click build --no-validate ./ubuntu-deploy`
- `click-review --sdk "noson.janbar_X.X.X_armhf.click"`
## Deploy
#### Deploy
The developer mode must be enabled for all the following steps: Settings > About Phone > Developer Mode
- `adb push noson.janbar_X.X.X_armhf.click /home/phablet/Downloads/`
- `adb shell`
- `pkcon install-local --allow-untrusted Downloads/noson.janbar_X.X.X_armhf.click`
Exit from adb shell by command `exit`.
- Exit from adb shell by command `exit`.

28 changes: 26 additions & 2 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Automatically create moc files
set(CMAKE_AUTOMOC ON)

find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Qml REQUIRED)
find_package(Qt5Quick REQUIRED)

file(GLOB QML_JS_FILES *.qml *.js)
file(GLOB APP_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml *.js *.json)

Expand All @@ -7,6 +15,22 @@ add_subdirectory(ui)
# Make the files visible on qtcreator
add_custom_target(nosonapp_QMlFiles ALL SOURCES ${APP_FILES})

install(FILES ${QML_JS_FILES} DESTINATION ${NOSONAPP_DIR})
install(DIRECTORY "graphics" DESTINATION ${NOSONAPP_DIR})
set(
noson-gui-sources
noson.cpp
signalhandler.cpp
signalhandler.h
diskcache/diskcachefactory.cpp
diskcache/diskcachefactory.h
diskcache/cachingnetworkaccessmanager.cpp
diskcache/cachingnetworkaccessmanager.h
diskcache/cachereply.cpp
diskcache/cachereply.h
)

qt5_add_resources(noson-gui-resources noson.qrc)
add_executable(noson-gui ${noson-gui-sources} ${noson-gui-resources})
qt5_use_modules(noson-gui Gui Qml Quick)

install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/noson-gui
DESTINATION ${PLUGINS_DIR})
2 changes: 0 additions & 2 deletions app/components/ActivitySpinner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
file(GLOB ACTIVITY_SPINNER_QML_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml)

add_custom_target(nosonapp_ACTIVITY_SPINNER_QMLFiles ALL SOURCES ${ACTIVITY_SPINNER_QML_FILES})

install(FILES ${ACTIVITY_SPINNER_QML_FILES} DESTINATION ${NOSONAPP_DIR}/components/ActivitySpinner)
5 changes: 0 additions & 5 deletions app/components/BottomEdge/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# make the qml files visible on qtcreator
file(GLOB BOTTOMEDGE_QML_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml)
file(GLOB BOTTOMEDGE_JS_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.js)

add_custom_target(nosonapp_BOTTOMEDGE_QMLFiles ALL SOURCES ${BOTTOMEDGE_QML_FILES})
add_custom_target(nosonapp_BOTTOMEDGE_JSFiles ALL SOURCES ${BOTTOMEDGE_JS_FILES})

install(FILES ${BOTTOMEDGE_QML_FILES} DESTINATION ${NOSONAPP_DIR}/components/BottomEdge)
install(FILES ${BOTTOMEDGE_JS_FILES} DESTINATION ${NOSONAPP_DIR}/components/BottomEdge)
2 changes: 0 additions & 2 deletions app/components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ file(GLOB COMPONENTS_QML_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml)

add_custom_target(nosonapp_COMPONENTS_QMLFiles ALL SOURCES ${COMPONENTS_QML_FILES})

install(FILES ${COMPONENTS_QML_FILES} DESTINATION ${NOSONAPP_DIR}/components)

3 changes: 3 additions & 0 deletions app/components/CoverGrid.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Item {

property string firstSource

signal imageError(var index)

onCoversChanged: {
if (covers !== undefined) {
while (covers.length > 4) { // remove any covers after 4
Expand Down Expand Up @@ -83,6 +85,7 @@ Item {

onStatusChanged: {
if (status === Image.Error) {
coverGrid.imageError(index);
if (useFallbackArt) {
var array = coverGrid.covers.slice(0);
array.splice(index,1);
Expand Down
3 changes: 0 additions & 3 deletions app/components/Delegates/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@
file(GLOB DELEGATES_QML_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml)

add_custom_target(nosonapp_DELEGATES_QMLFiles ALL SOURCES ${DELEGATES_QML_FILES})

install(FILES ${DELEGATES_QML_FILES} DESTINATION ${NOSONAPP_DIR}/components/Delegates)

3 changes: 3 additions & 0 deletions app/components/Delegates/Card.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Item {
signal pressAndHold(var mouse)
signal playClicked(var mouse)

signal imageError(var index)

/* Animations */
Behavior on height {
NumberAnimation {
Expand Down Expand Up @@ -77,6 +79,7 @@ Item {
CoverGrid {
id: coverGrid
size: parent.width
onImageError: card.imageError(index)
}

Item {
Expand Down
4 changes: 4 additions & 0 deletions app/components/Delegates/MusicListItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Ubuntu.Components 1.3
import "../"

ListItem {
id: item
color: styleMusic.mainView.backgroundColor
highlightColor: Qt.lighter(color, 1.2)

Expand All @@ -36,6 +37,7 @@ ListItem {
property bool reorderable: false

signal itemClicked()
signal imageError

onClicked: {
if (selectMode) {
Expand Down Expand Up @@ -69,6 +71,8 @@ ListItem {
rightMargin: selectMode ? 0 : units.gu(2)
}

onImageError: item.imageError()

// Animate margin changes so it isn't noticible
Behavior on anchors.leftMargin {
NumberAnimation {
Expand Down
4 changes: 4 additions & 0 deletions app/components/Delegates/SelectListItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Ubuntu.Components 1.3
import "../"

ListItem {
id: item
color: styleMusic.mainView.backgroundColor
highlightColor: Qt.lighter(color, 1.2)

Expand All @@ -32,6 +33,7 @@ ListItem {
property alias imageSource: musicRow.imageSource

signal itemClicked()
signal imageError

Component.onCompleted: {
ListView.view.ViewItems.selectMode = true
Expand All @@ -55,6 +57,8 @@ ListItem {
fill: parent
}

onImageError: item.imageError()

// Animate margin changes so it isn't noticible
Behavior on anchors.leftMargin {
NumberAnimation {
Expand Down
1 change: 1 addition & 0 deletions app/components/Delegates/SimpleListItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Ubuntu.Components 1.3
import "../"

ListItem {
id: item
color: styleMusic.mainView.backgroundColor
highlightColor: Qt.lighter(color, 1.2)

Expand Down
3 changes: 0 additions & 3 deletions app/components/Dialog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@
file(GLOB DIALOG_QML_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml)

add_custom_target(nosonapp_DIALOG_QMLFiles ALL SOURCES ${DIALOG_QML_FILES})

install(FILES ${DIALOG_QML_FILES} DESTINATION ${NOSONAPP_DIR}/components/Dialog)

2 changes: 0 additions & 2 deletions app/components/Flickables/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
file(GLOB FLICKABLES_QML_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml)

add_custom_target(nosonapp_FLICKABLES_QMLFiles ALL SOURCES ${FLICKABLES_QML_FILES})

install(FILES ${FLICKABLES_QML_FILES} DESTINATION ${NOSONAPP_DIR}/components/Flickables)
2 changes: 0 additions & 2 deletions app/components/HeadState/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
file(GLOB HEAD_STATE_QML_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml)

add_custom_target(nosonapp_HEAD_STATE_QMLFiles ALL SOURCES ${HEAD_STATE_QML_FILES})

install(FILES ${HEAD_STATE_QML_FILES} DESTINATION ${NOSONAPP_DIR}/components/HeadState)
3 changes: 0 additions & 3 deletions app/components/ListItemActions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@
file(GLOB ACTIONITEMS_QML_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml)

add_custom_target(nosonapp_ACTIONITEMS_QMLFiles ALL SOURCES ${ACTIONITEMS_QML_FILES})

install(FILES ${ACTIONITEMS_QML_FILES} DESTINATION ${NOSONAPP_DIR}/components/ListItemActions)

Loading

0 comments on commit b82b7f4

Please sign in to comment.