version.cpp
author insilmaril
Mon, 18 Jun 2007 15:10:20 +0000
changeset 510 7f66447b4ff1
parent 404 53efc2562a7d
child 565 e7f6bcdf5f6c
permissions -rw-r--r--
1.8.73 - beta testing
     1 #include "version.h"
     2 
     3 bool checkVersion (const QString &v)
     4 {
     5 	// returns true, if vym is able to read file regarding 
     6 	// the version set with setVersion
     7 	QString s1=v.section (".",0,0);
     8 	QString s2=v.section (".",1,1);
     9 	QString s3=v.section (".",2,2);
    10 	bool ok;
    11 	int vv1 =QString(__VYM_VERSION).section (".",0,0).toInt(&ok,10);
    12 	int vv2 =QString(__VYM_VERSION).section (".",1,1).toInt(&ok,10);
    13 	int vv3 =QString(__VYM_VERSION).section (".",2,2).toInt(&ok,10);
    14 	int mv1=0;
    15 	int mv2=0;
    16 	int mv3=0;
    17 	if (!s1.isEmpty() ) mv1=s1.toInt(&ok,10);
    18 	if (!s2.isEmpty() ) mv2=s2.toInt(&ok,10);
    19 	if (!s3.isEmpty() ) mv3=s3.toInt(&ok,10);
    20 	
    21 	if (vv1 > mv1)
    22 		return true;
    23 	if (vv1 < mv1)
    24 		return false;
    25 	if (vv2 > mv2)
    26 		return true;
    27 	if (vv2 < mv2)
    28 		return false;
    29 	if (vv3 > mv3)
    30 		return true;
    31 	if (vv3 < mv3)
    32 		return false;
    33 	return true;	
    34 
    35 }