Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
linphone-desktop
Commits
24a83838
Commit
24a83838
authored
Jun 19, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(App): svg parser in progress
parent
6c8a198c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
ImageProvider.cpp
src/app/providers/ImageProvider.cpp
+18
-13
No files found.
src/app/providers/ImageProvider.cpp
View file @
24a83838
...
@@ -42,40 +42,45 @@ QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) {
...
@@ -42,40 +42,45 @@ QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) {
const
QString
path
=
QStringLiteral
(
":/assets/images/%1"
).
arg
(
id
);
const
QString
path
=
QStringLiteral
(
":/assets/images/%1"
).
arg
(
id
);
// 1. Read and update XML content.
// 1. Read and update XML content.
QFile
file
(
path
);
QFile
file
(
path
);
// TODO: Check file size.
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
))
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
))
return
QImage
();
// Invalid file.
return
QImage
();
// Invalid file.
QString
content
;
QString
content
;
QXmlStreamReader
reader
(
&
file
);
QXmlStreamReader
reader
(
&
file
);
bool
soFarSoGood
=
true
;
while
(
!
reader
.
atEnd
())
while
(
soFarSoGood
&&
!
reader
.
atEnd
())
switch
(
reader
.
readNext
())
{
switch
(
reader
.
readNext
())
{
case
QXmlStreamReader
:
:
NoToken
:
case
QXmlStreamReader
:
:
Comment
:
case
QXmlStreamReader
:
:
DTD
:
case
QXmlStreamReader
:
:
EndDocument
:
case
QXmlStreamReader
:
:
EntityReference
:
case
QXmlStreamReader
:
:
Invalid
:
case
QXmlStreamReader
:
:
Invalid
:
case
QXmlStreamReader
:
:
NoToken
:
case
QXmlStreamReader
:
:
ProcessingInstruction
:
case
QXmlStreamReader
:
:
StartDocument
:
break
;
break
;
case
QXmlStreamReader
:
:
StartDocument
:
case
QXmlStreamReader
:
:
EndDocument
:
case
QXmlStreamReader
:
:
StartElement
:
{
case
QXmlStreamReader
:
:
StartElement
:
{
QXmlStreamNamespaceDeclarations
declarations
=
reader
.
namespaceDeclarations
();
QXmlStreamAttributes
attributes
=
reader
.
attributes
();
QXmlStreamAttributes
attributes
=
reader
.
attributes
();
}
break
;
for
(
const
auto
&
declaration
:
declarations
)
{
qDebug
()
<<
"toto"
<<
declaration
.
namespaceUri
()
<<
declaration
.
prefix
();
}
}
break
;
// TODO.
case
QXmlStreamReader
:
:
EndElement
:
case
QXmlStreamReader
:
:
EndElement
:
content
.
append
(
QStringLiteral
(
"</%1>"
).
arg
(
reader
.
name
().
toString
()));
content
.
append
(
QStringLiteral
(
"</%1>"
).
arg
(
reader
.
name
().
toString
()));
break
;
break
;
case
QXmlStreamReader
:
:
Characters
:
case
QXmlStreamReader
:
:
Characters
:
case
QXmlStreamReader
:
:
Comment
:
content
.
append
(
reader
.
text
());
case
QXmlStreamReader
:
:
DTD
:
case
QXmlStreamReader
:
:
EntityReference
:
case
QXmlStreamReader
:
:
ProcessingInstruction
:
break
;
break
;
}
}
qDebug
()
<<
content
;
qDebug
()
<<
content
;
if
(
!
soFarSoGood
||
reader
.
hasError
())
if
(
reader
.
hasError
())
return
QImage
();
// Invalid file.
return
QImage
();
// Invalid file.
// 2. Build svg renderer.
// 2. Build svg renderer.
...
...
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