mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
use QVersionNumber and switch to "list of int" standard
This commit is contained in:
parent
19d867f6a4
commit
038d2d7033
@ -156,9 +156,9 @@ bool ElementPictureFactory::build(const ElementsLocation &location,
|
|||||||
//Check if the current version can read the xml description
|
//Check if the current version can read the xml description
|
||||||
if (dom.hasAttribute("version"))
|
if (dom.hasAttribute("version"))
|
||||||
{
|
{
|
||||||
bool conv_ok;
|
QVersionNumber qet_version = QVersionNumber::fromString(QET::version);
|
||||||
qreal element_version = dom.attribute("version").toDouble(&conv_ok);
|
QVersionNumber element_version = QVersionNumber::fromString(dom.attribute("version"));
|
||||||
if (conv_ok && QET::version.toDouble() < element_version)
|
if (qet_version < element_version)
|
||||||
{
|
{
|
||||||
std::cerr << qPrintable(
|
std::cerr << qPrintable(
|
||||||
QObject::tr("Avertissement : l'élément "
|
QObject::tr("Avertissement : l'élément "
|
||||||
|
@ -429,10 +429,9 @@ bool Element::buildFromXml(const QDomElement &xml_def_elmt, int *state)
|
|||||||
//Check if the current version can read the xml description
|
//Check if the current version can read the xml description
|
||||||
if (xml_def_elmt.hasAttribute(QStringLiteral("version")))
|
if (xml_def_elmt.hasAttribute(QStringLiteral("version")))
|
||||||
{
|
{
|
||||||
bool conv_ok;
|
QVersionNumber qet_version = QVersionNumber::fromString(QET::version);
|
||||||
qreal element_version = xml_def_elmt.attribute(
|
QVersionNumber element_version = QVersionNumber::fromString(xml_def_elmt.attribute(QStringLiteral("version")));
|
||||||
QStringLiteral("version")).toDouble(&conv_ok);
|
if (qet_version < element_version)
|
||||||
if (conv_ok && QET::version.toDouble() < element_version)
|
|
||||||
{
|
{
|
||||||
std::cerr << qPrintable(
|
std::cerr << qPrintable(
|
||||||
QObject::tr("Avertissement : l'élément "
|
QObject::tr("Avertissement : l'élément "
|
||||||
|
@ -436,7 +436,7 @@ QString QETProject::title() const
|
|||||||
celui-ci a ete ouvert ; si ce projet n'a jamais ete enregistre / ouvert
|
celui-ci a ete ouvert ; si ce projet n'a jamais ete enregistre / ouvert
|
||||||
depuis un fichier, cette methode retourne -1.
|
depuis un fichier, cette methode retourne -1.
|
||||||
*/
|
*/
|
||||||
qreal QETProject::declaredQElectroTechVersion()
|
QVersionNumber QETProject::declaredQElectroTechVersion()
|
||||||
{
|
{
|
||||||
return(m_project_qet_version);
|
return(m_project_qet_version);
|
||||||
}
|
}
|
||||||
@ -1340,11 +1340,14 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
|
|||||||
if (root_elmt.hasAttribute(QStringLiteral("version")))
|
if (root_elmt.hasAttribute(QStringLiteral("version")))
|
||||||
{
|
{
|
||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
m_project_qet_version = root_elmt.attribute(QStringLiteral("version")).toDouble(&conv_ok);
|
qreal r_project_qet_version = root_elmt.attribute(QStringLiteral("version")).toDouble(&conv_ok);
|
||||||
|
QVersionNumber qet_version = QVersionNumber::fromString(QET::version);
|
||||||
|
m_project_qet_version = QVersionNumber::fromString(root_elmt.attribute(QStringLiteral("version")));
|
||||||
|
|
||||||
#if TODO_LIST
|
#if TODO_LIST
|
||||||
#pragma message("@TODO use of version convert")
|
#pragma message("@TODO use of version convert")
|
||||||
#endif
|
#endif
|
||||||
if (conv_ok && QET::version.toDouble() < m_project_qet_version)
|
if (qet_version < m_project_qet_version)
|
||||||
{
|
{
|
||||||
int ret = QET::QetMessageBox::warning(
|
int ret = QET::QetMessageBox::warning(
|
||||||
nullptr,
|
nullptr,
|
||||||
@ -1365,9 +1368,11 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Since QElectrotech 0.9 the compatibility with project made with
|
//Since QElectrotech 0.9 the compatibility with project made with
|
||||||
//Qet 0.6 or lower is break;
|
//Qet 0.6 or lower is break;
|
||||||
if (conv_ok && m_project_qet_version <= 0.6 )
|
//keep float here for very old version
|
||||||
|
if (conv_ok && r_project_qet_version <= 0.6)
|
||||||
{
|
{
|
||||||
auto ret = QET::QetMessageBox::warning(
|
auto ret = QET::QetMessageBox::warning(
|
||||||
nullptr,
|
nullptr,
|
||||||
|
@ -98,7 +98,7 @@ class QETProject : public QObject
|
|||||||
QString currentDir() const;
|
QString currentDir() const;
|
||||||
QString pathNameTitle() const;
|
QString pathNameTitle() const;
|
||||||
QString title() const;
|
QString title() const;
|
||||||
qreal declaredQElectroTechVersion();
|
QVersionNumber declaredQElectroTechVersion();
|
||||||
void setTitle(const QString &);
|
void setTitle(const QString &);
|
||||||
|
|
||||||
///DEFAULT PROPERTIES
|
///DEFAULT PROPERTIES
|
||||||
@ -247,7 +247,7 @@ class QETProject : public QObject
|
|||||||
/// Project title
|
/// Project title
|
||||||
QString project_title_;
|
QString project_title_;
|
||||||
/// QElectroTech version declared in the XML document at opening time
|
/// QElectroTech version declared in the XML document at opening time
|
||||||
qreal m_project_qet_version = -1;
|
QVersionNumber m_project_qet_version;
|
||||||
/// Whether options were modified
|
/// Whether options were modified
|
||||||
bool m_modified = false;
|
bool m_modified = false;
|
||||||
/// Whether the project is read only
|
/// Whether the project is read only
|
||||||
|
Loading…
x
Reference in New Issue
Block a user