Update the dialogconductorautonum with the diagramselection widget

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2133 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
cfdev
2013-04-30 10:26:13 +00:00
parent 4b915ab77f
commit 7b950562d5
3 changed files with 73 additions and 29 deletions

View File

@@ -1,15 +1,37 @@
/*
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"
#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 @@ DialogConductorAutoNum::~DialogConductorAutoNum()
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();
}
}
}

View File

@@ -1,9 +1,27 @@
/*
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
#include <QDialog>
#include "diagram.h"
#include "ui/diagramselection.h"
namespace Ui {
class DialogConductorAutoNum;
@@ -18,13 +36,14 @@ class DialogConductorAutoNum : public QDialog
~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

View File

@@ -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>