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
23451a3b
Commit
23451a3b
authored
Aug 15, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handling redirection for check new version request
parent
e4382f6a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+14
-3
UBApplicationController.h
src/core/UBApplicationController.h
+5
-1
No files found.
src/core/UBApplicationController.cpp
View file @
23451a3b
...
...
@@ -24,7 +24,6 @@
#include "UBApplicationController.h"
#include "frameworks/UBPlatformUtils.h"
...
...
@@ -481,16 +480,27 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
}
void
UBApplicationController
::
checkUpdate
()
void
UBApplicationController
::
checkUpdate
(
QString
urlString
)
{
if
(
mHttp
)
delete
mHttp
;
QUrl
url
(
"http://get.openboard.org/update.json"
);
QUrl
url
(
urlString
);
mHttp
=
new
QHttp
(
url
.
host
());
connect
(
mHttp
,
SIGNAL
(
requestFinished
(
int
,
bool
)),
this
,
SLOT
(
updateRequestFinished
(
int
,
bool
)));
connect
(
mHttp
,
SIGNAL
(
responseHeaderReceived
(
QHttpResponseHeader
)),
this
,
SLOT
(
updateHeaderReceived
(
QHttpResponseHeader
)));
mHttp
->
get
(
url
.
path
());
}
void
UBApplicationController
::
updateHeaderReceived
(
QHttpResponseHeader
header
)
{
if
(
header
.
statusCode
()
==
302
&&
header
.
hasKey
(
"Location"
)){
mHttp
->
close
();
checkUpdate
(
header
.
value
(
"Location"
));
}
}
void
UBApplicationController
::
updateRequestFinished
(
int
id
,
bool
error
)
{
if
(
error
){
...
...
@@ -499,6 +509,7 @@ void UBApplicationController::updateRequestFinished(int id, bool error)
}
else
{
QString
responseString
=
QString
(
mHttp
->
readAll
());
qDebug
()
<<
responseString
;
if
(
!
responseString
.
isEmpty
()
&&
responseString
.
contains
(
"version"
)
&&
responseString
.
contains
(
"url"
)){
mHttp
->
close
();
downloadJsonFinished
(
responseString
);
...
...
src/core/UBApplicationController.h
View file @
23451a3b
...
...
@@ -30,6 +30,8 @@
#include <QtGui>
#include <QFtp>
#include <QHttpResponseHeader>
class
UBBoardView
;
class
UBDocumentProxy
;
...
...
@@ -145,6 +147,8 @@ class UBApplicationController : public QObject
private
slots
:
void
updateRequestFinished
(
int
id
,
bool
error
);
void
updateHeaderReceived
(
QHttpResponseHeader
header
);
protected
:
...
...
@@ -178,7 +182,7 @@ class UBApplicationController : public QObject
bool
mIsShowingDesktop
;
bool
isNoUpdateDisplayed
;
void
checkUpdate
();
void
checkUpdate
(
QString
urlString
=
"http://get.openboard.org/update.json"
);
QNetworkAccessManager
*
networkAccessManager
;
void
downloadJsonFinished
(
QString
updateString
);
...
...
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