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
98094ee7
Commit
98094ee7
authored
Jun 14, 2011
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated update check using now the ftp directory to store the update.json
parent
82cd2e50
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
7 deletions
+41
-7
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+33
-6
UBApplicationController.h
src/core/UBApplicationController.h
+8
-1
No files found.
src/core/UBApplicationController.cpp
View file @
98094ee7
...
...
@@ -479,18 +479,44 @@ void UBApplicationController::showSankoreEditor()
void
UBApplicationController
::
checkUpdate
()
{
networkAccessManager
->
get
(
QNetworkRequest
(
QUrl
(
"http://getuniboard.com/dl/sankore/update.json"
)));
mFtp
=
new
QFtp
(
this
);
connect
(
mFtp
,
SIGNAL
(
commandFinished
(
int
,
bool
)),
this
,
SLOT
(
ftpCommandFinished
(
int
,
bool
)));
mFtp
->
connectToHost
(
"91.121.248.138"
,
21
);
mFtp
->
login
(
"anonymous"
,
"anonymous"
);
mFtp
->
get
(
"update.json"
,
0
);
}
void
UBApplicationController
::
downloadJsonFinished
(
QNetworkReply
*
pReply
)
void
UBApplicationController
::
ftpCommandFinished
(
int
id
,
bool
error
)
{
if
(
error
){
qWarning
()
<<
"ftp command id"
<<
id
<<
"return the error: "
<<
mFtp
->
errorString
();
mFtp
->
close
();
}
else
{
// 3 stand for the third command we have sent
// in our case
// 1->connect
// 2->login
// 3->get
if
(
id
==
3
){
QString
updateString
=
QString
(
mFtp
->
readAll
());
mFtp
->
close
();
downloadJsonFinished
(
updateString
);
}
}
}
void
UBApplicationController
::
downloadJsonFinished
(
QString
currentJson
)
{
QString
currentJson
=
pReply
->
readAll
();
QScriptValue
scriptValue
;
QScriptEngine
scriptEngine
;
scriptValue
=
scriptEngine
.
evaluate
(
"("
+
currentJson
+
")"
);
UBVersion
installedVersion
(
qApp
->
applicationVersion
());
UBVersion
jsonVersion
(
scriptValue
.
property
(
"version"
).
toString
());
UBVersion
installedVersion
(
qApp
->
applicationVersion
()
.
left
(
4
)
);
UBVersion
jsonVersion
(
scriptValue
.
property
(
"version"
).
toString
()
.
left
(
4
)
);
if
(
installedVersion
.
isValid
()
&&
jsonVersion
.
isValid
()
&&
jsonVersion
>
installedVersion
)
{
QMessageBox
msgBox
;
...
...
@@ -511,7 +537,8 @@ void UBApplicationController::downloadJsonFinished(QNetworkReply* pReply)
// should never be reached
break
;
}
}
else
{
}
else
{
if
(
isNoUpdateDisplayed
)
{
QMessageBox
msgBox
;
msgBox
.
setText
(
tr
(
"No update available"
));
...
...
src/core/UBApplicationController.h
View file @
98094ee7
...
...
@@ -3,6 +3,7 @@
#define UBAPPLICATIONCONTROLLER_H_
#include <QtGui>
#include <QFtp>
class
UBBoardView
;
class
UBDocumentProxy
;
...
...
@@ -16,6 +17,7 @@ class UBSoftwareUpdate;
class
QNetworkAccessManager
;
class
QNetworkReply
;
class
UBApplicationController
:
public
QObject
{
Q_OBJECT
;
...
...
@@ -117,7 +119,9 @@ class UBApplicationController : public QObject
void
checkUpdateRequest
();
void
checkUpdateAtLaunch
();
void
downloadJsonFinished
(
QNetworkReply
*
pReply
);
private
slots
:
void
ftpCommandFinished
(
int
id
,
bool
error
);
protected
:
...
...
@@ -134,6 +138,7 @@ class UBApplicationController : public QObject
UBScreenMirror
*
mMirror
;
int
mInitialHScroll
,
mInitialVScroll
;
QFtp
*
mFtp
;
private
:
...
...
@@ -151,6 +156,8 @@ class UBApplicationController : public QObject
bool
isNoUpdateDisplayed
;
void
checkUpdate
();
QNetworkAccessManager
*
networkAccessManager
;
void
downloadJsonFinished
(
QString
updateString
);
};
#endif
/* UBAPPLICATIONCONTROLLER_H_ */
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