Started adding undo/redo framework.

This commit is contained in:
Jim Evins
2016-04-29 23:51:01 -04:00
parent 231dc66c0d
commit 61c41d8ba9
9 changed files with 445 additions and 13 deletions
+7 -1
View File
@@ -21,6 +21,7 @@
#include "PropertiesView.h"
#include "LabelModel.h"
#include "UndoRedoModel.h"
#include "Settings.h"
#include "libglabels/Db.h"
@@ -55,9 +56,10 @@ PropertiesView::~PropertiesView()
///
/// Set Model
///
void PropertiesView::setModel( LabelModel* model )
void PropertiesView::setModel( LabelModel* model, UndoRedoModel* undoRedoModel )
{
mModel = model;
mUndoRedoModel = undoRedoModel;
connect( mModel, SIGNAL(sizeChanged()), this, SLOT(onLabelSizeChanged()) );
@@ -171,11 +173,13 @@ void PropertiesView::onFormChanged()
}
else if ( frame->w() > frame->h() )
{
mUndoRedoModel->checkpoint( tr("Product Orientation") );
int index = orientationCombo->currentIndex();
mModel->setRotate( index == 1 );
}
else
{
mUndoRedoModel->checkpoint( tr("Product Orientation") );
int index = orientationCombo->currentIndex();
mModel->setRotate( index == 0 );
}
@@ -193,6 +197,8 @@ void PropertiesView::onChangeProductButtonClicked()
const glabels::Template* tmplate = selectProductDialog.tmplate();
if ( tmplate )
{
mUndoRedoModel->checkpoint( tr("Change Product") );
mModel->setTmplate( tmplate );
// Don't rotate circular or round labels