1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 18:52:30 +01:00

Add html support

This commit is contained in:
kelteseth 2018-09-21 16:25:31 +02:00
parent 544b603cfa
commit d0219191c0
6 changed files with 38 additions and 21 deletions

View File

@ -240,6 +240,13 @@ ApplicationWindow {
} else { } else {
sidebar.state = "activeScene" sidebar.state = "activeScene"
} }
} else if (type === "html") {
if (sidebar.activeScreen == screenId
&& sidebar.state == "activeScene") {
sidebar.state = "inactive"
} else {
sidebar.state = "activeScene"
}
} }
sidebar.activeScreen = screenId sidebar.activeScreen = screenId
sidebar.type = type sidebar.type = type

View File

@ -12,6 +12,8 @@ Item {
state: "inactive" state: "inactive"
focus: true focus: true
property real navHeight property real navHeight
property string type
property string activeScreen
MouseArea { MouseArea {
id: mouseAreaHelper id: mouseAreaHelper
@ -19,7 +21,6 @@ Item {
enabled: true enabled: true
} }
property string activeScreen
onActiveScreenChanged: { onActiveScreenChanged: {
txtHeadline.text = installedListModel.get(activeScreen).screenTitle txtHeadline.text = installedListModel.get(activeScreen).screenTitle
image.source = Qt.resolvedUrl( image.source = Qt.resolvedUrl(
@ -28,9 +29,6 @@ Item {
activeScreen).screenPreview) activeScreen).screenPreview)
} }
property string type
Item { Item {
id: sidebarWrapper id: sidebarWrapper
@ -349,16 +347,18 @@ Item {
} }
onClicked: { onClicked: {
if (type === "video" || type === "qmlScene") { print(type + " "+activeScreen + " " + installedListModel.absoluteStoragePath+ "/" + activeScreen,
installedListModel.get(
activeScreen).screenPreview)
if (type === "video" || type === "qmlScene" || type === "html") {
screenPlay.createWallpaper( screenPlay.createWallpaper(
monitorSelection.activeMonitorIndex, monitorSelection.activeMonitorIndex, 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) ), type)
sidebar.state = "inactive" sidebar.state = "inactive"
} else if (type === "widget") { } else if (type === "widget" ) {
screenPlay.createWidget( screenPlay.createWidget(
installedListModel.absoluteStoragePath + "/" + activeScreen, installedListModel.absoluteStoragePath + "/" + activeScreen,
installedListModel.get( installedListModel.get(

View File

@ -46,7 +46,7 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const
QHash<int, QByteArray> InstalledListModel::roleNames() const QHash<int, QByteArray> InstalledListModel::roleNames() const
{ {
static const QHash<int, QByteArray> roles{ static const QHash<int, QByteArray> roles {
{ TitleRole, "screenTitle" }, { TitleRole, "screenTitle" },
{ TypeRole, "screenType" }, { TypeRole, "screenType" },
{ PreviewRole, "screenPreview" }, { PreviewRole, "screenPreview" },
@ -116,14 +116,14 @@ void InstalledListModel::loadScreens()
continue; continue;
//Some settings dont have a file type //Some settings dont have a file type
QString fileEnding; QString fileEnding;
if (obj.contains("file")) { if (obj.contains("file")) {
fileEnding = obj.value("file").toString(); fileEnding = obj.value("file").toString();
if (!obj.contains("type")) { if (!obj.contains("type")) {
obj.insert("type", "video"); obj.insert("type", "video");
} }
if (fileEnding.endsWith(".webm") || (obj.value("type").toString() == "qmlScene")) qDebug() << fileEnding << obj.value("type");
if (fileEnding.endsWith(".webm") || (obj.value("type").toString() == "qmlScene") || fileEnding.endsWith(".html"))
emit addInstalledItem(obj, item.baseName()); emit addInstalledItem(obj, item.baseName());
} }
} }

View File

@ -16,24 +16,24 @@ ProjectFile::ProjectFile(QJsonObject obj, QString folderName, QUrl absolutePath)
m_title = obj.value("title"); m_title = obj.value("title");
if (obj.contains("type")) { if (obj.contains("type")) {
QString tmp = obj.value("type").toString(); QString tmp = obj.value("type").toString().toLower();
tmp = tmp.toLower();
if (tmp == "video") { if (tmp == "video") {
m_type = "video"; m_type = "video";
} else if (tmp == "qmlwidget" || tmp == "standalonewidget") { } else if (tmp == "qmlwidget" || tmp == "standalonewidget") {
m_type = "widget"; m_type = "widget";
} else if (tmp == "qmlscene") { } else if (tmp == "qmlscene") {
m_type = "qmlScene"; m_type = "qmlScene";
} else if (tmp == "html") {
m_type = "html";
} }
} }
if (obj.contains("workshopid")){ if (obj.contains("workshopid")) {
m_workshopID = obj.value("workshopid").toInt(); m_workshopID = obj.value("workshopid").toInt();
} else { } else {
m_workshopID = 0; m_workshopID = 0;
} }
m_absoluteStoragePath = QUrl(absolutePath.toString() + "/" + folderName); m_absoluteStoragePath = QUrl(absolutePath.toString() + "/" + folderName);
m_folderId = folderName; m_folderId = folderName;
@ -46,5 +46,3 @@ ProjectFile::ProjectFile()
ProjectFile::~ProjectFile() ProjectFile::~ProjectFile()
{ {
} }

View File

@ -8,13 +8,15 @@ Rectangle {
Connections { Connections {
target: mainwindow target: mainwindow
onQmlExit:{ onQmlExit: {
webView.runJavaScript( webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;") "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;")
mainwindow.destroyThis() mainwindow.destroyThis()
} }
onFillModeChanged: { onFillModeChanged: {
//TODO //TODO
} }
@ -70,6 +72,12 @@ Rectangle {
webView.url = Qt.resolvedUrl( webView.url = Qt.resolvedUrl(
"file:///" + mainwindow.getApplicationPath( "file:///" + mainwindow.getApplicationPath(
) + "/index.html") ) + "/index.html")
} else if (mainwindow.type === "html") {
webView.visible = true
webView.url = Qt.resolvedUrl(
"file:///" + mainwindow.fullContentPath)
mainwindow.init()
timer.start()
} }
} }

View File

@ -66,6 +66,10 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder,
QString tmpPath = m_projectPath.toString() + "/" + m_projectFile; QString tmpPath = m_projectPath.toString() + "/" + m_projectFile;
setFullContentPath(tmpPath); setFullContentPath(tmpPath);
setType("qmlScene"); setType("qmlScene");
} else if (m_project.value("type") == "html") {
QString tmpPath = m_projectPath.toString() + "/" + m_projectFile;
setFullContentPath(tmpPath);
setType("html");
} }
} }