History

Moved GLCanvas in DM and DM to QSharedPointers

Atlante45 committed 11 years ago

Commit e5e2eb41 parent 68430e124 files · +143 −146Browse files

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

Unified · Split

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

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