added requested features

This commit is contained in:
Dante Ruiz 2017-04-26 16:52:51 +01:00
parent 5a9cf554e7
commit 79d827c6be
6 changed files with 29 additions and 2 deletions

View file

@ -23,6 +23,7 @@ Rectangle {
signal sendToScript(var message);
color: hifi.colors.baseGray;
property string path: ""
property string dir: ""
property var dialog: null;
property bool recording: false;
@ -49,6 +50,7 @@ Rectangle {
sendToScript({method: "Stop"});
inputRecorder.recording = false;
start.text = "Start Recording";
selectedFile.text = "";
} else {
sendToScript({method: "Start"});
inputRecorder.recording = true;
@ -111,6 +113,9 @@ Rectangle {
enabled: true
onClicked: {
dialog = fileDialog.createObject(inputRecorder);
dialog.caption = "InputRecorder";
console.log(dialog.dir);
dialog.dir = "file:///" + inputRecorder.dir;
dialog.selectedFile.connect(getFileSelected);
}
}
@ -144,6 +149,10 @@ Rectangle {
case "update":
updateButtonStatus(message.params);
break;
case "path":
console.log(message.params);
inputRecorder.dir = message.params;
break;
}
}

View file

@ -23,8 +23,7 @@
#include <BuildInfo.h>
#include <GLMHelpers.h>
QString SAVE_DIRECTORY = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/" + BuildInfo::INTERFACE_NAME +
"/interface" + "/hifi-input-recordings/";
QString SAVE_DIRECTORY = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/" + BuildInfo::MODIFIED_ORGANIZATION + "/" + BuildInfo::INTERFACE_NAME + "/hifi-input-recordings/";
QString FILE_PREFIX_NAME = "input-recording-";
QString COMPRESS_EXTENSION = ".tar.gz";
namespace controller {
@ -135,6 +134,10 @@ namespace controller {
return &inputRecorder;
}
QString InputRecorder::getSaveDirectory() {
return SAVE_DIRECTORY;
}
void InputRecorder::startRecording() {
_recording = true;
_playback = false;

View file

@ -44,6 +44,7 @@ namespace controller {
void setActionState(controller::Action action, const controller::Pose pose);
float getActionState(controller::Action action);
controller::Pose getPoseState(controller::Action action);
QString getSaveDirectory();
void frameTick();
private:
bool _recording { false };

View file

@ -185,6 +185,11 @@ namespace controller {
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 {
return DependencyManager::get<UserInputMapper>()->triggerHapticPulseOnDevice(device, strength, duration, hand);
}

View file

@ -105,6 +105,7 @@ namespace controller {
Q_INVOKABLE void stopInputPlayback();
Q_INVOKABLE void saveInputRecording();
Q_INVOKABLE void loadInputRecording(const QString& file);
Q_INVOKABLE QString getInputRecorderSaveDirectory();
bool isMouseCaptured() const { return _mouseCaptured; }
bool isTouchCaptured() const { return _touchCaptured; }

View file

@ -9,6 +9,7 @@
(function() {
var recording = false;
var onRecordingScreen = false;
var passedSaveDirectory = false;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
text: "IRecord"
@ -25,6 +26,7 @@
function onScreenChanged(type, url) {
onRecordingScreen = false;
passedSaveDirectory = false;
}
button.clicked.connect(onClick);
@ -78,6 +80,12 @@
}
function update() {
if (!passedSaveDirectory) {
var directory = Controller.getInputRecorderSaveDirectory();
sendToQml({method: "path", params: directory});
passedSaveDirectory = true;
}
sendToQml({method: "update", params: recording});
}