Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include "orthancaccess.hpp"
#include <QMetaProperty>
#include <QNetworkRequest>
#include <QApplication>
#include <QThreadStorage>
namespace orthanc {
OrthancAccess::OrthancAccess(QObject *parent) : QNetworkAccessManager(parent)
{
qDebug() << "Creating access object " << this;
}
QThreadStorage<OrthancAccess*> _access;
QNetworkReply *OrthancAccess::get(const QString &request,QObject *requestor)
{
Q_ASSERT(!prefix.isEmpty());
QUrl url=prefix;
url.setPath(QString("/")+request);
QNetworkRequest req(url);
req.setOriginatingObject(requestor);
// qDebug() << "Sending request" << req.url() << "for" << requestor;
return QNetworkAccessManager::get(req);
}
void OrthancAccess::setPrefix(QString _prefix)
{
// @todo make sure no request is currently running
prefix=QUrl(_prefix);
const QString host=prefix.host();
const int port=prefix.port();
connectToHost(host,port);
}
OrthancAccess &access()
{
if(!_access.hasLocalData())
_access.setLocalData(new OrthancAccess);
Q_ASSERT(_access.localData());
return *_access.localData();
}
}