mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 14:14:07 +02:00
saving work
This commit is contained in:
parent
2a997f2a4d
commit
8c020a0ec2
6 changed files with 58 additions and 17 deletions
interface/resources/qml/hifi/tablet
libraries
controllers
ui/src
scripts/developer
|
@ -98,25 +98,15 @@ Rectangle {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
HifiControls.Button {
|
||||
id: load
|
||||
id: browse
|
||||
anchors.right: parent.right
|
||||
anchors.top: selectedFile.bottom
|
||||
anchors.topMargin: 10
|
||||
|
||||
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"
|
||||
text: "Load..."
|
||||
color: hifi.buttons.black
|
||||
enabled: true
|
||||
onClicked: {
|
||||
|
@ -146,6 +136,25 @@ Rectangle {
|
|||
function getFileSelected(file) {
|
||||
selectedFile.text = 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)
|
||||
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 <QDateTime>
|
||||
#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 COMPRESS_EXTENSION = ".tar.gz";
|
||||
namespace controller {
|
||||
|
|
|
@ -26,6 +26,10 @@ QStringList FileDialogHelper::standardPath(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) {
|
||||
return url.toLocalFile();
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
|
||||
Q_INVOKABLE QUrl home();
|
||||
Q_INVOKABLE QStringList standardPath(StandardLocation location);
|
||||
Q_INVOKABLE QString writableLocation(StandardLocation location);
|
||||
Q_INVOKABLE QStringList drives();
|
||||
Q_INVOKABLE QString urlToPath(const QUrl& url);
|
||||
Q_INVOKABLE bool urlIsDir(const QUrl& url);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//
|
||||
|
||||
(function() {
|
||||
var recording = false;
|
||||
var onRecordingScreen = false;
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var button = tablet.addButton({
|
||||
|
@ -15,13 +16,20 @@
|
|||
function onClick() {
|
||||
if (onRecordingScreen) {
|
||||
tablet.gotoHomeScreen();
|
||||
onRecordingScreen = false;
|
||||
} else {
|
||||
tablet.loadQMLSource("InputRecorder.qml");
|
||||
onRecordingScreen = true;
|
||||
}
|
||||
}
|
||||
|
||||
function onScreenChanged(type, url) {
|
||||
onRecordingScreen = false;
|
||||
}
|
||||
|
||||
button.clicked.connect(onClick);
|
||||
tablet.fromQml.connect(fromQml);
|
||||
tablet.screenChanged.connect(onScreenChanged);
|
||||
function fromQml(message) {
|
||||
switch (message.method) {
|
||||
case "Start":
|
||||
|
@ -45,10 +53,12 @@
|
|||
|
||||
function startRecording() {
|
||||
Controller.startInputRecording();
|
||||
recording = true;
|
||||
}
|
||||
|
||||
function stopRecording() {
|
||||
Controller.stopInputRecording();
|
||||
recording = false;
|
||||
}
|
||||
|
||||
function saveRecording() {
|
||||
|
@ -63,11 +73,23 @@
|
|||
Controller.startInputPlayback();
|
||||
}
|
||||
|
||||
function sendToQml(message) {
|
||||
tablet.sendToQml(message);
|
||||
}
|
||||
|
||||
function update() {
|
||||
sendToQml({method: "update", params: recording});
|
||||
}
|
||||
|
||||
Script.setInterval(update, 60);
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
button.clicked.disconnect(onClick);
|
||||
if (tablet) {
|
||||
tablet.removeButton(button);
|
||||
}
|
||||
|
||||
Controller.stopInputRecording();
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
Loading…
Reference in a new issue