Finished extending undo/redo framework into PropertiesView.
This commit is contained in:
@@ -86,8 +86,12 @@ void LabelModel::restore( const LabelModel *savedModel )
|
|||||||
mObjectList.append( object->clone() );
|
mObjectList.append( object->clone() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emit signals based on potential changes
|
||||||
emit changed();
|
emit changed();
|
||||||
emit selectionChanged();
|
emit selectionChanged();
|
||||||
|
emit modifiedChanged();
|
||||||
|
emit nameChanged();
|
||||||
|
emit sizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -156,33 +156,39 @@ void PropertiesView::onLabelSizeChanged()
|
|||||||
{
|
{
|
||||||
orientationCombo->setCurrentIndex( isRotated ? 0 : 1 );
|
orientationCombo->setCurrentIndex( isRotated ? 0 : 1 );
|
||||||
}
|
}
|
||||||
|
mOldOrientationIndex = orientationCombo->currentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Form changed handler
|
/// Orientation combo box changed handler
|
||||||
///
|
///
|
||||||
void PropertiesView::onFormChanged()
|
void PropertiesView::onOrientationActivated()
|
||||||
{
|
{
|
||||||
const glabels::Template *tmplate = mModel->tmplate();
|
const glabels::Template *tmplate = mModel->tmplate();
|
||||||
const glabels::Frame *frame = tmplate->frames().first();
|
const glabels::Frame *frame = tmplate->frames().first();
|
||||||
|
|
||||||
|
// Make sure index actually changed.
|
||||||
|
int index = orientationCombo->currentIndex();
|
||||||
|
if ( index != mOldOrientationIndex )
|
||||||
|
{
|
||||||
|
mOldOrientationIndex = index;
|
||||||
|
|
||||||
|
mUndoRedoModel->checkpoint( tr("Product Rotate") );
|
||||||
|
|
||||||
if ( frame->w() == frame->h() )
|
if ( frame->w() == frame->h() )
|
||||||
{
|
{
|
||||||
mModel->setRotate( false );
|
mModel->setRotate( false );
|
||||||
}
|
}
|
||||||
else if ( frame->w() > frame->h() )
|
else if ( frame->w() > frame->h() )
|
||||||
{
|
{
|
||||||
mUndoRedoModel->checkpoint( tr("Product Orientation") );
|
|
||||||
int index = orientationCombo->currentIndex();
|
|
||||||
mModel->setRotate( index == 1 );
|
mModel->setRotate( index == 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mUndoRedoModel->checkpoint( tr("Product Orientation") );
|
|
||||||
int index = orientationCombo->currentIndex();
|
|
||||||
mModel->setRotate( index == 0 );
|
mModel->setRotate( index == 0 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void onSettingsChanged();
|
void onSettingsChanged();
|
||||||
void onLabelSizeChanged();
|
void onLabelSizeChanged();
|
||||||
void onFormChanged();
|
void onOrientationActivated();
|
||||||
void onChangeProductButtonClicked();
|
void onChangeProductButtonClicked();
|
||||||
|
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ private:
|
|||||||
LabelModel* mModel;
|
LabelModel* mModel;
|
||||||
UndoRedoModel* mUndoRedoModel;
|
UndoRedoModel* mUndoRedoModel;
|
||||||
glabels::Units mUnits;
|
glabels::Units mUnits;
|
||||||
|
int mOldOrientationIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -372,22 +372,6 @@
|
|||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
|
||||||
<sender>orientationCombo</sender>
|
|
||||||
<signal>currentIndexChanged(int)</signal>
|
|
||||||
<receiver>PropertiesView</receiver>
|
|
||||||
<slot>onFormChanged()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>671</x>
|
|
||||||
<y>283</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>723</x>
|
|
||||||
<y>285</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>changeProductButton</sender>
|
<sender>changeProductButton</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>clicked()</signal>
|
||||||
@@ -395,8 +379,8 @@
|
|||||||
<slot>onChangeProductButtonClicked()</slot>
|
<slot>onChangeProductButtonClicked()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>684</x>
|
<x>311</x>
|
||||||
<y>192</y>
|
<y>221</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>728</x>
|
<x>728</x>
|
||||||
@@ -404,9 +388,25 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>orientationCombo</sender>
|
||||||
|
<signal>activated(int)</signal>
|
||||||
|
<receiver>PropertiesView</receiver>
|
||||||
|
<slot>onOrientationActivated()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>285</x>
|
||||||
|
<y>280</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>802</x>
|
||||||
|
<y>300</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>onChangeProductButtonClicked()</slot>
|
<slot>onChangeProductButtonClicked()</slot>
|
||||||
<slot>onFormChanged()</slot>
|
<slot>onOrientationActivated()</slot>
|
||||||
</slots>
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user