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
587c859b
Commit
587c859b
authored
Oct 09, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version correctly handled
parent
e9f745b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
167 deletions
+5
-167
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+2
-2
UBVersion.cpp
src/frameworks/UBVersion.cpp
+2
-149
UBVersion.h
src/frameworks/UBVersion.h
+1
-16
No files found.
src/core/UBApplicationController.cpp
View file @
587c859b
...
...
@@ -525,8 +525,8 @@ void UBApplicationController::downloadJsonFinished(QString currentJson)
QScriptEngine
scriptEngine
;
scriptValue
=
scriptEngine
.
evaluate
(
"("
+
currentJson
+
")"
);
UBVersion
installedVersion
(
qApp
->
applicationVersion
()
.
left
(
4
)
);
UBVersion
jsonVersion
(
scriptValue
.
property
(
"version"
).
toString
()
.
left
(
4
)
);
UBVersion
installedVersion
(
qApp
->
applicationVersion
());
UBVersion
jsonVersion
(
scriptValue
.
property
(
"version"
).
toString
());
if
(
jsonVersion
>
installedVersion
)
{
if
(
UBApplication
::
mainWindow
->
yesNoQuestion
(
tr
(
"Update available"
),
tr
(
"New update available, would you go to the web page ?"
))){
...
...
src/frameworks/UBVersion.cpp
View file @
587c859b
...
...
@@ -33,16 +33,6 @@
#include "core/memcheck.h"
//UBVersion::UBVersion()
// : mIsValid(false)
// , mPlatform(-1)
// , mMajor(-1)
// , mMinor(-1)
//{
// // NOOP
//}
UBVersion
::
UBVersion
(
const
QString
&
string
)
{
mString
=
string
;
...
...
@@ -55,11 +45,11 @@ uint UBVersion::toUInt() const
switch
(
list
.
count
())
{
case
2
:
//short version 1.0
result
=
(
list
.
at
(
0
).
toUInt
()
*
1000000
)
+
(
list
.
at
(
1
).
toUInt
()
*
10000
);
result
=
(
list
.
at
(
0
).
toUInt
()
*
1000000
)
+
(
list
.
at
(
1
).
toUInt
()
*
10000
)
+
(
Release
*
100
)
;
break
;
case
3
:
//release version 1.0.0
result
=
(
list
.
at
(
0
).
toUInt
()
*
1000000
)
+
(
list
.
at
(
1
).
toUInt
()
*
10000
)
+
list
.
at
(
2
).
toUInt
();
result
=
(
list
.
at
(
0
).
toUInt
()
*
1000000
)
+
(
list
.
at
(
1
).
toUInt
()
*
10000
)
+
(
Release
*
100
)
+
list
.
at
(
2
).
toUInt
();
break
;
case
4
:{
//standard version 1.0.a/b/r.0
...
...
@@ -79,143 +69,6 @@ UBVersion::~UBVersion()
// NOOP
}
//QString UBVersion::toString() const
//{
// return isValid() ? mString : "INVALID";
//}
//void UBVersion::setString(const QString &string)
//{
// mIsValid = true;
// mString = string;
// QStringList versionParts = string.split(".");
// int count = versionParts.count();
// if (count < 2)
// {
// mIsValid = false;
// return;
// }
// mPlatform = versionParts.at(0).toInt(&mIsValid);
// if (!isValid()) return;
// mMajor = versionParts.at(1).toInt(&mIsValid);
// if (!isValid()) return;
// if (count == 2)
// {
// mMinor = 0;
// mReleaseStage = ReleaseCandidate;
// }
// else if (count == 3)
// {
// // Format 4.1.2 (implicitly release)
// mMinor = versionParts.at(2).toInt(&mIsValid);
// if (!isValid()) return;
// mReleaseStage = ReleaseCandidate;
// }
// else if (count >= 4)
// {
// // Format 4.1.x.2 (where x = a|b|r|<integer>)
// if ("a" == versionParts.at(2))
// {
// mReleaseStage = Alpha;
// }
// else if ("b" == versionParts.at(2))
// {
// mReleaseStage = Beta;
// }
// else if ("r" == versionParts.at(2))
// {
// mReleaseStage = ReleaseCandidate;
// }
// else
// {
// mMinor = versionParts.at(2).toInt(&mIsValid);
// if (!isValid()) return;
// mReleaseStage = ReleaseCandidate;
// return;
// }
// QStringList lastParts = versionParts.at(3).split(" ");
// mMinor = lastParts.at(0).toInt();
// }
//}
//bool UBVersion::isValid() const
//{
// return mIsValid;
//}
//int UBVersion::platformNumber() const
//{
// Q_ASSERT(isValid());
// return mPlatform;
//}
//int UBVersion::majorNumber() const
//{
// Q_ASSERT(isValid());
// return mMajor;
//}
//ReleaseStage UBVersion::releaseStage() const
//{
// Q_ASSERT(isValid());
// return mReleaseStage;
//}
//int UBVersion::minorNumber() const
//{
// Q_ASSERT(isValid());
// return mMinor;
//}
//bool UBVersion::operator < (const UBVersion &otherVersion) const
//{
// Q_ASSERT(isValid());
// Q_ASSERT(otherVersion.isValid());
// if (platformNumber() != otherVersion.platformNumber())
// return platformNumber() < otherVersion.platformNumber();
// if (majorNumber() != otherVersion.majorNumber())
// return majorNumber() < otherVersion.majorNumber();
// if (releaseStage() != otherVersion.releaseStage())
// return releaseStage() < otherVersion.releaseStage();
// if (minorNumber() != otherVersion.minorNumber())
// return minorNumber() < otherVersion.minorNumber();
// return false;
//}
//bool UBVersion::operator == (const UBVersion &otherVersion) const
//{
// Q_ASSERT(isValid());
// Q_ASSERT(otherVersion.isValid());
// return (platformNumber() == otherVersion.platformNumber() &&
// majorNumber() == otherVersion.majorNumber() &&
// releaseStage() == otherVersion.releaseStage() &&
// minorNumber() == otherVersion.minorNumber());
//}
//bool UBVersion::operator > (const UBVersion &otherVersion) const
//{
// Q_ASSERT(isValid());
// Q_ASSERT(otherVersion.isValid());
// if (platformNumber() != otherVersion.platformNumber())
// return platformNumber() > otherVersion.platformNumber();
// if (majorNumber() != otherVersion.majorNumber())
// return majorNumber() > otherVersion.majorNumber();
// if (releaseStage() != otherVersion.releaseStage())
// return releaseStage() > otherVersion.releaseStage();
// if (minorNumber() != otherVersion.minorNumber())
// return minorNumber() > otherVersion.minorNumber();
// return false;
//}
bool
UBVersion
::
operator
<
(
const
UBVersion
&
otherVersion
)
const
{
return
toUInt
()
<
otherVersion
.
toUInt
();
...
...
src/frameworks/UBVersion.h
View file @
587c859b
...
...
@@ -30,26 +30,16 @@
#include <QString>
enum
ReleaseStage
{
Alpha
=
10
,
Beta
=
11
,
ReleaseCandidate
=
15
};
enum
ReleaseStage
{
Alpha
=
10
,
Beta
=
11
,
ReleaseCandidate
=
15
,
Release
=
17
};
class
UBVersion
{
public
:
// UBVersion();
UBVersion
(
const
QString
&
string
);
virtual
~
UBVersion
();
uint
toUInt
()
const
;
// void setString(const QString &string);
// QString toString() const;
// bool isValid() const;
// int platformNumber() const;
// int majorNumber() const;
// ReleaseStage releaseStage() const;
// int minorNumber() const;
bool
operator
<
(
const
UBVersion
&
otherVersion
)
const
;
bool
operator
==
(
const
UBVersion
&
otherVersion
)
const
;
bool
operator
>
(
const
UBVersion
&
otherVersion
)
const
;
...
...
@@ -57,11 +47,6 @@ class UBVersion
private
:
QString
mString
;
// bool mIsValid;
// int mPlatform;
// int mMajor;
// int mMinor;
// ReleaseStage mReleaseStage;
};
#endif // UBVERSION_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