void ContactsReader::readGroup(QTreeWidgetItem* parent) { Q_ASSERT(isStartElement() && name() == "Group"); QTreeWidgetItem* group = createChildItem(parent); const bool expanded = (attributes().value("expanded") == "yes"); this->_tree->setItemExpanded(group, expanded); group->setIcon(0, QIcon(":/images/group.png")); group->setData(0, ContactsTree::Type, ContactsTree::Group); group->setData(0, ContactsTree::IconPath, ":/images/group.png"); group->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled); while (!atEnd()) { readNext(); if (isEndElement()) break; if (name() == "name") group->setText(0, readElementText()); if (isStartElement()) { if (name() == "Contact") readContact(group); else readUnknownElement(); } } Group::buildToolTip(group); }
void XMLimport::readTriggerGroup( TTrigger * pParent ) { TTrigger * pT; if( pParent ) { pT = new TTrigger( pParent, mpHost ); } else { pT = new TTrigger( 0, mpHost ); } if (module){ pT->mModuleMember = true; } mpHost->getTriggerUnit()->registerTrigger( pT ); pT->setIsActive( (attributes().value("isActive") == "yes" ) ); pT->mIsFolder = ( attributes().value("isFolder") == "yes" ); pT->mIsTempTrigger = ( attributes().value("isTempTrigger") == "yes" ); pT->mIsMultiline = ( attributes().value("isMultiline") == "yes" ); pT->mPerlSlashGOption = ( attributes().value("isPerlSlashGOption") == "yes" ); pT->mIsColorizerTrigger = ( attributes().value("isColorizerTrigger") == "yes" ); pT->mFilterTrigger = ( attributes().value("isFilterTrigger") == "yes" ); pT->mSoundTrigger = ( attributes().value("isSoundTrigger") == "yes" ); pT->mColorTrigger = ( attributes().value("isColorTrigger") == "yes" ); pT->mColorTriggerBg = ( attributes().value("isColorTriggerBg") == "yes" ); pT->mColorTriggerFg = ( attributes().value("isColorTriggerFg") == "yes" ); while( ! atEnd() ) { readNext(); //qDebug()<<"[INFO] element:"<<name().toString()<<" text:"<<text().toString(); if( isEndElement() ) break; if( isStartElement() ) { if( name() == "name" ) { pT->setName( readElementText() ); continue; } else if( name() == "script") { pT->mScript = readElementText(); continue; } else if( name() == "packageName") { pT->mPackageName = readElementText(); continue; } else if( name() == "triggerType" ) { pT->mTriggerType = readElementText().toInt(); continue; } else if( name() == "conditonLineDelta" ) { pT->mConditionLineDelta = readElementText().toInt(); continue; } else if( name() == "mStayOpen" ) { pT->mStayOpen = readElementText().toInt(); continue; } else if( name() == "mCommand" ) { pT->mCommand = readElementText(); continue; } else if( name() == "mFgColor") { pT->mFgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mBgColor") { pT->mBgColor.setNamedColor( readElementText() ); continue; } else if( name() == "colorTriggerFgColor") { pT->mColorTriggerFgColor.setNamedColor( readElementText() ); continue; } else if( name() == "colorTriggerBgColor") { pT->mColorTriggerBgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mSoundFile" ) { pT->mSoundFile = readElementText(); continue; } else if( name() == "regexCodeList") { readStringList( pT->mRegexCodeList ); continue; } else if( name() == "regexCodePropertyList" ) { readIntegerList( pT->mRegexCodePropertyList ); continue; } else if( name() == "TriggerGroup" ) { readTriggerGroup( pT ); } else if( name() == "Trigger" ) { readTriggerGroup( pT ); } else { readUnknownTriggerElement(); } } } if( ! pT->setRegexCodeList( pT->mRegexCodeList, pT->mRegexCodePropertyList ) ) { qDebug()<<"IMPORT: ERROR: cant initialize pattern list for trigger "<<pT->getName(); } QString script = pT->mScript; if( ! pT->setScript( script ) ) { qDebug()<<"IMPORT: ERROR: trigger script "<< pT->getName()<<" does not compile"; } }
bool TSReader::read(Translator &translator) { STRING(both); STRING(byte); STRING(comment); STRING(context); STRING(defaultcodec); STRING(encoding); STRING(extracomment); STRING(filename); STRING(id); STRING(language); STRING(line); STRING(location); STRING(message); STRING(name); STRING(numerus); STRING(numerusform); STRING(obsolete); STRING(oldcomment); STRING(oldsource); STRING(source); STRING(sourcelanguage); STRING(translation); STRING(translatorcomment); STRING(true); STRING(TS); STRING(type); STRING(unfinished); STRING(userdata); STRING(utf8); STRING(value); //STRING(version); STRING(yes); static const QString strextrans(QLatin1String("extra-")); static const QString strUtf8(QLatin1String("UTF-8")); while (!atEnd()) { readNext(); if (isStartDocument()) { // <!DOCTYPE TS> //qDebug() << attributes(); } else if (isEndDocument()) { // <!DOCTYPE TS> //qDebug() << attributes(); } else if (isDTD()) { // <!DOCTYPE TS> //qDebug() << tokenString(); } else if (elementStarts(strTS)) { // <TS> //qDebug() << "TS " << attributes(); QHash<QString, int> currentLine; QString currentFile; QXmlStreamAttributes atts = attributes(); //QString version = atts.value(strversion).toString(); translator.setLanguageCode(atts.value(strlanguage).toString()); translator.setSourceLanguageCode(atts.value(strsourcelanguage).toString()); while (!atEnd()) { readNext(); if (isEndElement()) { // </TS> found, finish local loop break; } else if (isWhiteSpace()) { // ignore these, just whitespace } else if (elementStarts(strdefaultcodec)) { // <defaultcodec> const QString &codec = readElementText(); if (!codec.isEmpty()) translator.setCodecName(codec.toLatin1()); // </defaultcodec> } else if (isStartElement() && name().toString().startsWith(strextrans)) { // <extra-...> QString tag = name().toString(); translator.setExtra(tag.mid(6), readContents()); // </extra-...> } else if (elementStarts(strcontext)) { // <context> QString context; while (!atEnd()) { readNext(); if (isEndElement()) { // </context> found, finish local loop break; } else if (isWhiteSpace()) { // ignore these, just whitespace } else if (elementStarts(strname)) { // <name> context = readElementText(); // </name> } else if (elementStarts(strmessage)) { // <message> TranslatorMessage::References refs; QString currentMsgFile = currentFile; TranslatorMessage msg; msg.setId(attributes().value(strid).toString()); msg.setContext(context); msg.setType(TranslatorMessage::Finished); msg.setPlural(attributes().value(strnumerus) == stryes); const QStringRef &utf8Attr = attributes().value(strutf8); msg.setNonUtf8(utf8Attr == strboth); msg.setUtf8(msg.isNonUtf8() || utf8Attr == strtrue || attributes().value(strencoding) == strUtf8); while (!atEnd()) { readNext(); if (isEndElement()) { // </message> found, finish local loop msg.setReferences(refs); translator.append(msg); break; } else if (isWhiteSpace()) { // ignore these, just whitespace } else if (elementStarts(strsource)) { // <source>...</source> msg.setSourceText(readContents()); } else if (elementStarts(stroldsource)) { // <oldsource>...</oldsource> msg.setOldSourceText(readContents()); } else if (elementStarts(stroldcomment)) { // <oldcomment>...</oldcomment> msg.setOldComment(readContents()); } else if (elementStarts(strextracomment)) { // <extracomment>...</extracomment> msg.setExtraComment(readContents()); } else if (elementStarts(strtranslatorcomment)) { // <translatorcomment>...</translatorcomment> msg.setTranslatorComment(readContents()); } else if (elementStarts(strlocation)) { // <location/> QXmlStreamAttributes atts = attributes(); QString fileName = atts.value(strfilename).toString(); if (fileName.isEmpty()) { fileName = currentMsgFile; } else { if (refs.isEmpty()) currentFile = fileName; currentMsgFile = fileName; } const QString lin = atts.value(strline).toString(); if (lin.isEmpty()) { translator.setLocationsType(Translator::RelativeLocations); refs.append(TranslatorMessage::Reference(fileName, -1)); } else { bool bOK; int lineNo = lin.toInt(&bOK); if (bOK) { if (lin.startsWith(QLatin1Char('+')) || lin.startsWith(QLatin1Char('-'))) { lineNo = (currentLine[fileName] += lineNo); translator.setLocationsType(Translator::RelativeLocations); } else { translator.setLocationsType(Translator::AbsoluteLocations); } refs.append(TranslatorMessage::Reference(fileName, lineNo)); } } readContents(); } else if (elementStarts(strcomment)) { // <comment>...</comment> msg.setComment(readContents()); } else if (elementStarts(struserdata)) { // <userdata>...</userdata> msg.setUserData(readContents()); } else if (elementStarts(strtranslation)) { // <translation> QXmlStreamAttributes atts = attributes(); QStringRef type = atts.value(strtype); if (type == strunfinished) msg.setType(TranslatorMessage::Unfinished); else if (type == strobsolete) msg.setType(TranslatorMessage::Obsolete); if (msg.isPlural()) { QStringList translations; while (!atEnd()) { readNext(); if (isEndElement()) { break; } else if (isWhiteSpace()) { // ignore these, just whitespace } else if (elementStarts(strnumerusform)) { translations.append(readTransContents()); } else { handleError(); break; } } msg.setTranslations(translations); } else { msg.setTranslation(readTransContents()); } // </translation> } else if (isStartElement() && name().toString().startsWith(strextrans)) { // <extra-...> QString tag = name().toString(); msg.setExtra(tag.mid(6), readContents()); // </extra-...> } else { handleError(); } } // </message> } else { handleError(); } } // </context> } else { handleError(); } } // </TS> } else { handleError(); } } if (hasError()) { m_cd.appendError(errorString()); return false; } return true; }
void YTFeedReader::readEntry() { Video* video = new Video(); while (!atEnd()) { readNext(); /* qDebug() << name(); QXmlStreamAttribute attribute; foreach (attribute, attributes()) qDebug() << attribute.name() << ":" << attribute.value(); */ if (isEndElement() && name() == QLatin1String("entry")) break; if (isStartElement()) { if (name() == QLatin1String("link") && attributes().value("rel").toString() == QLatin1String("alternate") && attributes().value("type").toString() == QLatin1String("text/html") ) { QString webpage = attributes().value("href").toString(); webpage.remove("&feature=youtube_gdata"); video->setWebpage(webpage); } else if (name() == QLatin1String("author")) { while(readNextStartElement()) if (name() == QLatin1String("name")) { QString author = readElementText(); video->setChannelTitle(author); } else if (name() == QLatin1String("userId")) { QString userId = readElementText(); video->setChannelId(userId); } else skipCurrentElement(); } else if (name() == QLatin1String("published")) { video->setPublished(QDateTime::fromString(readElementText(), Qt::ISODate)); } else if (namespaceUri() == QLatin1String("http://gdata.youtube.com/schemas/2007") && name() == QLatin1String("statistics")) { QString viewCount = attributes().value("viewCount").toString(); video->setViewCount(viewCount.toInt()); } else if (namespaceUri() == QLatin1String("http://search.yahoo.com/mrss/") && name() == QLatin1String("group")) { // read media group while (!atEnd()) { readNext(); if (isEndElement() && name() == QLatin1String("group")) break; if (isStartElement()) { if (name() == QLatin1String("thumbnail")) { // qDebug() << "Thumb: " << attributes().value("url").toString(); QStringRef name = attributes().value("yt:name"); if (name == QLatin1String("mqdefault")) video->setThumbnailUrl( attributes().value("url").toString()); else if (name == QLatin1String("hqdefault")) video->setMediumThumbnailUrl( attributes().value("url").toString()); } else if (name() == QLatin1String("title")) { QString title = readElementText(); // qDebug() << "Title: " << title; video->setTitle(title); } else if (name() == QLatin1String("description")) { QString desc = readElementText(); // qDebug() << "Description: " << desc; video->setDescription(desc); } else if (name() == QLatin1String("duration")) { QString duration = attributes().value("seconds").toString(); // qDebug() << "Duration: " << duration; video->setDuration(duration.toInt()); } else if (name() == QLatin1String("license")) { QString license = readElementText(); // qDebug() << "License: " << license; if (license == QLatin1String("cc")) video->setLicense(Video::LicenseCC); } } } } } } videos.append(video); }
void ProjectReader::readProject() { Q_ASSERT(isStartElement() && name() == "project"); project = new Project(); bool dirExists; //message("readProject"); QDir::setCurrent(fileinfo.absolutePath()); // Since we need to load our bitmaps first, we just read in all of the filenames // and then load the actual resources last. That way, if <tilesets> isn't the // first section, there won't be any errors. while (!atEnd()) { readNext(); if (isEndElement()) break; if (isStartElement()) { if (name() == "name") { project->SetName(readElementText()); //message("Map name: " + map->GetName()); } else if (name() == "maps") { readMaps(); } else if (name() == "tilesets") { readTilesets(); } else if (name() == "sprites") { readSprites(); } else if (name() == "scripts") { readScripts(); } else { readUnknownElement(); } } } // Load bitmaps dirExists = QDir::setCurrent("tilesets"); BitmapReader bitmapReader; while(!tilesetlist.isEmpty()) { QString b = tilesetlist.takeFirst(); // load bitmap bitmapReader.read(b); } if(dirExists) QDir::setCurrent(".."); // load sprites dirExists = QDir::setCurrent("sprites"); SpriteReader spriteReader; while(!spritelist.isEmpty()) { QString s = spritelist.takeFirst(); // load sprite spriteReader.read(s); } if(dirExists) QDir::setCurrent(".."); // load maps dirExists = QDir::setCurrent("maps"); MapReader mapReader; while(!maplist.isEmpty()) { QString m = maplist.takeFirst(); // load map mapReader.read(m); } if(dirExists) QDir::setCurrent(".."); }
void XMLimport::readKeyGroup( TKey * pParent ) { TKey * pT; if( pParent ) { pT = new TKey( pParent, mpHost ); } else { pT = new TKey( 0, mpHost ); } mpHost->getKeyUnit()->registerKey( pT ); pT->setIsActive( ( attributes().value("isActive") == "yes" ) ); pT->mIsFolder = ( attributes().value("isFolder") == "yes" ); if (module) pT->mModuleMember = true; while( ! atEnd() ) { readNext(); if( isEndElement() ) break; if( isStartElement() ) { if( name() == "name" ) { pT->mName = readElementText(); continue; } else if( name() == "packageName") { pT->mPackageName = readElementText(); continue; } else if( name() == "script") { QString script = readElementText(); pT->setScript( script ); continue; } else if( name() == "command") { pT->mCommand = readElementText(); continue; } else if( name() == "keyCode" ) { pT->mKeyCode = readElementText().toInt(); continue; } else if( name() == "keyModifier" ) { pT->mKeyModifier = readElementText().toInt(); continue; } else if( name() == "KeyGroup" ) { readKeyGroup( pT ); } else if( name() == "Key" ) { readKeyGroup( pT ); } else { readUnknownKeyElement(); } } } }
void YouTubeStreamReader::readEntry() { Video* video = new Video(); // qDebug(" *** ENTRY ***"); while (!atEnd()) { readNext(); /* qDebug() << name(); QXmlStreamAttribute attribute; foreach (attribute, attributes()) qDebug() << attribute.name() << ":" << attribute.value(); */ if (isEndElement() && name() == "entry") break; if (isStartElement()) { if (name() == "link" && attributes().value("rel").toString() == "alternate" && attributes().value("type").toString() == "text/html" ) { QString webpage = attributes().value("href").toString(); webpage.remove("&feature=youtube_gdata"); // qDebug() << "Webpage: " << webpage; video->setWebpage(QUrl(webpage)); } else if (name() == "author") { readNext(); if (name() == "name") { QString author = readElementText(); // qDebug() << "Author: " << author; video->setAuthor(author); } } else if (name() == "published") { video->setPublished(QDateTime::fromString(readElementText(), Qt::ISODate)); } else if (namespaceUri() == "http://gdata.youtube.com/schemas/2007" && name() == "statistics") { QString viewCount = attributes().value("viewCount").toString(); // qDebug() << "viewCount: " << viewCount; video->setViewCount(viewCount.toInt()); } else if (namespaceUri() == "http://search.yahoo.com/mrss/" && name() == "group") { // read media group while (!atEnd()) { readNext(); if (isEndElement() && name() == "group") break; if (isStartElement()) { if (name() == "thumbnail") { // qDebug() << "Thumb: " << attributes().value("url").toString(); // video->thumbnailUrls() << QUrl(attributes().value("url").toString()); video->addThumbnailUrl(QUrl(attributes().value("url").toString())); } else if (name() == "title") { QString title = readElementText(); // qDebug() << "Title: " << title; video->setTitle(title); } else if (name() == "description") { QString desc = readElementText(); // qDebug() << "Description: " << desc; video->setDescription(desc); } else if (name() == "duration") { QString duration = attributes().value("seconds").toString(); // qDebug() << "Duration: " << duration; video->setDuration(duration.toInt()); } } } } } } videos.append(video); }
void XMLimport::readActionGroup( TAction * pParent ) { TAction * pT; if( pParent ) { pT = new TAction( pParent, mpHost ); } else { pT = new TAction( 0, mpHost ); } mpHost->getActionUnit()->registerAction( pT ); pT->setIsActive( ( attributes().value("isActive") == "yes" ) ); pT->mIsFolder = ( attributes().value("isFolder") == "yes" ); pT->mIsPushDownButton = ( attributes().value("isPushButton") == "yes" ); pT->mButtonFlat = ( attributes().value("isFlatButton") == "yes" ); pT->mUseCustomLayout = ( attributes().value("useCustomLayout") == "yes" ); if (module) pT->mModuleMember = true; while( ! atEnd() ) { readNext(); if( isEndElement() ) break; if( isStartElement() ) { if( name() == "name" ) { pT->mName = readElementText(); continue; } else if( name() == "packageName") { pT->mPackageName = readElementText(); continue; } else if( name() == "script") { QString script = readElementText(); pT->setScript( script ); continue; } else if( name() == "css") { pT->css = readElementText(); continue; } else if( name() == "commandButtonUp") { pT->mCommandButtonUp = readElementText(); continue; } else if( name() == "commandButtonDown") { pT->mCommandButtonDown = readElementText(); continue; } else if( name() == "icon") { pT->mIcon = readElementText(); continue; } else if( name() == "orientation") { pT->mOrientation = readElementText().toInt(); continue; } else if( name() == "location") { pT->mLocation = readElementText().toInt(); continue; } else if( name() == "buttonRotation") { pT->mButtonRotation = readElementText().toInt(); continue; } else if( name() == "sizeX") { pT->mSizeX = readElementText().toInt(); continue; } else if( name() == "sizeY") { pT->mSizeY = readElementText().toInt(); continue; } else if( name() == "mButtonState") { pT->mButtonState = readElementText().toInt(); continue; } else if( name() == "buttonColor") { pT->mButtonColor.setNamedColor( readElementText() ); continue; } else if( name() == "buttonColumn") { pT->mButtonColumns = readElementText().toInt(); continue; } else if( name() == "posX") { pT->mPosX = readElementText().toInt(); continue; } else if( name() == "posY") { pT->mPosY = readElementText().toInt(); continue; } else if( name() == "ActionGroup" ) { readActionGroup( pT ); } else if( name() == "Action" ) { readActionGroup( pT ); } else { readUnknownActionElement(); } } } }
void ITunesImporterWorker::run() { DEBUG_BLOCK debug() << "file:" << m_databaseLocation; QFile* file = new QFile( m_databaseLocation ); if( !file->exists() ) { debug() << "COULDN'T FIND DB FILE!"; emit importError( "" ); m_failed = true; return; } if ( !file->open( QIODevice::ReadOnly ) ) { debug() << "COULDN'T OPEN DB FILE!"; emit importError( "" ); m_failed = true; return; } setDevice( file ); //debug() << "got element:" << name().toString(); while( !atEnd() ) { if( m_aborted ) return; readNext(); if ( name() == "key" && readElementText() == "Tracks" ) // ok, we're at the start { readNext(); readNext(); readNext(); // this skips the first all-encompassing <dict> tag debug() << "got start of tracks"; while( !atEnd() && !( isEndElement() && name() == "dict" ) ) { if( m_aborted ) return; //debug() << "reading element name:" << name().toString(); if( isStartElement() && name() == "dict") // this is a track item! { readTrackElement(); } readNext(); } } } if( m_tracksForInsert.size() > 0 ) { Collections::CollectionLocation *location = CollectionManager::instance()->primaryCollection()->location(); QMapIterator<Meta::TrackPtr, QString> j(m_tracksForInsert); while (j.hasNext()) { j.next(); location->insert( j.key(), j.value() ); } } debug() << "done importing xml file"; }
void ITunesImporterWorker::readTrackElement() { QString title, artist, album, url; int year = -1, bpm = -1, playcount = -1, rating = -1; QDateTime lastplayed; while( !( isEndElement() && name() == "dict" ) ) { readNext(); QString text = readElementText(); if( name() == "key" && text == "Name" ) { readNext(); // skip past the </key> and to the data tag QString text = readElementText(); title = text; } else if( name() == "key" && text == "Artist" ) { readNext(); // skip past the </key> and to the data tag artist = readElementText(); } else if( isStartElement() && name() == "key" && text == "Album" ) { readNext(); // skip past the </key> and to the data tag album = readElementText(); } else if( name() == "key" && text == "Year" ) { readNext(); // skip past the </key> and to the data tag year = readElementText().toInt(); } else if( name() == "key" && text == "BPM" ) { readNext(); // skip past the </key> and to the data tag bpm = readElementText().toInt(); } else if( name() == "key" && text == "Play Count" ) { readNext(); // skip past the </key> and to the data tag playcount = readElementText().toInt(); } else if( name() == "key" && text == "Rating" ) { readNext(); // skip past the </key> and to the data tag rating = readElementText().toInt() / 10; // itunes rates 0-100 } else if( name() == "key" && text == "Play Date" ) { readNext(); // skip past the </key> and to the data tag lastplayed = QDateTime::fromTime_t(readElementText().toInt()); } else if( name() == "key" && text == "Location" ) { readNext(); // skip past the </key> and to the data tag url = readElementText(); } } //split the file://localhost/path/to/track to just file:///path/to/track if( url.indexOf( "file://localhost" ) == 0 ) url = url.remove( 7, 9 ); debug() << "got track info:" << title << artist << album << year << bpm << url; Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( KUrl( url ) ); if( track ) { QScopedPointer<Capabilities::StatisticsCapability> ec( track->create<Capabilities::StatisticsCapability>() ); if( ec ) { ec->beginStatisticsUpdate(); if( rating != -1 ) ec->setRating( rating ); if( lastplayed.isValid() ) ec->setLastPlayed( lastplayed ); if( playcount != -1 ) ec->setPlayCount( playcount ); ec->endStatisticsUpdate(); if( !track->inCollection() ) { m_tracksForInsert.insert( track, track->playableUrl().url() ); debug() << " inserting track:" << track->playableUrl(); } else { Collections::Collection* collection = track->collection(); if (collection) debug() << "track in collection (" << collection->location()->prettyLocation() << "):" << track->playableUrl(); } emit trackAdded( track ); } } }
void ActivityXmlParser::readActivityInfo(Activity_Info *actiInfo) { while (!atEnd()) { readNext(); if (isStartElement()) { if (name() == "title") { QString title = readElementText(); actiInfo->setTitle(title); continue; } else if (name() == "time") { QString time = readElementText(); actiInfo->setTime(time); continue; } else if (name() == "address") { QString address = readElementText(); actiInfo->setAddress(address); continue; } else if (name() == "content") { QString content = readElementText(); actiInfo->setContent(content); continue; } else if (name() == "name") { QString name = readElementText(); actiInfo->setName(name); continue; } else if (name() == "stunum") { QString stunum = readElementText(); actiInfo->setStunum(stunum); continue; } else if (name() == "tel") { QString tel = readElementText(); actiInfo->setTel(tel); continue; } else if (name() == "schname") { QString schname = readElementText(); actiInfo->setSchname(schname); continue; } else if (name() == "colname") { QString colname = readElementText(); actiInfo->setColname(colname); continue; } } //当读到activity结束标签,此次读取activity信息结束 if (isEndElement()) { if (name() == "activity") break; } } }
void XMLimport::readHostPackage( Host * pT ) { pT->mAutoClearCommandLineAfterSend = ( attributes().value("autoClearCommandLineAfterSend") == "yes" ); pT->mDisableAutoCompletion = ( attributes().value("disableAutoCompletion") == "yes" ); pT->mPrintCommand = ( attributes().value("printCommand") == "yes" ); pT->set_USE_IRE_DRIVER_BUGFIX( attributes().value("USE_IRE_DRIVER_BUGFIX") == "yes" ); pT->mUSE_FORCE_LF_AFTER_PROMPT = ( attributes().value("mUSE_FORCE_LF_AFTER_PROMPT") == "yes" ); pT->mUSE_UNIX_EOL = ( attributes().value("mUSE_UNIX_EOL") == "yes" ); pT->mNoAntiAlias = ( attributes().value("mNoAntiAlias") == "yes" ); pT->mRawStreamDump = ( attributes().value("mRawStreamDump") == "yes" ); pT->mAlertOnNewData = ( attributes().value("mAlertOnNewData") == "yes" ); pT->mFORCE_NO_COMPRESSION = ( attributes().value("mFORCE_NO_COMPRESSION") == "yes" ); pT->mFORCE_GA_OFF = ( attributes().value("mFORCE_GA_OFF") == "yes" ); pT->mFORCE_SAVE_ON_EXIT = ( attributes().value("mFORCE_SAVE_ON_EXIT") == "yes" ); pT->mEnableGMCP = ( attributes().value("mEnableGMCP") == "yes" ); pT->mMapStrongHighlight = ( attributes().value("mMapStrongHighlight") == "yes" ); pT->mLogStatus = ( attributes().value("mLogStatus") == "yes" ); pT->mEnableSpellCheck = ( attributes().value("mEnableSpellCheck") == "yes" ); while( ! atEnd() ) { readNext(); if( isEndElement() ) break; if( isStartElement() ) { if( name() == "name" ) { pT->mHostName = readElementText(); continue; } else if( name() == "mInstalledPackages") { readStringList( pT->mInstalledPackages ); continue; } else if( name() =="url" ) { pT->mUrl = readElementText(); continue; } else if( name() == "port") { pT->mPort = readElementText().toInt(); continue; } else if( name() == "borderTopHeight") { pT->mBorderTopHeight = readElementText().toInt(); continue; } else if( name() == "commandLineMinimumHeight") { pT->commandLineMinimumHeight = readElementText().toInt(); continue; } else if( name() == "borderBottomHeight") { pT->mBorderBottomHeight = readElementText().toInt(); continue; } else if( name() == "borderLeftWidth") { pT->mBorderLeftWidth = readElementText().toInt(); continue; } else if( name() == "borderRightWidth") { pT->mBorderRightWidth = readElementText().toInt(); continue; } else if( name() == "wrapAt") { pT->mWrapAt = readElementText().toInt(); continue; } else if( name() == "wrapIndentCount" ) { pT->mWrapIndentCount = readElementText().toInt(); continue; } else if( name() == "mCommandSeparator" ) { pT->mCommandSeparator = readElementText(); continue; } else if( name() == "mFgColor") { pT->mFgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mBgColor") { pT->mBgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mCommandFgColor") { pT->mCommandFgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mCommandBgColor") { pT->mCommandBgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mBlack") { pT->mBlack.setNamedColor( readElementText() ); continue; } else if( name() == "mLightBlack") { pT->mLightBlack.setNamedColor( readElementText() ); continue; } else if( name() == "mRed") { pT->mRed.setNamedColor( readElementText() ); continue; } else if( name() == "mLightRed") { pT->mLightRed.setNamedColor( readElementText() ); continue; } else if( name() == "mBlue") { pT->mBlue.setNamedColor( readElementText() ); continue; } else if( name() == "mLightBlue") { pT->mLightBlue.setNamedColor( readElementText() ); continue; } else if( name() == "mGreen") { pT->mGreen.setNamedColor( readElementText() ); continue; } else if( name() == "mLightGreen") { pT->mLightGreen.setNamedColor( readElementText() ); continue; } else if( name() == "mYellow") { pT->mYellow.setNamedColor( readElementText() ); continue; } else if( name() == "mLightYellow") { pT->mLightYellow.setNamedColor( readElementText() ); continue; } else if( name() == "mCyan") { pT->mCyan.setNamedColor( readElementText() ); continue; } else if( name() == "mLightCyan") { pT->mLightCyan.setNamedColor( readElementText() ); continue; } else if( name() == "mMagenta") { pT->mMagenta.setNamedColor( readElementText() ); continue; } else if( name() == "mLightMagenta") { pT->mLightMagenta.setNamedColor( readElementText() ); continue; } else if( name() == "mWhite") { pT->mWhite.setNamedColor( readElementText() ); continue; } else if( name() == "mLightWhite") { pT->mLightWhite.setNamedColor( readElementText() ); continue; } else if( name() == "mDisplayFont") { pT->mDisplayFont.fromString( readElementText() ); continue; } else if( name() == "mCommandLineFont") { pT->mCommandLineFont.fromString( readElementText() ); continue; } else if( name() == "mFgColor2") { pT->mFgColor_2.setNamedColor( readElementText() ); continue; } else if( name() == "mBgColor2") { pT->mBgColor_2.setNamedColor( readElementText() ); continue; } else if( name() == "mBlack2") { pT->mBlack_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightBlack2") { pT->mLightBlack_2.setNamedColor( readElementText() ); continue; } else if( name() == "mRed2") { pT->mRed_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightRed2") { pT->mLightRed_2.setNamedColor( readElementText() ); continue; } else if( name() == "mBlue2") { pT->mBlue_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightBlue2") { pT->mLightBlue_2.setNamedColor( readElementText() ); continue; } else if( name() == "mGreen2") { pT->mGreen_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightGreen2") { pT->mLightGreen_2.setNamedColor( readElementText() ); continue; } else if( name() == "mYellow2") { pT->mYellow_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightYellow2") { pT->mLightYellow_2.setNamedColor( readElementText() ); continue; } else if( name() == "mCyan2") { pT->mCyan_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightCyan2") { pT->mLightCyan_2.setNamedColor( readElementText() ); continue; } else if( name() == "mMagenta2") { pT->mMagenta_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightMagenta2") { pT->mLightMagenta_2.setNamedColor( readElementText() ); continue; } else if( name() == "mWhite2") { pT->mWhite_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightWhite2") { pT->mLightWhite_2.setNamedColor( readElementText() ); continue; } else if( name() == "mSpellDic") { pT->mSpellDic = readElementText(); continue; } else { readUnknownHostElement(); } } } }
OpenSearchEngine* OpenSearchReader::read() { OpenSearchEngine* engine = new OpenSearchEngine(); m_searchXml = device()->peek(1024 * 5); while (!isStartElement() && !atEnd()) { readNext(); } if (!m_searchXml.contains(QLatin1String("http://a9.com/-/spec/opensearch/1.1/"))) { raiseError(QObject::tr("The file is not an OpenSearch 1.1 file.")); return engine; } while (!atEnd()) { readNext(); if (!isStartElement()) { continue; } if (name() == QLatin1String("ShortName") || name() == QLatin1String("os:ShortName")) { engine->setName(readElementText()); } else if (name() == QLatin1String("Description") || name() == QLatin1String("os:Description")) { engine->setDescription(readElementText()); } else if (name() == QLatin1String("Url") || name() == QLatin1String("os:Url")) { QString type = attributes().value(QLatin1String("type")).toString(); QString url = attributes().value(QLatin1String("template")).toString(); QString method = attributes().value(QLatin1String("method")).toString(); if (type == QLatin1String("application/x-suggestions+json") && !engine->suggestionsUrlTemplate().isEmpty()) { continue; } if ((type.isEmpty() || type == QLatin1String("text/html") || type == QLatin1String("application/xhtml+xml")) && !engine->searchUrlTemplate().isEmpty()) { continue; } if (url.isEmpty()) { continue; } QList<OpenSearchEngine::Parameter> parameters; readNext(); while (!isEndElement() || (name() != QLatin1String("Url") && name() != QLatin1String("os:Url"))) { if (!isStartElement() || (name() != QLatin1String("Param") && name() != QLatin1String("Parameter") && name() != QLatin1String("os:Param") && name() != QLatin1String("os:Parameter"))) { readNext(); continue; } QString key = attributes().value(QLatin1String("name")).toString(); QString value = attributes().value(QLatin1String("value")).toString(); if (!key.isEmpty() && !value.isEmpty()) { parameters.append(OpenSearchEngine::Parameter(key, value)); } while (!isEndElement()) { readNext(); } } if (type == QLatin1String("application/x-suggestions+json")) { engine->setSuggestionsUrlTemplate(url); engine->setSuggestionsParameters(parameters); engine->setSuggestionsMethod(method); } else if (type.isEmpty() || type == QLatin1String("text/html") || type == QLatin1String("application/xhtml+xml")) { engine->setSearchUrlTemplate(url); engine->setSearchParameters(parameters); engine->setSearchMethod(method); } } else if (name() == QLatin1String("Image") || name() == QLatin1String("os:Image")) { engine->setImageUrl(readElementText()); } if (!engine->name().isEmpty() && !engine->description().isEmpty() && !engine->suggestionsUrlTemplate().isEmpty() && !engine->searchUrlTemplate().isEmpty() && !engine->imageUrl().isEmpty()) { break; } } return engine; }
void XMLimport::readTimerGroup( TTimer * pParent ) { TTimer * pT; if( pParent ) { pT = new TTimer( pParent, mpHost ); } else { pT = new TTimer( 0, mpHost ); } pT->registerTimer(); pT->setShouldBeActive( ( attributes().value("isActive") == "yes" ) ); pT->mIsFolder = ( attributes().value("isFolder") == "yes" ); pT->mIsTempTimer = ( attributes().value("isTempTimer") == "yes" ); if (module) pT->mModuleMember = true; while( ! atEnd() ) { readNext(); if( isEndElement() ) break; if( isStartElement() ) { if( name() == "name" ) { pT->setName( readElementText() ); continue; } else if( name() == "packageName") { pT->mPackageName = readElementText(); continue; } else if( name() == "script") { QString script = readElementText(); pT->setScript( script ); continue; } else if( name() == "command") { pT->mCommand = readElementText(); continue; } else if( name() == "time") { QString timeString = readElementText(); QTime time = QTime::fromString( timeString, "hh:mm:ss.zzz" ); pT->setTime( time ); continue; } else if( name() == "TimerGroup" ) { readTimerGroup( pT ); } else if( name() == "Timer" ) { readTimerGroup( pT ); } else { readUnknownTimerElement(); } } } if( ( ! pT->isOffsetTimer() ) && ( pT->shouldBeActive() ) ) pT->enableTimer( pT->getID() ); else pT->disableTimer( pT->getID() ); }
void XbelReader::readTitle(BookmarkNode *parent) { Q_ASSERT(isStartElement() && name() == QLatin1String("title")); parent->title = readElementText(); }
void XMLimport::readAliasGroup( TAlias * pParent ) { TAlias * pT; if( pParent ) { pT = new TAlias( pParent, mpHost ); } else { pT = new TAlias( 0, mpHost ); } mpHost->getAliasUnit()->registerAlias( pT ); pT->setIsActive( ( attributes().value("isActive") == "yes" ) ); pT->mIsFolder = ( attributes().value("isFolder") == "yes" ); if (module) pT->mModuleMember = true; while( ! atEnd() ) { readNext(); if( isEndElement() ) break; if( isStartElement() ) { if( name() == "name" ) { pT->setName( readElementText() ); continue; } else if( name() == "packageName") { pT->mPackageName = readElementText(); continue; } else if( name() == "script") { QString script = readElementText(); pT->setScript( script ); continue; } else if( name() == "command") { pT->mCommand = readElementText(); continue; } else if( name() == "regex") { pT->setRegexCode( readElementText() ); continue; } else if( name() == "AliasGroup" ) { readAliasGroup( pT ); } else if( name() == "Alias" ) { readAliasGroup( pT ); } else { readUnknownAliasElement(); } } } }
void XbelReader::readDescription(BookmarkNode *parent) { Q_ASSERT(isStartElement() && name() == QLatin1String("desc")); parent->desc = readElementText(); }
void XMLimport::readScriptGroup( TScript * pParent ) { TScript * pT; if( pParent ) { pT = new TScript( pParent, mpHost ); } else { pT = new TScript( 0, mpHost ); } mpHost->getScriptUnit()->registerScript( pT ); pT->setIsActive( ( attributes().value("isActive") == "yes" ) ); pT->mIsFolder = ( attributes().value("isFolder") == "yes" ); if (module) pT->mModuleMember = true; while( ! atEnd() ) { readNext(); if( isEndElement() ) break; if( isStartElement() ) { if( name() == "name" ) { pT->mName = readElementText(); continue; } else if( name() == "packageName") { pT->mPackageName = readElementText(); continue; } else if( name() == "script") { QString script = readElementText(); pT->setScript( script ); continue; } else if( name() == "eventHandlerList") { readStringList( pT->mEventHandlerList ); pT->setEventHandlerList( pT->mEventHandlerList ); continue; } else if( name() == "ScriptGroup" ) { readScriptGroup( pT ); } else if( name() == "Script" ) { readScriptGroup( pT ); } else { readUnknownScriptElement(); } } } }
bool ZipplXmlReader::read( QIODevice *dev ) { setDevice( dev ); bool res = true; bool metaMode = false; mCurrParent = 0; mCurrSpot = 0; QGraphicsScene *scene = mGraphWidget->scene(); int spotID = 0; while (!atEnd()) { readNext(); if( isStartElement() ) { qDebug() << "XML name: " << name(); if( name() == "presentation") { // presentation mode: debug & presentation QString mode = attributes().value("mode").toString(); if( !mode.isEmpty() ) mMode = mode; mPath = attributes().value("path").toString(); if( !mPath.endsWith('/') ) mPath += "/"; qreal dx = qrealAttrib("width") / -2.0; qreal dy = qrealAttrib("height") / -2.0; QRectF rect( dx, dy, -2.0*dx, -2.0*dy ); scene->setSceneRect( rect ); } else if( name() == "meta" ) { metaMode = true; } else if( name() == "title" && metaMode ) { mPresentationTitle = readElementText(); } else if( name() == "description" && metaMode ) { mPresentationDescr = readElementText(); } else if( name() == "date" && metaMode ) { mPresentationDate = readElementText(); } else if( name() == "name" && metaMode ) { mAuthorName = readElementText(); } else if( name() == "email" && metaMode ) { mAuthorEmail = readElementText(); } else if( name() == "tocentry" ) { if( mCurrSpot ) { mCurrSpot->setData( TOCENTRY, readElementText() ); } } else if( name() == "spot" ) { if( mCurrParent != 0 ) { qDebug() << "Strange: Current Parent should be zero here!"; } QGraphicsRectItem *rectItem = new QGraphicsRectItem( ); rectItem->setPen( pen( rectItem->pen(), QColor("#aeaeae") )); mCurrParent = rectItem; mCurrSpot = rectItem; mCurrParent->setData( ID, QVariant( spotID++ )); mCurrParent->setPos( position() ); rectItem->setBrush( brush( rectItem->brush() ) ); scene->addItem( mCurrParent ); mSpots.append( mCurrParent ); // Prepare the hidden items list GraphicsItemList list; mHiddenItems.insert( mCurrParent, list ); } else if( name() == "hidden" ) { QGraphicsRectItem *rectItem = new QGraphicsRectItem( mCurrParent, scene ); rectItem->setPen( QPen( QColor( 240, 240, 240 ))); // append this hidden item to the list of hiddens of the parent spot. GraphicsItemList list = mHiddenItems[mCurrSpot]; list.append( rectItem ); mHiddenItems[mCurrSpot] = list; mCurrParent = rectItem; mCurrParent->setData( ID, QVariant( spotID++ )); } else if( name() == "rect" ) { if( mCurrParent ) { // within a spot qDebug() << "Creating a rectangle!"; QGraphicsRectItem *rectItem = new QGraphicsRectItem( mCurrParent, scene ); qreal width = qrealAttrib( "width" ); qreal height = qrealAttrib( "height" ); QPointF pos = position(); if( width > 0 && height > 0 ) { rectItem->setRect( pos.x(), pos.y(), width, height ); } else { rectItem->setPos( pos ); } rectItem->setPen( pen( rectItem->pen() ) ); mCurrParent = rectItem; } } else if( name() == "circle" ) { QPointF pos = position(); QGraphicsEllipseItem *ellipse = new QGraphicsEllipseItem( mCurrParent, scene ); // ellipse->setBrush( getBrush() ); qreal r = 2.0 * qrealAttrib( "r" ); QRectF rect( pos, QSizeF( r, r ) ); ellipse->setPen( pen( ellipse->pen() ) ); ellipse->setRect( rect ); } else if( name() == "text" ) { QGraphicsSimpleTextItem *textItem = new QGraphicsSimpleTextItem( mCurrParent, scene ); QString font = attributes().value("font").toString(); QString size = attributes().value("size").toString(); QFont currFont = textItem->font(); if( !font.isEmpty() ) { currFont.setFamily( font ); textItem->setFont( currFont ); } if( !size.isEmpty() ) { currFont.setPointSize( size.toInt() ); textItem->setFont( currFont ); } textItem->setPos( position() ); // set the brush QBrush b( textItem->brush() ); b.setColor( color() ); textItem->setBrush( b ); QString text = readElementText(); textItem->setText( text ); } else if( name() == "image" ) { if( handleImg( scene ) ) { } } } else if( isEndElement() ) { qDebug( ) << "XML CLOSE: " << name().toString(); if( name() == "spot" || name() == "toc" ) { QRectF rect = mCurrParent->childrenBoundingRect(); rect.setX(0); rect.setY(0); qgraphicsitem_cast<QGraphicsRectItem*>(mCurrParent)->setRect( rect); mCurrParent = 0; } else if( name() == "rect" ) { QGraphicsRectItem *item = qgraphicsitem_cast<QGraphicsRectItem*>(mCurrParent); if( item->rect().isEmpty() ) item->setRect( mCurrParent->childrenBoundingRect() ); mCurrParent = mCurrParent->parentItem(); } else if( name() == "hidden") { mCurrParent->setOpacity( 0.0 ); mCurrParent = mCurrParent->parentItem(); } else if( name() == "meta" ) { metaMode = false; } } } createToc( scene ); return res; }
void XMLimport::readHostPackage( Host * pT ) { pT->mAutoClearCommandLineAfterSend = ( attributes().value("autoClearCommandLineAfterSend") == "yes" ); pT->mDisableAutoCompletion = ( attributes().value("disableAutoCompletion") == "yes" ); pT->mPrintCommand = ( attributes().value("printCommand") == "yes" ); pT->set_USE_IRE_DRIVER_BUGFIX( attributes().value("USE_IRE_DRIVER_BUGFIX") == "yes" ); pT->mUSE_FORCE_LF_AFTER_PROMPT = ( attributes().value("mUSE_FORCE_LF_AFTER_PROMPT") == "yes" ); pT->mUSE_UNIX_EOL = ( attributes().value("mUSE_UNIX_EOL") == "yes" ); pT->mNoAntiAlias = ( attributes().value("mNoAntiAlias") == "yes" ); pT->mRawStreamDump = ( attributes().value("mRawStreamDump") == "yes" ); pT->mAlertOnNewData = ( attributes().value("mAlertOnNewData") == "yes" ); pT->mFORCE_NO_COMPRESSION = ( attributes().value("mFORCE_NO_COMPRESSION") == "yes" ); pT->mFORCE_GA_OFF = ( attributes().value("mFORCE_GA_OFF") == "yes" ); pT->mFORCE_SAVE_ON_EXIT = ( attributes().value("mFORCE_SAVE_ON_EXIT") == "yes" ); pT->mEnableGMCP = ( attributes().value("mEnableGMCP") == "yes" ); pT->mMapStrongHighlight = ( attributes().value("mMapStrongHighlight") == "yes" ); pT->mLogStatus = ( attributes().value("mLogStatus") == "yes" ); pT->mEnableSpellCheck = ( attributes().value("mEnableSpellCheck") == "yes" ); pT->mShowInfo = ( attributes().value("mShowInfo") == "yes" ); pT->mAcceptServerGUI = ( attributes().value("mAcceptServerGUI") == "yes" ); pT->mMapperUseAntiAlias = ( attributes().value("mMapperUseAntiAlias") == "yes" ); pT->mFORCE_MXP_NEGOTIATION_OFF = ( attributes().value("mFORCE_MXP_NEGOTIATION_OFF") == "yes" ); while( ! atEnd() ) { readNext(); if( isEndElement() ) break; if( isStartElement() ) { if( name() == "name" ) { pT->mHostName = readElementText(); continue; } else if( name() == "mInstalledModules") { QMap<QString, QStringList> entry; readMapList(entry); QMapIterator<QString, QStringList> it(entry); while (it.hasNext()){ it.next(); QStringList moduleList; QStringList entryList = it.value(); moduleList << entryList[0]; moduleList << entryList[1]; pT->mInstalledModules[it.key()] = moduleList; pT->mModulePriorities[it.key()] = entryList[2].toInt(); } //readMapList( pT->mInstalledModules ); continue; } else if( name() == "mInstalledPackages") { readStringList( pT->mInstalledPackages ); continue; } else if( name() =="url" ) { pT->mUrl = readElementText(); continue; } else if( name() =="serverPackageName" ) { pT->mServerGUI_Package_name = readElementText(); continue; } else if( name() == "serverPackageVersion") { pT->mServerGUI_Package_version = readElementText().toInt(); continue; } else if( name() == "port") { pT->mPort = readElementText().toInt(); continue; } else if( name() == "borderTopHeight") { pT->mBorderTopHeight = readElementText().toInt(); continue; } else if( name() == "commandLineMinimumHeight") { pT->commandLineMinimumHeight = readElementText().toInt(); continue; } else if( name() == "borderBottomHeight") { pT->mBorderBottomHeight = readElementText().toInt(); continue; } else if( name() == "borderLeftWidth") { pT->mBorderLeftWidth = readElementText().toInt(); continue; } else if( name() == "borderRightWidth") { pT->mBorderRightWidth = readElementText().toInt(); continue; } else if( name() == "wrapAt") { pT->mWrapAt = readElementText().toInt(); continue; } else if( name() == "wrapIndentCount" ) { pT->mWrapIndentCount = readElementText().toInt(); continue; } else if( name() == "mCommandSeparator" ) { pT->mCommandSeparator = readElementText(); continue; } else if( name() == "mCommandLineFgColor") { pT->mCommandLineFgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mCommandLineBgColor") { pT->mCommandLineBgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mFgColor") { pT->mFgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mBgColor") { pT->mBgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mCommandFgColor") { pT->mCommandFgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mCommandBgColor") { pT->mCommandBgColor.setNamedColor( readElementText() ); continue; } else if( name() == "mBlack") { pT->mBlack.setNamedColor( readElementText() ); continue; } else if( name() == "mLightBlack") { pT->mLightBlack.setNamedColor( readElementText() ); continue; } else if( name() == "mRed") { pT->mRed.setNamedColor( readElementText() ); continue; } else if( name() == "mLightRed") { pT->mLightRed.setNamedColor( readElementText() ); continue; } else if( name() == "mBlue") { pT->mBlue.setNamedColor( readElementText() ); continue; } else if( name() == "mLightBlue") { pT->mLightBlue.setNamedColor( readElementText() ); continue; } else if( name() == "mGreen") { pT->mGreen.setNamedColor( readElementText() ); continue; } else if( name() == "mLightGreen") { pT->mLightGreen.setNamedColor( readElementText() ); continue; } else if( name() == "mYellow") { pT->mYellow.setNamedColor( readElementText() ); continue; } else if( name() == "mLightYellow") { pT->mLightYellow.setNamedColor( readElementText() ); continue; } else if( name() == "mCyan") { pT->mCyan.setNamedColor( readElementText() ); continue; } else if( name() == "mLightCyan") { pT->mLightCyan.setNamedColor( readElementText() ); continue; } else if( name() == "mMagenta") { pT->mMagenta.setNamedColor( readElementText() ); continue; } else if( name() == "mLightMagenta") { pT->mLightMagenta.setNamedColor( readElementText() ); continue; } else if( name() == "mWhite") { pT->mWhite.setNamedColor( readElementText() ); continue; } else if( name() == "mLightWhite") { pT->mLightWhite.setNamedColor( readElementText() ); continue; } else if( name() == "mDisplayFont") { pT->mDisplayFont.fromString( readElementText() ); pT->mDisplayFont.setFixedPitch( true ); // pT->mDisplayFont.setWordSpacing( 0 ); // pT->mDisplayFont.setLetterSpacing( QFont::AbsoluteSpacing, 0 ); continue; } else if( name() == "mCommandLineFont") { pT->mCommandLineFont.fromString( readElementText() ); continue; } else if( name() == "mFgColor2") { pT->mFgColor_2.setNamedColor( readElementText() ); continue; } else if( name() == "mBgColor2") { pT->mBgColor_2.setNamedColor( readElementText() ); continue; } else if( name() == "mBlack2") { pT->mBlack_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightBlack2") { pT->mLightBlack_2.setNamedColor( readElementText() ); continue; } else if( name() == "mRed2") { pT->mRed_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightRed2") { pT->mLightRed_2.setNamedColor( readElementText() ); continue; } else if( name() == "mBlue2") { pT->mBlue_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightBlue2") { pT->mLightBlue_2.setNamedColor( readElementText() ); continue; } else if( name() == "mGreen2") { pT->mGreen_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightGreen2") { pT->mLightGreen_2.setNamedColor( readElementText() ); continue; } else if( name() == "mYellow2") { pT->mYellow_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightYellow2") { pT->mLightYellow_2.setNamedColor( readElementText() ); continue; } else if( name() == "mCyan2") { pT->mCyan_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightCyan2") { pT->mLightCyan_2.setNamedColor( readElementText() ); continue; } else if( name() == "mMagenta2") { pT->mMagenta_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightMagenta2") { pT->mLightMagenta_2.setNamedColor( readElementText() ); continue; } else if( name() == "mWhite2") { pT->mWhite_2.setNamedColor( readElementText() ); continue; } else if( name() == "mLightWhite2") { pT->mLightWhite_2.setNamedColor( readElementText() ); continue; } else if( name() == "mSpellDic") { pT->mSpellDic = readElementText(); continue; } else if( name() == "mRoomSize" ) { pT->mRoomSize = readElementText().toDouble(); } else if( name() == "mLineSize" ) { pT->mLineSize = readElementText().toDouble(); } else { readUnknownHostElement(); } } } }
void TcxReader::readTrackpoint(CTrack *track, int lap) { Q_ASSERT(isStartElement() && name() == "Trackpoint"); CTrack::pt_t *pt = new CTrack::pt_t(); pt->lat = pold.lat; pt->lon = pold.lon; pt->ele = pold.ele; pt->distance = pold.distance; pt->heartReateBpm = pold.heartReateBpm; while (!atEnd()) { readNext(); if (isEndElement()) break; if (isStartElement()) { if (name() == "Time") { QDateTime time(QDateTime::fromString(readElementText(), Qt::ISODate)); time.setTimeSpec(Qt::UTC); pt->timestamp = time.toTime_t(); } else if (name() == "AltitudeMeters") { pt->ele = readElementText().toDouble(); pold.ele = pt->ele; } else if (name() == "DistanceMeters") { pt->distance = readElementText().toDouble(); pold.distance = pt->distance; } else if (name() == "Position") { readPosition(pt); pold.lat = pt->lat; pold.lon = pt->lon; firstPositionFound = true; } else if (name() == "HeartRateBpm") { readHeartRateBpm(pt); pold.heartReateBpm = pt->heartReateBpm; } else if (name() == "Cadence") { //readCadenceRpm(pt); pt->cadenceRpm = readElementText().toInt(); pold.cadenceRpm = pt->cadenceRpm; } else readUnknownElement(); } } pt->_lat=pt->lat; pt->_lon=pt->lon; pt->_ele=pt->ele; if (firstPositionFound) { *track << *pt; } }