本文整理汇总了C++中QUrl::userInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::userInfo方法的具体用法?C++ QUrl::userInfo怎么用?C++ QUrl::userInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUrl
的用法示例。
在下文中一共展示了QUrl::userInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: userInfo
QString QUrlProto::userInfo() const
{
QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
if (item)
return item->userInfo();
return QString();
}
示例2: QString
HttpEngine::HttpEngine(QUrl url, QUrl referrer, QUuid proxyUuid) : m_pRemote(0), m_url(url)
{
QString user_info;
QString query, host;
// QList<Proxy> listProxy = Proxy::loadProxys();
m_proxyData.nType = Proxy::ProxyNone;
host = url.host();
if(url.port(80) != 80)
host += QString(":") + QString::number(url.port(80));
if (Proxy::isProxyEnabled()){
Proxy p = Proxy:: loadProxy();
if(p.uuid == proxyUuid)
{
m_proxyData = p;
}
}
if(!url.hasQuery())
query = url.path();
else
query = url.path()+"?"+url.encodedQuery();
if(query.isEmpty())
query = "/";
if(m_proxyData.nType == Proxy::ProxyHttp)
{
m_header.setRequest("GET", QString("%1://%2%3").arg(url.scheme()).arg(host).arg(query));
if(!m_proxyData.strUser.isEmpty())
m_header.addValue("Proxy-Authorization", QString("Basic %1").arg((QString) (m_proxyData.strUser+":"+m_proxyData.strPassword).toUtf8().toBase64()) );
}
else
m_header.setRequest("GET", query);
user_info = url.userInfo();
if(!user_info.isEmpty())
m_header.addValue("Authorization", QString("Basic %1").arg( QString(user_info.toUtf8().toBase64()) ));
if(referrer.isValid())
m_header.addValue("Referrer", referrer.toString());
m_header.addValue("Host", host);
m_header.addValue("Connection", "close");
}
示例3: QObject
EwsEngine::EwsEngine(const QSettings &settings, const QString &uuid, QObject *parent) :
QObject(parent),
m_uuid(uuid)
{
// First thing to do is setup our connection
m_internalUri = settings.value("internalASUrl").toString();
m_externalUri = settings.value("externalASUrl").toString();
QUrl credentials = settings.value("URI").toUrl();
m_internalUri.setUserInfo(credentials.userInfo());
m_externalUri.setUserInfo(credentials.userInfo());
m_connection = new Ews::Connection(this);
m_connection->setUri(m_internalUri);
QDir dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
if (!dataLocation.exists() && !dataLocation.mkpath(dataLocation.absolutePath())) {
qWarning() << "Failed to create data directory" << dataLocation.absolutePath();
}
QString accountName = settings.value("Description").toString();
if (accountName.isEmpty()) {
accountName = settings.value("EmailAddress").toString().section(QLatin1Char('@'), 1, 1).section(QLatin1Char('.'), 0, 0);
}
m_folderModel = new EwsFolderModel(dataLocation.absolutePath(), this);
m_folderModel->setProperty("HEADER", accountName.toUpper());
// connect(m_folderModel, SIGNAL(syncItems(QString)),
// SLOT(syncItems(QString)));
// qDebug() << Q_FUNC_INFO << uri.host() << m_uuid;
checkDNS();
// Update the list in one minute
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), SLOT(update()));
timer->setInterval(5000);
timer->start();
}
示例4: run
//.........这里部分代码省略.........
if (!tuning.GetBitrate(i))
buf_size = 2 * 1024 * 1024;
int ok = setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
(char *)&buf_size, sizeof(buf_size));
if (ok)
{
LOG(VB_GENERAL, LOG_INFO, LOC +
QString("Increasing buffer size to %1 failed")
.arg(buf_size) + ENO);
}
/*
int broadcast = 1;
ok = setsockopt(fd, SOL_SOCKET, SO_BROADCAST,
(char *)&broadcast, sizeof(broadcast));
if (ok)
{
LOG(VB_GENERAL, LOG_INFO, LOC +
QString("Enabling broadcast failed") + ENO);
}
*/
m_sockets[i]->setSocketDescriptor(
fd, QAbstractSocket::UnconnectedState, QIODevice::ReadOnly);
m_sockets[i]->bind(QHostAddress::Any, url.port());
QHostAddress dest_addr(tuning.GetURL(i).host());
if (dest_addr != QHostAddress::Any)
{
//m_sockets[i]->joinMulticastGroup(dest_addr); // needs Qt 4.8
LOG(VB_GENERAL, LOG_INFO, LOC + QString("Joining %1")
.arg(dest_addr.toString()));
struct ip_mreq imr;
memset(&imr, 0, sizeof(struct ip_mreq));
imr.imr_multiaddr.s_addr = inet_addr(
dest_addr.toString().toLatin1().constData());
imr.imr_interface.s_addr = htonl(INADDR_ANY);
if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
(const char *)&imr, sizeof(imr)) < 0)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
"setsockopt - IP_ADD_MEMBERSHIP " + ENO);
}
}
if (!url.userInfo().isEmpty())
m_sender[i] = QHostAddress(url.userInfo());
}
if (m_use_rtp_streaming)
m_buffer = new RTPPacketBuffer(tuning.GetBitrate(0));
else
m_buffer = new UDPPacketBuffer(tuning.GetBitrate(0));
m_write_helper = new IPTVStreamHandlerWriteHelper(this);
m_write_helper->Start();
bool error = false;
if (rtsp)
{
// Start Streaming
if (!rtsp->Setup(m_sockets[0]->localPort(),
m_sockets[1]->localPort()) ||
!rtsp->Play())
{
LOG(VB_RECORD, LOG_ERR, LOC +
"Starting recording (RTP initialization failed). Aborting.");
error = true;
}
}
if (!error)
{
// Enter event loop
exec();
}
// Clean up
for (uint i = 0; i < IPTV_SOCKET_COUNT; i++)
{
if (m_sockets[i])
{
delete m_sockets[i];
m_sockets[i] = NULL;
delete m_read_helpers[i];
m_read_helpers[i] = NULL;
}
}
delete m_buffer;
m_buffer = NULL;
delete m_write_helper;
m_write_helper = NULL;
if (rtsp)
{
rtsp->Teardown();
delete rtsp;
}
SetRunning(false, false, false);
RunEpilog();
}
示例5: userInfo
int Url::userInfo ( lua_State * L )// const : QString
{
QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
lua_pushstring(L, lhs->userInfo().toLatin1() );
return 1;
}
示例6: addTransfer
//.........这里部分代码省略.........
else
eng = Transfer::bestEngine(m_dlgNewTransfer->m_strDestination, Transfer::Upload);
if(eng.nClass < 0)
throw RuntimeException(tr("Couldn't autodetect transfer type for \"%1\"").arg(uris[i]));
else
classID = eng.nClass;
if(detectedClass == -1)
detectedClass = classID;
else if(detectedClass >= 0 && detectedClass != classID)
detectedClass = -2;
}
else
classID = m_dlgNewTransfer->m_nClass;
d = Transfer::createInstance(m_dlgNewTransfer->m_mode, classID);
if(d == 0)
throw RuntimeException(tr("Failed to create a class instance."));
listTransfers << d;
QString source, destination;
source = uris[i].trimmed();
destination = m_dlgNewTransfer->m_strDestination;
if(!m_dlgNewTransfer->m_auth.strUser.isEmpty())
{
QString& obj = (m_dlgNewTransfer->m_mode == Transfer::Download) ? source : destination;
QUrl url = obj;
if(url.userInfo().isEmpty())
{
url.setUserName(m_dlgNewTransfer->m_auth.strUser);
url.setPassword(m_dlgNewTransfer->m_auth.strPassword);
}
obj = url.toString();
}
d->init(source, destination);
d->setUserSpeedLimits(m_dlgNewTransfer->m_nDownLimit,m_dlgNewTransfer->m_nUpLimit);
}
// show the transfer details dialog
if(m_dlgNewTransfer->m_bDetails)
{
// show a typical transfer propeties dialog
if(listTransfers.size() == 1)
{
WidgetHostDlg dlg(this);
m_dlgNewTransfer->setWindowTitle(tr("Transfer details"));
if(WidgetHostChild* q = listTransfers[0]->createOptionsWidget(dlg.getChildHost()))
{
dlg.addChild(q);
if(dlg.exec() != QDialog::Accepted)
throw RuntimeException();
}
}
else if(detectedClass >= 0) // show a dialog designed for multiple
{
if(!Transfer::runProperties(this, m_dlgNewTransfer->m_mode, detectedClass, listTransfers))
throw RuntimeException();
示例7: createTransfer
/**
* @brief creating new transfer
*
* @param m_strURIs transfers urls
* @param downloadTrueUploadFalse boolean value for download or upload
* @param m_nClass download type default -1
* @param m_strDestination destination fo transfer
* @param m_nDownLimit down limit of transfer
* @param m_nUpLimit up limit of transfer
* @param m_bPaused boolean true if transfer is paused
*/
void TransfersMethods::createTransfer(QString m_strURIs,bool downloadTrueUploadFalse,int m_nClass,QString m_strDestination,
int m_nDownLimit,int m_nUpLimit,bool m_bPaused)
{
Queue* queue = 0;
QList<Transfer*> listTransfers;
try
{
QStringList uris;
uris = m_strURIs.split('\n', QString::SkipEmptyParts);
if(uris.isEmpty())
throw RuntimeException();
for(int i=0;i<uris.size();i++)
{
QString trm = uris[i].trimmed();
if(trm.isEmpty())
{
uris.removeAt(i);
i--;
}
else
uris[i] = trm;
}
int detectedClass = m_nClass;
for(int i=0;i<uris.size();i++)
{
Transfer* d;
int classID;
if(m_nClass == -1)
{
Transfer::BestEngine eng;
if(downloadTrueUploadFalse)
eng = Transfer::bestEngine(uris[i], Transfer::Download);
else
eng = Transfer::bestEngine(m_strDestination, Transfer::Upload);
if(eng.nClass < 0)
throw RuntimeException(tr("Couldn't autodetect transfer type for \"%1\"").arg(uris[i]));
else
classID = eng.nClass;
if(detectedClass == -1)
detectedClass = classID;
else if(detectedClass >= 0 && detectedClass != classID)
detectedClass = -2;
}
else
classID = m_nClass;
Transfer::Mode myMode = downloadTrueUploadFalse ? Transfer::Download : Transfer::Upload;;
d = Transfer::createInstance(myMode, classID);
if(d == 0)
throw RuntimeException(tr("Failed to create a class instance."));
listTransfers << d;
QString source, destination;
source = uris[i].trimmed();
destination = m_strDestination;
d->setUrl( (myMode == Transfer::Download) ? source : destination);
if(!m_auth.strUser.isEmpty())
{
QString& obj = (myMode == Transfer::Download) ? source : destination;
QUrl url = obj;
if(url.userInfo().isEmpty())
{
url.setUserName(m_auth.strUser);
url.setPassword(m_auth.strPassword);
}
obj = url.toString();
}
d->init(source, destination);
d->setUserSpeedLimits(m_nDownLimit,m_nUpLimit);
}
if(m_bPaused)
{
foreach(Transfer* d, listTransfers)
d->setState(Transfer::Waiting);
}
else
{
//.........这里部分代码省略.........
示例8: run
void IPTVStreamHandler::run(void)
{
RunProlog();
LOG(VB_GENERAL, LOG_INFO, LOC + "run()");
SetRunning(true, false, false);
// TODO Error handling..
// Setup
CetonRTSP *rtsp = NULL;
IPTVTuningData tuning = m_tuning;
if (m_tuning.GetURL(0).scheme().toLower() == "rtsp")
{
rtsp = new CetonRTSP(m_tuning.GetURL(0));
// Check RTSP capabilities
QStringList options;
if (!(rtsp->GetOptions(options) && options.contains("OPTIONS") &&
options.contains("DESCRIBE") && options.contains("SETUP") &&
options.contains("PLAY") && options.contains("TEARDOWN")))
{
LOG(VB_RECORD, LOG_ERR, LOC +
"RTSP interface did not support the necessary options");
delete rtsp;
SetRunning(false, false, false);
RunEpilog();
return;
}
if (!rtsp->Describe())
{
LOG(VB_RECORD, LOG_ERR, LOC +
"RTSP Describe command failed");
delete rtsp;
SetRunning(false, false, false);
RunEpilog();
return;
}
tuning = IPTVTuningData(
QString("rtp://%[email protected]%2:0")
.arg(m_tuning.GetURL(0).host())
.arg(QHostAddress(QHostAddress::Any).toString()), 0,
IPTVTuningData::kNone,
QString("rtp://%[email protected]%2:0")
.arg(m_tuning.GetURL(0).host())
.arg(QHostAddress(QHostAddress::Any).toString()), 0,
"", 0);
}
for (uint i = 0; i < IPTV_SOCKET_COUNT; i++)
{
QUrl url = tuning.GetURL(i);
if (url.port() < 0)
continue;
m_sockets[i] = new QTcpSocket();
m_sockets[i]->setSocketOption(QAbstractSocket::LowDelayOption, 1);
m_read_helpers[i] = new IPTVStreamHandlerReadHelper(
this, m_sockets[i], i);
if (!url.userInfo().isEmpty())
m_sender[i] = QHostAddress(url.userInfo());
m_sockets[i]->connectToHost(url.host().toAscii(), 3000);
if (m_sockets[i]->waitForConnected(1000))
{
m_sockets[i]->write("GET " + url.path().toAscii() + " HTTP/1.0\r\n\r\n\r\n\r\n");
m_sockets[i]->waitForBytesWritten(500);
}
else
{
qDebug("not Connected!");
m_sockets[i]->connectToHost(url.host().toAscii(), 3000);
m_sockets[i]->write("GET " + url.path().toAscii() + " HTTP/1.0\r\n\r\n\r\n\r\n");
m_sockets[i]->waitForBytesWritten(500);
}
}
//if (m_use_rtp_streaming)
// m_buffer = new RTPPacketBuffer(tuning.GetBitrate(0));
//else
m_buffer = new UDPPacketBuffer(tuning.GetBitrate(0));
m_write_helper = new IPTVStreamHandlerWriteHelper(this);
m_write_helper->Start();
bool error = false;
/*if (rtsp)
{
// Start Streaming
if (!rtsp->Setup(m_sockets[0]->localPort(),
m_sockets[1]->localPort()) ||
!rtsp->Play())
{
LOG(VB_RECORD, LOG_ERR, LOC +
//.........这里部分代码省略.........