Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all
Unified · Split
| @@ -309,8 +309,13 @@ Application::~Application() { · 308 unmodified lines | ||
| 309 | 309 | delete idleTimer; |
| 310 | 310 | |
| 311 | 311 | Menu::getInstance()->saveSettings(); |
| 312 | − | |
| 313 | 312 | _rearMirrorTools->saveSettings(_settings); |
| 313 | + | |
| 314 | + _sharedVoxelSystem.changeTree(new VoxelTree); | |
| 315 | + if (_voxelImporter) { | |
| 316 | + _voxelImporter->saveSettings(_settings); | |
| 317 | + delete _voxelImporter; | |
| 318 | + } | |
| 314 | 319 | _settings->sync(); |
| 315 | 320 | |
| 316 | 321 | // let the avatar mixer know we're out |
| @@ -331,7 +336,6 @@ Application::~Application() { · 14 unmodified lines | ||
| 331 | 336 | |
| 332 | 337 | storeSizeAndPosition(); |
| 333 | 338 | saveScripts(); |
| 334 | − _sharedVoxelSystem.changeTree(new VoxelTree); | |
| 335 | 339 | |
| 336 | 340 | VoxelTreeElement::removeDeleteHook(&_voxels); // we don't need to do this processing on shutdown |
| 337 | 341 | Menu::getInstance()->deleteLater(); |
| @@ -1299,8 +1303,14 @@ void Application::mousePressEvent(QMouseEvent* event) { · 961 unmodified lines | ||
| 1299 | 1303 | pasteVoxels(); |
| 1300 | 1304 | } |
| 1301 | 1305 | |
| 1302 | − } else if (event->button() == Qt::RightButton && Menu::getInstance()->isVoxelModeActionChecked()) { | |
| 1303 | − deleteVoxelUnderCursor(); | |
| 1306 | + } else if (event->button() == Qt::RightButton) { | |
| 1307 | + if (Menu::getInstance()->isVoxelModeActionChecked()) { | |
| 1308 | + deleteVoxelUnderCursor(); | |
| 1309 | + } | |
| 1310 | + if (_pasteMode) { | |
| 1311 | + _pasteMode = false; | |
| 1312 | + } | |
| 1313 | + | |
| 1304 | 1314 | } |
| 1305 | 1315 | } |
| 1306 | 1316 | } |
| @@ -1710,13 +1720,19 @@ void Application::exportVoxels() { · 403 unmodified lines | ||
| 1710 | 1720 | void Application::importVoxels() { |
| 1711 | 1721 | if (!_voxelImporter) { |
| 1712 | 1722 | _voxelImporter = new VoxelImporter(_window); |
| 1713 | − _voxelImporter->init(_settings); | |
| 1723 | + _voxelImporter->loadSettings(_settings); | |
| 1714 | 1724 | } |
| 1715 | 1725 | |
| 1716 | − if (_voxelImporter->exec()) { | |
| 1717 | − qDebug("[DEBUG] Import succeeded."); | |
| 1726 | + if (!_voxelImporter->exec()) { | |
| 1727 | + qDebug() << "[DEBUG] Import succeeded." << endl; | |
| 1728 | + Menu::getInstance()->setIsOptionChecked(MenuOption::VoxelSelectMode, true); | |
| 1729 | + _pasteMode = true; | |
| 1718 | 1730 | } else { |
| 1719 | − qDebug("[DEBUG] Import failed."); | |
| 1731 | + qDebug() << "[DEBUG] Import failed." << endl; | |
| 1732 | + if (_sharedVoxelSystem.getTree() == _voxelImporter->getVoxelTree()) { | |
| 1733 | + _sharedVoxelSystem.killLocalVoxels(); | |
| 1734 | + _sharedVoxelSystem.changeTree(&_clipboard); | |
| 1735 | + } | |
| 1720 | 1736 | } |
| 1721 | 1737 | |
| 1722 | 1738 | // restore the main window's active state |
| @@ -1773,10 +1789,11 @@ void Application::pasteVoxels() { · 50 unmodified lines | ||
| 1773 | 1789 | } |
| 1774 | 1790 | |
| 1775 | 1791 | pasteVoxelsToOctalCode(octalCodeDestination); |
| 1776 | − | |
| 1792 | + | |
| 1777 | 1793 | if (calculatedOctCode) { |
| 1778 | 1794 | delete[] calculatedOctCode; |
| 1779 | 1795 | } |
| 1796 | + _pasteMode = false; | |
| 1780 | 1797 | } |
| 1781 | 1798 | |
| 1782 | 1799 | void Application::findAxisAlignment() { |
| @@ -1848,6 +1865,7 @@ void Application::init() { · 65 unmodified lines | ||
| 1848 | 1865 | |
| 1849 | 1866 | VoxelTreeElement::removeUpdateHook(&_sharedVoxelSystem); |
| 1850 | 1867 | |
| 1868 | + // Cleanup of the original shared tree | |
| 1851 | 1869 | _sharedVoxelSystem.init(); |
| 1852 | 1870 | VoxelTree* tmpTree = _sharedVoxelSystem.getTree(); |
| 1853 | 1871 | _sharedVoxelSystem.changeTree(&_clipboard); |
| @@ -1939,12 +1957,11 @@ void Application::init() { · 85 unmodified lines | ||
| 1939 | 1957 | _audio.init(_glWidget); |
| 1940 | 1958 | |
| 1941 | 1959 | _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings); |
| 1960 | + | |
| 1942 | 1961 | connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); |
| 1943 | 1962 | connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); |
| 1944 | 1963 | connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); |
| 1945 | 1964 | connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); |
| 1946 | − | |
| 1947 | − | |
| 1948 | 1965 | } |
| 1949 | 1966 | |
| 1950 | 1967 | void Application::closeMirrorView() { |