version.cpp
author insilmaril
Wed Jan 16 15:45:19 2008 +0000 (2008-01-16)
changeset 656 53ef954e90b6
parent 404 53efc2562a7d
child 729 7ddbe3fa34a1
permissions -rw-r--r--
Fixed missing MapCenter
insilmaril@402
     1
#include "version.h"
insilmaril@402
     2
insilmaril@402
     3
bool checkVersion (const QString &v)
insilmaril@402
     4
{
insilmaril@402
     5
	// returns true, if vym is able to read file regarding 
insilmaril@402
     6
	// the version set with setVersion
insilmaril@565
     7
	return checkVersion (v,__VYM_VERSION);
insilmaril@565
     8
	/*
insilmaril@402
     9
	QString s1=v.section (".",0,0);
insilmaril@402
    10
	QString s2=v.section (".",1,1);
insilmaril@402
    11
	QString s3=v.section (".",2,2);
insilmaril@402
    12
	bool ok;
insilmaril@402
    13
	int vv1 =QString(__VYM_VERSION).section (".",0,0).toInt(&ok,10);
insilmaril@402
    14
	int vv2 =QString(__VYM_VERSION).section (".",1,1).toInt(&ok,10);
insilmaril@402
    15
	int vv3 =QString(__VYM_VERSION).section (".",2,2).toInt(&ok,10);
insilmaril@402
    16
	int mv1=0;
insilmaril@402
    17
	int mv2=0;
insilmaril@402
    18
	int mv3=0;
insilmaril@402
    19
	if (!s1.isEmpty() ) mv1=s1.toInt(&ok,10);
insilmaril@402
    20
	if (!s2.isEmpty() ) mv2=s2.toInt(&ok,10);
insilmaril@402
    21
	if (!s3.isEmpty() ) mv3=s3.toInt(&ok,10);
insilmaril@402
    22
	
insilmaril@402
    23
	if (vv1 > mv1)
insilmaril@402
    24
		return true;
insilmaril@402
    25
	if (vv1 < mv1)
insilmaril@402
    26
		return false;
insilmaril@402
    27
	if (vv2 > mv2)
insilmaril@402
    28
		return true;
insilmaril@402
    29
	if (vv2 < mv2)
insilmaril@402
    30
		return false;
insilmaril@402
    31
	if (vv3 > mv3)
insilmaril@402
    32
		return true;
insilmaril@402
    33
	if (vv3 < mv3)
insilmaril@402
    34
		return false;
insilmaril@402
    35
	return true;	
insilmaril@565
    36
*/
insilmaril@565
    37
}
insilmaril@565
    38
insilmaril@565
    39
bool checkVersion (const QString &v, const QString &d)
insilmaril@565
    40
{
insilmaril@565
    41
	QString v1=v.section (".",0,0);
insilmaril@565
    42
	QString v2=v.section (".",1,1);
insilmaril@565
    43
	QString v3=v.section (".",2,2);
insilmaril@565
    44
	QString d1=d.section (".",0,0);
insilmaril@565
    45
	QString d2=d.section (".",1,1);
insilmaril@565
    46
	QString d3=d.section (".",2,2);
insilmaril@565
    47
	bool ok;
insilmaril@565
    48
	int d1i=d1.toInt(&ok,10);
insilmaril@565
    49
	int d2i=d2.toInt(&ok,10);
insilmaril@565
    50
	int d3i=d3.toInt(&ok,10);
insilmaril@565
    51
	int v1i=0;
insilmaril@565
    52
	int v2i=0;
insilmaril@565
    53
	int v3i=0;
insilmaril@565
    54
	if (!v1.isEmpty() ) v1i=v1.toInt(&ok,10);
insilmaril@565
    55
	if (!v2.isEmpty() ) v2i=v2.toInt(&ok,10);
insilmaril@565
    56
	if (!v3.isEmpty() ) v3i=v3.toInt(&ok,10);
insilmaril@565
    57
	
insilmaril@565
    58
	if (d1i > v1i)
insilmaril@565
    59
		return true;
insilmaril@565
    60
	if (d1i < v1i)
insilmaril@565
    61
		return false;
insilmaril@565
    62
	if (d2i > v2i)
insilmaril@565
    63
		return true;
insilmaril@565
    64
	if (d2i < v2i)
insilmaril@565
    65
		return false;
insilmaril@565
    66
	if (d3i > v3i)
insilmaril@565
    67
		return true;
insilmaril@565
    68
	if (d3i < v3i)
insilmaril@565
    69
		return false;
insilmaril@565
    70
	return true;	
insilmaril@402
    71
insilmaril@404
    72
}