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
6e81d74d
Commit
6e81d74d
authored
Jan 23, 2012
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some logic for the Document description datas in the teacherbar
parent
4e6a17b6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
73 additions
and
25 deletions
+73
-25
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+0
-2
UBPersistenceManager.h
src/core/UBPersistenceManager.h
+1
-2
UBTBDocumentEditWidget.cpp
src/gui/UBTBDocumentEditWidget.cpp
+20
-2
UBTBDocumentEditWidget.h
src/gui/UBTBDocumentEditWidget.h
+3
-0
UBTBPageEditWidget.cpp
src/gui/UBTBPageEditWidget.cpp
+0
-1
UBTeacherBarDataMgr.cpp
src/gui/UBTeacherBarDataMgr.cpp
+21
-6
UBTeacherBarDataMgr.h
src/gui/UBTeacherBarDataMgr.h
+1
-1
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+24
-10
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+3
-1
No files found.
src/core/UBPersistenceManager.cpp
View file @
6e81d74d
...
@@ -1086,7 +1086,6 @@ void UBPersistenceManager::persistTeacherBar(UBDocumentProxy* pDocumentProxy, in
...
@@ -1086,7 +1086,6 @@ 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
(
"duration"
,
QString
(
"%0"
).
arg
(
infos
.
Duration
));
QString
qsAct
;
QString
qsAct
;
for
(
int
i
=
0
;
i
<
infos
.
actions
.
size
();
i
++
){
for
(
int
i
=
0
;
i
<
infos
.
actions
.
size
();
i
++
){
...
@@ -1146,7 +1145,6 @@ sTeacherBarInfos UBPersistenceManager::getTeacherBarInfos(UBDocumentProxy* pDocu
...
@@ -1146,7 +1145,6 @@ 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
.
Duration
=
teacherBarNode
.
toElement
().
attributeNode
(
"duration"
).
value
().
toInt
();
infos
.
actions
=
teacherBarNode
.
toElement
().
attributeNode
(
"actions"
).
value
().
split
(
"@"
);
infos
.
actions
=
teacherBarNode
.
toElement
().
attributeNode
(
"actions"
).
value
().
split
(
"@"
);
infos
.
medias
=
teacherBarNode
.
toElement
().
attributeNode
(
"medias"
).
value
().
split
(
"@"
);
infos
.
medias
=
teacherBarNode
.
toElement
().
attributeNode
(
"medias"
).
value
().
split
(
"@"
);
infos
.
urls
=
teacherBarNode
.
toElement
().
attributeNode
(
"links"
).
value
().
split
(
"@"
);
infos
.
urls
=
teacherBarNode
.
toElement
().
attributeNode
(
"links"
).
value
().
split
(
"@"
);
...
...
src/core/UBPersistenceManager.h
View file @
6e81d74d
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
struct
sTeacherBarInfos
struct
sTeacherBarInfos
{
{
QString
title
;
QString
title
;
int
Duration
;
QStringList
actions
;
QStringList
actions
;
QStringList
medias
;
QStringList
medias
;
QStringList
urls
;
QStringList
urls
;
...
@@ -36,7 +35,7 @@ class UBGraphicsScene;
...
@@ -36,7 +35,7 @@ class UBGraphicsScene;
class
UBPersistenceManager
:
public
QObject
class
UBPersistenceManager
:
public
QObject
{
{
Q_OBJECT
;
Q_OBJECT
private
:
private
:
UBPersistenceManager
(
QObject
*
pParent
=
0
);
UBPersistenceManager
(
QObject
*
pParent
=
0
);
...
...
src/gui/UBTBDocumentEditWidget.cpp
View file @
6e81d74d
...
@@ -63,6 +63,8 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
...
@@ -63,6 +63,8 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
connect
(
mpPageViewButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onPageView
()));
connect
(
mpPageViewButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onPageView
()));
connect
(
mpPreviewButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onPreview
()));
connect
(
mpPreviewButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onPreview
()));
connect
(
mpTitle
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
onSessionTitleChanged
()));
connect
(
mpTarget
,
SIGNAL
(
textChanged
()),
this
,
SLOT
(
onSessionTargetChanged
()));
}
}
UBTBDocumentEditWidget
::~
UBTBDocumentEditWidget
()
UBTBDocumentEditWidget
::~
UBTBDocumentEditWidget
()
...
@@ -87,12 +89,28 @@ void UBTBDocumentEditWidget::onPreview()
...
@@ -87,12 +89,28 @@ void UBTBDocumentEditWidget::onPreview()
emit
changeTBState
(
eTeacherBarState_DocumentPreview
);
emit
changeTBState
(
eTeacherBarState_DocumentPreview
);
}
}
void
UBTBDocumentEditWidget
::
updateFields
()
void
UBTBDocumentEditWidget
::
onSessionTitleChanged
()
{
{
mpDataMgr
->
setSessionTitle
(
mpTitle
->
text
());
emit
valueChanged
();
}
void
UBTBDocumentEditWidget
::
onSessionTargetChanged
()
{
mpDataMgr
->
setSessionTarget
(
mpTarget
->
document
()
->
toPlainText
());
emit
valueChanged
();
}
}
void
UBTBDocumentEditWidget
::
clear
Fields
()
void
UBTBDocumentEditWidget
::
update
Fields
()
{
{
mpTitle
->
setText
(
mpDataMgr
->
sessionTitle
());
mpTarget
->
setPlainText
(
mpDataMgr
->
sessionTarget
());
}
void
UBTBDocumentEditWidget
::
clearFields
()
{
mpTitle
->
setText
(
""
);
mpTarget
->
setPlainText
(
""
);
}
}
src/gui/UBTBDocumentEditWidget.h
View file @
6e81d74d
...
@@ -20,10 +20,13 @@ public:
...
@@ -20,10 +20,13 @@ public:
signals
:
signals
:
void
changeTBState
(
eTeacherBarState
state
);
void
changeTBState
(
eTeacherBarState
state
);
void
valueChanged
();
private
slots
:
private
slots
:
void
onPageView
();
void
onPageView
();
void
onPreview
();
void
onPreview
();
void
onSessionTitleChanged
();
void
onSessionTargetChanged
();
private
:
private
:
QVBoxLayout
mLayout
;
QVBoxLayout
mLayout
;
...
...
src/gui/UBTBPageEditWidget.cpp
View file @
6e81d74d
...
@@ -42,7 +42,6 @@ UBTBPageEditWidget::UBTBPageEditWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *p
...
@@ -42,7 +42,6 @@ UBTBPageEditWidget::UBTBPageEditWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *p
mpTitleLabel
=
new
QLabel
(
tr
(
"Title"
),
mpContainer
);
mpTitleLabel
=
new
QLabel
(
tr
(
"Title"
),
mpContainer
);
mpTitle
=
new
QLineEdit
(
mpContainer
);
mpTitle
=
new
QLineEdit
(
mpContainer
);
mpTitle
->
setObjectName
(
"DockPaletteWidgetLineEdit"
);
mpTitle
->
setObjectName
(
"DockPaletteWidgetLineEdit"
);
connect
(
mpTitle
,
SIGNAL
(
textChanged
(
const
QString
&
)),
this
,
SLOT
(
onTitleTextChanged
(
const
QString
&
)));
mContainerLayout
.
addWidget
(
mpTitleLabel
,
0
);
mContainerLayout
.
addWidget
(
mpTitleLabel
,
0
);
mContainerLayout
.
addWidget
(
mpTitle
,
0
);
mContainerLayout
.
addWidget
(
mpTitle
,
0
);
...
...
src/gui/UBTeacherBarDataMgr.cpp
View file @
6e81d74d
...
@@ -20,6 +20,7 @@ void UBTeacherBarDataMgr::clearLists()
...
@@ -20,6 +20,7 @@ void UBTeacherBarDataMgr::clearLists()
mActionList
.
clear
();
mActionList
.
clear
();
mUrlList
.
clear
();
mUrlList
.
clear
();
mMediaList
.
clear
();
mMediaList
.
clear
();
mMediaUrls
.
clear
();
}
}
void
UBTeacherBarDataMgr
::
saveContent
()
void
UBTeacherBarDataMgr
::
saveContent
()
...
@@ -27,40 +28,49 @@ void UBTeacherBarDataMgr::saveContent()
...
@@ -27,40 +28,49 @@ void UBTeacherBarDataMgr::saveContent()
// Store the page information in the UBZ
// Store the page information in the UBZ
sTeacherBarInfos
infos
;
sTeacherBarInfos
infos
;
// Page Title
infos
.
title
=
mPageTitle
;
infos
.
title
=
mPageTitle
;
// Actions
// Actions
foreach
(
sAction
action
,
mActionList
){
foreach
(
sAction
action
,
mActionList
){
infos
.
actions
<<
QString
(
"%0;%1"
).
arg
(
action
.
type
).
arg
(
action
.
content
);
infos
.
actions
<<
QString
(
"%0;%1"
).
arg
(
action
.
type
).
arg
(
action
.
content
);
}
}
// Media
// Media
foreach
(
QString
media
,
mMediaUrls
){
foreach
(
QString
media
,
mMediaUrls
){
infos
.
medias
<<
media
;
infos
.
medias
<<
media
;
}
}
// Links
// Links
foreach
(
sLink
link
,
mUrlList
){
foreach
(
sLink
link
,
mUrlList
){
if
(
""
!=
link
.
title
&&
""
!=
link
.
link
){
if
(
""
!=
link
.
title
&&
""
!=
link
.
link
){
infos
.
urls
<<
QString
(
"%0;%1"
).
arg
(
link
.
title
).
arg
(
link
.
link
);
infos
.
urls
<<
QString
(
"%0;%1"
).
arg
(
link
.
title
).
arg
(
link
.
link
);
}
}
}
}
// Comments
// Comments
infos
.
comments
=
mComments
;
infos
.
comments
=
mComments
;
UBPersistenceManager
::
persistenceManager
()
->
persistTeacherBar
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
(),
infos
);
UBPersistenceManager
::
persistenceManager
()
->
persistTeacherBar
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
(),
infos
);
// TODO: Store the document metadata somewhere
// TODO: Store the document metadata somewhere
// Session Title
//... = mSessionTitle;
// Session Target
//... = mSessionTarget;
}
}
void
UBTeacherBarDataMgr
::
loadContent
()
void
UBTeacherBarDataMgr
::
loadContent
(
bool
docChanged
)
{
{
clearLists
();
clearLists
();
sTeacherBarInfos
nextInfos
=
UBPersistenceManager
::
persistenceManager
()
->
getTeacherBarInfos
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
());
sTeacherBarInfos
nextInfos
=
UBPersistenceManager
::
persistenceManager
()
->
getTeacherBarInfos
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
());
if
(
docChanged
){
// TODO: Read these information from the metadata file
// Session Title
//mSessionTitle = ...;
// Session Target
//mSessionTarget = ...;
}
// Page Title
// Page Title
mPageTitle
=
nextInfos
.
title
;
mPageTitle
=
nextInfos
.
title
;
// Actions
// Actions
...
@@ -74,7 +84,12 @@ void UBTeacherBarDataMgr::loadContent()
...
@@ -74,7 +84,12 @@ void UBTeacherBarDataMgr::loadContent()
}
}
}
}
// Media URL
// Media URL
mMediaUrls
=
nextInfos
.
medias
;
if
((
nextInfos
.
medias
.
size
()
==
1
)
&&
(
nextInfos
.
medias
.
at
(
0
)
==
""
)){
// Do not retrieve it
}
else
{
mMediaUrls
=
nextInfos
.
medias
;
}
// Links
// Links
foreach
(
QString
eachUrl
,
nextInfos
.
urls
){
foreach
(
QString
eachUrl
,
nextInfos
.
urls
){
...
...
src/gui/UBTeacherBarDataMgr.h
View file @
6e81d74d
...
@@ -68,7 +68,7 @@ public:
...
@@ -68,7 +68,7 @@ public:
// Others
// Others
void
clearLists
();
void
clearLists
();
void
saveContent
();
void
saveContent
();
void
loadContent
();
void
loadContent
(
bool
docChanged
=
false
);
private
:
private
:
QString
mSessionTitle
;
QString
mSessionTitle
;
...
...
src/gui/UBTeacherBarWidget.cpp
View file @
6e81d74d
...
@@ -52,14 +52,16 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
...
@@ -52,14 +52,16 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
mpStackWidget
->
addWidget
(
mpDocEditWidget
);
mpStackWidget
->
addWidget
(
mpDocEditWidget
);
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneWillChange
()),
this
,
SLOT
(
saveContent
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneWillChange
()),
this
,
SLOT
(
saveContent
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
this
,
SLOT
(
loadContent
()));
connect
(
UBApplication
::
mainWindow
->
actionQuit
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
saveContent
()));
connect
(
UBApplication
::
mainWindow
->
actionQuit
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
saveContent
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
this
,
SLOT
(
loadContentInfos
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeDocumentChanged
()),
this
,
SLOT
(
onActiveDocumentChanged
()));
connect
(
mpPreview
,
SIGNAL
(
showEditMode
()),
this
,
SLOT
(
onShowEditMode
()));
connect
(
mpPreview
,
SIGNAL
(
showEditMode
()),
this
,
SLOT
(
onShowEditMode
()));
connect
(
mpDocPreviewWidget
,
SIGNAL
(
changeTBState
(
eTeacherBarState
)),
this
,
SLOT
(
onTBStateChanged
(
eTeacherBarState
)));
connect
(
mpDocPreviewWidget
,
SIGNAL
(
changeTBState
(
eTeacherBarState
)),
this
,
SLOT
(
onTBStateChanged
(
eTeacherBarState
)));
connect
(
mpDocEditWidget
,
SIGNAL
(
changeTBState
(
eTeacherBarState
)),
this
,
SLOT
(
onTBStateChanged
(
eTeacherBarState
)));
connect
(
mpDocEditWidget
,
SIGNAL
(
changeTBState
(
eTeacherBarState
)),
this
,
SLOT
(
onTBStateChanged
(
eTeacherBarState
)));
connect
(
mpPageEditWidget
,
SIGNAL
(
changeTBState
(
eTeacherBarState
)),
this
,
SLOT
(
onTBStateChanged
(
eTeacherBarState
)));
connect
(
mpPageEditWidget
,
SIGNAL
(
changeTBState
(
eTeacherBarState
)),
this
,
SLOT
(
onTBStateChanged
(
eTeacherBarState
)));
connect
(
mpPageEditWidget
,
SIGNAL
(
valueChanged
()),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpPageEditWidget
,
SIGNAL
(
valueChanged
()),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpDocEditWidget
,
SIGNAL
(
valueChanged
()),
this
,
SLOT
(
onValueChanged
()));
}
}
UBTeacherBarWidget
::~
UBTeacherBarWidget
()
UBTeacherBarWidget
::~
UBTeacherBarWidget
()
...
@@ -71,6 +73,11 @@ UBTeacherBarWidget::~UBTeacherBarWidget()
...
@@ -71,6 +73,11 @@ UBTeacherBarWidget::~UBTeacherBarWidget()
DELETEPTR
(
mpStackWidget
);
DELETEPTR
(
mpStackWidget
);
}
}
void
UBTeacherBarWidget
::
onActiveDocumentChanged
()
{
loadContent
(
true
);
}
void
UBTeacherBarWidget
::
onValueChanged
()
void
UBTeacherBarWidget
::
onValueChanged
()
{
{
if
(
isEmpty
())
if
(
isEmpty
())
...
@@ -93,22 +100,31 @@ void UBTeacherBarWidget::saveContent()
...
@@ -93,22 +100,31 @@ void UBTeacherBarWidget::saveContent()
mData
.
saveContent
();
mData
.
saveContent
();
}
}
void
UBTeacherBarWidget
::
loadContent
()
void
UBTeacherBarWidget
::
loadContentInfos
()
{
loadContent
(
false
);
}
void
UBTeacherBarWidget
::
loadContent
(
bool
docChanged
)
{
{
// Clear the old datas
// Clear the old datas
mpPageEditWidget
->
clearFields
();
mpPageEditWidget
->
clearFields
();
mpPreview
->
clearFields
();
mpPreview
->
clearFields
();
mpDocEditWidget
->
clearFields
();
if
(
docChanged
){
mpDocPreviewWidget
->
clearFields
();
mpDocEditWidget
->
clearFields
();
mpDocPreviewWidget
->
clearFields
();
}
// Update the datas
// Update the datas
mData
.
loadContent
();
mData
.
loadContent
(
docChanged
);
// Update the fields
// Update the fields
mpPageEditWidget
->
updateFields
();
mpPageEditWidget
->
updateFields
();
mpPreview
->
updateFields
();
mpPreview
->
updateFields
();
mpDocEditWidget
->
updateFields
();
if
(
docChanged
){
mpDocPreviewWidget
->
updateFields
();
mpDocEditWidget
->
updateFields
();
mpDocPreviewWidget
->
updateFields
();
}
if
(
!
isEmpty
()){
if
(
!
isEmpty
()){
onTBStateChanged
(
eTeacherBarState_PagePreview
);
onTBStateChanged
(
eTeacherBarState_PagePreview
);
...
@@ -127,9 +143,7 @@ bool UBTeacherBarWidget::isEmpty()
...
@@ -127,9 +143,7 @@ bool UBTeacherBarWidget::isEmpty()
mData
.
urls
()
->
empty
()
&&
mData
.
urls
()
->
empty
()
&&
mData
.
actions
()
->
empty
()
&&
mData
.
actions
()
->
empty
()
&&
mData
.
medias
()
->
empty
()
&&
mData
.
medias
()
->
empty
()
&&
mData
.
comments
()
==
""
&&
mData
.
comments
()
==
""
;
mData
.
sessionTarget
()
==
""
&&
mData
.
sessionTitle
()
==
""
;
}
}
void
UBTeacherBarWidget
::
onShowEditMode
()
void
UBTeacherBarWidget
::
onShowEditMode
()
...
...
src/gui/UBTeacherBarWidget.h
View file @
6e81d74d
...
@@ -34,12 +34,14 @@ public:
...
@@ -34,12 +34,14 @@ public:
private
slots
:
private
slots
:
void
saveContent
();
void
saveContent
();
void
loadContent
();
void
loadContent
Infos
();
void
onValueChanged
();
void
onValueChanged
();
void
onShowEditMode
();
void
onShowEditMode
();
void
onTBStateChanged
(
eTeacherBarState
state
);
void
onTBStateChanged
(
eTeacherBarState
state
);
void
onActiveDocumentChanged
();
private
:
private
:
void
loadContent
(
bool
docChanged
=
false
);
bool
isEmpty
();
bool
isEmpty
();
QVBoxLayout
mLayout
;
QVBoxLayout
mLayout
;
...
...
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