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
6174a783
Commit
6174a783
authored
Oct 20, 2011
by
Ivan Ilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A new step to implement cff support
parent
8bcabeca
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
24 deletions
+84
-24
UBCFFSubsetAdaptor.cpp
src/adaptors/UBCFFSubsetAdaptor.cpp
+66
-8
UBCFFSubsetAdaptor.h
src/adaptors/UBCFFSubsetAdaptor.h
+8
-5
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+10
-11
No files found.
src/adaptors/UBCFFSubsetAdaptor.cpp
View file @
6174a783
...
...
@@ -41,6 +41,7 @@
//tag names definition
//use them everiwhere!
static
QString
tElement
=
"element"
;
static
QString
tGroup
=
"group"
;
static
QString
tEllipse
=
"ellipse"
;
static
QString
tIwb
=
"iwb"
;
static
QString
tMeta
=
"meta"
;
...
...
@@ -78,25 +79,72 @@ static QString aFontweight = "font-weight";
static
QString
aTextalign
=
"text-align"
;
static
QString
aPoints
=
"points"
;
static
QString
svgNS
=
"http://www.w3.org/2000/svg"
;
static
QString
tId
=
"id
"
;
static
QString
iwbNS
=
"http://www.becta.org.uk/iwb
"
;
static
QString
aId
=
"id"
;
UBCFFSubsetAdaptor
::
UBCFFSubsetAdaptor
()
{
}
void
UBCFFSubsetAdaptor
::
UBCFFSubsetReader
::
hashNode
(
QDomNode
*
parent
,
QString
prefix
)
void
UBCFFSubsetAdaptor
::
UBCFFSubsetReader
::
hashSiblingIwbElements
(
QDomElement
*
parent
,
QDomElement
*
topGroup
)
{
QDomElement
curExt
=
parent
->
firstChildElement
(
tElement
);
while
(
!
curExt
.
isNull
())
{
QDomElement
n
=
curExt
;
if
(
curExt
.
namespaceURI
()
!=
iwbNS
)
continue
;
QHash
<
QString
,
IwbExt
>::
iterator
iSvgElement
=
extProperties
.
find
(
curExt
.
attribute
(
"ref"
));
if
(
iSvgElement
!=
extProperties
.
end
())
{
IwbExt
&
svgElement
=
*
iSvgElement
;
svgElement
.
extAttr
.
push_back
(
curExt
);
if
(
topGroup
)
qDebug
()
<<
"made"
;
}
curExt
=
curExt
.
nextSiblingElement
(
tElement
);
}
}
void
UBCFFSubsetAdaptor
::
UBCFFSubsetReader
::
addExtentionsToHash
(
QDomElement
*
parent
)
{
//add top level elements
QDomElement
curGroup
=
parent
->
firstChildElement
(
tGroup
);
QDomElement
topGroup
;
while
(
!
curGroup
.
isNull
())
{
if
(
curGroup
.
namespaceURI
()
!=
iwbNS
)
continue
;
// if (parent == mDOMdoc.documentElement())
// topGroup = curGroup;
// QHash<QString, IwbExt>::iterator iSvgElement = extProperties.find(curExt.attribute("ref"));
// if (iSvgElement != extProperties.end()) {
// IwbExt &svgElement = *iSvgElement;
// svgElement.group = curGroup;
// qDebug() << "made";
// }
hashSiblingIwbElements
(
&
curGroup
,
&
topGroup
);
if
(
curGroup
.
hasChildNodes
())
{
addExtentionsToHash
(
&
curGroup
);
}
curGroup
=
curGroup
.
nextSiblingElement
(
tGroup
);
}
//add groups
}
void
UBCFFSubsetAdaptor
::
UBCFFSubsetReader
::
hashSvg
(
QDomNode
*
parent
,
QString
prefix
)
{
QDomNode
n
=
parent
->
firstChild
();
while
(
!
n
.
isNull
())
{
QDomElement
e
=
n
.
toElement
();
QString
id
=
e
.
attribute
(
t
Id
);
QString
id
=
e
.
attribute
(
a
Id
);
if
(
!
id
.
isNull
())
{
extProperties
.
insert
(
id
,
IwbExt
(
e
));
qDebug
()
<<
prefix
+
e
.
prefix
()
+
":"
+
e
.
tagName
();
}
if
(
n
.
hasChildNodes
())
{
hash
Node
(
&
n
,
QString
(
"| %1"
).
arg
(
prefix
));
hash
Svg
(
&
n
,
QString
(
"| %1"
).
arg
(
prefix
));
}
n
=
n
.
nextSibling
();
}
...
...
@@ -107,11 +155,21 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::hashElements()
QDomElement
svgSection
=
mDOMdoc
.
elementsByTagNameNS
(
svgNS
,
tSvg
).
at
(
0
).
toElement
();
Q_ASSERT
(
!
svgSection
.
isNull
());
hashNode
(
&
svgSection
);
hashSvg
(
&
svgSection
);
QDomElement
parElement
=
mDOMdoc
.
documentElement
();
Q_ASSERT
(
!
parElement
.
isNull
());
qDebug
()
<<
"ext properties count "
<<
extProperties
.
count
();
qDebug
()
<<
extProperties
.
value
(
"link1"
).
element
.
toElement
().
tagName
();
addExtentionsToHash
(
&
parElement
);
// qDebug() << "ext properties count " << extProperties.count();
// qDebug() << extProperties.value("link1").element.toElement().tagName();
foreach
(
IwbExt
cur
,
extProperties
)
{
qDebug
()
<<
(
cur
.
extAttr
.
count
()
?
cur
.
extAttr
.
first
().
toElement
().
tagName
()
:
"count < 0"
)
;
}
// for (int i = 0; i < extProperties.count(); i++) {
// }
// QDomNode n = docElem.firstChild();
// int i = 0;
...
...
src/adaptors/UBCFFSubsetAdaptor.h
View file @
6174a783
...
...
@@ -29,12 +29,14 @@ class UBGraphicsSvgItem;
class
QTransform
;
struct
IwbExt
{
IwbExt
()
:
group
(
NULL
)
{;}
IwbExt
(
QDomNode
element
)
:
group
(
NULL
),
element
(
element
)
{;}
IwbExt
()
{;}
IwbExt
(
QDomNode
element
)
:
element
(
element
),
extAttr
(
*
(
new
QVector
<
QDomNode
>
())
)
{;}
QDomNode
*
group
;
QDomNode
group
;
QDomNode
element
;
QVector
<
QDomNode
>
extAttr
;
QHash
<
QString
,
QString
>
textAttributes
;
operator
bool
()
const
{
return
group
.
isNull
()
||
!
element
.
isNull
();}
};
class
UBCFFSubsetAdaptor
...
...
@@ -80,9 +82,10 @@ private:
QDomDocument
mDOMdoc
;
QHash
<
QString
,
IwbExt
>
extProperties
;
bool
hashElements
();
void
addExtentionsToHash
(
QDomElement
*
parent
);
void
hash
Node
(
QDomNode
*
parent
,
QString
prefix
=
""
);
void
hash
Svg
(
QDomNode
*
parent
,
QString
prefix
=
""
);
void
hashSiblingIwbElements
(
QDomElement
*
parent
,
QDomElement
*
topGroup
=
0
);
//methods to store current xml parse state
...
...
src/board/UBBoardPaletteManager.cpp
View file @
6174a783
...
...
@@ -167,15 +167,16 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mpLibWidget
=
new
UBLibWidget
();
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_DESKTOP
);
connect
(
this
,
SIGNAL
(
signal_changeMode
(
eUBDockPaletteWidgetMode
)),
mpLibWidget
,
SLOT
(
slot_changeMode
(
eUBDockPaletteWidgetMode
)));
// mpCachePropWidget = new UBCachePropertiesWidget();
// mpCachePropWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
//
mpTeacherBarWidget = new UBTeacherBarWidget();
//
mpTeacherBarWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpTeacherBarWidget
=
new
UBTeacherBarWidget
();
mpTeacherBarWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
connect
(
this
,
SIGNAL
(
signal_changeMode
(
eUBDockPaletteWidgetMode
)),
mpTeacherBarWidget
,
SLOT
(
slot_changeMode
(
eUBDockPaletteWidgetMode
)));
//------------------------------------------------//
// Add the dock palettes
...
...
@@ -200,8 +201,8 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
// mRightPalette->addTabWidget(mpCachePropWidget);
// // ???
//
mRightPalette->registerWidget(mpTeacherBarWidget);
//
mRightPalette->addTabWidget(mpTeacherBarWidget);
mRightPalette
->
registerWidget
(
mpTeacherBarWidget
);
mRightPalette
->
addTabWidget
(
mpTeacherBarWidget
);
mRightPalette
->
connectSignals
();
...
...
@@ -443,8 +444,6 @@ void UBBoardPaletteManager::connectPalettes()
}
void
UBBoardPaletteManager
::
containerResized
()
{
int
innerMargin
=
UBSettings
::
boardMargin
;
...
...
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