void MetavoxelEditor::createNewAttribute() { QDialog dialog(this); dialog.setWindowTitle("New Attribute"); QVBoxLayout layout; dialog.setLayout(&layout); QFormLayout form; layout.addLayout(&form); QLineEdit name; form.addRow("Name:", &name); SharedObjectEditor editor(&Attribute::staticMetaObject, false); editor.setObject(new QRgbAttribute()); layout.addWidget(&editor); QDialogButtonBox buttons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); dialog.connect(&buttons, SIGNAL(accepted()), SLOT(accept())); dialog.connect(&buttons, SIGNAL(rejected()), SLOT(reject())); layout.addWidget(&buttons); if (!dialog.exec()) { return; } QString nameText = name.text().trimmed(); SharedObjectPointer attribute = editor.getObject(); attribute->setObjectName(nameText); AttributeRegistry::getInstance()->registerAttribute(attribute.staticCast<Attribute>()); updateAttributes(nameText); }
int setAttribute(Volume* volume, uint32_t fileID, const char* name, uint8_t* data, size_t size) { HFSPlusAttrKey key; HFSPlusAttrData* record; int ret, exact; if(!volume->attrTree) return FALSE; memset(&key, 0 , sizeof(HFSPlusAttrKey)); key.fileID = fileID; key.startBlock = 0; ASCIIToUnicode(name, &key.name); key.keyLength = sizeof(HFSPlusAttrKey) - sizeof(HFSUniStr255) + sizeof(key.name.length) + (sizeof(uint16_t) * key.name.length); record = (HFSPlusAttrData*) malloc(sizeof(HFSPlusAttrData) + size); memset(record, 0, sizeof(HFSPlusAttrData)); record->recordType = kHFSPlusAttrInlineData; record->size = size; memcpy(record->data, data, size); ret = updateAttributes(volume, &key, (HFSPlusAttrRecord*) record); free(record); return ret; }
void FVAnimation::slotTimer( ) { double v = getAttrValue( tr("Current Time:") ).toDouble(); double st = getAttrValue( tr("Time Step:") ).toDouble(); v += st; setAttrValue( tr("Current Time:") , QString("%1").arg( v )); updateAttributes(); }
KateRenderer::KateRenderer(KateDocument* doc, KateView *view) : m_doc(doc) , m_view (view) , m_tabWidth(m_doc->config()->tabWidth()) , m_indentWidth(m_doc->config()->indentationWidth()) , m_caretStyle(KateRenderer::Line) , m_drawCaret(true) , m_showSelections(true) , m_showTabs(true) , m_showSpaces(true) , m_printerFriendly(false) , m_config(new KateRendererConfig(this)) { updateAttributes (); }
KateRenderer::KateRenderer(KateDocument* doc, Kate::TextFolding &folding, KateView *view) : m_doc(doc) , m_folding (folding) , m_view (view) , m_tabWidth(m_doc->config()->tabWidth()) , m_indentWidth(m_doc->config()->indentationWidth()) , m_caretStyle(KateRenderer::Line) , m_drawCaret(true) , m_showSelections(true) , m_showTabs(true) , m_showSpaces(true) , m_printerFriendly(false) , m_config(new KateRendererConfig(this)) { updateAttributes (); // initialize with a sane font height updateFontHeight (); }
ccFitPlane::ccFitPlane(ccPlane* p) : ccPlane(p->getXWidth(), p->getYWidth(), &p->getTransformation(), p->getName()) //create an identical plane { p->clone(); //add metadata tag defining the ccCompass class type QVariantMap* map = new QVariantMap(); map->insert("ccCompassType", "FitPlane"); setMetaData(*map, true); //update name CCVector3 N(getNormal()); //We always consider the normal with a positive 'Z' by default! if (N.z < 0.0) N *= -1.0; //calculate strike/dip/dip direction float dip, dipdir; ccNormalVectors::ConvertNormalToDipAndDipDir(N, dip, dipdir); QString dipAndDipDirStr = QString("%1/%2").arg((int)dip, 2, 10, QChar('0')).arg((int)dipdir, 3, 10, QChar('0')); setName(dipAndDipDirStr); //update metadata float rms = -1; float search_r = -1; if (p->hasMetaData("RMS")) { rms = p->getMetaData("RMS").toFloat(); } if (p->hasMetaData("Radius")) { search_r = p->getMetaData("Radius").toFloat(); } updateAttributes(rms,search_r); //update drawing properties based on ccCompass state enableStippling(ccCompass::drawStippled); showNameIn3D(ccCompass::drawName); showNormalVector(ccCompass::drawNormals); }
MetavoxelEditor::MetavoxelEditor() : QWidget(Application::getInstance()->getGLWidget(), Qt::Tool | Qt::WindowStaysOnTopHint) { setWindowTitle("Metavoxel Editor"); setAttribute(Qt::WA_DeleteOnClose); QVBoxLayout* topLayout = new QVBoxLayout(); setLayout(topLayout); QGroupBox* attributeGroup = new QGroupBox(); attributeGroup->setTitle("Attributes"); topLayout->addWidget(attributeGroup); QVBoxLayout* attributeLayout = new QVBoxLayout(); attributeGroup->setLayout(attributeLayout); attributeLayout->addWidget(_attributes = new QListWidget()); connect(_attributes, SIGNAL(itemSelectionChanged()), SLOT(selectedAttributeChanged())); QHBoxLayout* attributeButtonLayout = new QHBoxLayout(); attributeLayout->addLayout(attributeButtonLayout); QPushButton* newAttribute = new QPushButton("New..."); attributeButtonLayout->addWidget(newAttribute); connect(newAttribute, SIGNAL(clicked()), SLOT(createNewAttribute())); attributeButtonLayout->addWidget(_deleteAttribute = new QPushButton("Delete")); _deleteAttribute->setEnabled(false); connect(_deleteAttribute, SIGNAL(clicked()), SLOT(deleteSelectedAttribute())); QFormLayout* formLayout = new QFormLayout(); topLayout->addLayout(formLayout); formLayout->addRow("Grid Plane:", _gridPlane = new QComboBox()); _gridPlane->addItem("X/Y"); _gridPlane->addItem("X/Z"); _gridPlane->addItem("Y/Z"); _gridPlane->setCurrentIndex(GRID_PLANE_XZ); connect(_gridPlane, SIGNAL(currentIndexChanged(int)), SLOT(centerGridPosition())); formLayout->addRow("Grid Spacing:", _gridSpacing = new QDoubleSpinBox()); _gridSpacing->setMinimum(-FLT_MAX); _gridSpacing->setMaximum(FLT_MAX); _gridSpacing->setPrefix("2^"); _gridSpacing->setValue(-3.0); connect(_gridSpacing, SIGNAL(valueChanged(double)), SLOT(alignGridPosition())); formLayout->addRow("Grid Position:", _gridPosition = new QDoubleSpinBox()); _gridPosition->setMinimum(-FLT_MAX); _gridPosition->setMaximum(FLT_MAX); alignGridPosition(); centerGridPosition(); formLayout->addRow("Tool:", _toolBox = new QComboBox()); connect(_toolBox, SIGNAL(currentIndexChanged(int)), SLOT(updateTool())); _value = new QGroupBox(); _value->setTitle("Value"); topLayout->addWidget(_value); QVBoxLayout* valueLayout = new QVBoxLayout(); _value->setLayout(valueLayout); valueLayout->addWidget(_valueArea = new QScrollArea()); _valueArea->setMinimumHeight(200); _valueArea->setWidgetResizable(true); addTool(new BoxSetTool(this)); addTool(new GlobalSetTool(this)); addTool(new InsertSpannerTool(this)); addTool(new RemoveSpannerTool(this)); addTool(new ClearSpannersTool(this)); addTool(new SetSpannerTool(this)); updateAttributes(); connect(Application::getInstance(), SIGNAL(simulating(float)), SLOT(simulate(float))); connect(Application::getInstance(), SIGNAL(renderingInWorldInterface()), SLOT(render())); Application::getInstance()->getGLWidget()->installEventFilter(this); show(); if (_gridProgram.isLinked()) { return; } _gridProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/grid.frag"); _gridProgram.link(); }
void MetavoxelEditor::deleteSelectedAttribute() { AttributeRegistry::getInstance()->deregisterAttribute(getSelectedAttribute()); _attributes->selectionModel()->clear(); updateAttributes(); }
void FVAnimation::slotPlay() { setAttrValue( tr("Play Speed:"), lastPlaySpeed ); updateAttributes(); }
void FVAnimation::slotStop() { setAttrValue( tr("Play Speed:"), tr("Stop") ); updateAttributes(); }
void FVAnimation::slotPause() { lastPlaySpeed = getAttrValue( tr("Play Speed:") ); setAttrValue( tr("Play Speed:"), tr("Stop") ); updateAttributes(); }