MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / checkUpdate

Method checkUpdate

MiniZincIDE/ide.cpp:110–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void IDE::checkUpdate(void) {
111 QSettings settings;
112 settings.sync();
113
114 settings.beginGroup("ide");
115 if (settings.value("checkforupdates21",false).toBool()) {
116 QDate lastCheck = QDate::fromString(settings.value("lastCheck21",
117 QDate::currentDate().addDays(-2).toString()).toString());
118 if (lastCheck < QDate::currentDate()) {
119 // Prepare Google Analytics event
120 QUrlQuery gaQuery;
121 gaQuery.addQueryItem("v","1"); // version 1 of the protocol
122 gaQuery.addQueryItem("tid","UA-63390311-1"); // the MiniZinc ID
123 gaQuery.addQueryItem("cid",settings.value("uuid","unknown").toString()); // identifier for this installation
124 gaQuery.addQueryItem("aip","1"); // anonymize IP address
125 gaQuery.addQueryItem("t","event"); // feedback type
126 gaQuery.addQueryItem("ec","check"); // event type
127 gaQuery.addQueryItem("ea","checkUpdate"); // event action
128 gaQuery.addQueryItem("el",applicationVersion()); // event label (IDE version)
129 QNetworkRequest gaRequest(QUrl("http://www.google-analytics.com/collect"));
130 gaRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
131 networkManager->post(gaRequest, gaQuery.toString().toLocal8Bit());
132
133 // Check if an update is available
134 QNetworkRequest request(QUrl("http://www.minizinc.org/version-info.php"));
135 versionCheckReply = networkManager->get(request);
136 connect(versionCheckReply, &QNetworkReply::finished, this, &IDE::versionCheckFinished);
137 }
138 QTimer::singleShot(24*60*60*1000, this, SLOT(checkUpdate()));
139 }
140 settings.endGroup();
141}
142
143
144IDE::IDE(int& argc, char* argv[]) : QApplication(argc,argv) {

Callers 1

Calls 3

valueMethod · 0.45
toStringMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected