History

Merge branch 'master' into 20280

David Rowe committed 11 years ago

Commit 3c7cdc12 parents 44083dd e73a000209 files · +7380 −4838Browse files

Showing the changes to interface/src/Application.cpp (1 of 209 files). Show all

Unified · Split

interface/src/Application.cpp+172−170
@@ -38,8 +38,8 @@ · 37 unmodified lines
38#include <QObject>38#include <QObject>
39#include <QWheelEvent>39#include <QWheelEvent>
40#include <QScreen>40#include <QScreen>
41#include <QSettings>
42#include <QShortcut>41#include <QShortcut>
42#include <QSystemTrayIcon>
43#include <QTimer>43#include <QTimer>
44#include <QUrl>44#include <QUrl>
45#include <QWindow>45#include <QWindow>
@@ -73,13 +73,16 @@ · 27 unmodified lines
73#include <PhysicsEngine.h>73#include <PhysicsEngine.h>
74#include <ProgramObject.h>74#include <ProgramObject.h>
75#include <ResourceCache.h>75#include <ResourceCache.h>
76#include <Settings.h>
76#include <SoundCache.h>77#include <SoundCache.h>
77#include <TextRenderer.h>78#include <TextRenderer.h>
78#include <UserActivityLogger.h>79#include <UserActivityLogger.h>
79#include <UUID.h>80#include <UUID.h>
80 81
81#include "Application.h"82#include "Application.h"
83#include "Audio.h"
82#include "InterfaceVersion.h"84#include "InterfaceVersion.h"
85#include "LODManager.h"
83#include "Menu.h"86#include "Menu.h"
84#include "ModelUploader.h"87#include "ModelUploader.h"
85#include "Util.h"88#include "Util.h"
@@ -100,7 +103,6 @@ · 14 unmodified lines
100#include "gpu/Batch.h"103#include "gpu/Batch.h"
101#include "gpu/GLBackend.h"104#include "gpu/GLBackend.h"
102 105
103
104#include "scripting/AccountScriptingInterface.h"106#include "scripting/AccountScriptingInterface.h"
105#include "scripting/AudioDeviceScriptingInterface.h"107#include "scripting/AudioDeviceScriptingInterface.h"
106#include "scripting/ClipboardScriptingInterface.h"108#include "scripting/ClipboardScriptingInterface.h"
@@ -112,9 +114,16 @@ · 5 unmodified lines
112#include "scripting/WindowScriptingInterface.h"114#include "scripting/WindowScriptingInterface.h"
113#include "scripting/WebWindowClass.h"115#include "scripting/WebWindowClass.h"
114 116
117#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
118#include "SpeechRecognizer.h"
119#endif
120
115#include "ui/DataWebDialog.h"121#include "ui/DataWebDialog.h"
122#include "ui/DialogsManager.h"
116#include "ui/InfoView.h"123#include "ui/InfoView.h"
124#include "ui/LoginDialog.h"
117#include "ui/Snapshot.h"125#include "ui/Snapshot.h"
126#include "ui/StandAloneJSConsole.h"
118#include "ui/Stats.h"127#include "ui/Stats.h"
119 128
120 129
@@ -137,6 +146,12 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D · 16 unmodified lines
137 146
138const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js";147const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js";
139 148
149namespace SettingHandles {
150 const SettingHandle<bool> firstRun("firstRun", true);
151 const SettingHandle<QString> lastScriptLocation("LastScriptLocation");
152 const SettingHandle<QString> scriptsLocation("scriptsLocation");
153}
154
140void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {155void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {
141 QString logMessage = LogHandler::getInstance().printMessage((LogMsgType) type, context, message);156 QString logMessage = LogHandler::getInstance().printMessage((LogMsgType) type, context, message);
142 157
@@ -153,6 +168,16 @@ bool setupEssentials(int& argc, char** argv) { · 10 unmodified lines
153 listenPort = atoi(portStr);168 listenPort = atoi(portStr);
154 }169 }
155 170
171 // read the ApplicationInfo.ini file for Name/Version/Domain information
172 QSettings::setDefaultFormat(QSettings::IniFormat);
173 QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
174 // set the associated application properties
175 applicationInfo.beginGroup("INFO");
176 QApplication::setApplicationName(applicationInfo.value("name").toString());
177 QApplication::setApplicationVersion(BUILD_VERSION);
178 QApplication::setOrganizationName(applicationInfo.value("organizationName").toString());
179 QApplication::setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
180
156 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();181 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
157 182
158 // Set dependencies183 // Set dependencies
@@ -173,6 +198,12 @@ bool setupEssentials(int& argc, char** argv) { · 14 unmodified lines
173 auto ddeFaceTracker = DependencyManager::set<DdeFaceTracker>();198 auto ddeFaceTracker = DependencyManager::set<DdeFaceTracker>();
174 auto modelBlender = DependencyManager::set<ModelBlender>();199 auto modelBlender = DependencyManager::set<ModelBlender>();
175 auto audioToolBox = DependencyManager::set<AudioToolBox>();200 auto audioToolBox = DependencyManager::set<AudioToolBox>();
201 auto lodManager = DependencyManager::set<LODManager>();
202 auto jsConsole = DependencyManager::set<StandAloneJSConsole>();
203 auto dialogsManager = DependencyManager::set<DialogsManager>();
204#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
205 auto speechRecognizer = DependencyManager::set<SpeechRecognizer>();
206#endif
176 207
177 return true;208 return true;
178}209}
@@ -210,8 +241,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 31 unmodified lines
210 _mousePressed(false),241 _mousePressed(false),
211 _enableProcessOctreeThread(true),242 _enableProcessOctreeThread(true),
212 _octreeProcessor(),243 _octreeProcessor(),
213 _packetsPerSecond(0),244 _inPacketsPerSecond(0),
214 _bytesPerSecond(0),245 _outPacketsPerSecond(0),
246 _inBytesPerSecond(0),
247 _outBytesPerSecond(0),
215 _nodeBoundsDisplay(this),248 _nodeBoundsDisplay(this),
216 _previousScriptLocation(),249 _previousScriptLocation(),
217 _applicationOverlay(),250 _applicationOverlay(),
@@ -224,35 +257,21 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 6 unmodified lines
224 _aboutToQuit(false),257 _aboutToQuit(false),
225 _notifiedPacketVersionMismatchThisDomain(false)258 _notifiedPacketVersionMismatchThisDomain(false)
226{259{
227 auto glCanvas = DependencyManager::get<GLCanvas>();260 _logger = new FileLogger(this); // After setting organization name in order to get correct directory
228 auto nodeList = DependencyManager::get<NodeList>();261 qInstallMessageHandler(messageHandler);
229 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
230 262
263 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
264 _window->setWindowTitle("Interface");
231 265
232 // read the ApplicationInfo.ini file for Name/Version/Domain information266 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
233 QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);267
234 268 auto glCanvas = DependencyManager::get<GLCanvas>();
235 // set the associated application properties269 auto nodeList = DependencyManager::get<NodeList>();
236 applicationInfo.beginGroup("INFO");
237
238 setApplicationName(applicationInfo.value("name").toString());
239 setApplicationVersion(BUILD_VERSION);
240 setOrganizationName(applicationInfo.value("organizationName").toString());
241 setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
242
243 _logger = new FileLogger(this); // After setting organization name in order to get correct directory
244
245 QSettings::setDefaultFormat(QSettings::IniFormat);
246 270
247 _myAvatar = _avatarManager.getMyAvatar();271 _myAvatar = _avatarManager.getMyAvatar();
248 272
249 _applicationStartupTime = startup_time;273 _applicationStartupTime = startup_time;
250 274
251 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
252 _window->setWindowTitle("Interface");
253
254 qInstallMessageHandler(messageHandler);
255
256 qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());275 qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
257 276
258 _bookmarks = new Bookmarks(); // Before setting up the menu277 _bookmarks = new Bookmarks(); // Before setting up the menu
@@ -281,6 +300,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 22 unmodified lines
281 auto audioIO = DependencyManager::get<Audio>();300 auto audioIO = DependencyManager::get<Audio>();
282 audioIO->moveToThread(audioThread);301 audioIO->moveToThread(audioThread);
283 connect(audioThread, &QThread::started, audioIO.data(), &Audio::start);302 connect(audioThread, &QThread::started, audioIO.data(), &Audio::start);
303 connect(audioIO.data(), SIGNAL(muteToggled()), this, SLOT(audioMuteToggled()));
284 304
285 audioThread->start();305 audioThread->start();
286 306
@@ -292,7 +312,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 5 unmodified lines
292 connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(updateWindowTitle()));312 connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(updateWindowTitle()));
293 connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(clearDomainOctreeDetails()));313 connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(clearDomainOctreeDetails()));
294 connect(&domainHandler, &DomainHandler::settingsReceived, this, &Application::domainSettingsReceived);314 connect(&domainHandler, &DomainHandler::settingsReceived, this, &Application::domainSettingsReceived);
295 connect(&domainHandler, &DomainHandler::hostnameChanged, Menu::getInstance(), &Menu::clearLoginDialogDisplayedFlag);315 connect(&domainHandler, &DomainHandler::hostnameChanged,
316 DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress);
296 317
297 // update our location every 5 seconds in the data-server, assuming that we are authenticated with one318 // update our location every 5 seconds in the data-server, assuming that we are authenticated with one
298 const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000;319 const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000;
@@ -319,7 +340,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 20 unmodified lines
319 340
320 connect(&accountManager, &AccountManager::balanceChanged, this, &Application::updateWindowTitle);341 connect(&accountManager, &AccountManager::balanceChanged, this, &Application::updateWindowTitle);
321 342
322 connect(&accountManager, &AccountManager::authRequired, Menu::getInstance(), &Menu::loginForCurrentDomain);343 auto dialogsManager = DependencyManager::get<DialogsManager>();
344 connect(&accountManager, &AccountManager::authRequired, dialogsManager.data(), &DialogsManager::showLoginDialog);
323 connect(&accountManager, &AccountManager::usernameChanged, this, &Application::updateWindowTitle);345 connect(&accountManager, &AccountManager::usernameChanged, this, &Application::updateWindowTitle);
324 346
325 // once we have a profile in account manager make sure we generate a new keypair347 // once we have a profile in account manager make sure we generate a new keypair
@@ -340,9 +362,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 14 unmodified lines
340 362
341 connect(addressManager.data(), &AddressManager::rootPlaceNameChanged, this, &Application::updateWindowTitle);363 connect(addressManager.data(), &AddressManager::rootPlaceNameChanged, this, &Application::updateWindowTitle);
342 364
343 _settings = new QSettings(this);
344 _numChangedSettings = 0;
345
346 #ifdef _WIN32365 #ifdef _WIN32
347 WSADATA WsaData;366 WSADATA WsaData;
348 int wsaresult = WSAStartup(MAKEWORD(2,2), &WsaData);367 int wsaresult = WSAStartup(MAKEWORD(2,2), &WsaData);
@@ -383,7 +402,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 34 unmodified lines
383 402
384 _window->setCentralWidget(glCanvas.data());403 _window->setCentralWidget(glCanvas.data());
385 404
386 restoreSizeAndPosition();405 _window->restoreGeometry();
387 406
388 _window->setVisible(true);407 _window->setVisible(true);
389 glCanvas->setFocusPolicy(Qt::StrongFocus);408 glCanvas->setFocusPolicy(Qt::StrongFocus);
@@ -417,23 +436,31 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 27 unmodified lines
417 connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));436 connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
418 437
419 // check first run...438 // check first run...
420 QVariant firstRunValue = _settings->value("firstRun",QVariant(true));439 bool firstRun = SettingHandles::firstRun.get();
421 if (firstRunValue.isValid() && firstRunValue.toBool()) {440 if (firstRun) {
422 qDebug() << "This is a first run...";441 qDebug() << "This is a first run...";
423 // clear the scripts, and set out script to our default scripts442 // clear the scripts, and set out script to our default scripts
424 clearScriptsBeforeRunning();443 clearScriptsBeforeRunning();
425 loadScript(DEFAULT_SCRIPTS_JS_URL);444 loadScript(DEFAULT_SCRIPTS_JS_URL);
426 445
427 QMutexLocker locker(&_settingsMutex);446 SettingHandles::firstRun.set(false);
428 _settings->setValue("firstRun",QVariant(false));
429 } else {447 } else {
430 // do this as late as possible so that all required subsystems are initialized448 // do this as late as possible so that all required subsystems are initialized
431 loadScripts();449 loadScripts();
432 450
433 QMutexLocker locker(&_settingsMutex);451 _previousScriptLocation = SettingHandles::lastScriptLocation.get();
434 _previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString();
435 }452 }
436 453
454 loadSettings();
455 int SAVE_SETTINGS_INTERVAL = 10 * MSECS_PER_SECOND; // Let's save every seconds for now
456 connect(&_settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
457 connect(&_settingsThread, SIGNAL(started), &_settingsTimer, SLOT(start));
458 connect(&_settingsThread, &QThread::finished, &_settingsTimer, &QTimer::deleteLater);
459 _settingsTimer.moveToThread(&_settingsThread);
460 _settingsTimer.setSingleShot(false);
461 _settingsTimer.setInterval(SAVE_SETTINGS_INTERVAL);
462 _settingsThread.start();
463
437 _trayIcon->show();464 _trayIcon->show();
438 465
439 // set the local loopback interface for local sounds from audio scripts466 // set the local loopback interface for local sounds from audio scripts
@@ -454,12 +481,12 @@ void Application::aboutToQuit() { · 14 unmodified lines
454}481}
455 482
456Application::~Application() {483Application::~Application() {
484 saveSettings();
457 485
458 _entities.getTree()->setSimulation(NULL);486 _entities.getTree()->setSimulation(NULL);
459 qInstallMessageHandler(NULL);487 qInstallMessageHandler(NULL);
460 488
461 saveSettings();489 _window->saveGeometry();
462 storeSizeAndPosition();
463 490
464 int DELAY_TIME = 1000;491 int DELAY_TIME = 1000;
465 UserActivityLogger::getInstance().close(DELAY_TIME);492 UserActivityLogger::getInstance().close(DELAY_TIME);
@@ -496,45 +523,6 @@ Application::~Application() { · 30 unmodified lines
496 DependencyManager::destroy<GLCanvas>();523 DependencyManager::destroy<GLCanvas>();
497}524}
498 525
499void Application::saveSettings() {
500 Menu::getInstance()->saveSettings();
501 _rearMirrorTools->saveSettings(_settings);
502
503 _settings->sync();
504 _numChangedSettings = 0;
505}
506
507
508void Application::restoreSizeAndPosition() {
509 QRect available = desktop()->availableGeometry();
510
511 QMutexLocker locker(&_settingsMutex);
512 _settings->beginGroup("Window");
513
514 int x = (int)loadSetting(_settings, "x", 0);
515 int y = (int)loadSetting(_settings, "y", 0);
516 _window->move(x, y);
517
518 int width = (int)loadSetting(_settings, "width", available.width());
519 int height = (int)loadSetting(_settings, "height", available.height());
520 _window->resize(width, height);
521
522 _settings->endGroup();
523}
524
525void Application::storeSizeAndPosition() {
526 QMutexLocker locker(&_settingsMutex);
527 _settings->beginGroup("Window");
528
529 _settings->setValue("width", _window->rect().width());
530 _settings->setValue("height", _window->rect().height());
531
532 _settings->setValue("x", _window->pos().x());
533 _settings->setValue("y", _window->pos().y());
534
535 _settings->endGroup();
536}
537
538void Application::initializeGL() {526void Application::initializeGL() {
539 qDebug( "Created Display Window.");527 qDebug( "Created Display Window.");
540 528
@@ -657,7 +645,7 @@ void Application::paintGL() { · 116 unmodified lines
657 _myCamera.update(1.0f / _fps);645 _myCamera.update(1.0f / _fps);
658 }646 }
659 647
660 if (Menu::getInstance()->getShadowsEnabled()) {648 if (getShadowsEnabled()) {
661 updateShadowMap();649 updateShadowMap();
662 }650 }
663 651
@@ -713,6 +701,24 @@ void Application::paintGL() { · 49 unmodified lines
713 _frameCount++;701 _frameCount++;
714}702}
715 703
704void Application::runTests() {
705 runTimingTests();
706}
707
708void Application::audioMuteToggled() {
709 QAction* muteAction = Menu::getInstance()->getActionForOption(MenuOption::MuteAudio);
710 Q_CHECK_PTR(muteAction);
711 muteAction->setChecked(DependencyManager::get<Audio>()->isMuted());
712}
713
714void Application::aboutApp() {
715 InfoView::forcedShow(INFO_HELP_PATH);
716}
717
718void Application::showEditEntitiesHelp() {
719 InfoView::forcedShow(INFO_EDIT_ENTITIES_PATH);
720}
721
716void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height) {722void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height) {
717 if (OculusManager::isConnected()) {723 if (OculusManager::isConnected()) {
718 OculusManager::configureCamera(camera, width, height);724 OculusManager::configureCamera(camera, width, height);
@@ -720,7 +726,7 @@ void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height) · 1 unmodified line
720 TV3DManager::configureCamera(camera, width, height);726 TV3DManager::configureCamera(camera, width, height);
721 } else {727 } else {
722 camera.setAspectRatio((float)width / height);728 camera.setAspectRatio((float)width / height);
723 camera.setFieldOfView(Menu::getInstance()->getFieldOfView());729 camera.setFieldOfView(_viewFrustum.getFieldOfView());
724 }730 }
725}731}
726 732
@@ -773,19 +779,20 @@ void Application::controlledBroadcastToNodes(const QByteArray& packet, const Nod · 46 unmodified lines
773 int nReceivingNodes = DependencyManager::get<NodeList>()->broadcastToNodes(packet, NodeSet() << type);779 int nReceivingNodes = DependencyManager::get<NodeList>()->broadcastToNodes(packet, NodeSet() << type);
774 780
775 // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)781 // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)
776 BandwidthMeter::ChannelIndex channel;782 double bandwidth_amount = nReceivingNodes * packet.size();
777 switch (type) {783 switch (type) {
778 case NodeType::Agent:784 case NodeType::Agent:
779 case NodeType::AvatarMixer:785 case NodeType::AvatarMixer:
780 channel = BandwidthMeter::AVATARS;786 _bandwidthRecorder.avatarsChannel->output.updateValue(bandwidth_amount);
787 _bandwidthRecorder.totalChannel->input.updateValue(bandwidth_amount);
781 break;788 break;
782 case NodeType::EntityServer:789 case NodeType::EntityServer:
783 channel = BandwidthMeter::OCTREE;790 _bandwidthRecorder.octreeChannel->output.updateValue(bandwidth_amount);
791 _bandwidthRecorder.totalChannel->output.updateValue(bandwidth_amount);
784 break;792 break;
785 default:793 default:
786 continue;794 continue;
787 }795 }
788 _bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * packet.size());
789 }796 }
790}797}
791 798
@@ -1260,7 +1267,6 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { · 468 unmodified lines
1260 int horizontalOffset = MIRROR_VIEW_WIDTH;1267 int horizontalOffset = MIRROR_VIEW_WIDTH;
1261 Stats::getInstance()->checkClick(getMouseX(), getMouseY(),1268 Stats::getInstance()->checkClick(getMouseX(), getMouseY(),
1262 getMouseDragStartedX(), getMouseDragStartedY(), horizontalOffset);1269 getMouseDragStartedX(), getMouseDragStartedY(), horizontalOffset);
1263 checkBandwidthMeterClick();
1264 }1270 }
1265 1271
1266 // fire an action end event1272 // fire an action end event
@@ -1388,8 +1394,10 @@ void Application::timer() { · 121 unmodified lines
1388 1394
1389 _fps = (float)_frameCount / diffTime;1395 _fps = (float)_frameCount / diffTime;
1390 1396
1391 _packetsPerSecond = (float) _datagramProcessor.getPacketCount() / diffTime;1397 _inPacketsPerSecond = (float) _datagramProcessor.getInPacketCount() / diffTime;
1392 _bytesPerSecond = (float) _datagramProcessor.getByteCount() / diffTime;1398 _outPacketsPerSecond = (float) _datagramProcessor.getOutPacketCount() / diffTime;
1399 _inBytesPerSecond = (float) _datagramProcessor.getInByteCount() / diffTime;
1400 _outBytesPerSecond = (float) _datagramProcessor.getOutByteCount() / diffTime;
1393 _frameCount = 0;1401 _frameCount = 0;
1394 1402
1395 _datagramProcessor.resetCounters();1403 _datagramProcessor.resetCounters();
@@ -1443,31 +1451,10 @@ void Application::idle() { · 47 unmodified lines
1443 1451
1444 // After finishing all of the above work, restart the idle timer, allowing 2ms to process events.1452 // After finishing all of the above work, restart the idle timer, allowing 2ms to process events.
1445 idleTimer->start(2);1453 idleTimer->start(2);
1446
1447 if (_numChangedSettings > 0) {
1448 saveSettings();
1449 }
1450 }1454 }
1451 }1455 }
1452}1456}
1453 1457
1454void Application::checkBandwidthMeterClick() {
1455 // ... to be called upon button release
1456 auto glCanvas = DependencyManager::get<GLCanvas>();
1457 if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) &&
1458 Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
1459 Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) &&
1460 glm::compMax(glm::abs(glm::ivec2(getMouseX() - getMouseDragStartedX(),
1461 getMouseY() - getMouseDragStartedY())))
1462 <= BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH
1463 && _bandwidthMeter.isWithinArea(getMouseX(), getMouseY(), glCanvas->width(), glCanvas->height())) {
1464
1465 // The bandwidth meter is visible, the click didn't get dragged too far and
1466 // we actually hit the bandwidth meter
1467 Menu::getInstance()->bandwidthDetails();
1468 }
1469}
1470
1471void Application::setFullscreen(bool fullscreen) {1458void Application::setFullscreen(bool fullscreen) {
1472 if (Menu::getInstance()->isOptionChecked(MenuOption::Fullscreen) != fullscreen) {1459 if (Menu::getInstance()->isOptionChecked(MenuOption::Fullscreen) != fullscreen) {
1473 Menu::getInstance()->getActionForOption(MenuOption::Fullscreen)->setChecked(fullscreen);1460 Menu::getInstance()->getActionForOption(MenuOption::Fullscreen)->setChecked(fullscreen);
@@ -1602,6 +1589,20 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa · 128 unmodified lines
1602 return true;1589 return true;
1603}1590}
1604 1591
1592void Application::loadSettings() {
1593 DependencyManager::get<Audio>()->loadSettings();
1594 DependencyManager::get<LODManager>()->loadSettings();
1595 Menu::getInstance()->loadSettings();
1596 _myAvatar->loadData();
1597}
1598
1599void Application::saveSettings() {
1600 DependencyManager::get<Audio>()->saveSettings();
1601 DependencyManager::get<LODManager>()->saveSettings();
1602 Menu::getInstance()->saveSettings();
1603 _myAvatar->saveData();
1604}
1605
1605bool Application::importEntities(const QString& filename) {1606bool Application::importEntities(const QString& filename) {
1606 _entityClipboard.eraseAllOctreeElements();1607 _entityClipboard.eraseAllOctreeElements();
1607 bool success = _entityClipboard.readFromSVOFile(filename.toLocal8Bit().constData());1608 bool success = _entityClipboard.readFromSVOFile(filename.toLocal8Bit().constData());
@@ -1652,8 +1653,6 @@ void Application::init() { · 44 unmodified lines
1652 1653
1653 _timerStart.start();1654 _timerStart.start();
1654 _lastTimeUpdated.start();1655 _lastTimeUpdated.start();
1655
1656 Menu::getInstance()->loadSettings();
1657 1656
1658 // when --url in command line, teleport to location1657 // when --url in command line, teleport to location
1659 const QString HIFI_URL_COMMAND_LINE_KEY = "--url";1658 const QString HIFI_URL_COMMAND_LINE_KEY = "--url";
@@ -1671,11 +1670,11 @@ void Application::init() { · 11 unmodified lines
1671 if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseEnabled)) {1670 if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseEnabled)) {
1672 // on OS X we only setup sixense if the user wants it on - this allows running without the hid_init crash1671 // on OS X we only setup sixense if the user wants it on - this allows running without the hid_init crash
1673 // if hydra support is temporarily not required1672 // if hydra support is temporarily not required
1674 Menu::getInstance()->toggleSixense(true);1673 SixenseManager::getInstance().toggleSixense(true);
1675 }1674 }
1676#else1675#else
1677 // setup sixense1676 // setup sixense
1678 Menu::getInstance()->toggleSixense(true);1677 SixenseManager::getInstance().toggleSixense(true);
1679#endif1678#endif
1680 1679
1681 // initialize our face trackers after loading the menu settings1680 // initialize our face trackers after loading the menu settings
@@ -1714,16 +1713,13 @@ void Application::init() { · 32 unmodified lines
1714 _metavoxels.init();1713 _metavoxels.init();
1715 1714
1716 auto glCanvas = DependencyManager::get<GLCanvas>();1715 auto glCanvas = DependencyManager::get<GLCanvas>();
1717 _rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect, _settings);1716 _rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect);
1718 1717
1719 connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));1718 connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
1720 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));1719 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
1721 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));1720 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
1722 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));1721 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
1723 1722
1724 // save settings when avatar changes
1725 connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings);
1726
1727 // make sure our texture cache knows about window size changes1723 // make sure our texture cache knows about window size changes
1728 DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data());1724 DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data());
1729 1725
@@ -1765,9 +1761,9 @@ void Application::updateLOD() { · 35 unmodified lines
1765 PerformanceTimer perfTimer("LOD");1761 PerformanceTimer perfTimer("LOD");
1766 // adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode1762 // adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode
1767 if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD) && !isThrottleRendering()) {1763 if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD) && !isThrottleRendering()) {
1768 Menu::getInstance()->autoAdjustLOD(_fps);1764 DependencyManager::get<LODManager>()->autoAdjustLOD(_fps);
1769 } else {1765 } else {
1770 Menu::getInstance()->resetLODAdjust();1766 DependencyManager::get<LODManager>()->resetLODAdjust();
1771 }1767 }
1772}1768}
1773 1769
@@ -1884,7 +1880,7 @@ void Application::updateMyAvatarLookAtPosition() { · 110 unmodified lines
1884 // deflect using Faceshift gaze data1880 // deflect using Faceshift gaze data
1885 glm::vec3 origin = _myAvatar->getHead()->getEyePosition();1881 glm::vec3 origin = _myAvatar->getHead()->getEyePosition();
1886 float pitchSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? -1.0f : 1.0f;1882 float pitchSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? -1.0f : 1.0f;
1887 float deflection = Menu::getInstance()->getFaceshiftEyeDeflection();1883 float deflection = DependencyManager::get<Faceshift>()->getEyeDeflection();
1888 if (isLookingAtSomeone) {1884 if (isLookingAtSomeone) {
1889 deflection *= GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT;1885 deflection *= GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT;
1890 }1886 }
@@ -1956,14 +1952,15 @@ void Application::updateDialogs(float deltaTime) { · 65 unmodified lines
1956 PerformanceTimer perfTimer("updateDialogs");1952 PerformanceTimer perfTimer("updateDialogs");
1957 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);1953 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1958 PerformanceWarning warn(showWarnings, "Application::updateDialogs()");1954 PerformanceWarning warn(showWarnings, "Application::updateDialogs()");
1959 1955 auto dialogsManager = DependencyManager::get<DialogsManager>();
1956
1960 // Update bandwidth dialog, if any1957 // Update bandwidth dialog, if any
1961 BandwidthDialog* bandwidthDialog = Menu::getInstance()->getBandwidthDialog();1958 BandwidthDialog* bandwidthDialog = dialogsManager->getBandwidthDialog();
1962 if (bandwidthDialog) {1959 if (bandwidthDialog) {
1963 bandwidthDialog->update();1960 bandwidthDialog->update();
1964 }1961 }
1965 1962
1966 OctreeStatsDialog* octreeStatsDialog = Menu::getInstance()->getOctreeStatsDialog();1963 QPointer<OctreeStatsDialog> octreeStatsDialog = dialogsManager->getOctreeStatsDialog();
1967 if (octreeStatsDialog) {1964 if (octreeStatsDialog) {
1968 octreeStatsDialog->update();1965 octreeStatsDialog->update();
1969 }1966 }
@@ -2234,8 +2231,9 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 264 unmodified lines
2234 _octreeQuery.setCameraNearClip(_viewFrustum.getNearClip());2231 _octreeQuery.setCameraNearClip(_viewFrustum.getNearClip());
2235 _octreeQuery.setCameraFarClip(_viewFrustum.getFarClip());2232 _octreeQuery.setCameraFarClip(_viewFrustum.getFarClip());
2236 _octreeQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition());2233 _octreeQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition());
2237 _octreeQuery.setOctreeSizeScale(Menu::getInstance()->getOctreeSizeScale());2234 auto lodManager = DependencyManager::get<LODManager>();
2238 _octreeQuery.setBoundaryLevelAdjust(Menu::getInstance()->getBoundaryLevelAdjust());2235 _octreeQuery.setOctreeSizeScale(lodManager->getOctreeSizeScale());
2236 _octreeQuery.setBoundaryLevelAdjust(lodManager->getBoundaryLevelAdjust());
2239 2237
2240 unsigned char queryPacket[MAX_PACKET_SIZE];2238 unsigned char queryPacket[MAX_PACKET_SIZE];
2241 2239
@@ -2287,7 +2285,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 45 unmodified lines
2287 int perServerPPS = 0;2285 int perServerPPS = 0;
2288 const int SMALL_BUDGET = 10;2286 const int SMALL_BUDGET = 10;
2289 int perUnknownServer = SMALL_BUDGET;2287 int perUnknownServer = SMALL_BUDGET;
2290 int totalPPS = Menu::getInstance()->getMaxOctreePacketsPerSecond();2288 int totalPPS = _octreeQuery.getMaxOctreePacketsPerSecond();
2291 2289
2292 // determine PPS based on number of servers2290 // determine PPS based on number of servers
2293 if (inViewServers >= 1) {2291 if (inViewServers >= 1) {
@@ -2390,7 +2388,8 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 96 unmodified lines
2390 nodeList->writeUnverifiedDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node);2388 nodeList->writeUnverifiedDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node);
2391 2389
2392 // Feed number of bytes to corresponding channel of the bandwidth meter2390 // Feed number of bytes to corresponding channel of the bandwidth meter
2393 _bandwidthMeter.outputStream(BandwidthMeter::OCTREE).updateValue(packetLength);2391 _bandwidthRecorder.octreeChannel->output.updateValue(packetLength);
2392 _bandwidthRecorder.totalChannel->output.updateValue(packetLength);
2394 }2393 }
2395 });2394 });
2396}2395}
@@ -2408,7 +2407,7 @@ QRect Application::getDesirableApplicationGeometry() { · 11 unmodified lines
2408 2407
2409 // If our parent window is on the HMD, then don't use it's geometry, instead use2408 // If our parent window is on the HMD, then don't use it's geometry, instead use
2410 // the "main screen" geometry.2409 // the "main screen" geometry.
2411 HMDToolsDialog* hmdTools = Menu::getInstance()->getHMDToolsDialog();2410 HMDToolsDialog* hmdTools = DependencyManager::get<DialogsManager>()->getHMDToolsDialog();
2412 if (hmdTools && hmdTools->hasHMDScreen()) {2411 if (hmdTools && hmdTools->hasHMDScreen()) {
2413 QScreen* hmdScreen = hmdTools->getHMDScreen();2412 QScreen* hmdScreen = hmdTools->getHMDScreen();
2414 QWindow* appWindow = getWindow()->windowHandle();2413 QWindow* appWindow = getWindow()->windowHandle();
@@ -2633,15 +2632,15 @@ void Application::setupWorldLight() { · 218 unmodified lines
2633}2632}
2634 2633
2635bool Application::shouldRenderMesh(float largestDimension, float distanceToCamera) {2634bool Application::shouldRenderMesh(float largestDimension, float distanceToCamera) {
2636 return Menu::getInstance()->shouldRenderMesh(largestDimension, distanceToCamera);2635 return DependencyManager::get<LODManager>()->shouldRenderMesh(largestDimension, distanceToCamera);
2637}2636}
2638 2637
2639float Application::getSizeScale() const { 2638float Application::getSizeScale() const {
2640 return Menu::getInstance()->getOctreeSizeScale();2639 return DependencyManager::get<LODManager>()->getOctreeSizeScale();
2641}2640}
2642 2641
2643int Application::getBoundaryLevelAdjust() const { 2642int Application::getBoundaryLevelAdjust() const {
2644 return Menu::getInstance()->getBoundaryLevelAdjust();2643 return DependencyManager::get<LODManager>()->getBoundaryLevelAdjust();
2645}2644}
2646 2645
2647PickRay Application::computePickRay(float x, float y) {2646PickRay Application::computePickRay(float x, float y) {
@@ -2791,8 +2790,7 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 143 unmodified lines
2791 if (!selfAvatarOnly) {2790 if (!selfAvatarOnly) {
2792 // draw a red sphere2791 // draw a red sphere
2793 float originSphereRadius = 0.05f;2792 float originSphereRadius = 0.05f;
2794 glColor3f(1,0,0);2793 DependencyManager::get<GeometryCache>()->renderSphere(originSphereRadius, 15, 15, glm::vec4(1.0f, 0.0f, 0.0f, 1.0f));
2795 DependencyManager::get<GeometryCache>()->renderSphere(originSphereRadius, 15, 15);
2796 2794
2797 // also, metavoxels2795 // also, metavoxels
2798 if (Menu::getInstance()->isOptionChecked(MenuOption::Metavoxels)) {2796 if (Menu::getInstance()->isOptionChecked(MenuOption::Metavoxels)) {
@@ -2937,8 +2935,10 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom · 138 unmodified lines
2937 }2935 }
2938}2936}
2939 2937
2940bool Application::getShadowsEnabled() { 2938bool Application::getShadowsEnabled() {
2941 return Menu::getInstance()->getShadowsEnabled(); 2939 Menu* menubar = Menu::getInstance();
2940 return menubar->isOptionChecked(MenuOption::SimpleShadows) ||
2941 menubar->isOptionChecked(MenuOption::CascadedShadows);
2942}2942}
2943 2943
2944bool Application::getCascadeShadowsEnabled() { 2944bool Application::getCascadeShadowsEnabled() {
@@ -2983,7 +2983,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 38 unmodified lines
2983 _mirrorCamera.setPosition(_myAvatar->getPosition() +2983 _mirrorCamera.setPosition(_myAvatar->getPosition() +
2984 _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * BILLBOARD_DISTANCE * _myAvatar->getScale());2984 _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * BILLBOARD_DISTANCE * _myAvatar->getScale());
2985 2985
2986 } else if (_rearMirrorTools->getZoomLevel() == BODY) {2986 } else if (SettingHandles::rearViewZoomLevel.get() == BODY) {
2987 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees2987 _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
2988 _mirrorCamera.setPosition(_myAvatar->getChestPosition() +2988 _mirrorCamera.setPosition(_myAvatar->getChestPosition() +
2989 _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());2989 _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());
@@ -3377,48 +3377,49 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin · 387 unmodified lines
3377}3377}
3378 3378
3379void Application::packetSent(quint64 length) {3379void Application::packetSent(quint64 length) {
3380 _bandwidthMeter.outputStream(BandwidthMeter::OCTREE).updateValue(length);3380 _bandwidthRecorder.octreeChannel->output.updateValue(length);
3381 _bandwidthRecorder.totalChannel->output.updateValue(length);
3381}3382}
3382 3383
3384const QString SETTINGS_KEY = "Settings";
3385
3383void Application::loadScripts() {3386void Application::loadScripts() {
3384 // loads all saved scripts3387 // loads all saved scripts
3385 int size = lockSettings()->beginReadArray("Settings");3388 Settings settings;
3386 unlockSettings();3389 int size = settings.beginReadArray(SETTINGS_KEY);
3387 for (int i = 0; i < size; ++i){3390 for (int i = 0; i < size; ++i){
3388 lockSettings()->setArrayIndex(i);3391 settings.setArrayIndex(i);
3389 QString string = _settings->value("script").toString();3392 QString string = settings.value("script").toString();
3390 unlockSettings();
3391 if (!string.isEmpty()) {3393 if (!string.isEmpty()) {
3392 loadScript(string);3394 loadScript(string);
3393 }3395 }
3394 }3396 }
3395 3397 settings.endArray();
3396 QMutexLocker locker(&_settingsMutex);
3397 _settings->endArray();
3398}3398}
3399 3399
3400void Application::clearScriptsBeforeRunning() {3400void Application::clearScriptsBeforeRunning() {
3401 // clears all scripts from the settings3401 // clears all scripts from the settingsSettings settings;
3402 QMutexLocker locker(&_settingsMutex);3402 Settings settings;
3403 _settings->remove("Settings");3403 settings.beginWriteArray(SETTINGS_KEY);
3404 settings.remove("");
3404}3405}
3405 3406
3406void Application::saveScripts() {3407void Application::saveScripts() {
3407 // Saves all currently running user-loaded scripts3408 // Saves all currently running user-loaded scripts
3408 QMutexLocker locker(&_settingsMutex);3409 Settings settings;
3409 _settings->beginWriteArray("Settings");3410 settings.beginWriteArray(SETTINGS_KEY);
3410 3411 settings.remove("");
3412
3411 QStringList runningScripts = getRunningScripts();3413 QStringList runningScripts = getRunningScripts();
3412 int i = 0;3414 int i = 0;
3413 for (QStringList::const_iterator it = runningScripts.begin(); it != runningScripts.end(); it += 1) {3415 for (auto it = runningScripts.begin(); it != runningScripts.end(); ++it) {
3414 if (getScriptEngine(*it)->isUserLoaded()) {3416 if (getScriptEngine(*it)->isUserLoaded()) {
3415 _settings->setArrayIndex(i);3417 settings.setArrayIndex(i);
3416 _settings->setValue("script", *it);3418 settings.setValue("script", *it);
3417 i += 1;3419 ++i;
3418 }3420 }
3419 }3421 }
3420 3422 settings.endArray();
3421 _settings->endArray();
3422}3423}
3423 3424
3424QScriptValue joystickToScriptValue(QScriptEngine *engine, Joystick* const &in) {3425QScriptValue joystickToScriptValue(QScriptEngine *engine, Joystick* const &in) {
@@ -3445,7 +3446,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 20 unmodified lines
3445 scriptEngine->registerGlobalObject("Camera", &_myCamera);3446 scriptEngine->registerGlobalObject("Camera", &_myCamera);
3446 3447
3447#if defined(Q_OS_MAC) || defined(Q_OS_WIN)3448#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
3448 scriptEngine->registerGlobalObject("SpeechRecognizer", Menu::getInstance()->getSpeechRecognizer());3449 scriptEngine->registerGlobalObject("SpeechRecognizer", DependencyManager::get<SpeechRecognizer>().data());
3449#endif3450#endif
3450 3451
3451 ClipboardScriptingInterface* clipboardScriptable = new ClipboardScriptingInterface();3452 ClipboardScriptingInterface* clipboardScriptable = new ClipboardScriptingInterface();
@@ -3545,7 +3546,6 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser · 93 unmodified lines
3545 if (activateMainWindow && !loadScriptFromEditor) {3546 if (activateMainWindow && !loadScriptFromEditor) {
3546 _window->activateWindow();3547 _window->activateWindow();
3547 }3548 }
3548 bumpSettings();
3549 3549
3550 return scriptEngine;3550 return scriptEngine;
3551}3551}
@@ -3573,7 +3573,6 @@ void Application::scriptFinished(const QString& scriptName) { · 21 unmodified lines
3573 _scriptEnginesHash.erase(it);3573 _scriptEnginesHash.erase(it);
3574 _runningScriptsWidget->scriptStopped(scriptName);3574 _runningScriptsWidget->scriptStopped(scriptName);
3575 _runningScriptsWidget->setRunningScripts(getRunningScripts());3575 _runningScriptsWidget->setRunningScripts(getRunningScripts());
3576 bumpSettings();
3577 }3576 }
3578}3577}
3579 3578
@@ -3669,7 +3668,6 @@ void Application::openUrl(const QUrl& url) { · 89 unmodified lines
3669}3668}
3670 3669
3671void Application::updateMyAvatarTransform() {3670void Application::updateMyAvatarTransform() {
3672 bumpSettings();
3673 const float SIMULATION_OFFSET_QUANTIZATION = 16.0f; // meters3671 const float SIMULATION_OFFSET_QUANTIZATION = 16.0f; // meters
3674 glm::vec3 avatarPosition = _myAvatar->getPosition();3672 glm::vec3 avatarPosition = _myAvatar->getPosition();
3675 glm::vec3 physicsWorldOffset = _physicsEngine.getOriginOffset();3673 glm::vec3 physicsWorldOffset = _physicsEngine.getOriginOffset();
@@ -3686,7 +3684,6 @@ void Application::updateMyAvatarTransform() { · 10 unmodified lines
3686}3684}
3687 3685
3688void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject) {3686void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject) {
3689
3690 // from the domain-handler, figure out the satoshi cost per voxel and per meter cubed3687 // from the domain-handler, figure out the satoshi cost per voxel and per meter cubed
3691 const QString VOXEL_SETTINGS_KEY = "voxels";3688 const QString VOXEL_SETTINGS_KEY = "voxels";
3692 const QString PER_VOXEL_COST_KEY = "per-voxel-credits";3689 const QString PER_VOXEL_COST_KEY = "per-voxel-credits";
@@ -3729,9 +3726,7 @@ QString Application::getPreviousScriptLocation() { · 36 unmodified lines
3729 3726
3730void Application::setPreviousScriptLocation(const QString& previousScriptLocation) {3727void Application::setPreviousScriptLocation(const QString& previousScriptLocation) {
3731 _previousScriptLocation = previousScriptLocation;3728 _previousScriptLocation = previousScriptLocation;
3732 QMutexLocker locker(&_settingsMutex);3729 SettingHandles::lastScriptLocation.set(_previousScriptLocation);
3733 _settings->setValue("LastScriptLocation", _previousScriptLocation);
3734 bumpSettings();
3735}3730}
3736 3731
3737void Application::loadDialog() {3732void Application::loadDialog() {
@@ -3747,7 +3742,6 @@ void Application::loadDialog() { · 9 unmodified lines
3747}3742}
3748 3743
3749void Application::loadScriptURLDialog() {3744void Application::loadScriptURLDialog() {
3750
3751 QInputDialog scriptURLDialog(Application::getInstance()->getWindow());3745 QInputDialog scriptURLDialog(Application::getInstance()->getWindow());
3752 scriptURLDialog.setWindowTitle("Open and Run Script URL");3746 scriptURLDialog.setWindowTitle("Open and Run Script URL");
3753 scriptURLDialog.setLabelText("Script:");3747 scriptURLDialog.setLabelText("Script:");
@@ -3765,11 +3759,16 @@ void Application::loadScriptURLDialog() { · 11 unmodified lines
3765 }3759 }
3766 loadScript(newScript);3760 loadScript(newScript);
3767 }3761 }
3768
3769 sendFakeEnterEvent();
3770}3762}
3771 3763
3764QString Application::getScriptsLocation() const {
3765 return SettingHandles::scriptsLocation.get();
3766}
3772 3767
3768void Application::setScriptsLocation(const QString& scriptsLocation) {
3769 SettingHandles::scriptsLocation.set(scriptsLocation);
3770 emit scriptLocationChanged(scriptsLocation);
3771}
3773 3772
3774void Application::toggleLogDialog() {3773void Application::toggleLogDialog() {
3775 if (! _logDialog) {3774 if (! _logDialog) {
@@ -3789,6 +3788,7 @@ void Application::initAvatarAndViewFrustum() { · 13 unmodified lines
3789 3788
3790void Application::checkVersion() {3789void Application::checkVersion() {
3791 QNetworkRequest latestVersionRequest((QUrl(CHECK_VERSION_URL)));3790 QNetworkRequest latestVersionRequest((QUrl(CHECK_VERSION_URL)));
3791 latestVersionRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
3792 latestVersionRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);3792 latestVersionRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
3793 QNetworkReply* reply = NetworkAccessManager::getInstance().get(latestVersionRequest);3793 QNetworkReply* reply = NetworkAccessManager::getInstance().get(latestVersionRequest);
3794 connect(reply, SIGNAL(finished()), SLOT(parseVersionXml()));3794 connect(reply, SIGNAL(finished()), SLOT(parseVersionXml()));
@@ -3871,7 +3871,8 @@ void Application::takeSnapshot() { · 76 unmodified lines
3871 _snapshotShareDialog->show();3871 _snapshotShareDialog->show();
3872}3872}
3873 3873
3874void Application::setVSyncEnabled(bool vsyncOn) {3874void Application::setVSyncEnabled() {
3875 bool vsyncOn = Menu::getInstance()->isOptionChecked(MenuOption::RenderTargetFramerateVSyncOn);
3875#if defined(Q_OS_WIN)3876#if defined(Q_OS_WIN)
3876 if (wglewGetExtension("WGL_EXT_swap_control")) {3877 if (wglewGetExtension("WGL_EXT_swap_control")) {
3877 wglSwapIntervalEXT(vsyncOn);3878 wglSwapIntervalEXT(vsyncOn);
@@ -3895,6 +3896,7 @@ void Application::setVSyncEnabled(bool vsyncOn) { · 17 unmodified lines
3895#else3896#else
3896 qDebug("V-Sync is FORCED ON on this system\n");3897 qDebug("V-Sync is FORCED ON on this system\n");
3897#endif3898#endif
3899 vsyncOn = true; // Turns off unused variable warning
3898}3900}
3899 3901
3900bool Application::isVSyncOn() const {3902bool Application::isVSyncOn() const {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t