void JBtnObj::engine(int n, JLinkObj& link) { if (!n) { int iv = value; link.access(JIntegerData(iv)); setValue((iv) ? mask : 0); } else processColor(n, link); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Notify this dialog box that the active image has changed //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //! \brief notify this dialog box that the active image has changed //! \param[in] img new changed image void IPDialog::imageChanged(QImage img) { // update the changed image m_retProcImg = img; m_origImg = img.scaled(128, 128, Qt::KeepAspectRatio); m_resultImg = img.scaled(128, 128, Qt::KeepAspectRatio); // reprocess with the new image (same parameters) switch(m_currentFuct) { case COLOR: processColor(); break; case THRESHOLD: processThreshold(); break; case EDGE: processEdge(); break; default: break; } // show the appropriate display if (m_dispOrig ->isChecked()) m_ipDisplay ->storeImage(tr("Original"), m_origImg); else m_ipDisplay ->storeImage(tr("Result"), m_resultImg); }
void J1DMObj::engine(int n, JLinkObj& link) { if (n < 2) { int iv = v[n]; link.access(JIntegerData(iv)); setNValue(n, iv); } else processColor(n, link, -1); }
void SmlPlug::processFillNode(QDomElement &elem) { fillStyle = elem.attribute("colorStyle","1").toInt(); if (fillStyle == 0) CurrColorFill = CommonStrings::None; else CurrColorFill = processColor(elem); }
void SmlPlug::processStrokeNode(QDomElement &elem) { CurrColorStroke = processColor(elem); LineW = ScCLocale::toDoubleC(elem.attribute("width"), 1.0); LineJoin = Qt::PenJoinStyle(elem.attribute("joinStyle", "0").toInt()); Dash = Qt::PenStyle(elem.attribute("pattern", "1").toInt()); LineEnd = Qt::PenCapStyle(elem.attribute("capStyle", "0").toInt()); }
void J1DSliderObj::engine(int n, JLinkObj& link) { switch (n) { case INPUT: { int iv = value; link.access(JIntegerData(iv)); setValue(iv); break; } case COLOR: case BACKGROUND: { processColor(n, link); break; } case MIN: { int ov = min; link.access(JIntegerData(min)); if (min != ov) setValue(value); break; } case MAX: { int ov = max; link.access(JIntegerData(max)); if (max != ov) setValue(value); break; } case NEXT: { int ov = next; link.access(JIntegerData(next)); next = (next != 0); if (next && (next != ov)) setValue(value+1); break; } case PREV: { int ov = prev; link.access(JIntegerData(prev)); prev = (prev != 0); if (prev && (prev != ov)) setValue(value-1); break; } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CONSTRUCTOR //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //! \brief Constructor IPDialog::IPDialog(QWidget *p, Qt::WindowFlags f) : QWidget(p, f) { // initialize image processing class m_ip = new IP(); // create display layout QGridLayout *dispLay = new QGridLayout; m_ipDisplay = new OpenGLWidget(); m_ipDisplay ->setFixedSize(128, 128); dispLay ->addWidget(m_ipDisplay, 0, 0, 2, 2, Qt::AlignCenter); m_dispOrig = new QRadioButton(tr("Original")); m_dispResult = new QRadioButton(tr("Result")); m_dispResult ->setChecked(true); // display result by default dispLay ->addWidget(m_dispOrig, 0, 2, Qt::AlignCenter); dispLay ->addWidget(m_dispResult, 1, 2, Qt::AlignCenter); m_boxDisp = new QGroupBox(tr("Display"), this); m_boxDisp ->setLayout(dispLay); // initialize all dynamic layout options m_thresSlider = new QSlider(Qt::Horizontal); m_thresSlider ->setTickPosition(QSlider::TicksBelow); m_thresSlider ->setRange(0, 255); m_thresSlider ->setValue(128); m_thresSlider ->setTickInterval(10); m_thresSpin = new QSpinBox; m_thresSpin ->setRange(0, 255); m_thresSpin ->setValue(128); m_thresSpin ->setKeyboardTracking(false); m_colorRed = new QRadioButton(tr("Red")); m_colorBlue = new QRadioButton(tr("Blue")); m_colorGreen = new QRadioButton(tr("Green")); m_colorGray = new QRadioButton(tr("Gray")); m_thresInd = new QRadioButton(tr("Individual")); m_thresAll = new QRadioButton(tr("All")); m_edgePrewitt = new QRadioButton(tr("Prewitt")); m_edgeSobel = new QRadioButton(tr("Sobel")); m_edgeLoG = new QRadioButton(tr("LoG")); // dynamic layout depends on function selected m_optLay = new QGridLayout; // set different layout depending on the options m_boxOpt = new QGroupBox(this); m_boxOpt ->setLayout(m_optLay); // initialize confirmation buttons m_butOk = new QPushButton(tr("OK")); m_butCancel = new QPushButton(tr("Cancel")); m_butApply = new QPushButton(tr("Apply")); // map confirmation buttons signal m_signalMap = new QSignalMapper(this); m_signalMap ->setMapping(m_butOk, 1); m_signalMap ->setMapping(m_butCancel, 2); m_signalMap ->setMapping(m_butApply, 3); QHBoxLayout *hLay = new QHBoxLayout(); hLay ->addWidget(m_butOk); hLay ->addWidget(m_butCancel); hLay ->addWidget(m_butApply); // set up the entire dialog layout m_ipLayout = new QVBoxLayout(this); m_ipLayout ->addWidget(m_boxDisp); m_ipLayout ->setStretchFactor(m_boxDisp, 1); m_ipLayout ->addWidget(m_boxOpt); m_ipLayout ->addLayout(hLay); setLayout (m_ipLayout); // set up all connections connect(m_thresSlider, SIGNAL(valueChanged(int)), this, SLOT(sliderChanged(int))); connect(m_thresSpin, SIGNAL(valueChanged(int)), this, SLOT(spinChanged(int))); connect(m_dispOrig, SIGNAL(toggled(bool)), this, SLOT(imgButToggled(bool))); // true = orig; false = result connect(m_colorRed, SIGNAL(released()), this, SLOT(processColor())); connect(m_colorGreen, SIGNAL(released()), this, SLOT(processColor())); connect(m_colorBlue, SIGNAL(released()), this, SLOT(processColor())); connect(m_colorGray, SIGNAL(released()), this, SLOT(processColor())); connect(m_thresInd, SIGNAL(released()), this, SLOT(processThreshold())); connect(m_thresAll, SIGNAL(released()), this, SLOT(processThreshold())); connect(m_edgePrewitt, SIGNAL(released()), this, SLOT(processEdge())); connect(m_edgeSobel, SIGNAL(released()), this, SLOT(processEdge())); connect(m_edgeLoG, SIGNAL(released()), this, SLOT(processEdge())); connect(m_butOk, SIGNAL(clicked()), m_signalMap, SLOT(map())); connect(m_butCancel, SIGNAL(clicked()), m_signalMap, SLOT(map())); connect(m_butApply, SIGNAL(clicked()), m_signalMap, SLOT(map())); connect(m_signalMap, SIGNAL(mapped(int)), this, SIGNAL(done(int))); }
void ResourcePool::Config() { for (vector<Branch>::iterator branch = resourceBranch.childBranches.begin(); branch != resourceBranch.childBranches.end(); ++branch) { if (branch->branchName == "MeshContainer") { for (vector<Attribute>::iterator attri = branch->attributes.begin(); attri != branch->attributes.end(); ++attri) { Attribute tempAttri = *attri; string attriName = tempAttri.name; string attriValue = tempAttri.value; if (attriName == "Directory") { processMesh(attriValue); } } } else if (branch->branchName == "TextureContainer") { for (vector<Attribute>::iterator attri = branch->attributes.begin(); attri != branch->attributes.end(); ++attri) { Attribute tempAttri = *attri; string attriName = tempAttri.name; string attriValue = tempAttri.value; if (attriName == "Directory") { processTexture(attriValue); } } } else if (branch->branchName == "ColorContainer") { for (vector<Attribute>::iterator attri = branch->attributes.begin(); attri != branch->attributes.end(); ++attri) { Attribute tempAttri = *attri; string attriName = tempAttri.name; string attriValue = tempAttri.value; if (attriName == "Directory") { processColor(attriValue); } } } else if (branch->branchName == "ShaderContainer") { for (vector<Attribute>::iterator attri = branch->attributes.begin(); attri != branch->attributes.end(); ++attri) { Attribute tempAttri = *attri; string attriName = tempAttri.name; string attriValue = tempAttri.value; if (attriName == "Directory") { processShader(attriValue); } } } else if (branch->branchName == "SoundContainer") { for (vector<Attribute>::iterator attri = branch->attributes.begin(); attri != branch->attributes.end(); ++attri) { Attribute tempAttri = *attri; string attriName = tempAttri.name; string attriValue = tempAttri.value; if (attriName == "Directory") { soundPool->processSound(attriValue); } } } } }