Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GCompris
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
27
Issues
27
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Education
GCompris
Commits
e506f425
Commit
e506f425
authored
Aug 04, 2020
by
Timothée Giet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
learn_digits, add option to disable voices
parent
7ee65dd5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
7 deletions
+28
-7
src/activities/learn_digits/ActivityConfig.qml
src/activities/learn_digits/ActivityConfig.qml
+18
-2
src/activities/learn_digits/Learn_digits.qml
src/activities/learn_digits/Learn_digits.qml
+6
-2
src/activities/learn_digits/learn_digits.js
src/activities/learn_digits/learn_digits.js
+4
-3
No files found.
src/activities/learn_digits/ActivityConfig.qml
View file @
e506f425
...
...
@@ -27,6 +27,8 @@ Item {
id
:
activityConfiguration
property
Item
background
property
alias
modeBox
:
modeBox
property
alias
enableVoicesBox
:
enableVoicesBox
property
bool
voicesEnabled
:
enableVoicesBox
.
checked
width
:
if
(
background
)
background
.
width
property
var
availableModes
:
[
{
"
text
"
:
qsTr
(
"
Arabic numerals
"
),
"
value
"
:
1
},
...
...
@@ -42,14 +44,26 @@ Item {
background
:
activityConfiguration
.
background
label
:
qsTr
(
"
Digits representation
"
)
}
GCDialogCheckBox
{
id
:
enableVoicesBox
text
:
qsTr
(
"
Enable voices
"
)
checked
:
voicesEnabled
}
}
property
var
dataToSave
function
setDefaultValues
()
{
// Recreate the binding
enableVoicesBox
.
checked
=
Qt
.
binding
(
function
(){
return
activityConfiguration
.
voicesEnabled
;});
if
(
dataToSave
[
"
mode
"
]
===
undefined
)
{
dataToSave
[
"
mode
"
]
=
1
;
modeBox
.
currentIndex
=
0
modeBox
.
currentIndex
=
0
;
}
if
(
dataToSave
[
"
voicesEnabled
"
]
===
undefined
)
{
dataToSave
[
"
voicesEnabled
"
]
=
"
true
"
;
enableVoicesBox
.
checked
=
true
;
}
for
(
var
i
=
0
;
i
<
availableModes
.
length
;
i
++
)
{
if
(
availableModes
[
i
].
value
==
dataToSave
[
"
mode
"
])
{
...
...
@@ -57,11 +71,13 @@ Item {
break
;
}
}
voicesEnabled
=
(
dataToSave
.
voicesEnabled
===
"
true
"
)
}
function
saveValues
()
{
var
newMode
=
availableModes
[
modeBox
.
currentIndex
].
value
;
dataToSave
=
{
"
mode
"
:
newMode
};
voicesEnabled
=
enableVoicesBox
.
checked
dataToSave
=
{
"
mode
"
:
newMode
,
"
voicesEnabled
"
:
""
+
voicesEnabled
};
}
}
src/activities/learn_digits/Learn_digits.qml
View file @
e506f425
...
...
@@ -75,6 +75,7 @@ ActivityBase {
property
bool
inputLocked
:
false
property
var
levels
:
activity
.
datasetLoader
.
data
property
int
mode
:
1
// default is arabic numerals
property
bool
voicesEnabled
:
true
property
string
imageSource
:
"
qrc:/gcompris/src/core/resource/empty.svg
"
}
property
string
locale
:
ApplicationSettings
.
locale
...
...
@@ -88,7 +89,7 @@ ActivityBase {
function
itemsVisible
()
{
iAmReady
.
visible
=
false
;
if
(
DownloadManager
.
areVoicesRegistered
()
&&
!
operationMode
)
{
if
(
DownloadManager
.
areVoicesRegistered
()
&&
!
operationMode
&&
items
.
voicesEnabled
)
{
repeatItem
.
visible
=
true
;
}
if
(
items
.
mode
===
1
)
{
...
...
@@ -434,6 +435,9 @@ ActivityBase {
if
(
activityData
&&
activityData
[
"
mode
"
])
{
items
.
mode
=
activityData
[
"
mode
"
];
}
if
(
activityData
&&
activityData
[
"
voicesEnabled
"
])
{
items
.
voicesEnabled
=
activityData
[
"
voicesEnabled
"
]
===
"
true
"
?
true
:
false
;
}
}
onSaveData
:
{
levelFolder
=
dialogActivityConfig
.
chosenLevels
...
...
@@ -442,7 +446,7 @@ ActivityBase {
}
onStartActivity
:
{
background
.
stop
();
background
.
start
()
background
.
start
()
;
}
onClose
:
home
()
...
...
src/activities/learn_digits/learn_digits.js
View file @
e506f425
...
...
@@ -34,7 +34,7 @@ var url = ""
function
start
(
items_
,
operationMode_
)
{
items
=
items_
;
operationMode
=
operationMode_
;
if
(
!
operationMode
)
if
(
!
operationMode
&&
items
.
voicesEnabled
)
Core
.
checkForVoices
(
items_
.
main
);
numberOfLevel
=
items
.
levels
.
length
;
currentLevel
=
0
;
...
...
@@ -108,7 +108,8 @@ function initQuestion() {
}
else
{
items
.
question
=
questionsArray
[
questionIndex
];
items
.
questionText
=
items
.
question
.
toString
()
playLetter
(
items
.
questionText
);
if
(
items
.
voicesEnabled
)
playLetter
(
items
.
questionText
);
}
if
(
items
.
mode
!=
1
)
{
items
.
imageSource
=
url
+
items
.
questionText
+
"
.svg
"
...
...
@@ -174,7 +175,7 @@ function processKey(event) {
items
.
circlesLine
.
itemAt
(
items
.
selectedCircle
).
clickCircle
();
}
else
if
(
event
.
key
===
Qt
.
Key_Enter
||
event
.
key
===
Qt
.
Key_Return
)
{
checkAnswer
();
}
else
if
(
event
.
key
===
Qt
.
Key_Tab
&&
!
operationMode
)
{
}
else
if
(
event
.
key
===
Qt
.
Key_Tab
&&
!
operationMode
&&
items
.
voicesEnabled
)
{
playLetter
(
items
.
question
.
toString
());
}
}
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