[qet] [2133] Update the dialogconductorautonum with the diagramselection widget

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


Revision: 2133
Author:   cfdev
Date:     2013-04-30 12:26:13 +0200 (Tue, 30 Apr 2013)
Log Message:
-----------
Update the dialogconductorautonum with the diagramselection widget

Modified Paths:
--------------
    trunk/sources/ui/dialogconductorautonum.cpp
    trunk/sources/ui/dialogconductorautonum.h
    trunk/sources/ui/dialogconductorautonum.ui

Modified: trunk/sources/ui/dialogconductorautonum.cpp
===================================================================
--- trunk/sources/ui/dialogconductorautonum.cpp	2013-04-30 10:25:05 UTC (rev 2132)
+++ trunk/sources/ui/dialogconductorautonum.cpp	2013-04-30 10:26:13 UTC (rev 2133)
@@ -1,3 +1,20 @@
+/*
+		Copyright 2006-2013 The QElectroTech Team
+		This file is part of QElectroTech.
+		
+		QElectroTech is free software: you can redistribute it and/or modify
+		it under the terms of the GNU General Public License as published by
+		the Free Software Foundation, either version 2 of the License, or
+		(at your option) any later version.
+		
+		QElectroTech is distributed in the hope that it will be useful,
+		but WITHOUT ANY WARRANTY; without even the implied warranty of
+		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+		GNU General Public License for more details.
+		
+		You should have received a copy of the GNU General Public License
+		along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
+*/
 #include "dialogconductorautonum.h"
 #include "ui_dialogconductorautonum.h"
 
@@ -4,12 +21,17 @@
 #include "conductorautonumerotation.h"
 #include "qetmessagebox.h"
 
+
 DialogConductorAutoNum::DialogConductorAutoNum(Diagram *dg, QWidget *parent) :
 	QDialog(parent),
 	ui(new Ui::DialogConductorAutoNum)
 {
-	ui->setupUi(this);
+	ui -> setupUi(this);
 	dg_ = dg;
+	
+	// create widget of diagram selection
+	dgselect_ = new diagramselection( dg_ ->project(), this );
+	ui -> verticalLayout_Selection -> addWidget( dgselect_ );
 }
 
 DialogConductorAutoNum::~DialogConductorAutoNum()
@@ -17,27 +39,37 @@
 	delete ui;
 }
 
+
 /**
  * @brief DialogConductorAutoNum::on_pushButton_delete_clicked
  */
 void DialogConductorAutoNum::on_pushButton_delete_clicked() {
-	// TODO check if project or diagram
-	// ...
+	// get list of diagrams selected
+	QList<Diagram *>listDiag = dgselect_ ->list_of_DiagramSelected();
+	if(listDiag.count()<=0) return;
+	
+	QString diagramsTitle;
+	for(int i=0; i<listDiag.count(); i++){
+		diagramsTitle += listDiag.at(i)->title();
+		if(i+1<listDiag.count()) diagramsTitle += ", ";
+	}
 	// Ask if user is sure to delete the conductor numerotation
 	QMessageBox::StandardButton answer = QET::MessageBox::critical(
 		this,
 		tr("Suppression des annotations conducteurs", "Attention"),
 		QString(
-			tr("Voulez vraiment supprimer les annotations conducteurs de\n%1 ?")
-		).arg(dg_ -> title()),
+			tr("Voulez vraiment supprimer les annotations conducteurs de :\n\n%1 ?")
+		).arg(diagramsTitle),
 		QMessageBox::Yes | QMessageBox::No,
 		QMessageBox::No
 	);
 	
 	// if yes remove all
 	if( answer ==  QMessageBox::Yes) {
-		ConductorAutoNumerotation can(dg_);
-		can.removeNum_ofDiagram();
+		for(int i=0; i<listDiag.count(); i++){
+			ConductorAutoNumerotation can(listDiag.at(i));
+			can.removeNum_ofDiagram();
+		}
 	}
 }
 

Modified: trunk/sources/ui/dialogconductorautonum.h
===================================================================
--- trunk/sources/ui/dialogconductorautonum.h	2013-04-30 10:25:05 UTC (rev 2132)
+++ trunk/sources/ui/dialogconductorautonum.h	2013-04-30 10:26:13 UTC (rev 2133)
@@ -1,3 +1,20 @@
+/*
+		Copyright 2006-2013 The QElectroTech Team
+		This file is part of QElectroTech.
+		
+		QElectroTech is free software: you can redistribute it and/or modify
+		it under the terms of the GNU General Public License as published by
+		the Free Software Foundation, either version 2 of the License, or
+		(at your option) any later version.
+		
+		QElectroTech is distributed in the hope that it will be useful,
+		but WITHOUT ANY WARRANTY; without even the implied warranty of
+		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+		GNU General Public License for more details.
+		
+		You should have received a copy of the GNU General Public License
+		along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
+*/
 #ifndef DIALOGCONDUCTORAUTONUM_H
 #define DIALOGCONDUCTORAUTONUM_H
 
@@ -4,6 +21,7 @@
 #include <QDialog>
 
 #include "diagram.h"
+#include "ui/diagramselection.h"
 
 namespace Ui {
 	class DialogConductorAutoNum;
@@ -18,13 +36,14 @@
 	~DialogConductorAutoNum();
 	
 	private slots:
-	void on_pushButton_delete_clicked();
-	
+	void on_pushButton_delete_clicked();	
 	void on_pushButton_close_clicked();
 	
 	private:
 	Ui::DialogConductorAutoNum *ui;
 	Diagram *dg_;
+	diagramselection *dgselect_;	
+
 };
 
 #endif // DIALOGCONDUCTORAUTONUM_H

Modified: trunk/sources/ui/dialogconductorautonum.ui
===================================================================
--- trunk/sources/ui/dialogconductorautonum.ui	2013-04-30 10:25:05 UTC (rev 2132)
+++ trunk/sources/ui/dialogconductorautonum.ui	2013-04-30 10:26:13 UTC (rev 2133)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>482</width>
-    <height>245</height>
+    <height>382</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -27,25 +27,7 @@
        </property>
        <layout class="QVBoxLayout" name="verticalLayout_4">
         <item>
-         <layout class="QVBoxLayout" name="verticalLayout_3">
-          <item>
-           <widget class="QRadioButton" name="radioButton_Diagram">
-            <property name="text">
-             <string>Numéroter le schéma actif</string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QRadioButton" name="radioButton_Project">
-            <property name="text">
-             <string>Numéroter le projet actif entier</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
+         <layout class="QVBoxLayout" name="verticalLayout_Selection"/>
         </item>
        </layout>
       </widget>
@@ -70,6 +52,14 @@
               </property>
              </widget>
             </item>
+            <item row="0" column="2">
+             <widget class="QPushButton" name="pushButton_info">
+              <property name="icon">
+               <iconset resource="../../qelectrotech.qrc">
+                <normaloff>:/ico/16x16/configure.png</normaloff>:/ico/16x16/configure.png</iconset>
+              </property>
+             </widget>
+            </item>
            </layout>
           </item>
          </layout>
@@ -121,6 +111,9 @@
        <property name="text">
         <string>Fermer</string>
        </property>
+       <property name="default">
+        <bool>true</bool>
+       </property>
       </widget>
      </item>
     </layout>


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