Mercurial > hg > dmlib
diff edgui.cpp @ 401:2fdf440ea66a
Fix some segfaults, etc.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 19 Oct 2012 16:28:06 +0300 |
parents | 8660c6005032 |
children | d34922e6a244 |
line wrap: on
line diff
--- a/edgui.cpp Fri Oct 19 15:56:59 2012 +0300 +++ b/edgui.cpp Fri Oct 19 16:28:06 2012 +0300 @@ -26,15 +26,14 @@ else name = currTimeline->filename; - if (changed) + if (currTimeline && currTimeline->touched()) name = "*" + name; setWindowTitle(name + " - " + QCoreApplication::applicationName()); // Enable menu items based on states - menuActSave->setEnabled(currTimeline->changed || changed); - menuActSaveAs->setEnabled(currTimeline->changed || changed); - + menuActSave->setEnabled(currTimeline != NULL&& currTimeline->touched()); + menuActSaveAs->setEnabled(currTimeline != NULL); // Enable undo/redo items and set their texts based on history status int historyLevels = undoHistory.size(); @@ -43,7 +42,7 @@ if (undoHistoryPos >= 0 && undoHistoryPos < historyLevels) { - itemText = " " + undoHistory.at(undoHistoryPos)->state; + itemText = " " + undoHistory.at(undoHistoryPos)->state(); itemEnabled = true; } else @@ -57,7 +56,7 @@ if (undoHistoryPos > 0 && historyLevels > 0) { - itemText = " " + undoHistory.at(undoHistoryPos - 1)->state; + itemText = " " + undoHistory.at(undoHistoryPos - 1)->state(); itemEnabled = true; } else @@ -121,7 +120,7 @@ { bool okToCreate = true; - if (changed) + if (currTimeline != NULL && currTimeline->touched()) { okToCreate = false; switch (showDocumentModifiedDialog()) @@ -132,7 +131,7 @@ case QMessageBox::Save: actionFileSave(); - if (!changed) + if (!currTimeline->touched()) { QMessageBox::information(this, "Document saved", @@ -156,7 +155,7 @@ { bool okToOpen = true; - if (changed) + if (currTimeline != NULL && currTimeline->touched()) { okToOpen = false; @@ -168,7 +167,7 @@ case QMessageBox::Save: actionFileSave(); - if (!changed) + if (!currTimeline->touched()) { QMessageBox::information(this, "Document saved", @@ -241,7 +240,7 @@ { bool okToClose = true; - if (changed) + if (currTimeline && currTimeline->touched()) { okToClose = false; switch (showDocumentModifiedDialog()) @@ -252,7 +251,7 @@ case QMessageBox::Save: actionFileSave(); - if (!changed) + if (!currTimeline->touched()) okToClose = true; break;