Exemple #1
0
	void HScrollBar::setRangeFromPage( int pageWidth, int contentWidth )
	{
		float percentage = (float)(pageWidth) / (float)(contentWidth);

		int y = (int)((contentWidth - pageWidth)
			/ (1.0f - percentage));
		int x = (int)((float)y * percentage);

		//should the thumb be brought to the bottom?
		bool isAtMax = getValue() > y - x;

		setMaxValue(y);
		setLargeAmount(x);

		y = getMaxValue();
		x = getLargeAmount();

		if(isAtMax)
		{
			setValue(getMaxValue() - getLargeAmount());
		}

		if(x <= 0 || y <= 0 || x >= y)
		{
			setMaxValue(1);
			setLargeAmount(1);

		}
	}
Exemple #2
0
int QProg::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: valueChanged((*reinterpret_cast< double(*)>(_a[1]))); break;
        case 1: setValue((*reinterpret_cast< double(*)>(_a[1]))); break;
        case 2: setMaxValue((*reinterpret_cast< double(*)>(_a[1]))); break;
        case 3: setMinValue((*reinterpret_cast< double(*)>(_a[1]))); break;
        case 4: setFontDim((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 5: setPrecision((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 6: setBarColor((*reinterpret_cast< QColor(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 7;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< double*>(_v) = value(); break;
        case 1: *reinterpret_cast< double*>(_v) = minValue(); break;
        case 2: *reinterpret_cast< double*>(_v) = maxValue(); break;
        case 3: *reinterpret_cast< int*>(_v) = font(); break;
        case 4: *reinterpret_cast< int*>(_v) = numPrec(); break;
        case 5: *reinterpret_cast< QColor*>(_v) = color(); break;
        }
        _id -= 6;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setValue(*reinterpret_cast< double*>(_v)); break;
        case 1: setMinValue(*reinterpret_cast< double*>(_v)); break;
        case 2: setMaxValue(*reinterpret_cast< double*>(_v)); break;
        case 3: setFontDim(*reinterpret_cast< int*>(_v)); break;
        case 4: setPrecision(*reinterpret_cast< int*>(_v)); break;
        case 5: setBarColor(*reinterpret_cast< QColor*>(_v)); break;
        }
        _id -= 6;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 6;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 6;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemple #3
0
void DoubleSlider::setValues(float val1, float val2) {
    if (val1 < val2) {
        setMinValue(val1);
        setMaxValue(val2);
    }
    else {
        setMinValue(val2);
        setMaxValue(val1);
    }
}
Exemple #4
0
void DoubleSlider::moveSlider(float mousePos) {
    if (leftSliderActive_ && !rightSliderActive_)
        setMinValue(mousePos);
    if (rightSliderActive_ && !leftSliderActive_)
        setMaxValue(mousePos);
    if (rightSliderActive_ && leftSliderActive_) {
        float mouseDiff = normalizedMousePos_ - mousePos;
        setMinValue(mV1_ - mouseDiff);
        setMaxValue(mV2_ - mouseDiff);
    }
}
void Slider::setLineStep (const double new_ls)
{
  lineStep = new_ls;
  setMinValue(minValue);
  setMaxValue(maxValue);
  setValue(value);
}
void Slider::setDirection (const DIRECT new_dir)
{
  direction = new_dir;
  setMinValue(minValue);
  setMaxValue(maxValue);
  setValue(value);
}
void Slider::reloadSlider()
{
    slider->hide();
    if (orientation == 0) {
      slider->setOrientation(Qt::Horizontal);
      slider->setGeometry(x()+10, height()/2-10, width()-20, 20);
    }
      else if (orientation == 1) {
             slider->setOrientation(Qt::Vertical);
             slider->setGeometry(width()/2-10, 10, 20, height()-20);
           }
    slider->setMinValue(-32768);
    slider->show();

    setTickmarks (tickmarks);
    setTickInterval (tickInterval);
    setTracking (tracking);
    setPageStep(pageStep);
    setMainColor(mainColor);
    setTickmarksColor(tickmarksColor);

    setMinValue(minValue);
    setMaxValue(maxValue);
    if (direction == 0) slider->setValue((int)(-32768 + (value-minValue)/lineStep));
      else if (direction == 1) slider->setValue((int)(-32768 + (maxValue-value)/lineStep));

    setNewMask();
}
Exemple #8
0
int QwtCounter::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: buttonReleased((*reinterpret_cast< double(*)>(_a[1]))); break;
        case 1: valueChanged((*reinterpret_cast< double(*)>(_a[1]))); break;
        case 2: btnReleased(); break;
        case 3: btnClicked(); break;
        case 4: textChanged(); break;
        }
        _id -= 5;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = numButtons(); break;
        case 1: *reinterpret_cast< double*>(_v) = step(); break;
        case 2: *reinterpret_cast< double*>(_v) = minVal(); break;
        case 3: *reinterpret_cast< double*>(_v) = maxVal(); break;
        case 4: *reinterpret_cast< int*>(_v) = stepButton1(); break;
        case 5: *reinterpret_cast< int*>(_v) = stepButton2(); break;
        case 6: *reinterpret_cast< int*>(_v) = stepButton3(); break;
        case 7: *reinterpret_cast< double*>(_v) = value(); break;
        case 8: *reinterpret_cast< bool*>(_v) = editable(); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setNumButtons(*reinterpret_cast< int*>(_v)); break;
        case 1: setStep(*reinterpret_cast< double*>(_v)); break;
        case 2: setMinValue(*reinterpret_cast< double*>(_v)); break;
        case 3: setMaxValue(*reinterpret_cast< double*>(_v)); break;
        case 4: setStepButton1(*reinterpret_cast< int*>(_v)); break;
        case 5: setStepButton2(*reinterpret_cast< int*>(_v)); break;
        case 6: setStepButton3(*reinterpret_cast< int*>(_v)); break;
        case 7: setValue(*reinterpret_cast< double*>(_v)); break;
        case 8: setEditable(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 9;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemple #9
0
CNeuralNetworkStateModifier::CNeuralNetworkStateModifier(CStateProperties *originalState) : CStateModifier(getNumInitContinuousStates(originalState, NULL, 0),0)
{
	this->originalState = originalState;

	for (unsigned int i = 0; i < getNumContinuousStates(); i++)
	{
		setMinValue(i, -10000.0);
		setMaxValue(i, 10000.0);
	}
	numDim = 0;
	dimensions = NULL;

	input_mean = new ColumnVector(numDim);
	input_std = new ColumnVector(numDim);

	*input_mean = 0;
	*input_std = 1;

	// preserve normalization on the intervall [-1 1]

	for (unsigned int i = 0; i < numDim; i ++)
	{
		input_mean->element(i) =  (originalState->getMaxValue(dimensions[i]) + originalState->getMinValue(dimensions[i])) / 2.0;
		
		input_std->element(i) = (originalState->getMaxValue(dimensions[i]) - originalState->getMinValue(dimensions[i])) / 2.0;
	}

	buffVector = new ColumnVector(numDim);
}
caTable::caTable(QWidget *parent) : QTableWidget(parent)

{
    setPrecisionMode(Channel);
    setLimitsMode(Channel);
    setPrecision(0);
    setMinValue(0.0);
    setMaxValue(1.0);
    for(int i=0; i< MaxRows; i++) {
        setFormat(i, 1);
        for(int j=0; j< MaxCols; j++) tableItem[i][j] = (QTableWidgetItem*) 0;
    }

    thisItemFont = this->font();

    setColorMode(Static);
    setAlternatingRowColors(true);
    setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    setEditTriggers(QTableWidget::NoEditTriggers);
    verticalHeader()->setDefaultSectionSize(20);
    horizontalHeader()->setResizeMode(QHeaderView::Stretch);

    defaultForeColor = palette().foreground().color();

    createActions();
    addAction(copyAct);

    connect(this, SIGNAL( cellDoubleClicked (int, int) ), this, SLOT(celldoubleclicked( int, int ) ) );
    //connect(this, SIGNAL( cellClicked (int, int) ), this, SLOT(cellclicked( int, int ) ) );
}
Exemple #11
0
void gajim::loadMessages(const QString &path)
{
	QDir dir = path;
	QFileInfo info(dir.filePath("logs.db"));
	if(!info.exists())
		return;
	QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
	db.setDatabaseName(info.absoluteFilePath());
	if(!db.open())
		return;
	setProtocol("jabber");
	setAccount(m_account);
	QSqlQuery jid_query("SELECT jid_id, jid FROM jids", db);
	setMaxValue(jid_query.size());
	int num = 0;
	while(jid_query.next())
	{
		QString jid_id = jid_query.value(0).toString();
		QString jid = jid_query.value(1).toString();
		setContact(jid);
		static QString query_str = "SELECT time, message, kind FROM logs "
								   "WHERE jid_id = %1 AND (kind = 4 OR kind = 6) "
								   "ORDER BY time ASC";
		QSqlQuery query(query_str.arg(jid_id), db);
		while(query.next())
		{
			Message message;
			message.setTime(QDateTime::fromTime_t(query.value(0).toInt()));
			message.setIncoming(query.value(2).toInt() == 4);
			message.setText(query.value(1).toString());
			appendMessage(message);
		}
		setValue(++num);
	}
}
void QmitkNumberPropertyEditor::adjustFactors(short newDecimalPlaces, bool newShowPercents)
{
    int oldMax = maxValue();
    int oldMin = minValue();

    m_DecimalPlaces = newDecimalPlaces;
    m_ShowPercents = newShowPercents;

    m_FactorPropertyToSpinbox = pow(10.0,m_DecimalPlaces);
    m_FactorSpinboxToDisplay = 1.0 / m_FactorPropertyToSpinbox;

    // commented line would set the default increase/decrease to 1.0, no matter how many decimal places are available
    //setLineStep( ROUND(m_FactorPropertyToSpinbox) );

    if ( m_ShowPercents )
    {
        m_FactorPropertyToSpinbox *= 100.0;
        //setLineStep( ROUND(0.01 *m_FactorPropertyToSpinbox) );
        setSuffix("%");
    }
    else
    {
        setSuffix("");
    }

    setMinValue(oldMin);
    setMaxValue(oldMax);
}
Exemple #13
0
Vibrator::Vibrator( const std::string& name, unsigned int maxValue  )
	: Component(kVibrator, name),
	  mMaxValue(0),
	  mValue(0)
{
	setMaxValue(maxValue);
}
Exemple #14
0
void LinearGauge::loadSettings( QSettings& pSettings )
{
	// Scale
	Qt::Orientation orientation = (Qt::Orientation) pSettings.value("orientation", Qt::Vertical).toInt();
	QwtThermo::ScalePos scalePosition = (QwtThermo::ScalePos) pSettings.value("scalePosition", QwtThermo::LeftScale).toInt();
	setOrientation( orientation, scalePosition );
	setMinValue( pSettings.value("minValue", 0).toDouble() );
	setMaxValue( pSettings.value("maxValue", 10).toDouble() );

	// Ticks
	setScaleMaxMinor( pSettings.value("scaleMaxMinor", 4).toInt() );
	setScaleMaxMajor( pSettings.value("scaleMaxMajor", 12).toInt() );
	scaleDraw()->enableComponent( QwtAbstractScaleDraw::Labels, pSettings.value("labels", true).toBool() );
	setFont( QFont(	pSettings.value("font").toString(), pSettings.value("fontSize", 8).toDouble()) );

	// Pipe
	setValue( pSettings.value("value", 8).toDouble() );
	setPipeWidth( pSettings.value("pipeWidth", 10).toInt() );
	setFillBrush( QBrush( pSettings.value("pipeColor").toUInt() ) );

	// Alarm
	setAlarmLevel( pSettings.value("alarmLevel", 7).toDouble() );
	setAlarmBrush( QBrush( pSettings.value("alarmBrush").toUInt() ) );
	setAlarmEnabled( pSettings.value("alarmEnabled").toBool() );	

	// Color
	setTextColor( pSettings.value("textColor").toUInt() );
	setBackgroundColor( pSettings.value("backgroundColor").toUInt() );

	AbstractGauge::loadSettings( pSettings );
}
bool OSArgument::setMaxValue(int maxValue)
{
  if (m_type == OSArgumentType::Double) {
    double test = (double)maxValue;
    return setMaxValue(test);
  }
  else if (m_type != OSArgumentType::Integer) {
    return false;
  }

  double minValue = std::numeric_limits<int>::min();
  if (hasDomain() && (m_domainType == OSDomainType::Interval)){
    std::vector<int> domain = domainAsInteger();
    if (domain.size() == 2){
      minValue = domain[0];
    }
  }

  m_domainType = OSDomainType::Interval;
  m_domain.clear();
  m_domain.push_back(QVariant(minValue));
  m_domain.push_back(QVariant(maxValue));

  onChange();

  return true;
}
Exemple #16
0
CNeuralNetworkStateModifier::CNeuralNetworkStateModifier(CStateProperties *originalState, unsigned int *l_dimensions, unsigned int l_numDim) : CStateModifier(getNumInitContinuousStates(originalState, l_dimensions, l_numDim),0)
{
	this->originalState = originalState;

	
	this->numDim = l_numDim;
	dimensions = new unsigned int[numDim];
	memcpy(dimensions, l_dimensions, sizeof(int) * numDim);

	normValues = false;

	for (unsigned int i = 0; i < getNumContinuousStates(); i++)
	{
		setMinValue(i, - 100000.0);
		setMaxValue(i,   100000.0);
	}
	input_mean = new ColumnVector(numDim);
	input_std = new ColumnVector(numDim);

	*input_mean = 0;
	*input_std = 1;

	// preserve normalization on the intervall [-1 1]

	for (unsigned int i = 0; i < numDim; i ++)
	{
		input_mean->element(i) =  (originalState->getMaxValue(dimensions[i]) + originalState->getMinValue(dimensions[i])) / 2.0;
		
		input_std->element(i) = (originalState->getMaxValue(dimensions[i]) - originalState->getMinValue(dimensions[i])) / 2.0;
	}

	buffVector = new ColumnVector(numDim);
}
Exemple #17
0
CStateVariablesChooser::CStateVariablesChooser(unsigned int numContStates,unsigned int *l_contStatesInd,unsigned int numDiscStates,unsigned int *l_discStatesInd, CStateProperties *originalState) :  CStateModifier(numContStates, numDiscStates)
{
	contStatesInd = NULL;
	discStatesInd = NULL;

	if (numContStates > 0)
	{
		contStatesInd = new unsigned int[numContStates];
		memcpy(contStatesInd, l_contStatesInd, sizeof(unsigned int) * numContStates);
	}
	if (numDiscStates > 0)
	{
		discStatesInd = new unsigned int[numDiscStates];

		memcpy(discStatesInd, l_discStatesInd, sizeof(unsigned int) * numDiscStates);
	}

	this->originalState = originalState;


	for (int i = 0; i < getNumContinuousStates(); i++)
	{
		setMinValue(i, originalState->getMinValue(contStatesInd[i]));
		setMaxValue(i, originalState->getMaxValue(contStatesInd[i]));
	}

	for (int i = 0; i < getNumDiscreteStates(); i++)
	{
		setDiscreteStateSize(i, originalState->getDiscreteStateSize(discStatesInd[i]));
	}

	
}
bool IOAudioLevelControl::init(SInt32 initialValue,
                               SInt32 minValue,
                               SInt32 maxValue,
                               IOFixed minDB,
                               IOFixed maxDB,
                               UInt32 channelID,
                               const char *channelName,
                               UInt32 cntrlID,
                               UInt32 subType,
                               UInt32 usage,
                               OSDictionary *properties)
{
    bool result = true;
    OSNumber *number;
    
    number = OSNumber::withNumber(initialValue, sizeof(SInt32)*8);
    
    if ((number == NULL) || !super::init(kIOAudioControlTypeLevel, number, channelID, channelName, cntrlID, subType, usage, properties)) {
        result = false;
        goto Done;
    }

    setMinValue(minValue);
    setMaxValue(maxValue);
    setMinDB(minDB);
    setMaxDB(maxDB);

Done:
    if (number) {
        number->release();
    }
            
    return result;
}
void SettingsConstraints::loadFromConfig(const String & path_to_constraints, const Poco::Util::AbstractConfiguration & config)
{
    if (!config.has(path_to_constraints))
        throw Exception("There is no path '" + path_to_constraints + "' in configuration file.", ErrorCodes::NO_ELEMENTS_IN_CONFIG);

    Poco::Util::AbstractConfiguration::Keys names;
    config.keys(path_to_constraints, names);

    for (const String & name : names)
    {
        String path_to_name = path_to_constraints + "." + name;
        Poco::Util::AbstractConfiguration::Keys constraint_types;
        config.keys(path_to_name, constraint_types);
        for (const String & constraint_type : constraint_types)
        {
            auto get_constraint_value = [&]{ return config.getString(path_to_name + "." + constraint_type); };
            if (constraint_type == "min")
                setMinValue(name, get_constraint_value());
            else if (constraint_type == "max")
                setMaxValue(name, get_constraint_value());
            else if (constraint_type == "readonly")
                setReadOnly(name, true);
            else
                throw Exception("Setting " + constraint_type + " value for " + name + " isn't supported", ErrorCodes::NOT_IMPLEMENTED);
        }
    }
}
Exemple #20
0
void Variometer::loadSettings(QSettings &settings) {
    PanelItem::loadSettings(settings);
    QString unitname = settings.value("unit").toString();
    VelocityUnit unit = Units::velocityUnitForName(unitname);
    setUnit(unit);
    setMaxValue(settings.value("maxvalue", 300).toDouble());
    setIsTotalEnergy(settings.value("totalenergy", false).toBool());
}
Exemple #21
0
		void GridColorWidget::normalizationToggled(bool enabled)
		{
			if(enabled)
			{
				setMinValue(0.0f);
				setMidValue(0.5f);
				setMaxValue(1.0f);
			}
		}
Exemple #22
0
int QwtThermo::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setValue((*reinterpret_cast< double(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = alarmEnabled(); break;
        case 1: *reinterpret_cast< double*>(_v) = alarmLevel(); break;
        case 2: *reinterpret_cast< ScalePos*>(_v) = scalePosition(); break;
        case 3: *reinterpret_cast< int*>(_v) = spacing(); break;
        case 4: *reinterpret_cast< int*>(_v) = borderWidth(); break;
        case 5: *reinterpret_cast< double*>(_v) = maxValue(); break;
        case 6: *reinterpret_cast< double*>(_v) = minValue(); break;
        case 7: *reinterpret_cast< int*>(_v) = pipeWidth(); break;
        case 8: *reinterpret_cast< double*>(_v) = value(); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setAlarmEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 1: setAlarmLevel(*reinterpret_cast< double*>(_v)); break;
        case 2: setScalePosition(*reinterpret_cast< ScalePos*>(_v)); break;
        case 3: setSpacing(*reinterpret_cast< int*>(_v)); break;
        case 4: setBorderWidth(*reinterpret_cast< int*>(_v)); break;
        case 5: setMaxValue(*reinterpret_cast< double*>(_v)); break;
        case 6: setMinValue(*reinterpret_cast< double*>(_v)); break;
        case 7: setPipeWidth(*reinterpret_cast< int*>(_v)); break;
        case 8: setValue(*reinterpret_cast< double*>(_v)); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 9;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemple #23
0
void KDoubleSpinBox::setRange( double lower, double upper, double step,
			       int precision ) {
  lower = kMin(upper, lower);
  upper = kMax(upper, lower);
  setPrecision( precision, true ); // disable bounds checking, since
  setMinValue( lower );            // it's done in set{Min,Max}Value
  setMaxValue( upper );            // anyway and we want lower, upper
  setLineStep( step );             // and step to have the right precision
}
void Variometer::loadSettings(QSettings &settings) {
    NeedleInstrument::loadSettings(settings);
    QString unitname = settings.value("unit").toString();
    VelocityUnit unit = Units::velocityUnitForName(unitname);
    setUnit(unit);
    setMaxValue(settings.value("maxvalue", 300).toFloat());
    setNumberScale(settings.value("scalevalue", 1.).toFloat());
    setIsTotalEnergy(settings.value("totalenergy", false).toBool());
}
Exemple #25
0
void Normalization::init(Normalization::Type nt, double max, double min, double threshold, double amp, double elong)
{
	setType(nt);
	setMaxValue(max);
	setMinValue(min);
	setThreshold(threshold);
	setAmplitude(amp);
	setElongation(elong);
}
void andrq::loadMessages(const QString &path)
{
	QDir dir = path;
	QString account = dir.dirName();
	if(!dir.cd("history"))
		return;
	setProtocol("ICQ");
	setAccount(account);
	QFileInfoList files = dir.entryInfoList(QDir::Files);
	setMaxValue(files.size());
	for(int i = 0; i < files.size(); i++)
	{
		setValue(i + 1);
		QString uin = files[i].fileName();
		QFile file(files[i].absoluteFilePath());
		if(!file.open(QFile::ReadOnly))
			continue;
		setContact(uin);
		QDataStream in(&file);
		in.setByteOrder(QDataStream::LittleEndian);
		Message message;
		message.type=1;
		while(!in.atEnd())
		{
			qint32 type;
			in >> type;
			switch(type)
			{
			case -1: {
				quint8 kind;
				qint32 who;
				in >> kind >> who;
				QString from = QString::number(who);
				message.in = from == uin;
				message.time = getDateTime(in);
				qint32 tmp;
				in >> tmp;
				in.skipRawData(tmp);
				message.text = Qt::escape(getString(in, who)).replace("\n", "<br/>");
				if(kind==1)
					appendMessage(message);
				break; }
			case -2: {
				qint32 tmp;
				in >> tmp;
				in.skipRawData(tmp);
				break; }
			case -3:
				in.skipRawData(5);
				break;
			default:
				break;
			}
		}
	}
}
KSimTimeSpinBox::KSimTimeSpinBox(const KSimTimeBase & time, QWidget * parent, const char * name)
	:	KSimDoubleUnitSpinBox(parent, name),
		m_time(time)
{
	setMinValue(1e-10);
	setMaxValue(1e6);
	setLineStep(1e-3);
	
	init();
}
short ElemDDLSGOptions::importSGO(const ElemDDLSGOptions *sgo)
{
  if (sgo->isStartValueSpecified())
    {
      setStartValueSpec(TRUE);
      setStartValue(sgo->getStartValue());
    }

  if (sgo->isIncrementSpecified())
    {
      setIncrementSpec(TRUE);
      setIncrement(sgo->getIncrement());
    }

  if (sgo->isMinValueSpecified())
    {
      setMinValueSpec(TRUE);
      
      if (sgo->isNoMinValue())
        setNoMinValue(TRUE);
      else
        setMinValue(sgo->getMinValue());
    }

  if (sgo->isMaxValueSpecified())
    {
      setMaxValueSpec(TRUE);

      if (sgo->isNoMaxValue())
        setNoMaxValue(TRUE);
      else
        setMaxValue(sgo->getMaxValue());
    }

  if (sgo->isCacheSpecified())
    {
      setCacheSpec(TRUE);
      setCache(sgo->getCache());
    }

  if (sgo->isCycleSpecified())
    {
      setCycleSpec(TRUE);
      setCycle(sgo->isCycle());
    }

  if (sgo->isResetSpecified())
    {
      setResetSpec();
      setReset(sgo->isReset());
    }

  return 0;
}
void AirspeedIndicator::loadSettings(QSettings &settings) {
    PanelItem::loadSettings(settings);
    QString unitname = settings.value("unit").toString();
    VelocityUnit unit = Units::velocityUnitForName(unitname);
    setUnit(unit);
    setMaxValue(settings.value("maxvalue", 300).toDouble());
    setVso(settings.value("vso", 35).toDouble());
    setVs(settings.value("vs", 50).toDouble());
    setVfe(settings.value("vfe", 110).toDouble());
    setVno(settings.value("vno", 150).toDouble());
    setVno(settings.value("vne", 200).toDouble());
}
/**
* Reset the colorbar parameters.
* @param cmap :: A new Mantid color map.
* @param minValue :: A new minimum value.
* @param maxValue :: A new maximum value.
* @param minPositive :: A new minimum positive value for the log scale.
* @param autoscaling :: Flag to set autoscaling of the color
*/
void InstrumentWidgetRenderTab::setupColorBar(const MantidColorMap &cmap,
                                              double minValue, double maxValue,
                                              double minPositive,
                                              bool autoscaling) {
  setMinValue(minValue, false);
  setMaxValue(maxValue, false);
  m_colorMapWidget->setMinPositiveValue(minPositive);
  m_colorMapWidget->setupColorBarScaling(cmap);
  m_autoscaling->blockSignals(true);
  m_autoscaling->setChecked(autoscaling);
  m_autoscaling->blockSignals(false);
}