mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-15 06:52:34 +02:00
Add more video controls
This commit is contained in:
parent
c4c24a1ae8
commit
a500911ad7
@ -115,5 +115,6 @@
|
|||||||
<file>legal/OFL.txt</file>
|
<file>legal/OFL.txt</file>
|
||||||
<file>legal/OpenSSL.txt</file>
|
<file>legal/OpenSSL.txt</file>
|
||||||
<file>legal/Qt LGPLv3.txt</file>
|
<file>legal/Qt LGPLv3.txt</file>
|
||||||
|
<file>qml/Controls/Slider.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -113,11 +113,11 @@ ApplicationWindow {
|
|||||||
if (miMuteAll.isMuted) {
|
if (miMuteAll.isMuted) {
|
||||||
isMuted = false
|
isMuted = false
|
||||||
miMuteAll.text = qsTr("Mute all")
|
miMuteAll.text = qsTr("Mute all")
|
||||||
screenPlay.setWallpaperValue(0, "volume", "1")
|
screenPlay.setAllWallpaperValue("volume", "1")
|
||||||
} else {
|
} else {
|
||||||
isMuted = true
|
isMuted = true
|
||||||
miMuteAll.text = qsTr("Unmute all")
|
miMuteAll.text = qsTr("Unmute all")
|
||||||
screenPlay.setWallpaperValue(0, "volume", "0")
|
screenPlay.setAllWallpaperValue("volume", "0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,11 +129,11 @@ ApplicationWindow {
|
|||||||
if (miStopAll.isPlaying) {
|
if (miStopAll.isPlaying) {
|
||||||
isPlaying = false
|
isPlaying = false
|
||||||
miStopAll.text = qsTr("Pause all")
|
miStopAll.text = qsTr("Pause all")
|
||||||
screenPlay.setWallpaperValue(0, "isPlaying", "false")
|
screenPlay.setAllWallpaperValue("isPlaying", "false")
|
||||||
} else {
|
} else {
|
||||||
isPlaying = true
|
isPlaying = true
|
||||||
miStopAll.text = qsTr("Play all")
|
miStopAll.text = qsTr("Play all")
|
||||||
screenPlay.setWallpaperValue(0, "isPlaying", "true")
|
screenPlay.setAllWallpaperValue("isPlaying", "true")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
70
ScreenPlay/qml/Controls/Slider.qml
Normal file
70
ScreenPlay/qml/Controls/Slider.qml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import QtQuick 2.9
|
||||||
|
import QtQuick.Controls 2.2
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: sliderVolumeWrapperBottom
|
||||||
|
height: 70
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
property string headline: "dummyHeandline"
|
||||||
|
property string iconSource: "qrc:/assets/icons/icon_volume.svg"
|
||||||
|
property alias value: slider.value
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: txtHeadline
|
||||||
|
text: headline
|
||||||
|
height: 20
|
||||||
|
font.pixelSize: 14
|
||||||
|
font.family: "Roboto"
|
||||||
|
color: "#5D5D5D"
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
right: parent.right
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: 30
|
||||||
|
anchors {
|
||||||
|
top: txtHeadline.bottom
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: imgIcon
|
||||||
|
width: 20
|
||||||
|
height: 20
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
source: iconSource
|
||||||
|
sourceSize: Qt.size(20, 20)
|
||||||
|
}
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
id: slider
|
||||||
|
stepSize: 0.01
|
||||||
|
from: 0
|
||||||
|
value: 1
|
||||||
|
to: 1
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: txtValue
|
||||||
|
color: "#818181"
|
||||||
|
text: Math.round(slider.value * 100) / 100
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
font.family: "Libre Baskerville"
|
||||||
|
font.pointSize: 12
|
||||||
|
font.italic: true
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -355,7 +355,8 @@ Item {
|
|||||||
installedListModel.absoluteStoragePath + "/" + activeScreen,
|
installedListModel.absoluteStoragePath + "/" + activeScreen,
|
||||||
installedListModel.get(activeScreen).screenPreview,
|
installedListModel.get(activeScreen).screenPreview,
|
||||||
(Math.round(sliderVolume.value * 100) / 100),
|
(Math.round(sliderVolume.value * 100) / 100),
|
||||||
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString())
|
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString(),
|
||||||
|
type)
|
||||||
sidebar.state = "inactive"
|
sidebar.state = "inactive"
|
||||||
} else if (type === "widget") {
|
} else if (type === "widget") {
|
||||||
screenPlay.createWidget(
|
screenPlay.createWidget(
|
||||||
|
@ -4,16 +4,19 @@ import QtGraphicalEffects 1.0
|
|||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
|
import "Controls/" as SP
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: monitors
|
id: monitors
|
||||||
state: "inactive"
|
state: "inactive"
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
property string activeMonitorName: ""
|
property string activeMonitorName: ""
|
||||||
|
property int activeMonitorIndex
|
||||||
|
|
||||||
onStateChanged: {
|
onStateChanged: {
|
||||||
bgMouseArea.focus = monitors.state == "active" ? true : false
|
bgMouseArea.focus = monitors.state == "active" ? true : false
|
||||||
if(monitors.state === "active"){
|
if (monitors.state === "active") {
|
||||||
screenPlay.requestProjectSettingsListModelAt(0)
|
screenPlay.requestProjectSettingsListModelAt(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,17 +88,27 @@ Item {
|
|||||||
availableHeight: 150
|
availableHeight: 150
|
||||||
onRequestProjectSettings: {
|
onRequestProjectSettings: {
|
||||||
// This will return in the connection with target: screenPlay
|
// This will return in the connection with target: screenPlay
|
||||||
print(at)
|
|
||||||
screenPlay.requestProjectSettingsListModelAt(at)
|
screenPlay.requestProjectSettingsListModelAt(at)
|
||||||
|
activeMonitorIndex = at
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: screenPlay
|
target: screenPlay
|
||||||
onProjectSettingsListModelFound: {
|
onProjectSettingsListModelFound: {
|
||||||
print("found")
|
|
||||||
gridView.model = li
|
gridView.model = li
|
||||||
|
// TODO via states
|
||||||
|
if (type == "video") {
|
||||||
|
videoControlWrapper.z = 10
|
||||||
|
gridView.z = 0
|
||||||
|
videoControlWrapper.visible = true
|
||||||
|
gridView.visible = false
|
||||||
|
} else {
|
||||||
|
videoControlWrapper.visible = false
|
||||||
|
gridView.visible = true
|
||||||
|
videoControlWrapper.z = 0
|
||||||
|
gridView.z = 10
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onProjectSettingsListModelNotFound: {
|
onProjectSettingsListModelNotFound: {
|
||||||
print("not found")
|
|
||||||
gridView.model = null
|
gridView.model = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,8 +131,26 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Column {
|
||||||
|
id: videoControlWrapper
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
topMargin: 60
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
margins: 30
|
||||||
|
left: itmLeftWrapper.right
|
||||||
|
}
|
||||||
|
|
||||||
|
SP.Slider {
|
||||||
|
headline: qsTr("Volume")
|
||||||
|
onValueChanged: screenPlay.setWallpaperValue(activeMonitorIndex,"volume", value)
|
||||||
|
}
|
||||||
|
SP.Slider {
|
||||||
|
headline: qsTr("Playback rate")
|
||||||
|
onValueChanged: screenPlay.setWallpaperValue(activeMonitorIndex,"playbackRate", value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GridView {
|
GridView {
|
||||||
id: gridView
|
id: gridView
|
||||||
@ -246,3 +277,8 @@ Item {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*##^## Designer {
|
||||||
|
D{i:0;autoSize:true;height:500;width:1000}
|
||||||
|
}
|
||||||
|
##^##*/
|
||||||
|
@ -8,10 +8,9 @@ ScreenPlay::ScreenPlay(InstalledListModel* ilm, Settings* set, MonitorListModel*
|
|||||||
m_mlm = mlm;
|
m_mlm = mlm;
|
||||||
m_qGuiApplication = qGuiApplication;
|
m_qGuiApplication = qGuiApplication;
|
||||||
m_sdkc = sdkc;
|
m_sdkc = sdkc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenPlay::createWallpaper(int monitorIndex, QUrl absoluteStoragePath, QString previewImage, float volume, QString fillMode)
|
void ScreenPlay::createWallpaper(int monitorIndex, QUrl absoluteStoragePath, QString previewImage, float volume, QString fillMode, QString type)
|
||||||
{
|
{
|
||||||
ProjectFile project;
|
ProjectFile project;
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ void ScreenPlay::createWallpaper(int monitorIndex, QUrl absoluteStoragePath, QSt
|
|||||||
m_settings->increaseActiveWallpaperCounter();
|
m_settings->increaseActiveWallpaperCounter();
|
||||||
QVector<int> tmpMonitorIndex;
|
QVector<int> tmpMonitorIndex;
|
||||||
tmpMonitorIndex.append(monitorIndex);
|
tmpMonitorIndex.append(monitorIndex);
|
||||||
m_screenPlayWallpaperList.append(QSharedPointer<ScreenPlayWallpaper>(new ScreenPlayWallpaper(tmpMonitorIndex, absoluteStoragePath.toString(), previewImage, volume, fillMode, this)));
|
m_screenPlayWallpaperList.append(QSharedPointer<ScreenPlayWallpaper>(new ScreenPlayWallpaper(tmpMonitorIndex, absoluteStoragePath.toString(), previewImage, volume, fillMode, type, this)));
|
||||||
|
|
||||||
m_mlm->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), absoluteStoragePath.toString() + "/" + previewImage);
|
m_mlm->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), absoluteStoragePath.toString() + "/" + previewImage);
|
||||||
}
|
}
|
||||||
@ -54,7 +53,8 @@ void ScreenPlay::requestProjectSettingsListModelAt(int index)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < m_screenPlayWallpaperList.count(); ++i) {
|
for (int i = 0; i < m_screenPlayWallpaperList.count(); ++i) {
|
||||||
if (m_screenPlayWallpaperList.at(i).data()->screenNumber().at(0) == index) {
|
if (m_screenPlayWallpaperList.at(i).data()->screenNumber().at(0) == index) {
|
||||||
emit projectSettingsListModelFound(m_screenPlayWallpaperList.at(i).data()->projectSettingsListModel().data());
|
emit projectSettingsListModelFound(m_screenPlayWallpaperList.at(i).data()->projectSettingsListModel().data(),
|
||||||
|
m_screenPlayWallpaperList.at(i).get()->type());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,13 +80,19 @@ void ScreenPlay::setWallpaperValue(int at, QString key, QString value)
|
|||||||
|
|
||||||
for (int i = 0; i < m_screenPlayWallpaperList.count(); ++i) {
|
for (int i = 0; i < m_screenPlayWallpaperList.count(); ++i) {
|
||||||
if (m_screenPlayWallpaperList.at(i).data()->screenNumber().at(0) == at) {
|
if (m_screenPlayWallpaperList.at(i).data()->screenNumber().at(0) == at) {
|
||||||
|
|
||||||
m_sdkc->setWallpaperValue(m_screenPlayWallpaperList.at(i).data()->appID(), key, value);
|
m_sdkc->setWallpaperValue(m_screenPlayWallpaperList.at(i).data()->appID(), key, value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenPlay::setAllWallpaperValue(QString key, QString value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_screenPlayWallpaperList.count(); ++i) {
|
||||||
|
m_sdkc->setWallpaperValue(m_screenPlayWallpaperList.at(i).data()->appID(), key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenPlay::removeWallpaperAt(int at)
|
void ScreenPlay::removeWallpaperAt(int at)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_screenPlayWallpaperList.length(); ++i) {
|
for (int i = 0; i < m_screenPlayWallpaperList.length(); ++i) {
|
||||||
@ -102,7 +108,7 @@ void ScreenPlay::removeWallpaperAt(int at)
|
|||||||
QVector<int> ScreenPlay::getMonitorByAppID(QString appID)
|
QVector<int> ScreenPlay::getMonitorByAppID(QString appID)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_screenPlayWallpaperList.length(); ++i) {
|
for (int i = 0; i < m_screenPlayWallpaperList.length(); ++i) {
|
||||||
if(m_screenPlayWallpaperList.at(i).data()->appID() == appID){
|
if (m_screenPlayWallpaperList.at(i).data()->appID() == appID) {
|
||||||
return m_screenPlayWallpaperList.at(i).data()->screenNumber();
|
return m_screenPlayWallpaperList.at(i).data()->screenNumber();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,15 +39,16 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void allWallpaperRemoved();
|
void allWallpaperRemoved();
|
||||||
void projectSettingsListModelFound(ProjectSettingsListModel* li);
|
void projectSettingsListModelFound(ProjectSettingsListModel* li,QString type);
|
||||||
void projectSettingsListModelNotFound();
|
void projectSettingsListModelNotFound();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void createWallpaper(int monitorIndex, QUrl absoluteStoragePath, QString previewImage, float volume, QString fillMode);
|
void createWallpaper(int monitorIndex, QUrl absoluteStoragePath, QString previewImage, float volume, QString fillMode, QString type);
|
||||||
void createWidget(QUrl absoluteStoragePath, QString previewImage);
|
void createWidget(QUrl absoluteStoragePath, QString previewImage);
|
||||||
void removeAllWallpaper();
|
void removeAllWallpaper();
|
||||||
void requestProjectSettingsListModelAt(int index);
|
void requestProjectSettingsListModelAt(int index);
|
||||||
void setWallpaperValue(int at, QString key, QString value);
|
void setWallpaperValue(int at, QString key, QString value);
|
||||||
|
void setAllWallpaperValue(QString key, QString value);
|
||||||
void removeWallpaperAt(int at);
|
void removeWallpaperAt(int at);
|
||||||
QVector<int> getMonitorByAppID(QString appID);
|
QVector<int> getMonitorByAppID(QString appID);
|
||||||
QString generateID();
|
QString generateID();
|
||||||
@ -64,13 +65,15 @@ class ScreenPlayWallpaper : public QObject {
|
|||||||
Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged)
|
Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged)
|
||||||
Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged)
|
Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged)
|
||||||
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
|
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
|
||||||
|
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ScreenPlayWallpaper(QVector<int> screenNumber, QString projectPath, QString previewImage, float volume, QString fillMode, ScreenPlay* parent)
|
explicit ScreenPlayWallpaper(QVector<int> screenNumber, QString projectPath, QString previewImage, float volume, QString fillMode, QString type, ScreenPlay* parent)
|
||||||
{
|
{
|
||||||
m_screenNumber = screenNumber;
|
m_screenNumber = screenNumber;
|
||||||
m_projectPath = projectPath;
|
m_projectPath = projectPath;
|
||||||
m_previewImage = previewImage;
|
m_previewImage = previewImage;
|
||||||
|
m_type = type;
|
||||||
|
|
||||||
// We do not want to parent the QProcess because the
|
// We do not want to parent the QProcess because the
|
||||||
// Process manages its lifetime and destructing (animation) itself
|
// Process manages its lifetime and destructing (animation) itself
|
||||||
@ -88,7 +91,7 @@ public:
|
|||||||
proArgs.append(QString::number(m_screenNumber.at(0)));
|
proArgs.append(QString::number(m_screenNumber.at(0)));
|
||||||
proArgs.append(m_projectPath);
|
proArgs.append(m_projectPath);
|
||||||
m_appID = parent->generateID();
|
m_appID = parent->generateID();
|
||||||
proArgs.append("appID="+m_appID);
|
proArgs.append("appID=" + m_appID);
|
||||||
proArgs.append(parent->m_settings->decoder());
|
proArgs.append(parent->m_settings->decoder());
|
||||||
proArgs.append(QString::number(volume));
|
proArgs.append(QString::number(volume));
|
||||||
proArgs.append(fillMode);
|
proArgs.append(fillMode);
|
||||||
@ -98,6 +101,11 @@ public:
|
|||||||
m_projectSettingsListModel = QSharedPointer<ProjectSettingsListModel>(new ProjectSettingsListModel(projectPath + "/project.json"));
|
m_projectSettingsListModel = QSharedPointer<ProjectSettingsListModel>(new ProjectSettingsListModel(projectPath + "/project.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~ScreenPlayWallpaper()
|
||||||
|
{
|
||||||
|
qDebug() << "Destructing wallpaper " << m_appID;
|
||||||
|
}
|
||||||
|
|
||||||
QSharedPointer<ProjectSettingsListModel> projectSettingsListModel() const;
|
QSharedPointer<ProjectSettingsListModel> projectSettingsListModel() const;
|
||||||
|
|
||||||
QVector<int> screenNumber() const
|
QVector<int> screenNumber() const
|
||||||
@ -120,6 +128,11 @@ public:
|
|||||||
return m_appID;
|
return m_appID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString type() const
|
||||||
|
{
|
||||||
|
return m_type;
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void screenNumberChanged(QVector<int> screenNumber);
|
void screenNumberChanged(QVector<int> screenNumber);
|
||||||
void projectPathChanged(QString projectPath);
|
void projectPathChanged(QString projectPath);
|
||||||
@ -127,6 +140,8 @@ signals:
|
|||||||
void projectSettingsListModelAt(ProjectSettingsListModel* li);
|
void projectSettingsListModelAt(ProjectSettingsListModel* li);
|
||||||
void appIDChanged(QString appID);
|
void appIDChanged(QString appID);
|
||||||
|
|
||||||
|
void typeChanged(QString type);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void setScreenNumber(QVector<int> screenNumber)
|
void setScreenNumber(QVector<int> screenNumber)
|
||||||
@ -165,14 +180,25 @@ public slots:
|
|||||||
emit appIDChanged(m_appID);
|
emit appIDChanged(m_appID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setType(QString type)
|
||||||
|
{
|
||||||
|
if (m_type == type)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_type = type;
|
||||||
|
emit typeChanged(m_type);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<int> m_screenNumber;
|
QVector<int> m_screenNumber;
|
||||||
QString m_projectPath;
|
QString m_projectPath;
|
||||||
QString m_previewImage;
|
QString m_previewImage;
|
||||||
QProcess* m_process;
|
QProcess* m_process;
|
||||||
|
|
||||||
QSharedPointer<ProjectSettingsListModel> m_projectSettingsListModel;
|
QSharedPointer<ProjectSettingsListModel> m_projectSettingsListModel;
|
||||||
|
|
||||||
QString m_appID;
|
QString m_appID;
|
||||||
|
QString m_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScreenPlayWidget : public QObject {
|
class ScreenPlayWidget : public QObject {
|
||||||
@ -198,7 +224,6 @@ public:
|
|||||||
proArgs.append(m_appID);
|
proArgs.append(m_appID);
|
||||||
m_process->setArguments(proArgs);
|
m_process->setArguments(proArgs);
|
||||||
|
|
||||||
|
|
||||||
if (fullPath.endsWith(".exe")) {
|
if (fullPath.endsWith(".exe")) {
|
||||||
m_process->setProgram(fullPath);
|
m_process->setProgram(fullPath);
|
||||||
} else if (fullPath.endsWith(".qml")) {
|
} else if (fullPath.endsWith(".qml")) {
|
||||||
|
@ -17,7 +17,7 @@ void redirectMessageOutputToMainWindow(QtMsgType type, const QMessageLogContext&
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
localMsg = "Debug " /*+ QByteArray::fromStdString(global_sdkPtr->contentType().toStdString()) + " "*/ + localMsg;
|
localMsg = "SDK START: " /*+ QByteArray::fromStdString(global_sdkPtr->contentType().toStdString()) + " "*/ + localMsg + " SDK END!";
|
||||||
global_sdkPtr->redirectMessage(localMsg);
|
global_sdkPtr->redirectMessage(localMsg);
|
||||||
break;
|
break;
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
@ -74,6 +74,7 @@ void ScreenPlaySDK::bytesWritten(qint64 bytes)
|
|||||||
void ScreenPlaySDK::readyRead()
|
void ScreenPlaySDK::readyRead()
|
||||||
{
|
{
|
||||||
QString tmp = m_socket.readAll();
|
QString tmp = m_socket.readAll();
|
||||||
|
qDebug() << "SDK MESSAGE RECEIVED: " << tmp;
|
||||||
QJsonParseError err;
|
QJsonParseError err;
|
||||||
auto doc = QJsonDocument::fromJson(QByteArray::fromStdString(tmp.toStdString()), &err);
|
auto doc = QJsonDocument::fromJson(QByteArray::fromStdString(tmp.toStdString()), &err);
|
||||||
|
|
||||||
@ -101,5 +102,6 @@ void ScreenPlaySDK::redirectMessage(QByteArray& msg)
|
|||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
m_socket.write(msg);
|
m_socket.write(msg);
|
||||||
m_socket.waitForBytesWritten();
|
m_socket.waitForBytesWritten();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,14 +41,13 @@ public:
|
|||||||
return m_appID;
|
return m_appID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void connected();
|
void connected();
|
||||||
void disconnected();
|
void disconnected();
|
||||||
void bytesWritten(qint64 bytes);
|
void bytesWritten(qint64 bytes);
|
||||||
void readyRead();
|
void readyRead();
|
||||||
void error(QLocalSocket::LocalSocketError socketError);
|
void error(QLocalSocket::LocalSocketError socketError);
|
||||||
void redirectMessage(QByteArray &msg);
|
void redirectMessage(QByteArray& msg);
|
||||||
|
|
||||||
void setContentType(QString contentType)
|
void setContentType(QString contentType)
|
||||||
{
|
{
|
||||||
@ -86,9 +85,6 @@ public slots:
|
|||||||
m_socket.waitForBytesWritten();
|
m_socket.waitForBytesWritten();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
//qint64 writeData(const char *data, qint64 c) override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void incommingMessage(QString key, QString value);
|
void incommingMessage(QString key, QString value);
|
||||||
void incommingMessageError(QString msg);
|
void incommingMessageError(QString msg);
|
||||||
@ -100,7 +96,7 @@ signals:
|
|||||||
void isConnectedChanged(bool isConnected);
|
void isConnectedChanged(bool isConnected);
|
||||||
|
|
||||||
void appIDChanged(QString appID);
|
void appIDChanged(QString appID);
|
||||||
void newRedirectMessage(QByteArray &msg);
|
void newRedirectMessage(QByteArray& msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLocalSocket m_socket;
|
QLocalSocket m_socket;
|
||||||
|
@ -11,7 +11,7 @@ Rectangle {
|
|||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
onMessageReceived: {
|
onQmlSceneValueReceived: {
|
||||||
var obj2 = 'import QtQuick 2.9; Item {Component.onCompleted: loader.item.'
|
var obj2 = 'import QtQuick 2.9; Item {Component.onCompleted: loader.item.'
|
||||||
+ key + ' = ' + value + '; }'
|
+ key + ' = ' + value + '; }'
|
||||||
var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
|
var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
|
||||||
|
@ -141,6 +141,59 @@ void MainWindow::init()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::messageReceived(QString key, QString value)
|
||||||
|
{
|
||||||
|
if (key == "decoder") {
|
||||||
|
setDecoder(value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == "volume") {
|
||||||
|
bool ok = false;
|
||||||
|
auto tmp = value.toFloat(&ok);
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
setVolume(tmp);
|
||||||
|
else
|
||||||
|
qDebug() << "ERROR with " << key << " " << value;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == "fillmode") {
|
||||||
|
setFillMode(value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == "isPlaying") {
|
||||||
|
if (value == "true")
|
||||||
|
setIsPlaying(true);
|
||||||
|
else
|
||||||
|
setIsPlaying(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == "playbackRate") {
|
||||||
|
bool ok = false;
|
||||||
|
auto tmp = value.toFloat(&ok);
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
setPlaybackRate(tmp);
|
||||||
|
else
|
||||||
|
qDebug() << "ERROR with " << key << " " << value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == "loops") {
|
||||||
|
if (value == "true")
|
||||||
|
setLoops(true);
|
||||||
|
else
|
||||||
|
setLoops(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit qmlSceneValueReceived(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::destroyThis()
|
void MainWindow::destroyThis()
|
||||||
{
|
{
|
||||||
|
@ -101,6 +101,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void destroyThis();
|
void destroyThis();
|
||||||
void init();
|
void init();
|
||||||
|
void messageReceived(QString key, QString value);
|
||||||
|
|
||||||
QString getApplicationPath()
|
QString getApplicationPath()
|
||||||
{
|
{
|
||||||
@ -220,10 +221,9 @@ signals:
|
|||||||
void loopsChanged(bool loops);
|
void loopsChanged(bool loops);
|
||||||
void volumeChanged(float volume);
|
void volumeChanged(float volume);
|
||||||
void fullContentPathChanged(QString fullContentPath);
|
void fullContentPathChanged(QString fullContentPath);
|
||||||
void messageReceived(QString key, QString value);
|
|
||||||
void isPlayingChanged(bool isPlaying);
|
void isPlayingChanged(bool isPlaying);
|
||||||
void playbackRateChanged(float playbackRate);
|
void playbackRateChanged(float playbackRate);
|
||||||
|
void qmlSceneValueReceived(QString key, QString value);
|
||||||
void decoderChanged(QString decoder);
|
void decoderChanged(QString decoder);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user