[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [gcompris] /: activation, add an internal activation code (no inapp)
From:       Bruno Coudoin <bruno.coudoin () gcompris ! net>
Date:       2016-01-12 0:01:35
Message-ID: E1aImP1-0002m2-1K () scm ! kde ! org
[Download RAW message or body]

Git commit 13456f643240cff986da0085d802ab95bd4db81c by Bruno Coudoin.
Committed on 11/01/2016 at 23:55.
Pushed by bcoudoin into branch 'master'.

activation, add an internal activation code (no inapp)

Replaced CMake WITH_ACTIVATION_CODE by ACTIVATION_MODE. It can take
3 values, none, inapp or internal.
Add support for entering an activation code in the config dialog.
Add a new persistent config value named 'key' that holds the activation code.
On startup the key is checked in internal mode the key is checked and the
demo mode is set if the code does not match.
The configuration includes an entry box to enter the activation code.
Created another BuyMeOverlay dialog for to have one for inapp and one for
internal mode.

M  +6    -3    CMakeLists.txt
M  +3    -1    android/CMakeLists.txt
M  +87   -4    src/activities/menu/ConfigurationItem.qml
M  +2    -1    src/core/ActivityBase.qml
M  +5    -0    src/core/ApplicationAndroid.cpp
M  +26   -6    src/core/ApplicationSettings.cpp
M  +39   -2    src/core/ApplicationSettings.h
M  +28   -1    src/core/ApplicationSettingsDefault.cpp
M  +36   -40   src/core/BuyMeOverlay.qml
C  +42   -31   src/core/BuyMeOverlayInapp.qml [from: src/core/BuyMeOverlay.qml - 069% \
similarity] M  +1    -5    src/core/CMakeLists.txt
M  +1    -0    src/core/GCButtonCancel.qml
M  +4    -0    src/core/config.h.in
A  +10   -0    tools/gencode.py

http://commits.kde.org/gcompris/13456f643240cff986da0085d802ab95bd4db81c

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a355baf..f3addf7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,9 @@ set(GCOMPRIS_MAJOR_VERSION 0)
 set(GCOMPRIS_MINOR_VERSION 60)
 set(GCOMPRIS_PATCH_VERSION 0)
 
+# Set the BUILD_DATE
+string(TIMESTAMP BUILD_DATE %Y%M)
+
 # Set executable filename
 if(ANDROID)
   set(GCOMPRIS_EXECUTABLE_NAME GCompris)
@@ -102,7 +105,7 @@ FIND_PROGRAM(LRELEASE_EXECUTABLE lrelease lrelease-qt5
 #    message("${_variableName}=${${_variableName}}")
 #endforeach()
 
-option(WITH_ACTIVATION_CODE "Include the activation system" OFF)
+set(ACTIVATION_MODE "no" CACHE STRING "Policy for activation [no|inapp|internal]")
 option(WITH_DEMO_ONLY "Include only demo activities" OFF)
 
 option(WITH_DOWNLOAD "Internal download" ON)
@@ -125,10 +128,10 @@ if(ANDROID)
   set(CMAKE_LIBRARY_OUTPUT_DIRECTORY \
${CMAKE_BINARY_DIR}/android/libs/${ARM_TARGET}/)  set(GCOMPRIS_TRANSLATIONS_DIR \
${CMAKE_BINARY_DIR}/${_data_dest_dir} CACHE INTERNAL "" FORCE)  set(GCOMPRIS_RCC_DIR \
                ${CMAKE_BINARY_DIR}/${_data_dest_dir} CACHE INTERNAL "" FORCE)
-  if(WITH_ACTIVATION_CODE)
+  if(ACTIVATION_MODE STREQUAL "inapp")
     set(ANDROID_BILLING_PERMISSION "<uses-permission \
android:name=\"com.android.vending.BILLING\"/>")  set(ANDROID_PACKAGE "net.gcompris")
-  else(WITH_ACTIVATION_CODE)
+  else(ACTIVATION_MODE)
     set(ANDROID_PACKAGE "net.gcompris.full")
   endif()
   add_subdirectory(android)
diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt
index 370e201..a5803eb 100644
--- a/android/CMakeLists.txt
+++ b/android/CMakeLists.txt
@@ -26,8 +26,10 @@ set(ANDROID_VERSION_NAME ${GCOMPRIS_VERSION})
 
 # Set a name representing the build type
 set(APK_SUFFIX "-")
-if(WITH_ACTIVATION_CODE)
+if(ACTIVATION_MODE STREQUAL "inapp")
   set(APK_SUFFIX "-inapp${APK_SUFFIX}")
+elseif(ACTIVATION_MODE STREQUAL "internal")
+  set(APK_SUFFIX "-internal${APK_SUFFIX}")
 endif(WITH_ACTIVATION_CODE)
 
 if(WITH_DEMO_ONLY)
diff --git a/src/activities/menu/ConfigurationItem.qml \
b/src/activities/menu/ConfigurationItem.qml index f6dc98f..1d868de 100644
--- a/src/activities/menu/ConfigurationItem.qml
+++ b/src/activities/menu/ConfigurationItem.qml
@@ -28,9 +28,9 @@ import "../../core"
 import "qrc:/gcompris/src/core/core.js" as Core
 
 Item {
+    id: dialogConfig
 
     property var languages: allLangs.languages
-    id: dialogConfig
     height: column.height
 
     LanguageList {
@@ -41,6 +41,11 @@ Item {
         id: column
         spacing: 10
         width: parent.width
+
+        move: Transition {
+            NumberAnimation { properties: "x,y"; duration: 120 }
+        }
+
         // Put configuration here
         Row {
             id: demoModeBox
@@ -94,12 +99,91 @@ Item {
                 }
 
                 onClicked: {
-                    if(ApplicationSettings.isDemoMode)
-                    ApplicationSettings.isDemoMode = false
+                    if(ApplicationSettings.activationMode == 1) {
+                        if(ApplicationSettings.isDemoMode)
+                            ApplicationSettings.isDemoMode = false
+                    } else if(ApplicationSettings.activationMode == 2) {
+                        activationCodeEntry.visible = !activationCodeEntry.visible
+                    }
                 }
             }
         }
 
+        Column {
+            id: activationCodeEntry
+            width: parent.width
+            spacing: 10
+            visible: false
+            opacity: 0
+
+            Behavior on opacity { NumberAnimation { duration: 200 } }
+
+            onVisibleChanged: {
+                if(visible) {
+                    activationInput.forceActiveFocus()
+                    activationInput.cursorPosition = 0
+                    opacity = 1
+                } else {
+                    activationInput.focus = false
+                    opacity = 0
+                }
+            }
+
+            GCText {
+                id: activationInstruction
+                fontSize: regularSize
+                color: "black"
+                style: Text.Outline
+                styleColor: "white"
+                horizontalAlignment: Text.AlignHCenter
+                width: parent.width
+                wrapMode: TextEdit.WordWrap
+                text: qsTr("On <a href='http://gcompris.net'>http://gcompris.net</a> \
" + +                           "you will find the instructions to obtain an \
activation code.") +                Component.onCompleted: \
ApplicationInfo.isDownloadAllowed ? +                                           \
linkActivated.connect(Qt.openUrlExternally) : null +            }
+
+            TextInput {
+                id: activationInput
+                width: parent.width
+                focus: true
+                font.weight: Font.DemiBold
+                font.pointSize: ApplicationSettings.baseFontSize
+                                + 14 * ApplicationInfo.fontRatio
+                color: 'black'
+                horizontalAlignment: Text.AlignHCenter
+                inputMask: '>HHHH-HHHH-HHHH;#'
+                text: ApplicationSettings.codeKey
+                onTextChanged: {
+                    var code = text.replace(/-/g,'')
+                    var codeValidity = \
ApplicationSettings.checkActivationCode(code); +                    switch \
(codeValidity) { +                    case 0:
+                        activationMsg.text = qsTr('Enter your activation code');
+                        break;
+                    case 1:
+                        activationMsg.text = qsTr('Sorry, your code is too old for \
this version of GCompris'); +                        break;
+                    case 2:
+                        activationMsg.text = qsTr('You code is valid, thanks a lot \
for your support'); +                        activationCodeEntry.visible = false
+                        ApplicationSettings.codeKey = code
+                        break;
+                    }
+                }
+            }
+
+            GCText {
+                id: activationMsg
+                width: parent.width
+                color: "black"
+                fontSize: regularSize
+                horizontalAlignment: TextInput.AlignHCenter
+                wrapMode: TextEdit.WordWrap
+            }
+        }
+
         GCDialogCheckBox {
             id: displayLockedActivitiesBox
             text: qsTr("Show locked activities")
@@ -394,7 +478,6 @@ Item {
         }
     }
 
-
     property bool showLockedActivities: ApplicationSettings.showLockedActivities
     property bool isAudioVoicesEnabled: ApplicationSettings.isAudioVoicesEnabled
     property bool isAudioEffectsEnabled: ApplicationSettings.isAudioEffectsEnabled
diff --git a/src/core/ActivityBase.qml b/src/core/ActivityBase.qml
index 57fe3b1..05b91f8 100644
--- a/src/core/ActivityBase.qml
+++ b/src/core/ActivityBase.qml
@@ -219,7 +219,8 @@ Item {
 
     Loader {
         id: demoPageLoader
-        source: "BuyMeOverlay.qml"
+        source: ApplicationSettings.activationMode == 1 ?
+                    "BuyMeOverlayInapp.qml" : "BuyMeOverlay.qml"
         anchors.fill: parent
         active: !activityInfo.demo && ApplicationSettings.isDemoMode
     }
diff --git a/src/core/ApplicationAndroid.cpp b/src/core/ApplicationAndroid.cpp
index aea113c..5ef2f04 100644
--- a/src/core/ApplicationAndroid.cpp
+++ b/src/core/ApplicationAndroid.cpp
@@ -44,6 +44,11 @@ void ApplicationSettings::checkPayment() {
 #endif
 }
 
+uint ApplicationSettings::checkActivationCode(const QString code) {
+    // Not used in inapp mode.
+    return 0;
+}
+
 static void bought(JNIEnv *, jclass /*clazz*/, jboolean b)
 {
     ApplicationSettings::getInstance()->bought(b);
diff --git a/src/core/ApplicationSettings.cpp b/src/core/ApplicationSettings.cpp
index a65ba6d..2fc3bf2 100644
--- a/src/core/ApplicationSettings.cpp
+++ b/src/core/ApplicationSettings.cpp
@@ -66,6 +66,7 @@ static const QString FONT_CAPITALIZATION = "fontCapitalization";
 static const QString DEFAULT_CURSOR = "defaultCursor";
 static const QString NO_CURSOR = "noCursor";
 static const QString DEMO_KEY = "demo";
+static const QString CODE_KEY = "key";
 static const QString KIOSK_KEY = "kiosk";
 static const QString SECTION_VISIBLE = "sectionVisible";
 
@@ -92,12 +93,22 @@ ApplicationSettings::ApplicationSettings(QObject *parent): \
                QObject(parent),
     m_fontCapitalization = m_config.value(FONT_CAPITALIZATION, \
                GC_DEFAULT_FONT_CAPITALIZATION).toUInt();
     m_isEmbeddedFont = m_config.value(IS_CURRENT_FONT_EMBEDDED, true).toBool();
 
-// The default demo mode based on the platform
-#if defined(WITH_ACTIVATION_CODE)
-    m_isDemoMode = m_config.value(DEMO_KEY, true).toBool();
-#else
-    m_isDemoMode = m_config.value(DEMO_KEY, false).toBool();
-#endif
+    // Init the activation mode
+    if(QLatin1String(ACTIVATION_MODE) == "no")
+        m_activationMode = 0;
+    else if(QLatin1String(ACTIVATION_MODE) == "inapp")
+        m_activationMode = 1;
+    else if(QLatin1String(ACTIVATION_MODE) == "internal")
+        m_activationMode = 2;
+    else
+        qFatal("Unknown activation mode");
+
+    // Set the demo mode
+    if(QLatin1String(ACTIVATION_MODE) != "no")
+        m_isDemoMode = m_config.value(DEMO_KEY, true).toBool();
+    else
+        m_isDemoMode = false;
+    m_codeKey = m_config.value(CODE_KEY, "").toString();
 
 #if defined(WITH_KIOSK_MODE)
     m_isKioskMode = m_config.value(KIOSK_KEY, true).toBool();
@@ -167,6 +178,7 @@ ApplicationSettings::~ApplicationSettings()
     m_config.setValue(FILTER_LEVEL_MIN, m_filterLevelMin);
 	m_config.setValue(FILTER_LEVEL_MAX, m_filterLevelMax);
     m_config.setValue(DEMO_KEY, m_isDemoMode);
+    m_config.setValue(CODE_KEY, m_codeKey);
     m_config.setValue(KIOSK_KEY, m_isKioskMode);
     m_config.setValue(SECTION_VISIBLE, m_sectionVisible);
 	m_config.setValue(DEFAULT_CURSOR, m_defaultCursor);
@@ -278,6 +290,14 @@ void ApplicationSettings::notifyDemoModeChanged()
     qDebug() << "notifyDemoMode: " << m_isDemoMode;
 }
 
+void ApplicationSettings::notifyCodeKeyChanged()
+{
+    checkPayment();
+    if(!m_isDemoMode)
+        updateValueInConfig(GENERAL_GROUP_KEY, CODE_KEY, m_codeKey);
+    qDebug() << "notifyCodeKey: " << m_codeKey;
+}
+
 void ApplicationSettings::notifyKioskModeChanged()
 {
     updateValueInConfig(GENERAL_GROUP_KEY, KIOSK_KEY, m_isKioskMode);
diff --git a/src/core/ApplicationSettings.h b/src/core/ApplicationSettings.h
index bce4961..7f5ec7e 100644
--- a/src/core/ApplicationSettings.h
+++ b/src/core/ApplicationSettings.h
@@ -143,6 +143,16 @@ class ApplicationSettings : public QObject
     Q_PROPERTY(bool isDemoMode READ isDemoMode WRITE setDemoMode NOTIFY \
demoModeChanged)  
     /**
+     * Activation code key.
+     */
+    Q_PROPERTY(QString codeKey READ codeKey WRITE setCodeKey NOTIFY codeKeyChanged)
+
+    /**
+     * Activation mode.
+     */
+    Q_PROPERTY(quint32 activationMode READ activationMode CONSTANT)
+
+    /**
      * Whether kiosk mode is currently active.
      */
     Q_PROPERTY(bool isKioskMode READ isKioskMode WRITE setKioskMode NOTIFY \
kioskModeChanged) @@ -286,14 +296,37 @@ public:
     bool isDemoMode() const { return m_isDemoMode; }
     void setDemoMode(const bool newMode);
 
+    QString codeKey() const { return m_codeKey; }
+    void setCodeKey(const QString newCodeKey) {
+        m_codeKey = newCodeKey;
+        emit notifyCodeKeyChanged();
+    }
+
+    /**
+     * @brief activationMode
+     * @return 0: no, 1: inapp, 2: internal
+     */
+    quint32 activationMode() const { return m_activationMode; }
+
     bool isKioskMode() const { return m_isKioskMode; }
     void setKioskMode(const bool newMode) {
         m_isKioskMode = newMode;
         emit kioskModeChanged();
     }
 
-    // Payment API
-    // Call a payment system to sync our demoMode state with it
+    /**
+     * Check validity of the activation code
+     * @param code An activation code to check
+     * @returns  0 if the code is not valid or we don't know yet
+     *           1 if the code is valid but out of date
+     *           2 if the code is valid and under 2 years
+     */
+    Q_INVOKABLE uint checkActivationCode(const QString code);
+
+    /**
+     * Check Payment API
+     * Call a payment system to sync our demoMode state with it
+     */
     void checkPayment();
     // Called by the payment system
     void bought(const bool isBought) {
@@ -352,6 +385,7 @@ protected slots:
     Q_INVOKABLE void notifyFilterLevelMinChanged();
     Q_INVOKABLE void notifyFilterLevelMaxChanged();
     Q_INVOKABLE void notifyDemoModeChanged();
+    Q_INVOKABLE void notifyCodeKeyChanged();
     Q_INVOKABLE void notifyKioskModeChanged();
     Q_INVOKABLE void notifySectionVisibleChanged();
 
@@ -413,6 +447,7 @@ signals:
     void filterLevelMinChanged();
     void filterLevelMaxChanged();
     void demoModeChanged();
+    void codeKeyChanged();
     void kioskModeChanged();
     void sectionVisibleChanged();
     void baseFontSizeChanged();
@@ -446,6 +481,8 @@ private:
     QString m_locale;
     QString m_font;
     bool m_isDemoMode;
+    QString m_codeKey;
+    quint32 m_activationMode;
     bool m_isKioskMode;
     bool m_sectionVisible;
 	int m_baseFontSize;
diff --git a/src/core/ApplicationSettingsDefault.cpp \
b/src/core/ApplicationSettingsDefault.cpp index 059d3c8..79cb7dd 100644
--- a/src/core/ApplicationSettingsDefault.cpp
+++ b/src/core/ApplicationSettingsDefault.cpp
@@ -20,13 +20,40 @@
  */
 
 #include "ApplicationSettings.h"
+#include "config.h"
 #include <QDebug>
-
 void ApplicationSettings::setDemoMode(const bool newMode) {
     m_isDemoMode = newMode;
     emit demoModeChanged();
 }
 
 void ApplicationSettings::checkPayment() {
+    if(m_activationMode == 2)
+        setDemoMode(checkActivationCode(m_codeKey) < 2);
+}
+
+uint ApplicationSettings::checkActivationCode(const QString code) {
+    if(code.length() != 12) {
+        return 0;
+    }
+    bool ok;
+    uint year = code.mid(4, 3).toUInt(&ok, 16);
+    uint month = code.mid(7, 1).toUInt(&ok, 16);
+    uint crc = code.mid(8, 4).toUInt(&ok, 16);
+
+    uint expectedCrc =
+            code.mid(0, 4).toUInt(&ok, 16) ^
+            code.mid(4, 4).toUInt(&ok, 16) ^
+            0xCECA;
+    qDebug() << expectedCrc << " " << crc;
+    ok = (expectedCrc == crc && year < 2100 && month <= 12);
+    if(!ok)
+        // Bad crc, year or month
+        return 0;
+
+    // Check date is under 2 years
+    qDebug() << year * 100 + month + 200 << " " << atoi(BUILD_DATE);
+    ok = year * 100 + month + 200 >= atoi(BUILD_DATE);
+    return(ok ? 2 : 1);
 }
 
diff --git a/src/core/BuyMeOverlay.qml b/src/core/BuyMeOverlay.qml
index 189d624..be9fa3b 100644
--- a/src/core/BuyMeOverlay.qml
+++ b/src/core/BuyMeOverlay.qml
@@ -1,4 +1,4 @@
-/* GCompris - BuyMeOverlay.qml
+/* GCompris - BuyMeOverlayInapp.qml
  *
  * Copyright (C) 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
  *
@@ -34,58 +34,48 @@ Item {
         color: "grey"
     }
     /* Activation Instruction */
-    Item {
+    Rectangle {
         id: instruction
         z: 99
         anchors {
             horizontalCenter: parent.horizontalCenter
+            horizontalCenterOffset: - cancelButton.width / 2
             top: parent.top
             topMargin: 40
         }
-        width: parent.width * 0.9
-
-        GCText {
-            id: instructionTxt
-            fontSize: mediumSize
-            color: "white"
-            style: Text.Outline
-            styleColor: "black"
-            horizontalAlignment: Text.AlignHCenter
-            width: parent.width
-            wrapMode: TextEdit.WordWrap
-            z: 2
-            text: qsTr("This activity is only available in the full version of \
                GCompris.")
-        }
+        width: parent.width - cancelButton.width * 2
+        height: instructionTxt.height
+        radius: 10
+        border.width: 2
+        border.color: "black"
+        color: 'white'
 
-        Button {
-            width: parent.width * 0.8
-            height: 60 * ApplicationInfo.ratio
+        Row {
             anchors {
-                horizontalCenter: parent.horizontalCenter
-                top: instructionTxt.bottom
-                topMargin: 10
-            }
-            text: qsTr("Buy the full version").toUpperCase()
-            style: GCButtonStyle {
+                fill: parent
+                margins: 10
             }
 
-            onClicked: {
-                if(ApplicationSettings.isDemoMode)
-                    ApplicationSettings.isDemoMode = false
+            Image {
+                id: lock
+                source: "qrc:/gcompris/src/activities/menu/resource/lock.svg"
+                sourceSize.width: 30 * ApplicationInfo.ratio
             }
-        }
 
-        Rectangle {
-            anchors.fill: instructionTxt
-            z: 1
-            opacity: 0.8
-            radius: 10
-            border.width: 2
-            border.color: "black"
-            gradient: Gradient {
-                GradientStop { position: 0.0; color: "#000" }
-                GradientStop { position: 0.9; color: "#666" }
-                GradientStop { position: 1.0; color: "#AAA" }
+            GCText {
+                id: instructionTxt
+                fontSize: mediumSize
+                color: "black"
+                style: Text.Outline
+                styleColor: "white"
+                horizontalAlignment: Text.AlignHCenter
+                width: parent.width - lock.width
+                wrapMode: TextEdit.WordWrap
+                z: 2
+                text: qsTr("This activity is only available in the full version of \
GCompris." + "<br/>" + +                           "On <a \
href='http://gcompris.net'>http://gcompris.net</a> " + +                           \
"you will find the instructions to obtain an activation code." + " " + +              \
"Then go to the main configuration dialog to enter the code.")  }
         }
     }
@@ -120,4 +110,10 @@ Item {
             home()
         }
     }
+
+    // The cancel button
+    GCButtonCancel {
+        id: cancelButton
+        onClose: home()
+    }
 }
diff --git a/src/core/BuyMeOverlay.qml b/src/core/BuyMeOverlayInapp.qml
similarity index 69%
copy from src/core/BuyMeOverlay.qml
copy to src/core/BuyMeOverlayInapp.qml
index 189d624..9c92eab 100644
--- a/src/core/BuyMeOverlay.qml
+++ b/src/core/BuyMeOverlayInapp.qml
@@ -1,4 +1,4 @@
-/* GCompris - BuyMeOverlay.qml
+/* GCompris - BuyMeOverlayInapp.qml
  *
  * Copyright (C) 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
  *
@@ -34,35 +34,54 @@ Item {
         color: "grey"
     }
     /* Activation Instruction */
-    Item {
-        id: instruction
+    Rectangle {
+        id: instructionsArea
         z: 99
         anchors {
             horizontalCenter: parent.horizontalCenter
+            horizontalCenterOffset: - cancelButton.width / 2
             top: parent.top
             topMargin: 40
         }
-        width: parent.width * 0.9
+        width: parent.width - cancelButton.width * 2
+        height: instructionTxt.height
+        radius: 10
+        border.width: 2
+        border.color: "black"
+        color: 'white'
+
+        Row {
+            anchors {
+                fill: parent
+                margins: 10
+            }
+
+            Image {
+                id: lock
+                source: "qrc:/gcompris/src/activities/menu/resource/lock.svg"
+                sourceSize.width: 30 * ApplicationInfo.ratio
+            }
 
-        GCText {
-            id: instructionTxt
-            fontSize: mediumSize
-            color: "white"
-            style: Text.Outline
-            styleColor: "black"
-            horizontalAlignment: Text.AlignHCenter
-            width: parent.width
-            wrapMode: TextEdit.WordWrap
-            z: 2
-            text: qsTr("This activity is only available in the full version of \
GCompris.") +            GCText {
+                id: instructionTxt
+                fontSize: mediumSize
+                color: "black"
+                style: Text.Outline
+                styleColor: "white"
+                horizontalAlignment: Text.AlignHCenter
+                width: parent.width - lock.width
+                wrapMode: TextEdit.WordWrap
+                z: 2
+                text: qsTr("This activity is only available in the full version of \
GCompris.") +            }
         }
 
         Button {
-            width: parent.width * 0.8
+            width: instructionsArea.width * 0.9
             height: 60 * ApplicationInfo.ratio
             anchors {
                 horizontalCenter: parent.horizontalCenter
-                top: instructionTxt.bottom
+                top: instructionsArea.bottom
                 topMargin: 10
             }
             text: qsTr("Buy the full version").toUpperCase()
@@ -74,20 +93,6 @@ Item {
                     ApplicationSettings.isDemoMode = false
             }
         }
-
-        Rectangle {
-            anchors.fill: instructionTxt
-            z: 1
-            opacity: 0.8
-            radius: 10
-            border.width: 2
-            border.color: "black"
-            gradient: Gradient {
-                GradientStop { position: 0.0; color: "#000" }
-                GradientStop { position: 0.9; color: "#666" }
-                GradientStop { position: 1.0; color: "#AAA" }
-            }
-        }
     }
 
     MultiPointTouchArea {
@@ -120,4 +125,10 @@ Item {
             home()
         }
     }
+
+    // The cancel button
+    GCButtonCancel {
+        id: cancelButton
+        onClose: home()
+    }
 }
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index adf45bf..5fe3337 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -2,10 +2,6 @@ include(qt_helper)
 
 configure_file(config.h.in "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY)
 
-if(WITH_ACTIVATION_CODE)
-  add_definitions(-DWITH_ACTIVATION_CODE)
-endif()
-
 if(WITH_KIOSK_MODE)
   add_definitions(-DWITH_KIOSK_MODE)
 endif()
@@ -196,7 +192,7 @@ if(BUILD_STANDALONE)
   install(DIRECTORY ${_qt_qml_path}/QtGraphicalEffects DESTINATION \
${_qt_qml_destdir})  
   # Fix for Linux 'make package' that fails to link with libicu
-  if(UNIX AND NOT APPLE AND NOT SAILFISHOS)
+  if(UNIX AND NOT APPLE AND NOT SAILFISHOS AND NOT ANDROID)
     add_library( libicudata SHARED IMPORTED )
     set_target_properties( libicudata PROPERTIES IMPORTED_LOCATION \
${Qt5_DIR}/../../libicudata.so.53 )  add_library( libicui18n SHARED IMPORTED )
diff --git a/src/core/GCButtonCancel.qml b/src/core/GCButtonCancel.qml
index 45bb9e8..66faa0b 100644
--- a/src/core/GCButtonCancel.qml
+++ b/src/core/GCButtonCancel.qml
@@ -35,6 +35,7 @@ Image {
     smooth: true
     sourceSize.width: 60 * ApplicationInfo.ratio
     anchors.margins: 10
+    z: 200
 
     signal close
 
diff --git a/src/core/config.h.in b/src/core/config.h.in
index 75a5e5e..94140bb 100644
--- a/src/core/config.h.in
+++ b/src/core/config.h.in
@@ -35,5 +35,9 @@
 #define COMPRESSED_AUDIO "@COMPRESSED_AUDIO@"
 /* Download Allowed */
 #define DOWNLOAD_ALLOWED "@WITH_DOWNLOAD@"
+/* Date at which GCompris has been built */
+#define BUILD_DATE "@BUILD_DATE@"
+/* Type of activation system */
+#define ACTIVATION_MODE "@ACTIVATION_MODE@"
 
 #endif // GCOMPRIS_CONFIG_H
diff --git a/tools/gencode.py b/tools/gencode.py
new file mode 100755
index 0000000..92fad2e
--- /dev/null
+++ b/tools/gencode.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+# Generate code for today
+import random
+from datetime import datetime
+
+user = int(random.random() * 0xFFFF)
+date = (datetime.now().year << 4) | datetime.now().month
+crc = user ^ date ^ 0xCECA
+print "%04X-%04X-%04X" %(user, date, crc)
+


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic