Пример #1
0
void AStylePart::restorePartialProjectSession(const QDomElement * el)
{
	kdDebug(9009) << "Load project" << endl;
	QDomElement style = el->namedItem("AStyle").toElement();

	if (style.attribute("FStyle", "GLOBAL") == "GLOBAL")
	{
		m_project = m_global;
		m_project["FStyle"] = "GLOBAL";
		m_projectExtensions=m_globalExtensions;
	}
	else
	{
		for (QMap<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++)
        {
              m_project[iter.key()] = style.attribute(iter.key(),iter.data().toString());
		}

		QDomElement exten = el->namedItem("Extensions").toElement();
		QString ext = exten.attribute("ext").simplifyWhiteSpace();
		if ( ext.isEmpty()){
            ext=defaultFormatExtensions;
		}
		setExtensions(ext.replace(QChar(','), QChar('\n')),false);
	}
}
Пример #2
0
AviExporter::AviExporter()
{
   setName("AVI Product Exporter");
   setExtensions("AVI Movie Files (*.avi)");
   setShortDescription("Export AVI Movie Products");
   setDescriptorId("{B8281902-85B9-4037-A348-01C1DDB7D8CF}");
   setProductionStatus(APP_IS_PRODUCTION_RELEASE);
}
Пример #3
0
void XmppMessage::setHtml(const QString &html)
{
    QDomDocument doc;
    doc.setContent(html);
    QXmppElement element(doc.documentElement());
    QXmppElementList elementList = extensions();
    elementList << element;
    setExtensions(elementList);
}
Пример #4
0
DiHdfImporter::DiHdfImporter()
{
   setDescriptorId("{0da1caba-ee6f-440d-b53f-e0c317a8fba1}");
   setName("DI HDF Importer");
   setCreator("Ball Aerospace & Technologies Corp.");
   setCopyright(IMPORTERS_COPYRIGHT);
   setVersion(IMPORTERS_VERSION_NUMBER);
   setProductionStatus(IMPORTERS_IS_PRODUCTION_RELEASE);
   setExtensions("DI HDF Files (*.hdf)");
}
Пример #5
0
NefImporter::NefImporter()
{
   setDescriptorId("{cb8fc80b-4fcd-4c13-8183-61ec61e95cb2}");
   setName("NEF Importer");
   setCreator("Ball Aerospace & Technologies Corp.");
   setCopyright("abc");
   setVersion("0.1");
   setProductionStatus(false);
   setExtensions("NEF Filez (*.nef)");
}
Пример #6
0
void QXmppPresence::parse(const QDomElement &element)
{
    QXmppStanza::parse(element);

    setTypeFromStr(element.attribute("type"));
    m_status.parse(element);

    QDomElement xElement = element.firstChildElement("x");
    if(!xElement.isNull())
        setExtensions(QXmppElement(xElement));
}
Пример #7
0
void QXmppIq::parseElementFromChild(const QDomElement &element)
{
    QXmppElementList extensions;
    QDomElement itemElement = element.firstChildElement();
    while (!itemElement.isNull())
    {
        extensions.append(QXmppElement(itemElement));
        itemElement = itemElement.nextSiblingElement();
    }
    setExtensions(extensions);
}
Пример #8
0
VideoImporter::VideoImporter()
{
   av_register_all();

   setDescriptorId("{4d4d06b4-fa58-4cb2-b01b-9a027876258f}");
   setName("Video Importer");
   setCreator("Ball Aerospace & Technologies Corp.");
   setCopyright(VIDEO_COPYRIGHT);
   setVersion(VIDEO_VERSION_NUMBER);
   setProductionStatus(VIDEO_IS_PRODUCTION_RELEASE);
   setExtensions("Video Files (*.mpg *.avi)");
}
Пример #9
0
FitsImporter::FitsImporter()
{
   setDescriptorId("{299E1A6D-F80B-45D2-910D-0E318303CF88}");
   setName("FITS Importer");
   setCreator("Ball Aerospace & Technologies Corp.");
   setCopyright(APP_COPYRIGHT);
   setVersion(APP_VERSION_NUMBER);
   setProductionStatus(APP_IS_PRODUCTION_RELEASE);
   setExtensions("FITS Files (*.fit *.fts *.fits)");
   setWizardSupported(false);
   addDependencyCopyright("CFITSIO", Service<UtilityServices>()->getTextFromFile(":/licenses/cfitsio"));
}
LandsatGeotiffImporter::LandsatGeotiffImporter()
{
   setDescriptorId("{A8E57295-9A8-44FD-96D8-26A4FA13298F}");
   setName("Landsat GeoTIFF Importer");
   setCreator("Ball Aerospace & Technologies Corp.");
   setShortDescription("Importer for Landsat data in GeoTIFF format.");
   setCopyright(SPECTRAL_COPYRIGHT);
   setVersion(SPECTRAL_VERSION_NUMBER);
   setProductionStatus(SPECTRAL_IS_PRODUCTION_RELEASE);
   setExtensions("Landsat 5 Files (*_MTL.txt *_mtl.txt *.tif *.TIF);;"
      "Landsat 7 Files (*_MTL.txt *_mtl.txt *.tif *.TIF)");
}
Пример #11
0
MetadataExporter::MetadataExporter()
{
   setName("Metadata Exporter");
   setCreator("Ball Aerospace & Technologies Corp.");
   setCopyright(APP_COPYRIGHT);
   setVersion(APP_VERSION_NUMBER);
   setExtensions("Metadata Files (*.metadata.xml)");
   setDescription("Export Metadata from Data Elements");
   setSubtype("DataElement");
   setDescriptorId("{f48cae61-5827-45b7-8a0e-bf1a2d9f2f62}");
   setProductionStatus(APP_IS_PRODUCTION_RELEASE);
}
Пример #12
0
DicomImporter::DicomImporter()
{
   setDescriptorId("{A680AF67-0304-4e12-9B5F-BEC86CA5EC66}");
   setName("DICOM Importer");
   setCreator("Ball Aerospace & Technologies Corp.");
   setCopyright(IMPORTERS_COPYRIGHT);
   setVersion(IMPORTERS_VERSION_NUMBER);
   setProductionStatus(IMPORTERS_IS_PRODUCTION_RELEASE);
   setExtensions("DICOM Files (*.dcm)");
   DJDecoderRegistration::registerCodecs();
   DcmRLEDecoderRegistration::registerCodecs();
}
Пример #13
0
TVariable::TVariable(const TVariable& copyOf) : TSymbol(copyOf)
{
    type.deepCopy(copyOf.type);
    userType = copyOf.userType;
    numExtensions = 0;
    extensions = 0;
    if (copyOf.numExtensions != 0)
        setExtensions(copyOf.numExtensions, copyOf.extensions);

    if (! copyOf.constArray.empty()) {
        assert(! copyOf.type.isStruct());
        TConstUnionArray newArray(copyOf.constArray, 0, copyOf.constArray.size());
        constArray = newArray;
    }

    // don't support specialization-constant subtrees in cloned tables
    constSubtree = nullptr;
}
Пример #14
0
AStylePart::AStylePart(QObject *parent, const char *name, const QStringList &)
  : KDevSourceFormatter(&data, parent, name ? name : "AStylePart")
{
  setInstance(AStyleFactory::instance());

  setXMLFile("kdevpart_astyle.rc");

  formatTextAction = new KAction(i18n("&Reformat Source"), 0, this, SLOT(beautifySource()), actionCollection(), "edit_astyle");
  formatTextAction->setEnabled(false);
  formatTextAction->setToolTip(i18n("Reformat source"));
  formatTextAction->setWhatsThis(i18n("<b>Reformat source</b><p>Source reformatting functionality using <b>astyle</b> library. "
                             "Also available in <b>New Class</b> and <b>Subclassing</b> wizards."));

  formatFileAction = new KAction(i18n("Format files"), 0, this, SLOT(formatFilesSelect()), actionCollection(), "tools_astyle");
  formatFileAction->setEnabled(false);
  formatFileAction->setToolTip(i18n("Format files"));
  formatFileAction->setWhatsThis(i18n("<b>Fomat files</b><p>Formatting functionality using <b>astyle</b> library. "
                             "Also available in <b>New Class</b> and <b>Subclassing</b> wizards."));
  formatFileAction->setEnabled ( true );

  m_configProxy = new ConfigWidgetProxy(core());
  m_configProxy->createGlobalConfigPage(i18n("Formatting"), GLOBALDOC_OPTIONS, info()->icon());
  m_configProxy->createProjectConfigPage(i18n("Formatting"), PROJECTDOC_OPTIONS, info()->icon());


  connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase* ,QWidget*,unsigned int)), this, SLOT(insertConfigWidget(const KDialogBase*,QWidget*,unsigned int)));

  connect(partController(), SIGNAL(activePartChanged(KParts::Part*)), this, SLOT(activePartChanged(KParts::Part*)));

  connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)) );

  loadGlobal();
  //use the globals first, project level will override later..
  m_project=m_global;
  m_projectExtensions = m_globalExtensions;
  setExtensions(m_globalExtensions.join("\n"),false);

  // maybe there is a file open already
  activePartChanged( partController()->activePart() );

}
Пример #15
0
TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf)
{
    for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) {
        TParameter param;
        parameters.push_back(param);
        parameters.back().copyParam(copyOf.parameters[i]);
    }

    numExtensions = 0;
    extensions = 0;
    if (copyOf.extensions != 0)
        setExtensions(copyOf.numExtensions, copyOf.extensions);
    returnType.deepCopy(copyOf.returnType);
    mangledName = copyOf.mangledName;
    op = copyOf.op;
    defined = copyOf.defined;
    prototyped = copyOf.prototyped;
    implicitThis = copyOf.implicitThis;
    illegalImplicitThis = copyOf.illegalImplicitThis;
    defaultParamCount = copyOf.defaultParamCount;
}
Пример #16
0
PlatformArduino::PlatformArduino() : Platform(QString("Arduino"))
{
    setReferenceUrl(QUrl(QString("http://arduino.cc/en/Reference/")));
    setIdeName("Arduino IDE");
    setDownloadUrl(QUrl("http://arduino.cc/en/Main/Software"));
    setMinVersion("1.5.2");
    setCanProgram(true);
    setExtensions(QStringList() << ".ino" << ".pde");

    QMap<QString, QString> boards;
    // https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/avr/boards.txt
    boards.insert("Arduino UNO", "arduino:avr:uno");
    boards.insert("Arduino Yún", "arduino:avr:yun");
    boards.insert("Arduino Mega/2560", "arduino:avr:mega");
    boards.insert("Arduino Duemilanove/Diecemila", "arduino:avr:diecimila");
    boards.insert("Arduino Nano", "arduino:avr:nano");
    boards.insert("Arduino Mega ADK", "arduino:avr:megaADK");
    boards.insert("Arduino Leonardo", "arduino:avr:leonardo");
    boards.insert("Arduino Micro", "arduino:avr:micro");
    boards.insert("Arduino Esplora", "arduino:avr:Esplora");
    boards.insert("Arduino Mini", "arduino:avr:mini");
    boards.insert("Arduino Ethernet", "arduino:avr:ethernet");
    boards.insert("Arduino Fio", "arduino:avr:fio");
    boards.insert("Arduino BT", "arduino:avr:bt");
    boards.insert("Lilypad Arduino USB", "arduino:avr:LilyPadUSB");
    boards.insert("LilyPad Arduino ", "arduino:avr:lilypad");
    boards.insert("Arduino Pro/Pro Mini", "arduino:avr:pro");
    boards.insert("Arduino NG or older", "arduino:avr:atmegang");
    boards.insert("Arduino Robot Control", "arduino:avr:robotControl");
    boards.insert("Arduino Robot Motor", "arduino:avr:robotMotor");
    // https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/sam/boards.txt
    boards.insert("Arduino Due (Programming Port)", "arduino:sam:arduino_due_x_dbg");
    boards.insert("Arduino Due (Native USB Port)", "arduino:sam:arduino_due_x");
    setBoards(boards);

    setDefaultBoardName("Arduino UNO");
}
Пример #17
0
PlatformPicaxe::PlatformPicaxe() : Platform(QString("PICAXE"))
{
    setReferenceUrl(QUrl("http://www.picaxe.com/BASIC-Commands"));
    setCanProgram(true);
    setIdeName("PICAXE Compilers");
    setDownloadUrl(QUrl("http://www.picaxe.com/Software/Drivers/PICAXE-Compilers/"));
    setMinVersion("2.0");
    setExtensions(QStringList() << ".bas" << ".BAS");

    QMap<QString, QString> boards;
    boards.insert("PICAXE-08", "picaxe08");
    boards.insert("PICAXE-08M", "picaxe08m");
    boards.insert("PICAXE-08M2", "picaxe08m2");
    boards.insert("PICAXE-08M2LE", "picaxe08m2le");
    boards.insert("PICAXE-14M", "picaxe14m");
    boards.insert("PICAXE-14M2", "picaxe14m2");
    boards.insert("PICAXE-18", "picaxe18");
    boards.insert("PICAXE-18A", "picaxe18a");
    boards.insert("PICAXE-18M", "picaxe18m");
    boards.insert("PICAXE-18M2", "picaxe18m2");
    boards.insert("PICAXE-18X", "picaxe18x");
    boards.insert("PICAXE-20", "picaxe20");
    boards.insert("PICAXE-20M2", "picaxe20m2");
    boards.insert("PICAXE-20X2", "picaxe20x2");
    boards.insert("PICAXE-28", "picaxe28");
    boards.insert("PICAXE-28A", "picaxe28a");
    boards.insert("PICAXE-28X", "picaxe28x");
    boards.insert("PICAXE-28X1", "picaxe28x1");
    boards.insert("PICAXE-28X2", "picaxe28x2");
    boards.insert("PICAXE-40X", "picaxe28x");
    boards.insert("PICAXE-40X1", "picaxe28x1");
    boards.insert("PICAXE-40X2", "picaxe28x2");
    setBoards(boards);

    setDefaultBoardName("PICAXE-08M");
}
Пример #18
0
/// \cond
void QXmppMessage::parse(const QDomElement &element)
{
    QXmppStanza::parse(element);

    const QString type = element.attribute("type");
    d->type = Normal;
    for (int i = Error; i <= Headline; i++) {
        if (type == message_types[i]) {
            d->type = static_cast<Type>(i);
            break;
        }
    }

    d->body = element.firstChildElement("body").text();
    d->subject = element.firstChildElement("subject").text();
    d->thread = element.firstChildElement("thread").text();

    // chat states
    for (int i = Active; i <= Paused; i++)
    {
        QDomElement stateElement = element.firstChildElement(chat_states[i]);
        if (!stateElement.isNull() &&
            stateElement.namespaceURI() == ns_chat_states)
        {
            d->state = static_cast<QXmppMessage::State>(i);
            break;
        }
    }

    // XEP-0071: XHTML-IM
    QDomElement htmlElement = element.firstChildElement("html");
    if (!htmlElement.isNull() && htmlElement.namespaceURI() == ns_xhtml_im) {
        QDomElement bodyElement = htmlElement.firstChildElement("body");
        if (!bodyElement.isNull() && bodyElement.namespaceURI() == ns_xhtml) {
            QTextStream stream(&d->xhtml, QIODevice::WriteOnly);
            bodyElement.save(stream, 0);

            d->xhtml = d->xhtml.mid(d->xhtml.indexOf('>') + 1);
            d->xhtml.replace(" xmlns=\"http://www.w3.org/1999/xhtml\"", "");
            d->xhtml.replace("</body>", "");
            d->xhtml = d->xhtml.trimmed();
        }
    }

    // XEP-0184: Message Delivery Receipts
    QDomElement receivedElement = element.firstChildElement("received");
    if (!receivedElement.isNull() && receivedElement.namespaceURI() == ns_message_receipts) {
        d->receiptId = receivedElement.attribute("id");

        // compatibility with old-style XEP
        if (d->receiptId.isEmpty())
            d->receiptId = id();
    } else {
        d->receiptId = QString();
    }
    d->receiptRequested = element.firstChildElement("request").namespaceURI() == ns_message_receipts;

    // XEP-0203: Delayed Delivery
    QDomElement delayElement = element.firstChildElement("delay");
    if (!delayElement.isNull() && delayElement.namespaceURI() == ns_delayed_delivery)
    {
        const QString str = delayElement.attribute("stamp");
        d->stamp = QXmppUtils::datetimeFromString(str);
        d->stampType = DelayedDelivery;
    }

    // XEP-0224: Attention
    d->attentionRequested = element.firstChildElement("attention").namespaceURI() == ns_attention;

    // XEP-0333: Chat Markers
    QDomElement markableElement = element.firstChildElement("markable");
    if (!markableElement.isNull())
    {
        d->markable = true;
    }
    // check for all the marker types
    QDomElement chatStateElement;
    QXmppMessage::Marker marker = QXmppMessage::NoMarker;
    for (int i = Received; i <= Acknowledged; i++)
    {
        chatStateElement = element.firstChildElement(marker_types[i]);
        if (!chatStateElement.isNull() &&
            chatStateElement.namespaceURI() == ns_chat_markers)
        {
            marker = static_cast<QXmppMessage::Marker>(i);
            break;
        }
    }
    // if marker is present, check it's the right ns
    if (!chatStateElement.isNull())
    {
        if (chatStateElement.namespaceURI() == ns_chat_markers)
        {
            d->marker = marker;
            d->markedId = chatStateElement.attribute("id", QString());
            d->markedThread = chatStateElement.attribute("thread", QString());
        }
    }

    // XEP-0280: Message Carbons
    QDomElement privateElement = element.firstChildElement("private");
    if (!privateElement.isNull())
        d->privatemsg = true;

    // XEP-0308: Last Message Correction
    QDomElement replaceElement = element.firstChildElement("replace");
    if (!replaceElement.isNull() && replaceElement.namespaceURI() == ns_message_correct)
        d->replaceId = replaceElement.attribute("id");

    const QList<QPair<QString, QString> > &knownElems = knownMessageSubelems();

    QXmppElementList extensions;
    QDomElement xElement = element.firstChildElement();
    while (!xElement.isNull())
    {
        if (xElement.tagName() == "x")
        {
            if (xElement.namespaceURI() == ns_legacy_delayed_delivery)
            {
                // if XEP-0203 exists, XEP-0091 has no need to parse because XEP-0091 is no more standard protocol)
                if (d->stamp.isNull())
                {
                    // XEP-0091: Legacy Delayed Delivery
                    const QString str = xElement.attribute("stamp");
                    d->stamp = QDateTime::fromString(str, "yyyyMMddThh:mm:ss");
                    d->stamp.setTimeSpec(Qt::UTC);
                    d->stampType = LegacyDelayedDelivery;
                }
            } else if (xElement.namespaceURI() == ns_conference) {
                // XEP-0249: Direct MUC Invitations
                d->mucInvitationJid = xElement.attribute("jid");
                d->mucInvitationPassword = xElement.attribute("password");
                d->mucInvitationReason = xElement.attribute("reason");
            } else if (xElement.namespaceURI() == ns_oob) {
                // XEP-0066: Out of Band Data
                d->outOfBandUrl = xElement.firstChildElement("url").text();
            }
            else {
                extensions << QXmppElement(xElement);
            }
        // XEP-0369: Mediated Information eXchange (MIX)
        } else if (xElement.tagName() == "mix" && xElement.namespaceURI() == ns_mix) {
            d->mixUserJid = xElement.firstChildElement("jid").text();
            d->mixUserNick = xElement.firstChildElement("nick").text();
        // XEP-0382: Spoiler messages
        } else if (xElement.tagName() == "spoiler" && xElement.namespaceURI() == ns_spoiler) {
            d->isSpoiler = true;
            d->spoilerHint = xElement.text();
        } else if (!knownElems.contains(qMakePair(xElement.tagName(), xElement.namespaceURI())) &&
                   !knownElems.contains(qMakePair(xElement.tagName(), QString()))) {
            // other extensions
            extensions << QXmppElement(xElement);
        }
        xElement = xElement.nextSiblingElement();
    }
    setExtensions(extensions);
}
Пример #19
0
/// \cond
void QXmppPresence::parse(const QDomElement &element)
{
    QXmppStanza::parse(element);

    const QString type = element.attribute("type");
    for (int i = Error; i <= Probe; i++) {
        if (type == presence_types[i]) {
            d->type = static_cast<Type>(i);
            break;
        }
    }
    const QString show = element.firstChildElement("show").text();
    for (int i = Online; i <= Invisible; i++) {
        if (show == presence_shows[i]) {
            d->availableStatusType = static_cast<AvailableStatusType>(i);
            break;
        }
    }
    d->statusText = element.firstChildElement("status").text();
    d->priority = element.firstChildElement("priority").text().toInt();

    QXmppElementList extensions;
    QDomElement xElement = element.firstChildElement();
    d->vCardUpdateType = VCardUpdateNone;
    while(!xElement.isNull())
    {
        // XEP-0045: Multi-User Chat
        if(xElement.namespaceURI() == ns_muc) {
            d->mucSupported = true;
            d->mucPassword = xElement.firstChildElement("password").text();
        }
        else if(xElement.namespaceURI() == ns_muc_user)
        {
            QDomElement itemElement = xElement.firstChildElement("item");
            d->mucItem.parse(itemElement);
            QDomElement statusElement = xElement.firstChildElement("status");
            d->mucStatusCodes.clear();
            while (!statusElement.isNull()) {
                d->mucStatusCodes << statusElement.attribute("code").toInt();
                statusElement = statusElement.nextSiblingElement("status");
            }
        }
        // XEP-0153: vCard-Based Avatars
        else if(xElement.namespaceURI() == ns_vcard_update)
        {
            QDomElement photoElement = xElement.firstChildElement("photo");
            if(!photoElement.isNull())
            {
                d->photoHash = QByteArray::fromHex(photoElement.text().toLatin1());
                if(d->photoHash.isEmpty())
                    d->vCardUpdateType = VCardUpdateNoPhoto;
                else
                    d->vCardUpdateType = VCardUpdateValidPhoto;
            }
            else
            {
                d->photoHash = QByteArray();
                d->vCardUpdateType = VCardUpdateNotReady;
            }
        }
        // XEP-0115: Entity Capabilities
        else if(xElement.tagName() == "c" && xElement.namespaceURI() == ns_capabilities)
        {
            d->capabilityNode = xElement.attribute("node");
            d->capabilityVer = QByteArray::fromBase64(xElement.attribute("ver").toLatin1());
            d->capabilityHash = xElement.attribute("hash");
            d->capabilityExt = xElement.attribute("ext").split(" ", QString::SkipEmptyParts);
        }
        else if (xElement.tagName() == "addresses")
        {
        }
        else if (xElement.tagName() == "error")
        {
        }
        else if (xElement.tagName() == "show")
        {
        }
        else if (xElement.tagName() == "status")
        {
        }
        else if (xElement.tagName() == "priority")
        {
        }
        else
        {
            // other extensions
            extensions << QXmppElement(xElement);
        }
        xElement = xElement.nextSiblingElement();
    }
    setExtensions(extensions);
}
/// \cond
void QXmppMessage::parse(const QDomElement &element)
{
    QXmppStanza::parse(element);

    const QString type = element.attribute("type");
    d->type = Normal;
    for (int i = Error; i <= Headline; i++) {
        if (type == message_types[i]) {
            d->type = static_cast<Type>(i);
            break;
        }
    }

    d->body = element.firstChildElement("body").text();
    d->subject = element.firstChildElement("subject").text();
    d->thread = element.firstChildElement("thread").text();

    // chat states
    for (int i = Active; i <= Paused; i++)
    {
        QDomElement stateElement = element.firstChildElement(chat_states[i]);
        if (!stateElement.isNull() &&
            stateElement.namespaceURI() == ns_chat_states)
        {
            d->state = static_cast<QXmppMessage::State>(i);
            break;
        }
    }

    // XEP-0071: XHTML-IM
    QDomElement htmlElement = element.firstChildElement("html");
    if (!htmlElement.isNull() && htmlElement.namespaceURI() == ns_xhtml_im) {
        QDomElement bodyElement = htmlElement.firstChildElement("body");
        if (!bodyElement.isNull() && bodyElement.namespaceURI() == ns_xhtml) {
            QTextStream stream(&d->xhtml, QIODevice::WriteOnly);
            bodyElement.save(stream, 0);

            d->xhtml = d->xhtml.mid(d->xhtml.indexOf('>') + 1);
            d->xhtml.replace(" xmlns=\"http://www.w3.org/1999/xhtml\"", "");
            d->xhtml.replace("</body>", "");
            d->xhtml = d->xhtml.trimmed();
        }
    }

    // XEP-0184: Message Delivery Receipts
    QDomElement receivedElement = element.firstChildElement("received");
    if (!receivedElement.isNull() && receivedElement.namespaceURI() == ns_message_receipts) {
        d->receiptId = receivedElement.attribute("id");

        // compatibility with old-style XEP
        if (d->receiptId.isEmpty())
            d->receiptId = id();
    } else {
        d->receiptId = QString();
    }
    d->receiptRequested = element.firstChildElement("request").namespaceURI() == ns_message_receipts;

    // XEP-0203: Delayed Delivery
    QDomElement delayElement = element.firstChildElement("delay");
    if (!delayElement.isNull() && delayElement.namespaceURI() == ns_delayed_delivery)
    {
        const QString str = delayElement.attribute("stamp");
        d->stamp = QXmppUtils::datetimeFromString(str);
        d->stampType = DelayedDelivery;
    }

    // XEP-0313: Extract forwarded message from mam packet
    QDomElement mamElement = element.firstChildElement("result");
    if (!mamElement.isNull() && mamElement.namespaceURI() == ns_simple_archive)
    {
        QDomElement forwardedElement = mamElement.firstChildElement("forwarded");
        if (!forwardedElement.isNull() && forwardedElement.namespaceURI() == ns_stanza_forwarding)
        {
            setMaMMessage(parseForward(forwardedElement));
        }
    }

    // XEP-0280: message carbons
    QDomElement carbonElement = element.firstChildElement("sent");
    if (!carbonElement.isNull() && carbonElement.namespaceURI() == ns_message_carbons)
    {
        QDomElement forwardedElement = carbonElement.firstChildElement("forwarded");
        if (!forwardedElement.isNull() && forwardedElement.namespaceURI() == ns_stanza_forwarding)
        {
            setMessagecarbon(parseForward(forwardedElement));
        }
    }

    // XEP-0297: Forwarding
    QDomElement forwardedElement = element.firstChildElement("forwarded");
    if (!forwardedElement.isNull() && forwardedElement.namespaceURI() == ns_stanza_forwarding)
    {
        setForwarded(parseForward(forwardedElement));
    }

    // XEP-0224: Attention
    d->attentionRequested = element.firstChildElement("attention").namespaceURI() == ns_attention;

    // XEP-0334: Message Processing Hints
    // check for all the marker types
    QDomElement hintElement;
    for (int i = NoPermanentStorage; i <= AllowPermantStorage; i++)
    {
        hintElement = element.firstChildElement(hint_types[i]);
        if (!hintElement.isNull() &&
            hintElement.namespaceURI() == ns_message_processing_hints)
        {
            d->hints.append(static_cast<QXmppMessage::Hint>(i));
        }
    }

    // XEP-0333: Chat Markers
    QDomElement markableElement = element.firstChildElement("markable");
    if (!markableElement.isNull())
    {
        d->markable = true;
    }
    // check for all the marker types
    QDomElement chatStateElement;
    QXmppMessage::Marker marker = QXmppMessage::NoMarker;
    for (int i = Received; i <= Acknowledged; i++)
    {
        chatStateElement = element.firstChildElement(marker_types[i]);
        if (!chatStateElement.isNull() &&
            chatStateElement.namespaceURI() == ns_chat_markers)
        {
            marker = static_cast<QXmppMessage::Marker>(i);
            break;
        }
    }
    // if marker is present, check it's the right ns
    if (!chatStateElement.isNull())
    {
        if (chatStateElement.namespaceURI() == ns_chat_markers)
        {
            d->marker = marker;
            d->markedId = chatStateElement.attribute("id", QString());
            d->markedThread = chatStateElement.attribute("thread", QString());
        }
    }

    // XEP-0308: Last Message Correction
    QDomElement replaceElement = element.firstChildElement("replace");
    if(!replaceElement.isNull())
    {
        if(replaceElement.namespaceURI() == ns_replace_message)
        {
            d->replace = true;
            d->replaceId = replaceElement.attribute("id", QString());
        }
    }

    QXmppElementList extensions;
    QDomElement xElement = element.firstChildElement("x");
    while (!xElement.isNull())
    {
        if (xElement.namespaceURI() == ns_legacy_delayed_delivery)
        {
            // XEP-0091: Legacy Delayed Delivery
            const QString str = xElement.attribute("stamp");
            d->stamp = QDateTime::fromString(str, "yyyyMMddThh:mm:ss");
            d->stamp.setTimeSpec(Qt::UTC);
            d->stampType = LegacyDelayedDelivery;
        } else if (xElement.namespaceURI() == ns_conference) {
            // XEP-0249: Direct MUC Invitations
            d->mucInvitationJid = xElement.attribute("jid");
            d->mucInvitationPassword = xElement.attribute("password");
            d->mucInvitationReason = xElement.attribute("reason");
        } else {
            // other extensions
            extensions << QXmppElement(xElement);
        }
        xElement = xElement.nextSiblingElement("x");
    }
    setExtensions(extensions);
}
Пример #21
0
void Mesh2Cloud::Factory::init() {
	auto file = gui()->properties()->add<File>("Input Mesh", "meshFile");
	file->setExtensions({"obj"});
}
Пример #22
0
/// \cond
void QXmppMessage::parse(const QDomElement &element)
{
    QXmppStanza::parse(element);

    const QString type = element.attribute("type");
    d->type = Normal;
    for (int i = Error; i <= Headline; i++) {
        if (type == message_types[i]) {
            d->type = static_cast<Type>(i);
            break;
        }
    }

    d->body = element.firstChildElement("body").text();
    d->subject = element.firstChildElement("subject").text();
    d->thread = element.firstChildElement("thread").text();

    // chat states
    for (int i = Active; i <= Paused; i++)
    {
        QDomElement stateElement = element.firstChildElement(chat_states[i]);
        if (!stateElement.isNull() &&
            stateElement.namespaceURI() == ns_chat_states)
        {
            d->state = static_cast<QXmppMessage::State>(i);
            break;
        }
    }

    // XEP-0071: XHTML-IM
    QDomElement htmlElement = element.firstChildElement("html");
    if (!htmlElement.isNull() && htmlElement.namespaceURI() == ns_xhtml_im) {
        QDomElement bodyElement = htmlElement.firstChildElement("body");
        if (!bodyElement.isNull() && bodyElement.namespaceURI() == ns_xhtml) {
            QTextStream stream(&d->xhtml, QIODevice::WriteOnly);
            bodyElement.save(stream, 0);

            d->xhtml = d->xhtml.mid(d->xhtml.indexOf('>') + 1);
            d->xhtml.replace(" xmlns=\"http://www.w3.org/1999/xhtml\"", "");
            d->xhtml.replace("</body>", "");
            d->xhtml = d->xhtml.trimmed();
        }
    }

    // XEP-0184: Message Delivery Receipts
    QDomElement receivedElement = element.firstChildElement("received");
    if (!receivedElement.isNull() && receivedElement.namespaceURI() == ns_message_receipts) {
        d->receiptId = receivedElement.attribute("id");

        // compatibility with old-style XEP
        if (d->receiptId.isEmpty())
            d->receiptId = id();
    } else {
        d->receiptId = QString();
    }
    d->receiptRequested = element.firstChildElement("request").namespaceURI() == ns_message_receipts;

    // XEP-0203: Delayed Delivery
    QDomElement delayElement = element.firstChildElement("delay");
    if (!delayElement.isNull() && delayElement.namespaceURI() == ns_delayed_delivery)
    {
        const QString str = delayElement.attribute("stamp");
        d->stamp = QXmppUtils::datetimeFromString(str);
        d->stampType = DelayedDelivery;
    }

    // XEP-0224: Attention
    d->attentionRequested = element.firstChildElement("attention").namespaceURI() == ns_attention;

    const QList<QPair<QString, QString> > &knownElems = knownMessageSubelems();

    QXmppElementList extensions;
    QDomElement xElement = element.firstChildElement();
    while (!xElement.isNull())
    {
        if (xElement.tagName() == "x")
        {
            if (xElement.namespaceURI() == ns_legacy_delayed_delivery)
            {
                // XEP-0091: Legacy Delayed Delivery
                const QString str = xElement.attribute("stamp");
                d->stamp = QDateTime::fromString(str, "yyyyMMddThh:mm:ss");
                d->stamp.setTimeSpec(Qt::UTC);
                d->stampType = LegacyDelayedDelivery;
            } else if (xElement.namespaceURI() == ns_conference) {
                // XEP-0249: Direct MUC Invitations
                d->mucInvitationJid = xElement.attribute("jid");
                d->mucInvitationPassword = xElement.attribute("password");
                d->mucInvitationReason = xElement.attribute("reason");
            }
            else {
                extensions << QXmppElement(xElement);
            }
        } else if (!knownElems.contains(qMakePair(xElement.tagName(), xElement.namespaceURI())) &&
                   !knownElems.contains(qMakePair(xElement.tagName(), QString()))) {
            // other extensions
            extensions << QXmppElement(xElement);
        }
        xElement = xElement.nextSiblingElement();
    }
    setExtensions(extensions);
}