[qet] qet/qet: [4925] Autonumbering dock widget : add a "configure" push button to quickly open the dialog used for create the auto numbering rules.

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


Revision: 4925
Author:   blacksun
Date:     2017-03-01 16:03:56 +0100 (Wed, 01 Mar 2017)
Log Message:
-----------
Autonumbering dock widget : add a "configure" push button to quickly open the dialog used for create the auto numbering rules.

Modified Paths:
--------------
    trunk/sources/autoNum/ui/autonumberingdockwidget.cpp
    trunk/sources/autoNum/ui/autonumberingdockwidget.h
    trunk/sources/autoNum/ui/autonumberingdockwidget.ui

Modified: trunk/sources/autoNum/ui/autonumberingdockwidget.cpp
===================================================================
--- trunk/sources/autoNum/ui/autonumberingdockwidget.cpp	2017-02-28 18:52:48 UTC (rev 4924)
+++ trunk/sources/autoNum/ui/autonumberingdockwidget.cpp	2017-03-01 15:03:56 UTC (rev 4925)
@@ -22,6 +22,7 @@
 #include "diagram.h"
 #include "titleblockproperties.h"
 #include "numerotationcontext.h"
+#include "projectpropertiesdialog.h"
 
 /**
  * @brief AutoNumberingDockWidget::AutoNumberingDockWidget
@@ -28,12 +29,12 @@
  * Constructor
  * @param parent : parent widget
  */
-AutoNumberingDockWidget::AutoNumberingDockWidget(QWidget *parent, QETProject *project) :
+AutoNumberingDockWidget::AutoNumberingDockWidget(QWidget *parent) :
 	QDockWidget(parent),
-	ui(new Ui::AutoNumberingDockWidget),
-	m_project(project)
+	ui(new Ui::AutoNumberingDockWidget)
 {
 	ui->setupUi(this);
+	this->setDisabled(true);
 }
 
 /**
@@ -57,6 +58,14 @@
 	ui->m_folio_cb->clear();
 }
 
+void AutoNumberingDockWidget::projectClosed()
+{
+	m_project = nullptr;
+	m_project_view = nullptr;
+	clear();
+	this->setDisabled(true);
+}
+
 /**
  * @brief AutoNumberingDockWidget::setProject
  * @param project: project to be setted
@@ -63,22 +72,49 @@
  * @param projectview: projectview to be setted
  * assign Project and ProjectView, connect all signals and setContext
  */
-void AutoNumberingDockWidget::setProject(QETProject *project, ProjectView *projectview) {
-
+void AutoNumberingDockWidget::setProject(QETProject *project, ProjectView *projectview)
+{
+		//Disconnect previous project
+	if (m_project && m_project_view)
+	{
+			//Conductor Signals
+		disconnect(m_project, SIGNAL(conductorAutoNumChanged()),this,SLOT(conductorAutoNumChanged()));
+		disconnect (m_project,SIGNAL(conductorAutoNumRemoved()), this,SLOT(conductorAutoNumChanged()));
+		disconnect (m_project,SIGNAL(conductorAutoNumAdded()),   this,SLOT(conductorAutoNumChanged()));
+		disconnect(m_project_view,SIGNAL(diagramActivated(DiagramView*)),this,SLOT(setConductorActive(DiagramView*)));
+	
+			//Element Signals
+		disconnect (m_project,SIGNAL(elementAutoNumRemoved(QString)),   this,SLOT(elementAutoNumChanged()));
+		disconnect (m_project,SIGNAL(elementAutoNumAdded(QString)),     this,SLOT(elementAutoNumChanged()));
+	
+			//Folio Signals
+		disconnect (m_project,SIGNAL(folioAutoNumRemoved()),     this,SLOT(folioAutoNumChanged()));
+		disconnect (m_project,SIGNAL(folioAutoNumAdded()),       this,SLOT(folioAutoNumChanged()));
+		disconnect (this,
+				 SIGNAL(folioAutoNumChanged(QString)),
+				 &m_project_view->currentDiagram()->diagram()->border_and_titleblock,
+				 SLOT (slot_setAutoPageNum(QString)));
+		disconnect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()),this,SLOT(setActive()));
+	
+			//Conductor, Element and Folio Signals
+		disconnect(m_project, &QETProject::destroyed, this, &AutoNumberingDockWidget::projectClosed);
+	}
+	
 	m_project = project;
 	m_project_view = projectview;
+	this->setEnabled(true);
 
-	//Conductor Signals
+		//Conductor Signals
 	connect(m_project, SIGNAL(conductorAutoNumChanged()),this,SLOT(conductorAutoNumChanged()));
-	connect (m_project,SIGNAL(conductorAutoNumRemoved()), this,SLOT(conductorAutoNumChanged()));
-	connect (m_project,SIGNAL(conductorAutoNumAdded()),   this,SLOT(conductorAutoNumChanged()));
+	connect(m_project,SIGNAL(conductorAutoNumRemoved()), this,SLOT(conductorAutoNumChanged()));
+	connect(m_project,SIGNAL(conductorAutoNumAdded()),   this,SLOT(conductorAutoNumChanged()));
 	connect(m_project_view,SIGNAL(diagramActivated(DiagramView*)),this,SLOT(setConductorActive(DiagramView*)));
 
-	//Element Signals
+		//Element Signals
 	connect (m_project,SIGNAL(elementAutoNumRemoved(QString)),   this,SLOT(elementAutoNumChanged()));
 	connect (m_project,SIGNAL(elementAutoNumAdded(QString)),     this,SLOT(elementAutoNumChanged()));
 
-	//Folio Signals
+		//Folio Signals
 	connect (m_project,SIGNAL(folioAutoNumRemoved()),     this,SLOT(folioAutoNumChanged()));
 	connect (m_project,SIGNAL(folioAutoNumAdded()),       this,SLOT(folioAutoNumChanged()));
 	connect (this,
@@ -87,10 +123,10 @@
 			 SLOT (slot_setAutoPageNum(QString)));
 	connect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()),this,SLOT(setActive()));
 
-	//Conductor, Element and Folio Signals
-	connect(m_project_view,SIGNAL(projectClosed(ProjectView*)),this,SLOT(clear()));
+		//Conductor, Element and Folio Signals
+	connect(m_project, &QETProject::destroyed, this, &AutoNumberingDockWidget::projectClosed);
 
-	//Set Combobox Context
+		//Set Combobox Context
 	setContext();
 }
 
@@ -261,3 +297,13 @@
 	}
 		emit(folioAutoNumChanged(current_autonum));
 }
+
+void AutoNumberingDockWidget::on_m_configure_pb_clicked()
+{
+	if (m_project)
+	{
+		ProjectPropertiesDialog ppd (m_project, this);
+		ppd.setCurrentPage(ProjectPropertiesDialog::Autonum);
+		ppd.exec();
+	}
+}

Modified: trunk/sources/autoNum/ui/autonumberingdockwidget.h
===================================================================
--- trunk/sources/autoNum/ui/autonumberingdockwidget.h	2017-02-28 18:52:48 UTC (rev 4924)
+++ trunk/sources/autoNum/ui/autonumberingdockwidget.h	2017-03-01 15:03:56 UTC (rev 4925)
@@ -31,7 +31,7 @@
 		Q_OBJECT
 
 	public:
-		explicit AutoNumberingDockWidget(QWidget *parent = 0, QETProject *project = nullptr);
+		explicit AutoNumberingDockWidget(QWidget *parent = 0);
 		~AutoNumberingDockWidget();
 
 		void setContext();
@@ -49,14 +49,17 @@
 		void elementAutoNumChanged();
 		void folioAutoNumChanged();
 		void clear();
+		void projectClosed();
 
+		void on_m_configure_pb_clicked();
+		
 	signals:
 		void folioAutoNumChanged(QString);
 
 	private:
 		Ui::AutoNumberingDockWidget *ui;
-		QETProject* m_project;
-		ProjectView* m_project_view;
+		QETProject* m_project = nullptr;
+		ProjectView* m_project_view = nullptr;
 
 };
 

Modified: trunk/sources/autoNum/ui/autonumberingdockwidget.ui
===================================================================
--- trunk/sources/autoNum/ui/autonumberingdockwidget.ui	2017-02-28 18:52:48 UTC (rev 4924)
+++ trunk/sources/autoNum/ui/autonumberingdockwidget.ui	2017-03-01 15:03:56 UTC (rev 4925)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>334</width>
+    <height>335</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -14,81 +14,69 @@
    <string>Autonumerotation Séléction</string>
   </property>
   <widget class="QWidget" name="dockWidgetContents">
-   <layout class="QVBoxLayout" name="verticalLayout">
-    <property name="sizeConstraint">
-     <enum>QLayout::SetMaximumSize</enum>
-    </property>
-    <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>
-     <widget class="QGroupBox" name="groupBox">
-      <property name="title">
-       <string/>
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="3" column="1">
+     <widget class="QComboBox" name="m_element_cb"/>
+    </item>
+    <item row="4" column="0">
+     <widget class="QLabel" name="label_3">
+      <property name="text">
+       <string>Folio</string>
       </property>
-      <layout class="QVBoxLayout" name="verticalLayout_2">
-       <item>
-        <layout class="QGridLayout" name="gridLayout">
-         <item row="1" column="0">
-          <widget class="QLabel" name="label">
-           <property name="text">
-            <string>Element</string>
-           </property>
-          </widget>
-         </item>
-         <item row="1" column="1">
-          <widget class="QComboBox" name="m_element_cb"/>
-         </item>
-         <item row="0" column="1">
-          <widget class="QComboBox" name="m_conductor_cb"/>
-         </item>
-         <item row="0" column="0">
-          <widget class="QLabel" name="label_2">
-           <property name="text">
-            <string>Conductor</string>
-           </property>
-          </widget>
-         </item>
-         <item row="2" column="0">
-          <widget class="QLabel" name="label_3">
-           <property name="text">
-            <string>Folio</string>
-           </property>
-          </widget>
-         </item>
-         <item row="3" column="0">
-          <spacer name="verticalSpacer">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>40</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item row="2" column="1">
-          <widget class="QComboBox" name="m_folio_cb"/>
-         </item>
-        </layout>
-       </item>
-      </layout>
      </widget>
     </item>
+    <item row="2" column="1">
+     <widget class="QComboBox" name="m_conductor_cb"/>
+    </item>
+    <item row="3" column="0">
+     <widget class="QLabel" name="label">
+      <property name="text">
+       <string>Element</string>
+      </property>
+     </widget>
+    </item>
+    <item row="2" column="0">
+     <widget class="QLabel" name="label_2">
+      <property name="text">
+       <string>Conductor</string>
+      </property>
+     </widget>
+    </item>
+    <item row="4" column="1">
+     <widget class="QComboBox" name="m_folio_cb"/>
+    </item>
+    <item row="6" column="0">
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item row="5" column="1">
+     <widget class="QPushButton" name="m_configure_pb">
+      <property name="toolTip">
+       <string>Configurer les règles d'auto numérotation</string>
+      </property>
+      <property name="text">
+       <string>Configurer</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../../../qelectrotech.qrc">
+        <normaloff>:/ico/16x16/configure.png</normaloff>:/ico/16x16/configure.png</iconset>
+      </property>
+     </widget>
+    </item>
    </layout>
   </widget>
  </widget>
- <resources/>
+ <resources>
+  <include location="../../../qelectrotech.qrc"/>
+ </resources>
  <connections/>
 </ui>


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