Merge branch 'hotfix-history' into 'dev'

Hotfix history

See merge request creyd/intelliphoto!62
This commit is contained in:
Jonas Mucke
2020-01-30 17:25:58 +00:00
5 changed files with 18 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
history tool doesnt load polygon data on undo iff project was loaded history tool doesnt load polygon data on undo iff project was loaded
history tool doesnt save delete Layer history tool doesnt save delete Layer - done
Gradient breaks Heap Size, when big Witdh and Height (appeared on 1280x720) Gradient breaks Heap Size, when big Witdh and Height (appeared on 1280x720)
Heap block at 0000000025422990 modified at 0000000025422A28 past requested size of 88 Heap block at 0000000025422990 modified at 0000000025422A28 past requested size of 88

View File

@@ -105,6 +105,7 @@ void IntelliPhotoGui::slotCreateNewRasterLayer(){
// Create New Layer // Create New Layer
if (ok1&&ok2) { if (ok1&&ok2) {
paintingArea->addLayer(width,height,0,0,255,ImageType::RASTERIMAGE); paintingArea->addLayer(width,height,0,0,255,ImageType::RASTERIMAGE);
paintingArea->historyadd();
UpdateGui(); UpdateGui();
} }
} }
@@ -124,6 +125,7 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
// Create New Layer // Create New Layer
if (ok1&&ok2) { if (ok1&&ok2) {
paintingArea->addLayer(width, height, 0, 0,255, ImageType::SHAPEDIMAGE); paintingArea->addLayer(width, height, 0, 0,255, ImageType::SHAPEDIMAGE);
paintingArea->historyadd();
UpdateGui(); UpdateGui();
} }
} }
@@ -160,6 +162,7 @@ void IntelliPhotoGui::slotDeleteLayer(){
// Create New Layer // Create New Layer
if(ok1) { if(ok1) {
paintingArea->deleteLayer(layerNumber - 1); paintingArea->deleteLayer(layerNumber - 1);
paintingArea->historyadd();
UpdateGui(); UpdateGui();
} }
} }

View File

@@ -94,6 +94,7 @@ bool IntelliDatamanager::loadProject(PaintingArea* Canvas, QString filePath){
} }
Canvas->setRenderSettings(static_cast<bool>(rendersetting)); Canvas->setRenderSettings(static_cast<bool>(rendersetting));
openFile.close(); openFile.close();
Canvas->historyadd();
return true; return true;
} }

View File

@@ -106,7 +106,6 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff
} }
this->layerBundle.push_back(newLayer); this->layerBundle.push_back(newLayer);
activeLayer = static_cast<int>(layerBundle.size()) - 1; activeLayer = static_cast<int>(layerBundle.size()) - 1;
historyadd();
return activeLayer; return activeLayer;
} }
@@ -528,6 +527,12 @@ void PaintingArea::historyGoBack(){
if (historyPresent != historyMaxPast) { if (historyPresent != historyMaxPast) {
if (--historyPresent == -1) if (--historyPresent == -1)
historyPresent = 99; historyPresent = 99;
if (activeLayer == -1)
activeLayer = 0;
if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size())
activeLayer = static_cast<int>(history[static_cast<size_t>(historyPresent)].size())-1;
if (history[static_cast<size_t>(historyPresent)].size() == 0)
activeLayer = -1;
layerBundle = history[static_cast<size_t>(historyPresent)]; layerBundle = history[static_cast<size_t>(historyPresent)];
} }
this->guiReference->UpdateGui(); this->guiReference->UpdateGui();
@@ -537,6 +542,12 @@ void PaintingArea::historyGoForward(){
if (historyPresent != historyMaxFuture) { if (historyPresent != historyMaxFuture) {
if (++historyPresent == 100) if (++historyPresent == 100)
historyPresent = 0; historyPresent = 0;
if (activeLayer == -1)
activeLayer = 0;
if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size())
activeLayer = static_cast<int>(history[static_cast<size_t>(historyPresent)].size())-1;
if (history[static_cast<size_t>(historyPresent)].size() == 0)
activeLayer = -1;
layerBundle = history[static_cast<size_t>(historyPresent)]; layerBundle = history[static_cast<size_t>(historyPresent)];
} }
this->guiReference->UpdateGui(); this->guiReference->UpdateGui();

View File

@@ -285,9 +285,7 @@ IntelliToolsettings Toolsettings;
*/ */
IntelliColorPicker colorPicker; IntelliColorPicker colorPicker;
/*! void historyadd();
* \brief historyGoBack a function to return the previous state of the project.
*/
void historyGoBack(); void historyGoBack();
/*! /*!
@@ -471,11 +469,6 @@ int historyMaxFuture = 0;
*/ */
int historyPresent = 0; int historyPresent = 0;
/*!
* \brief historyadd adds an past version to the history
*/
void historyadd();
}; };
#endif #endif