Clock::Clock(std::string input) { std::stringstream temp; int count = 0, tempInt; switch (input.length()) { case 8: temp.str(input.substr(0,2)); temp >> tempInt; setHour(tempInt); temp.clear(); temp.str(input.substr(3,2)); temp >> tempInt; setMin(tempInt); temp.clear(); temp.str(input.substr(6,2)); temp >> tempInt; setSec(tempInt); temp.clear(); break; case 5: temp.str(input.substr(0,2)); temp >> tempInt; setHour(tempInt); temp.clear(); temp.str(input.substr(3,2)); temp >> tempInt; setMin(tempInt); temp.clear(); break; } }
void PowerLawWidgetManager::updateConnections() { if (m_Widgets.size() == 0) { return; } auto first = *(m_Widgets.cbegin()); auto last = *(m_Widgets.cend() - 1); if (m_Widgets.size() == 1) { first->lockMin(true); first->lockMax(true); } else if (m_Widgets.size() == 2) { first->lockMin(true); last->lockMax(true); first->setMax(0); last->setMin(0); first->connect(last); } else { auto previousLast = *(m_Widgets.cend() - 2); auto min = previousLast->getMin(); previousLast->setMax(min + 1); last->setMin(min + 1); last->lockMax(true); previousLast->connect(last); } }
void GenericSliderProperties::OnButton(wxCommandEvent& event) { int id = event.GetId(); wxObject *obj = event.GetEventObject(); if(isDecimal)incr = 0.01; else incr = 1; if(id == ID_INCRUP) { if(obj == min_up)setMin(min+incr); if(obj == max_up)setMax(max+incr); if(obj == tick_up)setTick(tick+1); } if(id == ID_INCRDOWN) { if(obj == min_down)setMin(min-incr); if(obj == max_down)setMax(max-incr); if(obj == tick_down)setTick(tick-1); } if(id == ID_ACCEPT2) { winSlider->setCurrentMinMax(min,max); winSlider->setTicks(tick); winSlider->Refresh(false); Close(true); } if(id == ID_CANCEL2) { winSlider->setCurrentMinMax(minOld,maxOld); winSlider->setTicks(tickOld); winSlider->getValueText()->SetBackgroundColour(colorPanelOld); winSlider->Refresh(false); Close(true); } if(id == ID_APPLY) { winSlider->setCurrentMinMax(min,max); winSlider->setTicks(tick); winSlider->Refresh(false); } if(id == ID_COLOR2) { wxColourDialog dial(this); dial.SetTitle(wxT("Color Picker")); if(dial.ShowModal()!= wxID_OK)return; colorPanel = dial.GetColourData().GetColour(); winSlider->getValueText()->SetBackgroundColour(colorPanel); winSlider->Refresh(false); } event.Skip(); }
void PowerLawWidgetManager::loadFromXml(TiXmlElement *_root) { std::vector < PowerLawWidget * > widgets; double valFactor, valExponent, valOffset, valMin, valMax; for (auto child = _root->FirstChildElement("PowerLawParameters"); child; child = child->NextSiblingElement()) { auto r0 = child->QueryDoubleAttribute("factor", &valFactor); auto r1 = child->QueryDoubleAttribute("exponent", &valExponent); auto r2 = child->QueryDoubleAttribute("offset", &valOffset); auto r3 = child->QueryDoubleAttribute("rangeMin", &valMin); auto r4 = child->QueryDoubleAttribute("rangeMax", &valMax); if (r0 == TIXML_SUCCESS && r1 == TIXML_SUCCESS && r2 == TIXML_SUCCESS && r3 == TIXML_SUCCESS && r4 == TIXML_SUCCESS) { auto w = new PowerLawWidget(); w->setFactor(valFactor); w->setExponent(valExponent); w->setOffset(valOffset); w->setMin(valMin); w->setMax(valMax); widgets.push_back(w); } else { QMessageBox::warning(0, "failed to load power laws", "could not load power laws: invalid file structure."); return; } } setPowerLawWidgets(widgets); }
//------------------------------------------------------------ //------------------------------------------------------------ bool Uniform::setSlotMin(const Number* const x) { bool ok = false; if(x != 0) ok = setMin(x->getDouble()); return ok; }
LoadingBar::LoadingBar(int min, int max, bool autoshow) : QDialog(NULL) { SetupUI(autoshow); setMax(max); setMin(min); SetupConnections(); }
/** Constructor, derived from coRowToolboxItem. @param name Label text. @param min,max Minimum and maximum slider values. @param init Initial slider value. @see coRowToolboxItem */ coSliderToolboxItem::coSliderToolboxItem(const std::string &name, float min, float max, float init) : coToolboxMenuItem(name) { slider = new coSlider(this); minLabel = new coLabel(); maxLabel = new coLabel(); label = new coLabel(); setLabel(name); // Constrain initialization values: if (max < min) max = min; init = coClamp(init, min, max); setMin(min); setMax(max); setValue(init); menuContainer->setOrientation(coRowContainer::HORIZONTAL); menuContainer->addElement(minLabel); menuContainer->addElement(slider); menuContainer->addElement(maxLabel); menuContainer->addElement(label); // menuContainer->addElement(label); vruiIntersection::getIntersectorForAction("coAction")->add(background->getDCS(), this); }
void k9PlayMPEG2::open (dvd_reader_t *dvd,const QString & device,k9DVDTitle * title,int chapter=0) { m_dvd=dvd; m_chapter=chapter; int ret = 0; struct stat dvd_stat; QString c; m_idxLect=0xFFFFFFFF; stop(); m_title=title; m_device=device; m_startSector=0; m_lastSector=0; ret = stat(device.utf8(), &dvd_stat); /* if ( ret < 0 ) { c=i18n("Can't find device %1\n").arg(device.latin1()); setError(c); return; } */ m_title=title; m_startSector=m_title->getChapter( 0)->getstartSector(); m_lastSector= m_startSector + m_title->getsectors(); //m_title->getChapter(m_title->getchapterCount()-1)->getendSector(); emit setPosition( m_startSector); emit setMax( m_lastSector); emit setMin( m_startSector); m_decoder.start(QThread::LowPriority); start(); }
IntPoint TextView::getCursorPoint(size_t _position) { setMin(_position, mLength); size_t position = 0; int top = 0; float left = 0.0f; for (VectorLineInfo::const_iterator line = mLineInfo.begin(); line != mLineInfo.end(); ++line) { left = (float)line->offset; if (position + line->count >= _position) { for (VectorCharInfo::const_iterator sim = line->simbols.begin(); sim != line->simbols.end(); ++sim) { if (sim->isColour()) continue; if (position == _position) break; position ++; left += sim->getBearingX() + sim->getAdvance(); } break; } position += line->count + 1; top += mFontHeight; } return IntPoint((int)left, top); }
MyGUI::IntPoint TextView::getCursorPoint(size_t _position) { setMin(_position, mTextData.length); size_t position = 0; int top = 0; float left = 0.0f; for (TextData::LinesData::const_iterator line = mTextData.data.begin(); line != mTextData.data.end(); ++line) { left = (float)line->offset.x; if (position + line->count >= _position) { for (TextData::SymbolsData::const_iterator sim = line->data.begin(); sim != line->data.end(); ++sim) { if (sim->type != TextData::SYMBOL_TEXT) continue; if (position == _position) break; position ++; left += sim->data.symbol.offset; } top = line->offset.y; break; } position += line->count + 1; } return MyGUI::IntPoint((int)left, top); }
CHYSTBlock::CHYSTBlock(const char* configString) : CBlock(configString) { CString tempString; float setpoint=0.0, delta=0.0, Min=0.0, Max=0.0; //Get HYST type and parameters m_LibIniReader.GetConfigParamString( configString, "TYPE", &tempString, "HYST"); for (int i = 0; i < HYST_TYPE_NUM_TOT; i++) { if (tempString == HYST_Type_Strings[i]) { m_HYSTType = (e_HYSTType)i; m_LibIniReader.GetConfigParamFloat( configString, "SETPOINT", &setpoint, 0.0); m_LibIniReader.GetConfigParamFloat( configString, "DELTA", &delta, 0.0); m_LibIniReader.GetConfigParamFloat( configString, "MIN", &Min, 0.0); m_LibIniReader.GetConfigParamFloat( configString, "MAX", &Max, 0.0); setSetpoint(&setpoint); setDelta(&delta); setLastOutput(&Min); setMin(&Min); setMax(&Max); } } }
void AABB::moveTo(Vector3 newPosition) { Vector3 change = newPosition - this->origin; setMax(this->origin + change); setMin(this->origin - change); this->origin = newPosition; }
PowerLawWidgetManager::PowerLawWidgetManager(QWidget *_parent) : m_Parent(_parent) { // defaults from paper addPowerLaw(); auto w1 = addPowerLaw(); w1->setMin(0); w1->setFactor(6850); w1->setExponent(1.49); }
LH_NowPlayingBar::LH_NowPlayingBar() { connect( this->plugin(), SIGNAL(updated_data()), this, SLOT(refresh_pos()) ); setMin(0); setValue(0,1); return; }
void MixerCurve::initLinearCurve(int numPoints, double maxValue, double minValue) { setMin(minValue); setMax(maxValue); m_curve->initLinearCurve(numPoints, maxValue, minValue); if (m_spinDelegate) m_spinDelegate->setRange(minValue, maxValue); }
bool coSliderToolboxItem::updateContentRange(float min, float max, float value, bool isInteger, float) { setMax(max); setMin(min); setValue(value); setInteger(isInteger); if (listener) listener->menuEvent(this); return true; }
void ossimLocalTm::setFractionalDay(double fractionalDay) { int h, m, s; double fractionalSecond; extractHmsFromFractionalDay(fractionalDay, h, m, s, fractionalSecond); setHour(h); setMin(m); setSec(s); setFractionalSecond(fractionalSecond); }
int ValueWidget::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) { if (_id < 2) qt_static_metacall(this, _c, _id, _a); _id -= 2; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 2) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< float*>(_v) = value(); break; case 1: *reinterpret_cast< float*>(_v) = min(); break; case 2: *reinterpret_cast< float*>(_v) = max(); break; case 3: *reinterpret_cast< int*>(_v) = nbStep(); break; } _id -= 4; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setValue(*reinterpret_cast< float*>(_v)); break; case 1: setMin(*reinterpret_cast< float*>(_v)); break; case 2: setMax(*reinterpret_cast< float*>(_v)); break; case 3: setNbStep(*reinterpret_cast< int*>(_v)); break; } _id -= 4; } else if (_c == QMetaObject::ResetProperty) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 4; } else if (_c == QMetaObject::RegisterPropertyMetaType) { if (_id < 4) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 4; } #endif // QT_NO_PROPERTIES return _id; }
Rpm::Rpm( ) { // set(0.0); // set(100.0); setMax(16000.0); setMin(0.0); /* connect(this, SIGNAL( changed(double) ), this, SLOT( on_changed() ) ); */ }
bool QLCCapability::loadXML(const QDomElement* root) { uchar min; uchar max; QString str; Q_ASSERT(root != NULL); if (root->tagName() != KXMLQLCCapability) { qWarning() << Q_FUNC_INFO << "Capability node not found"; return false; } /* Get low limit attribute (critical) */ str = root->attribute(KXMLQLCCapabilityMin); if (str.isEmpty() == true) { qWarning() << Q_FUNC_INFO << "Capability has no minimum limit."; return false; } else { min = CLAMP(str.toInt(), 0, UCHAR_MAX); } /* Get high limit attribute (critical) */ str = root->attribute(KXMLQLCCapabilityMax); if (str.isEmpty() == true) { qWarning() << Q_FUNC_INFO << "Capability has no maximum limit."; return false; } else { max = CLAMP(str.toInt(), 0, UCHAR_MAX); } if (min <= max) { setName(root->text()); setMin(min); setMax(max); return true; } else { qWarning() << Q_FUNC_INFO << "Capability min(" << min << ") is greater than max(" << max << ")"; return false; } }
//! Reads attributes of the element void CGUIScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { IGUIScrollBar::deserializeAttributes(in,options); Horizontal = in->getAttributeAsBool("Horizontal"); setMin(in->getAttributeAsInt("Min")); setMax(in->getAttributeAsInt("Max")); setPos(in->getAttributeAsInt("Value")); setSmallStep(in->getAttributeAsInt("SmallStep")); setLargeStep(in->getAttributeAsInt("LargeStep")); refreshControls(); }
void LeapMotionPlugin::init() { loadSettings(); auto preferences = DependencyManager::get<Preferences>(); static const QString LEAPMOTION_PLUGIN { "Leap Motion" }; { auto getter = [this]()->bool { return _enabled; }; auto setter = [this](bool value) { _enabled = value; saveSettings(); if (!_enabled) { auto userInputMapper = DependencyManager::get<controller::UserInputMapper>(); userInputMapper->withLock([&, this]() { _inputDevice->clearState(); }); } }; auto preference = new CheckPreference(LEAPMOTION_PLUGIN, "Enabled", getter, setter); preferences->addPreference(preference); } { auto getter = [this]()->QString { return _sensorLocation; }; auto setter = [this](QString value) { _sensorLocation = value; saveSettings(); applySensorLocation(); }; auto preference = new ComboBoxPreference(LEAPMOTION_PLUGIN, "Sensor location", getter, setter); QStringList list = { SENSOR_ON_DESKTOP, SENSOR_ON_HMD }; preference->setItems(list); preferences->addPreference(preference); } { auto getter = [this]()->float { return _desktopHeightOffset; }; auto setter = [this](float value) { _desktopHeightOffset = value; saveSettings(); applyDesktopHeightOffset(); }; auto preference = new SpinnerPreference(LEAPMOTION_PLUGIN, "Desktop height for horizontal forearms", getter, setter); float MIN_VALUE = 0.0f; float MAX_VALUE = 1.0f; float DECIMALS = 2.0f; float STEP = 0.01f; preference->setMin(MIN_VALUE); preference->setMax(MAX_VALUE); preference->setDecimals(DECIMALS); preference->setStep(STEP); preferences->addPreference(preference); } }
//! Reads attributes of the element void CGUIScrollBar::deserializeAttributes(IAttributes* in, SAttributeReadWriteOptions* options = 0) { IGUIScrollBar::deserializeAttributes(in, options); Horizontal = in->getAttributeAsBool("Horizontal"); setMin(in->getAttributeAsInt("Min")); setMax(in->getAttributeAsInt("Max")); setPos(in->getAttributeAsInt("Value")); setSmallStep(in->getAttributeAsInt("SmallStep")); setLargeStep(in->getAttributeAsInt("LargeStep")); // CurrentIconColor - not serialized as continuiously updated refreshControls(); }
bool ossimLocalTm::loadXml(ossimRefPtr<ossimXmlNode> dateNode) { bool result = true; ossimRefPtr<ossimXmlNode> month = dateNode->findFirstNode("month"); ossimRefPtr<ossimXmlNode> day = dateNode->findFirstNode("day"); ossimRefPtr<ossimXmlNode> year = dateNode->findFirstNode("year"); ossimRefPtr<ossimXmlNode> hour = dateNode->findFirstNode("hour"); ossimRefPtr<ossimXmlNode> minutes = dateNode->findFirstNode("minutes"); ossimRefPtr<ossimXmlNode> seconds = dateNode->findFirstNode("seconds"); ossimRefPtr<ossimXmlNode> fractionalSecond = dateNode->findFirstNode("fractionalSecond"); ossimRefPtr<ossimXmlNode> julian = dateNode->findFirstNode("julian"); ossimRefPtr<ossimXmlNode> modifiedJulian = dateNode->findFirstNode("modifiedJulian"); if(month.valid()&& day.valid()&& year.valid()&& hour.valid()&& minutes.valid()&& seconds.valid()) { setMonth(month->getText().toInt32()); setDay(day->getText().toInt32()); setYear(year->getText().toInt32()); setHour(hour->getText().toInt32()); setMin(minutes->getText().toInt32()); setSec(seconds->getText().toInt32()); if(fractionalSecond.valid()) { setFractionalSecond(fractionalSecond->getText().toDouble()); } else { setFractionalSecond(0.0); } } else if(modifiedJulian.valid()) { setDateFromModifiedJulian(modifiedJulian->getText().toDouble()); } else if(julian.valid()) { setDateFromJulian(julian->getText().toDouble()); } else { result = false; } return result; }
ossimDate::ossimDate(int month, int day, int year, int dtfmt) :ossimLocalTm (0), _fmt(dtfmt) { setMonth(month); setDay(day); setYear(year); setHour(0); setMin(0); setSec(0); setFractionalSecond(0.0); }
bool SdlJoystick::config(jccl::ConfigElementPtr e) { if (!gadget::Digital::config(e)) return false; if (!gadget::Analog::config(e)) return false; if (!gadget::Input::config(e)) return false; //if (!gadget::Rumble::config(e)) return false; mDeviceNumber = e->getProperty<int>("device"); setMin(-32767.0f); setMax(32767.0f); return true; }
void Observable::setLikelihoodFromHisto(std::string filename, std::string histoname) { this->filename = filename; this->histoname = histoname; TFile *lik = new TFile((filename + ".root").c_str(), "read"); TH1D *htmp = (TH1D*) (lik->Get(histoname.c_str())); if (htmp == NULL) throw std::runtime_error("ERROR: nonexistent histogram called " + histoname + " in " + filename + ".root"); inhisto = (TH1D *) htmp->Clone((filename + "/" + histoname).c_str()); inhisto->SetDirectory(gROOT); setMin(inhisto->GetXaxis()->GetXmin()); setMax(inhisto->GetXaxis()->GetXmax()); lik->Close(); delete lik; }
static Optional<IntConstraint> createIntConstraint(const Dictionary& mediaTrackConstraintSet, const String& name, MediaConstraintType type, ConstraintSetType constraintSetType) { auto constraint = IntConstraint(name, type); // Dictionary constraint value. Dictionary dictionaryValue; if (mediaTrackConstraintSet.get(name, dictionaryValue) && !dictionaryValue.isUndefinedOrNull()) { int minValue; if (dictionaryValue.get("min", minValue)) constraint.setMin(minValue); int maxValue; if (dictionaryValue.get("max", maxValue)) constraint.setMax(maxValue); int exactValue; if (dictionaryValue.get("exact", exactValue)) constraint.setExact(exactValue); int idealValue; if (dictionaryValue.get("ideal", idealValue)) constraint.setIdeal(idealValue); if (constraint.isEmpty()) { LOG(Media, "createIntConstraint() - ignoring long constraint '%s' with dictionary value since it has no valid or supported key/value pairs.", name.utf8().data()); return Nullopt; } return WTFMove(constraint); } // Scalar constraint value. int value; if (mediaTrackConstraintSet.get(name, value)) { if (constraintSetType == ConstraintSetType::Mandatory) constraint.setIdeal(value); else constraint.setExact(value); return WTFMove(constraint); } // Invalid constraint value. LOG(Media, "createIntConstraint() - ignoring long constraint '%s' since it has neither a dictionary nor scalar value.", name.utf8().data()); return Nullopt; }
LH_GraphNetOut() : net_(this) { QStringList valuesList; valuesList.append("kb/s (kilobits per second)"); valuesList.append("Mb/s (megabits per second)"); valuesList.append("kB/s (kilobytes per second)"); valuesList.append("MB/s (megabytes per second)"); setup_units_ = new LH_Qt_QStringList(this,"Units",valuesList,LH_FLAG_AUTORENDER); valCount = 0; valCache = 0; lastVal = 0; setMin(0.0); setMax(1000); setYUnit("kb/s"); net_.smoothingHidden(true); }
bool OCDial::setAttr(const QString& name, const QVariant& value) { if (name == "min") { bool ok; double v = value.toDouble(&ok); if (ok) setMin(v); return ok; } if (name == "max") { bool ok; double v = value.toDouble(&ok); if (ok) setMax(v); return ok; } return OCDataWidget::setAttr(name, value); }