History

CR fixes

Leonardo Murillo committed 12 years ago

Commit b8aaf4e1 parent 746b45d4 files · +44 −61Browse files

Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all

Unified · Split

interface/src/Application.cpp+20−16
@@ -4422,18 +4422,22 @@ void Application::checkVersion() { · 4421 unmodified lines
4422}4422}
4423 4423
4424void Application::parseVersionXml(QNetworkReply *reply) {4424void Application::parseVersionXml(QNetworkReply *reply) {
4425 QString *_operatingSystem;4425 QString *operatingSystem;
4426 4426
4427 #ifdef Q_OS_WIN324427 #ifdef Q_OS_WIN32
4428 _operatingSystem = new QString("win");4428 operatingSystem = new QString("win");
4429 #endif4429 #endif
4430 4430
4431 #ifdef Q_OS_MAC4431 #ifdef Q_OS_MAC
4432 _operatingSystem = new QString("mac");4432 operatingSystem = new QString("mac");
4433 #endif4433 #endif
4434 4434
4435 QString _releaseDate;4435 QString releaseDate;
4436 QString _releaseNotes;4436 QString releaseNotes;
4437 QString latestVersion;
4438 QUrl downloadURL;
4439
4440 QWidget *updateDialog;
4437 4441
4438 QXmlStreamReader xml(reply);4442 QXmlStreamReader xml(reply);
4439 while (!xml.atEnd() && !xml.hasError()) {4443 while (!xml.atEnd() && !xml.hasError()) {
@@ -4442,25 +4446,25 @@ void Application::parseVersionXml(QNetworkReply *reply) { · 2 unmodified lines
4442 if (token == QXmlStreamReader::StartElement) {4446 if (token == QXmlStreamReader::StartElement) {
4443 if (xml.name() == "ReleaseDate") {4447 if (xml.name() == "ReleaseDate") {
4444 xml.readNext();4448 xml.readNext();
4445 _releaseDate = xml.text().toString();4449 releaseDate = xml.text().toString();
4446 }4450 }
4447 if (xml.name() == "ReleaseNotes") {4451 if (xml.name() == "ReleaseNotes") {
4448 xml.readNext();4452 xml.readNext();
4449 _releaseNotes = xml.text().toString();4453 releaseNotes = xml.text().toString();
4450 }4454 }
4451 if (xml.name() == "Version") {4455 if (xml.name() == "Version") {
4452 xml.readNext();4456 xml.readNext();
4453 _latestVersion = new QString(xml.text().toString());4457 latestVersion = xml.text().toString();
4454 }4458 }
4455 if (xml.name() == _operatingSystem) {4459 if (xml.name() == operatingSystem) {
4456 xml.readNext();4460 xml.readNext();
4457 _downloadURL = new QUrl(xml.text().toString());4461 downloadURL = QUrl(xml.text().toString());
4458 }4462 }
4459 }4463 }
4460 }4464 }
4461 4465
4462 if (!shouldSkipVersion() && applicationVersion() != _latestVersion) {4466 if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
4463 _updateDialog = new UpdateDialog(_glWidget, _releaseNotes);4467 updateDialog = new UpdateDialog(_glWidget, releaseNotes);
4464 }4468 }
4465}4469}
4466 4470
@@ -4472,20 +4476,20 @@ QFile *Application::loadSkipFile() { · 5 unmodified lines
4472 return file;4476 return file;
4473}4477}
4474 4478
4475bool Application::shouldSkipVersion() {4479bool Application::shouldSkipVersion(QString latestVersion) {
4476 QFile *skipFile = loadSkipFile();4480 QFile *skipFile = loadSkipFile();
4477 QByteArray skipFileContents = skipFile->readAll();4481 QByteArray skipFileContents = skipFile->readAll();
4478 QString *skipVersion = new QString(skipFileContents);4482 QString *skipVersion = new QString(skipFileContents);
4479 skipFile->close();4483 skipFile->close();
4480 if (*skipVersion == *_latestVersion || applicationVersion() == "0.1") {4484 if (*skipVersion == latestVersion || applicationVersion() == "0.1") {
4481 return true;4485 return true;
4482 }4486 }
4483 return false;4487 return false;
4484}4488}
4485 4489
4486void Application::skipVersion() {4490void Application::skipVersion(QString latestVersion) {
4487 QFile *skipFile = loadSkipFile();4491 QFile *skipFile = loadSkipFile();
4488 skipFile->seek(0);4492 skipFile->seek(0);
4489 skipFile->write(_latestVersion->toStdString().c_str());4493 skipFile->write(latestVersion.toStdString().c_str());
4490 skipFile->close();4494 skipFile->close();
4491}4495}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t