mirror of
https://github.com/lubosz/overte.git
synced 2025-08-17 18:02:54 +02:00
added requested features
This commit is contained in:
parent
5a9cf554e7
commit
79d827c6be
6 changed files with 29 additions and 2 deletions
|
@ -23,6 +23,7 @@ Rectangle {
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
color: hifi.colors.baseGray;
|
color: hifi.colors.baseGray;
|
||||||
property string path: ""
|
property string path: ""
|
||||||
|
property string dir: ""
|
||||||
property var dialog: null;
|
property var dialog: null;
|
||||||
property bool recording: false;
|
property bool recording: false;
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ Rectangle {
|
||||||
sendToScript({method: "Stop"});
|
sendToScript({method: "Stop"});
|
||||||
inputRecorder.recording = false;
|
inputRecorder.recording = false;
|
||||||
start.text = "Start Recording";
|
start.text = "Start Recording";
|
||||||
|
selectedFile.text = "";
|
||||||
} else {
|
} else {
|
||||||
sendToScript({method: "Start"});
|
sendToScript({method: "Start"});
|
||||||
inputRecorder.recording = true;
|
inputRecorder.recording = true;
|
||||||
|
@ -111,6 +113,9 @@ Rectangle {
|
||||||
enabled: true
|
enabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
dialog = fileDialog.createObject(inputRecorder);
|
dialog = fileDialog.createObject(inputRecorder);
|
||||||
|
dialog.caption = "InputRecorder";
|
||||||
|
console.log(dialog.dir);
|
||||||
|
dialog.dir = "file:///" + inputRecorder.dir;
|
||||||
dialog.selectedFile.connect(getFileSelected);
|
dialog.selectedFile.connect(getFileSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,6 +149,10 @@ Rectangle {
|
||||||
case "update":
|
case "update":
|
||||||
updateButtonStatus(message.params);
|
updateButtonStatus(message.params);
|
||||||
break;
|
break;
|
||||||
|
case "path":
|
||||||
|
console.log(message.params);
|
||||||
|
inputRecorder.dir = message.params;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
#include <BuildInfo.h>
|
#include <BuildInfo.h>
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
|
|
||||||
QString SAVE_DIRECTORY = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/" + BuildInfo::INTERFACE_NAME +
|
QString SAVE_DIRECTORY = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/" + BuildInfo::MODIFIED_ORGANIZATION + "/" + BuildInfo::INTERFACE_NAME + "/hifi-input-recordings/";
|
||||||
"/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 {
|
||||||
|
@ -135,6 +134,10 @@ namespace controller {
|
||||||
return &inputRecorder;
|
return &inputRecorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString InputRecorder::getSaveDirectory() {
|
||||||
|
return SAVE_DIRECTORY;
|
||||||
|
}
|
||||||
|
|
||||||
void InputRecorder::startRecording() {
|
void InputRecorder::startRecording() {
|
||||||
_recording = true;
|
_recording = true;
|
||||||
_playback = false;
|
_playback = false;
|
||||||
|
|
|
@ -44,6 +44,7 @@ namespace controller {
|
||||||
void setActionState(controller::Action action, const controller::Pose pose);
|
void setActionState(controller::Action action, const controller::Pose pose);
|
||||||
float getActionState(controller::Action action);
|
float getActionState(controller::Action action);
|
||||||
controller::Pose getPoseState(controller::Action action);
|
controller::Pose getPoseState(controller::Action action);
|
||||||
|
QString getSaveDirectory();
|
||||||
void frameTick();
|
void frameTick();
|
||||||
private:
|
private:
|
||||||
bool _recording { false };
|
bool _recording { false };
|
||||||
|
|
|
@ -185,6 +185,11 @@ namespace controller {
|
||||||
inputRecorder->loadRecording(file);
|
inputRecorder->loadRecording(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ScriptingInterface::getInputRecorderSaveDirectory() {
|
||||||
|
InputRecorder* inputRecorder = InputRecorder::getInstance();
|
||||||
|
return inputRecorder->getSaveDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
bool ScriptingInterface::triggerHapticPulseOnDevice(unsigned int device, float strength, float duration, controller::Hand hand) const {
|
bool ScriptingInterface::triggerHapticPulseOnDevice(unsigned int device, float strength, float duration, controller::Hand hand) const {
|
||||||
return DependencyManager::get<UserInputMapper>()->triggerHapticPulseOnDevice(device, strength, duration, hand);
|
return DependencyManager::get<UserInputMapper>()->triggerHapticPulseOnDevice(device, strength, duration, hand);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,7 @@ namespace controller {
|
||||||
Q_INVOKABLE void stopInputPlayback();
|
Q_INVOKABLE void stopInputPlayback();
|
||||||
Q_INVOKABLE void saveInputRecording();
|
Q_INVOKABLE void saveInputRecording();
|
||||||
Q_INVOKABLE void loadInputRecording(const QString& file);
|
Q_INVOKABLE void loadInputRecording(const QString& file);
|
||||||
|
Q_INVOKABLE QString getInputRecorderSaveDirectory();
|
||||||
|
|
||||||
bool isMouseCaptured() const { return _mouseCaptured; }
|
bool isMouseCaptured() const { return _mouseCaptured; }
|
||||||
bool isTouchCaptured() const { return _touchCaptured; }
|
bool isTouchCaptured() const { return _touchCaptured; }
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
(function() {
|
(function() {
|
||||||
var recording = false;
|
var recording = false;
|
||||||
var onRecordingScreen = false;
|
var onRecordingScreen = false;
|
||||||
|
var passedSaveDirectory = 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({
|
||||||
text: "IRecord"
|
text: "IRecord"
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
|
|
||||||
function onScreenChanged(type, url) {
|
function onScreenChanged(type, url) {
|
||||||
onRecordingScreen = false;
|
onRecordingScreen = false;
|
||||||
|
passedSaveDirectory = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.clicked.connect(onClick);
|
button.clicked.connect(onClick);
|
||||||
|
@ -78,6 +80,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
|
||||||
|
if (!passedSaveDirectory) {
|
||||||
|
var directory = Controller.getInputRecorderSaveDirectory();
|
||||||
|
sendToQml({method: "path", params: directory});
|
||||||
|
passedSaveDirectory = true;
|
||||||
|
}
|
||||||
sendToQml({method: "update", params: recording});
|
sendToQml({method: "update", params: recording});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue