示例#1
0
void XmlPListSerializer::RenderList(const QString &sName,
                                    const QVariantList &list)
{
    bool array = true;
    if (!list.isEmpty())
    {
        QVariant::Type t = list[0].type();
        QListIterator<QVariant> it(list);
        while (it.hasNext())
        {
            if (it.next().type() != t)
            {
                array = false;
                break;
            }
        }
    }

    QString sItemName = GetItemName(sName);
    m_pXmlWriter->writeTextElement("key", sName);
    m_pXmlWriter->writeStartElement(array ? "array" : "dict");

    QListIterator<QVariant> it(list);
    while (it.hasNext())
        RenderValue(sItemName, it.next(), !array);

    m_pXmlWriter->writeEndElement();
}
示例#2
0
void XmlPListSerializer::AddProperty(const QString &sName,
                                     const QVariant &vValue,
                                     const QMetaObject *pMetaParent,
                                     const QMetaProperty *pMetaProp)
{
    RenderValue(sName, vValue);
}
示例#3
0
void JSONSerializer::AddProperty( const QString       &sName, 
                                  const QVariant      &vValue,
                                  const QMetaObject   */*pMetaParent*/,
                                  const QMetaProperty */*pMetaProp*/ )
{
    if (m_bCommaNeeded)
        m_Stream << ", ";

    m_Stream << "\"" << sName << "\": ";

    RenderValue( vValue );

    m_bCommaNeeded = true;
}
示例#4
0
void XmlPListSerializer::RenderMap(const QString &sName,
                                   const QVariantMap &map)
{
    QString sItemName = GetItemName(sName);
    m_pXmlWriter->writeTextElement("key", sItemName);
    m_pXmlWriter->writeStartElement("dict");

    QMapIterator<QString,QVariant> it(map);
    while (it.hasNext())
    {
        it.next();
        RenderValue(it.key(), it.value());
    }

    m_pXmlWriter->writeEndElement();
}
示例#5
0
void JSONSerializer::RenderList( const QVariantList &list )
{
    bool bFirst = true;

    m_Stream << "[";

    QListIterator< QVariant > it( list );

    while (it.hasNext())
    {
        if (bFirst)
            bFirst = false;
        else
            m_Stream << ",";

        RenderValue( it.next() );
    }

    m_Stream << "]";
}
void OptionListRenderer::RenderEntry(std::ostream &reply, Context &c, const ROAnything &config, const ROAnything &entryRendererConfig, const ROAnything &listItem, Anything &anyRenderState)
{
	StartTrace(OptionListRenderer.RenderEntry);
	ROAnything value;
	TraceAny(listItem, "listItem");
	reply << "<option";
	{
		PrintOptions3(reply, c, config);
		if ( config.LookupPath(value, "ValueRenderer") ) {
			RenderValue(reply, c, config, value, listItem);
		}
		if ( config.LookupPath(value, "SelectedRenderer") ) {
			RenderSelected(reply, c, config, value, listItem);
		}
	}
	reply << ">";
	if ( config.LookupPath(value, "TextRenderer") ) {
		RenderText(reply, c, config, value, listItem);
	}
	reply << "</option>\n";
}
示例#7
0
void
GaugeVario::OnPaintBuffer(Canvas &canvas)
{
  const PixelRect rc = GetClientRect();
  const unsigned width = rc.right - rc.left;
  const unsigned height = rc.bottom - rc.top;

  if (!IsPersistent() || !layout_initialised) {
    unsigned value_height = 4 + look.value_font->GetCapitalHeight()
      + look.text_font->GetCapitalHeight();

    middle_position.y = offset.y - value_height / 2;
    middle_position.x = rc.right;
    top_position.y = middle_position.y - value_height;
    top_position.x = rc.right;
    bottom_position.y = middle_position.y + value_height;
    bottom_position.x = rc.right;

    canvas.Stretch(rc.left, rc.top, width, height,
                   look.background_bitmap,
                   look.background_x, 0, 58, 120);

    layout_initialised = true;
  }

  if (Settings().show_average) {
    // JMW averager now displays netto average if not circling
    if (!Calculated().circling) {
      RenderValue(canvas, top_position.x, top_position.y, &value_top, &label_top,
                  Units::ToUserVSpeed(Calculated().netto_average),
                  _T("NetAvg"));
    } else {
      RenderValue(canvas, top_position.x, top_position.y,
                  &value_top, &label_top,
                  Units::ToUserVSpeed(Calculated().average), _T("Avg"));
    }
  }

  if (Settings().show_mc) {
    fixed mc = Units::ToUserVSpeed(GetGlidePolar().GetMC());
    RenderValue(canvas, bottom_position.x, bottom_position.y,
                &value_bottom, &label_bottom,
                mc,
                GetComputerSettings().task.auto_mc ? _T("Auto MC") : _T("MC"));
  }

  if (Settings().show_speed_to_fly)
    RenderSpeedToFly(canvas, rc.right - 11, (rc.top + rc.bottom) / 2);
  else
    RenderClimb(canvas);

  if (Settings().show_ballast)
    RenderBallast(canvas);

  if (Settings().show_bugs)
    RenderBugs(canvas);

  dirty = false;
  int ival, sval, ival_av = 0;
  static int vval_last = 0;
  static int sval_last = 0;
  static int ival_last = 0;

  fixed vval = Basic().brutto_vario;
  ival = ValueToNeedlePos(fixed(vval));
  sval = ValueToNeedlePos(Calculated().sink_rate);
  if (Settings().show_average_needle) {
    if (!Calculated().circling)
      ival_av = ValueToNeedlePos(Calculated().netto_average);
    else
      ival_av = ValueToNeedlePos(Calculated().average);
  }

  // clear items first

  if (Settings().show_average_needle) {
    if (!IsPersistent() || ival_av != ival_last)
      RenderNeedle(canvas, ival_last, true, true);

    ival_last = ival_av;
  }

  if (!IsPersistent() || (sval != sval_last) || (ival != vval_last))
    RenderVarioLine(canvas, vval_last, sval_last, true);

  sval_last = sval;

  if (!IsPersistent() || ival != vval_last)
    RenderNeedle(canvas, vval_last, false, true);

  vval_last = ival;

  // now draw items
  RenderVarioLine(canvas, ival, sval, false);
  if (Settings().show_average_needle)
    RenderNeedle(canvas, ival_av, true, false);

  RenderNeedle(canvas, ival, false, false);

  if (Settings().show_gross) {
    fixed vvaldisplay = Clamp(Units::ToUserVSpeed(vval),
                              fixed(-99.9), fixed(99.9));

    RenderValue(canvas, middle_position.x, middle_position.y,
                &value_middle, &label_middle,
                vvaldisplay,
                _T("Gross"));
  }

  RenderZero(canvas);
}
示例#8
0
string
EnumTypeHandler::GetReturnValue(Context &context, uint64 value)
{
	return RenderValue(context, value);
}
示例#9
0
string
EnumTypeHandler::GetParameterValue(Context &context, Parameter *,
				   const void *address)
{
	return RenderValue(context, get_value<unsigned int>(address));
}