WIP: life updated on most shape properties, some bug fixes.

This commit is contained in:
Matthias Koefferlein
2020-08-26 00:38:41 +02:00
parent 6e860361c0
commit 3003eb96e7
11 changed files with 482 additions and 281 deletions
+74 -20
View File
@@ -17,7 +17,16 @@
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
@@ -54,7 +63,16 @@
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -69,7 +87,7 @@
<string>Previous</string>
</property>
<property name="icon">
<iconset resource="layResources.qrc">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/left.png</normaloff>:/left.png</iconset>
</property>
<property name="default">
@@ -89,7 +107,7 @@
<string>Next</string>
</property>
<property name="icon">
<iconset resource="layResources.qrc">
<iconset resource="../../lay/lay/layResources.qrc">
<normaloff>:/right.png</normaloff>:/right.png</iconset>
</property>
<property name="default">
@@ -97,6 +115,39 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="apply_to_all_cbx">
<property name="text">
<string>Change all</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="relative_cbx">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Relative</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
@@ -120,20 +171,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="apply_button">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="apply_to_all_button">
<property name="text">
<string>Apply To All</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancel_button">
<property name="text">
@@ -148,7 +185,24 @@
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="layResources.qrc"/>
<include location="../../lay/lay/layResources.qrc"/>
</resources>
<connections/>
<connections>
<connection>
<sender>apply_to_all_cbx</sender>
<signal>toggled(bool)</signal>
<receiver>relative_cbx</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>260</x>
<y>372</y>
</hint>
<hint type="destinationlabel">
<x>320</x>
<y>372</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+1 -1
View File
@@ -557,7 +557,7 @@ LayoutView::init (db::Manager *mgr, QWidget * /*parent*/)
}
if (is_editable () && (m_options & LV_NoEditorOptionsPanel) == 0 && (m_options & LV_Naked) == 0) {
if ((m_options & LV_NoEditorOptionsPanel) == 0 && (m_options & LV_Naked) == 0) {
mp_editor_options_frame = new QFrame (0);
mp_editor_options_frame->setObjectName (QString::fromUtf8 ("editor_options_frame"));
+1 -1
View File
@@ -198,7 +198,7 @@ public:
* If nothing was changed, the objects may be left untouched.
* The dialog will start a transaction on the manager object.
*/
virtual void apply_to_all ()
virtual void apply_to_all (bool /*relative*/)
{
// default implementation is empty.
}
+23 -45
View File
@@ -64,8 +64,8 @@ PropertiesDialog::PropertiesDialog (QWidget * /*parent*/, db::Manager *manager,
content_frame->setLayout (mp_stack);
// disable the apply button for first ..
apply_button->setEnabled (false);
apply_to_all_button->setEnabled (false);
apply_to_all_cbx->setEnabled (false);
relative_cbx->setEnabled (false);
ok_button->setEnabled (false);
// as a proposal, the start button can be enabled in most cases
@@ -87,22 +87,28 @@ PropertiesDialog::PropertiesDialog (QWidget * /*parent*/, db::Manager *manager,
// if at end disable the "Next" button and return (this may only happen at the first call)
if (m_index >= int (mp_properties_pages.size ())) {
next_button->setEnabled (false);
mp_stack->setCurrentWidget (dummy);
apply_button->setEnabled (false);
apply_to_all_button->setEnabled (false);
apply_to_all_cbx->setEnabled (false);
apply_to_all_cbx->setChecked (false);
relative_cbx->setEnabled (false);
relative_cbx->setChecked (false);
ok_button->setEnabled (false);
} else {
next_button->setEnabled (any_next ());
mp_properties_pages [m_index]->update ();
mp_stack->setCurrentWidget (mp_properties_pages [m_index]);
apply_button->setEnabled (! mp_properties_pages [m_index]->readonly ());
apply_to_all_button->setEnabled (! mp_properties_pages [m_index]->readonly () && mp_properties_pages [m_index]->can_apply_to_all ());
apply_to_all_cbx->setEnabled (! mp_properties_pages [m_index]->readonly () && mp_properties_pages [m_index]->can_apply_to_all ());
apply_to_all_cbx->setChecked (false);
relative_cbx->setEnabled (apply_to_all_cbx->isEnabled () && apply_to_all_cbx->isChecked ());
relative_cbx->setChecked (true);
ok_button->setEnabled (! mp_properties_pages [m_index]->readonly ());
}
connect (apply_button, SIGNAL (clicked ()), this, SLOT (apply_pressed ()));
connect (apply_to_all_button, SIGNAL (clicked ()), this, SLOT (apply_to_all_pressed ()));
connect (ok_button, SIGNAL (clicked ()), this, SLOT (ok_pressed ()));
connect (cancel_button, SIGNAL (clicked ()), this, SLOT (cancel_pressed ()));
connect (prev_button, SIGNAL (clicked ()), this, SLOT (prev_pressed ()));
@@ -159,8 +165,8 @@ BEGIN_PROTECTED
prev_button->setEnabled (true);
next_button->setEnabled (any_next ());
apply_button->setEnabled (! mp_properties_pages [m_index]->readonly ());
apply_to_all_button->setEnabled (! mp_properties_pages [m_index]->readonly () && mp_properties_pages [m_index]->can_apply_to_all ());
apply_to_all_cbx->setEnabled (! mp_properties_pages [m_index]->readonly () && mp_properties_pages [m_index]->can_apply_to_all ());
relative_cbx->setEnabled (apply_to_all_cbx->isEnabled () && apply_to_all_cbx->isChecked ());
ok_button->setEnabled (! mp_properties_pages [m_index]->readonly ());
mp_properties_pages [m_index]->update ();
@@ -203,8 +209,8 @@ BEGIN_PROTECTED
next_button->setEnabled (true);
prev_button->setEnabled (any_prev ());
apply_button->setEnabled (! mp_properties_pages [m_index]->readonly ());
apply_to_all_button->setEnabled (! mp_properties_pages [m_index]->readonly () && mp_properties_pages [m_index]->can_apply_to_all ());
apply_to_all_cbx->setEnabled (! mp_properties_pages [m_index]->readonly () && mp_properties_pages [m_index]->can_apply_to_all ());
relative_cbx->setEnabled (apply_to_all_cbx->isEnabled () && apply_to_all_cbx->isChecked ());
ok_button->setEnabled (! mp_properties_pages [m_index]->readonly ());
mp_properties_pages [m_index]->update ();
@@ -254,23 +260,6 @@ PropertiesDialog::any_prev () const
return (index >= 0);
}
void
PropertiesDialog::apply_to_all_pressed ()
{
BEGIN_PROTECTED
{
db::Transaction t (mp_manager, tl::to_string (QObject::tr ("Apply changes to all")), m_transaction_id);
mp_properties_pages [m_index]->apply_to_all ();
mp_properties_pages [m_index]->update ();
m_transaction_id = t.id ();
}
END_PROTECTED
}
void
PropertiesDialog::apply ()
{
@@ -280,7 +269,11 @@ BEGIN_PROTECTED
try {
mp_properties_pages [m_index]->apply ();
if (apply_to_all_cbx->isChecked () && mp_properties_pages [m_index]->can_apply_to_all ()) {
mp_properties_pages [m_index]->apply_to_all (relative_cbx->isChecked ());
} else {
mp_properties_pages [m_index]->apply ();
}
mp_properties_pages [m_index]->update ();
} catch (tl::Exception &) {
@@ -292,21 +285,6 @@ BEGIN_PROTECTED
END_PROTECTED
}
void
PropertiesDialog::apply_pressed ()
{
BEGIN_PROTECTED
db::Transaction t (mp_manager, tl::to_string (QObject::tr ("Apply changes")), m_transaction_id);
mp_properties_pages [m_index]->apply ();
mp_properties_pages [m_index]->update ();
m_transaction_id = t.id ();
END_PROTECTED
}
void
PropertiesDialog::cancel_pressed ()
{
@@ -92,8 +92,6 @@ public slots:
void apply ();
void next_pressed ();
void prev_pressed ();
void apply_pressed ();
void apply_to_all_pressed ();
void cancel_pressed ();
void ok_pressed ();