NOISSUE qnam -> network
This commit is contained in:
parent
0022aed8bb
commit
eafeb64dec
@ -59,7 +59,7 @@ shared_qobject_ptr< HttpMetaCache > Env::metacache()
|
||||
return d->m_metacache;
|
||||
}
|
||||
|
||||
QNetworkAccessManager& Env::qnam() const
|
||||
QNetworkAccessManager& Env::network() const
|
||||
{
|
||||
return d->m_qnam;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ private:
|
||||
public:
|
||||
static Env& getInstance();
|
||||
|
||||
QNetworkAccessManager &qnam() const;
|
||||
QNetworkAccessManager &network() const;
|
||||
|
||||
shared_qobject_ptr<HttpMetaCache> metacache();
|
||||
|
||||
|
@ -893,7 +893,7 @@ Launcher::Launcher(int &argc, char **argv) : QApplication(argc, argv)
|
||||
m_analytics = new GAnalytics(BuildConfig.ANALYTICS_ID, clientID, analyticsVersion, this);
|
||||
m_analytics->setLogLevel(GAnalytics::Debug);
|
||||
m_analytics->setAnonymizeIPs(true);
|
||||
m_analytics->setNetworkAccessManager(&ENV.qnam());
|
||||
m_analytics->setNetworkAccessManager(&ENV.network());
|
||||
|
||||
if(m_settings->get("AnalyticsSeen").toInt() < m_analytics->version())
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ void AuthContext::initMSA() {
|
||||
opts.accessTokenUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token";
|
||||
opts.listenerPorts = {28562, 28563, 28564, 28565, 28566};
|
||||
|
||||
m_oauth2 = new OAuth2(opts, m_data->msaToken, this, &ENV.qnam());
|
||||
m_oauth2 = new OAuth2(opts, m_data->msaToken, this, &ENV.network());
|
||||
m_oauth2->setGrantFlow(Katabasis::OAuth2::GrantFlowDevice);
|
||||
|
||||
connect(m_oauth2, &OAuth2::linkingFailed, this, &AuthContext::onOAuthLinkingFailed);
|
||||
|
@ -17,7 +17,7 @@ AuthRequest::~AuthRequest() {
|
||||
|
||||
void AuthRequest::get(const QNetworkRequest &req, int timeout/* = 60*1000*/) {
|
||||
setup(req, QNetworkAccessManager::GetOperation);
|
||||
reply_ = ENV.qnam().get(request_);
|
||||
reply_ = ENV.network().get(request_);
|
||||
status_ = Requesting;
|
||||
timedReplies_.add(new Katabasis::Reply(reply_, timeout));
|
||||
connect(reply_, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onRequestError(QNetworkReply::NetworkError)));
|
||||
@ -29,7 +29,7 @@ void AuthRequest::post(const QNetworkRequest &req, const QByteArray &data, int t
|
||||
setup(req, QNetworkAccessManager::PostOperation);
|
||||
data_ = data;
|
||||
status_ = Requesting;
|
||||
reply_ = ENV.qnam().post(request_, data_);
|
||||
reply_ = ENV.network().post(request_, data_);
|
||||
timedReplies_.add(new Katabasis::Reply(reply_, timeout));
|
||||
connect(reply_, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onRequestError(QNetworkReply::NetworkError)));
|
||||
connect(reply_, SIGNAL(finished()), this, SLOT(onRequestFinished()));
|
||||
|
@ -40,7 +40,7 @@ void Yggdrasil::sendRequest(QUrl endpoint, QByteArray content) {
|
||||
|
||||
QNetworkRequest netRequest(endpoint);
|
||||
netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
m_netReply = ENV.qnam().post(netRequest, content);
|
||||
m_netReply = ENV.network().post(netRequest, content);
|
||||
connect(m_netReply, &QNetworkReply::finished, this, &Yggdrasil::processReply);
|
||||
connect(m_netReply, &QNetworkReply::uploadProgress, this, &Yggdrasil::refreshTimers);
|
||||
connect(m_netReply, &QNetworkReply::downloadProgress, this, &Yggdrasil::refreshTimers);
|
||||
|
@ -12,7 +12,7 @@ void CapeChange::setCape(QString& cape) {
|
||||
QNetworkRequest request(QUrl("https://api.minecraftservices.com/minecraft/profile/capes/active"));
|
||||
auto requestString = QString("{\"capeId\":\"%1\"}").arg(m_capeId);
|
||||
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_session->access_token).toLocal8Bit());
|
||||
QNetworkReply *rep = ENV.qnam().put(request, requestString.toUtf8());
|
||||
QNetworkReply *rep = ENV.network().put(request, requestString.toUtf8());
|
||||
|
||||
setStatus(tr("Equipping cape"));
|
||||
|
||||
@ -26,7 +26,7 @@ void CapeChange::clearCape() {
|
||||
QNetworkRequest request(QUrl("https://api.minecraftservices.com/minecraft/profile/capes/active"));
|
||||
auto requestString = QString("{\"capeId\":\"%1\"}").arg(m_capeId);
|
||||
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_session->access_token).toLocal8Bit());
|
||||
QNetworkReply *rep = ENV.qnam().deleteResource(request);
|
||||
QNetworkReply *rep = ENV.network().deleteResource(request);
|
||||
|
||||
setStatus(tr("Removing cape"));
|
||||
|
||||
|
@ -12,7 +12,7 @@ void SkinDelete::executeTask()
|
||||
{
|
||||
QNetworkRequest request(QUrl("https://api.minecraftservices.com/minecraft/profile/skins/active"));
|
||||
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_session->access_token).toLocal8Bit());
|
||||
QNetworkReply *rep = ENV.qnam().deleteResource(request);
|
||||
QNetworkReply *rep = ENV.network().deleteResource(request);
|
||||
m_reply = std::shared_ptr<QNetworkReply>(rep);
|
||||
|
||||
setStatus(tr("Deleting skin"));
|
||||
|
@ -37,7 +37,7 @@ void SkinUpload::executeTask()
|
||||
multiPart->append(skin);
|
||||
multiPart->append(model);
|
||||
|
||||
QNetworkReply *rep = ENV.qnam().post(request, multiPart);
|
||||
QNetworkReply *rep = ENV.network().post(request, multiPart);
|
||||
m_reply = std::shared_ptr<QNetworkReply>(rep);
|
||||
|
||||
setStatus(tr("Uploading skin"));
|
||||
|
@ -97,7 +97,7 @@ void Download::start()
|
||||
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT);
|
||||
|
||||
QNetworkReply *rep = ENV.qnam().get(request);
|
||||
QNetworkReply *rep = ENV.network().get(request);
|
||||
|
||||
m_reply.reset(rep);
|
||||
connect(rep, SIGNAL(downloadProgress(qint64, qint64)), SLOT(downloadProgress(qint64, qint64)));
|
||||
|
@ -41,7 +41,7 @@ void PasteUpload::executeTask()
|
||||
request.setRawHeader("Content-Length", QByteArray::number(m_jsonContent.size()));
|
||||
request.setRawHeader("X-Auth-Token", m_key.toStdString().c_str());
|
||||
|
||||
QNetworkReply *rep = ENV.qnam().post(request, m_jsonContent);
|
||||
QNetworkReply *rep = ENV.network().post(request, m_jsonContent);
|
||||
|
||||
m_reply = std::shared_ptr<QNetworkReply>(rep);
|
||||
setStatus(tr("Uploading to paste.ee"));
|
||||
|
@ -33,7 +33,7 @@ void ImgurAlbumCreation::start()
|
||||
|
||||
const QByteArray data = "deletehashes=" + hashes.join(',').toUtf8() + "&title=Minecraft%20Screenshots&privacy=hidden";
|
||||
|
||||
QNetworkReply *rep = ENV.qnam().post(request, data);
|
||||
QNetworkReply *rep = ENV.network().post(request, data);
|
||||
|
||||
m_reply.reset(rep);
|
||||
connect(rep, &QNetworkReply::uploadProgress, this, &ImgurAlbumCreation::downloadProgress);
|
||||
|
@ -49,7 +49,7 @@ void ImgurUpload::start()
|
||||
namePart.setBody(m_shot->m_file.baseName().toUtf8());
|
||||
multipart->append(namePart);
|
||||
|
||||
QNetworkReply *rep = ENV.qnam().post(request, multipart);
|
||||
QNetworkReply *rep = ENV.network().post(request, multipart);
|
||||
|
||||
m_reply.reset(rep);
|
||||
connect(rep, &QNetworkReply::uploadProgress, this, &ImgurUpload::downloadProgress);
|
||||
|
Loading…
Reference in New Issue
Block a user