mirror of
https://github.com/overte-org/overte.git
synced 2025-07-11 00:18:39 +02:00
Merge remote-tracking branch 'upstream/master' into vive-ui
This commit is contained in:
commit
71bf9384ce
13 changed files with 134 additions and 29 deletions
|
@ -82,6 +82,12 @@ ModalWindow {
|
||||||
|
|
||||||
// Clear selection when click on external frame.
|
// Clear selection when click on external frame.
|
||||||
frameClicked.connect(function() { d.clearSelection(); });
|
frameClicked.connect(function() { d.clearSelection(); });
|
||||||
|
|
||||||
|
if (selectDirectory) {
|
||||||
|
currentSelection.text = d.capitalizeDrive(helper.urlToPath(initialFolder));
|
||||||
|
}
|
||||||
|
|
||||||
|
fileTableView.forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -703,7 +709,6 @@ ModalWindow {
|
||||||
if (!helper.urlIsWritable(selection)) {
|
if (!helper.urlIsWritable(selection)) {
|
||||||
desktop.messageBox({
|
desktop.messageBox({
|
||||||
icon: OriginalDialogs.StandardIcon.Warning,
|
icon: OriginalDialogs.StandardIcon.Warning,
|
||||||
buttons: OriginalDialogs.StandardButton.Yes | OriginalDialogs.StandardButton.No,
|
|
||||||
text: "Unable to write to location " + selection
|
text: "Unable to write to location " + selection
|
||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -65,7 +65,10 @@ Preference {
|
||||||
verticalCenter: dataTextField.verticalCenter
|
verticalCenter: dataTextField.verticalCenter
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var browser = fileBrowserBuilder.createObject(desktop, { selectDirectory: true, folder: fileDialogHelper.pathToUrl(preference.value) });
|
var browser = fileBrowserBuilder.createObject(desktop, {
|
||||||
|
selectDirectory: true,
|
||||||
|
dir: fileDialogHelper.pathToUrl(preference.value)
|
||||||
|
});
|
||||||
browser.selectedFile.connect(function(fileUrl){
|
browser.selectedFile.connect(function(fileUrl){
|
||||||
console.log(fileUrl);
|
console.log(fileUrl);
|
||||||
dataTextField.text = fileDialogHelper.urlToPath(fileUrl);
|
dataTextField.text = fileDialogHelper.urlToPath(fileUrl);
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QScriptValue>
|
#include <QScriptValue>
|
||||||
|
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "DomainHandler.h"
|
#include "DomainHandler.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
@ -23,6 +25,10 @@
|
||||||
|
|
||||||
#include "WindowScriptingInterface.h"
|
#include "WindowScriptingInterface.h"
|
||||||
|
|
||||||
|
static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
|
static const QString LAST_BROWSE_LOCATION_SETTING = "LastBrowseLocation";
|
||||||
|
|
||||||
|
|
||||||
WindowScriptingInterface::WindowScriptingInterface() {
|
WindowScriptingInterface::WindowScriptingInterface() {
|
||||||
const DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
|
const DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
|
||||||
connect(&domainHandler, &DomainHandler::connectedToDomain, this, &WindowScriptingInterface::domainChanged);
|
connect(&domainHandler, &DomainHandler::connectedToDomain, this, &WindowScriptingInterface::domainChanged);
|
||||||
|
@ -101,6 +107,14 @@ QString fixupPathForMac(const QString& directory) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString WindowScriptingInterface::getPreviousBrowseLocation() const {
|
||||||
|
return Setting::Handle<QString>(LAST_BROWSE_LOCATION_SETTING, DESKTOP_LOCATION).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowScriptingInterface::setPreviousBrowseLocation(const QString& location) {
|
||||||
|
Setting::Handle<QVariant>(LAST_BROWSE_LOCATION_SETTING).set(location);
|
||||||
|
}
|
||||||
|
|
||||||
/// Display an open file dialog. If `directory` is an invalid file or directory the browser will start at the current
|
/// Display an open file dialog. If `directory` is an invalid file or directory the browser will start at the current
|
||||||
/// working directory.
|
/// working directory.
|
||||||
/// \param const QString& title title of the window
|
/// \param const QString& title title of the window
|
||||||
|
@ -108,8 +122,17 @@ QString fixupPathForMac(const QString& directory) {
|
||||||
/// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog`
|
/// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog`
|
||||||
/// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue`
|
/// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue`
|
||||||
QScriptValue WindowScriptingInterface::browse(const QString& title, const QString& directory, const QString& nameFilter) {
|
QScriptValue WindowScriptingInterface::browse(const QString& title, const QString& directory, const QString& nameFilter) {
|
||||||
QString path = fixupPathForMac(directory);
|
QString path = directory;
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
path = getPreviousBrowseLocation();
|
||||||
|
}
|
||||||
|
#ifndef Q_OS_WIN
|
||||||
|
path = fixupPathForMac(directory);
|
||||||
|
#endif
|
||||||
QString result = OffscreenUi::getOpenFileName(nullptr, title, path, nameFilter);
|
QString result = OffscreenUi::getOpenFileName(nullptr, title, path, nameFilter);
|
||||||
|
if (!result.isEmpty()) {
|
||||||
|
setPreviousBrowseLocation(QFileInfo(result).absolutePath());
|
||||||
|
}
|
||||||
return result.isEmpty() ? QScriptValue::NullValue : QScriptValue(result);
|
return result.isEmpty() ? QScriptValue::NullValue : QScriptValue(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,8 +143,17 @@ QScriptValue WindowScriptingInterface::browse(const QString& title, const QStrin
|
||||||
/// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog`
|
/// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog`
|
||||||
/// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue`
|
/// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue`
|
||||||
QScriptValue WindowScriptingInterface::save(const QString& title, const QString& directory, const QString& nameFilter) {
|
QScriptValue WindowScriptingInterface::save(const QString& title, const QString& directory, const QString& nameFilter) {
|
||||||
QString path = fixupPathForMac(directory);
|
QString path = directory;
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
path = getPreviousBrowseLocation();
|
||||||
|
}
|
||||||
|
#ifndef Q_OS_WIN
|
||||||
|
path = fixupPathForMac(directory);
|
||||||
|
#endif
|
||||||
QString result = OffscreenUi::getSaveFileName(nullptr, title, path, nameFilter);
|
QString result = OffscreenUi::getSaveFileName(nullptr, title, path, nameFilter);
|
||||||
|
if (!result.isEmpty()) {
|
||||||
|
setPreviousBrowseLocation(QFileInfo(result).absolutePath());
|
||||||
|
}
|
||||||
return result.isEmpty() ? QScriptValue::NullValue : QScriptValue(result);
|
return result.isEmpty() ? QScriptValue::NullValue : QScriptValue(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,10 @@ signals:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
WebWindowClass* doCreateWebWindow(const QString& title, const QString& url, int width, int height);
|
WebWindowClass* doCreateWebWindow(const QString& title, const QString& url, int width, int height);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString getPreviousBrowseLocation() const;
|
||||||
|
void setPreviousBrowseLocation(const QString& location);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_WindowScriptingInterface_h
|
#endif // hifi_WindowScriptingInterface_h
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "EntityItem.h"
|
#include "EntityItem.h"
|
||||||
#include "EntityItemProperties.h"
|
#include "EntityItemProperties.h"
|
||||||
#include "EntityTypes.h"
|
#include "EntityTypes.h"
|
||||||
|
#include "EntitiesLogging.h"
|
||||||
|
|
||||||
#include "LightEntityItem.h"
|
#include "LightEntityItem.h"
|
||||||
#include "ModelEntityItem.h"
|
#include "ModelEntityItem.h"
|
||||||
|
@ -63,6 +64,9 @@ EntityTypes::EntityType EntityTypes::getEntityTypeFromName(const QString& name)
|
||||||
if (matchedTypeName != _nameToTypeMap.end()) {
|
if (matchedTypeName != _nameToTypeMap.end()) {
|
||||||
return matchedTypeName.value();
|
return matchedTypeName.value();
|
||||||
}
|
}
|
||||||
|
if (name.size() > 0 && name[0].isLower()) {
|
||||||
|
qCDebug(entities) << "Entity types must start with an uppercase letter. Please change the type" << name;
|
||||||
|
}
|
||||||
return Unknown;
|
return Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,6 @@ void DomainHandler::softReset() {
|
||||||
|
|
||||||
clearSettings();
|
clearSettings();
|
||||||
|
|
||||||
_domainConnectionRefusals.clear();
|
|
||||||
_connectionDenialsSinceKeypairRegen = 0;
|
_connectionDenialsSinceKeypairRegen = 0;
|
||||||
|
|
||||||
// cancel the failure timeout for any pending requests for settings
|
// cancel the failure timeout for any pending requests for settings
|
||||||
|
@ -118,6 +117,9 @@ void DomainHandler::hardReset() {
|
||||||
_hostname = QString();
|
_hostname = QString();
|
||||||
_sockAddr.clear();
|
_sockAddr.clear();
|
||||||
|
|
||||||
|
_hasSignalledProtocolMismatch = false;
|
||||||
|
_domainConnectionRefusals.clear();
|
||||||
|
|
||||||
_hasCheckedForAccessToken = false;
|
_hasCheckedForAccessToken = false;
|
||||||
|
|
||||||
// clear any pending path we may have wanted to ask the previous DS about
|
// clear any pending path we may have wanted to ask the previous DS about
|
||||||
|
@ -405,11 +407,27 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
||||||
// and check and signal for an access token so that we can make sure they are logged in
|
// and check and signal for an access token so that we can make sure they are logged in
|
||||||
qCWarning(networking) << "The domain-server denied a connection request: " << reasonMessage;
|
qCWarning(networking) << "The domain-server denied a connection request: " << reasonMessage;
|
||||||
|
|
||||||
if (!_domainConnectionRefusals.contains(reasonMessage)) {
|
if (!_domainConnectionRefusals.contains(reasonCode)) {
|
||||||
_domainConnectionRefusals.append(reasonMessage);
|
|
||||||
|
_domainConnectionRefusals.append(reasonCode);
|
||||||
|
|
||||||
|
bool shouldSignal = true;
|
||||||
|
|
||||||
|
// only signal once for a protocol mismatch, even between soft resets that will reset the _domainConnectionRefusals
|
||||||
|
if (reasonCode == ConnectionRefusedReason::ProtocolMismatch) {
|
||||||
|
if (_hasSignalledProtocolMismatch) {
|
||||||
|
shouldSignal = false;
|
||||||
|
} else {
|
||||||
|
_hasSignalledProtocolMismatch = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldSignal) {
|
||||||
emit domainConnectionRefused(reasonMessage, (int)reasonCode);
|
emit domainConnectionRefused(reasonMessage, (int)reasonCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
|
||||||
// Some connection refusal reasons imply that a login is required. If so, suggest a new login
|
// Some connection refusal reasons imply that a login is required. If so, suggest a new login
|
||||||
|
|
|
@ -144,7 +144,8 @@ private:
|
||||||
QString _pendingPath;
|
QString _pendingPath;
|
||||||
QTimer _settingsTimer;
|
QTimer _settingsTimer;
|
||||||
|
|
||||||
QStringList _domainConnectionRefusals;
|
QList<ConnectionRefusedReason> _domainConnectionRefusals;
|
||||||
|
bool _hasSignalledProtocolMismatch { false };
|
||||||
bool _hasCheckedForAccessToken { false };
|
bool _hasCheckedForAccessToken { false };
|
||||||
int _connectionDenialsSinceKeypairRegen { 0 };
|
int _connectionDenialsSinceKeypairRegen { 0 };
|
||||||
|
|
||||||
|
|
|
@ -77,15 +77,40 @@ namespace Setting {
|
||||||
virtual ~Handle() { deinit(); }
|
virtual ~Handle() { deinit(); }
|
||||||
|
|
||||||
// Returns setting value, returns its default value if not found
|
// Returns setting value, returns its default value if not found
|
||||||
T get() { return get(_defaultValue); }
|
T get() const {
|
||||||
|
return get(_defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
// Returns setting value, returns other if not found
|
// Returns setting value, returns other if not found
|
||||||
T get(const T& other) { maybeInit(); return (_isSet) ? _value : other; }
|
T get(const T& other) const {
|
||||||
T getDefault() const { return _defaultValue; }
|
maybeInit();
|
||||||
|
return (_isSet) ? _value : other;
|
||||||
|
}
|
||||||
|
|
||||||
void set(const T& value) { maybeInit(); _value = value; _isSet = true; }
|
const T& getDefault() const {
|
||||||
void reset() { set(_defaultValue); }
|
return _defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
void remove() { maybeInit(); _isSet = false; }
|
void reset() {
|
||||||
|
set(_defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set(const T& value) {
|
||||||
|
maybeInit();
|
||||||
|
if ((!_isSet && (value != _defaultValue)) || _value != value) {
|
||||||
|
_value = value;
|
||||||
|
_isSet = true;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void remove() {
|
||||||
|
maybeInit();
|
||||||
|
if (_isSet) {
|
||||||
|
_isSet = false;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void setVariant(const QVariant& variant);
|
virtual void setVariant(const QVariant& variant);
|
||||||
|
|
|
@ -119,9 +119,9 @@ namespace Setting {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Interface::maybeInit() {
|
void Interface::maybeInit() const {
|
||||||
if (!_isInitialized) {
|
if (!_isInitialized) {
|
||||||
init();
|
const_cast<Interface*>(this)->init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,19 +39,20 @@ namespace Setting {
|
||||||
virtual ~Interface() = default;
|
virtual ~Interface() = default;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void maybeInit();
|
void maybeInit() const;
|
||||||
void deinit();
|
void deinit();
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
bool _isInitialized = false;
|
|
||||||
bool _isSet = false;
|
bool _isSet = false;
|
||||||
const QString _key;
|
const QString _key;
|
||||||
|
|
||||||
friend class Manager;
|
private:
|
||||||
|
mutable bool _isInitialized = false;
|
||||||
|
|
||||||
QWeakPointer<Manager> _manager;
|
friend class Manager;
|
||||||
|
mutable QWeakPointer<Manager> _manager;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ namespace Setting {
|
||||||
void Manager::customDeleter() { }
|
void Manager::customDeleter() { }
|
||||||
|
|
||||||
|
|
||||||
void Manager::registerHandle(Setting::Interface* handle) {
|
void Manager::registerHandle(Interface* handle) {
|
||||||
QString key = handle->getKey();
|
const QString& key = handle->getKey();
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_handles.contains(key)) {
|
if (_handles.contains(key)) {
|
||||||
qWarning() << "Setting::Manager::registerHandle(): Key registered more than once, overriding: " << key;
|
qWarning() << "Setting::Manager::registerHandle(): Key registered more than once, overriding: " << key;
|
||||||
|
@ -58,7 +58,9 @@ namespace Setting {
|
||||||
} else {
|
} else {
|
||||||
loadedValue = value(key);
|
loadedValue = value(key);
|
||||||
}
|
}
|
||||||
|
if (loadedValue.isValid()) {
|
||||||
handle->setVariant(loadedValue);
|
handle->setVariant(loadedValue);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +96,7 @@ namespace Setting {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::saveAll() {
|
void Manager::saveAll() {
|
||||||
|
bool forceSync = false;
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
for (auto key : _pendingChanges.keys()) {
|
for (auto key : _pendingChanges.keys()) {
|
||||||
auto newValue = _pendingChanges[key];
|
auto newValue = _pendingChanges[key];
|
||||||
|
@ -101,15 +104,21 @@ namespace Setting {
|
||||||
if (newValue == savedValue) {
|
if (newValue == savedValue) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (newValue == UNSET_VALUE) {
|
if (newValue == UNSET_VALUE || !newValue.isValid()) {
|
||||||
|
forceSync = true;
|
||||||
remove(key);
|
remove(key);
|
||||||
} else {
|
} else {
|
||||||
|
forceSync = true;
|
||||||
setValue(key, newValue);
|
setValue(key, newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_pendingChanges.clear();
|
_pendingChanges.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (forceSync) {
|
||||||
|
sync();
|
||||||
|
}
|
||||||
|
|
||||||
// Restart timer
|
// Restart timer
|
||||||
if (_saveTimer) {
|
if (_saveTimer) {
|
||||||
_saveTimer->start();
|
_saveTimer->start();
|
||||||
|
|
|
@ -366,6 +366,10 @@ void ViveControllerManager::InputDevice::handleButtonEvent(float deltaTime, uint
|
||||||
} else if (button == vr::k_EButton_SteamVR_Touchpad) {
|
} else if (button == vr::k_EButton_SteamVR_Touchpad) {
|
||||||
_buttonPressedMap.insert(isLeftHand ? LS : RS);
|
_buttonPressedMap.insert(isLeftHand ? LS : RS);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (button == vr::k_EButton_Grip) {
|
||||||
|
_axisStateMap[isLeftHand ? LEFT_GRIP : RIGHT_GRIP] = 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (touched) {
|
if (touched) {
|
||||||
|
|
|
@ -1221,8 +1221,7 @@ function handeMenuEvent(menuItem) {
|
||||||
if (!selectionManager.hasSelection()) {
|
if (!selectionManager.hasSelection()) {
|
||||||
Window.alert("No entities have been selected.");
|
Window.alert("No entities have been selected.");
|
||||||
} else {
|
} else {
|
||||||
var filename = "entities__" + Window.location.hostname + ".svo.json";
|
var filename = Window.save("Select Where to Save", "", "*.json")
|
||||||
filename = Window.save("Select Where to Save", filename, "*.json")
|
|
||||||
if (filename) {
|
if (filename) {
|
||||||
var success = Clipboard.exportEntities(filename, selectionManager.selections);
|
var success = Clipboard.exportEntities(filename, selectionManager.selections);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|
Loading…
Reference in a new issue