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
2078a309
Commit
2078a309
authored
Mar 14, 2018
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): clean some pieces of code and improve build (providers)
parent
b05e003d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
31 deletions
+31
-31
AvatarProvider.cpp
src/app/providers/AvatarProvider.cpp
+6
-6
ImageProvider.cpp
src/app/providers/ImageProvider.cpp
+19
-19
ThumbnailProvider.cpp
src/app/providers/ThumbnailProvider.cpp
+6
-6
No files found.
src/app/providers/AvatarProvider.cpp
View file @
2078a309
...
...
@@ -20,8 +20,8 @@
* Author: Ronan Abhamon
*/
#include "
../../utils/Util
s.hpp"
#include "
../paths/Path
s.hpp"
#include "
app/paths/Path
s.hpp"
#include "
utils/Util
s.hpp"
#include "AvatarProvider.hpp"
...
...
@@ -30,10 +30,10 @@
const
QString
AvatarProvider
::
PROVIDER_ID
=
"avatar"
;
AvatarProvider
::
AvatarProvider
()
:
QQuickImageProvider
(
QQmlImageProviderBase
::
Image
,
QQmlImageProviderBase
::
ForceAsynchronousImageLoading
)
{
mAvatarsPath
=
::
Utils
::
coreStringToAppString
(
Paths
::
getAvatarsDirPath
());
QQmlImageProviderBase
::
Image
,
QQmlImageProviderBase
::
ForceAsynchronousImageLoading
)
{
mAvatarsPath
=
Utils
::
coreStringToAppString
(
Paths
::
getAvatarsDirPath
());
}
QImage
AvatarProvider
::
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
)
{
...
...
src/app/providers/ImageProvider.cpp
View file @
2078a309
...
...
@@ -25,14 +25,14 @@
#include <QPainter>
#include <QSvgRenderer>
#include "
..
/App.hpp"
#include "
app
/App.hpp"
#include "ImageProvider.hpp"
using
namespace
std
;
// =============================================================================
using
namespace
std
;
namespace
{
// Max image size in bytes. (100Kb)
constexpr
qint64
cMaxImageSize
=
102400
;
...
...
@@ -40,8 +40,8 @@ namespace {
static
void
removeAttribute
(
QXmlStreamAttributes
&
readerAttributes
,
const
QString
&
name
)
{
auto
it
=
find_if
(
readerAttributes
.
cbegin
(),
readerAttributes
.
cend
(),
[
&
name
](
const
QXmlStreamAttribute
&
attribute
)
{
return
name
==
attribute
.
name
()
&&
!
attribute
.
prefix
().
length
();
});
return
name
==
attribute
.
name
()
&&
!
attribute
.
prefix
().
length
();
});
if
(
it
!=
readerAttributes
.
cend
())
readerAttributes
.
remove
(
int
(
distance
(
readerAttributes
.
cbegin
(),
it
)));
}
...
...
@@ -72,8 +72,8 @@ static QByteArray parseFillAndStroke (QXmlStreamAttributes &readerAttributes, co
continue
;
}
::
removeAttribute
(
readerAttributes
,
list
[
2
]);
attributes
.
append
(
::
buildByteArrayAttribute
(
list
[
2
].
toLatin1
(),
colorValue
.
value
<
QColor
>
().
name
().
toLatin1
()));
removeAttribute
(
readerAttributes
,
list
[
2
]);
attributes
.
append
(
buildByteArrayAttribute
(
list
[
2
].
toLatin1
(),
colorValue
.
value
<
QColor
>
().
name
().
toLatin1
()));
}
return
attributes
;
...
...
@@ -115,7 +115,7 @@ static QByteArray parseStyle (QXmlStreamAttributes &readerAttributes, const Colo
}
}
::
removeAttribute
(
readerAttributes
,
"style"
);
removeAttribute
(
readerAttributes
,
"style"
);
if
(
attribute
.
length
()
>
0
)
{
attribute
.
prepend
(
"style=
\"
"
);
...
...
@@ -128,8 +128,8 @@ static QByteArray parseStyle (QXmlStreamAttributes &readerAttributes, const Colo
static
QByteArray
parseAttributes
(
const
QXmlStreamReader
&
reader
,
const
Colors
&
colors
)
{
QXmlStreamAttributes
readerAttributes
=
reader
.
attributes
();
QByteArray
attributes
=
::
parseFillAndStroke
(
readerAttributes
,
colors
);
attributes
.
append
(
::
parseStyle
(
readerAttributes
,
colors
));
QByteArray
attributes
=
parseFillAndStroke
(
readerAttributes
,
colors
);
attributes
.
append
(
parseStyle
(
readerAttributes
,
colors
));
for
(
const
auto
&
attribute
:
readerAttributes
)
{
const
QByteArray
prefix
=
attribute
.
prefix
().
toLatin1
();
...
...
@@ -139,7 +139,7 @@ static QByteArray parseAttributes (const QXmlStreamReader &reader, const Colors
}
attributes
.
append
(
::
buildByteArrayAttribute
(
attribute
.
name
().
toLatin1
(),
attribute
.
value
().
toLatin1
())
buildByteArrayAttribute
(
attribute
.
name
().
toLatin1
(),
attribute
.
value
().
toLatin1
())
);
}
...
...
@@ -177,9 +177,9 @@ static QByteArray parseStartElement (const QXmlStreamReader &reader, const Color
QByteArray
startElement
=
"<"
;
startElement
.
append
(
reader
.
name
().
toLatin1
());
startElement
.
append
(
" "
);
startElement
.
append
(
::
parseAttributes
(
reader
,
colors
));
startElement
.
append
(
parseAttributes
(
reader
,
colors
));
startElement
.
append
(
" "
);
startElement
.
append
(
::
parseDeclarations
(
reader
));
startElement
.
append
(
parseDeclarations
(
reader
));
startElement
.
append
(
">"
);
return
startElement
;
}
...
...
@@ -209,15 +209,15 @@ static QByteArray computeContent (QFile &file) {
break
;
case
QXmlStreamReader
:
:
StartDocument
:
content
.
append
(
::
parseStartDocument
(
reader
));
content
.
append
(
parseStartDocument
(
reader
));
break
;
case
QXmlStreamReader
:
:
StartElement
:
content
.
append
(
::
parseStartElement
(
reader
,
*
colors
));
content
.
append
(
parseStartElement
(
reader
,
*
colors
));
break
;
case
QXmlStreamReader
:
:
EndElement
:
content
.
append
(
::
parseEndElement
(
reader
));
content
.
append
(
parseEndElement
(
reader
));
break
;
case
QXmlStreamReader
:
:
Characters
:
...
...
@@ -237,9 +237,9 @@ static QByteArray computeContent (QFile &file) {
const
QString
ImageProvider
::
PROVIDER_ID
=
"internal"
;
ImageProvider
::
ImageProvider
()
:
QQuickImageProvider
(
QQmlImageProviderBase
::
Image
,
QQmlImageProviderBase
::
ForceAsynchronousImageLoading
)
{}
QQmlImageProviderBase
::
Image
,
QQmlImageProviderBase
::
ForceAsynchronousImageLoading
)
{}
// -----------------------------------------------------------------------------
...
...
src/app/providers/ThumbnailProvider.cpp
View file @
2078a309
...
...
@@ -20,8 +20,8 @@
* Author: Ronan Abhamon
*/
#include "
../../utils/Util
s.hpp"
#include "
../paths/Path
s.hpp"
#include "
app/paths/Path
s.hpp"
#include "
utils/Util
s.hpp"
#include "ThumbnailProvider.hpp"
...
...
@@ -30,10 +30,10 @@
const
QString
ThumbnailProvider
::
PROVIDER_ID
=
"thumbnail"
;
ThumbnailProvider
::
ThumbnailProvider
()
:
QQuickImageProvider
(
QQmlImageProviderBase
::
Image
,
QQmlImageProviderBase
::
ForceAsynchronousImageLoading
)
{
mThumbnailsPath
=
::
Utils
::
coreStringToAppString
(
Paths
::
getThumbnailsDirPath
());
QQmlImageProviderBase
::
Image
,
QQmlImageProviderBase
::
ForceAsynchronousImageLoading
)
{
mThumbnailsPath
=
Utils
::
coreStringToAppString
(
Paths
::
getThumbnailsDirPath
());
}
QImage
ThumbnailProvider
::
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
)
{
...
...
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