mirror of https://github.com/OpenMW/openmw.git
track document modification state and display it in the top level window title bar
parent
8e546ebd30
commit
d7c63d4c74
@ -1,9 +1,27 @@
|
|||||||
|
|
||||||
#include "document.hpp"
|
#include "document.hpp"
|
||||||
|
|
||||||
CSMDoc::Document::Document() {}
|
CSMDoc::Document::Document()
|
||||||
|
{
|
||||||
|
connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool)));
|
||||||
|
}
|
||||||
|
|
||||||
QUndoStack& CSMDoc::Document::getUndoStack()
|
QUndoStack& CSMDoc::Document::getUndoStack()
|
||||||
{
|
{
|
||||||
return mUndoStack;
|
return mUndoStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CSMDoc::Document::getState() const
|
||||||
|
{
|
||||||
|
int state = 0;
|
||||||
|
|
||||||
|
if (!mUndoStack.isClean())
|
||||||
|
state |= State_Modified;
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::Document::modificationStateChanged (bool clean)
|
||||||
|
{
|
||||||
|
emit stateChanged (getState(), this);
|
||||||
}
|
}
|
Loading…
Reference in New Issue