Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
9aa11485
Commit
9aa11485
authored
Oct 12, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some fixes on mac for issue 1164
parent
241e770f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
17 deletions
+24
-17
UBYouTubePublisher.cpp
src/podcast/youtube/UBYouTubePublisher.cpp
+24
-17
No files found.
src/podcast/youtube/UBYouTubePublisher.cpp
View file @
9aa11485
...
@@ -94,16 +94,16 @@ void UBYouTubePublisher::postClientLoginRequest(const QString& userName, const Q
...
@@ -94,16 +94,16 @@ void UBYouTubePublisher::postClientLoginRequest(const QString& userName, const Q
QUrl
url
(
"https://www.google.com/youtube/accounts/ClientLogin"
);
QUrl
url
(
"https://www.google.com/youtube/accounts/ClientLogin"
);
mAuthRequest
=
new
UBServerXMLHttpRequest
(
UBNetworkAccessManager
::
defaultAccessManager
()
mAuthRequest
=
new
UBServerXMLHttpRequest
(
UBNetworkAccessManager
::
defaultAccessManager
()
,
"application/x-www-form-urlencoded"
);
// destroyed in postClientLoginResponse
,
"application/x-www-form-urlencoded"
);
// destroyed in postClientLoginResponse
connect
(
mAuthRequest
,
SIGNAL
(
finished
(
bool
,
const
QByteArray
&
)),
this
,
SLOT
(
postClientLoginResponse
(
bool
,
const
QByteArray
&
)));
connect
(
mAuthRequest
,
SIGNAL
(
finished
(
bool
,
const
QByteArray
&
)),
this
,
SLOT
(
postClientLoginResponse
(
bool
,
const
QByteArray
&
)));
mAuthRequest
->
addHeader
(
"X-GData-Key"
,
sYouTubeDeveloperKey
);
mAuthRequest
->
addHeader
(
"X-GData-Key"
,
sYouTubeDeveloperKey
);
QString
payload
=
QString
(
"Email=%1&Passwd=%2&service=youtube&source=%3"
)
QString
payload
=
QString
(
"Email=%1&Passwd=%2&service=youtube&source=%3"
)
.
arg
(
userName
)
.
arg
(
userName
)
.
arg
(
password
)
.
arg
(
password
)
.
arg
(
tr
(
"OpenSankore"
));
.
arg
(
tr
(
"OpenSankore"
));
mAuthRequest
->
post
(
url
,
payload
.
toUtf8
());
mAuthRequest
->
post
(
url
,
payload
.
toUtf8
());
...
@@ -125,8 +125,8 @@ void UBYouTubePublisher::postClientLoginResponse(bool success, const QByteArray&
...
@@ -125,8 +125,8 @@ void UBYouTubePublisher::postClientLoginResponse(bool success, const QByteArray&
{
{
if
(
line
.
startsWith
(
"Auth="
))
if
(
line
.
startsWith
(
"Auth="
))
{
{
mAuthToken
=
line
.
replace
(
"Auth="
,
""
);
mAuthToken
=
line
.
replace
(
"Auth="
,
""
);
break
;
break
;
}
}
}
}
}
}
...
@@ -137,7 +137,7 @@ void UBYouTubePublisher::postClientLoginResponse(bool success, const QByteArray&
...
@@ -137,7 +137,7 @@ void UBYouTubePublisher::postClientLoginResponse(bool success, const QByteArray&
if
(
mAuthToken
.
length
()
==
0
)
if
(
mAuthToken
.
length
()
==
0
)
{
{
UBApplication
::
showMessage
(
tr
(
"YouTube authentication failed."
));
UBApplication
::
showMessage
(
tr
(
"YouTube authentication failed."
));
// success = false;
// success = false;
deleteLater
();
deleteLater
();
}
}
else
else
...
@@ -188,7 +188,7 @@ void UBYouTubePublisher::postVideoUploadRequest()
...
@@ -188,7 +188,7 @@ void UBYouTubePublisher::postVideoUploadRequest()
QString
contentType
=
QString
(
"multipart/related; boundary=
\"
%1
\"
"
).
arg
(
boundary
);
QString
contentType
=
QString
(
"multipart/related; boundary=
\"
%1
\"
"
).
arg
(
boundary
);
mUploadRequest
=
new
UBServerXMLHttpRequest
(
UBNetworkAccessManager
::
defaultAccessManager
()
mUploadRequest
=
new
UBServerXMLHttpRequest
(
UBNetworkAccessManager
::
defaultAccessManager
()
,
contentType
);
// destroyed in postVideoUploadResponse
,
contentType
);
// destroyed in postVideoUploadResponse
mUploadRequest
->
setVerbose
(
true
);
mUploadRequest
->
setVerbose
(
true
);
connect
(
mUploadRequest
,
SIGNAL
(
progress
(
qint64
,
qint64
)),
this
,
SLOT
(
progress
(
qint64
,
qint64
)));
connect
(
mUploadRequest
,
SIGNAL
(
progress
(
qint64
,
qint64
)),
this
,
SLOT
(
progress
(
qint64
,
qint64
)));
...
@@ -206,15 +206,15 @@ void UBYouTubePublisher::postVideoUploadRequest()
...
@@ -206,15 +206,15 @@ void UBYouTubePublisher::postVideoUploadRequest()
QByteArray
payload
;
QByteArray
payload
;
payload
.
append
(
QString
(
"
\n
--"
+
boundary
+
"
\n
"
).
toUtf8
())
payload
.
append
(
QString
(
"
\n
--"
+
boundary
+
"
\n
"
).
toUtf8
())
.
append
(
QString
(
"Content-Type: application/atom+xml; charset=UTF-8
\n\n
"
).
toUtf8
())
.
append
(
QString
(
"Content-Type: application/atom+xml; charset=UTF-8
\n\n
"
).
toUtf8
())
.
append
(
youtubeMetadata
().
toUtf8
());
.
append
(
youtubeMetadata
().
toUtf8
());
payload
.
append
(
QString
(
"
\n
--"
+
boundary
+
"
\n
"
).
toUtf8
());
payload
.
append
(
QString
(
"
\n
--"
+
boundary
+
"
\n
"
).
toUtf8
());
QString
videoMimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
mVideoFilePath
);
QString
videoMimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
mVideoFilePath
);
payload
.
append
((
QString
(
"Content-Type: %1
\n
"
).
arg
(
videoMimeType
)).
toUtf8
())
payload
.
append
((
QString
(
"Content-Type: %1
\n
"
).
arg
(
videoMimeType
)).
toUtf8
())
.
append
(
QString
(
"Content-Transfer-Encoding: binary
\n\n
"
).
toUtf8
());
.
append
(
QString
(
"Content-Transfer-Encoding: binary
\n\n
"
).
toUtf8
());
payload
.
append
(
videoFile
.
readAll
());
payload
.
append
(
videoFile
.
readAll
());
...
@@ -340,7 +340,13 @@ UBYouTubePublishingDialog::UBYouTubePublishingDialog(const QString& videoFilePat
...
@@ -340,7 +340,13 @@ UBYouTubePublishingDialog::UBYouTubePublishingDialog(const QString& videoFilePat
dialogButtons
->
button
(
QDialogButtonBox
::
Ok
)
->
setEnabled
(
false
);
dialogButtons
->
button
(
QDialogButtonBox
::
Ok
)
->
setEnabled
(
false
);
dialogButtons
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"Upload"
));
dialogButtons
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"Upload"
));
UBSettings
*
settings
=
UBSettings
::
settings
();
email
->
setText
(
settings
->
youTubeUserEMail
->
get
().
toString
());
password
->
setText
(
settings
->
password
(
email
->
text
()));
youtubeCredentialsPersistence
->
setChecked
(
UBSettings
::
settings
()
->
youTubeCredentialsPersistence
->
get
().
toBool
());
youtubeCredentialsPersistence
->
setChecked
(
UBSettings
::
settings
()
->
youTubeCredentialsPersistence
->
get
().
toBool
());
updatePersistanceEnableState
();
}
}
...
@@ -353,20 +359,21 @@ void UBYouTubePublishingDialog::updatePersistanceEnableState()
...
@@ -353,20 +359,21 @@ void UBYouTubePublishingDialog::updatePersistanceEnableState()
{
{
bool
enabled
=
email
->
text
().
length
()
||
password
->
text
().
length
();
bool
enabled
=
email
->
text
().
length
()
||
password
->
text
().
length
();
youtubeCredentialsPersistence
->
setEnabled
(
enabled
);
youtubeCredentialsPersistence
->
setEnabled
(
enabled
);
youtubeCredentialsPersistence
->
setStyleSheet
(
enabled
?
"color:black;"
:
"color
lightgra
y;"
);
youtubeCredentialsPersistence
->
setStyleSheet
(
enabled
?
"color:black;"
:
"color
: lightgre
y;"
);
}
}
void
UBYouTubePublishingDialog
::
updateUIState
(
const
QString
&
string
)
void
UBYouTubePublishingDialog
::
updateUIState
(
const
QString
&
string
)
{
{
Q_UNUSED
(
string
);
Q_UNUSED
(
string
);
bool
ok
=
title
->
text
().
length
()
>
0
bool
ok
=
title
->
text
().
length
()
>
0
&&
description
->
toPlainText
().
length
()
>
0
&&
description
->
toPlainText
().
length
()
>
0
&&
keywords
->
text
().
length
()
>
0
&&
keywords
->
text
().
length
()
>
0
&&
email
->
text
().
length
()
>
0
&&
email
->
text
().
length
()
>
0
&&
password
->
text
().
length
()
>
0
;
&&
password
->
text
().
length
()
>
0
;
dialogButtons
->
button
(
QDialogButtonBox
::
Ok
)
->
setEnabled
(
ok
);
dialogButtons
->
button
(
QDialogButtonBox
::
Ok
)
->
setEnabled
(
ok
);
updatePersistanceEnableState
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment