Mercurial > hg > easaier-soundaccess
changeset 253:82d17c4d4b39
set a color and a value different when a new interval layer is loaded
author | lbajardsilogic |
---|---|
date | Thu, 12 Jun 2008 13:36:37 +0000 |
parents | 3e35ed5332cb |
children | 8bdd4752c2b2 |
files | data/fileio/ModelReader.cpp data/model/IntervalModel.h view/Pane.cpp view/Pane.h |
diffstat | 4 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/data/fileio/ModelReader.cpp Thu Jun 12 12:29:49 2008 +0000 +++ b/data/fileio/ModelReader.cpp Thu Jun 12 13:36:37 2008 +0000 @@ -223,6 +223,15 @@ m_model = model; m_model->setObjectName(eventLabel); + //set color and value for interval + IntervalModel *im = dynamic_cast<IntervalModel*> (m_model); + if ((m_pane) && (im)) + { + int modulo = m_pane->getIntervalModulo(); + im->setMeanValue(modulo*0.2+0.2); + m_layer->setProperty("Colour", modulo + 1); + } + //link model, layer document and view if (m_model && m_layer) { @@ -261,7 +270,7 @@ label += iter->second + " - "; } //value - float value = 0.5; + float value = im->getMeanValue(); im->addInterval(start, end, label, value); } }
--- a/data/model/IntervalModel.h Thu Jun 12 12:29:49 2008 +0000 +++ b/data/model/IntervalModel.h Thu Jun 12 13:36:37 2008 +0000 @@ -99,6 +99,8 @@ void changeInterval(TimeIntervalPtr ti, long start, long end, float value, const QString& label); + inline float getMeanValue() {return m_meanValue;}; + inline void setMeanValue(float value) {m_meanValue = value;}; /** * Command to change an interval. */ @@ -214,6 +216,8 @@ IntervalList m_intervals; mutable QMutex m_mutex; + float m_meanValue; + }; #endif // _INTERVAL_MODEL_H_
--- a/view/Pane.cpp Thu Jun 12 12:29:49 2008 +0000 +++ b/view/Pane.cpp Thu Jun 12 13:36:37 2008 +0000 @@ -54,7 +54,8 @@ m_vpan(0), m_hthumb(0), m_vthumb(0), - m_reset(0) + m_reset(0), + m_intervalModulo(3) { setObjectName("Pane"); setMouseTracking(true);
--- a/view/Pane.h Thu Jun 12 12:29:49 2008 +0000 +++ b/view/Pane.h Thu Jun 12 13:36:37 2008 +0000 @@ -61,6 +61,7 @@ virtual QString toEasaierXmlString(QString indent = "", QString extraAttributes = "") const; + virtual int getIntervalModulo() {m_intervalModulo = (m_intervalModulo+1)%4; return m_intervalModulo;} signals: void paneInteractedWith(); void rightButtonMenuRequested(QPoint position); @@ -144,6 +145,8 @@ Thumbwheel *m_hthumb; Thumbwheel *m_vthumb; NotifyingPushButton *m_reset; + + int m_intervalModulo; }; #endif