Changeset View
Changeset View
Standalone View
Standalone View
tests/model/window.cpp
Show First 20 Lines • Show All 288 Lines • ▼ Show 20 Line(s) | |||||
289 | 289 | | |||
290 | void Window::setQuery(const KActivities::Stats::Query &query) | 290 | void Window::setQuery(const KActivities::Stats::Query &query) | ||
291 | { | 291 | { | ||
292 | qDebug() << "Updating the results"; | 292 | qDebug() << "Updating the results"; | ||
293 | 293 | | |||
294 | ui->viewResults->setModel(nullptr); | 294 | ui->viewResults->setModel(nullptr); | ||
295 | 295 | | |||
296 | // Log results | 296 | // Log results | ||
297 | using boost::accumulate; | 297 | QString buffer; | ||
298 | 298 | for (const ResultSet::Result &result : ResultSet(query)) { | |||
299 | ui->textLog->setText( | 299 | buffer += result.title() + QStringLiteral(" (") + result.resource() + QStringLiteral(")\n"); | ||
300 | accumulate(ResultSet(query), QString(), | 300 | } | ||
301 | [] (const QString &acc, const ResultSet::Result &result) { | 301 | ui->textLog->setText(buffer); | ||
302 | return acc + result.title() + QStringLiteral(" (") + result.resource() + QStringLiteral(")\n"); | | |||
303 | }) | | |||
304 | ); | | |||
305 | 302 | | |||
306 | model.reset(new ResultModel(query)); | 303 | model.reset(new ResultModel(query)); | ||
307 | 304 | | |||
308 | if (QCoreApplication::arguments().contains(QLatin1String("--enable-model-test"))) { | 305 | if (QCoreApplication::arguments().contains(QLatin1String("--enable-model-test"))) { | ||
309 | modelTest.reset(); | 306 | modelTest.reset(); | ||
310 | modelTest.reset(new ModelTest(new ResultModel(query))); | 307 | modelTest.reset(new ModelTest(new ResultModel(query))); | ||
311 | } | 308 | } | ||
312 | 309 | | |||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |