Commit 50796a79 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

improve Android integration

parent ded1a122
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Elisa Music Player
Upstream-Contact: Matthieu Gallien <matthieu_gallien@yahoo.fr>
Source: https://invent.kde.org/multimedia/elisa
......@@ -81,6 +81,11 @@ set_package_properties(KF5CoreAddons PROPERTIES
DESCRIPTION "Qt addon library with a collection of non-GUI utilities."
TYPE REQUIRED)
find_package(KF5IconThemes ${REQUIRED_KF5_VERSION} CONFIG QUIET)
set_package_properties(KF5IconThemes PROPERTIES
DESCRIPTION "Support for icon themes."
TYPE REQUIRED)
if (NOT WIN32)
find_package(KF5Baloo ${REQUIRED_KF5_VERSION} CONFIG QUIET)
set_package_properties(KF5Baloo PROPERTIES
......@@ -157,10 +162,6 @@ include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(CMakePackageConfigHelpers)
if (CMAKE_SYSTEM_NAME STREQUAL Android)
set(QT_QMAKE_EXECUTABLE "$ENV{Qt5_android}/bin/qmake")
endif()
configure_file(config-upnp-qt.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-upnp-qt.h )
ecm_setup_version(${RELEASE_SERVICE_VERSION}
......
Copyright (c) <year> <owner> All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
......@@ -26,6 +26,7 @@ Elisa has the following dependencies:
* KF5I18n (required version >= 5.70.0), KF5 text internationalization library.
* KF5CoreAddons (required version >= 5.70.0), Qt addon library with a collection of non-GUI utilities.
* KF5Config (required version >= 5.70.0), Persistent platform-independent application settings.
* KF5IconThemes (required version >= 5.70.0), Support for icon themes.
* ECM (required version >= 1.6.0)
* Qt5Core
......
<?xml version='1.0' encoding='utf-8'?>
<!--
SPDX-FileCopyrightText: 2016 Matthieu Gallien <matthieu_gallien@yahoo.fr>
SPDX-License-Identifier: LGPL-3.0-or-later
SPDX-FileCopyrightText: 2019 Dimitris Kardarakos <dimkard@posteo.net>
SPDX-License-Identifier: BSD-2-Clause
-->
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.2.80" package="org.kde.elisa" android:installLocation="auto" android:versionCode="7">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Elisa" android:icon="@drawable/kde">
<activity android:name="org.qtproject.qt5.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:label="Elisa" android:screenOrientation="unspecified" android:windowSoftInputMode="adjustResize" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="elisa"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<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"/>
<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"/>
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<meta-data android:name="android.app.background_running" android:value="false"/>
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
</activity>
<service android:process=":qtElisaService" android:name="org.kde.elisa.ElisaService">
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<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"/>
<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"/>
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<meta-data android:name="android.app.arguments" android:value="-service"/>
<!-- Background running -->
<meta-data android:name="android.app.background_running" android:value="true"/>
<!-- Background running -->
</service>
</application>
<supports-screens android:anyDensity="true" android:normalScreens="true" android:smallScreens="true" android:largeScreens="true"/>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
<!--
The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions.
-->
<!-- %%INSERT_PERMISSIONS -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.kde.elisa"
android:versionName="21.07.70"
android:versionCode="1615803371"
android:installLocation="auto">
<application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Elisa" android:icon="@drawable/splash_logo">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation"
android:name="org.qtproject.qt5.android.bindings.QtActivity"
android:label="Elisa"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="elisa"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<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"/>
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
<!-- 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.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>
<!-- Run with local libs -->
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<!-- Messages maps -->
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<!-- Splash screen -->
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash"/>
<!-- Background running -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<!-- auto screen scale factor -->
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="true"/>
</activity>
<service android:process=":qtElisaService" android:name=".org.kde.elisa.ElisaService">
<meta-data android:name="android.app.lib_name" android:value="elisa"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<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"/>
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<meta-data android:name="android.app.background_running" android:value="true"/>
<meta-data android:name="android.app.arguments" android:value="-service"/>
</service>
</application>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-feature android:name="android.hardware.audio.output" android:required="false" />
<!--
The following comment will be replaced upon deployment with default features based on the dependencies of the application.
......@@ -85,4 +84,9 @@ SPDX-License-Identifier: LGPL-3.0-or-later
-->
<!-- %%INSERT_FEATURES -->
<!--
The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions.
-->
<!-- %%INSERT_PERMISSIONS -->
</manifest>
// SPDX-FileCopyrightText: 2018 Matthieu Gallien <matthieu_gallien@yahoo.fr>
//
// SPDX-License-Identifier: LGPL-3.0-or-later
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
}
}
repositories {
google()
jcenter()
}
apply plugin: 'com.android.application'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
}
android {
/*******************************************************
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
* are defined in gradle.properties file. This file is
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger()
buildToolsVersion androidBuildToolsVersion
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
res.srcDirs = [qt5AndroidDir + '/res', 'res']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion qtMinSdkVersion
targetSdkVersion qtTargetSdkVersion
}
}
# SPDX-FileCopyrightText: 2020 Gabriel Souza Franco <gabrielfrancosouza@gmail.com>
# SPDX-License-Identifier: BSD-3-Clause
android.useAndroidX=true
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2018-2020 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: CC0-1.0
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#3daee9"/>
</shape>
</item>
<item android:width="64dp" android:height="64dp" android:right="4dp" android:bottom="4dp" android:gravity="bottom|right">
<bitmap
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="@drawable/vendor_logo"/>
</item>
</layer-list>
// SPDX-FileCopyrightText: 2018 Matthieu Gallien <matthieu_gallien@yahoo.fr>
//
// SPDX-License-Identifier: LGPL-3.0-or-later
package org.kde.elisa;
import org.qtproject.qt5.android.bindings.QtActivity;
import android.content.ContentResolver;
import android.content.Context;
import androidx.core.content.ContextCompat;
import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.content.Intent;
import android.provider.MediaStore;
public class ElisaActivity extends QtActivity
{
private static final int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 1;
private static String[] tracksRequestedColumns = {
MediaStore.Audio.Media._ID,
MediaStore.Audio.Media.TITLE,
MediaStore.Audio.Media.TRACK,
MediaStore.Audio.Media.YEAR,
MediaStore.Audio.Media.DURATION,
MediaStore.Audio.Media.DATA,
MediaStore.Audio.Media.ARTIST,
MediaStore.Audio.Media.ARTIST_ID,
MediaStore.Audio.Media.ALBUM,
MediaStore.Audio.Media.ALBUM_ID,
MediaStore.Audio.Media.COMPOSER,
};
private static String[] albumsRequestedColumns = {
MediaStore.Audio.Albums._ID,
MediaStore.Audio.Albums.ALBUM,
MediaStore.Audio.Albums.ALBUM_ART,
MediaStore.Audio.Albums.ARTIST,
MediaStore.Audio.Albums.NUMBER_OF_SONGS,
};
public static void listAudioFiles(Context ctx)
{
androidMusicScanTracksStarting();
//Some audio may be explicitly marked as not being music
String tracksSelection = MediaStore.Audio.Media.IS_MUSIC + " != 0";
String tracksSortOrder = MediaStore.Audio.Media.DEFAULT_SORT_ORDER + " ASC";
if (ContextCompat.checkSelfPermission(ctx, Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
androidMusicScanTracksFinishing();
androidMusicScanAlbumsStarting();
androidMusicScanAlbumsFinishing();
return;
}
Cursor tracksCursor = ctx.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, tracksRequestedColumns, tracksSelection, null, tracksSortOrder);
tracksCursor.moveToFirst();
while(tracksCursor.moveToNext()) {
sendMusicFile(tracksCursor.getString(0) + "||" + tracksCursor.getString(1) + "||" +
tracksCursor.getString(2) + "||" + tracksCursor.getString(3) + "||" +
tracksCursor.getString(4) + "||" + tracksCursor.getString(5) + "||" +
tracksCursor.getString(6) + "||" + tracksCursor.getString(7) + "||" +
tracksCursor.getString(8) + "||" + tracksCursor.getString(9) + "||" +
tracksCursor.getString(10));
}
androidMusicScanTracksFinishing();
androidMusicScanAlbumsStarting();
//Some audio may be explicitly marked as not being music
/*String albumsSortOrder = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER + " ASC";
Cursor albumsCursor = ctx.getContentResolver().query(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, albumsRequestedColumns, null, null, albumsSortOrder);
albumsCursor.moveToFirst();
while(albumsCursor.moveToNext()) {
sendMusicAlbum(albumsCursor.getString(0) + "||" + albumsCursor.getString(1) + "||" +
albumsCursor.getString(2) + "||" + albumsCursor.getString(3) + "||" + albumsCursor.getString(4));
}*/
androidMusicScanAlbumsFinishing();
}
public static void checkPermissions(Activity activity)
{
if (ContextCompat.checkSelfPermission(activity,
Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(activity,
Manifest.permission.READ_EXTERNAL_STORAGE)) {
// Show an explanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
} else {
// No explanation needed; request the permission
ActivityCompat.requestPermissions(activity,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
}
} else {
readExternalStoragePermissionIsOk();
}
}
@Override
public void onRequestPermissionsResult(int requestCode,
String[] permissions, int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
readExternalStoragePermissionIsOk();
} else {
readExternalStoragePermissionIsKo();
}
return;
}
}
}
private static native void androidMusicScanTracksStarting();
private static native void sendMusicFile(String musicFile);
private static native void androidMusicScanTracksFinishing();
private static native void androidMusicScanAlbumsStarting();
private static native void sendMusicAlbum(String musicFile);
private static native void androidMusicScanAlbumsFinishing();
private static native void readExternalStoragePermissionIsOk();
private static native void readExternalStoragePermissionIsKo();
}
......@@ -122,9 +122,17 @@ else()
endif()
if (ANDROID)
ecm_qt_declare_logging_category(elisaLib_SOURCES
HEADER "android/androidcommon.h"
IDENTIFIER "orgKdeElisaAndroid"
CATEGORY_NAME "org.kde.elisa.android"
DEFAULT_SEVERITY Info
)
set(elisaLib_SOURCES
${elisaLib_SOURCES}
android/androidmusiclistener.cpp
android/androidfilelisting.cpp
)
endif()
......@@ -381,13 +389,7 @@ if (Qt5Quick_FOUND AND Qt5Widgets_FOUND)
windows/WindowsTheme.qml
windows/PlatformIntegration.qml
android/ElisaMainWindow.qml
android/AndroidTheme.qml
android/PlatformIntegration.qml
android/AlbumsView.qml
android/ArtistsView.qml
android/TracksView.qml
android/GenresView.qml
qml/ElisaMainWindow.qml
qml/ApplicationMenu.qml
......@@ -472,11 +474,12 @@ if (Qt5Quick_FOUND AND Qt5Widgets_FOUND)
elisaLib
Qt5::Widgets Qt5::QuickControls2
KF5::I18n KF5::CoreAddons KF5::ConfigCore KF5::ConfigGui
KF5::IconThemes
)
if (ANDROID)
target_link_libraries(elisa
LINK_PRIVATE
PRIVATE
Qt5::AndroidExtras Qt5::Svg Qt5::Sql Qt5::Concurrent KF5::Kirigami2
)
endif()
......
/*
SPDX-FileCopyrightText: 2018 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr>
SPDX-License-Identifier: LGPL-3.0-or-later
*/
import QtQuick 2.11
import QtQuick.Controls 2.4
import org.kde.kirigami 2.5 as Kirigami
import org.kde.elisa 1.0
Kirigami.Page {
id: pageElement
property bool isSubPage: false
property string mainTitle
property string secondaryTitle
property url image
property var contentModel: elisa.allAlbumsProxyModel
property bool showRating: false
property bool delegateDisplaySecondaryText: true
property bool expandedFilterView: false
property var stackView
title: i18nc("Title of the view of all albums", "Albums")
GridView {
id: gridView
focus: true
anchors.fill: parent
cellWidth: gridView.width / 2
cellHeight: gridView.width / 2
model: contentModel
delegate: GridBrowserDelegate {
width: gridView.cellWidth
height: gridView.cellHeight
focus: true
isPartial: false
mainText: model.display
secondaryText: if (gridView.delegateDisplaySecondaryText) {model.secondaryText} else {""}
imageUrl: (model && model.imageUrl && model.imageUrl.toString() !== "" ? model.imageUrl : defaultIcon)
shadowForImage: (model && model.imageUrl && model.imageUrl.toString() !== "" ? true : false)
databaseId: model.databaseId
delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText
onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Album,
ElisaUtils.AppendPlayList,
ElisaUtils.DoNotTriggerPlay)
onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, ElisaUtils.Album,
ElisaUtils.ReplacePlayList,
ElisaUtils.TriggerPlay)
onOpen: pageElement.open(model.display, model.secondaryText, model.imageUrl, model.databaseId)
onSelected: {
forceActiveFocus()
contentDirectoryView.currentIndex = model.index
}
}
}
}
/*
SPDX-FileCopyrightText: 2017 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr>
SPDX-License-Identifier: LGPL-3.0-or-later
*/
import QtQuick 2.7
import QtQuick.Controls 2.2
import org.kde.elisa 1.0
BaseTheme {
property string albumCover: 'media-optical-audio.svg'
property string artistImage: 'view-media-artist.svg'
property string clearIcon: 'edit-clear.svg'
property string skipBackwardIcon: 'media-skip-backward.svg'
property string pauseIcon: 'media-playback-pause.svg'
property string playIcon: 'media-playback-start.svg'
property string skipForwardIcon: 'media-skip-forward.svg'
property string playerVolumeMutedIcon: 'player-volume-muted.svg'