version.cpp
changeset 402 ae11bca6bbd8
child 404 53efc2562a7d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/version.cpp	Thu Nov 16 15:20:54 2006 +0000
     1.3 @@ -0,0 +1,35 @@
     1.4 +#include "version.h"
     1.5 +
     1.6 +bool checkVersion (const QString &v)
     1.7 +{
     1.8 +	// returns true, if vym is able to read file regarding 
     1.9 +	// the version set with setVersion
    1.10 +	QString s1=v.section (".",0,0);
    1.11 +	QString s2=v.section (".",1,1);
    1.12 +	QString s3=v.section (".",2,2);
    1.13 +	bool ok;
    1.14 +	int vv1 =QString(__VYM_VERSION).section (".",0,0).toInt(&ok,10);
    1.15 +	int vv2 =QString(__VYM_VERSION).section (".",1,1).toInt(&ok,10);
    1.16 +	int vv3 =QString(__VYM_VERSION).section (".",2,2).toInt(&ok,10);
    1.17 +	int mv1=0;
    1.18 +	int mv2=0;
    1.19 +	int mv3=0;
    1.20 +	if (!s1.isEmpty() ) mv1=s1.toInt(&ok,10);
    1.21 +	if (!s2.isEmpty() ) mv2=s2.toInt(&ok,10);
    1.22 +	if (!s3.isEmpty() ) mv3=s3.toInt(&ok,10);
    1.23 +	
    1.24 +	if (vv1 > mv1)
    1.25 +		return true;
    1.26 +	if (vv1 < mv1)
    1.27 +		return false;
    1.28 +	if (vv2 > mv2)
    1.29 +		return true;
    1.30 +	if (vv2 < mv2)
    1.31 +		return false;
    1.32 +	if (vv3 > mv3)
    1.33 +		return true;
    1.34 +	if (vv3 < mv3)
    1.35 +		return false;
    1.36 +	return true;	
    1.37 +
    1.38 +}
    1.39 \ No newline at end of file