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
ca29e0d5
Commit
ca29e0d5
authored
Jan 05, 2012
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the ability to save the values of the teacher bar in the UBZ file
parent
0fb7cad9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
128 additions
and
29 deletions
+128
-29
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+34
-19
UBPersistenceManager.h
src/core/UBPersistenceManager.h
+4
-9
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+87
-1
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+3
-0
No files found.
src/core/UBPersistenceManager.cpp
View file @
ca29e0d5
...
@@ -1086,16 +1086,36 @@ void UBPersistenceManager::persistTeacherBar(UBDocumentProxy* pDocumentProxy, in
...
@@ -1086,16 +1086,36 @@ void UBPersistenceManager::persistTeacherBar(UBDocumentProxy* pDocumentProxy, in
// Set the <teacherBar> element values
// Set the <teacherBar> element values
QDomElement
teacherBarElem
=
teacherBarNode
.
toElement
();
QDomElement
teacherBarElem
=
teacherBarNode
.
toElement
();
teacherBarElem
.
setAttribute
(
"title"
,
infos
.
title
);
teacherBarElem
.
setAttribute
(
"title"
,
infos
.
title
);
teacherBarElem
.
setAttribute
(
"phasis"
,
infos
.
phasis
);
teacherBarElem
.
setAttribute
(
"duration"
,
QString
(
"%0"
).
arg
(
infos
.
Duration
));
teacherBarElem
.
setAttribute
(
"duration"
,
infos
.
Duration
);
teacherBarElem
.
setAttribute
(
"equipment"
,
infos
.
material
);
QString
qsAct
;
teacherBarElem
.
setAttribute
(
"activity"
,
infos
.
activity
);
for
(
int
i
=
0
;
i
<
infos
.
actions
.
size
();
i
++
){
teacherBarElem
.
setAttribute
(
"action1Teacher"
,
infos
.
action1Master
);
if
(
0
!=
i
){
teacherBarElem
.
setAttribute
(
"action1Student"
,
infos
.
action1Student
);
qsAct
.
append
(
'@'
);
teacherBarElem
.
setAttribute
(
"action2Teacher"
,
infos
.
action2Master
);
}
teacherBarElem
.
setAttribute
(
"action2Student"
,
infos
.
action2Student
);
qsAct
.
append
(
infos
.
actions
.
at
(
i
));
teacherBarElem
.
setAttribute
(
"action3Teacher"
,
infos
.
action3Master
);
}
teacherBarElem
.
setAttribute
(
"action3Student"
,
infos
.
action3Student
);
teacherBarElem
.
setAttribute
(
"actions"
,
qsAct
);
QString
qsMedias
;
for
(
int
j
=
0
;
j
<
infos
.
medias
.
size
();
j
++
){
if
(
0
!=
j
){
qsMedias
.
append
(
'@'
);
}
qsMedias
.
append
(
infos
.
medias
.
at
(
j
));
}
teacherBarElem
.
setAttribute
(
"medias"
,
qsMedias
);
QString
qsUrls
;
for
(
int
k
=
0
;
k
<
infos
.
urls
.
size
();
k
++
){
if
(
0
!=
k
){
qsUrls
.
append
(
'@'
);
}
qsUrls
.
append
(
infos
.
urls
.
at
(
k
));
}
teacherBarElem
.
setAttribute
(
"links"
,
qsUrls
);
teacherBarElem
.
setAttribute
(
"comments"
,
infos
.
comments
);
// Save the file
// Save the file
f
.
write
(
domDoc
.
toString
().
toAscii
());
f
.
write
(
domDoc
.
toString
().
toAscii
());
...
@@ -1126,16 +1146,11 @@ sTeacherBarInfos UBPersistenceManager::getTeacherBarInfos(UBDocumentProxy* pDocu
...
@@ -1126,16 +1146,11 @@ sTeacherBarInfos UBPersistenceManager::getTeacherBarInfos(UBDocumentProxy* pDocu
QDomNode
teacherBarNode
=
rootElem
.
namedItem
(
"teacherBar"
);
QDomNode
teacherBarNode
=
rootElem
.
namedItem
(
"teacherBar"
);
infos
.
title
=
teacherBarNode
.
toElement
().
attributeNode
(
"title"
).
value
();
infos
.
title
=
teacherBarNode
.
toElement
().
attributeNode
(
"title"
).
value
();
infos
.
phasis
=
teacherBarNode
.
toElement
().
attributeNode
(
"phasis"
).
value
().
toInt
();
infos
.
Duration
=
teacherBarNode
.
toElement
().
attributeNode
(
"duration"
).
value
().
toInt
();
infos
.
Duration
=
teacherBarNode
.
toElement
().
attributeNode
(
"duration"
).
value
().
toInt
();
infos
.
material
=
teacherBarNode
.
toElement
().
attributeNode
(
"equipment"
).
value
();
infos
.
actions
=
teacherBarNode
.
toElement
().
attributeNode
(
"actions"
).
value
().
split
(
"@"
);
infos
.
activity
=
teacherBarNode
.
toElement
().
attributeNode
(
"activity"
).
value
().
toInt
();
infos
.
medias
=
teacherBarNode
.
toElement
().
attributeNode
(
"medias"
).
value
().
split
(
"@"
);
infos
.
action1Master
=
teacherBarNode
.
toElement
().
attributeNode
(
"action1Teacher"
).
value
();
infos
.
urls
=
teacherBarNode
.
toElement
().
attributeNode
(
"links"
).
value
().
split
(
"@"
);
infos
.
action1Student
=
teacherBarNode
.
toElement
().
attributeNode
(
"action1Student"
).
value
();
infos
.
comments
=
teacherBarNode
.
toElement
().
attributeNode
(
"comments"
).
value
();
infos
.
action2Master
=
teacherBarNode
.
toElement
().
attributeNode
(
"action2Teacher"
).
value
();
infos
.
action2Student
=
teacherBarNode
.
toElement
().
attributeNode
(
"action2Student"
).
value
();
infos
.
action3Master
=
teacherBarNode
.
toElement
().
attributeNode
(
"action3Teacher"
).
value
();
infos
.
action3Student
=
teacherBarNode
.
toElement
().
attributeNode
(
"action3Student"
).
value
();
}
}
f
.
close
();
f
.
close
();
}
}
...
...
src/core/UBPersistenceManager.h
View file @
ca29e0d5
...
@@ -23,16 +23,11 @@
...
@@ -23,16 +23,11 @@
struct
sTeacherBarInfos
struct
sTeacherBarInfos
{
{
QString
title
;
QString
title
;
int
phasis
;
int
Duration
;
int
Duration
;
QString
material
;
QStringList
actions
;
int
activity
;
QStringList
medias
;
QString
action1Master
;
QStringList
urls
;
QString
action1Student
;
QString
comments
;
QString
action2Master
;
QString
action2Student
;
QString
action3Master
;
QString
action3Student
;
};
};
class
UBDocument
;
class
UBDocument
;
...
...
src/gui/UBTeacherBarWidget.cpp
View file @
ca29e0d5
...
@@ -266,14 +266,79 @@ void UBTeacherBarWidget::onValueChanged()
...
@@ -266,14 +266,79 @@ void UBTeacherBarWidget::onValueChanged()
void
UBTeacherBarWidget
::
saveContent
()
void
UBTeacherBarWidget
::
saveContent
()
{
{
sTeacherBarInfos
infos
;
sTeacherBarInfos
infos
;
// Title
infos
.
title
=
mpTitle
->
text
();
infos
.
title
=
mpTitle
->
text
();
// Duration
if
(
mpDuration1
->
isChecked
()){
infos
.
Duration
=
0
;
}
else
if
(
mpDuration2
->
isChecked
()){
infos
.
Duration
=
1
;
}
else
{
infos
.
Duration
=
2
;
}
// Actions
for
(
int
i
=
0
;
i
<
mActionList
.
size
();
i
++
){
infos
.
actions
<<
QString
(
"%0;%1"
).
arg
(
mActionList
.
at
(
i
)
->
comboValue
()).
arg
(
mActionList
.
at
(
i
)
->
text
());
}
// Media
// TODO : Get the url of the dropped medias and store them in infos.medias
// Links
for
(
int
j
=
0
;
j
<
mUrlList
.
size
();
j
++
){
if
(
""
!=
mUrlList
.
at
(
j
)
->
url
()){
infos
.
urls
<<
mUrlList
.
at
(
j
)
->
url
();
}
}
// Comments
infos
.
comments
=
mpComments
->
document
()
->
toPlainText
();
UBPersistenceManager
::
persistenceManager
()
->
persistTeacherBar
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
(),
infos
);
UBPersistenceManager
::
persistenceManager
()
->
persistTeacherBar
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
(),
infos
);
}
}
void
UBTeacherBarWidget
::
loadContent
()
void
UBTeacherBarWidget
::
loadContent
()
{
{
sTeacherBarInfos
nextInfos
=
UBPersistenceManager
::
persistenceManager
()
->
getTeacherBarInfos
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
());
sTeacherBarInfos
nextInfos
=
UBPersistenceManager
::
persistenceManager
()
->
getTeacherBarInfos
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
());
// Title
mpTitle
->
setText
(
nextInfos
.
title
);
mpTitle
->
setText
(
nextInfos
.
title
);
// Duration
switch
(
nextInfos
.
Duration
){
case
0
:
mpDuration1
->
setChecked
(
true
);
break
;
case
1
:
mpDuration2
->
setChecked
(
true
);
break
;
case
2
:
mpDuration3
->
setChecked
(
true
);
break
;
default
:
mpDuration1
->
setChecked
(
true
);
break
;
}
// Actions
for
(
int
i
=
0
;
i
<
nextInfos
.
actions
.
size
();
i
++
){
QStringList
qslAction
=
nextInfos
.
actions
.
at
(
i
).
split
(
";"
);
if
(
qslAction
.
size
()
>=
2
){
UBTeacherStudentAction
*
pAction
=
new
UBTeacherStudentAction
(
this
);
pAction
->
setComboValue
(
qslAction
.
at
(
0
).
toInt
());
pAction
->
setText
(
qslAction
.
at
(
1
));
mActionList
<<
pAction
;
mpActions
->
addWidget
(
pAction
);
}
}
// Media
// TODO : Add the media items here
// Links
for
(
int
j
=
0
;
j
<
nextInfos
.
urls
.
size
();
j
++
){
QString
qsUrl
=
nextInfos
.
urls
.
at
(
j
);
if
(
""
!=
qsUrl
){
UBUrlWidget
*
pLink
=
new
UBUrlWidget
(
this
);
pLink
->
setUrl
(
qsUrl
);
mUrlList
<<
pLink
;
mpLinks
->
addWidget
(
pLink
);
}
}
// Comments
if
(
NULL
!=
mpComments
){
mpComments
->
document
()
->
setPlainText
(
nextInfos
.
comments
);
}
}
}
void
UBTeacherBarWidget
::
onTitleTextChanged
(
const
QString
&
text
)
void
UBTeacherBarWidget
::
onTitleTextChanged
(
const
QString
&
text
)
...
@@ -365,12 +430,26 @@ QString UBTeacherStudentAction::comboValue()
...
@@ -365,12 +430,26 @@ QString UBTeacherStudentAction::comboValue()
QString
str
;
QString
str
;
if
(
NULL
!=
mpCombo
){
if
(
NULL
!=
mpCombo
){
str
=
mpCombo
->
currentText
(
);
str
=
QString
(
"%0"
).
arg
(
mpCombo
->
currentIndex
()
);
}
}
return
str
;
return
str
;
}
}
void
UBTeacherStudentAction
::
setComboValue
(
int
value
)
{
if
(
NULL
!=
mpCombo
){
mpCombo
->
setCurrentIndex
(
value
);
}
}
void
UBTeacherStudentAction
::
setText
(
const
QString
&
text
)
{
if
(
NULL
!=
mpText
){
mpText
->
document
()
->
setPlainText
(
text
);
}
}
// ---------------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
UBTeacherBarDropMediaZone
::
UBTeacherBarDropMediaZone
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
UBTeacherBarDropMediaZone
::
UBTeacherBarDropMediaZone
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
...
@@ -507,3 +586,10 @@ QString UBUrlWidget::url()
...
@@ -507,3 +586,10 @@ QString UBUrlWidget::url()
return
str
;
return
str
;
}
}
void
UBUrlWidget
::
setUrl
(
const
QString
&
url
)
{
if
(
NULL
!=
mpUrl
){
mpUrl
->
setText
(
url
);
}
}
src/gui/UBTeacherBarWidget.h
View file @
ca29e0d5
...
@@ -29,6 +29,8 @@ public:
...
@@ -29,6 +29,8 @@ public:
~
UBTeacherStudentAction
();
~
UBTeacherStudentAction
();
QString
comboValue
();
QString
comboValue
();
QString
text
();
QString
text
();
void
setComboValue
(
int
value
);
void
setText
(
const
QString
&
text
);
private
:
private
:
QTextEdit
*
mpText
;
QTextEdit
*
mpText
;
...
@@ -67,6 +69,7 @@ public:
...
@@ -67,6 +69,7 @@ public:
~
UBUrlWidget
();
~
UBUrlWidget
();
QString
url
();
QString
url
();
void
setUrl
(
const
QString
&
url
);
private
:
private
:
QHBoxLayout
*
mpLayout
;
QHBoxLayout
*
mpLayout
;
...
...
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