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() );
|
||||
}
|
||||
|
||||
// Emit signals based on potential changes
|
||||
emit changed();
|
||||
emit selectionChanged();
|
||||
emit modifiedChanged();
|
||||
emit nameChanged();
|
||||
emit sizeChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -156,34 +156,40 @@ void PropertiesView::onLabelSizeChanged()
|
||||
{
|
||||
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::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() )
|
||||
{
|
||||
mModel->setRotate( false );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
private slots:
|
||||
void onSettingsChanged();
|
||||
void onLabelSizeChanged();
|
||||
void onFormChanged();
|
||||
void onOrientationActivated();
|
||||
void onChangeProductButtonClicked();
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ private:
|
||||
LabelModel* mModel;
|
||||
UndoRedoModel* mUndoRedoModel;
|
||||
glabels::Units mUnits;
|
||||
|
||||
int mOldOrientationIndex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -372,22 +372,6 @@
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<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>
|
||||
<sender>changeProductButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
@@ -395,8 +379,8 @@
|
||||
<slot>onChangeProductButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>684</x>
|
||||
<y>192</y>
|
||||
<x>311</x>
|
||||
<y>221</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>728</x>
|
||||
@@ -404,9 +388,25 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</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>
|
||||
<slots>
|
||||
<slot>onChangeProductButtonClicked()</slot>
|
||||
<slot>onFormChanged()</slot>
|
||||
<slot>onOrientationActivated()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user