LennardJonesCapped(real _epsilon, real _sigma, real _cutoff, real _caprad, real _shift) : epsilon(_epsilon), sigma(_sigma), caprad(_caprad) { setShift(_shift); setCutoff(_cutoff); preset(); }
/*------------------------------------------------------------------------ * dgcntl - control function for datagram pseudo-devices *------------------------------------------------------------------------ */ int dgcntl(struct devsw *pdev, int func, void *arg1, void *arg2) { STATWORD ps; struct dgblk *pdg; int ret; disable(ps); pdg = (struct dgblk *)pdev->dvioblk; ret = OK; switch (func) { case DG_SETMODE: /* set mode bits */ pdg->dg_mode = (int)arg1; break; case DG_CLEAR: /* clear queued packets */ preset(pdg->dg_xport, (void (*)())freebuf); break; default: ret = SYSERR; } restore(ps); return ret; }
VSpherePair(real _epsilon, real _cutoff) : epsilon(_epsilon) { autoShift = false; setCutoff(_cutoff); preset(); setAutoShift(); }
void ProfileList::createNewProfile() { db::Preset preset(_ctx->database); preset.data="{\"audio\" : {},\"video\" : {},\"format\" : {}}"; preset.uuid=(std::string)org::esb::util::PUUID(); openEditDialog(preset); }
LennardJonesCapped(real _epsilon, real _sigma, real _cutoff, real _caprad) : epsilon(_epsilon), sigma(_sigma), caprad(_caprad) { autoShift = false; setCutoff(_cutoff); preset(); setAutoShift(); }
void DrumMachine::SetPreset(const string& file_path) { //cout << __PRETTY_FUNCTION__ << endl; DrumMachinePreset preset(file_path); AudioMidiSeq* audio = static_cast<AudioMidiSeq*>(_audio); audio->SetPreset(&preset); _midiSeq->SetPreset(&preset); }
Game::SpecialPreset selectedPreset() const { // Get data from selected item auto sel_data = (SpecialPresetData*)GetItemData(GetSelection()); if (sel_data) return sel_data->preset(); return {}; }
void WPassGen::OnSpinNumber(wxSpinEvent& event) { pass_type passtype = (pass_type)choiceType->GetSelection(); bool skip_similar = checkboxSkipSimilarChar->GetValue(); bool skip_swapped = checkboxSkipSwappedChar->GetValue(); wxString extrachar = textctrlExtraChar->GetValue(); int passlen = spinctrlLength->GetValue(); bool enumerate = checkboxEnumerate->GetValue(); int passnumber = event.GetPosition(); Preset preset(_T(""), passtype, skip_similar, skip_swapped, extrachar, passlen); if (standalone) { // Fill wxTextCtrl with passwords wxString oldtext = textctrlPasslist->GetValue(); wxStringTokenizer oldtexttoken(oldtext, _T("\n")); wxString newtext; for (int i = 0; i < passnumber; i++) { if (oldtexttoken.HasMoreTokens()) { newtext += oldtexttoken.GetNextToken() + _T("\n"); } else { if (enumerate) newtext += wxString::Format(_T("%u "), i); newtext += MakePassword(preset) + _T("\n"); } } textctrlPasslist->SetValue(newtext); } else { // Fill wxListCtrl with passwords int oldcount = listctrlPasslist->GetItemCount(); for (int i = oldcount; i > passnumber; --i) { listctrlPasslist->DeleteItem(i - 1); } for (int i = oldcount; i < passnumber; i++) { listctrlPasslist->InsertItem(i, MakePassword(preset)); } } buttonOK->Disable(); }
PresetTransferFunctions3DPtr DataManagerImpl::getPresetTransferFunctions3D() const { ///< create from filename, create trivial document of type name and root node if no file exists. XmlOptionFile preset(DataLocations::findConfigFilePath("presets.xml", "/transferFunctions")); XmlOptionFile custom = profile()->getXmlSettings().descend("presetTransferFunctions"); if (!mPresetTransferFunctions3D) mPresetTransferFunctions3D.reset(new TransferFunctions3DPresets(preset, custom)); return mPresetTransferFunctions3D; }
QLCCapability *QLCCapability::createCopy() { QLCCapability *copy = new QLCCapability(m_min, m_max, m_name); copy->setPreset(preset()); for (int i = 0; i < m_resources.count(); i++) copy->setResource(i, m_resources.at(i)); foreach (AliasInfo alias, m_aliases) copy->addAlias(alias); return copy; }
void FilterHorizontalHeaderView::savePreset() { QVariantMap p=preset(); bool ok; QString presetName = QInputDialog::getText(this, tr("QInputDialog::getText()"), tr("Preset name:"), QLineEdit::Normal, QString(), &ok); if (ok) { addPreset(p,presetName); } emit presetSaved(p,presetName); }
void EncodeDock::loadPresets() { ui->presetsTree->clear(); QTreeWidgetItem* item = new QTreeWidgetItem(QStringList(tr("Custom"))); item->setFlags(Qt::ItemIsEnabled); ui->presetsTree->addTopLevelItem(item); item = new QTreeWidgetItem(QStringList(tr("Stock"))); item->setFlags(Qt::ItemIsEnabled); ui->presetsTree->addTopLevelItem(item); QString prefix("consumer/avformat/"); for (int i = 0; i < ui->presetsTree->topLevelItemCount(); i++) { QTreeWidgetItem* group = ui->presetsTree->topLevelItem(i); if (group->text(0) == tr("Stock")) { if (m_presets && m_presets->is_valid()) { for (int j = 0; j < m_presets->count(); j++) { QString name(m_presets->get_name(j)); if (name.startsWith(prefix)) { Mlt::Properties preset((mlt_properties) m_presets->get_data(name.toAscii().constData())); if (preset.get_int("meta.preset.hidden")) continue; if (preset.get("meta.preset.name")) name = QString::fromUtf8(preset.get("meta.preset.name")); else { // use relative path and filename name.remove(0, prefix.length()); QStringList textParts = name.split('/'); if (textParts.count() > 1) { // if the path is a profile name, then change it to "preset (profile)" QString profile = textParts.at(0); textParts.removeFirst(); if (m_profiles->get_data(profile.toAscii().constData())) name = QString("%1 (%2)").arg(textParts.join("/")).arg(profile); } } QTreeWidgetItem* item = new QTreeWidgetItem(group, QStringList(name)); item->setData(0, Qt::UserRole, QString(m_presets->get_name(j))); if (preset.get("meta.preset.note")) item->setToolTip(0, QString("<p>%1</p>").arg(QString::fromUtf8(preset.get("meta.preset.note")))); } } } } else if (group->text(0) == tr("Custom")) { QDir dir(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); if (dir.cd("presets") && dir.cd("encode")) { QStringList entries = dir.entryList(QDir::Files | QDir::NoDotAndDotDot | QDir::Readable); foreach (QString name, entries) { QTreeWidgetItem* item = new QTreeWidgetItem(group, QStringList(name)); item->setData(0, Qt::UserRole, name); } }
void WPassGen::UpdateKeyStrength() { pass_type passtype = (pass_type)choiceType->GetSelection(); bool skip_similar = checkboxSkipSimilarChar->GetValue(); bool skip_swapped = checkboxSkipSwappedChar->GetValue(); wxString extrachar = textctrlExtraChar->GetValue(); int passlen = spinctrlLength->GetValue(); Preset preset(_T(""), passtype, skip_similar, skip_swapped, extrachar, passlen); double keybits = GetTypeKeybits(preset); if (IsAllowedLength()) keybits *= passlen; wxString ss = wxString::Format(_("%.1f keybits"), keybits); textctrlStrength->SetValue(ss); }
void WPassGen::GenerateList() { pass_type passtype = (pass_type)choiceType->GetSelection(); bool skip_similar = checkboxSkipSimilarChar->GetValue(); bool skip_swapped = checkboxSkipSwappedChar->GetValue(); wxString extrachar = textctrlExtraChar->GetValue(); int passlen = spinctrlLength->GetValue(); bool enumerate = checkboxEnumerate->GetValue(); int passnumber = spinctrlNumber->GetValue(); Preset preset(_T(""), passtype, skip_similar, skip_swapped, extrachar, passlen); if (standalone) { // Fill wxTextCtrl with passwords wxString text; for (int i = 0; i < passnumber; i++) { if (enumerate) text += wxString::Format(_T("%u "), i); text += MakePassword(preset) + _T("\n"); } textctrlPasslist->SetValue(text); } else { // Fill wxListCtrl with passwords listctrlPasslist->DeleteAllItems(); for (int i = 0; i < passnumber; i++) { listctrlPasslist->InsertItem(i, MakePassword(preset)); } } buttonOK->Disable(); }
void FullColorBrushTool::addPreset(QString name) { //Build the preset BrushData preset(name.toStdWString()); preset.m_min = m_thickness.getValue().first; preset.m_max = m_thickness.getValue().second; preset.m_hardness = m_hardness.getValue(); preset.m_opacityMin = m_opacity.getValue().first; preset.m_opacityMax = m_opacity.getValue().second; preset.m_pressure = m_pressure.getValue(); //Pass the preset to the manager m_presetsManager.addPreset(preset); //Reinitialize the associated preset enum initPresets(); //Set the value to the specified one m_preset.setValue(preset.m_name); }
MirrorLennardJones(real _epsilon, real _sigma) : epsilon(_epsilon), sigma(_sigma) { setShift(-epsilon); setCutoff(2*pow(2.,1./6.)*sigma); preset(); }
void KrashConfig :: readConfig() { KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); m_signalnum = args->getOption( "signal" ).toInt(); m_pid = args->getOption( "pid" ).toInt(); m_startedByKdeinit = args->isSet("kdeinit"); m_safeMode = args->isSet("safer"); m_execname = args->getOption( "appname" ); if ( !args->getOption( "apppath" ).isEmpty() ) m_execname.prepend( args->getOption( "apppath" ) + '/' ); QCString programname = args->getOption("programname"); if (programname.isEmpty()) programname.setStr(I18N_NOOP("unknown")); // leak some memory... Well. It's only done once anyway :-) const char * progname = qstrdup(programname); m_aboutData = new KAboutData(args->getOption("appname"), progname, args->getOption("appversion"), 0, 0, 0, 0, 0, args->getOption("bugaddress")); QCString startup_id( args->getOption( "startupid" )); if (!startup_id.isEmpty()) { // stop startup notification KStartupInfoId id; id.initId( startup_id ); KStartupInfo::sendFinish( id ); } KConfig *config = KGlobal::config(); config->setGroup("drkonqi"); // maybe we should check if it's relative? QString configname = config->readEntry("ConfigName", QString::fromLatin1("enduser")); QString debuggername = config->readEntry("Debugger", QString::fromLatin1("gdb")); KConfig debuggers(QString::fromLatin1("debuggers/%1rc").arg(debuggername), true, false, "appdata"); debuggers.setGroup("General"); m_debugger = debuggers.readPathEntry("Exec"); m_debuggerBatch = debuggers.readPathEntry("ExecBatch"); m_tryExec = debuggers.readPathEntry("TryExec"); m_backtraceCommand = debuggers.readEntry("BacktraceCommand"); m_removeFromBacktraceRegExp = debuggers.readEntry("RemoveFromBacktraceRegExp"); m_invalidStackFrameRegExp = debuggers.readEntry("InvalidStackFrameRegExp"); m_frameRegExp = debuggers.readEntry("FrameRegExp"); m_neededInValidBacktraceRegExp = debuggers.readEntry("NeededInValidBacktraceRegExp"); m_kcrashRegExp = debuggers.readEntry("KCrashRegExp"); KConfig preset(QString::fromLatin1("presets/%1rc").arg(configname), true, false, "appdata"); preset.setGroup("ErrorDescription"); if (preset.readBoolEntry("Enable"), true) m_errorDescriptionText = preset.readEntry("Name"); preset.setGroup("WhatToDoHint"); if (preset.readBoolEntry("Enable")) m_whatToDoText = preset.readEntry("Name"); preset.setGroup("General"); m_showbugreport = preset.readBoolEntry("ShowBugReportButton", false); m_showdebugger = m_showbacktrace = m_pid != 0; if (m_showbacktrace) { m_showbacktrace = preset.readBoolEntry("ShowBacktraceButton", true); m_showdebugger = preset.readBoolEntry("ShowDebugButton", true); } m_disablechecks = preset.readBoolEntry("DisableChecks", false); bool b = preset.readBoolEntry("SignalDetails", true); QString str = QString::number(m_signalnum); // use group unknown if signal not found if (!preset.hasGroup(str)) str = QString::fromLatin1("unknown"); preset.setGroup(str); m_signalName = preset.readEntry("Name"); if (b) m_signalText = preset.readEntry("Comment"); }
void setSigma(real _sigma) { sigma = _sigma; setCutoff(2*pow(2.,1./6.)*sigma); preset(); }
// Setter and getter void setEpsilon(real _epsilon) { epsilon = _epsilon; setShift(-epsilon); preset(); }
void setK(real _K) { K = _K; preset(); }
void setTheta0(real _theta0) { theta0 = _theta0; preset();}
Cosine() : K(0.0), theta0(0.0) { preset(); }
Cosine(real _K, real _theta0) : K(_K), theta0(_theta0) { preset(); }
// Setter and getter void setEpsilon(real _epsilon) { epsilon = _epsilon; updateAutoShift(); preset(); }
void setSigma(real _sigma) { sigma = _sigma; updateAutoShift(); preset(); }
LennardJonesCapped() : epsilon(0.0), sigma(0.0) { setShift(0.0); setCutoff(infinity); preset(); }
VSpherePair(real _epsilon, real _cutoff, real _shift) : epsilon(_epsilon) { setShift(_shift); setCutoff(_cutoff); preset(); }
VSpherePair() : epsilon(0.0) { setShift(0.0); setCutoff(infinity); preset(); }
void setCaprad(real _caprad) { caprad = _caprad; updateAutoShift(); preset(); }
QList<KisUniformPaintOpPropertySP> KisBrushBasedPaintOpSettings::uniformProperties(KisPaintOpSettingsSP settings) { QList<KisUniformPaintOpPropertySP> props = listWeakToStrong(m_uniformProperties); if (props.isEmpty()) { { KisIntSliderBasedPaintOpPropertyCallback *prop = new KisIntSliderBasedPaintOpPropertyCallback( KisIntSliderBasedPaintOpPropertyCallback::Int, "angle", "Angle", settings, 0); prop->setRange(0, 360); prop->setReadCallback( [](KisUniformPaintOpProperty *prop) { KisBrushBasedPaintOpSettings *s = dynamic_cast<KisBrushBasedPaintOpSettings*>(prop->settings().data()); const qreal angleResult = kisRadiansToDegrees(s->angle()); prop->setValue(angleResult); }); prop->setWriteCallback( [](KisUniformPaintOpProperty *prop) { KisBrushBasedPaintOpSettings *s = dynamic_cast<KisBrushBasedPaintOpSettings*>(prop->settings().data()); s->setAngle(kisDegreesToRadians(prop->value().toReal())); }); QObject::connect(preset()->updateProxy(), SIGNAL(sigSettingsChanged()), prop, SLOT(requestReadValue())); prop->requestReadValue(); props << toQShared(prop); } { KisUniformPaintOpPropertyCallback *prop = new KisUniformPaintOpPropertyCallback( KisUniformPaintOpPropertyCallback::Bool, "auto_spacing", "Auto Spacing", settings, 0); prop->setReadCallback( [](KisUniformPaintOpProperty *prop) { KisBrushBasedPaintOpSettings *s = dynamic_cast<KisBrushBasedPaintOpSettings*>(prop->settings().data()); prop->setValue(s->autoSpacingActive()); }); prop->setWriteCallback( [](KisUniformPaintOpProperty *prop) { KisBrushBasedPaintOpSettings *s = dynamic_cast<KisBrushBasedPaintOpSettings*>(prop->settings().data()); s->setAutoSpacing(prop->value().toBool(), s->autoSpacingCoeff()); }); QObject::connect(preset()->updateProxy(), SIGNAL(sigSettingsChanged()), prop, SLOT(requestReadValue())); prop->requestReadValue(); props << toQShared(prop); } { KisDoubleSliderBasedPaintOpPropertyCallback *prop = new KisDoubleSliderBasedPaintOpPropertyCallback( KisDoubleSliderBasedPaintOpPropertyCallback::Double, "spacing", "Spacing", settings, 0); prop->setRange(0.01, 10); prop->setSingleStep(0.01); prop->setReadCallback( [](KisUniformPaintOpProperty *prop) { KisBrushBasedPaintOpSettings *s = dynamic_cast<KisBrushBasedPaintOpSettings*>(prop->settings().data()); const qreal value = s->autoSpacingActive() ? s->autoSpacingCoeff() : s->spacing(); prop->setValue(value); }); prop->setWriteCallback( [](KisUniformPaintOpProperty *prop) { KisBrushBasedPaintOpSettings *s = dynamic_cast<KisBrushBasedPaintOpSettings*>(prop->settings().data()); if (s->autoSpacingActive()) { s->setAutoSpacing(true, prop->value().toReal()); } else { s->setSpacing(prop->value().toReal()); } }); QObject::connect(preset()->updateProxy(), SIGNAL(sigSettingsChanged()), prop, SLOT(requestReadValue())); prop->requestReadValue(); props << toQShared(prop); } } return KisPaintOpSettings::uniformProperties(settings) + props; }