mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 17:50:52 +01:00
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user