mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Format code using clang-format
This commit is contained in:
@ -13,14 +13,14 @@
|
||||
#define PREVIOUS_VERSION_TESTING "6.0.0"
|
||||
|
||||
HttpVersionChecker::HttpVersionChecker()
|
||||
:HttpWorker("https://bitbucket.org/luisangelsm/yacreader/wiki/Home")
|
||||
: HttpWorker("https://bitbucket.org/luisangelsm/yacreader/wiki/Home")
|
||||
{
|
||||
connect(this,SIGNAL(dataReady(const QByteArray &)),this,SLOT(checkNewVersion(const QByteArray &)));
|
||||
connect(this, SIGNAL(dataReady(const QByteArray &)), this, SLOT(checkNewVersion(const QByteArray &)));
|
||||
}
|
||||
|
||||
void HttpVersionChecker::checkNewVersion(const QByteArray & data)
|
||||
void HttpVersionChecker::checkNewVersion(const QByteArray &data)
|
||||
{
|
||||
checkNewVersion(QString(data));
|
||||
checkNewVersion(QString(data));
|
||||
}
|
||||
|
||||
bool HttpVersionChecker::checkNewVersion(QString sourceContent)
|
||||
@ -29,54 +29,46 @@ bool HttpVersionChecker::checkNewVersion(QString sourceContent)
|
||||
QRegExp rx("YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}win32");
|
||||
#endif
|
||||
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
QRegExp rx("YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}X11");
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
QRegExp rx("YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}Mac");
|
||||
#endif
|
||||
|
||||
int index = 0;
|
||||
bool newVersion = false;
|
||||
bool sameVersion = true;
|
||||
//bool currentVersionIsNewer = false;
|
||||
|
||||
int index = 0;
|
||||
bool newVersion = false;
|
||||
bool sameVersion = true;
|
||||
//bool currentVersionIsNewer = false;
|
||||
#ifdef QT_DEBUG
|
||||
QString version(PREVIOUS_VERSION_TESTING);
|
||||
#else
|
||||
QString version(VERSION);
|
||||
#endif
|
||||
QStringList sl = version.split(".");
|
||||
if((index = rx.indexIn(sourceContent))!=-1)
|
||||
{
|
||||
int length = qMin(sl.size(),(rx.cap(4)!="")?4:3);
|
||||
for(int i=0;i<length;i++)
|
||||
{
|
||||
if(rx.cap(i+1).toInt()<sl.at(i).toInt())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(rx.cap(i+1).toInt()>sl.at(i).toInt()){
|
||||
newVersion=true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
sameVersion = sameVersion && rx.cap(i+1).toInt()==sl.at(i).toInt();
|
||||
}
|
||||
if(!newVersion && sameVersion)
|
||||
{
|
||||
if((sl.size()==3)&&(rx.cap(4)!=""))
|
||||
newVersion = true;
|
||||
}
|
||||
}
|
||||
QStringList sl = version.split(".");
|
||||
if ((index = rx.indexIn(sourceContent)) != -1) {
|
||||
int length = qMin(sl.size(), (rx.cap(4) != "") ? 4 : 3);
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (rx.cap(i + 1).toInt() < sl.at(i).toInt()) {
|
||||
return false;
|
||||
}
|
||||
if (rx.cap(i + 1).toInt() > sl.at(i).toInt()) {
|
||||
newVersion = true;
|
||||
break;
|
||||
} else
|
||||
sameVersion = sameVersion && rx.cap(i + 1).toInt() == sl.at(i).toInt();
|
||||
}
|
||||
if (!newVersion && sameVersion) {
|
||||
if ((sl.size() == 3) && (rx.cap(4) != ""))
|
||||
newVersion = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(newVersion == true)
|
||||
{
|
||||
emit newVersionDetected();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (newVersion == true) {
|
||||
emit newVersionDetected();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user