2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2009-04-03 19:30:25 +00:00
|
|
|
Copyright 2006-2009 Xavier Guerrin
|
2007-12-01 10:47:15 +00:00
|
|
|
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/>.
|
|
|
|
*/
|
2007-06-30 17:41:07 +00:00
|
|
|
#ifndef _QET_H
|
|
|
|
#define _QET_H
|
|
|
|
#include <QtXml>
|
|
|
|
/**
|
|
|
|
Ce fichier contient des fonctions utiles pouvant etre appelees depuis
|
|
|
|
n'importe ou. Il contient egalement des enums utilises dans plusieurs
|
|
|
|
classes de l'application
|
|
|
|
*/
|
|
|
|
namespace QET {
|
2009-04-03 19:30:25 +00:00
|
|
|
/// version de QElectroTech (utilisee pour estampiller les projets et elements)
|
|
|
|
const QString version = "0.2";
|
|
|
|
/// version affichee de QElectroTech
|
2009-06-20 14:22:17 +00:00
|
|
|
const QString displayedVersion = "0.2rc2";
|
2007-10-28 01:32:57 +00:00
|
|
|
QString license();
|
2007-10-21 16:10:21 +00:00
|
|
|
/// Orientation (utilise pour les bornes mais aussi pour les elements)
|
2007-06-30 17:41:07 +00:00
|
|
|
enum Orientation {North, East, South, West};
|
2009-04-03 19:30:25 +00:00
|
|
|
|
|
|
|
/// Mouvements orientes
|
|
|
|
enum OrientedMovement {
|
|
|
|
ToNorth,
|
|
|
|
ToNorthEast,
|
|
|
|
ToEast,
|
|
|
|
ToSouthEast,
|
|
|
|
ToSouth,
|
|
|
|
ToSouthWest,
|
|
|
|
ToWest,
|
|
|
|
ToNorthWest
|
|
|
|
};
|
|
|
|
|
2007-10-21 16:10:21 +00:00
|
|
|
/// Types de segment de conducteurs
|
2009-04-03 19:30:25 +00:00
|
|
|
enum ConductorSegmentType {
|
|
|
|
Horizontal = 1, ///< Segment horizontal
|
|
|
|
Vertical = 2, ///< Segment vertical
|
|
|
|
Both = 3 ///< Segment en biais / invalide
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
Cet enum represente les differents embouts possibles pour les
|
|
|
|
extremites d'une ligne.
|
|
|
|
*/
|
|
|
|
enum EndType {
|
|
|
|
None, ///< Ligne normale
|
|
|
|
Simple, ///< Triangle sans base
|
|
|
|
Triangle, ///< Triangle
|
|
|
|
Circle, ///< Cercle
|
|
|
|
Diamond ///< Losange
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
Cet enum represente les differents items manipulables dans une
|
|
|
|
collection d'elements.
|
|
|
|
*/
|
|
|
|
enum ItemType {
|
|
|
|
Element = 1, ///< Element
|
|
|
|
Category = 2, ///< Categorie
|
|
|
|
Collection = 4, ///< Collection
|
|
|
|
All = 7 ///< Tous
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Cet enum represente les differentes facons de gerer un probleme lors de
|
|
|
|
la recopie ou du deplacement d'un element ou d'une categorie.
|
|
|
|
@see MoveElementsHandler
|
|
|
|
*/
|
|
|
|
enum Action {
|
|
|
|
Retry, ///< il faut reessayer l'operation
|
|
|
|
Ignore, ///< il faut passer a la suite
|
|
|
|
Erase, ///< il faut ecraser le contenu cible
|
|
|
|
Abort, ///< il faut arreter : ignorer l'item en cours et ne pas continuer
|
|
|
|
Managed, ///< le cas a ete gere par l'objet delegue : ne pas le traiter et passer a la suite
|
|
|
|
Rename ///< il faut renommer la cible
|
|
|
|
};
|
|
|
|
|
2007-06-30 17:41:07 +00:00
|
|
|
QET::Orientation nextOrientation(QET::Orientation);
|
|
|
|
QET::Orientation previousOrientation(QET::Orientation);
|
|
|
|
QET::Orientation orientationFromString(const QString &);
|
|
|
|
QString orientationToString(QET::Orientation);
|
|
|
|
bool surLeMemeAxe(QET::Orientation, QET::Orientation);
|
|
|
|
bool estHorizontale(QET::Orientation);
|
|
|
|
bool estVerticale(QET::Orientation);
|
|
|
|
bool attributeIsAnInteger(const QDomElement &, QString , int * = NULL);
|
|
|
|
bool attributeIsAReal(const QDomElement &, QString , double * = NULL);
|
2007-10-27 13:18:17 +00:00
|
|
|
QString ElementsAndConductorsSentence(int, int, int = 0);
|
|
|
|
QList<QDomElement> findInDomElement(const QDomElement &, const QString &, const QString &);
|
2007-12-23 01:15:16 +00:00
|
|
|
QList<QChar> forbiddenCharacters();
|
2009-04-03 19:30:25 +00:00
|
|
|
QString forbiddenCharactersString(bool = false);
|
2007-12-23 01:15:16 +00:00
|
|
|
bool containsForbiddenCharacters(const QString &);
|
2009-04-03 19:30:25 +00:00
|
|
|
QString stringToFileName(const QString &);
|
2008-07-26 15:26:19 +00:00
|
|
|
QString escapeSpaces(const QString &);
|
|
|
|
QString unescapeSpaces(const QString &);
|
|
|
|
QString joinWithSpaces(const QStringList &);
|
|
|
|
QStringList splitWithSpaces(const QString &);
|
2009-04-03 19:30:25 +00:00
|
|
|
QString endTypeToString(const QET::EndType &);
|
|
|
|
QET::EndType endTypeFromString(const QString &);
|
|
|
|
QString pointerString(void *);
|
2007-06-30 17:41:07 +00:00
|
|
|
}
|
|
|
|
#endif
|