mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 20:35:17 +02:00
Merge pull request #14483 from danteruiz/keyboard-toggle-option
Keyboard menu option in general settings
This commit is contained in:
commit
dacf43d70c
8 changed files with 34 additions and 5 deletions
|
@ -44,14 +44,14 @@ Rectangle {
|
||||||
|
|
||||||
|
|
||||||
onPasswordChanged: {
|
onPasswordChanged: {
|
||||||
var use3DKeyboard = (typeof MenuInterface === "undefined") ? false : MenuInterface.isOptionChecked("Use 3D Keyboard");
|
var use3DKeyboard = (typeof KeyboardScriptingInterface === "undefined") ? false : KeyboardScriptingInterface.use3DKeyboard;
|
||||||
if (use3DKeyboard) {
|
if (use3DKeyboard) {
|
||||||
KeyboardScriptingInterface.password = password;
|
KeyboardScriptingInterface.password = password;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onRaisedChanged: {
|
onRaisedChanged: {
|
||||||
var use3DKeyboard = (typeof MenuInterface === "undefined") ? false : MenuInterface.isOptionChecked("Use 3D Keyboard");
|
var use3DKeyboard = (typeof KeyboardScriptingInterface === "undefined") ? false : KeyboardScriptingInterface.use3DKeyboard;
|
||||||
if (!use3DKeyboard) {
|
if (!use3DKeyboard) {
|
||||||
keyboardBase.height = raised ? raisedHeight : 0;
|
keyboardBase.height = raised ? raisedHeight : 0;
|
||||||
keyboardBase.visible = raised;
|
keyboardBase.visible = raised;
|
||||||
|
|
|
@ -364,8 +364,6 @@ Menu::Menu() {
|
||||||
qApp->setHmdTabletBecomesToolbarSetting(action->isChecked());
|
qApp->setHmdTabletBecomesToolbarSetting(action->isChecked());
|
||||||
});
|
});
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(uiOptionsMenu, MenuOption::Use3DKeyboard, 0, true);
|
|
||||||
|
|
||||||
// Developer > Render >>>
|
// Developer > Render >>>
|
||||||
MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render");
|
MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render");
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,6 @@ namespace MenuOption {
|
||||||
const QString TurnWithHead = "Turn using Head";
|
const QString TurnWithHead = "Turn using Head";
|
||||||
const QString UseAudioForMouth = "Use Audio for Mouth";
|
const QString UseAudioForMouth = "Use Audio for Mouth";
|
||||||
const QString UseCamera = "Use Camera";
|
const QString UseCamera = "Use Camera";
|
||||||
const QString Use3DKeyboard = "Use 3D Keyboard";
|
|
||||||
const QString VelocityFilter = "Velocity Filter";
|
const QString VelocityFilter = "Velocity Filter";
|
||||||
const QString VisibleToEveryone = "Everyone";
|
const QString VisibleToEveryone = "Everyone";
|
||||||
const QString VisibleToFriends = "Friends";
|
const QString VisibleToFriends = "Friends";
|
||||||
|
|
|
@ -32,3 +32,7 @@ void KeyboardScriptingInterface::setPassword(bool password) {
|
||||||
void KeyboardScriptingInterface::loadKeyboardFile(const QString& keyboardFile) {
|
void KeyboardScriptingInterface::loadKeyboardFile(const QString& keyboardFile) {
|
||||||
DependencyManager::get<Keyboard>()->loadKeyboardFile(keyboardFile);
|
DependencyManager::get<Keyboard>()->loadKeyboardFile(keyboardFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool KeyboardScriptingInterface::getUse3DKeyboard() {
|
||||||
|
return DependencyManager::get<Keyboard>()->getUse3DKeyboard();
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ class KeyboardScriptingInterface : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool raised READ isRaised WRITE setRaised)
|
Q_PROPERTY(bool raised READ isRaised WRITE setRaised)
|
||||||
Q_PROPERTY(bool password READ isPassword WRITE setPassword)
|
Q_PROPERTY(bool password READ isPassword WRITE setPassword)
|
||||||
|
Q_PROPERTY(bool use3DKeyboard READ getUse3DKeyboard);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE void loadKeyboardFile(const QString& string);
|
Q_INVOKABLE void loadKeyboardFile(const QString& string);
|
||||||
|
@ -39,5 +40,7 @@ private:
|
||||||
|
|
||||||
bool isPassword();
|
bool isPassword();
|
||||||
void setPassword(bool password);
|
void setPassword(bool password);
|
||||||
|
|
||||||
|
bool getUse3DKeyboard();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -241,6 +241,17 @@ void Keyboard::registerKeyboardHighlighting() {
|
||||||
selection->enableListToScene(KEY_PRESSED_HIGHLIGHT);
|
selection->enableListToScene(KEY_PRESSED_HIGHLIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Keyboard::getUse3DKeyboard() const {
|
||||||
|
return _use3DKeyboardLock.resultWithReadLock<bool>([&] {
|
||||||
|
return _use3DKeyboard.get();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void Keyboard::setUse3DKeyboard(bool use) {
|
||||||
|
_use3DKeyboardLock.withWriteLock([&] {
|
||||||
|
_use3DKeyboard.set(use);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Keyboard::createKeyboard() {
|
void Keyboard::createKeyboard() {
|
||||||
auto pointerManager = DependencyManager::get<PointerManager>();
|
auto pointerManager = DependencyManager::get<PointerManager>();
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <Sound.h>
|
#include <Sound.h>
|
||||||
#include <AudioInjector.h>
|
#include <AudioInjector.h>
|
||||||
#include <shared/ReadWriteLockable.h>
|
#include <shared/ReadWriteLockable.h>
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "ui/overlays/Overlay.h"
|
#include "ui/overlays/Overlay.h"
|
||||||
|
|
||||||
|
@ -97,6 +98,9 @@ public:
|
||||||
bool isPassword() const;
|
bool isPassword() const;
|
||||||
void setPassword(bool password);
|
void setPassword(bool password);
|
||||||
|
|
||||||
|
bool getUse3DKeyboard() const;
|
||||||
|
void setUse3DKeyboard(bool use);
|
||||||
|
|
||||||
void loadKeyboardFile(const QString& keyboardFile);
|
void loadKeyboardFile(const QString& keyboardFile);
|
||||||
QVector<OverlayID> getKeysID();
|
QVector<OverlayID> getKeysID();
|
||||||
|
|
||||||
|
@ -143,6 +147,9 @@ private:
|
||||||
SharedSoundPointer _keySound { nullptr };
|
SharedSoundPointer _keySound { nullptr };
|
||||||
std::shared_ptr<QTimer> _layerSwitchTimer { std::make_shared<QTimer>() };
|
std::shared_ptr<QTimer> _layerSwitchTimer { std::make_shared<QTimer>() };
|
||||||
|
|
||||||
|
mutable ReadWriteLockable _use3DKeyboardLock;
|
||||||
|
Setting::Handle<bool> _use3DKeyboard { "use3DKeyboard", true };
|
||||||
|
|
||||||
QString _typedCharacters;
|
QString _typedCharacters;
|
||||||
TextDisplay _textDisplay;
|
TextDisplay _textDisplay;
|
||||||
Anchor _anchor;
|
Anchor _anchor;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "Snapshot.h"
|
#include "Snapshot.h"
|
||||||
#include "SnapshotAnimated.h"
|
#include "SnapshotAnimated.h"
|
||||||
#include "UserActivityLogger.h"
|
#include "UserActivityLogger.h"
|
||||||
|
#include "ui/Keyboard.h"
|
||||||
|
|
||||||
void setupPreferences() {
|
void setupPreferences() {
|
||||||
auto preferences = DependencyManager::get<Preferences>();
|
auto preferences = DependencyManager::get<Preferences>();
|
||||||
|
@ -119,6 +120,12 @@ void setupPreferences() {
|
||||||
preferences->addPreference(new CheckPreference(UI_CATEGORY, "Use reticle cursor instead of arrow", getter, setter));
|
preferences->addPreference(new CheckPreference(UI_CATEGORY, "Use reticle cursor instead of arrow", getter, setter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto getter = []()->bool { return DependencyManager::get<Keyboard>()->getUse3DKeyboard(); };
|
||||||
|
auto setter = [](bool value) { DependencyManager::get<Keyboard>()->setUse3DKeyboard(value); };
|
||||||
|
preferences->addPreference(new CheckPreference(UI_CATEGORY, "Use Virtual Keyboard", getter, setter));
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto getter = []()->bool { return qApp->getMiniTabletEnabled(); };
|
auto getter = []()->bool { return qApp->getMiniTabletEnabled(); };
|
||||||
auto setter = [](bool value) { qApp->setMiniTabletEnabled(value); };
|
auto setter = [](bool value) { qApp->setMiniTabletEnabled(value); };
|
||||||
|
|
Loading…
Reference in a new issue