mirror of
https://github.com/KDE/kasts.git
synced 2025-01-30 09:04:53 +01:00
Added C++ client
This commit is contained in:
parent
3707f4673b
commit
48744f636f
@ -53,6 +53,13 @@ else()
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Widgets DBus)
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG QUIET OPTIONAL_COMPONENTS AndroidExtras)
|
||||
set_package_properties(Qt5AndroidExtras PROPERTIES
|
||||
DESCRIPTION "Qt5 AndroidExtras is needed to provide the Android integration."
|
||||
TYPE REQUIRED)
|
||||
endif()
|
||||
|
||||
add_definitions(-DQT_NO_CAST_FROM_ASCII
|
||||
-DQT_NO_CAST_TO_ASCII
|
||||
-DQT_NO_URL_CAST_FROM_STRING
|
||||
@ -61,6 +68,7 @@ add_definitions(-DQT_NO_CAST_FROM_ASCII
|
||||
-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00
|
||||
)
|
||||
|
||||
|
||||
install(PROGRAMS org.kde.kasts.desktop DESTINATION ${KDE_INSTALL_APPDIR})
|
||||
install(FILES org.kde.kasts.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
|
||||
install(FILES kasts.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
|
||||
|
@ -7,7 +7,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.kde.kasts"
|
||||
android:versionName="0.0.1"
|
||||
android:versionCode="1627466509"
|
||||
android:versionCode="1628121202"
|
||||
android:installLocation="auto">
|
||||
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
@ -8,22 +8,75 @@
|
||||
package org.kde.kasts;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.media.session.MediaSessionCompat;
|
||||
import android.support.v4.media.session.PlaybackStateCompat;
|
||||
import android.util.Log;
|
||||
|
||||
public class MediaService extends Service {
|
||||
public static final String TAG = "MediaService";
|
||||
|
||||
private MediaSessionCompat mSession;
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
|
||||
private class MediaSessionCallback extends MediaSessionCompat.Callback {
|
||||
private Context mContext;
|
||||
|
||||
public MediaSessionCallback(Context context) {
|
||||
super();
|
||||
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlay() {
|
||||
super.onPlay();
|
||||
|
||||
mSession.setActive(true);
|
||||
|
||||
//JNI to audiomanager play
|
||||
//setPlaybackState for mSession
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
//JNI to audiomanager pause
|
||||
//setPlaybackState for mSession
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
|
||||
//JNI call to audiomanager stop
|
||||
mSession.setActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
mSession = new MediaSessionCompat(this, TAG);
|
||||
mSession.setFlags(
|
||||
MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS |
|
||||
MediaSessionCompat.FLAG_HANDLES_QUEUE_COMMANDS |
|
||||
MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
|
||||
mSession.setCallback(new MediaSessionCallback(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
mSession.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -140,6 +140,11 @@ if(ANDROID)
|
||||
target_link_libraries(kasts PRIVATE ZLIB::ZLIB)
|
||||
endif()
|
||||
|
||||
target_link_libraries(kasts
|
||||
LINK_PUBLIC
|
||||
Qt5::AndroidExtras
|
||||
)
|
||||
|
||||
kirigami_package_breeze_icons(ICONS
|
||||
window-close
|
||||
window-close-symbolic
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include <QTimer>
|
||||
#include <QtMath>
|
||||
#include <algorithm>
|
||||
#include <QtAndroid>
|
||||
#include <QAndroidJniObject>
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
|
16
src/mediasessionclient.cpp
Normal file
16
src/mediasessionclient.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2021 Swapnil Tripathi <swapnil06.st@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
*/
|
||||
|
||||
#include "mediasessionclient.h"
|
||||
#include "audiomanager.h"
|
||||
|
||||
#include <QtAndroid>
|
||||
|
||||
MediaSessionClient::MediaSessionClient(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
//connections to be added here.
|
||||
}
|
13
src/mediasessionclient.h
Normal file
13
src/mediasessionclient.h
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2021 Swapnil Tripathi <swapnil06.st@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class MediaSessionClient
|
||||
{
|
||||
public:
|
||||
explicit MediaSessionClient(QObject *parent = nullptr);
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user