Пример #1
0
bool StJpegParser::setupJps(const StFormatEnum theFormat) {
    if(myBuffer == NULL) {
        return false;
    }

    if(myOffsets[Offset_Jps] == 0) {
        if(myOffsets[Offset_Dqt] == 0) {
            return false;
        }

        // insert section right after DQT
        const StCString THE_APP_DESC = stCString("Written by sView");
        const uint16_t  aDqtLen  = StAlienData::Get16uBE(myBuffer + myOffsets[Offset_Dqt] + 2);
        const ptrdiff_t anOffset = myOffsets[Offset_Dqt] + aDqtLen + 2;
        const uint16_t  aJpsLen  = 16 + 2 + ((uint16_t )THE_APP_DESC.Size + 1);
        if(!insertSection(M_APP3, aJpsLen, anOffset)) {
            return false;
        }

        myOffsets[Offset_Jps] = anOffset;
        stUByte_t* aData = myBuffer + anOffset + 2;
        stMemCpy(aData + 2, "_JPSJPS_", 8);
        StAlienData::Set16uBE(aData + 10, 4);
        StAlienData::Set32uBE(aData + 12, 0);
        StAlienData::Set16uBE(aData + 16, (uint16_t )THE_APP_DESC.Size);
        stMemCpy(aData + 18, THE_APP_DESC.String, THE_APP_DESC.Size + 1);
    } else if(myStFormat == theFormat) {
        return false;
    }

    myStFormat = theFormat;
    uint32_t aStereoDesc = 0x00000001;
    switch(theFormat) {
        case ST_V_SRC_PARALLEL_PAIR:
            aStereoDesc |= SD_LAYOUT_SIDEBYSIDE | SD_LEFT_FIELD_FIRST;
            break;
        case ST_V_SRC_SIDE_BY_SIDE:
            aStereoDesc |= SD_LAYOUT_SIDEBYSIDE;
            break;
        case ST_V_SRC_OVER_UNDER_LR:
            aStereoDesc |= SD_LAYOUT_OVERUNDER | SD_LEFT_FIELD_FIRST;
            break;
        case ST_V_SRC_OVER_UNDER_RL:
            aStereoDesc |= SD_LAYOUT_OVERUNDER;
            break;
        case ST_V_SRC_ROW_INTERLACE:
            aStereoDesc |= SD_LAYOUT_INTERLEAVED;
            break;
        case ST_V_SRC_ANAGLYPH_RED_CYAN:
            aStereoDesc |= SD_LAYOUT_ANAGLYPH;
            break;
        case ST_V_SRC_MONO:
        default:
            aStereoDesc = 0x00000000;
            break;
    }

    StAlienData::Set32uBE(myBuffer + myOffsets[Offset_Jps] + 2 + 8 + 2 + 2, aStereoDesc);
    return true;
}
Пример #2
0
iniparser &iniparser::operator+=(const iniparser &rhs)
{
    // merge rhs into us (without overwriting existing entries)
    for (std::pair<std::string, std::map<std::string, std::string> > section : rhs.options)
        insertSection(section);
    return *this;
}
Пример #3
0
ReportWindow::ReportWindow(ReportGridOptions * rgo, QWidget * parent, const char * name)
  : Q3MainWindow(parent, name, Qt::WDestructiveClose) {
    lastSaveToDb = FALSE;
    dbRecordGrade = -1;
    _modified = FALSE;
    _handler = 0;
    setCaption();
    setIcon(QPixmap(document_xpm));

    qsList = new QuerySourceList();
    pageOptions = new ReportPageOptions();
    gridOptions = rgo;

    rptHead = rptFoot = 0;
    pageHeadFirst = pageHeadOdd = pageHeadEven = pageHeadLast = pageHeadAny = 0;
    pageFootFirst = pageFootOdd = pageFootEven = pageFootLast = pageFootAny = 0;

    // Set default Watermark Properties
    _wmOpacity = 25;
    _wmFont = QFont("Arial");
    _wmUseDefaultFont = true;
    _wmUseStaticText = true;
    _wmText = QString::null;
    _wmColumn = QString::null;
    _wmQuery = QString::null;

    // Set default Background Properties
    _bgEnabled = false;
    _bgStatic = true;
    _bgImage = QString::null;
    _bgQuery = QString::null;
    _bgColumn = QString::null;
    _bgResizeMode = "clip";
    _bgAlign = Qt::AlignLeft | Qt::AlignTop;
    _bgBoundsX = 100;
    _bgBoundsY = 100;
    _bgBoundsWidth = 650;
    _bgBoundsHeight = 900;
    _bgOpacity = 25;

    Q3ScrollView * sv = new Q3ScrollView(this);
    sv->setHScrollBarMode(Q3ScrollView::AlwaysOn);
    sv->setVScrollBarMode(Q3ScrollView::AlwaysOn);
    vbox = new QWidget(sv->viewport());
    vboxlayout = new QVBoxLayout(vbox);
    vboxlayout->setSpacing(0);
    vboxlayout->setMargin(0);
     
    ReportSectionDetail * rsd = new ReportSectionDetail(this,vbox);
    insertSection(detailSectionCount(), rsd);

    vbox->setLayout(vboxlayout);
    sv->addChild(vbox);
    setCentralWidget(sv);

    connect(pageOptions, SIGNAL(pageOptionsChanged()), this, SLOT(setModified()));
    connect(qsList, SIGNAL(updated()), this, SLOT(setModified()));
}
Пример #4
0
ScreenProperties::ScreenProperties(QWidget *parent) :
	PropertyTree(parent)
{
	PropertyItem *section = insertSection(tr("Screen"));

	width = new PropertyItem(0);
	height = new PropertyItem(0);
	section->appendRow(tr("width"), width);
	section->appendRow(tr("height"), height);
}
Пример #5
0
iniparser::iniparser(const std::string &path) : options()
{
    std::ifstream ifs(path.c_str());
    if (ifs.is_open()) {
        std::string line;
        std::string currentSection = "";
        std::map<std::string, std::string> currentOptions;
        while (ifs.good()) {
            std::getline(ifs, line);
            line = trim(line);

            // it's a comment
            if (line.front() == '#' || line.front() == ';')
                continue;

            // it's a section
            if (line.front() == '[' && line.back() == ']') {
                // insert options from old sections into map
                insertSection(std::pair<std::string, std::map<std::string, std::string> >(currentSection, currentOptions));
                currentOptions.clear();

                currentSection = line.substr(1, line.length() - 2); // remove [ and ]
                currentSection = trim(currentSection);
                continue;
            }
            
            size_t pos = line.find_first_of("=");
            if (pos == std::string::npos) // no key = value pair
                continue;

            std::string key = line.substr(0, pos), value = line.substr(pos + 1);
            key = toLower(trim(key));
            value = trim(value);
            currentOptions.insert(std::pair<std::string, std::string>(key, value));
        }
        insertSection(std::pair<std::string, std::map<std::string, std::string> >(currentSection, currentOptions));
        ifs.close();
    }
}
Пример #6
0
void ORGraphicsSectionDetail::initFromXML(QDomNode & section)
{
  QDomNodeList nl = section.childNodes();
  QDomNode node;
  QString n;

  // some code to handle old style defs
  QString o_name = "unnamed";
  QString o_column = QString::null;
  bool old_head = FALSE;
  QDomNode o_head;
  bool old_foot = FALSE;
  QDomNode o_foot;

  for(int i = 0; i < nl.count(); i++) {
    node = nl.item(i);
    n = node.nodeName();
    if(n == "name") {
      o_name = node.firstChild().nodeValue();
      setTitle(o_name);
    } else if(n == "pagebreak") {
      QDomElement eThis = node.toElement();
      if(eThis.attribute("when") == "at end")
        setPageBreak(BreakAtEnd);
    } else if(n == "group") {
      ORGraphicsSectionDetailGroup * rsdg = new ORGraphicsSectionDetailGroup("unnamed", this, this);
      QDomNodeList gnl = node.childNodes();
      QDomNode gnode;
      bool show_head = FALSE;
      bool show_foot = FALSE;
      for(int gi = 0; gi < gnl.count(); gi++) {
        gnode = gnl.item(gi);
        if(gnode.nodeName() == "name") {
          rsdg->setTitle(gnode.firstChild().nodeValue());
        } else if(gnode.nodeName() == "column") {
          rsdg->setColumn(gnode.firstChild().nodeValue());
        } else if(gnode.nodeName() == "pagebreak") {
          QDomElement elemThis = gnode.toElement();
          QString n = elemThis.attribute("when");
          if("after foot" == n)
            rsdg->setPageBreak(ORGraphicsSectionDetailGroup::BreakAfterGroupFooter);
        } else if(gnode.nodeName() == "head") {
          rsdg->getGroupHead()->initFromXML(gnode);
          rsdg->showGroupHead(TRUE);
          show_head = TRUE;
        } else if(gnode.nodeName() == "foot") {
          rsdg->getGroupFoot()->initFromXML(gnode);
          rsdg->showGroupFoot(TRUE);
          show_foot = TRUE;
        } else {
          qDebug("encountered unknown element while parsing group element: %s", gnode.nodeName().toLatin1().constData());
        }
      }
      insertSection(groupSectionCount(), rsdg);
      rsdg->showGroupHead(show_head);
      rsdg->showGroupFoot(show_foot);
    } else if(n == "grouphead") {
      o_head = node;
      old_head = TRUE;
    } else if(n == "groupfoot") {
      o_foot = node;
      old_foot = TRUE;
    } else if(n == "detail") {
      // need to pull out the query key values
      QDomNode key = node.namedItem("key");
      if(key.isNull()) {
        qDebug("Did not find a key element while parsing detail section");
      } else {
        QDomNodeList knl = key.childNodes();
        QDomNode knode;
        for(int ki = 0; ki < knl.count(); ki++) {
          knode = knl.item(ki);
          if(knode.nodeName() == "query") {
            setQuery(knode.firstChild().nodeValue());
          } else if(knode.nodeName() == "column") {
            o_column = knode.firstChild().nodeValue();
          } else {
            qDebug("encountered unknown element while parsing key element: %s", knode.nodeName().toLatin1().constData());
          }
        }
      }
      _detail->initFromXML(node);
    } else {
      // unknown element
      qDebug("while parsing section encountered and unknown element: %s", n.toLatin1().constData());
    }
  }

  if(old_head || old_foot) {
    ORGraphicsSectionDetailGroup * rsdg = new ORGraphicsSectionDetailGroup(o_name, this, this);

    rsdg->setColumn(o_column);
    if(old_head)
      rsdg->getGroupHead()->initFromXML(o_head);
    if(old_foot)
      rsdg->getGroupFoot()->initFromXML(o_foot);

    // if we encountered this situation then we shouldn't have
    // any other sections but to be sure we will just tack this one
    // onto the end
    insertSection(groupSectionCount(), rsdg);

    rsdg->showGroupHead(old_head);
    rsdg->showGroupFoot(old_foot);
  }
}