Showing the changes to interface/src/Application.cpp (1 of 24 files). Show all
Unified · Split
| @@ -194,7 +194,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 193 unmodified lines | ||
| 194 | 194 | _isVSyncOn(true), |
| 195 | 195 | _aboutToQuit(false) |
| 196 | 196 | { |
| 197 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 197 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 198 | 198 | |
| 199 | 199 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| 200 | 200 | QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); |
| @@ -365,7 +365,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 164 unmodified lines | ||
| 365 | 365 | |
| 366 | 366 | ResourceCache::setRequestLimit(3); |
| 367 | 367 | |
| 368 | − _window->setCentralWidget(glCanvas); | |
| 368 | + _window->setCentralWidget(glCanvas.data()); | |
| 369 | 369 | |
| 370 | 370 | restoreSizeAndPosition(); |
| 371 | 371 | |
| @@ -393,7 +393,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 21 unmodified lines | ||
| 393 | 393 | |
| 394 | 394 | checkVersion(); |
| 395 | 395 | |
| 396 | − _overlays.init(glCanvas); // do this before scripts load | |
| 396 | + _overlays.init(glCanvas.data()); // do this before scripts load | |
| 397 | 397 | |
| 398 | 398 | LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree()); |
| 399 | 399 | LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard); |
| @@ -442,6 +442,8 @@ void Application::aboutToQuit() { · 42 unmodified lines | ||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | Application::~Application() { |
| 445 | + DependencyManager::get<GLCanvas>()->setParent(NULL); | |
| 446 | + | |
| 445 | 447 | _entities.getTree()->setSimulation(NULL); |
| 446 | 448 | qInstallMessageHandler(NULL); |
| 447 | 449 | |
| @@ -1046,7 +1048,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 598 unmodified lines | ||
| 1046 | 1048 | if (isShifted) { |
| 1047 | 1049 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f); |
| 1048 | 1050 | if (TV3DManager::isConnected()) { |
| 1049 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1051 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1050 | 1052 | TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 1051 | 1053 | } |
| 1052 | 1054 | } else { |
| @@ -1059,7 +1061,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 6 unmodified lines | ||
| 1059 | 1061 | if (isShifted) { |
| 1060 | 1062 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f); |
| 1061 | 1063 | if (TV3DManager::isConnected()) { |
| 1062 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1064 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1063 | 1065 | TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 1064 | 1066 | } |
| 1065 | 1067 | |
| @@ -1532,7 +1534,7 @@ void Application::idle() { · 466 unmodified lines | ||
| 1532 | 1534 | |
| 1533 | 1535 | void Application::checkBandwidthMeterClick() { |
| 1534 | 1536 | // ... to be called upon button release |
| 1535 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1537 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1536 | 1538 | if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) && |
| 1537 | 1539 | Menu::getInstance()->isOptionChecked(MenuOption::Stats) && |
| 1538 | 1540 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) && |
| @@ -1568,7 +1570,7 @@ void Application::setFullscreen(bool fullscreen) { · 29 unmodified lines | ||
| 1568 | 1570 | } |
| 1569 | 1571 | |
| 1570 | 1572 | void Application::setEnable3DTVMode(bool enable3DTVMode) { |
| 1571 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1573 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1572 | 1574 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 1573 | 1575 | } |
| 1574 | 1576 | |
| @@ -1594,7 +1596,7 @@ void Application::setEnableVRMode(bool enableVRMode) { · 19 unmodified lines | ||
| 1594 | 1596 | _myCamera.setHmdRotation(glm::quat()); |
| 1595 | 1597 | } |
| 1596 | 1598 | |
| 1597 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1599 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1598 | 1600 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 1599 | 1601 | } |
| 1600 | 1602 | |
| @@ -1657,7 +1659,7 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox · 56 unmodified lines | ||
| 1657 | 1659 | |
| 1658 | 1660 | bool Application::mouseOnScreen() const { |
| 1659 | 1661 | if (OculusManager::isConnected()) { |
| 1660 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1662 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 1661 | 1663 | return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() && |
| 1662 | 1664 | getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight(); |
| 1663 | 1665 | } |
| @@ -1699,13 +1701,13 @@ int Application::getMouseDragStartedY() const { · 35 unmodified lines | ||
| 1699 | 1701 | } |
| 1700 | 1702 | |
| 1701 | 1703 | FaceTracker* Application::getActiveFaceTracker() { |
| 1702 | − Faceshift* faceshift = DependencyManager::get<Faceshift>(); | |
| 1703 | − Visage* visage = DependencyManager::get<Visage>(); | |
| 1704 | − DdeFaceTracker* dde = DependencyManager::get<DdeFaceTracker>(); | |
| 1704 | + QSharedPointer<Faceshift> faceshift = DependencyManager::get<Faceshift>(); | |
| 1705 | + QSharedPointer<Visage> visage = DependencyManager::get<Visage>(); | |
| 1706 | + QSharedPointer<DdeFaceTracker> dde = DependencyManager::get<DdeFaceTracker>(); | |
| 1705 | 1707 | |
| 1706 | − return (dde->isActive() ? static_cast<FaceTracker*>(dde) : | |
| 1707 | − (faceshift->isActive() ? static_cast<FaceTracker*>(faceshift) : | |
| 1708 | − (visage->isActive() ? static_cast<FaceTracker*>(visage) : NULL))); | |
| 1708 | + return (dde->isActive() ? static_cast<FaceTracker*>(dde.data()) : | |
| 1709 | + (faceshift->isActive() ? static_cast<FaceTracker*>(faceshift.data()) : | |
| 1710 | + (visage->isActive() ? static_cast<FaceTracker*>(visage.data()) : NULL))); | |
| 1709 | 1711 | } |
| 1710 | 1712 | |
| 1711 | 1713 | struct SendVoxelsOperationArgs { |
| @@ -1778,7 +1780,7 @@ void Application::exportVoxels(const VoxelDetail& sourceVoxel) { · 66 unmodified lines | ||
| 1778 | 1780 | QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); |
| 1779 | 1781 | QString suggestedName = desktopLocation.append("/voxels.svo"); |
| 1780 | 1782 | |
| 1781 | − QString fileNameString = QFileDialog::getSaveFileName(DependencyManager::get<GLCanvas>(), | |
| 1783 | + QString fileNameString = QFileDialog::getSaveFileName(DependencyManager::get<GLCanvas>().data(), | |
| 1782 | 1784 | tr("Export Voxels"), suggestedName, |
| 1783 | 1785 | tr("Sparse Voxel Octree Files (*.svo)")); |
| 1784 | 1786 | QByteArray fileNameAscii = fileNameString.toLocal8Bit(); |
| @@ -2034,9 +2036,9 @@ void Application::init() { · 249 unmodified lines | ||
| 2034 | 2036 | |
| 2035 | 2037 | _metavoxels.init(); |
| 2036 | 2038 | |
| 2037 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 2038 | − _audio.init(glCanvas); | |
| 2039 | − _rearMirrorTools = new RearMirrorTools(glCanvas, _mirrorViewRect, _settings); | |
| 2039 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 2040 | + _audio.init(glCanvas.data()); | |
| 2041 | + _rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect, _settings); | |
| 2040 | 2042 | |
| 2041 | 2043 | connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); |
| 2042 | 2044 | connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); |
| @@ -2115,7 +2117,7 @@ void Application::updateMouseRay() { · 72 unmodified lines | ||
| 2115 | 2117 | void Application::updateFaceshift() { |
| 2116 | 2118 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2117 | 2119 | PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); |
| 2118 | − Faceshift* faceshift = DependencyManager::get<Faceshift>(); | |
| 2120 | + Faceshift* faceshift = DependencyManager::get<Faceshift>().data(); | |
| 2119 | 2121 | // Update faceshift |
| 2120 | 2122 | faceshift->update(); |
| 2121 | 2123 | |
| @@ -2919,7 +2921,7 @@ void Application::updateShadowMap() { · 797 unmodified lines | ||
| 2919 | 2921 | |
| 2920 | 2922 | fbo->release(); |
| 2921 | 2923 | |
| 2922 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 2924 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 2923 | 2925 | glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 2924 | 2926 | } |
| 2925 | 2927 | |
| @@ -3247,7 +3249,7 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom · 321 unmodified lines | ||
| 3247 | 3249 | } |
| 3248 | 3250 | |
| 3249 | 3251 | glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { |
| 3250 | − GLCanvas* glCanvas = DependencyManager::get<GLCanvas>(); | |
| 3252 | + QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>(); | |
| 3251 | 3253 | float horizontalScale = glCanvas->getDeviceWidth() / 2.0f; |
| 3252 | 3254 | float verticalScale = glCanvas->getDeviceHeight() / 2.0f; |
| 3253 | 3255 | |
| @@ -4260,7 +4262,7 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio · 1006 unmodified lines | ||
| 4260 | 4262 | |
| 4261 | 4263 | void Application::loadDialog() { |
| 4262 | 4264 | |
| 4263 | − QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get<GLCanvas>(), | |
| 4265 | + QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get<GLCanvas>().data(), | |
| 4264 | 4266 | tr("Open Script"), |
| 4265 | 4267 | getPreviousScriptLocation(), |
| 4266 | 4268 | tr("JavaScript Files (*.js)")); |
| @@ -4297,7 +4299,7 @@ void Application::loadScriptURLDialog() { · 30 unmodified lines | ||
| 4297 | 4299 | |
| 4298 | 4300 | void Application::toggleLogDialog() { |
| 4299 | 4301 | if (! _logDialog) { |
| 4300 | − _logDialog = new LogDialog(DependencyManager::get<GLCanvas>(), getLogger()); | |
| 4302 | + _logDialog = new LogDialog(DependencyManager::get<GLCanvas>().data(), getLogger()); | |
| 4301 | 4303 | } |
| 4302 | 4304 | |
| 4303 | 4305 | if (_logDialog->isVisible()) { |
| @@ -4357,7 +4359,7 @@ void Application::parseVersionXml() { · 53 unmodified lines | ||
| 4357 | 4359 | } |
| 4358 | 4360 | |
| 4359 | 4361 | if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) { |
| 4360 | − new UpdateDialog(DependencyManager::get<GLCanvas>(), releaseNotes, latestVersion, downloadUrl); | |
| 4362 | + new UpdateDialog(DependencyManager::get<GLCanvas>().data(), releaseNotes, latestVersion, downloadUrl); | |
| 4361 | 4363 | } |
| 4362 | 4364 | sender->deleteLater(); |
| 4363 | 4365 | } |
| @@ -4390,7 +4392,7 @@ void Application::takeSnapshot() { · 26 unmodified lines | ||
| 4390 | 4392 | } |
| 4391 | 4393 | |
| 4392 | 4394 | if (!_snapshotShareDialog) { |
| 4393 | − _snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get<GLCanvas>()); | |
| 4395 | + _snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get<GLCanvas>().data()); | |
| 4394 | 4396 | } |
| 4395 | 4397 | _snapshotShareDialog->show(); |
| 4396 | 4398 | } |