1.1 --- a/version.cpp Mon Nov 20 12:12:02 2006 +0000
1.2 +++ b/version.cpp Fri Aug 03 14:13:35 2007 +0000
1.3 @@ -4,6 +4,8 @@
1.4 {
1.5 // returns true, if vym is able to read file regarding
1.6 // the version set with setVersion
1.7 + return checkVersion (v,__VYM_VERSION);
1.8 + /*
1.9 QString s1=v.section (".",0,0);
1.10 QString s2=v.section (".",1,1);
1.11 QString s3=v.section (".",2,2);
1.12 @@ -31,5 +33,40 @@
1.13 if (vv3 < mv3)
1.14 return false;
1.15 return true;
1.16 +*/
1.17 +}
1.18 +
1.19 +bool checkVersion (const QString &v, const QString &d)
1.20 +{
1.21 + QString v1=v.section (".",0,0);
1.22 + QString v2=v.section (".",1,1);
1.23 + QString v3=v.section (".",2,2);
1.24 + QString d1=d.section (".",0,0);
1.25 + QString d2=d.section (".",1,1);
1.26 + QString d3=d.section (".",2,2);
1.27 + bool ok;
1.28 + int d1i=d1.toInt(&ok,10);
1.29 + int d2i=d2.toInt(&ok,10);
1.30 + int d3i=d3.toInt(&ok,10);
1.31 + int v1i=0;
1.32 + int v2i=0;
1.33 + int v3i=0;
1.34 + if (!v1.isEmpty() ) v1i=v1.toInt(&ok,10);
1.35 + if (!v2.isEmpty() ) v2i=v2.toInt(&ok,10);
1.36 + if (!v3.isEmpty() ) v3i=v3.toInt(&ok,10);
1.37 +
1.38 + if (d1i > v1i)
1.39 + return true;
1.40 + if (d1i < v1i)
1.41 + return false;
1.42 + if (d2i > v2i)
1.43 + return true;
1.44 + if (d2i < v2i)
1.45 + return false;
1.46 + if (d3i > v3i)
1.47 + return true;
1.48 + if (d3i < v3i)
1.49 + return false;
1.50 + return true;
1.51
1.52 }