aboutsummaryrefslogtreecommitdiffstats
path: root/src/remotesettings
diff options
context:
space:
mode:
authorGrigorii Zimin <gzimin@luxoft.com>2019-07-17 16:24:32 +0300
committerGrigorii Zimin <gzimin@luxoft.com>2019-08-13 10:28:05 +0000
commit992459fa64fd84655ec3a74887cc8f84ed61de05 (patch)
tree4375f58d646f7e0465f1671f32bc42a18f7598cb /src/remotesettings
parent4994f88490876df1e8ce999632f00397f26d5186 (diff)
[companion-app] add music controls
Change-Id: I5c24d6e4d8c577db0a8cf45063cd9d425fe81826 Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com> Reviewed-by: Alexandra Betouni <ABetouni@luxoft.com> Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
Diffstat (limited to 'src/remotesettings')
-rw-r--r--src/remotesettings/app/MediaPage.qml39
-rw-r--r--src/remotesettings/app/app.pro8
-rw-r--r--src/remotesettings/app/assets/ic_pause.png3
-rw-r--r--src/remotesettings/app/assets/ic_play.png3
-rw-r--r--src/remotesettings/app/assets/ic_skipnext.png3
-rw-r--r--src/remotesettings/app/assets/ic_skipprevious.png3
-rw-r--r--src/remotesettings/app/client.cpp10
-rw-r--r--src/remotesettings/app/client.h4
-rw-r--r--src/remotesettings/app/main.qml7
-rw-r--r--src/remotesettings/app/qml.qrc4
10 files changed, 83 insertions, 1 deletions
diff --git a/src/remotesettings/app/MediaPage.qml b/src/remotesettings/app/MediaPage.qml
index 6a80f8c7..523aa7ac 100644
--- a/src/remotesettings/app/MediaPage.qml
+++ b/src/remotesettings/app/MediaPage.qml
@@ -32,6 +32,7 @@ import QtQuick 2.8
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
+import QtIvi.Media 1.0
Flickable {
id: root
@@ -91,5 +92,43 @@ Flickable {
onClicked: uiSettings.muted = checked
}
}
+
+ GridLayout {
+ Row {
+ spacing: 30
+
+ Button {
+ width: 70
+ height: 70
+ icon.source: "qrc:/assets/ic_skipprevious.png"
+ onClicked: {
+ mediaPlayer.previous()
+ }
+ }
+
+ Button {
+ width: 70
+ height: 70
+ icon.source: mediaPlayer.playState === MediaPlayer.Playing
+ ? "qrc:/assets/ic_pause.png" : "qrc:/assets/ic_play.png"
+ onClicked: {
+ if (mediaPlayer.playState === MediaPlayer.Playing) {
+ mediaPlayer.pause()
+ } else {
+ mediaPlayer.play()
+ }
+ }
+ }
+
+ Button {
+ width: 70
+ height: 70
+ icon.source: "qrc:/assets/ic_skipnext.png"
+ onClicked: {
+ mediaPlayer.next()
+ }
+ }
+ }
+ }
}
}
diff --git a/src/remotesettings/app/app.pro b/src/remotesettings/app/app.pro
index 22fd6da5..4e5be427 100644
--- a/src/remotesettings/app/app.pro
+++ b/src/remotesettings/app/app.pro
@@ -1,7 +1,7 @@
VERSION = 5.13.0
TARGET = neptune-companion-app
DESTDIR = $$BUILD_DIR
-QT += quick ivicore
+QT += quick ivicore ivimedia
CONFIG += c++11
macos: CONFIG -= app_bundle
@@ -36,6 +36,12 @@ QMAKE_RPATHDIR += $$QMAKE_REL_RPATH_BASE/$$relative_path($$INSTALL_PREFIX/neptun
QML_IMPORT_PATH += $$BUILD_DIR/imports_shared_cpp
android {
+ copydata.commands = $(COPY_DIR) $$[QT_INSTALL_PLUGINS]/qtivi $$BUILD_DIR/plugins
+ first.depends = $(first) copydata
+ export(first.depends)
+ export(copydata.commands)
+ QMAKE_EXTRA_TARGETS += first copydata
+
#This is used to tell the deployment tool to include these additional
#libs to the apk. This library (libQt5RemoteObjects) is not directly used by the
#app itself, but by the backend plugin.
diff --git a/src/remotesettings/app/assets/ic_pause.png b/src/remotesettings/app/assets/ic_pause.png
new file mode 100644
index 00000000..8eaffc10
--- /dev/null
+++ b/src/remotesettings/app/assets/ic_pause.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7cc802ab84c57b9f175ab3b75f8908bfb73cd8376d8014b30ad436cd613223b3
+size 141
diff --git a/src/remotesettings/app/assets/ic_play.png b/src/remotesettings/app/assets/ic_play.png
new file mode 100644
index 00000000..280a9f2c
--- /dev/null
+++ b/src/remotesettings/app/assets/ic_play.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1bacf02c69f3c0016d9986d28a9d0cb26c754fbd6e114ae3ca38f5483a9a6cd6
+size 512
diff --git a/src/remotesettings/app/assets/ic_skipnext.png b/src/remotesettings/app/assets/ic_skipnext.png
new file mode 100644
index 00000000..3f15ace7
--- /dev/null
+++ b/src/remotesettings/app/assets/ic_skipnext.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3164c2e866101499325d98926283910741fc110c1bf80b3066a3e5103a0faa13
+size 697
diff --git a/src/remotesettings/app/assets/ic_skipprevious.png b/src/remotesettings/app/assets/ic_skipprevious.png
new file mode 100644
index 00000000..4a3ece96
--- /dev/null
+++ b/src/remotesettings/app/assets/ic_skipprevious.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:33efcb814a924dae666354c69c7fc8716ded9ec3827b53d7b66b12ca0109744c
+size 696
diff --git a/src/remotesettings/app/client.cpp b/src/remotesettings/app/client.cpp
index 5e9e56ed..48b500a2 100644
--- a/src/remotesettings/app/client.cpp
+++ b/src/remotesettings/app/client.cpp
@@ -37,16 +37,19 @@ const QString Client::settingsLastUrlsPrefix = QStringLiteral("lastUrls");
const QString Client::settingsLastUrlsItem = QStringLiteral("url");
const QString Client::settingsRemoteSettingsPortItem = QStringLiteral("ports/remoteSettingsPort");
const QString Client::settingsDriveDataPortItem = QStringLiteral("ports/driveDataPort");
+const QString Client::settingsIviMediaPortItem = QStringLiteral("ports/iviMediaPort");
const int Client::numOfUrlsStored = 5;
const int Client::timeoutToleranceMS = 1000;
const int Client::reconnectionIntervalMS = 3000;
const QString Client::defaultUrl = QStringLiteral("tcp://127.0.0.1");
const int Client::defaultRemoteSettingsPort = 9999;
const int Client::defaultDriveDataPort = 9998;
+const int Client::defaultIviMediaPort = 9997;
Client::Client(QObject *parent) : QObject(parent),
m_remoteSettingsPort(defaultRemoteSettingsPort),
m_driveDataPort(defaultDriveDataPort),
+ m_iviMediaPort(defaultIviMediaPort),
m_connected(false),
m_timedOut(false),
m_settings(QStringLiteral("Luxoft Sweden AB"), QStringLiteral("NeptuneCompanionApp"))
@@ -112,9 +115,11 @@ void Client::connectToServer(const QString &serverUrl)
QUrl remoteSettingsUrl(url);
QUrl driveDataUrl(url);
+ QUrl iviMediaUrl(url);
remoteSettingsUrl.setPort(m_remoteSettingsPort);
driveDataUrl.setPort(m_driveDataPort);
+ iviMediaUrl.setPort(m_iviMediaPort);
QSettings settings(m_configPath, QSettings::IniFormat);
settings.beginGroup(QStringLiteral("remotesettings"));
@@ -125,6 +130,10 @@ void Client::connectToServer(const QString &serverUrl)
settings.setValue(QStringLiteral("Registry"), driveDataUrl.toString());
settings.endGroup();
settings.sync();
+ settings.beginGroup(QStringLiteral("qtivimedia"));
+ settings.setValue(QStringLiteral("Registry"), iviMediaUrl.toString());
+ settings.endGroup();
+ settings.sync();
setStatus(tr("Connecting to %1...").arg(url.toString()));
updateLastUrls(url.toString());
@@ -194,6 +203,7 @@ void Client::readSettings()
{
m_remoteSettingsPort = m_settings.value(settingsRemoteSettingsPortItem, defaultRemoteSettingsPort).toInt();
m_driveDataPort = m_settings.value(settingsDriveDataPortItem, defaultDriveDataPort).toInt();
+ m_iviMediaPort = m_settings.value(settingsIviMediaPortItem, defaultIviMediaPort).toInt();
int size=m_settings.beginReadArray(settingsLastUrlsPrefix);
for (int i=0; i<size; i++) {
diff --git a/src/remotesettings/app/client.h b/src/remotesettings/app/client.h
index 3f24af80..e2647bf1 100644
--- a/src/remotesettings/app/client.h
+++ b/src/remotesettings/app/client.h
@@ -55,6 +55,8 @@ class Client : public QObject
static const QString settingsLastUrlsItem;
static const QString settingsRemoteSettingsPortItem;
static const QString settingsDriveDataPortItem;
+ static const QString settingsIviMediaPortItem;
+
static const int numOfUrlsStored;
static const int timeoutToleranceMS;
static const int reconnectionIntervalMS;
@@ -63,6 +65,7 @@ public:
static const QString defaultUrl;
static const int defaultRemoteSettingsPort;
static const int defaultDriveDataPort;
+ static const int defaultIviMediaPort;
explicit Client(QObject *parent = nullptr);
@@ -96,6 +99,7 @@ private:
int m_remoteSettingsPort;
int m_driveDataPort;
+ int m_iviMediaPort;
QUrl m_serverUrl;
QStringList m_lastUrls;
bool m_connected;
diff --git a/src/remotesettings/app/main.qml b/src/remotesettings/app/main.qml
index 17283806..398cb6d4 100644
--- a/src/remotesettings/app/main.qml
+++ b/src/remotesettings/app/main.qml
@@ -33,6 +33,7 @@ import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtIvi 1.0
+import QtIvi.Media 1.0
import shared.com.pelagicore.remotesettings 1.0
import shared.com.pelagicore.drivedata 1.0
@@ -91,6 +92,10 @@ ApplicationWindow {
id: systemUI
}
+ MediaPlayer {
+ id: mediaPlayer
+ }
+
ConnectionDialog {
id: connectionDialog
@@ -105,9 +110,11 @@ ApplicationWindow {
uiSettings.setServiceObject(null);
instrumentCluster.setServiceObject(null);
systemUI.setServiceObject(null);
+ mediaPlayer.setServiceObject(null);
uiSettings.startAutoDiscovery();
instrumentCluster.startAutoDiscovery();
systemUI.startAutoDiscovery();
+ mediaPlayer.startAutoDiscovery();
}
connectionDialog.close();
}
diff --git a/src/remotesettings/app/qml.qrc b/src/remotesettings/app/qml.qrc
index 1e2f497e..6a148ed7 100644
--- a/src/remotesettings/app/qml.qrc
+++ b/src/remotesettings/app/qml.qrc
@@ -31,5 +31,9 @@
<file>assets/ic_trunkClosedVehicle.png</file>
<file>assets/ic_trunkOpenedVehicle.png</file>
<file>DefaultNumberAnimation.qml</file>
+ <file>assets/ic_pause.png</file>
+ <file>assets/ic_play.png</file>
+ <file>assets/ic_skipnext.png</file>
+ <file>assets/ic_skipprevious.png</file>
</qresource>
</RCC>