-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question and answer activity #230
Open
amitsagtani97
wants to merge
2
commits into
gcompris:master
Choose a base branch
from
amitsagtani97:question_and_answer_activity
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,7 @@ paintings | |
penalty | ||
photo_hunter | ||
planegame | ||
question_and_answer | ||
railroad | ||
readingh | ||
readingv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* GCompris - ActivityInfo.qml | ||
* | ||
* Copyright (C) 2018 Amit Sagtani <[email protected]> | ||
* | ||
* 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 GCompris 1.0 | ||
|
||
ActivityInfo { | ||
name: "question_and_answer/Question_and_answer.qml" | ||
difficulty: 3 | ||
icon: "question_and_answer/question_and_answer.svg" | ||
author: "Amit Sagtani <[email protected]>" | ||
demo: true | ||
//: Activity title | ||
title: "Question_and_answer activity" | ||
//: Help title | ||
description: "" | ||
//intro: "put here in comment the text for the intro voice" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to be updated |
||
//: Help goal | ||
goal: "" | ||
//: Help prerequisite | ||
prerequisite: "" | ||
//: Help manual | ||
manual: "" | ||
credit: "" | ||
section: "fun" | ||
createdInVersion: 9500 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GCOMPRIS_ADD_RCC(activities/question_and_answer *.qml *.svg *.js resource/*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
/* GCompris - MenuScreen.qml | ||
* | ||
* Copyright (C) Amit Sagtani <[email protected]> | ||
* | ||
* Authors: | ||
* Pascal Georges ([email protected]) (GTK+ version) | ||
* Holger Kaelberer <[email protected]> (Qt Quick port of imageid) | ||
* Siddhesh suthar <[email protected]> (Qt Quick port) | ||
* Bruno Coudoin <[email protected]> (Integration Lang dataset) | ||
* | ||
* 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.6 | ||
import GCompris 1.0 | ||
import QtGraphicalEffects 1.0 | ||
import QtQuick.Controls 1.5 | ||
|
||
import "../../core" | ||
import "question_and_answer.js" as Activity | ||
|
||
Image { | ||
id: menuScreen | ||
anchors.fill: parent | ||
fillMode: Image.Tile | ||
source: "qrc:/gcompris/src/activities/digital_electricity/resource/texture02.png" //"qrc:/gcompris/src/activities/algebra_by/resource/background.svg" | ||
sourceSize.width: Math.max(parent.width, parent.height) | ||
opacity: 0 | ||
|
||
property alias menuModel: menuModel | ||
//property alias iAmReady: iAmReady | ||
property bool keyboardMode: false | ||
property bool started: opacity == 1 | ||
|
||
Behavior on opacity { PropertyAnimation { duration: 200 } } | ||
|
||
visible: opacity != 0 | ||
|
||
function start() { | ||
focus = true | ||
forceActiveFocus() | ||
menuGrid.currentIndex = 0 | ||
opacity = 1 | ||
} | ||
|
||
function stop() { | ||
focus = false | ||
opacity = 0 | ||
} | ||
|
||
Keys.onEscapePressed: { | ||
home() | ||
} | ||
|
||
//Keys.enabled : (items.mode == "expert") ? false : true | ||
Keys.onPressed: { | ||
if(event.key === Qt.Key_Space) { | ||
menuGrid.currentItem.selectCurrentItem() | ||
event.accepted = true | ||
} | ||
if(event.key === Qt.Key_Enter) { | ||
menuGrid.currentItem.selectCurrentItem() | ||
event.accepted = true | ||
} | ||
if(event.key === Qt.Key_Return) { | ||
menuGrid.currentItem.selectCurrentItem() | ||
event.accepted = true | ||
} | ||
if(event.key === Qt.Key_Left) { | ||
menuGrid.moveCurrentIndexLeft() | ||
event.accepted = true | ||
} | ||
if(event.key === Qt.Key_Right) { | ||
menuGrid.moveCurrentIndexRight() | ||
event.accepted = true | ||
} | ||
if(event.key === Qt.Key_Up) { | ||
menuGrid.moveCurrentIndexUp() | ||
event.accepted = true | ||
} | ||
if(event.key === Qt.Key_Down) { | ||
menuGrid.moveCurrentIndexDown() | ||
event.accepted = true | ||
} | ||
} | ||
|
||
Keys.onReleased: { | ||
keyboardMode = true | ||
event.accepted = false | ||
} | ||
|
||
// sections | ||
property int iconWidth: 180 * ApplicationInfo.ratio | ||
property int iconHeight: 180 * ApplicationInfo.ratio | ||
|
||
property int levelCellWidth: background.width / Math.floor(background.width / iconWidth ) | ||
property int levelCellHeight: iconHeight * 1.2 | ||
|
||
ListModel { | ||
id: menuModel | ||
} | ||
|
||
GridView { | ||
id: menuGrid | ||
anchors { | ||
fill: parent | ||
bottomMargin: bar.height | ||
} | ||
cellWidth: levelCellWidth | ||
cellHeight: levelCellHeight | ||
clip: true | ||
model: menuModel | ||
keyNavigationWraps: true | ||
property int spacing: 10 | ||
|
||
delegate: Item { | ||
id: delegateItem | ||
width: levelCellWidth - menuGrid.spacing | ||
height: levelCellHeight - menuGrid.spacing | ||
property string sectionName: name | ||
opacity: 1 | ||
|
||
Rectangle { | ||
id: activityBackground | ||
width: levelCellWidth - menuGrid.spacing | ||
height: levelCellHeight - menuGrid.spacing | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
color: "white" | ||
opacity: 0.5 | ||
} | ||
|
||
Image { | ||
id: containerImage | ||
source: image | ||
anchors.top: activityBackground.top | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
height: activityBackground.height*0.8 - 6 | ||
width: height | ||
anchors.margins: 5 | ||
sourceSize.height: height | ||
fillMode: Image.PreserveAspectCrop | ||
clip: true | ||
} | ||
|
||
GCText { | ||
id: categoryName | ||
anchors.top: containerImage.bottom | ||
horizontalAlignment: Text.AlignHCenter | ||
verticalAlignment: Text.AlignVCenter | ||
width: activityBackground.width | ||
height: activityBackground.height*0.2 - 6 | ||
fontSizeMode: Text.Fit | ||
elide: Text.ElideRight | ||
maximumLineCount: 2 | ||
wrapMode: Text.WordWrap | ||
text: name | ||
opacity: 1 //(items.mode == "expert") ? 0 : 1 | ||
} | ||
|
||
ParticleSystemStarLoader { | ||
id: particles | ||
anchors.fill: activityBackground | ||
} | ||
MouseArea { | ||
anchors.fill: activityBackground | ||
enabled: menuScreen.started | ||
onClicked: selectCurrentItem() | ||
} | ||
|
||
function selectCurrentItem() { | ||
particles.burst(50) | ||
console.log(name) | ||
Activity.initializeSubActivity(index) | ||
menuScreen.stop() | ||
} | ||
|
||
} //delegate close | ||
|
||
highlight: Rectangle { | ||
width: levelCellWidth - menuGrid.spacing | ||
height: levelCellHeight - menuGrid.spacing | ||
color: "#AA41AAC4" | ||
border.width: 3 | ||
border.color: "black" | ||
visible: true | ||
Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } } | ||
Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } } | ||
} | ||
|
||
Rectangle { | ||
id: menusMask | ||
visible: false | ||
anchors.fill: menuGrid | ||
gradient: Gradient { | ||
GradientStop { position: 0.0; color: "#FFFFFFFF" } | ||
GradientStop { position: 0.92; color: "#FFFFFFFF" } | ||
GradientStop { position: 0.96; color: "#00FFFFFF" } | ||
} | ||
} | ||
|
||
layer.enabled: ApplicationInfo.useOpenGL | ||
layer.effect: OpacityMask { | ||
id: activitiesOpacity | ||
source: menuGrid | ||
maskSource: menusMask | ||
anchors.fill: menuGrid | ||
} | ||
} // grid view close | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no underscore in title, use a real name (that will be displayed on screen)