Ejemplo n.º 1
0
OutputImageParams::PartialXform::PartialXform(QDomElement const& el)
:	m_11(el.namedItem("m11").toElement().text().toDouble()),
	m_12(el.namedItem("m12").toElement().text().toDouble()),
	m_21(el.namedItem("m21").toElement().text().toDouble()),
	m_22(el.namedItem("m22").toElement().text().toDouble())
{
}
Ejemplo n.º 2
0
QgsRectangle QgsXmlUtils::readRectangle( const QDomElement& element )
{
  QgsRectangle aoi;

  QDomNode xminNode = element.namedItem( "xmin" );
  QDomNode yminNode = element.namedItem( "ymin" );
  QDomNode xmaxNode = element.namedItem( "xmax" );
  QDomNode ymaxNode = element.namedItem( "ymax" );

  QDomElement exElement = xminNode.toElement();
  double xmin = exElement.text().toDouble();
  aoi.setXMinimum( xmin );

  exElement = yminNode.toElement();
  double ymin = exElement.text().toDouble();
  aoi.setYMinimum( ymin );

  exElement = xmaxNode.toElement();
  double xmax = exElement.text().toDouble();
  aoi.setXMaximum( xmax );

  exElement = ymaxNode.toElement();
  double ymax = exElement.text().toDouble();
  aoi.setYMaximum( ymax );

  return aoi;
}
Ejemplo n.º 3
0
void XDNet::processInit(QDomElement& init)
{

  QDomElement engine = init.namedItem("engine").toElement();
  QDomElement author = init.namedItem("author").toElement();
  QDomElement url = init.namedItem("url").toElement();
  QDomElement copyright = init.namedItem("copyright").toElement();

  kdDebug() << engine.text()
  << ": "
  << url.text()
  << " "
  << copyright.text()
  << endl;


  //setup stdout/sterr:

  QString stdout = "stdout -i 1 -c 1";//copy stdout to IDE
  m_socket->writeBlock(stdout, stdout.length()+1);

  QString stderr = "stderr -i 1 -c 1";//copy stderr to IDE
  m_socket->writeBlock(stderr, stderr.length()+1);

  if(m_debugger->settings()->breakOnLoad())
  {
    requestStepInto();
  }
  else
  {
    requestContinue();
  }
}
Ejemplo n.º 4
0
KPIM::FolderLister::ContentType GroupDavGlobals::getContentType(const QDomNode &folderNode)
{
    QDomNode n4;
    kdDebug() << "GroupDavGlobals::getContentType(...)" << endl;
    int type = KPIM::FolderLister::Unknown;
    for(n4 = folderNode.firstChild(); !n4.isNull(); n4 = n4.nextSibling())
    {
        QDomElement e = n4.toElement();

        if(e.tagName() == "resourcetype")
        {
            if(!e.namedItem("vevent-collection").isNull())
                type |= KPIM::FolderLister::Event;
            if(!e.namedItem("vtodo-collection").isNull())
                type |= KPIM::FolderLister::Todo;
            if(!e.namedItem("vjournal-collection").isNull())
                type |= KPIM::FolderLister::Journal;
            if(!e.namedItem("vcard-collection").isNull())
                type |= KPIM::FolderLister::Contact;
            if((type == KPIM::FolderLister::Unknown) &&
                    !(e.namedItem("collection").isNull()))
                type |= KPIM::FolderLister::Folder;
        }
    }
    return (KPIM::FolderLister::ContentType)type;
}
Ejemplo n.º 5
0
// Author & Date: Ehsan Azar       23 Aug 2011
// Purpose: Check if a node exists
// Inputs:
//   nodeName  - the node tag (it can be in the form of relative/path/to/node)
// Outputs:
//   Returns true if the current node contains the given node
bool XmlFile::contains(const QString & nodeName)
{
    QDomElement parent; // parent element
    QDomElement set;

    QStringList nodepath = nodeName.split("/");
    int level = nodepath.count();

    // If it is the first node
    if (m_nodes.isEmpty())
    {
        set = m_doc.namedItem(nodepath[0]).toElement();
    } else {
        // Get the parent node
        parent = m_nodes.last();
        // Look if the node exists then get it
        set = parent.namedItem(nodepath[0]).toElement();
    }
    if (set.isNull())
        return false; // not found

    // Look for higher levels
    for (int i = 1; i < level; ++i)
    {
        parent = set;
        set = parent.namedItem(nodepath[i]).toElement();
        if (set.isNull())
            return false; // not found
    }
    return true;
}
Ejemplo n.º 6
0
void UPnpDeviceDesc::ProcessServiceList( QDomNode oListNode, UPnpDevice *pDevice )
{
    for ( QDomNode oNode = oListNode.firstChild();
                  !oNode.isNull();
                   oNode = oNode.nextSibling() )
    {
        QDomElement e = oNode.toElement();

        if (!e.isNull())
        {
            if ( e.tagName() == "service" )
            {
                UPnpService *pService = new UPnpService();
                pDevice->m_listServices.append( pService );

                SetStrValue( e.namedItem( "serviceType" ),
                             pService->m_sServiceType     );
                SetStrValue( e.namedItem( "serviceId"   ),
                             pService->m_sServiceId       );
                SetStrValue( e.namedItem( "SCPDURL"     ),
                             pService->m_sSCPDURL         );
                SetStrValue( e.namedItem( "controlURL"  ),
                             pService->m_sControlURL      );
                SetStrValue( e.namedItem( "eventSubURL" ),
                             pService->m_sEventSubURL     );

                VERBOSE(VB_UPNP,
                        QString("ProcessServiceList adding service : %1 : %2 :")
                        .arg(pService->m_sServiceType)
                        .arg(pService->m_sServiceId ));
            }
        }
    }
}
Ejemplo n.º 7
0
void ProjectFile::SetAttribute(QString parentTag, QString childTag, QString attribute, QString value)
{
	QDomElement parentTagElement = documentElement().namedItem(parentTag).toElement();
	if (parentTagElement.isNull())
	{
		parentTagElement = createElement(parentTag);
		documentElement().appendChild(parentTagElement);
	}

	QDomElement childTagElement = parentTagElement.namedItem(childTag).toElement();
	if (childTagElement.isNull())
	{
		childTagElement = createElement(childTag);
		parentTagElement.appendChild(childTagElement);
	}

	QDomNode attributeNode = childTagElement.namedItem(value);
	if (!attributeNode.isNull())
	{
		childTagElement.removeChild(attributeNode);
	}

	QDomElement attributeElement = createElement(attribute);
	attributeElement.appendChild(createTextNode(value));
	childTagElement.appendChild(attributeElement);

	SaveProject();
}
Ejemplo n.º 8
0
SubmitItem::SubmitItem( const QDomElement& element )
{
    m_artist = element.namedItem( "artist" ).toElement().text();
    m_album = element.namedItem( "album" ).toElement().text();
    m_title = element.namedItem( "title" ).toElement().text();
    m_length = element.namedItem( "length" ).toElement().text().toInt();
    m_playStartTime = element.namedItem( "playtime" ).toElement().text().toUInt();
}
void
EqualizerPresetManager::slotDefault()
{
    int button = KMessageBox::warningYesNo( this, i18n( "All presets will be deleted and defaults will be restored. Are you sure?" ) );

    if ( button != KMessageBox::Yes )
        return;

    // Preserve the 'Manual' preset
    QList<int> manualGains = m_presets[ i18n("Manual") ];

    // Delete all presets
    m_presets.clear();

    // Create predefined presets 'Zero' and 'Manual'
    QList<int> zeroGains;
    zeroGains << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
    m_presets[ i18n("Zero") ] = zeroGains;
    m_presets[ i18n("Manual") ] = manualGains;

    // Load the default presets
    QFile file( KStandardDirs::locate( "data", "amarok/data/equalizer_presets.xml" ) );

    QTextStream stream( &file );
    stream.setCodec( "UTF8" );

    QDomDocument d;

    if( !file.open( QIODevice::ReadOnly ) || !d.setContent( stream.readAll() ) )
        return;

    QDomNode n = d.namedItem( "equalizerpresets" ).namedItem("preset");

    for( ; !n.isNull();  n = n.nextSibling() )
    {
        QDomElement e = n.toElement();
        QString title = e.attribute( "name" );

        QList<int> gains;
        gains << e.namedItem( "b0" ).toElement().text().toInt();
        gains << e.namedItem( "b1" ).toElement().text().toInt();
        gains << e.namedItem( "b2" ).toElement().text().toInt();
        gains << e.namedItem( "b3" ).toElement().text().toInt();
        gains << e.namedItem( "b4" ).toElement().text().toInt();
        gains << e.namedItem( "b5" ).toElement().text().toInt();
        gains << e.namedItem( "b6" ).toElement().text().toInt();
        gains << e.namedItem( "b7" ).toElement().text().toInt();
        gains << e.namedItem( "b8" ).toElement().text().toInt();
        gains << e.namedItem( "b9" ).toElement().text().toInt();

        m_presets[ title ] = gains;
    }

    file.close();

    // Update listview
    setPresets( m_presets );
}
Ejemplo n.º 10
0
Params::Params(QDomElement const& el)
:	m_layout(el.namedItem("pages").toElement()),
	m_deps(el.namedItem("dependencies").toElement()),
	m_splitLineMode(
		el.attribute("mode") == "manual"
		? MODE_MANUAL : MODE_AUTO
	)
{
}
Ejemplo n.º 11
0
bool KOfficePlugin::writeInfo( const KFileMetaInfo& info) const
{
  bool no_errors = true;
  QDomDocument doc = getMetaDocument(info.path());
  QDomElement base = getBaseNode(doc).toElement();
  if (base.isNull())
    return false;
  for (int i = 0; Information[i]; i+=2)
    no_errors = no_errors &&
      writeTextNode(doc, base, Information[i],
		    info[DocumentInfo][Information[i]].value().toString());
  // If we need a meta:keywords container, we create it.
  if (base.namedItem(metakeywords).isNull())
    base.appendChild(doc.createElement(metakeywords));
  QDomNode metaKeyNode = base.namedItem(metakeywords);

  QDomNodeList childs = doc.elementsByTagName(metakeyword);
  for (int i = childs.length(); i >= 0; --i){
	  metaKeyNode.removeChild( childs.item(i) );
  }
  QStringList keywordList = QStringList::split(",", info[DocumentInfo][metakeyword].value().toString().stripWhiteSpace(), false);
  for ( QStringList::Iterator it = keywordList.begin(); it != keywordList.end(); ++it ) {
	QDomElement elem = doc.createElement(metakeyword);
	metaKeyNode.appendChild(elem);
	elem.appendChild(doc.createTextNode((*it).stripWhiteSpace()));
    }

  // Now, we store the user-defined data
  QDomNodeList theElements = base.elementsByTagName(metauserdef);
  for (uint i = 0; i < theElements.length(); i++)
    {
      QDomElement el = theElements.item(i).toElement();
      if (el.isNull()){
	kdDebug(7034) << metauserdef << " is not an Element" << endl;
	no_errors = false;
      }

      QString s = info[UserDefined][el.attribute(metaname)].value().toString();
      if (s != el.text()){
	QDomText txt = doc.createTextNode(s);
	if (!el.firstChild().isNull())
	  el.replaceChild(txt, el.firstChild());
	else
	  el.appendChild(txt);
      }
    }

  if (!no_errors){
    kdDebug(7034) << "Errors were found while building " << metafile
	     	  << " for file " << info.path() << endl;
    // It is safer to avoid to manipulate meta.xml if errors, we abort.
    return false;
  }
  writeMetaData(info.path(), doc);
  return true;
}
Ejemplo n.º 12
0
PageLayout::PageLayout(QDomElement const& layout_el)
:	m_uncutOutline(
		XmlUnmarshaller::polygonF(
			layout_el.namedItem("outline").toElement()
		)
	),
	m_cutter1(
		XmlUnmarshaller::lineF(
			layout_el.namedItem("cutter1").toElement()
		)
	),
	m_cutter2(
		XmlUnmarshaller::lineF(
			layout_el.namedItem("cutter2").toElement()
		)
	)
{
	QString const type(layout_el.attribute("type"));
	QDomElement const split_line_el(layout_el.namedItem("split-line").toElement());
	if (split_line_el.isNull()) {
		m_type = typeFromString(type);
	} else {
		// Backwards compatibility with versions < 0.9.9
		// Note that we fill in m_uncutOutline elsewhere, namely in Task::process().
		QLineF const split_line(XmlUnmarshaller::lineF(split_line_el));

		// Backwards compatibility with versions <= 0.9.1
		bool const left_page = (
			layout_el.attribute("leftPageValid") == "1"
		);
		bool const right_page = (
			layout_el.attribute("rightPageValid") == "1"
		);

		if (type == "two-pages" || (left_page && right_page)) {
			m_type = TWO_PAGES;
			m_cutter1 = split_line;
			m_cutter2 = QLineF();
		} else if (type == "left-page" || left_page) {
			m_type = SINGLE_PAGE_CUT;
			m_cutter1 = QLineF(0, 0, 0, 1); // A bit of a hack, but should work.
			m_cutter2 = split_line;
		} else if (type == "right-page" || right_page) {
			m_type = SINGLE_PAGE_CUT;
			m_cutter1 = split_line;
			m_cutter2 = QLineF();
			// This one is a special case.  We don't know the outline at this point,
			// so we make m_cutter2 null.  We'll assign the correct value to it in
			// setUncutOutline().
		} else {
			m_type = SINGLE_PAGE_UNCUT;
			m_cutter1 = QLineF();
			m_cutter2 = QLineF();
		}
	}
}
Ejemplo n.º 13
0
void
Filter::loadSettings(ProjectReader const& reader, QDomElement const& filters_el)
{
	m_ptrSettings->clear();
	
	QDomElement const filter_el(
		filters_el.namedItem("output").toElement()
	);
	
	QString const page_tag_name("page");
	QDomNode node(filter_el.firstChild());
	for (; !node.isNull(); node = node.nextSibling()) {
		if (!node.isElement()) {
			continue;
		}
		if (node.nodeName() != page_tag_name) {
			continue;
		}
		QDomElement const el(node.toElement());
		
		bool ok = true;
		int const id = el.attribute("id").toInt(&ok);
		if (!ok) {
			continue;
		}
		
		PageId const page_id(reader.pageId(id));
		if (page_id.isNull()) {
			continue;
		}
		
		ZoneSet const picture_zones(el.namedItem("zones").toElement(), m_pictureZonePropFactory);
		if (!picture_zones.empty()) {
			m_ptrSettings->setPictureZones(page_id, picture_zones);
		}

		ZoneSet const fill_zones(el.namedItem("fill-zones").toElement(), m_fillZonePropFactory);
		if (!fill_zones.empty()) {
			m_ptrSettings->setFillZones(page_id, fill_zones);
		}

		QDomElement const params_el(el.namedItem("params").toElement());
		if (!params_el.isNull()) {
			Params const params(params_el);
			m_ptrSettings->setParams(page_id, params);
		}
		
		QDomElement const output_params_el(el.namedItem("output-params").toElement());
		if (!output_params_el.isNull()) {
			OutputParams const output_params(output_params_el);
			m_ptrSettings->setOutputParams(page_id, output_params);
		}
	}
}
Ejemplo n.º 14
0
//---------------------------------------------------------------------------
bool ProjectSession::restoreFromFile( const QString & sessionFileName, const QValueList< KDevPlugin * > plugins )
{
  bool bFileOpenOK = true;

  QFile f(sessionFileName);
  if ( f.open(IO_ReadOnly) ) {  // file opened successfully
    bool ok = domdoc.setContent( &f);
    f.close();
    if (!ok) {
      KMessageBox::sorry(0L,
                         i18n("The file %1 does not contain valid XML.\n"
                         "The loading of the session failed.").arg(sessionFileName));
      initXMLTree(); // because it was now broken after failed setContent()
      return false;
    }
  }
  else {
    bFileOpenOK = false;
  }

  // Check for proper document type.
  if (domdoc.doctype().name() != "KDevPrjSession") {
    KMessageBox::sorry(0L,
    i18n("The file %1 does not contain a valid KDevelop project session ('KDevPrjSession').\n").arg(sessionFileName)
    + i18n("The document type seems to be: '%1'.").arg(domdoc.doctype().name()));
    return false;
  }

  QDomElement session = domdoc.documentElement();

  // read the information about the mainframe widget
  if (bFileOpenOK) {
    recreateDocs(session);
  }

	// now also let the plugins load their session stuff
	QDomElement pluginListEl = session.namedItem("pluginList").toElement();
	QValueList<KDevPlugin*>::ConstIterator it = plugins.begin();
	while( it != plugins.end() )
	{
		KDevPlugin* pPlugin = (*it);
		QString pluginName = pPlugin->instance()->instanceName();
		QDomElement pluginEl = pluginListEl.namedItem(pluginName).toElement();
		if (!pluginEl.isNull()) {
			// now plugin, load what you find!
			pPlugin->restorePartialProjectSession(&pluginEl);
		}
		++it;
	}

	QTimer::singleShot( 0, this, SLOT(loadDocument()) );

  return true;
}
Ejemplo n.º 15
0
void KWMailMergeDataBase::load( const QDomElement& parentElem )
{
    QDomNode dn=parentElem.namedItem("PLUGIN");
    if (dn.isNull()) return;
    QDomElement el=dn.toElement();
    plugin=loadPlugin(el.attribute("library"));

    dn=parentElem.namedItem("DATASOURCE");
    if (dn.isNull()) return;
    el=dn.toElement();
    if (plugin) plugin->load(el);
}
Ejemplo n.º 16
0
Dependencies::Dependencies(QDomElement const& deps_el)
:	m_pageOutline(
		XmlUnmarshaller::polygonF(
			deps_el.namedItem("page-outline").toElement()
		)
	),
	m_rotation(
		XmlUnmarshaller::rotation(
			deps_el.namedItem("rotation").toElement()
		)
	)
{
}
Ejemplo n.º 17
0
QDomNode StyleStack::childNode(const QString & name) const
{
    QList<QDomElement>::ConstIterator it = m_stack.end();
    while ( it != m_stack.begin() )
    {
        --it;
        QDomElement properties = searchAttribute( *it, m_nodeNames, name );
        if ( !properties.namedItem( name ).isNull() )
            return properties.namedItem( name );
    }

    return QDomNode();          // a null node
}
Ejemplo n.º 18
0
QDomElement KoStyleStack::childNode(const QString & name) const
{
    QValueList<QDomElement>::ConstIterator it = m_stack.end();

    while ( it != m_stack.begin() )
    {
        --it;
        QDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement();
        if ( !properties.namedItem( name ).isNull() )
            return properties.namedItem( name ).toElement();
    }

    return QDomElement();          // a null element
}
Ejemplo n.º 19
0
void QgsEditorWidgetRegistry::readMapLayer( QgsMapLayer* mapLayer, const QDomElement& layerElem )
{
  if ( mapLayer->type() != QgsMapLayer::VectorLayer )
  {
    return;
  }

  QgsVectorLayer* vectorLayer = qobject_cast<QgsVectorLayer*>( mapLayer );
  Q_ASSERT( vectorLayer );

  QDomNodeList editTypeNodes = layerElem.namedItem( "edittypes" ).childNodes();

  for ( int i = 0; i < editTypeNodes.size(); i++ )
  {
    QDomNode editTypeNode = editTypeNodes.at( i );
    QDomElement editTypeElement = editTypeNode.toElement();

    QString name = editTypeElement.attribute( "name" );

    int idx = vectorLayer->fieldNameIndex( name );
    if ( idx == -1 )
      continue;

    QString ewv2Type = editTypeElement.attribute( "widgetv2type" );
    QgsEditorWidgetConfig cfg;

    if ( mWidgetFactories.contains( ewv2Type ) )
    {
      vectorLayer->editFormConfig()->setWidgetType( idx, ewv2Type );
      QDomElement ewv2CfgElem = editTypeElement.namedItem( "widgetv2config" ).toElement();

      if ( !ewv2CfgElem.isNull() )
      {
        cfg = mWidgetFactories[ewv2Type]->readEditorConfig( ewv2CfgElem, vectorLayer, idx );
      }

      vectorLayer->editFormConfig()->setReadOnly( idx, ewv2CfgElem.attribute( "fieldEditable", "1" ) != "1" );
      vectorLayer->editFormConfig()->setLabelOnTop( idx, ewv2CfgElem.attribute( "labelOnTop", "0" ) == "1" );
      vectorLayer->editFormConfig()->setNotNull( idx, ewv2CfgElem.attribute( "notNull", "0" ) == "1" );
      vectorLayer->editFormConfig()->setExpression( idx, ewv2CfgElem.attribute( "constraint", QString() ) );
      vectorLayer->editFormConfig()->setExpressionDescription( idx, ewv2CfgElem.attribute( "constraintDescription", QString() ) );

      vectorLayer->editFormConfig()->setWidgetConfig( idx, cfg );
    }
    else
    {
      QgsMessageLog::logMessage( tr( "Unknown attribute editor widget '%1'" ).arg( ewv2Type ) );
    }
  }
}
Ejemplo n.º 20
0
Params::Params(QDomElement const& filter_el)
:	m_contentRect(
		XmlUnmarshaller::rectF(
			filter_el.namedItem("content-rect").toElement()
		)
	),
	m_contentSizeMM(
		XmlUnmarshaller::sizeF(
			filter_el.namedItem("content-size-mm").toElement()
		)
	),
	m_deps(filter_el.namedItem("dependencies").toElement()),
	m_mode(filter_el.attribute("mode") == "manual" ? MODE_MANUAL : MODE_AUTO)
{
}
Ejemplo n.º 21
0
// KOffice-1.3 format
bool KoDocumentInfoAbout::load( const QDomElement& e )
{
    QDomNode n = e.namedItem( "about" ).firstChild();
    for( ; !n.isNull(); n = n.nextSibling()  )
    {
        QDomElement e = n.toElement();
        if ( e.isNull() ) continue;
        if ( e.tagName() == "abstract" )
            m_abstract = e.text();
        else if ( e.tagName() == "title" )
            m_title = e.text();
        else if ( e.tagName() == "subject" )
            m_subject = e.text();
        else if ( e.tagName() == "keyword" )
            m_keywords = e.text();
        else if ( e.tagName() == "initial-creator" )
            m_initialCreator = e.text();
        else if ( e.tagName() == "editing-cycles" )
            m_editingCycles = e.text().toInt();
        else if ( e.tagName() == "creation-date" )
            m_creationDate = QDateTime::fromString( e.text(), Qt::ISODate );
        else if ( e.tagName() == "date" )
            m_modificationDate = QDateTime::fromString( e.text(), Qt::ISODate );
    }

    return true;
}
Ejemplo n.º 22
0
void KWMailMergeKABC::load( QDomElement& parentElem )
{
    clear();
    QDomNode contentNode=parentElem.namedItem("CONTENT");
    if( contentNode.isNull() )
        return;
    for( QDomNode rec=contentNode.firstChild(); !rec.isNull(); rec=rec.nextSibling() )
    {
        if( rec.nodeName()== "RECORD" )
        {
            for( QDomElement recEnt=rec.firstChild().toElement(); !recEnt.isNull();
                    recEnt=recEnt.nextSibling().toElement() )
            {
                addEntry( recEnt.attribute( QString::fromLatin1("uid") ) );
            }
        }
        else if( rec.nodeName() == "LIST" )
        {
            for( QDomElement recEnt=rec.firstChild().toElement(); !recEnt.isNull();
                    recEnt=recEnt.nextSibling().toElement() )
            {
                addList( recEnt.attribute( QString::fromLatin1("listid") ) );
            }
        }
        else
            kdDebug() << "rec.nodeName(): " << rec.nodeName() << endl;
    }
}
Ejemplo n.º 23
0
QLineF
XmlUnmarshaller::lineF(QDomElement const& el)
{
	QPointF const p1(pointF(el.namedItem("p1").toElement()));
	QPointF const p2(pointF(el.namedItem("p2").toElement()));
	return QLineF(p1, p2);
}
Ejemplo n.º 24
0
bool QgsLayoutObject::readObjectPropertiesFromElement( const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext & )
{
  Q_UNUSED( document );
  if ( parentElement.isNull() )
  {
    return false;
  }

  QDomNodeList objectNodeList = parentElement.elementsByTagName( QStringLiteral( "LayoutObject" ) );
  if ( objectNodeList.size() < 1 )
  {
    return false;
  }
  QDomElement objectElement = objectNodeList.at( 0 ).toElement();

  QDomNode propsNode = objectElement.namedItem( QStringLiteral( "dataDefinedProperties" ) );
  if ( !propsNode.isNull() )
  {
    mDataDefinedProperties.readXml( propsNode.toElement(), sPropertyDefinitions );
  }

  //custom properties
  mCustomProperties.readXml( objectElement );

  return true;
}
Ejemplo n.º 25
0
QString ProjectFile::GetAttribute(QString parentTag, QString childTag, QString attribute)
{
	QDomElement parentTagElement = documentElement().namedItem(parentTag).toElement();
	if (!parentTagElement.isNull())
	{
		QDomElement childTagElement = parentTagElement.namedItem(childTag).toElement();
		if (!childTagElement.isNull())
		{
			QDomElement attributeElement = childTagElement.namedItem(attribute).toElement();
			if (!attributeElement.isNull())
			{
				return attributeElement.text();
			}
		}
	}
	return QString();
}
Ejemplo n.º 26
0
void MainWindow::loadData()
{
    QFile file(settings["xsplitPath"] + "streamcontrol.xml");
    file.open(QIODevice::ReadOnly | QIODevice::Text);

    QDomDocument doc;
    doc.setContent(&file);

    file.close();

    QDomElement items = doc.namedItem("items").toElement();

    QDomElement pName1 = items.namedItem("pName1").toElement();
    QDomElement pName2 = items.namedItem("pName2").toElement();
    QDomElement pScore1 = items.namedItem("pScore1").toElement();
    QDomElement pScore2 = items.namedItem("pScore2").toElement();
    QDomElement rounds = items.namedItem("rounds").toElement();
    QDomElement srText = items.namedItem("srText").toElement();
    QDomElement cTitle1 = items.namedItem("cTitle1").toElement();
    QDomElement cTitle2 = items.namedItem("cTitle2").toElement();
    QDomElement mText1 = items.namedItem("mText1").toElement();
    QDomElement mText2 = items.namedItem("mText2").toElement();
    QDomElement mText3 = items.namedItem("mText3").toElement();
    QDomElement mText4 = items.namedItem("mText4").toElement();
    QDomElement game = items.namedItem("game").toElement();
    QDomElement p1c = items.namedItem("p1c").toElement();
    QDomElement p2c = items.namedItem("p2c").toElement();

    ui->pName1->setText(pName1.text());
    ui->pScore1->setValue(pScore1.text().toInt());
    ui->pName2->setText(pName2.text());
    ui->pScore2->setValue(pScore2.text().toInt());
    ui->rounds->setValue(rounds.text().toInt());
    ui->srText->setText(srText.text());
    ui->cTitle1->setText(cTitle1.text());
    ui->cTitle2->setText(cTitle2.text());
    ui->mText1->setText(mText1.text());
    ui->mText2->setText(mText2.text());
    ui->mText3->setText(mText3.text());
    ui->mText4->setText(mText4.text());

    int gameIndex = gameComboBox->findText(game.text());
    if (gameIndex != -1) {
        gameComboBox->setCurrentIndex(gameIndex);
    } else if (game.text() != "") {
        gameComboBox->addItem(game.text());
        gameComboBox->setCurrentIndex(gameComboBox->findText(game.text()));
        saveSettings();
    }
    int p1CIndex = ui->p1Color->findText(p1c.text());
    ui->p1Color->setCurrentIndex(p1CIndex);
    int p2CIndex = ui->p2Color->findText(p2c.text());
    ui->p2Color->setCurrentIndex(p2CIndex);

}
Ejemplo n.º 27
0
bool GroupDavGlobals::getFolderHasSubs(const QDomNode &folderNode)
{
    // a folder is identified by the collection item in the resourcetype:
    // <a:resourcetype xmlns:a="DAV:"><a:collection xmlns:a="DAV:"/>...</a:resourcetype>
    QDomElement e = folderNode.namedItem("resourcetype").toElement();
    if(!e.namedItem("collection").isNull())
        return true;
    else return false;
}
Ejemplo n.º 28
0
KPIM::FolderLister::ContentType GroupDavGlobals::getContentType(const QDomElement &prop)
{
    QDomElement ctype = prop.namedItem("getcontenttype").toElement();
    if(ctype.isNull()) return KPIM::FolderLister::Unknown;
    const QString &type = ctype.text();
    kdDebug() << "Found content type: " << type << endl;
    /// TODO: Not yet implemented in GroupDav!
    return KPIM::FolderLister::Unknown;
}
Ejemplo n.º 29
0
Archivo: data.cpp Proyecto: shliu/UKY
Data::Data(const QDomElement& element){
  m_type = element.tagName().toStdString();
  assert(m_type=="data");

  QDomElement e;
  
  e = element.namedItem("accountnumber").toElement();
  m_account_num = e.text().toUInt();
  assert(m_account_num>0);
  
  e = element.namedItem("rate").toElement();
  m_rate = e.text().toUInt();
  assert(m_rate>=0);
  
  e = element.namedItem("usage").toElement();
  m_usage = e.text().toUInt();
  assert(m_usage>=0);
}
Ejemplo n.º 30
0
QDomElement DomUtil::namedChildElement( QDomElement& el, const QString& name )
{
    QDomElement child = el.namedItem( name ).toElement();
    if (child.isNull()) {
        child = el.ownerDocument().createElement( name );
        el.appendChild(child);
    }
    return child;
}