示例#1
0
bool RefImage::checkReply(QNetworkReply* reply)
{
    if (reply->error() == QNetworkReply::NoError)
    {
        QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
        if (redirectUrl == reply->url())
        {
            // redirect to original url: infinite loop
            return 0;
        }
        // If the URL is not empty, we're being redirected.
        // TODO track number of redirects
        if(!redirectUrl.isEmpty())
        {
            qDebug() << "Redirect to" << redirectUrl;
            setUri(redirectUrl);
            loadImage();

            return 0;
        }
        return 1;
    }
    else
    {
        if (reply->error() != QNetworkReply::OperationCanceledError)
            showErrorMessage(reply->errorString(), thumbItem()->scene()->views().first());
        thumbItem()->stopDownload(false);
        return 0;
    }
}
示例#2
0
void SVGPaint::setPaint(SVGPaintType paintType, const String& uri, const String& rgbPaint, const String&, ExceptionCode&)
{
    m_paintType = paintType;

    if (m_paintType == SVG_PAINTTYPE_URI)
        setUri(uri);
    else if (m_paintType == SVG_PAINTTYPE_RGBCOLOR)
        setRGBColor(rgbPaint);
}
示例#3
0
int ONVIF::StreamUri::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 4)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 4;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 4)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 4;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = uri(); break;
        case 1: *reinterpret_cast< bool*>(_v) = invalidAfterConnect(); break;
        case 2: *reinterpret_cast< bool*>(_v) = invalidAfterReboot(); break;
        case 3: *reinterpret_cast< QString*>(_v) = timeout(); break;
        default: break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setUri(*reinterpret_cast< QString*>(_v)); break;
        case 1: setInvalidAfterConnect(*reinterpret_cast< bool*>(_v)); break;
        case 2: setInvalidAfterReboot(*reinterpret_cast< bool*>(_v)); break;
        case 3: setTimeout(*reinterpret_cast< QString*>(_v)); break;
        default: break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 4;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 4)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 4;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
void
Engine::setAtomicUriEngine(const std::string& uri, const ProtocolInfo& protInfo)
{
    LOG(upnpav, debug, "engine sets new atomic uri: " + uri);

    setUri(uri, protInfo);

    Variant val;
    val.setValue(uri);
    _pAVTransportImpl->_pLastChange->setStateVar(_instanceId, AvTransportEventedStateVar::CURRENT_TRACK_URI, val);
}
示例#5
0
void RefImage::saveImage(QDir directory, QString name)
{
    if ( (isImageCached()) && (!isImageOnDisk()) )
    {
        if (imageItem()->saveImage(directory, name))
        {
            QFileInfo fileInfo(directory,imageItem()->name());
            setUri(QUrl::fromLocalFile(fileInfo.filePath()));
        }
    }
}
示例#6
0
	// See E4X 13.2.2, pg 64
    Namespace::Namespace(Atom prefix, Stringp uri, NamespaceType flags)
#ifdef DEBUGGER
		: AvmPlusScriptableObject(sotNamespace())
#endif // DEBUGGER
	{
		// verify our parameters are interned strings
		AvmAssert (uri->isInterned());
		// prefix can be an interned string, undefined, or null
		AvmAssert (AvmCore::isName(prefix) || AvmCore::isNullOrUndefined(prefix));
		setPrefix(prefix);
		setUri(uri, flags);
	}
void
Engine::setUriEngine(const std::string& uri, const ProtocolInfo& protInfo)
{
    Poco::URI uriParsed(uri);
    _playlist.clear();
    _duration = 0.0;
    if (protInfo.getMimeString() == Mime::PLAYLIST) {
        LOG(upnpav, debug, "renderer engine got playlist");

        Poco::Net::HTTPClientSession session(uriParsed.getHost(), uriParsed.getPort());

        Poco::Net::HTTPRequest request("GET", uriParsed.getPath());
        session.sendRequest(request);
        std::stringstream requestHeader;
        request.write(requestHeader);
        LOG(upnpav, debug, "request header:\n" + requestHeader.str());

        Poco::Net::HTTPResponse response;
        std::istream& istr = session.receiveResponse(response);

        LOG(upnpav, information, "HTTP " + Poco::NumberFormatter::format(response.getStatus()) + " " + response.getReason());
        std::stringstream responseHeader;
        response.write(responseHeader);
        LOG(upnpav, debug, "response header:\n" + responseHeader.str());

        std::string line;
        while(std::getline(istr, line)) {
            _playlist.push_back(line);
        }
        setAtomicUriEngine(_playlist[_trackNumberInPlaylist]);
    }
    else if (preferStdStream()) {
        Poco::Net::HTTPClientSession session(uriParsed.getHost(), uriParsed.getPort());
        Poco::Net::HTTPRequest request("GET", uriParsed.getPath());
        session.sendRequest(request);
        std::stringstream requestHeader;
        request.write(requestHeader);
        LOG(upnpav, debug, "request header:\n" + requestHeader.str());

        Poco::Net::HTTPResponse response;
        std::istream& istr = session.receiveResponse(response);

        LOG(upnpav, information, "HTTP " + Poco::NumberFormatter::format(response.getStatus()) + " " + response.getReason());
        std::stringstream responseHeader;
        response.write(responseHeader);
        LOG(upnpav, debug, "response header:\n" + responseHeader.str());
        setUri(istr, protInfo);
    }
    else {
        setAtomicUriEngine(uri, protInfo);
    }
}
示例#8
0
RefImage::RefImage(const QUrl uri, QUrl thumbUrl, QNetworkAccessManager *downloadManager) :
    m_thumbItem(new ThumbnailItem(uri, "thumb_"+nameFromUrl(uri))),
    m_imageReply(NULL)
{

    setUri(uri);
    setThumbUri(thumbUrl);
    setDownloadManager(downloadManager);

    initThumbItem();

    loadThumb();
}
示例#9
0
EthernetChannel::EthernetChannel(shared_ptr<const ndn::net::NetworkInterface> localEndpoint,
                                 time::nanoseconds idleTimeout)
  : m_localEndpoint(std::move(localEndpoint))
  , m_isListening(false)
  , m_socket(getGlobalIoService())
  , m_pcap(m_localEndpoint->getName())
  , m_idleFaceTimeout(idleTimeout)
#ifdef _DEBUG
  , m_nDropped(0)
#endif
{
  setUri(FaceUri::fromDev(m_localEndpoint->getName()));
  NFD_LOG_CHAN_INFO("Creating channel");
}
CAPICertificate::CAPICertificate(const std::string& capiUri, TimerFactory* timerFactory) : 
		valid_(false), 
		uri_(capiUri),
		certStoreHandle_(0),
		scardContext_(0),
		cardHandle_(0),
		certStore_(),
		certName_(),
		smartCardReaderName_(),
		timerFactory_(timerFactory),
		lastPollingResult_(true) {
	assert(timerFactory_);

	setUri(capiUri);
}
示例#11
0
文件: Namespace.cpp 项目: bsdf/trx
    // See E4X 13.2.2, pg 64
    Namespace::Namespace(Atom prefix, Stringp uri, NamespaceType flags, ApiVersion apiVersion) :
#ifdef DEBUGGER
        AvmPlusScriptableObject(sotNamespace()),
#endif // DEBUGGER
        m_prefix(prefix),
        m_apiVersion(apiVersion)
    {
        // verify our parameters are interned strings
        AvmAssert(uri->isInterned());
        // prefix can be an interned string, undefined, or null
        AvmAssert(AvmCore::isName(prefix) || AvmCore::isNullOrUndefined(prefix));
        // ensure that if the incoming Atom is a string, that it's interned
        AvmAssert(AvmCore::isString(prefix) ? (AvmCore::atomToString(prefix))->isInterned() : 1);
        setUri(uri, flags);
        // ApiVersion should be ALLVERSIONS for all Namespaces that are nonpublic.
        AvmAssert(flags != NS_Public ? apiVersion == kApiVersion_VM_ALLVERSIONS : true);
    }
示例#12
0
int EmulateSp::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 10)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 10;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = appVersion(); break;
        case 1: *reinterpret_cast< QString*>(_v) = getUri(); break;
        case 2: *reinterpret_cast< QString*>(_v) = getText(); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setAppVersion(*reinterpret_cast< QString*>(_v)); break;
        case 1: setUri(*reinterpret_cast< QString*>(_v)); break;
        case 2: setText(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 3;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
示例#13
0
	Namespace::~Namespace()
	{
		WBATOM(MMgc::GC::GetGC(this), this, &m_prefix, 0);
		setUri(NULL, NS_Public);
		setAPI(0);
	}
示例#14
0
SVGPaint::SVGPaint(const String& uri)
    : m_paintType(SVG_PAINTTYPE_URI_RGBCOLOR)
{
    setUri(uri);
}
示例#15
0
文件: Namespace.cpp 项目: bsdf/trx
 Namespace::~Namespace()
 {
     setUri(NULL, NS_Public);
     *const_cast<ApiVersion*>(&m_apiVersion) = ApiVersion(0);
 }
示例#16
0
SVGPaint::SVGPaint(SVGPaintType paintType, const String& uri, const String& rgbPaint, const String&)
    : SVGColor(rgbPaint)
    , m_paintType(paintType)
{
    setUri(uri);
}
示例#17
0
SVGPaint::SVGPaint(const String& uri, const Color& c)
    : SVGColor(c)
    , m_paintType(SVG_PAINTTYPE_URI_RGBCOLOR)
{
    setUri(uri);
}
示例#18
0
文件: webtab.cpp 项目: KDE/rekonq
WebTab::WebTab(QWidget *parent, bool isPrivateBrowsing)
    : QWidget(parent)
    , m_webView(0)
    , m_progress(0)
    , m_part(0)
    , m_zoomFactor(ReKonfig::defaultZoom())
    , m_isPrivateBrowsing(isPrivateBrowsing)
    , m_isWebApp(false)
    , m_splitter(new QSplitter(this))
#ifdef HAVE_KACTIVITIES
    , m_activityResourceInstance(0)
#endif
{
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QVBoxLayout *l = new QVBoxLayout(this);
    l->setMargin(0);
    l->setSpacing(0);

    m_splitter->addWidget(view());
    view()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // NOTE: setting web inspector vertical/horizontal
    m_splitter->setOrientation(Qt::Vertical);

    l->addWidget(m_splitter);

    // fix focus handling
    setFocusProxy(view());


    KWebWallet *wallet = page()->wallet();

    if (wallet)
    {
        connect(wallet, SIGNAL(saveFormDataRequested(QString,QUrl)),
                this, SLOT(createWalletBar(QString,QUrl)));
    }

    // Connect webview signals with related webtab ones
    connect(view(), SIGNAL(loadFinished(bool)),     this, SIGNAL(loadFinished(bool)));
    connect(view(), SIGNAL(loadProgress(int)),      this, SIGNAL(loadProgress(int)));
    connect(view(), SIGNAL(loadStarted()),          this, SIGNAL(loadStarted()));
    connect(view(), SIGNAL(urlChanged(QUrl)),       this, SIGNAL(urlChanged(QUrl)));
    connect(view(), SIGNAL(titleChanged(QString)),  this, SIGNAL(titleChanged(QString)));
    connect(view(), SIGNAL(iconChanged()),          this, SIGNAL(iconChanged()));
    
    connect(page(), SIGNAL(initialUrl(QUrl)),       this, SIGNAL(urlChanged(QUrl)));

    if (!parent)
    {
        m_isWebApp = true;
        connect(this, SIGNAL(titleChanged(QString)), this, SLOT(webAppTitleChanged(QString)));
        connect(this, SIGNAL(iconChanged()), this, SLOT(webAppIconChanged()));
    }

    connect(view(), SIGNAL(loadProgress(int)),  this, SLOT(updateProgress(int)));
    connect(view(), SIGNAL(loadStarted()),      this, SLOT(resetProgress()));
    connect(view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
    connect(view(), SIGNAL(zoomChanged(int)),   this, SLOT(setZoom(int)));
    
    // Session Manager
    connect(view(), SIGNAL(loadFinished(bool)), SessionManager::self(), SLOT(saveSession()));
    
#ifdef HAVE_KACTIVITIES
    if (m_isPrivateBrowsing)
        return;
    
    m_activityResourceInstance = new KActivities::ResourceInstance(window()->winId(), this);
    
    connect(this, SIGNAL(urlChanged(QUrl)), m_activityResourceInstance, SLOT(setUri(QUrl)));
    connect(this, SIGNAL(titleChanged(QString)), m_activityResourceInstance, SLOT(setTitle(QString)));
#endif
}
示例#19
0
WorkSpaceFolder::WorkSpaceFolder(const QString &uri, const QString &name)
{
    setUri(uri);
    setName(name);
}
SVGPaint::SVGPaint(const String& uri)
    : SVGColor()
    , m_paintType(SVG_PAINTTYPE_URI)
{
    setUri(uri);
}