Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qgroundcontrol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Valentin Platzgummer
qgroundcontrol
Commits
be0b2c22
Commit
be0b2c22
authored
6 years ago
by
Don Gagne
Browse files
Options
Downloads
Patches
Plain Diff
Stable desktop version check
parent
a070fb9c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ChangeLog.md
+2
-1
2 additions, 1 deletion
ChangeLog.md
src/QGCApplication.cc
+79
-10
79 additions, 10 deletions
src/QGCApplication.cc
src/QGCApplication.h
+9
-0
9 additions, 0 deletions
src/QGCApplication.h
src/api/QGCCorePlugin.h
+11
-0
11 additions, 0 deletions
src/api/QGCCorePlugin.h
with
101 additions
and
11 deletions
ChangeLog.md
+
2
−
1
View file @
be0b2c22
...
...
@@ -4,7 +4,8 @@ Note: This file only contains high level features or important fixes.
## 3.4
### 3.4.4 - Not yet released
### 3.4.4
*
Stable desktop versions now inform user at boot if newer version is available.
*
Multi-Vehicle Start Mission and Pause now work correctly. Issue #6864.
### 3.4.3
...
...
This diff is collapsed.
Click to expand it.
src/QGCApplication.cc
+
79
−
10
View file @
be0b2c22
...
...
@@ -24,6 +24,7 @@
#include
<QStyleFactory>
#include
<QAction>
#include
<QStringListModel>
#include
<QRegularExpression>
#ifdef QGC_ENABLE_BLUETOOTH
#include
<QBluetoothLocalDevice>
...
...
@@ -86,6 +87,7 @@
#include
"EditPositionDialogController.h"
#include
"FactValueSliderListModel.h"
#include
"KMLFileHelper.h"
#include
"QGCFileDownload.h"
#ifndef NO_SERIAL_LINK
#include
"SerialLink.h"
...
...
@@ -149,7 +151,7 @@ static QObject* kmlFileHelperSingletonFactory(QQmlEngine*, QJSEngine*)
QGCApplication
::
QGCApplication
(
int
&
argc
,
char
*
argv
[],
bool
unitTesting
)
#ifdef __mobile__
:
QGuiApplication
(
argc
,
argv
)
,
_qmlAppEngine
(
NULL
)
,
_qmlAppEngine
(
nullptr
)
#else
:
QApplication
(
argc
,
argv
)
#endif
...
...
@@ -157,10 +159,14 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
,
_logOutput
(
false
)
,
_fakeMobile
(
false
)
,
_settingsUpgraded
(
false
)
,
_majorVersion
(
0
)
,
_minorVersion
(
0
)
,
_buildVersion
(
0
)
,
_currentVersionDownload
(
nullptr
)
#ifdef QT_DEBUG
,
_testHighDPI
(
false
)
#endif
,
_toolbox
(
NULL
)
,
_toolbox
(
nullptr
)
,
_bluetoothAvailable
(
false
)
{
_app
=
this
;
...
...
@@ -322,6 +328,8 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
_toolbox
=
new
QGCToolbox
(
this
);
_toolbox
->
setChildToolboxes
();
_checkForNewVersion
();
}
void
QGCApplication
::
_shutdown
(
void
)
...
...
@@ -692,3 +700,64 @@ bool QGCApplication::isInternetAvailable()
{
return
getQGCMapEngine
()
->
isInternetActive
();
}
void
QGCApplication
::
_checkForNewVersion
(
void
)
{
#ifndef __mobile__
if
(
!
_runningUnitTests
)
{
if
(
_parseVersionText
(
applicationVersion
(),
_majorVersion
,
_minorVersion
,
_buildVersion
))
{
QString
versionCheckFile
=
toolbox
()
->
corePlugin
()
->
stableVersionCheckFileUrl
();
if
(
!
versionCheckFile
.
isEmpty
())
{
_currentVersionDownload
=
new
QGCFileDownload
(
this
);
connect
(
_currentVersionDownload
,
&
QGCFileDownload
::
downloadFinished
,
this
,
&
QGCApplication
::
_currentVersionDownloadFinished
);
connect
(
_currentVersionDownload
,
&
QGCFileDownload
::
error
,
this
,
&
QGCApplication
::
_currentVersionDownloadError
);
_currentVersionDownload
->
download
(
versionCheckFile
);
}
}
}
#endif
}
void
QGCApplication
::
_currentVersionDownloadFinished
(
QString
remoteFile
,
QString
localFile
)
{
Q_UNUSED
(
remoteFile
);
QFile
versionFile
(
localFile
);
if
(
versionFile
.
open
(
QIODevice
::
ReadOnly
))
{
QTextStream
textStream
(
&
versionFile
);
QString
version
=
textStream
.
readLine
();
qDebug
()
<<
version
;
int
majorVersion
,
minorVersion
,
buildVersion
;
if
(
_parseVersionText
(
version
,
majorVersion
,
minorVersion
,
buildVersion
))
{
if
(
_majorVersion
<
majorVersion
||
(
_majorVersion
==
majorVersion
&&
_minorVersion
<
minorVersion
)
||
(
_majorVersion
==
majorVersion
&&
_minorVersion
==
minorVersion
&&
_buildVersion
<
buildVersion
))
{
QGCMessageBox
::
information
(
tr
(
"New Version Available"
),
tr
(
"There is a newer version of %1 available. You can download it from %2."
).
arg
(
applicationName
()).
arg
(
toolbox
()
->
corePlugin
()
->
stableDownloadLocation
()));
}
}
}
_currentVersionDownload
->
deleteLater
();
}
void
QGCApplication
::
_currentVersionDownloadError
(
QString
errorMsg
)
{
Q_UNUSED
(
errorMsg
);
_currentVersionDownload
->
deleteLater
();
}
bool
QGCApplication
::
_parseVersionText
(
const
QString
&
versionString
,
int
&
majorVersion
,
int
&
minorVersion
,
int
&
buildVersion
)
{
QRegularExpression
regExp
(
"v(
\\
d+)
\\
.(
\\
d+)
\\
.(
\\
d+)"
);
QRegularExpressionMatch
match
=
regExp
.
match
(
versionString
);
if
(
match
.
hasMatch
()
&&
match
.
lastCapturedIndex
()
==
3
)
{
majorVersion
=
match
.
captured
(
1
).
toInt
();
minorVersion
=
match
.
captured
(
2
).
toInt
();
buildVersion
=
match
.
captured
(
3
).
toInt
();
return
true
;
}
return
false
;
}
This diff is collapsed.
Click to expand it.
src/QGCApplication.h
+
9
−
0
View file @
be0b2c22
...
...
@@ -42,6 +42,7 @@
class
QGCSingleton
;
class
MainWindow
;
class
QGCToolbox
;
class
QGCFileDownload
;
/**
* @brief The main application and management class.
...
...
@@ -152,9 +153,13 @@ public:
private
slots
:
void
_missingParamsDisplay
(
void
);
void
_currentVersionDownloadFinished
(
QString
remoteFile
,
QString
localFile
);
void
_currentVersionDownloadError
(
QString
errorMsg
);
bool
_parseVersionText
(
const
QString
&
versionString
,
int
&
majorVersion
,
int
&
minorVersion
,
int
&
buildVersion
);
private
:
QObject
*
_rootQmlObject
(
void
);
void
_checkForNewVersion
(
void
);
#ifdef __mobile__
QQmlApplicationEngine
*
_qmlAppEngine
;
...
...
@@ -170,6 +175,10 @@ private:
QStringList
_missingParams
;
///< List of missing facts to be displayed
bool
_fakeMobile
;
///< true: Fake ui into displaying mobile interface
bool
_settingsUpgraded
;
///< true: Settings format has been upgrade to new version
int
_majorVersion
;
int
_minorVersion
;
int
_buildVersion
;
QGCFileDownload
*
_currentVersionDownload
;
#ifdef QT_DEBUG
bool
_testHighDPI
;
///< true: double fonts sizes for simulating high dpi devices
...
...
This diff is collapsed.
Click to expand it.
src/api/QGCCorePlugin.h
+
11
−
0
View file @
be0b2c22
...
...
@@ -112,6 +112,17 @@ public:
/// should derive from QmlComponentInfo and set the url property.
virtual
QmlObjectListModel
*
customMapItems
(
void
);
/// Returns the url to download the stable version check file. Return QString() to indicate no version check should be performed.
/// Default implemenentation returns QGC Stable file location. Custom builds must override to turn off or provide their own location.
/// The contents of this file should be a single line in the form:
/// v3.4.4
/// This indicates the latest stable version number.
virtual
QString
stableVersionCheckFileUrl
(
void
)
{
return
QString
(
"https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGC.version.txt"
);
}
/// Returns the user visible url to show user where to download new stable builds from.
/// Custom builds must override to provide their own location.
virtual
QString
stableDownloadLocation
(
void
)
{
return
QString
(
"qgroundcontrol.com"
);
}
bool
showTouchAreas
(
void
)
const
{
return
_showTouchAreas
;
}
bool
showAdvancedUI
(
void
)
const
{
return
_showAdvancedUI
;
}
void
setShowTouchAreas
(
bool
show
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment