void ModelWindow::setData(bool adjustPlot) { settings.ride = ride; settings.x = xSelector->itemData(xSelector->currentIndex()).toInt(); settings.y = ySelector->itemData(ySelector->currentIndex()).toInt(); settings.z = zSelector->itemData(zSelector->currentIndex()).toInt(); settings.color = colorSelector->itemData(colorSelector->currentIndex()).toInt(); settings.xbin = binWidthSlider->value(); // XXX fixed to single bin width settings.ybin = binWidthSlider->value(); // XXX due to issues with bar geometry settings.crop = false; // XXX not implemented settings.zpane = 0; settings.ignore = ignore->isChecked(); settings.gridlines = grid->isChecked(); settings.frame = frame->isChecked(); settings.legend = legend->isChecked(); settings.adjustPlot = adjustPlot; zpane->setValue(0); // reset it! // any intervals to plot? settings.intervals.clear(); for (int i=0; i<main->allIntervalItems()->childCount(); i++) { IntervalItem *current = dynamic_cast<IntervalItem *>(main->allIntervalItems()->child(i)); if (current != NULL && current->isSelected() == true) settings.intervals.append(current); } modelPlot->setData(&settings); setClean(); }
KstSettingsDlgI::KstSettingsDlgI(QWidget* parent, const char *name, WFlags fl) : KstSettingsDlg(parent, name, fl) { fillAxesSettings(); updateCurveColorSettings(); setSettings(KstSettings::globalSettings()); setClean(); updateAxesButtons(); updateAxesSettings(); updateEMailSettings(); _source->insertStringList(KstDataSource::pluginList()); if (_source->count() > 0) { sourceChanged(_source->text(0)); } else { _configureSource->setEnabled(false); } QString hours = i18n(" hours"); QLineEdit* edit = dynamic_cast<QLineEdit*>(_valueOffset->child("qt_spinbox_edit")); if (edit) { edit->setMaxLength(5 + hours.length()); } _valueOffset->setRange(-24.0, 24.0, 0.50, false); _valueOffset->setSuffix(i18n(" hours")); _colorPalette->_label->setText(i18n("Curve color sequence: ")); connect(_spinBoxLineWidth, SIGNAL(valueChanged(int)), this, SLOT(setDirty())); connect(_spinBoxLineWidth->child("qt_spinbox_edit"), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); connect(_valueOffset->child("qt_spinbox_edit"), SIGNAL(textChanged(const QString&)), this, SLOT(updateTimezone(const QString&))); connect(_timer->child("qt_spinbox_edit"), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); connect(_kIntSpinBoxEMailPort->child("qt_spinbox_edit"), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); connect(_colorPalette->_palette, SIGNAL(activated(int)), this, SLOT(setDirty())); connect(_fontSize->child("qt_spinbox_edit"), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); connect(_fontMinSize->child("qt_spinbox_edit"), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); }
void PropertyStorage::dirtyAllClassProperties(class_id_type classID) { const std::set<LocationProperty>& dirty(mClassPropertyLocations.getValues(classID)); for (std::set<LocationProperty>::const_iterator it = dirty.begin();it != dirty.end(); ++it) if (it->attributeType() != attrMutable) setClean(*it, false); }
template<class Transformation> void Object<Transformation>::doSetClean(const std::vector<std::reference_wrapper<AbstractObject<Transformation::Dimensions, typename Transformation::Type>>>& objects) { std::vector<std::reference_wrapper<Object<Transformation>>> castObjects; castObjects.reserve(objects.size()); /** @todo Ensure this doesn't crash, somehow */ for(auto o: objects) castObjects.push_back(static_cast<Object<Transformation>&>(o.get())); setClean(std::move(castObjects)); }
template<UnsignedInt dimensions> AbstractShape<dimensions>* ShapeGroup<dimensions>::firstCollision(const AbstractShape<dimensions>& shape) { setClean(); for(std::size_t i = 0; i != this->size(); ++i) if(&(*this)[i] != &shape && (*this)[i].collides(shape)) return &(*this)[i]; return nullptr; }
template<class Transformation> void Object<Transformation>::doSetClean(const std::vector<AbstractObject<Transformation::Dimensions, typename Transformation::Type>*>& objects) { std::vector<Object<Transformation>*> castObjects(objects.size()); for(std::size_t i = 0; i != objects.size(); ++i) /** @todo Ensure this doesn't crash, somehow */ castObjects[i] = static_cast<Object<Transformation>*>(objects[i]); setClean(std::move(castObjects)); }
/** \brief Sets all component matrices and the result matrix to identity */ void Dcs::reset() { _rotMatrix.setIdentity(); _transMatrix.setIdentity(); _scaleMatrix.setIdentity(); _resultMatrix.setIdentity(); setClean(); }
/** \brief Calculates the result matrix. Calculation is done like this: _transMatrix*(_scaleMatrix*_rotMatrix) \remarks You have to call validate() only if you need the validated result matrix. All getters like getRotate(), getTranslate(), or getTranslateVector() will return the current values you just set. To save some performance (validate() performs two matrix multiplications) call validate() only if you need to. <br>If you call validate() but nothing was changed since last validation, the Dcs will not perform the redundant calculation due to the _dirty flag. */ void Dcs::validate() { if (_dirty) { _resultMatrix = _transMatrix*(_rotMatrix*_scaleMatrix); setClean(); } }
bool ProgramTab::loadProgramFile(const QString & fileName, const QString & altFileName, bool updateLink) { DebugDialog::debug("program tab load program file"); if (m_programWindow->alreadyHasProgram(fileName)) { return false; } DebugDialog::debug("checking file"); QFile file(fileName); if (!file.open(QFile::ReadOnly)) { m_programWindow->updateLink(fileName, m_language, m_programmerPath, false, true); if (!altFileName.isEmpty()) { file.setFileName(altFileName); if (!file.open(QFile::ReadOnly)) { QFileInfo fileInfo(fileName); QString fn = FolderUtils::getOpenFileName( NULL, tr("Fritzing is unable to find '%1', please locate it").arg(fileInfo.fileName()), FolderUtils::openSaveFolder(), tr("Code (*.%1)").arg(fileInfo.suffix()) ); if (fn.isEmpty()) return false; file.setFileName(fn); if (!file.open(QFile::ReadOnly)) { return false; } } } } DebugDialog::debug("about to read"); m_filename = file.fileName(); QString text = file.readAll(); // clean out 0x91, mostly due to picaxe files for (int i = 0; i < text.count(); i++) { if (text[i] == Quote91Char) { text[i] = '\''; } } DebugDialog::debug("about to set text"); m_textEdit->setText(text); setClean(); QFileInfo fileInfo(m_filename); m_tabWidget->setTabText(m_tabWidget->currentIndex(), fileInfo.fileName()); m_tabWidget->setTabToolTip(m_tabWidget->currentIndex(), m_filename); DebugDialog::debug("about to update link"); if (updateLink) { m_programWindow->updateLink(m_filename, m_language, m_programmerPath, true, true); } return true; }
void Quaternion::reset() { _last_valid_mat.setIdentity(); _quaternion = Vector3(); _angle = 0.0f; _axis = Vector3(); setClean(); }
bool BaseFile::saveAs(const std::string & name) { std::string s = name; if(s == "") { s = chooseSaveFileName(); if(s == "") return false; } beforeSave(); if(!doWrite(s)) return false; setFileName(s); setClean(); return true; }
bool BaseFile::save() { if(!shouldSave()) return false; if(isUntitled()) { std::string s = chooseSaveFileName(); if(s == "") return false; return saveAs(s); } beforeSave(); if(!doWrite(fileName())) return false; setClean(); return true; }
void Project::connectComponents() { connect( m_library, SIGNAL( cleanStateChanged( bool ) ), this, SLOT( libraryCleanChanged( bool ) ) ); connect( m_undoStack, SIGNAL( cleanChanged( bool ) ), this, SLOT( cleanChanged( bool ) ) ); connect( this, SIGNAL( projectSaved() ), m_undoStack, SLOT( setClean() ) ); //We have to wait for the library to be loaded before loading the workflow //FIXME //connect( Project::getInstance()->library(), SIGNAL( projectLoaded() ), this, SLOT( loadWorkflow() ) ); registerLoadSave( m_settings ); registerLoadSave( m_library ); registerLoadSave( m_workflow ); registerLoadSave( m_workflowRenderer ); }
LibUI::EditWidget::EditWidget(LibModel::Document* doc, QWidget* parent) : QWidget(parent) { d = new EditWidgetPrivate; // Load a monospaced font QFont editFont("Monospace", font().pointSize()); editFont.setStyleHint(QFont::TypeWriter); setFont(editFont); setFocusPolicy(Qt::StrongFocus); d->doc = doc; fsConnect(d->doc, SIGNAL(textChanged()), this, SLOT(update())); fsConnect(d->doc, SIGNAL(filenameChanged(const QString&)), this, SIGNAL(filenameChanged(const QString&))); // Handle the modified flag fsConnect(d->doc, SIGNAL(fileClean()), &d->undoStack, SLOT(setClean())); }
void Quaternion::validate() { /// do this fancy math only if its necessary if (_dirty) { /// recalculate quaternion Vector3 _scaledAxis = (_axis.normalized()*(sin(_angle/2.0f)));; _quaternion = Vector3(_scaledAxis[0], _scaledAxis[1], _scaledAxis[2], cos(_angle/2.0f)); double x2 = _scaledAxis[0]*_scaledAxis[0]; double y2 = _scaledAxis[1]*_scaledAxis[1]; double z2 = _scaledAxis[2]*_scaledAxis[2]; double xy = _scaledAxis[0]*_scaledAxis[1]; double xz = _scaledAxis[0]*_scaledAxis[2]; double yz = _scaledAxis[1]*_scaledAxis[2]; double wx = _quaternion[3]*_scaledAxis[0]; double wy = _quaternion[3]*_scaledAxis[1]; double wz = _quaternion[3]*_scaledAxis[2]; /// recalculate the result matrix _last_valid_mat.setIdentity(); _last_valid_mat[0] = 1 - 2*y2 - 2*z2; _last_valid_mat[1] = 2*xy + 2*wz; _last_valid_mat[2] = 2*xz - 2*wy; _last_valid_mat[4] = 2*xy - 2*wz; _last_valid_mat[5] = 1 - 2*x2 - 2*z2; _last_valid_mat[6] = 2*yz + 2*wx; _last_valid_mat[8] = 2*xz + 2*wy; _last_valid_mat[9] = 2*yz - 2*wx; _last_valid_mat[10]= 1 - 2*x2 - 2*y2; setClean(); } }
void ModelWindow::setData(bool adjustPlot) { settings.ride = ride; settings.x = xSelector->itemData(xSelector->currentIndex()).toInt(); settings.y = ySelector->itemData(ySelector->currentIndex()).toInt(); settings.z = zSelector->itemData(zSelector->currentIndex()).toInt(); settings.color = colorSelector->itemData(colorSelector->currentIndex()).toInt(); settings.xbin = binWidthSlider->value(); settings.ybin = binWidthSlider->value(); settings.crop = false; // not implemented yet settings.zpane = 0; settings.ignore = ignore->isChecked(); settings.gridlines = grid->isChecked(); settings.frame = frame->isChecked(); settings.legend = legend->isChecked(); settings.adjustPlot = adjustPlot; zpane->setValue(0); // reset it! // any intervals to plot? settings.intervals.clear(); for (int i=0; i<main->allIntervalItems()->childCount(); i++) { IntervalItem *current = dynamic_cast<IntervalItem *>(main->allIntervalItems()->child(i)); if (current != NULL && current->isSelected() == true) settings.intervals.append(current); } setUpdatesEnabled(false); // reset the model parameters modelPlot->setData(&settings); // if setdata resulted in the plot being hidden // then the settings were not valid. if (modelPlot->basicModelPlot->isHidden()) { zpane->hide(); nodata->show(); } else { zpane->show(); nodata->hide(); } setClean(); setUpdatesEnabled(true); }
bool INIFile::writeINIFile( void ) { if ( !isDirty() ) return true; // if ( invalid ) // return false; FILE *inf; // here we need to stat the file to see if it has changed // - but what do we do if it has? We should have loaded // it VERY recently if ( ( inf = fopen( loadedFileName.c_str(), "wt" ) ) == 0 ) return false; for ( std::vector <IniSectionPtr>::iterator thisSect = sections.begin(); thisSect != sections.end(); thisSect++ ) { const std::string sname = ( *thisSect ) ->name; if ( ( *thisSect ) ->isValidSection() ) fprintf( inf, "[%s]\n", sname.c_str() ); for ( std::vector <IniEntryPtr>::iterator this_entry = ( *thisSect ) ->entries.begin(); this_entry != ( *thisSect ) ->entries.end(); this_entry++ ) { const std::string name = ( *this_entry ) ->name; const std::string val = ( *this_entry ) ->getValue(); if ( ( *this_entry ) ->isValidEntry() ) fprintf( inf, "%s=%s\n", name.c_str(), val.c_str() ); else fprintf( inf, "%s\n", val.c_str() ); // treat as annotation } } fclose( inf ); setClean(); // now stat the file so we can check for changes checkStat(); return true; }
void ModelWindow::setData(bool adjustPlot) { settings.ride = ride; settings.x = xSelector->itemData(xSelector->currentIndex()).toInt(); settings.y = ySelector->itemData(ySelector->currentIndex()).toInt(); settings.z = zSelector->itemData(zSelector->currentIndex()).toInt(); settings.color = colorSelector->itemData(colorSelector->currentIndex()).toInt(); settings.xbin = binWidthSlider->value(); settings.ybin = binWidthSlider->value(); settings.crop = false; // not implemented yet settings.zpane = 0; settings.ignore = ignore->isChecked(); settings.gridlines = grid->isChecked(); settings.frame = frame->isChecked(); settings.legend = legend->isChecked(); settings.adjustPlot = adjustPlot; zpane->setValue(0); // reset it! // any intervals to plot? if (ride) settings.intervals = ride->intervalsSelected(); else settings.intervals.clear(); setUpdatesEnabled(false); // reset the model parameters modelPlot->setData(&settings); // if setdata resulted in the plot being hidden // then the settings were not valid. if (modelPlot->isHidden()) { zpane->hide(); setIsBlank(true); } else { zpane->show(); setIsBlank(false); } setClean(); setUpdatesEnabled(true); }
void setCleanCC (void *pa, unsigned char uc) { setClean(pa, uc > 63 ? 0 : 1); }
void BaseFile::doClear() { setClean(); // setFileName("untitled"); }
void PropertyStorage::setProperty( LocationProperty inNode, const boost::python::object& inValue, const std::set< LocationProperty >& inNewDowntreeValues ) { /**************** * to update a property we must do several things: * * update the property value * update the property list * make sure we go through old dependencies and orphan any new orphans * check that the value is different. if so, mark anybody "uptree" of this property as "dirty" * update the level of the boost::python::object. We assume that the levels in the system are correct for * - mutables (0) * - clean nodes with everything clean below * we have to be careful, in case a dirty property depends on another dirty property. * *******************/ if (!mNode_LazyCleanAndLevel.hasKey(inNode)) mNode_LazyCleanAndLevel.set(inNode, make_pair(make_pair(inNode.isLazy(), true), 0)); bool valueChanged = true; bool valueExisted = mValues.find(inNode) != mValues.end(); if (mValues.find(inNode) != mValues.end()) { boost::python::object oldValue = mValues[inNode]; if (mValues[inNode] == inValue) valueChanged = false; } else { //this property is new. by default it's orphaned. markOrphaned(inNode); mLocationProperties.insert(inNode.getLocation(), inNode.getPropertyID()); mClassPropertyLocations.insert(inNode.getLocation().getType()->getClassID(), inNode); } mValues[inNode] = inValue; mDirtyingProperties.erase(inNode); setDependencies(inNode, inNewDowntreeValues); //std::set dirtiness setClean(inNode, true); recomputeLevel(inNode); recomputeLaziness(inNode); //now we have to std::set the cleanliness of our parents if (valueChanged) { //we mark all our uptrees as dirty const std::set<LocationProperty>& uptree(mDependencies.getKeys(inNode)); for (std::set<LocationProperty>::const_iterator it = uptree.begin(); it != uptree.end(); ++it) { setClean(*it, false); mDirtyingProperties[*it].insert(inNode); } if (valueExisted && isRoot(inNode)) { std::set<WeakRootPtr> toDrop; std::set<WeakRootPtr>::const_iterator end = mNodeRoots.find(inNode)->second.end(); std::set<WeakRootPtr>::const_iterator it = mNodeRoots.find(inNode)->second.begin(); for (;it != end; ++it) { RootPtr r = it->lock(); if (!r) toDrop.insert(*it); else r->changed(); } end = toDrop.end(); it = toDrop.begin(); for (;it != end; ++it) dropRootNode(inNode, *it); } } }
KstSettingsDlg::KstSettingsDlg(QWidget* parent, const char *name, Qt::WindowFlags fl) : QDialog(parent, fl) { QString hours = QObject::tr(" hours"); QLineEdit* edit; setupUi(this); printf("-1\n"); fillAxesSettings(); updateCurveColorSettings(); setSettings(KstSettings::globalSettings()); setClean(); updateAxesButtons(); updateAxesSettings(); updateEMailSettings(); updateUTCOffset(); printf("0\n"); _source->insertItems(0, KstDataSource::pluginList()); if (_source->count() > 0) { sourceChanged(_source->itemText(0)); } else { _configureSource->setEnabled(false); } edit = _valueOffset->findChild<QLineEdit*>(); if (edit) { edit->setMaxLength(5 + hours.length()); } printf("2\n"); _valueOffset->setRange(-24.0, 24.0); _valueOffset->setSingleStep(0.50); _valueOffset->setSuffix(QObject::tr(" hours")); // xxx _colorPalette->_label->setText(QObject::tr("Curve color sequence: ")); connect(_spinBoxLineWidth, SIGNAL(valueChanged(int)), this, SLOT(setDirty())); connect(_spinBoxLineWidth->findChild<QLineEdit*>(), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); connect(_valueOffset->findChild<QLineEdit*>(), SIGNAL(textChanged(const QString&)), this, SLOT(updateTimezone(const QString&))); connect(_timer->findChild<QLineEdit*>(), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); connect(_kIntSpinBoxEMailPort->findChild<QLineEdit*>(), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); connect(_colorPalette->_palette, SIGNAL(activated(int)), this, SLOT(setDirty())); connect(_fontSize->findChild<QLineEdit*>(), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); connect(_fontMinSize->findChild<QLineEdit*>(), SIGNAL(textChanged(const QString&)), this, SLOT(setDirty())); connect(_cancel, SIGNAL(clicked()), this, SLOT(close())); connect(_timer, SIGNAL(valueChanged(int)), this, SLOT(setDirty())); connect(_defaults, SIGNAL(clicked()), this, SLOT(defaults())); connect(_ok, SIGNAL(clicked()), this, SLOT(save())); connect(_ok, SIGNAL(clicked()), this, SLOT(close())); connect(_colors, SIGNAL(bgChanged(QColor)), this, SLOT(setDirty())); connect(_colors, SIGNAL(bgChanged(QColor)), this, SLOT(setDirty())); connect(_xMajorGrid, SIGNAL(clicked()), this, SLOT(updateAxesButtons())); connect(_xMinorGrid, SIGNAL(clicked()), this, SLOT(updateAxesButtons())); connect(_yMajorGrid, SIGNAL(clicked()), this, SLOT(updateAxesButtons())); connect(_yMinorGrid, SIGNAL(clicked()), this, SLOT(updateAxesButtons())); connect(_checkBoxDefaultMajorGridColor, SIGNAL(clicked()), this, SLOT(updateAxesButtons())); connect(_checkBoxDefaultMinorGridColor, SIGNAL(clicked()), this, SLOT(updateAxesButtons())); connect(_checkBoxXInterpret, SIGNAL(toggled(bool)), _comboBoxXInterpret, SLOT(setEnabled(bool))); connect(_checkBoxXInterpret, SIGNAL(toggled(bool)), _comboBoxXDisplay, SLOT(setEnabled(bool))); connect(_configureSource, SIGNAL(clicked()), this, SLOT(configureSource())); connect(_source, SIGNAL(clicked(QString)), this, SLOT(sourceChanged(QString))); connect(_xMajorGrid, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_xMinorGrid, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_yMajorGrid, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_yMinorGrid, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_majorGridColor, SIGNAL(changed(QColor)), this, SLOT(setDirty())); connect(_minorGridColor, SIGNAL(changed(QColor)), this, SLOT(setDirty())); connect(_checkBoxDefaultMajorGridColor, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_checkBoxDefaultMinorGridColor, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_comboBoxXDisplay, SIGNAL(activated(int)), this, SLOT(setDirty())); connect(_promptWindowClose, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_showQuickStart, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_tiedZoomGlobal, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_lineEditSender, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(_lineEditHost, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(_lineEditLogin, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(_lineEditPassword, SIGNAL(textChanged(QString)), this, SLOT(setDirty())); connect(_checkBoxAuthentication, SIGNAL(clicked()), this, SLOT(setDirty())); connect(_buttonGroupEncryption, SIGNAL(clicked(int)), this, SLOT(setDirty())); connect(_buttonGroupAuthentication, SIGNAL(clicked(int)), this, SLOT(setDirty())); connect(_checkBoxXInterpret, SIGNAL(toggled(bool)), this, SLOT(setDirty())); connect(_checkBoxAuthentication, SIGNAL(clicked()), this, SLOT(updateEMailSettings())); connect(_comboBoxXInterpret, SIGNAL(activated(QString)), this, SLOT(setDirty())); connect(_fontSize, SIGNAL(valueChanged(int)), this, SLOT(setDirty())); connect(_valueOffset, SIGNAL(valueChanged(double)), this, SLOT(updateTimezone(double))); connect(_fontMinSize, SIGNAL(valueChanged(int)), this, SLOT(setDirty())); printf("3\n"); }