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
191e21ee
Commit
191e21ee
authored
Oct 19, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding the teacher bar widget
parent
68ffb3f5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
174 additions
and
6 deletions
+174
-6
UBBoardController.cpp
src/board/UBBoardController.cpp
+0
-1
UBBoardController.h
src/board/UBBoardController.h
+1
-0
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+1
-1
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+86
-3
UBPersistenceManager.h
src/core/UBPersistenceManager.h
+19
-0
UBDocumentNavigator.cpp
src/gui/UBDocumentNavigator.cpp
+6
-1
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+54
-0
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+7
-0
No files found.
src/board/UBBoardController.cpp
View file @
191e21ee
...
@@ -1981,4 +1981,3 @@ void UBBoardController::notifyPageChanged()
...
@@ -1981,4 +1981,3 @@ void UBBoardController::notifyPageChanged()
}
}
src/board/UBBoardController.h
View file @
191e21ee
...
@@ -263,6 +263,7 @@ class UBBoardController : public QObject
...
@@ -263,6 +263,7 @@ class UBBoardController : public QObject
void
pageChanged
();
void
pageChanged
();
void
setDocOnPageNavigator
(
UBDocumentProxy
*
doc
);
void
setDocOnPageNavigator
(
UBDocumentProxy
*
doc
);
void
documentReorganized
(
int
index
);
void
documentReorganized
(
int
index
);
void
pageWillChange
(
int
page
,
int
nextPage
);
protected
:
protected
:
...
...
src/board/UBBoardPaletteManager.cpp
View file @
191e21ee
...
@@ -164,7 +164,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
...
@@ -164,7 +164,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mRightPalette
->
addTabWidget
(
mpLibWidget
);
mRightPalette
->
addTabWidget
(
mpLibWidget
);
mRightPalette
->
registerWidget
(
mpTeacherBarWidget
);
mRightPalette
->
registerWidget
(
mpTeacherBarWidget
);
//
mRightPalette->addTabWidget(mpTeacherBarWidget);
mRightPalette
->
addTabWidget
(
mpTeacherBarWidget
);
mRightPalette
->
connectSignals
();
mRightPalette
->
connectSignals
();
mLeftPalette
->
showTabWidget
(
0
);
mLeftPalette
->
showTabWidget
(
0
);
mRightPalette
->
showTabWidget
(
0
);
mRightPalette
->
showTabWidget
(
0
);
...
...
src/core/UBPersistenceManager.cpp
View file @
191e21ee
...
@@ -592,7 +592,6 @@ UBGraphicsScene* UBPersistenceManager::loadDocumentScene(UBDocumentProxy* proxy,
...
@@ -592,7 +592,6 @@ UBGraphicsScene* UBPersistenceManager::loadDocumentScene(UBDocumentProxy* proxy,
{
{
if
(
mSceneCache
.
contains
(
proxy
,
sceneIndex
))
if
(
mSceneCache
.
contains
(
proxy
,
sceneIndex
))
{
{
//qDebug() << "scene" << sceneIndex << "retrieved from cache ...";
return
mSceneCache
.
value
(
proxy
,
sceneIndex
);
return
mSceneCache
.
value
(
proxy
,
sceneIndex
);
}
}
else
else
...
@@ -618,8 +617,6 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
...
@@ -618,8 +617,6 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
QDir
dir
(
pDocumentProxy
->
persistencePath
());
QDir
dir
(
pDocumentProxy
->
persistencePath
());
dir
.
mkpath
(
pDocumentProxy
->
persistencePath
());
dir
.
mkpath
(
pDocumentProxy
->
persistencePath
());
qDebug
()
<<
"saving page"
<<
pSceneIndex
+
1
<<
pDocumentProxy
->
persistencePath
();
if
(
pDocumentProxy
->
isModified
())
if
(
pDocumentProxy
->
isModified
())
UBMetadataDcSubsetAdaptor
::
persist
(
pDocumentProxy
);
UBMetadataDcSubsetAdaptor
::
persist
(
pDocumentProxy
);
...
@@ -638,6 +635,92 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
...
@@ -638,6 +635,92 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
}
}
void
UBPersistenceManager
::
persistTeacherBar
(
UBDocumentProxy
*
pDocumentProxy
,
int
page
,
sTeacherBarInfos
infos
)
{
if
(
NULL
!=
pDocumentProxy
)
{
QFile
f
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
page
+
1
));
if
(
f
.
exists
())
{
if
(
f
.
open
(
QIODevice
::
ReadOnly
))
{
QDomDocument
domDoc
;
if
(
domDoc
.
setContent
(
f
.
readAll
()))
{
f
.
close
();
if
(
f
.
open
(
QIODevice
::
WriteOnly
))
{
QDomElement
rootElem
=
domDoc
.
documentElement
();
QDomNode
teacherBarNode
=
domDoc
.
namedItem
(
"teacherBar"
);
if
(
teacherBarNode
.
isNull
())
{
// Create the element
QDomElement
teacherElem
=
domDoc
.
createElement
(
"teacherBar"
);
rootElem
.
appendChild
(
teacherElem
);
teacherBarNode
=
teacherElem
;
}
// Set the <teacherBar> element values
QDomElement
teacherBarElem
=
teacherBarNode
.
toElement
();
teacherBarElem
.
setAttribute
(
"title"
,
infos
.
title
);
teacherBarElem
.
setAttribute
(
"phasis"
,
infos
.
phasis
);
teacherBarElem
.
setAttribute
(
"duration"
,
infos
.
Duration
);
teacherBarElem
.
setAttribute
(
"equipment"
,
infos
.
material
);
teacherBarElem
.
setAttribute
(
"activity"
,
infos
.
activity
);
teacherBarElem
.
setAttribute
(
"action1Teacher"
,
infos
.
action1Master
);
teacherBarElem
.
setAttribute
(
"action1Student"
,
infos
.
action1Student
);
teacherBarElem
.
setAttribute
(
"action2Teacher"
,
infos
.
action2Master
);
teacherBarElem
.
setAttribute
(
"action2Student"
,
infos
.
action2Student
);
teacherBarElem
.
setAttribute
(
"action3Teacher"
,
infos
.
action3Master
);
teacherBarElem
.
setAttribute
(
"action3Student"
,
infos
.
action3Student
);
// Save the file
f
.
write
(
domDoc
.
toString
().
toAscii
());
f
.
close
();
}
}
f
.
close
();
}
}
}
}
sTeacherBarInfos
UBPersistenceManager
::
getTeacherBarInfos
(
UBDocumentProxy
*
pDocumentProxy
,
int
page
)
{
sTeacherBarInfos
infos
;
if
(
NULL
!=
pDocumentProxy
)
{
QFile
f
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
page
+
1
));
if
(
f
.
exists
())
{
if
(
f
.
open
(
QIODevice
::
ReadWrite
))
{
QDomDocument
domDoc
;
if
(
domDoc
.
setContent
(
f
.
readAll
()))
{
QDomElement
rootElem
=
domDoc
.
documentElement
();
QDomNode
teacherBarNode
=
rootElem
.
namedItem
(
"teacherBar"
);
infos
.
title
=
teacherBarNode
.
toElement
().
attributeNode
(
"title"
).
value
();
infos
.
phasis
=
teacherBarNode
.
toElement
().
attributeNode
(
"phasis"
).
value
().
toInt
();
infos
.
Duration
=
teacherBarNode
.
toElement
().
attributeNode
(
"duration"
).
value
().
toInt
();
infos
.
material
=
teacherBarNode
.
toElement
().
attributeNode
(
"equipment"
).
value
();
infos
.
activity
=
teacherBarNode
.
toElement
().
attributeNode
(
"activity"
).
value
().
toInt
();
infos
.
action1Master
=
teacherBarNode
.
toElement
().
attributeNode
(
"action1Teacher"
).
value
();
infos
.
action1Student
=
teacherBarNode
.
toElement
().
attributeNode
(
"action1Student"
).
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
();
}
}
}
return
infos
;
}
UBDocumentProxy
*
UBPersistenceManager
::
persistDocumentMetadata
(
UBDocumentProxy
*
pDocumentProxy
)
UBDocumentProxy
*
UBPersistenceManager
::
persistDocumentMetadata
(
UBDocumentProxy
*
pDocumentProxy
)
{
{
...
...
src/core/UBPersistenceManager.h
View file @
191e21ee
...
@@ -20,6 +20,21 @@
...
@@ -20,6 +20,21 @@
#include "UBSceneCache.h"
#include "UBSceneCache.h"
struct
sTeacherBarInfos
{
QString
title
;
int
phasis
;
int
Duration
;
QString
material
;
int
activity
;
QString
action1Master
;
QString
action1Student
;
QString
action2Master
;
QString
action2Student
;
QString
action3Master
;
QString
action3Student
;
};
class
UBDocument
;
class
UBDocument
;
class
UBDocumentProxy
;
class
UBDocumentProxy
;
class
UBGraphicsScene
;
class
UBGraphicsScene
;
...
@@ -60,6 +75,10 @@ class UBPersistenceManager : public QObject
...
@@ -60,6 +75,10 @@ class UBPersistenceManager : public QObject
virtual
void
persistDocumentScene
(
UBDocumentProxy
*
pDocumentProxy
,
virtual
void
persistDocumentScene
(
UBDocumentProxy
*
pDocumentProxy
,
UBGraphicsScene
*
pScene
,
const
int
pSceneIndex
);
UBGraphicsScene
*
pScene
,
const
int
pSceneIndex
);
virtual
void
persistTeacherBar
(
UBDocumentProxy
*
pDocumentProxy
,
int
page
,
sTeacherBarInfos
infos
);
sTeacherBarInfos
getTeacherBarInfos
(
UBDocumentProxy
*
pDocumentProxy
,
int
page
);
virtual
UBGraphicsScene
*
createDocumentSceneAt
(
UBDocumentProxy
*
pDocumentProxy
,
int
index
);
virtual
UBGraphicsScene
*
createDocumentSceneAt
(
UBDocumentProxy
*
pDocumentProxy
,
int
index
);
virtual
void
insertDocumentSceneAt
(
UBDocumentProxy
*
pDocumentProxy
,
UBGraphicsScene
*
scene
,
int
index
);
virtual
void
insertDocumentSceneAt
(
UBDocumentProxy
*
pDocumentProxy
,
UBGraphicsScene
*
scene
,
int
index
);
...
...
src/gui/UBDocumentNavigator.cpp
View file @
191e21ee
...
@@ -141,8 +141,13 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
...
@@ -141,8 +141,13 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
{
{
// Save the current state of the scene
// Save the current state of the scene
pScene
->
setModified
(
true
);
pScene
->
setModified
(
true
);
UBSvgSubsetAdaptor
::
persistScene
(
mCrntDoc
,
pScene
,
iPage
);
if
(
UBApplication
::
boardController
)
{
UBApplication
::
boardController
->
persistCurrentScene
();
}
// Now, update the thumbnail
UBThumbnailAdaptor
::
persistScene
(
mCrntDoc
->
persistencePath
(),
pScene
,
iPage
);
UBThumbnailAdaptor
::
persistScene
(
mCrntDoc
->
persistencePath
(),
pScene
,
iPage
);
// Load it
// Load it
...
...
src/gui/UBTeacherBarWidget.cpp
View file @
191e21ee
#include "UBTeacherBarWidget.h"
#include "UBTeacherBarWidget.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "document/UBDocumentController.h"
#include "document/UBDocumentProxy.h"
#include "board/UBBoardController.h"
UBTeacherBarWidget
::
UBTeacherBarWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
UBTeacherBarWidget
::
UBTeacherBarWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
,
mpLayout
(
NULL
)
,
mpLayout
(
NULL
)
...
@@ -110,6 +116,9 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
...
@@ -110,6 +116,9 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
mpLayout
->
addWidget
(
mpAction3
);
mpLayout
->
addWidget
(
mpAction3
);
populateCombos
();
populateCombos
();
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneWillChange
()),
this
,
SLOT
(
saveContent
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
this
,
SLOT
(
loadContent
()));
}
}
UBTeacherBarWidget
::~
UBTeacherBarWidget
()
UBTeacherBarWidget
::~
UBTeacherBarWidget
()
...
@@ -221,14 +230,50 @@ void UBTeacherBarWidget::populateCombos()
...
@@ -221,14 +230,50 @@ void UBTeacherBarWidget::populateCombos()
QStringList
qslPhasis
;
QStringList
qslPhasis
;
qslPhasis
<<
tr
(
"I discover"
)
<<
tr
(
"I experiment"
)
<<
tr
(
"I train myself"
)
<<
tr
(
"I play"
)
<<
tr
(
"I memorize"
);
qslPhasis
<<
tr
(
"I discover"
)
<<
tr
(
"I experiment"
)
<<
tr
(
"I train myself"
)
<<
tr
(
"I play"
)
<<
tr
(
"I memorize"
);
mpPhasis
->
insertItems
(
0
,
qslPhasis
);
mpPhasis
->
insertItems
(
0
,
qslPhasis
);
mpPhasis
->
setCurrentIndex
(
0
);
QStringList
qslDuration
;
QStringList
qslDuration
;
qslDuration
<<
tr
(
"Short"
)
<<
tr
(
"Middle"
)
<<
tr
(
"Long"
);
qslDuration
<<
tr
(
"Short"
)
<<
tr
(
"Middle"
)
<<
tr
(
"Long"
);
mpDuration
->
insertItems
(
0
,
qslDuration
);
mpDuration
->
insertItems
(
0
,
qslDuration
);
mpDuration
->
setCurrentIndex
(
0
);
QStringList
qslActivity
;
QStringList
qslActivity
;
qslActivity
<<
tr
(
"Alone"
)
<<
tr
(
"By Group"
)
<<
tr
(
"All together"
);
qslActivity
<<
tr
(
"Alone"
)
<<
tr
(
"By Group"
)
<<
tr
(
"All together"
);
mpActivity
->
insertItems
(
0
,
qslActivity
);
mpActivity
->
insertItems
(
0
,
qslActivity
);
mpActivity
->
setCurrentIndex
(
0
);
}
void
UBTeacherBarWidget
::
saveContent
()
{
sTeacherBarInfos
infos
;
infos
.
title
=
mpTitle
->
text
();
infos
.
phasis
=
mpPhasis
->
currentIndex
();
infos
.
Duration
=
mpDuration
->
currentIndex
();
infos
.
material
=
mpEquipment
->
text
();
infos
.
activity
=
mpActivity
->
currentIndex
();
infos
.
action1Master
=
mpAction1
->
teacherText
();
infos
.
action1Student
=
mpAction1
->
studentText
();
infos
.
action2Master
=
mpAction2
->
teacherText
();
infos
.
action2Student
=
mpAction2
->
studentText
();
infos
.
action3Master
=
mpAction3
->
teacherText
();
infos
.
action3Student
=
mpAction3
->
studentText
();
UBPersistenceManager
::
persistenceManager
()
->
persistTeacherBar
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
(),
infos
);
}
void
UBTeacherBarWidget
::
loadContent
()
{
sTeacherBarInfos
nextInfos
=
UBPersistenceManager
::
persistenceManager
()
->
getTeacherBarInfos
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
());
mpTitle
->
setText
(
nextInfos
.
title
);
mpPhasis
->
setCurrentIndex
(
nextInfos
.
phasis
);
mpDuration
->
setCurrentIndex
(
nextInfos
.
Duration
);
mpEquipment
->
setText
(
nextInfos
.
material
);
mpActivity
->
setCurrentIndex
(
nextInfos
.
activity
);
mpAction1
->
setTeacherText
(
nextInfos
.
action1Master
);
mpAction1
->
setStudentText
(
nextInfos
.
action1Student
);
mpAction2
->
setTeacherText
(
nextInfos
.
action2Master
);
mpAction2
->
setStudentText
(
nextInfos
.
action2Student
);
mpAction3
->
setTeacherText
(
nextInfos
.
action3Master
);
mpAction3
->
setStudentText
(
nextInfos
.
action3Student
);
}
}
UBTeacherStudentAction
::
UBTeacherStudentAction
(
int
actionNumber
,
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
UBTeacherStudentAction
::
UBTeacherStudentAction
(
int
actionNumber
,
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
...
@@ -327,3 +372,12 @@ QString UBTeacherStudentAction::studentText()
...
@@ -327,3 +372,12 @@ QString UBTeacherStudentAction::studentText()
return
mpStudent
->
document
()
->
toPlainText
();
return
mpStudent
->
document
()
->
toPlainText
();
}
}
void
UBTeacherStudentAction
::
setTeacherText
(
QString
text
)
{
mpTeacher
->
setText
(
text
);
}
void
UBTeacherStudentAction
::
setStudentText
(
QString
text
)
{
mpStudent
->
setText
(
text
);
}
src/gui/UBTeacherBarWidget.h
View file @
191e21ee
...
@@ -20,6 +20,8 @@ public:
...
@@ -20,6 +20,8 @@ public:
~
UBTeacherStudentAction
();
~
UBTeacherStudentAction
();
QString
teacherText
();
QString
teacherText
();
QString
studentText
();
QString
studentText
();
void
setTeacherText
(
QString
text
);
void
setStudentText
(
QString
text
);
private
:
private
:
int
mActionNumber
;
int
mActionNumber
;
...
@@ -35,10 +37,15 @@ private:
...
@@ -35,10 +37,15 @@ private:
class
UBTeacherBarWidget
:
public
UBDockPaletteWidget
class
UBTeacherBarWidget
:
public
UBDockPaletteWidget
{
{
Q_OBJECT
public
:
public
:
UBTeacherBarWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTeacherBarWidget"
);
UBTeacherBarWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTeacherBarWidget"
);
~
UBTeacherBarWidget
();
~
UBTeacherBarWidget
();
private
slots
:
void
saveContent
();
void
loadContent
();
private
:
private
:
void
populateCombos
();
void
populateCombos
();
...
...
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