SampleTCOView::SampleTCOView( SampleTCO * _tco, trackView * _tv ) : trackContentObjectView( _tco, _tv ), m_tco( _tco ) { // update UI and tooltip updateSample(); // track future changes of SampleTCO connect( m_tco, SIGNAL( sampleChanged() ), this, SLOT( updateSample() ) ); setStyle( QApplication::style() ); }
void FrmMinorStrata::previewRow(QModelIndex index) { //updating the sample QModelIndex idx=viewMinorStrata->index(index.row(),0); if (!idx.isValid()){ emit showError (tr("Could not preview this record!")); return; } updateSample(idx); if (!abstractPreviewRow(index)){ qDebug() << tr("Record discarded!") << endl; //emit showError (tr("Could not preview this record!")); }else{ QModelIndex idx=viewMinorStrata->index(index.row(),0); if (!idx.isValid()){ emit showError (tr("Could not preview this stratum!")); return; } mapper1->toLast(); } }
/** * A service function. * It calculates the current scalar acceleration of the device (x^2 + y^2 + z^2). * It does not, however, square root the result, as this is a relatively high cost operation. * * This is left to application code should it be needed. * * @return the sum of the square of the acceleration of the device across all axes. */ int MicroBitAccelerometer::instantaneousAccelerationSquared() { updateSample(); // Use pythagoras theorem to determine the combined force acting on the device. return (int)sample.x*(int)sample.x + (int)sample.y*(int)sample.y + (int)sample.z*(int)sample.z; }
sampleTCOView::sampleTCOView( sampleTCO * _tco, trackView * _tv ) : trackContentObjectView( _tco, _tv ), m_tco( _tco ) { connect( m_tco, SIGNAL( sampleChanged() ), this, SLOT( updateSample() ) ); }
bool Xform::readSample(XformData& dst, Time t) { if (t != m_time_prev) { updateSample(t); } dst = m_sample; return true; }
void FrmOperation::previewRow(QModelIndex index) { emit blockCatchUISignals(true); QModelIndex idx=viewOperations->index(index.row(),0); if (!idx.isValid()){ emit showError (tr("Could not preview this operation!")); return; } updateSample(idx); if (!abstractPreviewRow(index)){ //emit showError (tr("Could not preview this record!")); qDebug() << tr("Record discarded!") << endl; }else{ int intId=idx.data().toInt();//for the MultiModelI //QString id=idx.data().toString(); mapper1->toLast(); //Now fix the dates idx=tOperations->index(0,2); if (!idx.isValid()){ emit showError (tr("Could not preview this operation!")); return; } QString strStartDt=idx.data().toString(); idx=tOperations->index(0,3); if (!idx.isValid()){ emit showError (tr("Could not preview this operation!")); return; } QString strEndDt=idx.data().toString(); m_tDateTime->setFilter(tr("ID=") + strStartDt + tr(" OR ID=") + strEndDt + " ORDER BY DATE_LOCAL ASC"); if (m_tDateTime->rowCount()!=2) return; //adjusting the display format of the dates on preview QModelIndex idxDType=m_tDateTime->index(0,3); if (!idxDType.isValid()) return; customDtStart->adjustDateTime(idxDType,idxDType.data()); idxDType=m_tDateTime->index(1,3); if (!idxDType.isValid()) return; customDtEnd->adjustDateTime(idxDType,idxDType.data()); mapperEndDt->toLast(); mapperStartDt->setCurrentIndex(mapperEndDt->currentIndex()-1); //preview record on the listView multiModelI->setParentId(intId); multiModelI->model2List("id_fishing_operation"); } emit blockCatchUISignals(false); }
void MetricFontDialog::styleChanged(const QModelIndex & current, const QModelIndex & /*previous */) { QFont f=m_fontDatabase.font(m_font.family(), m_fontDatabase.styles(m_font.family())[current.row()],10); m_font.setStyle(f.style()); m_font.setBold(f.bold()); m_font.setItalic(f.italic()); updateSample(); }
void MetricFontDialog::setWritingSystem(QFontDatabase::WritingSystem ws) { m_writingSystem=ws; m_fontFamiliesModel.setStringList(m_fontDatabase.families(ws)); if (m_fontDatabase.families(ws).size()) m_familiesSelectionModel->setCurrentIndex(m_fontFamiliesModel.index(0,0), QItemSelectionModel::SelectCurrent); updateSample(); }
void DrumEvent::setType( int aType ) { _type = aType; if ( !_locked ) updateSample(); else _updateAfterUnlock = true; }
void DrumEvent::unlock() { _locked = false; if ( _updateAfterUnlock ) updateSample(); _updateAfterUnlock = false; }
void DrumEvent::setTimbre( int aTimbre ) { _timbre = aTimbre; if ( !_locked ) updateSample(); else _updateAfterUnlock = true; }
void QFontDialog::sizeHighlighted( const QString &s ) { d->sizeEdit->setText( s ); if ( style().styleHint(QStyle::SH_FontDialog_SelectAssociatedText, this) && d->sizeEdit->hasFocus() ) d->sizeEdit->selectAll(); d->size = s.toInt(); updateSample(); }
void MetricFontDialog::sizeChanged(double value ) { QString val; val.setNum(value,'f',1); m_font.setPointSizeF(value); m_sizeSelectionModel->clearSelection(); if (-1!=m_sizeList.indexOf(val)) m_sizeSelectionModel->setCurrentIndex(m_fontSizeModel.index(m_sizeList.indexOf(val),0),QItemSelectionModel::SelectCurrent); updateSample(); }
//----------------------------------------------------------------------------- // Function: selectColor() //----------------------------------------------------------------------------- void CodeEditorSettingsPage::selectColor() { QColorDialog dialog(this); dialog.setCurrentColor(colorBox_->getColor()); if (dialog.exec() == QDialog::Accepted) { colorBox_->setColor(dialog.currentColor()); updateSample(); } }
void SymbolWidget::onSymbolChanged(const ISymbol *newSymbol) { Q_UNUSED(newSymbol); if (m_sample == nullptr) { return; } updateSample(); }
void MetricFontDialog::setFont(const QFont & font) { m_font = font; writingSystemsComboBox->setCurrentIndex(0); sizeDoubleSpinBox->setValue(m_font.pointSizeF()); sizeChanged(m_font.pointSizeF()); m_familiesSelectionModel->clearSelection(); if (-1!=m_fontFamiliesModel.stringList().indexOf(m_font.family())) m_familiesSelectionModel->setCurrentIndex(m_fontFamiliesModel.index(m_fontFamiliesModel.stringList().indexOf(m_font.family()),0), QItemSelectionModel::SelectCurrent); updateLists(); updateSample(); }
void CalibrateFlossDlg::on_ResetColor_clicked() { m_sampleColor = m_item->data(Qt::DecorationRole).value<QColor>(); if (m_calibratedColors[m_schemeName].contains(m_item->data(Qt::UserRole).toString())) { m_calibratedColors[m_schemeName].remove(m_item->data(Qt::UserRole).toString()); } updateSample(); updateName(false); m_item->setData(Qt::CheckStateRole, Qt::Unchecked); }
aiObject::aiObject(aiContext *ctx, abcObject &abc) : m_ctx(ctx) , m_abc(abc) { if (m_abc.valid()) { const auto& metadata = m_abc.getMetaData(); if (AbcGeom::IXformSchema::matches(metadata)) { m_xform.reset(new aiXForm(this)); m_schemas.push_back(&*m_xform); } if (AbcGeom::IPolyMeshSchema::matches(metadata)) { m_polymesh.reset(new aiPolyMesh(this)); m_schemas.push_back(&*m_polymesh); } if (AbcGeom::ICameraSchema::matches(metadata)) { m_camera.reset(new aiCamera(this)); m_schemas.push_back(&*m_camera); } //if (AbcGeom::ICurvesSchema::matches(metadata)) //{ // m_curves.reset(new aiCurves(this)); // m_schemas.push_back(&*m_curves); //} //if (AbcGeom::IPointsSchema::matches(metadata)) //{ // m_points.reset(new aiPoints(this)); // m_schemas.push_back(&*m_points); //} //if (AbcGeom::ILight::matches(metadata)) //{ // m_light.reset(new aiLight(this)); // m_schemas.push_back(&*m_light); //} // //if (AbcMaterial::IMaterial::matches(metadata)) //{ // m_material.reset(new aiMaterial(this)); // m_schemas.push_back(&*m_material); //} updateSample(0u); } }
/** * initializes an DrumEvent with very definitive properties to be pre-cached * for use in a sequencer context * * @param aPosition {int} the step position in the sequencer * @param aDrumType {int} the PercussionType to synthesize * @param aDrumTimbre {int} the drum machine's timbre * @param aInstrument {BaseInstrument*} the DrumInstrument the event corresponds to */ DrumEvent::DrumEvent( int aPosition, int aDrumType, int aDrumTimbre, BaseInstrument* aInstrument ) { init( aInstrument ); position = aPosition; _sampleStart = position * AudioEngine::bytes_per_tick; setType ( aDrumType ); setTimbre( aDrumTimbre ); updateSample(); }
/** * Reads the value of the Z axis from the latest update retrieved from the accelerometer. * * @return The force measured in the Z axis, in milli-g. * * @code * accelerometer.getZ(); * @endcode */ int MicroBitAccelerometer::getZ(MicroBitCoordinateSystem system) { updateSample(); switch (system) { case NORTH_EAST_DOWN: return -sample.z; case SIMPLE_CARTESIAN: case RAW: default: return sample.z; } }
bool FrmCell::reallyApply() { bool bError=false; if (!bError){ if (mapper1->submit()){ bError=! tSampCell->submitAll(); if (bError){ if (tSampCell->lastError().type()!=QSqlError::NoError) emit showError(tSampCell->lastError().text()); else emit showError(tr("Could not write cell in the database!")); }//mapper1->toLast(); }else bError=true; } //} buttonBox->button(QDialogButtonBox::Apply)->setEnabled(bError); emit lockControls(!bError,m_lWidgets); if (!bError){ buttonBox->button(QDialogButtonBox::Apply)->hide(); }else{ buttonBox->button(QDialogButtonBox::Apply)->show(); } if (!bError){ if (!afterApply()) bError=false; else{ toolButton->setEnabled(true); updateSample(); QToolTip::showText(toolButton->mapToGlobal(toolButton->pos()), tr("You have just initialized a cell!\n Now before starting to introduce information, ") + tr("take a moment to have a look at the frame.\n ") + tr("If you wish to do any temporary changes, *please do it NOW*! ") , toolButton); //lets disable next till we review the frame pushNext->setEnabled(false); pushPrevious->setEnabled(false); } } return !bError; }
void CalibrateFlossDlg::on_ColorList_currentItemChanged(QListWidgetItem *item) { if (m_item) { commitColor(); } m_item = item; if (item) { if (m_calibratedColors[m_schemeName].contains(m_item->data(Qt::UserRole).toString())) { m_sampleColor = m_calibratedColors[m_schemeName][m_item->data(Qt::UserRole).toString()]; } else { m_sampleColor = m_item->data(Qt::DecorationRole).value<QColor>(); } updateSample(); updateName(m_calibratedColors[m_schemeName].contains(m_item->data(Qt::UserRole).toString())); } }
void QFontDialog::sizeChanged( const QString &s ) { // no need to check if the conversion is valid, since we have an QIntValidator in the size edit int size = s.toInt(); if ( d->size == size ) return; d->size = size; if ( d->sizeList->count() != 0 ) { int i; for ( i = 0 ; i < (int)d->sizeList->count() - 1 ; i++ ) { if ( d->sizeList->text(i).toInt() >= d->size ) break; } d->sizeList->blockSignals( TRUE ); d->sizeList->setCurrentItem( i ); d->sizeList->blockSignals( FALSE ); } updateSample(); }
//----------------------------------------------------------------------------- // Function: onSelectStyle() //----------------------------------------------------------------------------- void CodeEditorSettingsPage::onSelectStyle(QListWidgetItem* cur, QListWidgetItem* prev) { int prevRow = highlightTypeList_->row(prev); int curRow = highlightTypeList_->row(cur); if (prevRow >= 0) { // Save the previous style. styles_[prevRow].bold = boldCheckBox_->isChecked(); styles_[prevRow].italic = italicCheckBox_->isChecked(); styles_[prevRow].color = colorBox_->getColor(); } // Import the settings from the new style. colorBox_->setColor(styles_[curRow].color); boldCheckBox_->setChecked(styles_[curRow].bold); italicCheckBox_->setChecked(styles_[curRow].italic); updateSample(); }
void FrmCatch::previewRow(QModelIndex index) { emit blockCatchUISignals(true); QModelIndex idx=viewCatch->index(index.row(),0); if (!idx.isValid()) { emit showError (tr("Could not preview this catch!")); return; } updateSample(idx); if (!abstractPreviewRow(index)) { //emit showError (tr("Could not preview this record!")); qDebug() << tr("Record discarded!") << endl; } else { mapper1->toLast(); } emit blockCatchUISignals(false); }
void QFontDialog::updateSizes() { d->sizeList->blockSignals( TRUE ); d->sizeList->clear(); if ( !d->familyList->currentText().isEmpty() ) { QValueList<int> sizes = d->fdb.pointSizes( d->familyList->currentText(), d->styleList->currentText() ); int i = 0; bool found = FALSE; for( QValueList<int>::iterator it = sizes.begin() ; it != sizes.end(); ++it ) { d->sizeList->insertItem( QString::number( *it ) ); if ( !found && *it >= d->size ) { d->sizeList->setCurrentItem( i ); found = TRUE; } ++i; } if ( !found ) { // we request a size bigger than the ones in the list, select the biggest one d->sizeList->setCurrentItem( d->sizeList->count() - 1 ); } d->sizeEdit->blockSignals( TRUE ); d->sizeEdit->setText( ( d->smoothScalable ? QString::number( d->size ) : d->sizeList->currentText() ) ); if ( style().styleHint(QStyle::SH_FontDialog_SelectAssociatedText, this) && d->sizeList->hasFocus() ) d->sizeEdit->selectAll(); d->sizeEdit->blockSignals( FALSE ); } else { d->sizeEdit->clear(); } d->sizeList->blockSignals( FALSE ); updateSample(); }
void FrmCell::previewRow(QModelIndex index) { QModelIndex idx=viewCell->index(index.row(),0); if (!idx.isValid()){ emit showError (tr("Could not preview this cell!")); return; } updateSample(idx); if (!abstractPreviewRow(index)){ //emit showError (tr("Could not preview this record!")); qDebug() << tr("Record discarded!") << endl; }else{ mapper1->toLast(); //Now fix the dates idx=tSampCell->index(0,1); if (!idx.isValid()){ emit showError (tr("Could not preview this cell!")); return; } idx=tSampCell->index(0,2); if (!idx.isValid()){ emit showError (tr("Could not preview this cell!")); return; } idx=tSampCell->index(0,3); if (!idx.isValid()){ emit showError (tr("Could not preview this cell!")); return; } // pushNext->setEnabled(true); } }
void MetricFontDialog::fontWritingSystemChanged(int) { updateSample(); }
void MetricFontDialog::underlineChanged(bool checked ) { m_font.setUnderline(checked); updateSample(); }
void MetricFontDialog::strikeoutChanged(bool checked ) { m_font.setStrikeOut(checked); updateSample(); }