mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 10:43:45 +02:00
saving work
This commit is contained in:
parent
2a997f2a4d
commit
8c020a0ec2
6 changed files with 58 additions and 17 deletions
|
@ -98,25 +98,15 @@ Rectangle {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HifiControls.Button {
|
HifiControls.Button {
|
||||||
id: load
|
id: browse
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: selectedFile.bottom
|
anchors.top: selectedFile.bottom
|
||||||
anchors.topMargin: 10
|
anchors.topMargin: 10
|
||||||
|
|
||||||
text: "Load"
|
text: "Load..."
|
||||||
color: hifi.buttons.black
|
|
||||||
enabled: true
|
|
||||||
onClicked: sendToScript({method: "Load", params: {file: path }});
|
|
||||||
}
|
|
||||||
|
|
||||||
HifiControls.Button {
|
|
||||||
id: browse
|
|
||||||
anchors.right: load.left
|
|
||||||
anchors.top: selectedFile.bottom
|
|
||||||
anchors.topMargin: 10
|
|
||||||
|
|
||||||
text: "Browse"
|
|
||||||
color: hifi.buttons.black
|
color: hifi.buttons.black
|
||||||
enabled: true
|
enabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -146,6 +136,25 @@ Rectangle {
|
||||||
function getFileSelected(file) {
|
function getFileSelected(file) {
|
||||||
selectedFile.text = file;
|
selectedFile.text = file;
|
||||||
inputRecorder.path = file;
|
inputRecorder.path = file;
|
||||||
|
sendToScript({method: "Load", params: {file: path }});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fromScript(message) {
|
||||||
|
switch (message.method) {
|
||||||
|
case "update":
|
||||||
|
updateButtonStatus(message.params);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateButtonStatus(status) {
|
||||||
|
inputRecorder.recording = status;
|
||||||
|
|
||||||
|
if (inputRecorder.recording) {
|
||||||
|
start.text = "Stop Recording";
|
||||||
|
} else {
|
||||||
|
start.text = "Start Recording";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,4 @@ GroupSources("src/controllers")
|
||||||
|
|
||||||
add_dependency_external_projects(glm)
|
add_dependency_external_projects(glm)
|
||||||
find_package(GLM REQUIRED)
|
find_package(GLM REQUIRED)
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS} "${CMAKE_BINARY_DIR}/includes")
|
||||||
|
|
|
@ -17,9 +17,14 @@
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <GLMHelpers.h>
|
#include <QStandardPaths>
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
QString SAVE_DIRECTORY = QDir::homePath()+"/hifi-input-recordings/";
|
#include <BuildInfo.h>
|
||||||
|
#include <GLMHelpers.h>
|
||||||
|
|
||||||
|
QString SAVE_DIRECTORY = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/" + BuildInfo::INTERFACE_NAME +
|
||||||
|
"/interface" + "/hifi-input-recordings/";
|
||||||
QString FILE_PREFIX_NAME = "input-recording-";
|
QString FILE_PREFIX_NAME = "input-recording-";
|
||||||
QString COMPRESS_EXTENSION = ".tar.gz";
|
QString COMPRESS_EXTENSION = ".tar.gz";
|
||||||
namespace controller {
|
namespace controller {
|
||||||
|
|
|
@ -26,6 +26,10 @@ QStringList FileDialogHelper::standardPath(StandardLocation location) {
|
||||||
return QStandardPaths::standardLocations(static_cast<QStandardPaths::StandardLocation>(location));
|
return QStandardPaths::standardLocations(static_cast<QStandardPaths::StandardLocation>(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString FileDialogHelper::writableLocation(StandardLocation location) {
|
||||||
|
return QStandardPaths::writableLocation(static_cast<QStandardPaths::StandardLocation>(location));
|
||||||
|
}
|
||||||
|
|
||||||
QString FileDialogHelper::urlToPath(const QUrl& url) {
|
QString FileDialogHelper::urlToPath(const QUrl& url) {
|
||||||
return url.toLocalFile();
|
return url.toLocalFile();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE QUrl home();
|
Q_INVOKABLE QUrl home();
|
||||||
Q_INVOKABLE QStringList standardPath(StandardLocation location);
|
Q_INVOKABLE QStringList standardPath(StandardLocation location);
|
||||||
|
Q_INVOKABLE QString writableLocation(StandardLocation location);
|
||||||
Q_INVOKABLE QStringList drives();
|
Q_INVOKABLE QStringList drives();
|
||||||
Q_INVOKABLE QString urlToPath(const QUrl& url);
|
Q_INVOKABLE QString urlToPath(const QUrl& url);
|
||||||
Q_INVOKABLE bool urlIsDir(const QUrl& url);
|
Q_INVOKABLE bool urlIsDir(const QUrl& url);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
var recording = false;
|
||||||
var onRecordingScreen = false;
|
var onRecordingScreen = false;
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var button = tablet.addButton({
|
var button = tablet.addButton({
|
||||||
|
@ -15,13 +16,20 @@
|
||||||
function onClick() {
|
function onClick() {
|
||||||
if (onRecordingScreen) {
|
if (onRecordingScreen) {
|
||||||
tablet.gotoHomeScreen();
|
tablet.gotoHomeScreen();
|
||||||
|
onRecordingScreen = false;
|
||||||
} else {
|
} else {
|
||||||
tablet.loadQMLSource("InputRecorder.qml");
|
tablet.loadQMLSource("InputRecorder.qml");
|
||||||
|
onRecordingScreen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onScreenChanged(type, url) {
|
||||||
|
onRecordingScreen = false;
|
||||||
|
}
|
||||||
|
|
||||||
button.clicked.connect(onClick);
|
button.clicked.connect(onClick);
|
||||||
tablet.fromQml.connect(fromQml);
|
tablet.fromQml.connect(fromQml);
|
||||||
|
tablet.screenChanged.connect(onScreenChanged);
|
||||||
function fromQml(message) {
|
function fromQml(message) {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case "Start":
|
case "Start":
|
||||||
|
@ -45,10 +53,12 @@
|
||||||
|
|
||||||
function startRecording() {
|
function startRecording() {
|
||||||
Controller.startInputRecording();
|
Controller.startInputRecording();
|
||||||
|
recording = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopRecording() {
|
function stopRecording() {
|
||||||
Controller.stopInputRecording();
|
Controller.stopInputRecording();
|
||||||
|
recording = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveRecording() {
|
function saveRecording() {
|
||||||
|
@ -63,11 +73,23 @@
|
||||||
Controller.startInputPlayback();
|
Controller.startInputPlayback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendToQml(message) {
|
||||||
|
tablet.sendToQml(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
sendToQml({method: "update", params: recording});
|
||||||
|
}
|
||||||
|
|
||||||
|
Script.setInterval(update, 60);
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
button.clicked.disconnect(onClick);
|
button.clicked.disconnect(onClick);
|
||||||
if (tablet) {
|
if (tablet) {
|
||||||
tablet.removeButton(button);
|
tablet.removeButton(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Controller.stopInputRecording();
|
||||||
});
|
});
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
Loading…
Reference in a new issue