mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +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
|
||||
if (dom.hasAttribute("version"))
|
||||
{
|
||||
bool conv_ok;
|
||||
qreal element_version = dom.attribute("version").toDouble(&conv_ok);
|
||||
if (conv_ok && QET::version.toDouble() < element_version)
|
||||
QVersionNumber qet_version = QVersionNumber::fromString(QET::version);
|
||||
QVersionNumber element_version = QVersionNumber::fromString(dom.attribute("version"));
|
||||
if (qet_version < element_version)
|
||||
{
|
||||
std::cerr << qPrintable(
|
||||
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
|
||||
if (xml_def_elmt.hasAttribute(QStringLiteral("version")))
|
||||
{
|
||||
bool conv_ok;
|
||||
qreal element_version = xml_def_elmt.attribute(
|
||||
QStringLiteral("version")).toDouble(&conv_ok);
|
||||
if (conv_ok && QET::version.toDouble() < element_version)
|
||||
QVersionNumber qet_version = QVersionNumber::fromString(QET::version);
|
||||
QVersionNumber element_version = QVersionNumber::fromString(xml_def_elmt.attribute(QStringLiteral("version")));
|
||||
if (qet_version < element_version)
|
||||
{
|
||||
std::cerr << qPrintable(
|
||||
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
|
||||
depuis un fichier, cette methode retourne -1.
|
||||
*/
|
||||
qreal QETProject::declaredQElectroTechVersion()
|
||||
QVersionNumber QETProject::declaredQElectroTechVersion()
|
||||
{
|
||||
return(m_project_qet_version);
|
||||
}
|
||||
@ -1340,11 +1340,14 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
|
||||
if (root_elmt.hasAttribute(QStringLiteral("version")))
|
||||
{
|
||||
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
|
||||
#pragma message("@TODO use of version convert")
|
||||
#endif
|
||||
if (conv_ok && QET::version.toDouble() < m_project_qet_version)
|
||||
if (qet_version < m_project_qet_version)
|
||||
{
|
||||
int ret = QET::QetMessageBox::warning(
|
||||
nullptr,
|
||||
@ -1365,9 +1368,11 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Since QElectrotech 0.9 the compatibility with project made with
|
||||
//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(
|
||||
nullptr,
|
||||
|
@ -98,7 +98,7 @@ class QETProject : public QObject
|
||||
QString currentDir() const;
|
||||
QString pathNameTitle() const;
|
||||
QString title() const;
|
||||
qreal declaredQElectroTechVersion();
|
||||
QVersionNumber declaredQElectroTechVersion();
|
||||
void setTitle(const QString &);
|
||||
|
||||
///DEFAULT PROPERTIES
|
||||
@ -247,7 +247,7 @@ class QETProject : public QObject
|
||||
/// Project title
|
||||
QString project_title_;
|
||||
/// 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
|
||||
bool m_modified = false;
|
||||
/// Whether the project is read only
|
||||
|
Loading…
x
Reference in New Issue
Block a user