[qet] qet/qet: [5337] Multipaste : auto-num of element work, even if the option "erase label on copy /paste" is enable.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 5337
Author:   blacksun
Date:     2018-04-21 19:48:22 +0200 (Sat, 21 Apr 2018)
Log Message:
-----------
Multipaste : auto-num of element work, even if the option "erase label on copy /paste" is enable.

Modified Paths:
--------------
    trunk/sources/configpages.cpp
    trunk/sources/diagramcommands.cpp
    trunk/sources/ui/multipastedialog.cpp
    trunk/sources/ui/multipastedialog.ui

Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp	2018-04-19 09:51:25 UTC (rev 5336)
+++ trunk/sources/configpages.cpp	2018-04-21 17:48:22 UTC (rev 5337)
@@ -237,7 +237,7 @@
 	bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
 	bool zoom_out_folio = settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool();
 	bool use_trackpad = settings.value("diagramview/gestures", false).toBool();
-	bool save_label_paste = settings.value("diagramcommands/save-label", true).toBool();
+	bool save_label_paste = settings.value("diagramcommands/erase-label-on-copy", true).toBool();
 	bool panel_folio = settings.value("genericpanel/folio", true).toBool();
 	bool highlight_integrated_elements = settings.value("diagrameditor/highlight-integrated-elements", true).toBool();
 	bool terminal_exportlist = settings.value("nomenclature-exportlist", true).toBool();
@@ -386,7 +386,7 @@
 	settings.setValue("diagrameditor/highlight-integrated-elements", highlight_integrated_elements_ -> isChecked());
 	settings.setValue("elementeditor/default-informations", default_element_infos_textfield_ -> toPlainText());
 	settings.setValue("diagramview/gestures", use_trackpad_ -> isChecked());
-	settings.setValue("diagramcommands/save-label", save_label_paste_ -> isChecked());
+	settings.setValue("diagramcommands/erase-label-on-copy", save_label_paste_ -> isChecked());
 	settings.setValue("diagrameditor/zoom-out-beyond-of-folio", m_zoom_out_beyond_folio->isChecked());
 	settings.setValue("genericpanel/folio",folio_panel_->isChecked());
 	settings.setValue("nomenclature/terminal-exportlist",terminal_exportlist_->isChecked());

Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp	2018-04-19 09:51:25 UTC (rev 5336)
+++ trunk/sources/diagramcommands.cpp	2018-04-21 17:48:22 UTC (rev 5337)
@@ -100,7 +100,7 @@
 				//make new uuid, because old uuid are the uuid of the copied element
 			e -> newUuid();
 
-			if (settings.value("diagramcommands/save-label", true).toBool())
+			if (settings.value("diagramcommands/erase-label-on-copy", true).toBool())
 			{
 					//Reset the information about the label, the comment and location
 				e -> rElementInformations().addValue("formula", "");

Modified: trunk/sources/ui/multipastedialog.cpp
===================================================================
--- trunk/sources/ui/multipastedialog.cpp	2018-04-19 09:51:25 UTC (rev 5336)
+++ trunk/sources/ui/multipastedialog.cpp	2018-04-21 17:48:22 UTC (rev 5337)
@@ -4,6 +4,7 @@
 #include "diagramcommands.h"
 #include "element.h"
 #include "conductorautonumerotation.h"
+#include <QSettings>
 
 MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) :
 	QDialog(parent),
@@ -75,6 +76,17 @@
 {
     if(m_pasted_content.count())
 	{
+		QSettings settings;
+		bool erase_label = settings.value("diagramcommands/erase-label-on-copy", true).toBool();
+			//Ensure when 'auto_num' is checked, the settings 'save_label' is to true.
+			//Because in the class PasteDiagramCommand, if the settings 'save_label' is to false,
+			//the function redo of PasteDiagramCommand, clear the formula and the label of the pasted element
+			//and so the auto_num below do nothing (there is not a formula to compare)
+		if(ui->m_auto_num_cb->isChecked())
+			settings.setValue("diagramcommands/erase-label-on-copy", false);
+		
+		
+		
 		m_diagram->clearSelection();
 		
 		QUndoCommand *undo = new QUndoCommand(tr("Multi-collage"));
@@ -132,5 +144,6 @@
 		}
 		m_diagram->adjustSceneRect();
 		m_accept = true;
+		settings.setValue("diagramcommands/erase-label-on-copy", erase_label);
 	}
 }

Modified: trunk/sources/ui/multipastedialog.ui
===================================================================
--- trunk/sources/ui/multipastedialog.ui	2018-04-19 09:51:25 UTC (rev 5336)
+++ trunk/sources/ui/multipastedialog.ui	2018-04-21 17:48:22 UTC (rev 5337)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>261</width>
-    <height>136</height>
+    <width>304</width>
+    <height>162</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -90,7 +90,7 @@
    <item>
     <widget class="QCheckBox" name="m_auto_connection_cb">
      <property name="text">
-      <string>Auto-connection</string>
+      <string>Auto-connexion</string>
      </property>
     </widget>
    </item>
@@ -97,7 +97,7 @@
    <item>
     <widget class="QCheckBox" name="m_auto_num_cb">
      <property name="text">
-      <string>Auto-numérotation des éléments (experimental)</string>
+      <string>Auto-numérotation des éléments</string>
      </property>
     </widget>
    </item>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/