void RangeSelectWidget::modeChanged()
{
	const ndimdata::DataStatistic &statistic(m_statistic);
	if (ui->radioRangeAll->isChecked()) {
		m_bound1 = statistic.min;
		m_bound2 = statistic.max;
		valuesUpdated();
	} else if (ui->radioRangeAuto->isChecked()) {
		m_bound1 = statistic.auto_low_bound;
		m_bound2 = statistic.auto_high_bound;
		valuesUpdated();
	}
}
Exemple #2
0
void CCEdit::doLearn(int port, int chan, int cc, int lsb)
{
	//Stop listening to learning signals
	disconnect(song, SIGNAL(midiLearned(int, int, int, int)), this, SLOT(doLearn(int, int, int, int)));
	if(!m_info)
		return;

	if(m_info->port() != port)
		return; //For now we use the port assigned to the track
	
	if(lsb >= 0) //NRPN learned
	{
		int oldcc = m_info->assignedControl();
		m_info->setPort(port);
		m_info->setChannel(chan);
		m_info->setNRPN(true);
		m_info->setMSB(cc);
		m_info->setLSB(lsb);
		//printf("OLD number: %d\n", oldcc);
		printf("Midi NRPN Learned: port: %d, channel: %d, MSB: %d, LSB: %d\n", port, chan, cc, lsb);
		midiMonitor->msgModifyTrackController(m_info->track(), oldcc, m_info);
	}
	else
	{
		int oldcc = m_info->assignedControl();
		printf("Midi Learned: port: %d, channel: %d, CC: %d\n", port, chan, cc);
		m_info->setPort(port);
		m_info->setChannel(chan);
		m_info->setAssignedControl(cc);
		midiMonitor->msgModifyTrackController(m_info->track(), oldcc, m_info);
	}
	updateValues();

	emit valuesUpdated(m_info);
}
void RangeSelectWidget::setRange(double a, double b)
{
	m_bound1 = a;
	m_bound2 = b;
	ui->radioRangeCustom->setChecked(true);
	valuesUpdated();
}
IoslotValueProducer::IoslotValueProducer(QSharedPointer<Monitoring> monitoring, QObject *parent) : QObject(parent),
    d_monitoring(monitoring),
    d_period(5),
    d_lastTime(QTime::currentTime())
{
    connect(d_monitoring.data(), SIGNAL(valuesUpdated()), this, SLOT(onValuesUpdated()), Qt::DirectConnection);
}
Exemple #5
0
//TODO: requires values to be added in time order
void DataSeries::addValue(double time, double value, bool scale) {
	if (timestamps.size() > 0 && time < timestamps.last())  {//qDebug() << time << "vs." << timestamps.last();
		qWarning() << time << timestamps.last();
	}
	if (scale) value *= descriptor->factor();
	//qDebug() << descriptor->str() << ": Adding " << value << "at time" << time;
	if (value < _min) {
		_min = value;
		emit newMin(value);
	}
	if (value > _max) {
		_max = value;
		emit newMax(value);
	}
	double _oldavg = _avg;
	if (values.size() > 0) {
		//double t = time - timestamps.last();
		//double v1 = values.last();
		double avgval = value; //v1*t+(value-v1)*t/2;
		_avg += (avgval-_avg)/(values.size()+1);
		//qWarning() << _avg << avgval;
	} else {
		_avg = value;
	}
	values.append(value);
	timestamps.append(time);
	if (_oldavg != _avg) {
		emit newAvg(_avg);
	}
	emit newValue(time,value);
	emit valuesUpdated(timestamps,values);
}
void RangeSelectWidget::on_spinMinMax2_valueChanged(double v)
{
	if (m_updating)
		return;
	ui->radioRangeCustom->setChecked(true);
	m_bound2 = v;
	valuesUpdated();
}
void RangeSelectWidget::on_sliderMinMax2_valueChanged(int v)
{
	if (m_updating)
		return;
	ui->radioRangeCustom->setChecked(true);
	m_bound2 = fromSliderValue(v, ui->sliderMinMax2->maximum(), m_statistic.min, m_statistic.max);
	valuesUpdated();
}
void RangeSelectWidget::rangePicked(QRectF range)
{
	if (m_updating)
		return;
	ui->radioRangeCustom->setChecked(true);
	m_bound1 = range.left();
	m_bound2 = range.right();
	valuesUpdated();
}
void SettingsSection::setValues(const QVariant& values)
{
  QVariantMap map = values.toMap();
  QVariantMap updatedValues;

  // values not included in the map are reset to default
  foreach (const QString& key, m_values.keys())
  {
    if (!map.contains(key))
      map[key] = m_values[key]->defaultValue();
  }

  foreach (const QString& key, map.keys())
  {
    if (key.isEmpty())
      continue;

    bool haveKey = m_values.contains(key);
    if (haveKey && m_values[key]->value() == map[key])
      continue;

    if (haveKey)
    {
      m_values[key]->setValue(map[key]);
    }
    else
    {
      m_values[key] = new SettingsValue(key, QVariant(), PLATFORM_ANY, this);
      m_values[key]->setValue(map[key]);
    }

    updatedValues.insert(key, map[key]);
  }

  if (updatedValues.size() > 0)
    emit valuesUpdated(updatedValues);
}
void RangeSelectWidget::setBound2(double bound)
{
	m_bound2 = bound;
	ui->radioRangeCustom->setChecked(true);
	valuesUpdated();
}
void RangeSelectWidget::on_radioRangeCustom_clicked()
{
	if (m_updating)
		return;
	valuesUpdated();
}