mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 20:56:26 +02:00
Merge branch 'master' into 21359
This commit is contained in:
commit
9f83ca518f
19 changed files with 85 additions and 57 deletions
|
@ -208,9 +208,10 @@ foreach(CUSTOM_MACRO ${HIFI_CUSTOM_MACROS})
|
||||||
include(${CUSTOM_MACRO})
|
include(${CUSTOM_MACRO})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(GLOB_RECURSE JS_SRC scripts/*.js)
|
file(GLOB_RECURSE JS_SRC scripts/*.js unpublishedScripts/*.js)
|
||||||
add_custom_target(js SOURCES ${JS_SRC})
|
add_custom_target(js SOURCES ${JS_SRC})
|
||||||
GroupSources("scripts")
|
GroupSources("scripts")
|
||||||
|
GroupSources("unpublishedScripts")
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
install(
|
install(
|
||||||
|
|
|
@ -584,6 +584,7 @@ void Agent::setIsAvatar(bool isAvatar) {
|
||||||
void Agent::sendAvatarIdentityPacket() {
|
void Agent::sendAvatarIdentityPacket() {
|
||||||
if (_isAvatar) {
|
if (_isAvatar) {
|
||||||
auto scriptedAvatar = DependencyManager::get<ScriptableAvatar>();
|
auto scriptedAvatar = DependencyManager::get<ScriptableAvatar>();
|
||||||
|
scriptedAvatar->markIdentityDataChanged();
|
||||||
scriptedAvatar->sendIdentityPacket();
|
scriptedAvatar->sendIdentityPacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -431,7 +431,7 @@ static const QString STATE_ADVANCED_MOVEMENT_CONTROLS = "AdvancedMovement";
|
||||||
static const QString STATE_GROUNDED = "Grounded";
|
static const QString STATE_GROUNDED = "Grounded";
|
||||||
static const QString STATE_NAV_FOCUSED = "NavigationFocused";
|
static const QString STATE_NAV_FOCUSED = "NavigationFocused";
|
||||||
|
|
||||||
bool setupEssentials(int& argc, char** argv) {
|
bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
const char** constArgv = const_cast<const char**>(argv);
|
const char** constArgv = const_cast<const char**>(argv);
|
||||||
const char* portStr = getCmdOption(argc, constArgv, "--listenPort");
|
const char* portStr = getCmdOption(argc, constArgv, "--listenPort");
|
||||||
const int listenPort = portStr ? atoi(portStr) : INVALID_PORT;
|
const int listenPort = portStr ? atoi(portStr) : INVALID_PORT;
|
||||||
|
@ -458,7 +458,7 @@ bool setupEssentials(int& argc, char** argv) {
|
||||||
|
|
||||||
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
|
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
|
||||||
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
|
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
|
||||||
bool previousSessionCrashed = CrashHandler::checkForResetSettings(suppressPrompt);
|
bool previousSessionCrashed = CrashHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt);
|
||||||
|
|
||||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||||
DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
|
DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
|
||||||
|
@ -563,11 +563,11 @@ const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = true;
|
||||||
const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false;
|
const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false;
|
||||||
const bool DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS = false;
|
const bool DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS = false;
|
||||||
|
|
||||||
Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bool runningMarkerExisted) :
|
||||||
QApplication(argc, argv),
|
QApplication(argc, argv),
|
||||||
_window(new MainWindow(desktop())),
|
_window(new MainWindow(desktop())),
|
||||||
_sessionRunTimer(startupTimer),
|
_sessionRunTimer(startupTimer),
|
||||||
_previousSessionCrashed(setupEssentials(argc, argv)),
|
_previousSessionCrashed(setupEssentials(argc, argv, runningMarkerExisted)),
|
||||||
_undoStackScriptingInterface(&_undoStack),
|
_undoStackScriptingInterface(&_undoStack),
|
||||||
_entitySimulation(new PhysicalEntitySimulation()),
|
_entitySimulation(new PhysicalEntitySimulation()),
|
||||||
_physicsEngine(new PhysicsEngine(Vectors::ZERO)),
|
_physicsEngine(new PhysicsEngine(Vectors::ZERO)),
|
||||||
|
|
|
@ -136,7 +136,7 @@ public:
|
||||||
static void initPlugins(const QStringList& arguments);
|
static void initPlugins(const QStringList& arguments);
|
||||||
static void shutdownPlugins();
|
static void shutdownPlugins();
|
||||||
|
|
||||||
Application(int& argc, char** argv, QElapsedTimer& startup_time);
|
Application(int& argc, char** argv, QElapsedTimer& startup_time, bool runningMarkerExisted);
|
||||||
~Application();
|
~Application();
|
||||||
|
|
||||||
void postLambdaEvent(std::function<void()> f) override;
|
void postLambdaEvent(std::function<void()> f) override;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include <RunningMarker.h>
|
#include <RunningMarker.h>
|
||||||
|
|
||||||
bool CrashHandler::checkForResetSettings(bool suppressPrompt) {
|
bool CrashHandler::checkForResetSettings(bool wasLikelyCrash, bool suppressPrompt) {
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings.beginGroup("Developer");
|
settings.beginGroup("Developer");
|
||||||
QVariant displayCrashOptions = settings.value(MenuOption::DisplayCrashOptions);
|
QVariant displayCrashOptions = settings.value(MenuOption::DisplayCrashOptions);
|
||||||
|
@ -39,9 +39,6 @@ bool CrashHandler::checkForResetSettings(bool suppressPrompt) {
|
||||||
// If option does not exist in Interface.ini so assume default behavior.
|
// If option does not exist in Interface.ini so assume default behavior.
|
||||||
bool displaySettingsResetOnCrash = !displayCrashOptions.isValid() || displayCrashOptions.toBool();
|
bool displaySettingsResetOnCrash = !displayCrashOptions.isValid() || displayCrashOptions.toBool();
|
||||||
|
|
||||||
QFile runningMarkerFile(RunningMarker::getMarkerFilePath(RUNNING_MARKER_FILENAME));
|
|
||||||
bool wasLikelyCrash = runningMarkerFile.exists();
|
|
||||||
|
|
||||||
if (suppressPrompt) {
|
if (suppressPrompt) {
|
||||||
return wasLikelyCrash;
|
return wasLikelyCrash;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
class CrashHandler {
|
class CrashHandler {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool checkForResetSettings(bool suppressPrompt = false);
|
static bool checkForResetSettings(bool wasLikelyCrash, bool suppressPrompt = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Action {
|
enum Action {
|
||||||
|
|
|
@ -192,6 +192,7 @@ int main(int argc, const char* argv[]) {
|
||||||
int exitCode;
|
int exitCode;
|
||||||
{
|
{
|
||||||
RunningMarker runningMarker(nullptr, RUNNING_MARKER_FILENAME);
|
RunningMarker runningMarker(nullptr, RUNNING_MARKER_FILENAME);
|
||||||
|
bool runningMarkerExisted = runningMarker.fileExists();
|
||||||
runningMarker.writeRunningMarkerFile();
|
runningMarker.writeRunningMarkerFile();
|
||||||
|
|
||||||
bool noUpdater = parser.isSet(noUpdaterOption);
|
bool noUpdater = parser.isSet(noUpdaterOption);
|
||||||
|
@ -202,7 +203,7 @@ int main(int argc, const char* argv[]) {
|
||||||
SandboxUtils::runLocalSandbox(serverContentPath, true, RUNNING_MARKER_FILENAME, noUpdater);
|
SandboxUtils::runLocalSandbox(serverContentPath, true, RUNNING_MARKER_FILENAME, noUpdater);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application app(argc, const_cast<char**>(argv), startupTime);
|
Application app(argc, const_cast<char**>(argv), startupTime, runningMarkerExisted);
|
||||||
|
|
||||||
// Now that the main event loop is setup, launch running marker thread
|
// Now that the main event loop is setup, launch running marker thread
|
||||||
runningMarker.startRunningMarker();
|
runningMarker.startRunningMarker();
|
||||||
|
|
|
@ -810,7 +810,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
READ_ENTITY_PROPERTY(PROP_COLLISIONLESS, bool, updateCollisionless);
|
READ_ENTITY_PROPERTY(PROP_COLLISIONLESS, bool, updateCollisionless);
|
||||||
READ_ENTITY_PROPERTY(PROP_COLLISION_MASK, uint8_t, updateCollisionMask);
|
READ_ENTITY_PROPERTY(PROP_COLLISION_MASK, uint8_t, updateCollisionMask);
|
||||||
READ_ENTITY_PROPERTY(PROP_DYNAMIC, bool, updateDynamic);
|
READ_ENTITY_PROPERTY(PROP_DYNAMIC, bool, updateDynamic);
|
||||||
READ_ENTITY_PROPERTY(PROP_LOCKED, bool, setLocked);
|
READ_ENTITY_PROPERTY(PROP_LOCKED, bool, updateLocked);
|
||||||
READ_ENTITY_PROPERTY(PROP_USER_DATA, QString, setUserData);
|
READ_ENTITY_PROPERTY(PROP_USER_DATA, QString, setUserData);
|
||||||
|
|
||||||
if (args.bitstreamVersion >= VERSION_ENTITIES_HAS_MARKETPLACE_ID) {
|
if (args.bitstreamVersion >= VERSION_ENTITIES_HAS_MARKETPLACE_ID) {
|
||||||
|
@ -1344,6 +1344,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(dynamic, updateDynamic);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(dynamic, updateDynamic);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(created, updateCreated);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(created, updateCreated);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lifetime, updateLifetime);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lifetime, updateLifetime);
|
||||||
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(locked, updateLocked);
|
||||||
|
|
||||||
// non-simulation properties below
|
// non-simulation properties below
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(script, setScript);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(script, setScript);
|
||||||
|
@ -1352,7 +1353,6 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(collisionSoundURL, setCollisionSoundURL);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(collisionSoundURL, setCollisionSoundURL);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(localRenderAlpha, setLocalRenderAlpha);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(localRenderAlpha, setLocalRenderAlpha);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(visible, setVisible);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(visible, setVisible);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(locked, setLocked);
|
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(userData, setUserData);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(userData, setUserData);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(marketplaceID, setMarketplaceID);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(marketplaceID, setMarketplaceID);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(name, setName);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(name, setName);
|
||||||
|
@ -2769,6 +2769,23 @@ void EntityItem::setLocked(bool value) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityItem::updateLocked(bool value) {
|
||||||
|
bool changed { false };
|
||||||
|
withWriteLock([&] {
|
||||||
|
if (_locked != value) {
|
||||||
|
_locked = value;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (changed) {
|
||||||
|
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE);
|
||||||
|
EntityTreePointer tree = getTree();
|
||||||
|
if (tree) {
|
||||||
|
tree->entityChanged(getThisPointer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString EntityItem::getUserData() const {
|
QString EntityItem::getUserData() const {
|
||||||
QString result;
|
QString result;
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
|
|
|
@ -305,6 +305,7 @@ public:
|
||||||
|
|
||||||
bool getLocked() const;
|
bool getLocked() const;
|
||||||
void setLocked(bool value);
|
void setLocked(bool value);
|
||||||
|
void updateLocked(bool value);
|
||||||
|
|
||||||
QString getUserData() const;
|
QString getUserData() const;
|
||||||
virtual void setUserData(const QString& value);
|
virtual void setUserData(const QString& value);
|
||||||
|
|
|
@ -184,6 +184,11 @@ KtxStorage::KtxStorage(const std::string& filename) : _filename(filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<storage::FileStorage> KtxStorage::maybeOpenFile() const {
|
std::shared_ptr<storage::FileStorage> KtxStorage::maybeOpenFile() const {
|
||||||
|
// 1. Try to get the shared ptr
|
||||||
|
// 2. If it doesn't exist, grab the mutex around its creation
|
||||||
|
// 3. If it was created before we got the mutex, return it
|
||||||
|
// 4. Otherwise, create it
|
||||||
|
|
||||||
std::shared_ptr<storage::FileStorage> file = _cacheFile.lock();
|
std::shared_ptr<storage::FileStorage> file = _cacheFile.lock();
|
||||||
if (file) {
|
if (file) {
|
||||||
return file;
|
return file;
|
||||||
|
@ -205,7 +210,6 @@ std::shared_ptr<storage::FileStorage> KtxStorage::maybeOpenFile() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
PixelsPointer KtxStorage::getMipFace(uint16 level, uint8 face) const {
|
PixelsPointer KtxStorage::getMipFace(uint16 level, uint8 face) const {
|
||||||
storage::StoragePointer result;
|
|
||||||
auto faceOffset = _ktxDescriptor->getMipFaceTexelsOffset(level, face);
|
auto faceOffset = _ktxDescriptor->getMipFaceTexelsOffset(level, face);
|
||||||
auto faceSize = _ktxDescriptor->getMipFaceTexelsSize(level, face);
|
auto faceSize = _ktxDescriptor->getMipFaceTexelsSize(level, face);
|
||||||
if (faceSize != 0 && faceOffset != 0) {
|
if (faceSize != 0 && faceOffset != 0) {
|
||||||
|
@ -221,7 +225,7 @@ PixelsPointer KtxStorage::getMipFace(uint16 level, uint8 face) const {
|
||||||
qWarning() << "Failed to get a valid file out of maybeOpenFile " << QString::fromStdString(_filename);
|
qWarning() << "Failed to get a valid file out of maybeOpenFile " << QString::fromStdString(_filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size KtxStorage::getMipFaceSize(uint16 level, uint8 face) const {
|
Size KtxStorage::getMipFaceSize(uint16 level, uint8 face) const {
|
||||||
|
@ -255,8 +259,18 @@ void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& stor
|
||||||
}
|
}
|
||||||
|
|
||||||
auto file = maybeOpenFile();
|
auto file = maybeOpenFile();
|
||||||
|
if (!file) {
|
||||||
|
qWarning() << "Failed to open file to assign mip data " << QString::fromStdString(_filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto imageData = file->mutableData();
|
auto fileData = file->mutableData();
|
||||||
|
if (!fileData) {
|
||||||
|
qWarning() << "Failed to get mutable data for " << QString::fromStdString(_filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto imageData = fileData;
|
||||||
imageData += ktx::KTX_HEADER_SIZE + _ktxDescriptor->header.bytesOfKeyValueData + _ktxDescriptor->images[level]._imageOffset;
|
imageData += ktx::KTX_HEADER_SIZE + _ktxDescriptor->header.bytesOfKeyValueData + _ktxDescriptor->images[level]._imageOffset;
|
||||||
imageData += ktx::IMAGE_SIZE_WIDTH;
|
imageData += ktx::IMAGE_SIZE_WIDTH;
|
||||||
|
|
||||||
|
@ -271,7 +285,7 @@ void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& stor
|
||||||
memcpy(imageData, storage->data(), storage->size());
|
memcpy(imageData, storage->data(), storage->size());
|
||||||
_minMipLevelAvailable = level;
|
_minMipLevelAvailable = level;
|
||||||
if (_offsetToMinMipKV > 0) {
|
if (_offsetToMinMipKV > 0) {
|
||||||
auto minMipKeyData = file->mutableData() + ktx::KTX_HEADER_SIZE + _offsetToMinMipKV;
|
auto minMipKeyData = fileData + ktx::KTX_HEADER_SIZE + _offsetToMinMipKV;
|
||||||
memcpy(minMipKeyData, (void*)&_minMipLevelAvailable, 1);
|
memcpy(minMipKeyData, (void*)&_minMipLevelAvailable, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
|
#include "NetworkingConstants.h"
|
||||||
#include "NetworkLogging.h"
|
#include "NetworkLogging.h"
|
||||||
#include "NodeList.h"
|
#include "NodeList.h"
|
||||||
#include "udt/PacketHeaders.h"
|
#include "udt/PacketHeaders.h"
|
||||||
|
@ -226,6 +227,10 @@ void AccountManager::sendRequest(const QString& path,
|
||||||
|
|
||||||
QUrl requestURL = _authURL;
|
QUrl requestURL = _authURL;
|
||||||
|
|
||||||
|
if (requestURL.isEmpty()) { // Assignment client doesn't set _authURL.
|
||||||
|
requestURL = NetworkingConstants::METAVERSE_SERVER_URL;
|
||||||
|
}
|
||||||
|
|
||||||
if (path.startsWith("/")) {
|
if (path.startsWith("/")) {
|
||||||
requestURL.setPath(path);
|
requestURL.setPath(path);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
#include "udt/PacketHeaders.h"
|
#include "udt/PacketHeaders.h"
|
||||||
|
|
||||||
#if USE_STABLE_GLOBAL_SERVICES
|
#if USE_STABLE_GLOBAL_SERVICES
|
||||||
const QString DEFAULT_HIFI_ADDRESS = "hifi://welcome";
|
const QString DEFAULT_HIFI_ADDRESS = "hifi://welcome/hello";
|
||||||
#else
|
#else
|
||||||
const QString DEFAULT_HIFI_ADDRESS = "hifi://dev-welcome";
|
const QString DEFAULT_HIFI_ADDRESS = "hifi://dev-welcome/hello";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager";
|
const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager";
|
||||||
|
|
|
@ -185,6 +185,10 @@ PhysicsMotionType EntityMotionState::computePhysicsMotionType() const {
|
||||||
return MOTION_TYPE_STATIC;
|
return MOTION_TYPE_STATIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_entity->getLocked()) {
|
||||||
|
return MOTION_TYPE_STATIC;
|
||||||
|
}
|
||||||
|
|
||||||
if (_entity->getDynamic()) {
|
if (_entity->getDynamic()) {
|
||||||
if (!_entity->getParentID().isNull()) {
|
if (!_entity->getParentID().isNull()) {
|
||||||
// if something would have been dynamic but is a child of something else, force it to be kinematic, instead.
|
// if something would have been dynamic but is a child of something else, force it to be kinematic, instead.
|
||||||
|
|
|
@ -58,6 +58,10 @@ void ObjectAction::updateAction(btCollisionWorld* collisionWorld, btScalar delta
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ownerEntity->getLocked()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
updateActionWorker(deltaTimeStep);
|
updateActionWorker(deltaTimeStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,11 @@ RunningMarker::~RunningMarker() {
|
||||||
_runningMarkerThread->deleteLater();
|
_runningMarkerThread->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RunningMarker::fileExists() const {
|
||||||
|
QFile runningMarkerFile(getFilePath());
|
||||||
|
return runningMarkerFile.exists();
|
||||||
|
}
|
||||||
|
|
||||||
void RunningMarker::writeRunningMarkerFile() {
|
void RunningMarker::writeRunningMarkerFile() {
|
||||||
QFile runningMarkerFile(getFilePath());
|
QFile runningMarkerFile(getFilePath());
|
||||||
|
|
||||||
|
@ -69,7 +74,7 @@ void RunningMarker::deleteRunningMarkerFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RunningMarker::getFilePath() {
|
QString RunningMarker::getFilePath() const {
|
||||||
return QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + _name;
|
return QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,11 @@ public:
|
||||||
|
|
||||||
void startRunningMarker();
|
void startRunningMarker();
|
||||||
|
|
||||||
QString getFilePath();
|
QString getFilePath() const;
|
||||||
static QString getMarkerFilePath(QString name);
|
static QString getMarkerFilePath(QString name);
|
||||||
|
|
||||||
|
bool fileExists() const;
|
||||||
|
|
||||||
void writeRunningMarkerFile();
|
void writeRunningMarkerFile();
|
||||||
void deleteRunningMarkerFile();
|
void deleteRunningMarkerFile();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,15 @@ StoragePointer FileStorage::create(const QString& filename, size_t size, const u
|
||||||
}
|
}
|
||||||
|
|
||||||
FileStorage::FileStorage(const QString& filename) : _file(filename) {
|
FileStorage::FileStorage(const QString& filename) : _file(filename) {
|
||||||
if (_file.open(QFile::ReadOnly)) {
|
bool opened = _file.open(QFile::ReadWrite);
|
||||||
|
if (opened) {
|
||||||
|
_hasWriteAccess = true;
|
||||||
|
} else {
|
||||||
|
_hasWriteAccess = false;
|
||||||
|
opened = _file.open(QFile::ReadOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opened) {
|
||||||
_mapped = _file.map(0, _file.size());
|
_mapped = _file.map(0, _file.size());
|
||||||
if (_mapped) {
|
if (_mapped) {
|
||||||
_valid = true;
|
_valid = true;
|
||||||
|
@ -92,34 +100,3 @@ FileStorage::~FileStorage() {
|
||||||
_file.close();
|
_file.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileStorage::ensureWriteAccess() {
|
|
||||||
if (_hasWriteAccess) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_mapped) {
|
|
||||||
if (!_file.unmap(_mapped)) {
|
|
||||||
throw std::runtime_error("Unable to unmap file");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_file.isOpen()) {
|
|
||||||
_file.close();
|
|
||||||
}
|
|
||||||
_valid = false;
|
|
||||||
_mapped = nullptr;
|
|
||||||
|
|
||||||
if (_file.open(QFile::ReadWrite)) {
|
|
||||||
_mapped = _file.map(0, _file.size());
|
|
||||||
if (_mapped) {
|
|
||||||
_valid = true;
|
|
||||||
_hasWriteAccess = true;
|
|
||||||
} else {
|
|
||||||
qCWarning(storagelogging) << "Failed to map file " << _file.fileName();
|
|
||||||
throw std::runtime_error("Failed to map file");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qCWarning(storagelogging) << "Failed to open file " << _file.fileName();
|
|
||||||
throw std::runtime_error("Failed to open file");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -60,11 +60,10 @@ namespace storage {
|
||||||
FileStorage& operator=(const FileStorage& other) = delete;
|
FileStorage& operator=(const FileStorage& other) = delete;
|
||||||
|
|
||||||
const uint8_t* data() const override { return _mapped; }
|
const uint8_t* data() const override { return _mapped; }
|
||||||
uint8_t* mutableData() override { ensureWriteAccess(); return _mapped; }
|
uint8_t* mutableData() override { return _hasWriteAccess ? _mapped : nullptr; }
|
||||||
size_t size() const override { return _file.size(); }
|
size_t size() const override { return _file.size(); }
|
||||||
operator bool() const override { return _valid; }
|
operator bool() const override { return _valid; }
|
||||||
private:
|
private:
|
||||||
void ensureWriteAccess();
|
|
||||||
|
|
||||||
bool _valid { false };
|
bool _valid { false };
|
||||||
bool _hasWriteAccess { false };
|
bool _hasWriteAccess { false };
|
||||||
|
|
|
@ -42,7 +42,7 @@ const appIcon = path.join(__dirname, '../resources/console.png');
|
||||||
const DELETE_LOG_FILES_OLDER_THAN_X_SECONDS = 60 * 60 * 24 * 7; // 7 Days
|
const DELETE_LOG_FILES_OLDER_THAN_X_SECONDS = 60 * 60 * 24 * 7; // 7 Days
|
||||||
const LOG_FILE_REGEX = /(domain-server|ac-monitor|ac)-.*-std(out|err).txt/;
|
const LOG_FILE_REGEX = /(domain-server|ac-monitor|ac)-.*-std(out|err).txt/;
|
||||||
|
|
||||||
const HOME_CONTENT_URL = "http://cdn.highfidelity.com/content-sets/home-tutorial-RC39.tar.gz";
|
const HOME_CONTENT_URL = "http://cdn.highfidelity.com/content-sets/home-tutorial-RC40.tar.gz";
|
||||||
|
|
||||||
function getBuildInfo() {
|
function getBuildInfo() {
|
||||||
var buildInfoPath = null;
|
var buildInfoPath = null;
|
||||||
|
|
Loading…
Reference in a new issue