Esempio n. 1
0
/**
 * Supports only rendering of local files and resources that can be downloaded over
 * the http protocol. In the latter case the download gets started.
 */
void TextBrowser::setSource (const QUrl& url)
{
  bool relativeUrl = url.isRelative();
  if (!relativeUrl)
    d->source = url; // last set absolute url
  QString name = url.toString();
  if (url.scheme() == QLatin1String("http")) {
    // start the download but do not call setSource() of the base
    // class because we must wait until the data are available.
    // The slot done() is invoked automatically then. 
    d->http->setHost(url.host());
    d->http->get(url.path(), 0);
  } else if (d->source.scheme() == QLatin1String("http")) {
    // relative hyperlink in previously downloaded a HTML page 
    d->source = d->source.resolved(url);
    d->http->get(url.path(), 0);
  } else {
    QUrl resolved = url;
#if defined (Q_OS_WIN)
    if (url.scheme() == QLatin1String("file") && !url.isRelative()) {
      QString auth = url.authority();
      QString path = url.path();
      //If we click on a hyperlink with a reference to an absolute file name
      //then we get a string that cannot be used to open the file. So we try 
      //to reproduce the original url.
      if (!auth.isEmpty() && !path.isEmpty()) {
        QString fileName = auth + QLatin1Char(':') + path;
        resolved = QUrl::fromLocalFile(fileName);
      }
    }
#endif
    QTextBrowser::setSource(resolved);
  }
}
Item DocumentURIFN::evaluateSingleton(const DynamicContext::Ptr &context) const
{
    const Item node(m_operands.first()->evaluateSingleton(context));

    if(node)
    {
        const QUrl documentURI(node.asNode().documentUri());

        if(documentURI.isValid())
        {
            if(documentURI.isEmpty())
                return Item();
            else
            {
                Q_ASSERT_X(!documentURI.isRelative(), Q_FUNC_INFO,
                           "The document URI must be absolute.");
                return toItem(AnyURI::fromValue(documentURI));
            }
        }
        else
            return Item();
    }
    else
        return Item();
}
Esempio n. 3
0
bool Utils::isValidLocalPath(const QString &value)
{
	QUrl		url;
	
	url.setUrl(value);
	return (url.isValid() && (url.isRelative() || url.scheme().toLower() == "file") );
}
Esempio n. 4
0
void RSSWidget::addRss()
{
    if (!m_view) {
        return;
    }
    if (QPushButton* button = qobject_cast<QPushButton*>(sender())) {
        QUrl url = button->property("rss-url").toUrl();

        if (url.isRelative()) {
            url = m_view->page()->mainFrame()->baseUrl().resolved(url);
        }

        if (!url.isValid()) {
            return;
        }

        QString title = button->property("rss-title").toString();
        if (title.isEmpty()) {
            title = m_view->url().host();
        }

        RSSNotification* notif = new RSSNotification(title, url, m_view);
        m_view->addNotification(notif);
        close();
    }
}
Esempio n. 5
0
QVariant HelpBrowser::loadResource(int type, const QUrl &name){



      QTextBrowser::loadResource(type, name);

//      if (name.scheme() == "qthelp")
//          return QVariant(m_helpEngine->fileData(name));
//      else
//          return QTextBrowser::loadResource(type, name);


    return   m_helpEngine->fileData(name);




     QByteArray ba;
    if (type < 10 && m_helpEngine) {
        QUrl url(name);
        if (name.isRelative())
            url = source().resolved(url);
        ba = m_helpEngine->fileData(url);
    }
    return ba;
}
Esempio n. 6
0
/*!
    Load the QDeclarativeComponent from the provided \a url.

    Ensure that the URL provided is full and correct, in particular, use
    \l QUrl::fromLocalFile() when loading a file from the local filesystem.
*/
void QDeclarativeComponent::loadUrl(const QUrl &url)
{
    Q_D(QDeclarativeComponent);

    d->clear();

    if (url.isRelative() && !url.isEmpty())
        d->url = d->engine->baseUrl().resolved(url);
    else
        d->url = url;

    if (url.isEmpty()) {
        QDeclarativeError error;
        error.setDescription(tr("Invalid empty URL"));
        d->state.errors << error;
        return;
    }

    QDeclarativeCompositeTypeData *data =
        QDeclarativeEnginePrivate::get(d->engine)->typeManager.get(d->url);

    if (data->status == QDeclarativeCompositeTypeData::Waiting
            || data->status == QDeclarativeCompositeTypeData::WaitingResources)
    {
        d->typeData = data;
        d->typeData->addWaiter(d);
        d->progress = data->progress;
    } else {
        d->fromTypeData(data);
        d->progress = 1.0;
    }

    emit statusChanged(status());
    emit progressChanged(d->progress);
}
Esempio n. 7
0
bool QUrlProto::isRelative() const
{
  QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
  if (item)
    return item->isRelative();
  return false;
}
Esempio n. 8
0
QUrl searchForResourceSearchPath(const QUrl& baseUrl,
                                 const QUrl& url,
                                 const QStringList& searchPath)
{
  if (url.isRelative()) {
    if (!baseUrl.isLocalFile()) {
      return baseUrl.resolved(url);
    }

    auto path = url.path();
    if (!path.startsWith("/")) {
      auto resolvedUrl = baseUrl.resolved(url);
      if (QFile::exists(resolvedUrl.toLocalFile())) {
        return resolvedUrl;
      }
    } else if (!path.contains("/../")) {
      auto pathRelPart = path.split(QRegularExpression("^/+"))[1];
      for (const auto& str : searchPath) {
        auto dir = QDir(str);
        auto absPath = QDir::cleanPath(dir.absoluteFilePath(pathRelPart));

        if (QFile::exists(absPath)) {
          return QUrl::fromLocalFile(absPath);
        }
      }

      return QUrl();
    } else {
      return QUrl();
    }
  }

  return url;
}
Esempio n. 9
0
QString VWebUtils::copyResource(const QUrl &p_url, const QString &p_folder) const
{
    Q_ASSERT(!p_url.isRelative());

    QDir dir(p_folder);
    if (!dir.exists()) {
        VUtils::makePath(p_folder);
    }

    QString file = p_url.isLocalFile() ? p_url.toLocalFile() : p_url.toString();
    QString fileName = VUtils::fileNameFromPath(file);
    fileName = VUtils::getFileNameWithSequence(p_folder, fileName, true);
    QString targetFile = dir.absoluteFilePath(fileName);

    bool succ = false;
    if (p_url.scheme() == "https" || p_url.scheme() == "http") {
        // Download it.
        QByteArray data = VDownloader::downloadSync(p_url);
        if (!data.isEmpty()) {
            succ = VUtils::writeFileToDisk(targetFile, data);
        }
    } else if (QFileInfo::exists(file)) {
        // Do a copy.
        succ = VUtils::copyFile(file, targetFile, false);
    }

    return succ ? targetFile : QString();
}
Esempio n. 10
0
QUrl QQmlContextData::resolvedUrl(const QUrl &src)
{
    QQmlContextData *ctxt = this;

    QUrl resolved;
    if (src.isRelative() && !src.isEmpty()) {
        if (ctxt) {
            while(ctxt) {
                if (ctxt->url().isValid())
                    break;
                else
                    ctxt = ctxt->parent;
            }

            if (ctxt)
                resolved = ctxt->url().resolved(src);
            else if (engine)
                resolved = engine->baseUrl().resolved(src);
        }
    } else {
        resolved = src;
    }

    if (resolved.isEmpty()) //relative but no ctxt
        return resolved;

    if (engine && engine->urlInterceptor())
        resolved = engine->urlInterceptor()->intercept(resolved, QQmlAbstractUrlInterceptor::UrlString);
    return resolved;
}
Esempio n. 11
0
void OffscreenSurface::loadInternal(const QUrl& qmlSource,
                                    bool createNewContext,
                                    QQuickItem* parent,
                                    const QmlContextObjectCallback& callback) {
    if (QThread::currentThread() != thread()) {
        qFatal("Called load on a non-surface thread");
    }
    // Synchronous loading may take a while; restart the deadlock timer
    QMetaObject::invokeMethod(qApp, "updateHeartbeat", Qt::DirectConnection);

    if (!getRootItem()) {
        _sharedObject->create(this);
    }

    QUrl finalQmlSource = qmlSource;
    if ((qmlSource.isRelative() && !qmlSource.isEmpty()) || qmlSource.scheme() == QLatin1String("file")) {
        finalQmlSource = getSurfaceContext()->resolvedUrl(qmlSource);
    }

    if (!getRootItem()) {
        _sharedObject->setObjectName(finalQmlSource.toString());
    }

    auto targetContext = contextForUrl(finalQmlSource, parent, createNewContext);
    auto qmlComponent = new QQmlComponent(getSurfaceContext()->engine(), finalQmlSource, QQmlComponent::PreferSynchronous);
    if (qmlComponent->isLoading()) {
        connect(qmlComponent, &QQmlComponent::statusChanged, this,
                [=](QQmlComponent::Status) { finishQmlLoad(qmlComponent, targetContext, parent, callback); });
        return;
    }

    finishQmlLoad(qmlComponent, targetContext, parent, callback);
}
Esempio n. 12
0
/*!
    Load the QDeclarativeComponent from the provided \a url.

    Ensure that the URL provided is full and correct, in particular, use
    \l QUrl::fromLocalFile() when loading a file from the local filesystem.
*/
void QDeclarativeComponent::loadUrl(const QUrl &url)
{
    Q_D(QDeclarativeComponent);

    d->clear();

    if ((url.isRelative() && !url.isEmpty())
    || url.scheme() == QLatin1String("file")) // Workaround QTBUG-11929
        d->url = d->engine->baseUrl().resolved(url);
    else
        d->url = url;

    if (url.isEmpty()) {
        QDeclarativeError error;
        error.setDescription(tr("Invalid empty URL"));
        d->state.errors << error;
        return;
    }

    QDeclarativeTypeData *data = QDeclarativeEnginePrivate::get(d->engine)->typeLoader.get(d->url);

    if (data->isCompleteOrError()) {
        d->fromTypeData(data);
        d->progress = 1.0;
    } else {
        d->typeData = data;
        d->typeData->registerCallback(d);
        d->progress = data->progress();
    }

    emit statusChanged(status());
    emit progressChanged(d->progress);
}
Esempio n. 13
0
static inline QUrl ensureAbsoluteUrl(const QUrl &url)
{
    if (!url.isRelative())
        return url;

    return QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath());
}
Esempio n. 14
0
ItemType::Ptr ResourceLoader::announceUnparsedText(const QUrl &uri)
{
    Q_ASSERT(uri.isValid());
    Q_ASSERT(!uri.isRelative());
    Q_UNUSED(uri); /* Needed when compiling in release mode. */
    return ItemType::Ptr();
}
Esempio n. 15
0
SequenceType::Ptr ResourceLoader::announceDocument(const QUrl &uri, const Usage)
{
    Q_ASSERT(uri.isValid());
    Q_ASSERT(!uri.isRelative());
    Q_UNUSED(uri); /* Needed when compiling in release mode. */
    return SequenceType::Ptr();
}
Esempio n. 16
0
Item::Iterator::Ptr ResourceLoader::openCollection(const QUrl &uri)
{
    Q_ASSERT(uri.isValid());
    Q_ASSERT(!uri.isRelative());
    Q_UNUSED(uri); /* Needed when compiling in release mode. */
    return Item::Iterator::Ptr();
}
Esempio n. 17
0
bool ResourceLoader::isDocumentAvailable(const QUrl &uri)
{
    Q_ASSERT(uri.isValid());
    Q_ASSERT(!uri.isRelative());
    Q_UNUSED(uri); /* Needed when compiling in release mode. */
    return false;
}
Esempio n. 18
0
void ImageDownloader::downloadFinished()
	{
		 urlImage = new QImage();
		if (netReply->error() != QNetworkReply::NoError) {
			netReply->deleteLater();
			downloaded = true;
			return;
		}

		QVariant redir = netReply->attribute(QNetworkRequest::RedirectionTargetAttribute);
		if (redir.isValid()) {
			QUrl url = redir.toUrl();
			if (url.isRelative()) {
				url.setScheme(netReply->url().scheme());
				url.setEncodedHost(netReply->url().encodedHost());
			}
			QNetworkRequest req(url);
		   netManager->get(req);
			netReply->deleteLater();
			downloaded = true;
			return;
	
		
		}
    QByteArray jpegData = netReply->readAll();

	downloaded = true;
    urlImage->loadFromData(jpegData);

	}
Esempio n. 19
0
void DownloadHandler::handleRedirection(QUrl newUrl)
{
    // Resolve relative urls
    if (newUrl.isRelative())
        newUrl = m_reply->url().resolved(newUrl);

    const QString newUrlString = newUrl.toString();
    qDebug("Redirecting from %s to %s", qPrintable(m_reply->url().toString()), qPrintable(newUrlString));

    // Redirect to magnet workaround
    if (newUrlString.startsWith("magnet:", Qt::CaseInsensitive)) {
        qDebug("Magnet redirect detected.");
        m_reply->abort();
        if (m_handleRedirectToMagnet)
            emit redirectedToMagnet(m_url, newUrlString);
        else
            emit downloadFailed(m_url, tr("Unexpected redirect to magnet URI."));

        this->deleteLater();
    }
    else {
        DownloadHandler *tmp = m_manager->downloadUrl(newUrlString, m_saveToFile, m_sizeLimit, m_handleRedirectToMagnet);
        m_reply->deleteLater();
        m_reply = tmp->m_reply;
        init();
        tmp->m_reply = 0;
        delete tmp;
    }
}
Esempio n. 20
0
/** Called when the displayed document is changed. If <b>url</b> specifies
 * an external link, then the user will be prompted for whether they want to
 * open the link in their default browser or not. */
void
HelpTextBrowser::setSource(const QUrl &url)
{
  if (url.scheme() != "qrc" && !url.isRelative()) {
    /* External link. Prompt the user for a response. */
    int ret = VMessageBox::question(this,
                tr("Opening External Link"),
                p(tr("RetroShare can open the link you selected in your default "
                     "Web browser. If your browser is not currently "
                     "configured to use Tor then the request will not be "
                     "anonymous.")) +
                p(tr("Do you want Retroshare to open the link in your Web "
                     "browser?")),
                VMessageBox::Yes|VMessageBox::Default, 
                VMessageBox::Cancel|VMessageBox::Cancel);
    
    if (ret == VMessageBox::Cancel)
      return;
    
    bool ok = QDesktopServices::openUrl(url);
    if (!ok) {
      VMessageBox::information(this,
        tr("Unable to Open Link"),
        tr("RetroShare was unable to open the selected link in your Web browser. "
           "You can still copy the URL and paste it into your browser."),
        VMessageBox::Ok);
    }
  } else {
    /* Internal link. Just load it like normal. */
    QTextBrowser::setSource(url);
  }
}
Esempio n. 21
0
    /* The parse function is invoked after the loadFinished signal is received 
     * from  the webkit code upon successfully parsing a page. From here, the 
     * entire DOM can be manipulated and traversed really conveniently. The 
     * code right now just traverses the DOM looking for link tags, and queues 
     * them if they are valid, but this function is where all of the 
     * interesting development will take place in the future. 
     */
   void Parser::parse() {
      QUrl currentUrl;
      QWebElementCollection linkTags =
         page->mainFrame()->findAllElements("a");

      foreach(QWebElement current, linkTags) {
         currentUrl = QUrl(current.attribute("href"));
         /* This discards the fragment. It is useless in this context and
          * will complicate our visited hashtable.
          */
         currentUrl.setEncodedFragment(QByteArray());

         if (currentUrl.isEmpty()) {
            continue;
         }

         /* Prepend the parent URL if we have a relative link in an attempt
          * to validate it for retrieval.
          */
         if (currentUrl.isRelative() &&
            currentUrl.host() == "" && currentUrl.path() != "") {
            qDebug() << currentUrl << " is relative path. prepending host";
            currentUrl.setHost(url.host());
            currentUrl.setScheme(url.scheme());
            qDebug() << "with host fix: " << currentUrl;
         }

         /* Finally, check to make sure it's valid before queueing it */
         if (validateUrl(currentUrl)) {
            parsedUrls.push_back(currentUrl);
         }
      }
Esempio n. 22
0
bool UnparsedTextAvailableFN::evaluateEBV(const DynamicContext::Ptr &context) const
{
    Q_ASSERT(m_operands.count() == 1 || m_operands.count() == 2);
    const Item href(m_operands.first()->evaluateSingleton(context));
    if(!href)
        return Item();

    bool isValid = false;
    const QUrl mayRela(AnyURI::toQUrl<ReportContext::XTDE1170>(href.stringValue(),
                                                               context,
                                                               this,
                                                               &isValid));

    if(!isValid)
        return false;

    const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));

    /* fn:unparsed-text() will raise an error on this. */
    if(uri.hasFragment())
        return false;

    QString encoding;

    if(m_operands.count() == 2)
    {
        const Item encodingArg(m_operands.at(1)->evaluateSingleton(context));
        if(encodingArg)
            encoding = encodingArg.stringValue();
    }

    Q_ASSERT(uri.isValid() && !uri.isRelative());
    return context->resourceLoader()->isUnparsedTextAvailable(uri, encoding);
}
Esempio n. 23
0
Item UnparsedTextFN::evaluateSingleton(const DynamicContext::Ptr &context) const
{
    Q_ASSERT(m_operands.count() == 1 || m_operands.count() == 2);
    const Item href(m_operands.first()->evaluateSingleton(context));
    if(!href)
        return Item();

    const QUrl mayRela(AnyURI::toQUrl<ReportContext::XTDE1170>(href.stringValue(),
                       context,
                       this));

    const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));

    if(uri.hasFragment())
    {
        context->error(QtXmlPatterns::tr("The URI cannot have a fragment"),
                       ReportContext::XTDE1170, this);
    }

    QString encoding;

    if(m_operands.count() == 2)
    {
        const Item encodingArg(m_operands.at(1)->evaluateSingleton(context));
        if(encodingArg)
            encoding = encodingArg.stringValue();
    }

    Q_ASSERT(uri.isValid() && !uri.isRelative());
    return context->resourceLoader()->openUnparsedText(uri, encoding, context, this);
}
Esempio n. 24
0
void YandexNarodUploadJob::onPublishFinished()
{
	QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
	Q_ASSERT(reply);
	reply->deleteLater();

	QUrl url = reply->header(QNetworkRequest::LocationHeader).toUrl();
	if (url.isRelative())
		url = reply->url().resolved(url);

	QString text = tr("File sent: %1 (%n bytes)\nDownload url: %2",
					  "%1 - filename, %2 - url",
					  m_data->size())
				   .arg(fileName(), url.toString());

	Message message(text);
	message.setIncoming(false);
	message.setProperty("service", true);
	if (ChatSession *s = ChatLayer::get(chatUnit(), false))
		s->appendMessage(message);
	message.setProperty("service", false);
	chatUnit()->account()->getUnitForSession(chatUnit())->send(message);

	setState(Finished);
}
void TextBrowserHelpWidget::contextMenuEvent(QContextMenuEvent *event)
{
    QMenu menu(QLatin1String(""), 0);

    QUrl link;
    QAction *copyAnchorAction = 0;
    if (hasAnchorAt(event->pos())) {
        link = anchorAt(event->pos());
        if (link.isRelative())
            link = source().resolved(link);
        menu.addAction(tr("Open Link"), this, SLOT(openLink()));
        if (showOpenInNewWindowAction)
            menu.addAction(tr("Open Link as New Page"), this, SLOT(openLinkInNewPage()));

        if (!link.isEmpty() && link.isValid())
            copyAnchorAction = menu.addAction(tr("Copy Link"));
    } else if (!textCursor().selectedText().isEmpty()) {
        menu.addAction(tr("Copy"), this, SLOT(copy()));
    } else {
        menu.addAction(tr("Reload"), this, SLOT(reload()));
    }

    if (copyAnchorAction == menu.exec(event->globalPos()))
        QApplication::clipboard()->setText(link.toString());
}
Esempio n. 26
0
void TinyWebBrowser::setWikipediaPath( const QString& relativeUrl )
{
    QUrl url = relativeUrl;
    if ( url.isRelative() )
        url = QUrl( guessWikipediaDomain() ).resolved( url );
    load( url );
}
Esempio n. 27
0
QVariant HelpWidget::HelpBrowser::loadResource(int type, const QUrl& name) {
    QUrl url(name);
    if (name.isRelative()) url = source().resolved(url);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
    QUrlQuery query(url);
    if (query.hasQueryItem("classIdentifier")) {
        QString cid = query.queryItemValue("classIdentifier");

        auto imageCache = InviwoApplication::getPtr()->getPath(InviwoApplication::PATH_SETTINGS);
        imageCache += "image-cache";
        filesystem::createDirectoryRecursively(imageCache);

        QString imgname(QString::fromStdString(imageCache) + "/" + cid + ".png");
        QImageReader reader(imgname);
        QImage img = reader.read();
        if (!img.isNull()) {
            return img;
        } else {
            QImage img = utilqt::generatePreview(cid);
            QByteArray data;
            QBuffer buffer(&data);
            buffer.open(QIODevice::WriteOnly);
            img.save(&buffer, "PNG");

            QImageWriter writer(imgname);
            writer.write(img);

            return data;
        }
    }
#endif

#ifdef IVW_DEBUG  // Look for the html in the doc-qt folder.
    if (type == QTextDocument::HtmlResource || type == QTextDocument::ImageResource) {
        std::string docbase = InviwoApplication::getPtr()->getPath(InviwoApplication::PATH_DATA,
                                                                   "../tools/doxygen/doc-qt/html");
        QString file = name.toString();
        file.replace("qthelp://org.inviwo/doc", QString::fromStdString(docbase));
        QFile newfile(file);

        if (newfile.exists() && newfile.open(QIODevice::ReadOnly)) {
            QByteArray data = newfile.readAll();
            return data;
        }
    }
#endif

    QByteArray data = helpEngine_->fileData(url);
    switch (type) {
        case QTextDocument::HtmlResource:
            return data;
        case QTextDocument::ImageResource:
            return data;
        case QTextDocument::StyleSheetResource:
            return data;
    }
    return QTextBrowser::loadResource(type, url);
}
Esempio n. 28
0
void Breakpoint::setLocation(const QUrl& url, int line)
{
    Q_ASSERT(m_kind == CodeBreakpoint);
    Q_ASSERT(url.isEmpty() || (!url.isRelative() && !url.fileName().isEmpty()));
    m_url = url;
    m_line = line;
    reportChange(LocationColumn);
}
QQuickTextureFactory *AtcProvider::requestTexture(const QString &id, QSize *size, const QSize &requestedSize)
{
    Q_UNUSED(requestedSize);
    QAtcTextureFactory *ret = 0;

    size->setHeight(0);
    size->setWidth(0);

    QUrl url = QUrl(id);
    if (url.isRelative() && !m_baseUrl.isEmpty())
        url = m_baseUrl.resolved(url);
    QString path = QQmlFile::urlToLocalFileOrQrc(url);

    QFile file(path);
#ifdef ETC_DEBUG
    qDebug() << "requestTexture opening file: " << path;
#endif
    if (file.open(QIODevice::ReadOnly)) {
        ret = new QAtcTextureFactory;
        ret->m_data = file.readAll();
        if (!ret->m_data.isEmpty()) {
            DDSFormat *ddsFormat = NULL;
            ddsFormat = (DDSFormat *)ret->m_data.data();

            int byteSizeMultiplier = 0;
            switch (ddsFormat->ddsPixelFormat.dwFourCC) {
            case FOURCC_ATC_RGB:
               ret->m_glFormat = GL_ATC_RGB_AMD;
               byteSizeMultiplier = 8;
               break;
            case FOURCC_ATC_RGBA_EXPLICIT:
               ret->m_glFormat = GL_ATC_RGBA_EXPLICIT_ALPHA_AMD;
               byteSizeMultiplier = 16;
               break;
            case FOURCC_ATC_RGBA_INTERPOLATED:
               ret->m_glFormat = GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD;
               byteSizeMultiplier = 16;
               break;
            default:
               qWarning( "Unsupported compressed texture format." );
               delete ret;
               return 0;
            }

            size->setHeight(ddsFormat->dwHeight);
            size->setWidth(ddsFormat->dwWidth);
            ret->m_size = *size;

            ret->m_sizeInBytes = ((ddsFormat->dwWidth+3)/4) * ((ddsFormat->dwHeight+3)/4) * byteSizeMultiplier;
        }
        else {
            delete ret;
            ret = 0;
        }
    }

    return ret;
}
Esempio n. 30
0
SequenceType::Ptr AccelTreeResourceLoader::announceDocument(const QUrl &uri, const Usage)
{
    // TODO deal with the usage thingy
    Q_ASSERT(uri.isValid());
    Q_ASSERT(!uri.isRelative());
    Q_UNUSED(uri); /* Needed when compiling in release mode. */

    return CommonSequenceTypes::ZeroOrOneDocumentNode;
}