add class for auto numerotation (for the time, only same potential)

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2087 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2013-04-04 16:57:15 +00:00
parent 53bc7e8af7
commit 4a038a8bf0
9 changed files with 488 additions and 0 deletions

View File

@@ -936,3 +936,62 @@ void ChangeConductorPropertiesCommand::redo() {
conductor -> update();
}
}
/**
Constructeur
@param c La liste des conducteurs dont on modifie les proprietes
@param parent QUndoCommand parent
*/
ChangeSeveralConductorsPropertiesCommand::ChangeSeveralConductorsPropertiesCommand(QSet<Conductor *>c, QUndoCommand *parent) :
QUndoCommand(QObject::tr("modifier les propri\351t\351s de plusieurs conducteurs", "undo caption"), parent),
conductors(c),
old_settings_set(false),
new_settings_set(false)
{
}
/// Destructeur
ChangeSeveralConductorsPropertiesCommand::~ChangeSeveralConductorsPropertiesCommand() {
}
/// definit l'ancienne configuration
void ChangeSeveralConductorsPropertiesCommand::setOldSettings(const QList<ConductorProperties> &properties) {
old_properties = properties;
old_settings_set = true;
}
/// definit la nouvelle configuration
void ChangeSeveralConductorsPropertiesCommand::setNewSettings(const QList<ConductorProperties> &properties) {
new_properties = properties;
new_settings_set = true;
}
/**
Annule les changements - Attention : les anciens et nouveaux parametres
doivent avoir ete definis a l'aide de setNewSettings et setOldSettings
*/
void ChangeSeveralConductorsPropertiesCommand::undo() {
if (old_settings_set && new_settings_set) {
int i=0;
foreach(Conductor *c, conductors) {
c -> setProperties(old_properties.at(i));
c -> update();
i++;
}
}
}
/**
Refait les changements - Attention : les anciens et nouveaux parametres
doivent avoir ete definis a l'aide de setNewSettings et setOldSettings
*/
void ChangeSeveralConductorsPropertiesCommand::redo() {
if (old_settings_set && new_settings_set) {
int i=0;
foreach(Conductor *c, conductors) {
c -> setProperties(new_properties.at(0));
c -> update();
i++;
}
}
}