Example #1
0
void RenderingRuleSearchRequest::printDebugResult() {
	if (searchResult) {
		printf("\n Found : ");
		HMAP::hash_map<string, RenderingRuleProperty*>::iterator it = PROPS->properties.begin();
		for (; it != PROPS->properties.end(); ++it) {
			RenderingRuleProperty* rp = it->second;
			if (!rp->input && isSpecified(rp)) {
				printf(" %s=", rp->attrName.c_str());
				if (rp->isString()) {
					printf("\"%s\"", getStringPropertyValue(rp).c_str());
				} else if (rp->isFloat()) {
					printf("%f", getFloatPropertyValue(rp));
				} else if (rp->isColor()) {
					printf("%s", colorToString(getIntPropertyValue(rp)).c_str());
				} else if (rp->isIntParse()) {
					printf("%d", getIntPropertyValue(rp));
				}
			}
		}
		printf("\n");
	} else {
		printf("\nNot found\n");
	}

}
Example #2
0
QString ColorPickerPushButton::colorToCss( QColor color )
{
	QString colorStr = "rgb";
	colorStr.append(colorToString(color));

	return colorStr;
}
Example #3
0
string RenderingRule::getColorPropertyValue(string property) {
	int i = getPropertyIndex(property);
	if (i >= 0) {
		return colorToString(intProperties[i]);
	}
	return "";
}
Example #4
0
FilterAction BorderFilter::filterAction()
{
    FilterAction action(FilterIdentifier(), CurrentVersion());
    action.setDisplayableName(DisplayableName());

    action.setParameter(QLatin1String("borderPath"),            d->settings.borderPath);
    action.setParameter(QLatin1String("borderPercent"),         d->settings.borderPercent);
    action.setParameter(QLatin1String("borderType"),            d->settings.borderType);
    action.setParameter(QLatin1String("borderWidth1"),          d->settings.borderWidth1);
    action.setParameter(QLatin1String("borderWidth2"),          d->settings.borderWidth2);
    action.setParameter(QLatin1String("borderWidth3"),          d->settings.borderWidth3);
    action.setParameter(QLatin1String("borderWidth4"),          d->settings.borderWidth4);
    action.setParameter(QLatin1String("preserveAspectRatio"),   d->settings.preserveAspectRatio);
    action.setParameter(QLatin1String("orgHeight"),             d->settings.orgHeight);
    action.setParameter(QLatin1String("orgWidth"),              d->settings.orgWidth);

    action.setParameter(QLatin1String("solidColor"),            colorToString(d->settings.solidColor));
    action.setParameter(QLatin1String("niepceBorderColor"),     colorToString(d->settings.niepceBorderColor));
    action.setParameter(QLatin1String("niepceLineColor"),       colorToString(d->settings.niepceLineColor));
    action.setParameter(QLatin1String("bevelUpperLeftColor"),   colorToString(d->settings.bevelUpperLeftColor));
    action.setParameter(QLatin1String("bevelLowerRightColor"),  colorToString(d->settings.bevelLowerRightColor));
    action.setParameter(QLatin1String("decorativeFirstColor"),  colorToString(d->settings.decorativeFirstColor));
    action.setParameter(QLatin1String("decorativeSecondColor"), colorToString(d->settings.decorativeSecondColor));

    return action;
}
void PageSettingDlg::selectColor() {
    QColor color;
    QColorDialog *dlg = new QColorDialog(color, this);
    if (dlg->exec() == QDialog::Accepted) {
        color = dlg->selectedColor();
    } else return;

    strColor = colorToString(color);
    pageSetting.borderColor = strColor;
    ui->lblBorderColor->setStyleSheet("QLabel {background-color: "+strColor+"}");
}
Example #6
0
std::string ColorFilterArray::asString() {
  string s("Upper left:");
  s += colorToString(cfa[0]);
  s.append(" * Upper right:");
  s += colorToString(cfa[1]);
  s += ("\nLower left:");
  s += colorToString(cfa[2]);
  s.append(" * Lower right:");
  s += colorToString(cfa[3]);
  s.append("\n");

  s += string("CFA_") + colorToString(cfa[0]) + string(", CFA_") + colorToString(cfa[1]);
  s += string(", CFA_") + colorToString(cfa[2]) + string(", CFA_") + colorToString(cfa[3]) + string("\n");
  return s;
}
Example #7
0
static char *
iniOptionValueToString (CompDisplay *d, CompOptionValue *value, CompOptionType type)
{
    char tmp[MAX_OPTION_LENGTH];
    tmp[0] = '\0';

    switch (type)
    {
    case CompOptionTypeBool:
    case CompOptionTypeInt:
	snprintf(tmp, 256, "%i", (int)value->i);
	break;
    case CompOptionTypeFloat:
	snprintf(tmp, 256, "%f", value->f);
	break;
    case CompOptionTypeString:
	snprintf (tmp, MAX_OPTION_LENGTH, "%s", strdup (value->s));
	break;
    case CompOptionTypeColor:
	snprintf (tmp, 10, "%s", colorToString (value->c));
	break;
    case CompOptionTypeKey:
	return keyActionToString (d, &value->action);
	break;
    case CompOptionTypeButton:
	return buttonActionToString (d, &value->action);
	break;
    case CompOptionTypeEdge:
	return edgeMaskToString (value->action.edgeMask);
	break;
    case CompOptionTypeBell:
	snprintf (tmp, 256, "%i", (int) value->action.bell);
	break;
    case CompOptionTypeMatch:
        {
	    char *s = matchToString (&value->match);
	    snprintf (tmp, MAX_OPTION_LENGTH, "%s", s);
	    free(s);
	}
	break;
    default:
	break;
    }

    return strdup (tmp);
}
void EditFldDlg::chooseColor() {
    QColor color;
    if (sender() == ui->btnColorF)
        color = colorFromString(ui->lblColorF->styleSheet());
    if (sender() == ui->btnColorB)
        color = colorFromString(ui->lblColorB->styleSheet());
    QColorDialog *dlg = new QColorDialog(color, this);
    if (dlg->exec() == QDialog::Accepted) {
        color = dlg->selectedColor();
    } else return;

    QString strColor = colorToString(color);
    if (sender() == ui->btnColorB)
        ui->lblColorB->setStyleSheet("QLabel {background-color: "+strColor+"}");
    if (sender() == ui->btnColorF)
        ui->lblColorF->setStyleSheet("QLabel {background-color: "+strColor+"}");

    encodeHighLightingString();
}
Example #9
0
void ColorPickerPushButton::setColor( QColor color )
{
	_color = color;

	// Compute text color
	QColor hsv = _color.toHsv();
	QString textColorStr;
	if (hsv.valueF() < 0.5f)
		textColorStr = "color: rgb(255, 255, 255);";
	else
		textColorStr = "color: rgb(0, 0, 0);";

	QString stylesheetStr = "background-color: ";
	stylesheetStr.append(colorToCss(_color));
	stylesheetStr.append(";");
	stylesheetStr.append(textColorStr);
	this->setStyleSheet(stylesheetStr);

	this->setText(colorToString(_color));
}
Example #10
0
QString Blinkink::backGroundString(QColor c)
{
    return QString(" background-color: %1;").arg(colorToString(c));
}
void RptContainer::setBorder(Command command, QVariant values, bool yesFrame) {
    QColor color = values.value<QColor>();    
    if (color.isValid()) {
        setSheetValue(BorderColor,colorToString(color));
    } else {
        color = getColorValue(BorderColor);
    }

    borderColor = color;
    QString strColor = colorToString(color);
    QString stl = this->styleSheet();

    switch(command) {
        case None: {
            if (getColorValue(FrameTop) != "rgba(255,255,255,0)")
                setSheetValue(FrameTop,strColor);
            if (getColorValue(FrameBottom) != "rgba(255,255,255,0)")
                setSheetValue(FrameBottom,strColor);
            if (getColorValue(FrameLeft) != "rgba(255,255,255,0)")
                setSheetValue(FrameLeft,strColor);
            if (getColorValue(FrameRight) != "rgba(255,255,255,0)")
                setSheetValue(FrameRight,strColor);
            break;
        }
        case FrameNo: {
            setSheetValue(FrameTop,"rgba(255,255,255,0)");
            setSheetValue(FrameLeft,"rgba(255,255,255,0)");
            setSheetValue(FrameRight,"rgba(255,255,255,0)");
            setSheetValue(FrameBottom,"rgba(255,255,255,0)");
            break;
        }
        case FrameAll: {
            setSheetValue(FrameTop,strColor);
            setSheetValue(FrameLeft,strColor);
            setSheetValue(FrameRight,strColor);
            setSheetValue(FrameBottom,strColor);
            break;
        }
        case FrameTop:
        case FrameBottom:
        case FrameRight:
        case FrameLeft: {
            if (!yesFrame) strColor = "rgba(255,255,255,0)";
            setSheetValue(command,strColor);
            break;
        }
        case FrameStyle: {
            BorderStyle borderStyle = (BorderStyle)values.toInt();
            int start = stl.indexOf(";border-style:",0,Qt::CaseInsensitive);
            int end = stl.indexOf(";",start+1,Qt::CaseInsensitive);

            switch(borderStyle) {
                case Solid: {
                    stl.replace(start,end-start,";border-style:solid");
                    break;
                }
                case Dashed: {
                    stl.replace(start,end-start,";border-style:dashed");
                    break;
                }
                case Dotted: {
                    stl.replace(start,end-start,";border-style:dotted");
                    break;
                }
                case Dot_dash: {
                    stl.replace(start,end-start,";border-style:dot-dash");
                    break;
                }
                case Dot_dot_dash: {
                    stl.replace(start,end-start,";border-style:dot-dot-dash");
                    break;
                }
                case Double: {
                    stl.replace(start,end-start,";border-style:double");
                    break;
                }
                default: return;
            }
            setStyleSheet(stl);
            break;
        }
        case FrameWidth: {
            int start = stl.indexOf(";border-width:",0,Qt::CaseInsensitive);
            int end = stl.indexOf(";",start+1,Qt::CaseInsensitive);
            stl.replace(start,end-start,";border-width:"+values.toString()+"px");
            setStyleSheet(stl);
            borderWidth = values.toInt();
            break;
        }
        default: return;
    }
}
Example #12
0
static QString
kconfigValueToString (CompObject      *object,
		      CompOptionType  type,
		      CompOptionValue *value)
{
    QString str;

    switch (type) {
    case CompOptionTypeBool:
	str = QString::number (value->b ? TRUE : FALSE);
	break;
    case CompOptionTypeFloat:
	str = QString::number (value->f);
	break;
    case CompOptionTypeString:
	str = QString (value->s);
	break;
    case CompOptionTypeColor: {
	char *color;

	color = colorToString (value->c);
	if (color)
	{
	    str = QString (color);
	    free (color);
	}
    } break;
    case CompOptionTypeKey: {
	char *action = NULL;

	while (object && object->type != COMP_OBJECT_TYPE_DISPLAY)
	    object = object->parent;

	if (object)
	    action = keyActionToString (GET_CORE_DISPLAY (object),
					&value->action);
	if (action)
	{
	    str = QString (action);
	    free (action);
	}
    } break;
    case CompOptionTypeButton: {
	char *action = NULL;

	while (object && object->type != COMP_OBJECT_TYPE_DISPLAY)
	    object = object->parent;

	if (object)
	    action = buttonActionToString (GET_CORE_DISPLAY (object),
					   &value->action);
	if (action)
	{
	    str = QString (action);
	    free (action);
	}
    } break;
    case CompOptionTypeEdge: {
	char *edge;

	edge = edgeMaskToString (value->action.edgeMask);
	if (edge)
	{
	    str = QString (edge);
	    free (edge);
	}
    } break;
    case CompOptionTypeBell:
	str = QString::number (value->action.bell ? TRUE : FALSE);
	break;
    case CompOptionTypeMatch: {
	char *match;

	match = matchToString (&value->match);
	if (match)
	{
	    str = QString (match);
	    free (match);
	}
    }
    default:
	break;
    }

    return str;
}
Example #13
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    qDebug() << "\n********************************";
    qDebug() << "***** QPrintDevice Details *****";
    qDebug() << "********************************\n";

    QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();
    if (!ps) {
        qDebug() << "Could not load platform plugin!";
        return -1;
    }

    QString defaultId = ps->defaultPrintDeviceId();
    if (defaultId.isEmpty())
        qDebug() << "No default printer found";
    else
        qDebug() << "Default Printer ID    :" << defaultId;
    qDebug() << "Available Printer IDs :" << ps->availablePrintDeviceIds() << "\n";

    foreach (const QString id, ps->availablePrintDeviceIds()) {
        QPrintDevice printDevice = ps->createPrintDevice(id);
        if (printDevice.isValid()) {
            qDebug() << "===" << printDevice.id() << "===\n";
            qDebug() << "Device ID       :" << printDevice.id();
            qDebug() << "Device Name     :" << printDevice.name();
            qDebug() << "Device Location :" << printDevice.location();
            qDebug() << "Device Make     :" << printDevice.makeAndModel();
            qDebug() << "";
            qDebug() << "isValid   :" << printDevice.isValid();
            qDebug() << "isDefault :" << printDevice.isDefault();
            qDebug() << "isRemote  :" << printDevice.isRemote();
            qDebug() << "";
            qDebug() << "state :" << stateToString(printDevice.state());
            qDebug() << "";
            qDebug() << "supportsMultipleCopies :" << printDevice.supportsMultipleCopies();
            qDebug() << "supportsCollateCopies  :" << printDevice.supportsCollateCopies();
            qDebug() << "";
            qDebug() << "defaultPageSize    :" << printDevice.defaultPageSize();
            qDebug() << "supportedPageSizes :";
            foreach (const QPageSize &page, printDevice.supportedPageSizes())
                qDebug() << "                    " << page << printDevice.printableMargins(page, QPageLayout::Portrait, 300);
            qDebug() << "";
            qDebug() << "supportsCustomPageSizes :" << printDevice.supportsCustomPageSizes();
            qDebug() << "";
            qDebug() << "minimumPhysicalPageSize :" << printDevice.minimumPhysicalPageSize();
            qDebug() << "maximumPhysicalPageSize :" << printDevice.maximumPhysicalPageSize();
            qDebug() << "";
            qDebug() << "defaultResolution    :" << printDevice.defaultResolution();
            qDebug() << "supportedResolutions :" << printDevice.supportedResolutions();
            qDebug() << "";
            qDebug() << "defaultInputSlot    :" << printDevice.defaultInputSlot().key
                                                <<  printDevice.defaultInputSlot().name
                                                <<  printDevice.defaultInputSlot().id;
            qDebug() << "supportedInputSlots :";
            foreach (const QPrint::InputSlot &slot, printDevice.supportedInputSlots())
                qDebug() << "                     " << slot.key << slot.name << slot.id;
            qDebug() << "";
            qDebug() << "defaultOutputBin    :" << printDevice.defaultOutputBin().key
                                                <<  printDevice.defaultOutputBin().name
                                                <<  printDevice.defaultOutputBin().id;
            qDebug() << "supportedOutputBins :";
            foreach (const QPrint::OutputBin &bin, printDevice.supportedOutputBins())
                qDebug() << "                     " << bin.key <<  bin.name <<  bin.id;
            qDebug() << "";
            qDebug() << "defaultDuplexMode    :" << duplexToString(printDevice.defaultDuplexMode());
            qDebug() << "supportedDuplexModes :";
            foreach (QPrint::DuplexMode mode, printDevice.supportedDuplexModes())
                qDebug() << "                      " << duplexToString(mode);
            qDebug() << "";
            qDebug() << "defaultColorMode    :" << colorToString(printDevice.defaultColorMode());
            qDebug() << "supportedColorModes :";
            foreach (QPrint::ColorMode mode, printDevice.supportedColorModes())
                qDebug() << "                     " << colorToString(mode);
            qDebug() << "";
            qDebug() << "supportedMimeTypes :";
            foreach (const QMimeType &type, printDevice.supportedMimeTypes())
                qDebug() << "                    " << type.name();
        } else {
void GLC_WorldTo3dxml::writeMaterial(const GLC_Material* pMaterial)
{
	const GLC_uint materialId= pMaterial->id();
	QString materialName;
	if (pMaterial->name().isEmpty())
	{
		materialName= "Material_0" + QString::number(materialId);
	}
	else
	{
		materialName= symplifyName(pMaterial->name());

		// If the materialName is already uses append material id to the name
		QSet<QString> materialsName= QSet<QString>::fromList(m_MaterialIdToMaterialName.values());
		while (materialsName.contains(materialName))
		{
			materialName= materialName + '_' + QString::number(materialId);
		}
	}

	m_MaterialIdToMaterialName.insert(materialId, materialName);

	const QString fileName= xmlFileName(materialName + "_Rendering.3DRep");
	setStreamWriterToFile(fileName);

	// Begin to write the material file
	m_pOutStream->writeStartDocument();
	m_pOutStream->writeStartElement("Osm");
		m_pOutStream->writeAttribute("xmlns", "http://www.3ds.com/xsd/osm.xsd");
		m_pOutStream->writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
		m_pOutStream->writeAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
		m_pOutStream->writeAttribute("xsi:schemaLocation", "http://www.3ds.com/xsd/3DXML ./osm.xsd");
		m_pOutStream->writeStartElement("Feature");
			m_pOutStream->writeAttribute("Alias", "RenderingRootFeature");
			m_pOutStream->writeAttribute("Id", "1");
			m_pOutStream->writeAttribute("StartUp", "RenderingRootFeature");
		m_pOutStream->writeEndElement(); // Feature
		m_pOutStream->writeStartElement("Feature");
			m_pOutStream->writeAttribute("Alias", "RenderingFeature");
			m_pOutStream->writeAttribute("Id", "2");
			m_pOutStream->writeAttribute("StartUp", "RenderingFeature");
			m_pOutStream->writeAttribute("Aggregating", "1");

			writeMaterialAttributtes("Filtering", "int", "1");
			writeMaterialAttributtes("Rotation", "double", "0");
			writeMaterialAttributtes("PreviewType", "int", "1");
			writeMaterialAttributtes("AmbientCoef", "double", "1");
			writeMaterialAttributtes("DiffuseCoef", "double", "1");
			writeMaterialAttributtes("SpecularCoef", "double", "1");
			writeMaterialAttributtes("EmissiveCoef", "double", "0");
			writeMaterialAttributtes("AlphaTest", "boolean", "false");
			writeMaterialAttributtes("TextureFunction", "int", "0");
			writeMaterialAttributtes("MappingType", "int", "2");
			writeMaterialAttributtes("Refraction", "double", "1");
			writeMaterialAttributtes("TextureDimension", "int", "2");
			writeMaterialAttributtes("TranslationU", "double", "0");
			writeMaterialAttributtes("TranslationV", "double", "0");
			writeMaterialAttributtes("FlipU", "boolean", "false");
			writeMaterialAttributtes("FlipV", "boolean", "false");
			writeMaterialAttributtes("WrappingModeU", "int", "1");
			writeMaterialAttributtes("WrappingModeV", "int", "1");
			writeMaterialAttributtes("ScaleU", "double", "1");
			writeMaterialAttributtes("ScaleV", "double", "1");
			writeMaterialAttributtes("Reflectivity", "double", "0.1");
			writeMaterialAttributtes("BlendColor", "double", "[1,1,1]");

			writeMaterialAttributtes("Transparency", "double", QString::number(1.0 - pMaterial->opacity()));
			double specularExponent= pMaterial->shininess() / 128.0;
			writeMaterialAttributtes("SpecularExponent", "double", QString::number(specularExponent));
			writeMaterialAttributtes("DiffuseColor", "double", colorToString(pMaterial->diffuseColor()));
			writeMaterialAttributtes("SpecularColor", "double", colorToString(pMaterial->specularColor()));
			writeMaterialAttributtes("AmbientColor", "double", colorToString(pMaterial->ambientColor()));
			writeMaterialAttributtes("EmissiveColor", "double", colorToString(pMaterial->emissiveColor()));
			if (pMaterial->hasTexture())
			{
				Q_ASSERT(m_MaterialIdTo3dxmlImageId.contains(pMaterial->id()));
				const QString imageId(QString::number(m_MaterialIdTo3dxmlImageId.value(pMaterial->id())));

				writeMaterialAttributtes("TextureImage", "external", "urn:3DXML:CATRepImage.3dxml#" + imageId);
			}
		m_pOutStream->writeEndElement(); // Feature
	m_pOutStream->writeEndElement(); // Osm
	m_pOutStream->writeEndDocument();
}
Example #15
0
File: fuse.c Project: zmike/compiz
/* MULTIDPYERROR: only works with one or less displays present */
static char *
fuseGetStringFromInode(FuseInode *inode)
{
   CompOption *option;
   char str[256];

   if (!inode->parent)
     return NULL;

   option = fuseGetOptionFromInode(inode->parent);
   if (!option)
     return NULL;

   if (inode->flags & FUSE_INODE_FLAG_TRUNC)
     return strdup("");

   if (inode->type & FUSE_INODE_TYPE_TYPE)
     {
        return strdup(optionTypeToString(option->type));
     }
   else if (inode->type & (FUSE_INODE_TYPE_VALUE | FUSE_INODE_TYPE_ITEM_VALUE))
     {
        CompOptionValue *value = NULL;
        CompOptionType type;

        if (inode->type & FUSE_INODE_TYPE_ITEM_VALUE)
          {
             int i;

             if (sscanf(inode->name, "value%d", &i))
               {
                  if (i < option->value.list.nValue)
                    {
                       value = &option->value.list.value[i];
                       type = option->value.list.type;
                    }
               }
          }
        else
          {
             value = &option->value;
             type = option->type;
          }

        if (value)
          {
             switch (type)
               {
                case CompOptionTypeBool:
                  return strdup(value->b ? "true" : "false");

                case CompOptionTypeInt:
                  snprintf(str, 256, "%d", value->i);
                  return strdup(str);

                case CompOptionTypeFloat:
                  snprintf(str, 256, "%f", value->f);
                  return strdup(str);

                case CompOptionTypeString:
                  return strdup(value->s);

                case CompOptionTypeColor:
                  return colorToString(value->c);

                case CompOptionTypeKey:
                  if (core.displays)
                    return keyActionToString(core.displays, &value->action);

                case CompOptionTypeButton:
                  if (core.displays)
                    return buttonActionToString(core.displays,
                                                &value->action);

                case CompOptionTypeEdge:
                  return edgeMaskToString(value->action.edgeMask);

                case CompOptionTypeBell:
                  return strdup(value->action.bell ? "true" : "false");

                case CompOptionTypeMatch:
                  return matchToString(&value->match);

                default:
                  break;
               }
          }
     }
   else if (inode->type & FUSE_INODE_TYPE_MIN)
     {
        if (option->type == CompOptionTypeInt)
          snprintf(str, 256, "%d", option->rest.i.min);
        else
          snprintf(str, 256, "%f", option->rest.f.min);

        return strdup(str);
     }
   else if (inode->type & FUSE_INODE_TYPE_MAX)
     {
        if (option->type == CompOptionTypeInt)
          snprintf(str, 256, "%d", option->rest.i.max);
        else
          snprintf(str, 256, "%f", option->rest.f.max);

        return strdup(str);
     }
   else if (inode->type & FUSE_INODE_TYPE_PRECISION)
     {
        snprintf(str, 256, "%f", option->rest.f.precision);
        return strdup(str);
     }
   else if (inode->type & FUSE_INODE_TYPE_ITEM_COUNT)
     {
        snprintf(str, 256, "%d", option->value.list.nValue);
        return strdup(str);
     }
   else if (inode->type & FUSE_INODE_TYPE_ITEM_TYPE)
     {
        return strdup(optionTypeToString(option->value.list.type));
     }

   return NULL;
}
Example #16
0
QString BaseStateAbstract::write(QColor color)
{
    return colorToString(color);
}