mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 02:10:52 +01:00
Add the removeDiagramFromProject methode for autonum (beta)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2117 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include "qetdiagrameditor.h"
|
#include "qetdiagrameditor.h"
|
||||||
#include "QGraphicsView"
|
#include "QGraphicsView"
|
||||||
#include "diagramcommands.h"
|
#include "diagramcommands.h"
|
||||||
|
#include "qetapp.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -82,6 +83,24 @@ void ConductorAutoNumerotation::setNumStrategy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorAutoNumerotation::removeNum_ofDiagram
|
||||||
|
* @param dg the diagram to remove text of Conductor
|
||||||
|
*/
|
||||||
|
void ConductorAutoNumerotation::removeNum_ofDiagram(Diagram *dg) {
|
||||||
|
// Setting of application
|
||||||
|
QSettings &qet_settings = QETApp::settings();
|
||||||
|
// Get the default text of conductor from conf file
|
||||||
|
QString Conductor_DefaultText = qet_settings.value("defaultconductortext", "_").toString();
|
||||||
|
// Get all conductors presents in diagram
|
||||||
|
QList<Conductor *> Conductors = dg -> content().conductors();
|
||||||
|
// Browse all conductors and set the default value
|
||||||
|
for (int i=0; i<Conductors.count(); i++) {
|
||||||
|
Conductors.at(i) -> setText( Conductor_DefaultText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class ConductorAutoNumerotation
|
|||||||
void setConductor(Conductor *);
|
void setConductor(Conductor *);
|
||||||
void numerate();
|
void numerate();
|
||||||
void setText(QString);
|
void setText(QString);
|
||||||
|
void removeNum_ofDiagram(Diagram *);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//methods
|
//methods
|
||||||
|
|||||||
@@ -1712,8 +1712,7 @@ void QETDiagramEditor::cleanCurrentProject() {
|
|||||||
* @brief launch AutoNumConductor dialog
|
* @brief launch AutoNumConductor dialog
|
||||||
*/
|
*/
|
||||||
void QETDiagramEditor::conductorAutoNumProject() {
|
void QETDiagramEditor::conductorAutoNumProject() {
|
||||||
//TODO: Test dialog autonum CYRIL F.
|
DialogConductorAutoNum *dg = new DialogConductorAutoNum(currentDiagram()->diagram(), this);
|
||||||
DialogConductorAutoNum *dg = new DialogConductorAutoNum();
|
|
||||||
dg->setModal(true);
|
dg->setModal(true);
|
||||||
dg->exec();
|
dg->exec();
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,49 @@
|
|||||||
#include "ui_dialogconductorautonum.h"
|
#include "ui_dialogconductorautonum.h"
|
||||||
|
|
||||||
#include "conductorautonumerotation.h"
|
#include "conductorautonumerotation.h"
|
||||||
|
#include "qetmessagebox.h"
|
||||||
|
|
||||||
DialogConductorAutoNum::DialogConductorAutoNum(QWidget *parent) :
|
DialogConductorAutoNum::DialogConductorAutoNum(Diagram *dg, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::DialogConductorAutoNum)
|
ui(new Ui::DialogConductorAutoNum)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
dg_ = dg;
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogConductorAutoNum::~DialogConductorAutoNum()
|
DialogConductorAutoNum::~DialogConductorAutoNum()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DialogConductorAutoNum::on_pushButton_delete_clicked
|
||||||
|
*/
|
||||||
|
void DialogConductorAutoNum::on_pushButton_delete_clicked() {
|
||||||
|
// TODO check if project or diagram
|
||||||
|
// ...
|
||||||
|
// 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()),
|
||||||
|
QMessageBox::Yes | QMessageBox::No,
|
||||||
|
QMessageBox::No
|
||||||
|
);
|
||||||
|
|
||||||
|
// if yes remove all
|
||||||
|
if( answer == QMessageBox::Yes) {
|
||||||
|
ConductorAutoNumerotation ConductorNum;
|
||||||
|
ConductorNum.removeNum_ofDiagram( dg_ );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Close the dialog
|
||||||
|
*/
|
||||||
|
void DialogConductorAutoNum::on_pushButton_close_clicked() {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "diagram.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class DialogConductorAutoNum;
|
class DialogConductorAutoNum;
|
||||||
}
|
}
|
||||||
@@ -12,11 +14,17 @@ class DialogConductorAutoNum : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogConductorAutoNum(QWidget *parent = 0);
|
explicit DialogConductorAutoNum(Diagram *dg, QWidget *parent = 0);
|
||||||
~DialogConductorAutoNum();
|
~DialogConductorAutoNum();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_pushButton_delete_clicked();
|
||||||
|
|
||||||
|
void on_pushButton_close_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DialogConductorAutoNum *ui;
|
Ui::DialogConductorAutoNum *ui;
|
||||||
|
Diagram *dg_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGCONDUCTORAUTONUM_H
|
#endif // DIALOGCONDUCTORAUTONUM_H
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>523</width>
|
<width>482</width>
|
||||||
<height>313</height>
|
<height>245</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -29,16 +29,19 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButton">
|
<widget class="QRadioButton" name="radioButton_Diagram">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>RadioButton</string>
|
<string>Numéroter le schéma actif</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="radioButton_2">
|
<widget class="QRadioButton" name="radioButton_Project">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>RadioButton</string>
|
<string>Numéroter le projet actif entier</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -56,11 +59,18 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="text">
|
<item row="0" column="1">
|
||||||
<string>CheckBox</string>
|
<widget class="QLineEdit" name="lineEdit"/>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_format">
|
||||||
|
<property name="text">
|
||||||
|
<string>Format : </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@@ -89,6 +99,10 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Annotation</string>
|
<string>Annotation</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/16x16/edit-select-all.png</normaloff>:/ico/16x16/edit-select-all.png</iconset>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -96,6 +110,10 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Supprimer l'annotation</string>
|
<string>Supprimer l'annotation</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/16x16/edit-delete.png</normaloff>:/ico/16x16/edit-delete.png</iconset>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user