Merge branch 'master' of github.com:highfidelity/hifi into fix-imported-children-querybox

This commit is contained in:
Seth Alves 2017-05-19 17:37:03 -07:00
commit a45b5599c9
7 changed files with 18 additions and 13 deletions

View file

@ -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)),

View file

@ -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;

View file

@ -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;
} }

View file

@ -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 {

View file

@ -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();

View file

@ -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;
} }

View file

@ -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();