mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:43:31 +02:00
Icon toggling and keyboard shortcut
This commit is contained in:
parent
b546d977f4
commit
ced9473eb3
1 changed files with 24 additions and 3 deletions
|
@ -15,12 +15,25 @@
|
||||||
var APP_NAME = "EZRECORD",
|
var APP_NAME = "EZRECORD",
|
||||||
APP_ICON_INACTIVE = "icons/tablet-icons/avatar-record-i.svg",
|
APP_ICON_INACTIVE = "icons/tablet-icons/avatar-record-i.svg",
|
||||||
APP_ICON_ACTIVE = "icons/tablet-icons/avatar-record-a.svg",
|
APP_ICON_ACTIVE = "icons/tablet-icons/avatar-record-a.svg",
|
||||||
|
SHORTCUT_KEY = "r", // Ctrl modifier is assumed.
|
||||||
tablet,
|
tablet,
|
||||||
button;
|
button,
|
||||||
|
isRecording = false;
|
||||||
|
|
||||||
|
function toggleRecording() {
|
||||||
|
isRecording = !isRecording;
|
||||||
|
button.editProperties({ isActive: isRecording });
|
||||||
|
// TODO: Start/cancel/finish recording.
|
||||||
|
}
|
||||||
|
|
||||||
|
function onKeyPressEvent(event) {
|
||||||
|
if (event.isControl && event.text === SHORTCUT_KEY && !event.isMeta && !event.isAlt && !event.isAutoRepeat) {
|
||||||
|
toggleRecording();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onButtonClicked() {
|
function onButtonClicked() {
|
||||||
// TODO
|
toggleRecording();
|
||||||
print("Clicked");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
|
@ -39,9 +52,15 @@
|
||||||
if (button) {
|
if (button) {
|
||||||
button.clicked.connect(onButtonClicked);
|
button.clicked.connect(onButtonClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Controller.keyPressEvent.connect(onKeyPressEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
|
if (isRecording) {
|
||||||
|
// TODO: Cancel recording.
|
||||||
|
}
|
||||||
|
|
||||||
if (!tablet) {
|
if (!tablet) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +72,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
tablet = null;
|
tablet = null;
|
||||||
|
|
||||||
|
Controller.keyPressEvent.disconnect(onKeyPressEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
setUp();
|
setUp();
|
||||||
|
|
Loading…
Reference in a new issue