History

Added switch to pasteMode after successful import.

Atlante45 committed 12 years ago

Commit f24cd0c1 parent 64031701 file · +29 −12Browse files

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

Unified · Split

interface/src/Application.cpp+29−12
@@ -309,8 +309,13 @@ Application::~Application() { · 308 unmodified lines
309309 delete idleTimer;
310310
311311 Menu::getInstance()->saveSettings();
312−
313312 _rearMirrorTools->saveSettings(_settings);
313+
314+ _sharedVoxelSystem.changeTree(new VoxelTree);
315+ if (_voxelImporter) {
316+ _voxelImporter->saveSettings(_settings);
317+ delete _voxelImporter;
318+ }
314319 _settings->sync();
315320
316321 // let the avatar mixer know we're out
@@ -331,7 +336,6 @@ Application::~Application() { · 14 unmodified lines
331336
332337 storeSizeAndPosition();
333338 saveScripts();
334− _sharedVoxelSystem.changeTree(new VoxelTree);
335339
336340 VoxelTreeElement::removeDeleteHook(&_voxels); // we don't need to do this processing on shutdown
337341 Menu::getInstance()->deleteLater();
@@ -1296,8 +1300,14 @@ void Application::mousePressEvent(QMouseEvent* event) { · 958 unmodified lines
12961300 pasteVoxels();
12971301 }
12981302
1299− } else if (event->button() == Qt::RightButton && Menu::getInstance()->isVoxelModeActionChecked()) {
1300− deleteVoxelUnderCursor();
1303+ } else if (event->button() == Qt::RightButton) {
1304+ if (Menu::getInstance()->isVoxelModeActionChecked()) {
1305+ deleteVoxelUnderCursor();
1306+ }
1307+ if (_pasteMode) {
1308+ _pasteMode = false;
1309+ }
1310+
13011311 }
13021312 }
13031313 }
@@ -1707,13 +1717,19 @@ void Application::exportVoxels() { · 403 unmodified lines
17071717 void Application::importVoxels() {
17081718 if (!_voxelImporter) {
17091719 _voxelImporter = new VoxelImporter(_window);
1710− _voxelImporter->init(_settings);
1720+ _voxelImporter->loadSettings(_settings);
17111721 }
17121722
1713− if (_voxelImporter->exec()) {
1714− qDebug("[DEBUG] Import succeeded.");
1723+ if (!_voxelImporter->exec()) {
1724+ qDebug() << "[DEBUG] Import succeeded." << endl;
1725+ Menu::getInstance()->setIsOptionChecked(MenuOption::VoxelSelectMode, true);
1726+ _pasteMode = true;
17151727 } else {
1716− qDebug("[DEBUG] Import failed.");
1728+ qDebug() << "[DEBUG] Import failed." << endl;
1729+ if (_sharedVoxelSystem.getTree() == _voxelImporter->getVoxelTree()) {
1730+ _sharedVoxelSystem.killLocalVoxels();
1731+ _sharedVoxelSystem.changeTree(&_clipboard);
1732+ }
17171733 }
17181734
17191735 // restore the main window's active state
@@ -1770,10 +1786,11 @@ void Application::pasteVoxels() { · 50 unmodified lines
17701786 }
17711787
17721788 pasteVoxelsToOctalCode(octalCodeDestination);
1773−
1789+
17741790 if (calculatedOctCode) {
17751791 delete[] calculatedOctCode;
17761792 }
1793+ _pasteMode = false;
17771794 }
17781795
17791796 void Application::findAxisAlignment() {
@@ -1845,6 +1862,7 @@ void Application::init() { · 65 unmodified lines
18451862
18461863 VoxelTreeElement::removeUpdateHook(&_sharedVoxelSystem);
18471864
1865+ // Cleanup of the original shared tree
18481866 _sharedVoxelSystem.init();
18491867 VoxelTree* tmpTree = _sharedVoxelSystem.getTree();
18501868 _sharedVoxelSystem.changeTree(&_clipboard);
@@ -1936,12 +1954,11 @@ void Application::init() { · 85 unmodified lines
19361954 _audio.init(_glWidget);
19371955
19381956 _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings);
1957+
19391958 connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
19401959 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
19411960 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
19421961 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
1943−
1944−
19451962 }
19461963
19471964 void Application::closeMirrorView() {
@@ -2090,7 +2107,7 @@ void Application::updateMouseVoxels(float deltaTime, float& distance, BoxFace& f · 142 unmodified lines
20902107 PerformanceWarning warn(showWarnings, "Application::updateMouseVoxels()");
20912108
20922109 _mouseVoxel.s = 0.0f;
2093− bool wasInitialized = _mouseVoxelScaleInitialized;
2110+ bool wasInitialized = _mouseVoxelScaleInitialized ;
20942111 if (Menu::getInstance()->isVoxelModeActionChecked() &&
20952112 (fabs(_myAvatar->getVelocity().x) +
20962113 fabs(_myAvatar->getVelocity().y) +

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