comparison layer/TimeValueLayer.cpp @ 11:2d5005f2b3d9

* Rework handling of layer properties in file I/O -- we now get the individual layers to load and save them rather than doing it via generic property lists in the base class, so as to ensure we read and write meaningful values rather than generic int values requiring conversion.
author Chris Cannam
date Thu, 19 Jan 2006 12:54:38 +0000
parents 8f5b812baaee
children 01849cd277e6
comparison
equal deleted inserted replaced
10:8f5b812baaee 11:2d5005f2b3d9
285 long frame0 = startFrame + x0 * zoomLevel; 285 long frame0 = startFrame + x0 * zoomLevel;
286 long frame1 = startFrame + x1 * zoomLevel; 286 long frame1 = startFrame + x1 * zoomLevel;
287 287
288 SparseTimeValueModel::PointList points(m_model->getPoints 288 SparseTimeValueModel::PointList points(m_model->getPoints
289 (frame0, frame1)); 289 (frame0, frame1));
290 if (points.empty()) return;
290 291
291 paint.setPen(m_colour); 292 paint.setPen(m_colour);
292 293
293 QColor brushColour(m_colour); 294 QColor brushColour(m_colour);
294 brushColour.setAlpha(80); 295 brushColour.setAlpha(80);
436 return Layer::toXmlString(indent, extraAttributes + 437 return Layer::toXmlString(indent, extraAttributes +
437 QString(" colour=\"%1\" plotStyle=\"%2\"") 438 QString(" colour=\"%1\" plotStyle=\"%2\"")
438 .arg(encodeColour(m_colour)).arg(m_plotStyle)); 439 .arg(encodeColour(m_colour)).arg(m_plotStyle));
439 } 440 }
440 441
442 void
443 TimeValueLayer::setProperties(const QXmlAttributes &attributes)
444 {
445 QString colourSpec = attributes.value("colour");
446 if (colourSpec != "") {
447 QColor colour(colourSpec);
448 if (colour.isValid()) {
449 setBaseColour(QColor(colourSpec));
450 }
451 }
452
453 bool ok;
454 PlotStyle style = (PlotStyle)
455 attributes.value("plotStyle").toInt(&ok);
456 if (ok) setPlotStyle(style);
457 }
458
441 459
442 #ifdef INCLUDE_MOCFILES 460 #ifdef INCLUDE_MOCFILES
443 #include "TimeValueLayer.moc.cpp" 461 #include "TimeValueLayer.moc.cpp"
444 #endif 462 #endif
445 463