equal
deleted
inserted
replaced
36 #include "upload_video.h" |
36 #include "upload_video.h" |
37 #include "hwconsts.h" |
37 #include "hwconsts.h" |
38 |
38 |
39 // User-agent string used in http requests. |
39 // User-agent string used in http requests. |
40 // Don't make it a global varibale - crash on linux because of cVersionString |
40 // Don't make it a global varibale - crash on linux because of cVersionString |
41 #define USER_AGENT ("Hedgewars-QtFrontend/" + *cVersionString).toAscii() |
41 #define USER_AGENT ("Hedgewars-QtFrontend/" + *cVersionString).toLatin1() |
42 |
42 |
43 // This is developer key obtained from http://code.google.com/apis/youtube/dashboard/ |
43 // This is developer key obtained from http://code.google.com/apis/youtube/dashboard/ |
44 // If you are reusing this code outside Hedgewars, don't use this developer key, |
44 // If you are reusing this code outside Hedgewars, don't use this developer key, |
45 // obtain you own at http://code.google.com/apis/youtube/dashboard/ |
45 // obtain you own at http://code.google.com/apis/youtube/dashboard/ |
46 static const QByteArray devKey = "AI39si5pKjxR0XgNIlmrEFF-LyYD31rps4g2O5dZTxLgD0fvJ2rHxrMrNFY8FYTZrzeI3VlaFVQLKfFnSBugvdZmy8vFzRDefQ"; |
46 static const QByteArray devKey = "AI39si5pKjxR0XgNIlmrEFF-LyYD31rps4g2O5dZTxLgD0fvJ2rHxrMrNFY8FYTZrzeI3VlaFVQLKfFnSBugvdZmy8vFzRDefQ"; |
191 request.setRawHeader("User-Agent", USER_AGENT); |
191 request.setRawHeader("User-Agent", USER_AGENT); |
192 request.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); |
192 request.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); |
193 |
193 |
194 QString account(QUrl::toPercentEncoding(leAccount->text())); |
194 QString account(QUrl::toPercentEncoding(leAccount->text())); |
195 QString pass(QUrl::toPercentEncoding(lePassword->text())); |
195 QString pass(QUrl::toPercentEncoding(lePassword->text())); |
196 QByteArray data = QString("Email=%1&Passwd=%2&service=youtube&source=Hedgewars").arg(account).arg(pass).toAscii(); |
196 QByteArray data = QString("Email=%1&Passwd=%2&service=youtube&source=Hedgewars").arg(account).arg(pass).toUtf8(); |
197 |
197 |
198 QNetworkReply *reply = netManager->post(request, data); |
198 QNetworkReply *reply = netManager->post(request, data); |
199 connect(reply, SIGNAL(finished()), this, SLOT(authFinished())); |
199 connect(reply, SIGNAL(finished()), this, SLOT(authFinished())); |
200 } |
200 } |
201 |
201 |
244 |
244 |
245 setEditable(true); |
245 setEditable(true); |
246 return; |
246 return; |
247 } |
247 } |
248 |
248 |
249 QByteArray auth = ("GoogleLogin auth=" + authToken).toAscii(); |
249 QByteArray auth = ("GoogleLogin auth=" + authToken).toLatin1(); |
250 |
250 |
251 // We have authenticated, now we can send metadata and start upload |
251 // We have authenticated, now we can send metadata and start upload |
252 // Documentation is here: https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads#Resumable_uploads |
252 // Documentation is here: https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads#Resumable_uploads |
253 QByteArray body = |
253 QByteArray body = |
254 "<?xml version=\"1.0\"?>" |
254 "<?xml version=\"1.0\"?>" |