Commit 2a780fe7 authored by Johnny Jazeix's avatar Johnny Jazeix
Browse files

changelog, adding a default panel and the version handling

parent ff718a62
......@@ -46,7 +46,7 @@ set(GCOMPRIS_VERSION ${GCOMPRIS_MAJOR_VERSION}.${GCOMPRIS_MINOR_VERSION})
# An integer value that represents the version of the application
# Increase it at each release
set(GCOMPRIS_VERSION_CODE ${GCOMPRIS_MINOR_VERSION})
math(EXPR GCOMPRIS_VERSION_CODE "${GCOMPRIS_MAJOR_VERSION}*10000 + ${GCOMPRIS_MINOR_VERSION}*100 + ${GCOMPRIS_PATCH_VERSION}")
# cmake modules setup
find_package(ECM 1.4.0 QUIET NO_MODULE)
......
......@@ -115,6 +115,11 @@ class ApplicationInfo : public QObject
*/
Q_PROPERTY(QString GCVersion READ GCVersion CONSTANT)
/**
* GCompris version code (compile time).
*/
Q_PROPERTY(int GCVersionCode READ GCVersionCode CONSTANT)
/**
* Qt version string (runtime).
*/
......@@ -243,6 +248,7 @@ public:
return localeShort( ApplicationSettings::getInstance()->locale() );
}
static QString GCVersion() { return VERSION; }
static int GCVersionCode() { return VERSION_CODE; }
static QString QTVersion() { return qVersion(); }
static QString CompressedAudio() { return COMPRESSED_AUDIO; }
static bool isDownloadAllowed() { return QString(DOWNLOAD_ALLOWED) == "ON"; }
......
......@@ -56,6 +56,7 @@ static const QString ENABLE_AUTOMATIC_DOWNLOADS = "enableAutomaticDownloads";
static const QString DOWNLOAD_SERVER_URL_KEY = "downloadServerUrl";
static const QString EXE_COUNT_KEY = "exeCount";
static const QString LAST_GC_VERSION_RAN = "lastGCVersionRan";
static const QString FILTER_LEVEL_MIN = "filterLevelMin";
static const QString FILTER_LEVEL_MAX = "filterLevelMax";
......@@ -141,11 +142,13 @@ ApplicationSettings::ApplicationSettings(QObject *parent): QObject(parent),
// internal group
m_config.beginGroup(INTERNAL_GROUP_KEY);
m_exeCount = m_config.value(EXE_COUNT_KEY, 0).toUInt();
m_lastGCVersionRan = m_config.value(LAST_GC_VERSION_RAN, ApplicationInfo::getInstance()->GCVersionCode()).toUInt();
m_config.endGroup();
// no group
m_isBarHidden = false;
<<<<<<< ff718a62d9b45ef2cc3aa3eb27dee32e00bd2cfd
connect(this, &ApplicationSettings::showLockedActivitiesChanged, this, &ApplicationSettings::notifyShowLockedActivitiesChanged);
connect(this, &ApplicationSettings::audioVoicesEnabledChanged, this, &ApplicationSettings::notifyAudioVoicesEnabledChanged);
connect(this, &ApplicationSettings::audioEffectsEnabledChanged, this, &ApplicationSettings::notifyAudioEffectsEnabledChanged);
......@@ -163,6 +166,7 @@ ApplicationSettings::ApplicationSettings(QObject *parent): QObject(parent),
connect(this, &ApplicationSettings::downloadServerUrlChanged, this, &ApplicationSettings::notifyDownloadServerUrlChanged);
connect(this, &ApplicationSettings::exeCountChanged, this, &ApplicationSettings::notifyExeCountChanged);
connect(this, &ApplicationSettings::barHiddenChanged, this, &ApplicationSettings::notifyBarHiddenChanged);
connect(this, &ApplicationSettings::lastGCVersionRanChanged, this, &ApplicationSettings::notifyLastGCVersionRanChanged);
}
ApplicationSettings::~ApplicationSettings()
......@@ -199,6 +203,7 @@ ApplicationSettings::~ApplicationSettings()
// internal group
m_config.beginGroup(INTERNAL_GROUP_KEY);
m_config.setValue(EXE_COUNT_KEY, m_exeCount);
m_config.setValue(LAST_GC_VERSION_RAN, m_lastGCVersionRan);
m_config.endGroup();
m_config.sync();
......@@ -332,6 +337,12 @@ void ApplicationSettings::notifyExeCountChanged()
qDebug() << "exeCount set to: " << m_exeCount;
}
void ApplicationSettings::notifyLastGCVersionRanChanged()
{
updateValueInConfig(INTERNAL_GROUP_KEY, LAST_GC_VERSION_RAN, m_lastGCVersionRan);
qDebug() << "lastVersionRan set to: " << m_lastGCVersionRan;
}
void ApplicationSettings::notifyBarHiddenChanged()
{
qDebug() << "is bar hidden: " << m_isBarHidden;
......
......@@ -205,8 +205,11 @@ class ApplicationSettings : public QObject
// internal group
Q_PROPERTY(quint32 exeCount READ exeCount WRITE setExeCount NOTIFY exeCountChanged)
// no group
Q_PROPERTY(bool isBarHidden READ isBarHidden WRITE setBarHidden NOTIFY barHiddenChanged)
// keep last version ran. If different than ApplicationInfo.GCVersionCode(), it means a new version is running
Q_PROPERTY(int lastGCVersionRan READ lastGCVersionRan WRITE setLastGCVersionRan NOTIFY lastGCVersionRanChanged)
// no group
Q_PROPERTY(bool isBarHidden READ isBarHidden WRITE setBarHidden NOTIFY barHiddenChanged)
public:
/// @cond INTERNAL_DOCS
......@@ -381,6 +384,12 @@ public:
int baseFontSizeMin() const { return m_baseFontSizeMin; }
int baseFontSizeMax() const { return m_baseFontSizeMax; }
int lastGCVersionRan() const { return m_lastGCVersionRan; }
void setLastGCVersionRan(const int newLastGCVersionRan) {
m_lastGCVersionRan = newLastGCVersionRan;
emit lastGCVersionRanChanged();
}
protected slots:
Q_INVOKABLE void notifyShowLockedActivitiesChanged();
......@@ -405,6 +414,8 @@ protected slots:
Q_INVOKABLE void notifyExeCountChanged();
Q_INVOKABLE void notifyLastGCVersionRanChanged();
Q_INVOKABLE void notifyBarHiddenChanged();
public slots:
......@@ -469,6 +480,7 @@ signals:
void exeCountChanged();
void lastGCVersionRanChanged();
void barHiddenChanged();
private:
......@@ -507,6 +519,8 @@ private:
quint32 m_exeCount;
int m_lastGCVersionRan;
bool m_isBarHidden;
QSettings m_config;
......
/* GCompris - ChangeLog.qml
*
* Copyright (C) 2016 Johnny Jazeix <jazeix@gmail.com>
*
* Authors:
* Johnny Jazeix <jazeix@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.2
/**
* Container object with a list of all the changes by version.
* @ingroup infrastructure
*
*/
QtObject {
/**
* type: list
* List of changelog objects.
*
* A changelog object consists of the properties @c version (10000*major+100*minor+patch)
* and @c content (which changes have been added in this version).
*
*/
property var changelog: [
{ "version": "0.60", "versionCode": 6000, "content": qsTr("New activities: baby_word_processor, ") },
{ "version": "0.50", "versionCode": 5000, "content": qsTr("New activities: Chess activity, Sound sequence memory, Vocabulary training, Famous paintings puzzle, Reading practice activity, Scientific electrical grid power supply simulation, Scientific water system simulation, A fine motor skill practice activity based on the accelerometer, The classical hangman.") },
{ "version": "0.40", "versionCode": 4000, "content": qsTr("New activities: algebra_div, babymatch, babyshapes, braille_fun, chronos, details, geo-country, geography, hanoi, hanoi_real, imagename, intro_gravity, louis-braille, simplepaint, superbrain, tic_tac_toe and tic_tac_toe_2players") }
]
function isNewerVersion(previousVersion, newVersion) {
return newVersion > previousVersion
}
function getLogBetween(previousVersion, newVersion) {
var filtered = changelog.filter(function filter(obj) {
return isNewerVersion(previousVersion, obj['versionCode'])
});
var output = "";
filtered.map(function filter(obj) {
var content = obj['content'].split(',').join('<br>');
output += "Version %1: %2<br/>".arg(obj['version']).arg(content);
});
return output
}
}
......@@ -177,7 +177,7 @@ Item {
Button {
id: button1
width: parent.width
height: 60 * ApplicationInfo.ratio
height: (visible ? 60 : 30) * ApplicationInfo.ratio
anchors {
horizontalCenter: parent.horizontalCenter
top: instructionTxtBg.bottom
......@@ -195,7 +195,7 @@ Item {
Button {
id: button2
width: parent.width
height: 60 * ApplicationInfo.ratio
height: (visible ? 60 : 30) * ApplicationInfo.ratio
anchors {
horizontalCenter: parent.horizontalCenter
top: button1.bottom
......
......@@ -21,8 +21,11 @@
#ifndef GCOMPRIS_CONFIG_H
#define GCOMPRIS_CONFIG_H
/* Version number of package */
/* Version number of package (string) */
#define VERSION "@GCOMPRIS_VERSION@"
/* Version number of package (integer) */
#define VERSION_CODE @GCOMPRIS_VERSION_CODE@
/* Folder where rccs and translations are installed */
#ifdef Q_OS_MAC
#define GCOMPRIS_DATA_FOLDER "../Resources"
......
......@@ -134,6 +134,9 @@ Window {
);
}
}
ChangeLog {
id: changelog
}
Component.onCompleted: {
console.log("enter main.qml (run #" + ApplicationSettings.exeCount
......@@ -170,8 +173,23 @@ Window {
checkWordset()
}
);
} else {
}
else {
checkWordset()
if(changelog.isNewerVersion(ApplicationSettings.lastGCVersionRan, ApplicationInfo.GCVersionCode)) {
// display log between ApplicationSettings.lastGCVersionRan and ApplicationInfo.GCVersionCode
var dialog;
dialog = Core.showMessageDialog(
main,
qsTr("GCompris has been updated!<br/>") + changelog.getLogBetween(ApplicationSettings.lastGCVersionRan, ApplicationInfo.GCVersionCode),
"", null,
"", null,
function() { pageView.currentItem.focus = true }
);
// Store new version
ApplicationSettings.lastGCVersionRan = ApplicationInfo.GCVersionCode;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment