MCPcopy Create free account
hub / github.com/Gecode/gecode / statusChanged

Method statusChanged

gecode/gist/mainwindow.cpp:233–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231 }
232
233 void
234 GistMainWindow::statusChanged(const Statistics& stats, bool finished) {
235 if (stats.maxDepth==0) {
236 isSearching = false;
237 statusBar()->showMessage("Ready");
238 prefAction->setEnabled(true);
239 } else if (isSearching && finished) {
240 isSearching = false;
241 double ms = searchTimer.stop();
242 double s = std::floor(ms / 1000.0);
243 ms -= s*1000.0;
244 double m = std::floor(s / 60.0);
245 s -= m*60.0;
246 double h = std::floor(m / 60.0);
247 m -= h*60.0;
248
249 // QString t;
250 // if (static_cast<int>(h) != 0)
251 // t += QString().setNum(static_cast<int>(h))+"h ";
252 // if (static_cast<int>(m) != 0)
253 // t += QString().setNum(static_cast<int>(m))+"m ";
254 // if (static_cast<int>(s) != 0)
255 // t += QString().setNum(static_cast<int>(s));
256 // else
257 // t += "0";
258 // t += "."+QString().setNum(static_cast<int>(ms))+"s";
259 // statusBar()->showMessage(QString("Ready (search time ")+t+")");
260 statusBar()->showMessage("Ready");
261 prefAction->setEnabled(true);
262 } else if (!isSearching && !finished) {
263 prefAction->setEnabled(false);
264 statusBar()->showMessage("Searching");
265 isSearching = true;
266 searchTimer.start();
267 }
268 depthLabel->setNum(stats.maxDepth);
269 solvedLabel->setNum(stats.solutions);
270 failedLabel->setNum(stats.failures);
271 choicesLabel->setNum(stats.choices);
272 openLabel->setNum(stats.undetermined);
273 }
274
275 void
276 GistMainWindow::about(void) {

Callers

nothing calls this directly

Calls 2

stopMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected