-
Notifications
You must be signed in to change notification settings - Fork 0
/
versionlistitem.cpp
78 lines (66 loc) · 1.43 KB
/
versionlistitem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "versionlistitem.h"
#include "tool.h"
#include "dlgregisterkey.h"
VersionListItem::VersionListItem(QObject *parent) :
QObject(parent)
{
m_fSizeKb = 0.f;
m_bX86 = true;
m_bEmpty = true;
}
bool VersionListItem::isGreaterVersion( QString sV1, QString sV2 )
{
bool bV1Greater = false;
//int nTmp1 = 0, nTmp2 = 0;
while(true)
{
int i1 = 0, i2 = 0;
i1 = sV1.indexOf('.');
i2 = sV2.indexOf('.');
QString s1 = sV1.left(i1);
QString s2 = sV2.left(i2);
int n1 = s1.toInt();
int n2 = s2.toInt();
if( n1 > n2 )
{
bV1Greater = true;
break;
}
else if( n1 < n2 )
{
break;
}
if( i1 > 0 && i2 == -1 )
{
bV1Greater = true;
break;
}
else if( i1 == -1 && i2 > 0 )
{
break;
}
else if( i1 == -1 && i2 == -1 )
{
break;
}
sV1 = sV1.right(sV1.size() - i1 - 1);
sV2 = sV2.right(sV2.size() - i2 - 1);
}
return bV1Greater;
}
bool VersionListItem::isGreaterVersion( VersionListItem* p )
{
return VersionListItem::isGreaterVersion( m_strFileVersion, p->m_strFileVersion );
}
void VersionListItem::open()
{
if(!m_bEmpty)
{
Tool::openAndSelectFile(m_strFilePath);
}
else
{
DlgRegisterKey dlg;
dlg.exec();
}
}