comparison framework/VersionTester.cpp @ 337:1e3af7f4fa86 tony_integration

Merge from branch tonioni
author Chris Cannam
date Tue, 11 Mar 2014 17:34:53 +0000
parents 3144af512ea3
children b23bebfdfaba
comparison
equal deleted inserted replaced
328:28c17ce7a6e9 337:1e3af7f4fa86
58 QStringList blist = b.split(re, QString::SkipEmptyParts); 58 QStringList blist = b.split(re, QString::SkipEmptyParts);
59 int ae = alist.size(); 59 int ae = alist.size();
60 int be = blist.size(); 60 int be = blist.size();
61 int e = std::max(ae, be); 61 int e = std::max(ae, be);
62 for (int i = 0; i < e; ++i) { 62 for (int i = 0; i < e; ++i) {
63 int an = 0, bn = 0; 63 int an = 0, bn = 0;
64 if (i < ae) { 64 if (i < ae) {
65 an = alist[i].toInt(); 65 an = alist[i].toInt();
66 if (an == 0) an = -1; // non-numeric field -> "-pre1" etc 66 if (an == 0 && alist[i] != "0") {
67 } 67 an = -1; // non-numeric field -> "-pre1" etc
68 if (i < be) { 68 }
69 bn = blist[i].toInt(); 69 }
70 if (bn == 0) bn = -1; 70 if (i < be) {
71 } 71 bn = blist[i].toInt();
72 if (an < bn) return false; 72 if (bn == 0 && blist[i] != "0") {
73 if (an > bn) return true; 73 bn = -1;
74 }
75 }
76 if (an < bn) return false;
77 if (an > bn) return true;
74 } 78 }
75 return false; 79 return false;
76 } 80 }
77 81
78 void 82 void
101 QString str = QString::fromUtf8(responseData.data()); 105 QString str = QString::fromUtf8(responseData.data());
102 QStringList lines = str.split('\n', QString::SkipEmptyParts); 106 QStringList lines = str.split('\n', QString::SkipEmptyParts);
103 if (lines.empty()) return; 107 if (lines.empty()) return;
104 108
105 QString latestVersion = lines[0]; 109 QString latestVersion = lines[0];
106 SVDEBUG << "Comparing current version \"" << m_myVersion << "\" with latest version \"" << latestVersion << "\"" << endl; 110 cerr << "Comparing current version \"" << m_myVersion << "\" with latest version \"" << latestVersion << "\"" << endl;
107 if (isVersionNewerThan(latestVersion, m_myVersion)) { 111 if (isVersionNewerThan(latestVersion, m_myVersion)) {
112 cerr << "Latest version \"" << latestVersion << "\" is newer than current version \"" << m_myVersion << "\"" << endl;
108 emit newerVersionAvailable(latestVersion); 113 emit newerVersionAvailable(latestVersion);
109 } 114 }
110 } 115 }
111 116
112 117