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
4ccd5a45
Commit
4ccd5a45
authored
Jul 12, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sankore-724. Properties contains image now. When image loads - user see "loading" image.
parent
8dc76565
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
3 deletions
+52
-3
sankore.qrc
resources/sankore.qrc
+1
-0
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+44
-3
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+7
-0
No files found.
resources/sankore.qrc
View file @
4ccd5a45
...
...
@@ -265,6 +265,7 @@
<file>images/libpalette/notFound.png</file>
<file>images/libpalette/trash_favorite.svg</file>
<file>images/libpalette/back.png</file>
<file>images/libpalette/loading.png</file>
<file>images/stylusPalette/eraserArrow.png</file>
<file>images/stylusPalette/eraserOnArrow.png</file>
<file>images/stylusPalette/markerArrow.png</file>
...
...
src/gui/UBFeaturesWidget.cpp
View file @
4ccd5a45
...
...
@@ -10,7 +10,9 @@
#include "globals/UBGlobals.h"
#include "board/UBBoardController.h"
UBFeaturesWidget
::
UBFeaturesWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
UBFeaturesWidget
::
UBFeaturesWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
,
imageGatherer
(
NULL
)
{
setObjectName
(
name
);
mName
=
"FeaturesWidget"
;
...
...
@@ -139,6 +141,8 @@ UBFeaturesWidget::~UBFeaturesWidget()
delete
thumbSlider
;
thumbSlider
=
NULL
;
}
if
(
NULL
!=
imageGatherer
)
delete
imageGatherer
;
}
bool
UBFeaturesWidget
::
eventFilter
(
QObject
*
target
,
QEvent
*
event
)
...
...
@@ -353,7 +357,19 @@ void UBFeaturesWidget::thumbnailSizeChanged( int value )
void
UBFeaturesWidget
::
onDisplayMetadata
(
QMap
<
QString
,
QString
>
metadata
)
{
UBFeature
feature
(
QString
(),
QPixmap
(
":images/libpalette/notFound.png"
),
QString
(),
metadata
[
"Url"
],
FEATURE_ITEM
);
QString
previewImageUrl
;
previewImageUrl
=
":images/libpalette/loading.png"
;
if
(
!
imageGatherer
)
imageGatherer
=
new
UBDownloadHttpFile
(
0
,
this
);
connect
(
imageGatherer
,
SIGNAL
(
downloadFinished
(
int
,
bool
,
QUrl
,
QString
,
QByteArray
,
QPointF
,
QSize
,
bool
)),
this
,
SLOT
(
onPreviewLoaded
(
int
,
bool
,
QUrl
,
QString
,
QByteArray
,
QPointF
,
QSize
,
bool
)));
// We send here the request and store its reply in order to be able to cancel it if needed
imageGatherer
->
get
(
QUrl
(
metadata
[
"Url"
]),
QPoint
(
0
,
0
),
QSize
(),
false
);
UBFeature
feature
(
QString
(),
QPixmap
(
previewImageUrl
),
QString
(),
metadata
[
"Url"
],
FEATURE_ITEM
);
feature
.
setMetadata
(
metadata
);
featureProperties
->
showElement
(
feature
);
...
...
@@ -361,6 +377,16 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
mActionBar
->
setCurrentState
(
IN_PROPERTIES
);
}
void
UBFeaturesWidget
::
onPreviewLoaded
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
)
{
QImage
img
;
img
.
loadFromData
(
pData
);
QPixmap
pix
=
QPixmap
::
fromImage
(
img
);
featureProperties
->
setOrigPixmap
(
pix
);
featureProperties
->
setThumbnail
(
pix
);
}
void
UBFeaturesWidget
::
onAddDownloadedFileToLibrary
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentHeader
,
QByteArray
pData
)
{
if
(
pSuccess
)
...
...
@@ -738,6 +764,20 @@ UBFeature UBFeatureProperties::getCurrentElement() const
return
UBFeature
();
}
void
UBFeatureProperties
::
setOrigPixmap
(
QPixmap
&
pix
)
{
if
(
mpOrigPixmap
)
delete
mpOrigPixmap
;
mpOrigPixmap
=
new
QPixmap
(
pix
);
}
void
UBFeatureProperties
::
setThumbnail
(
QPixmap
&
pix
)
{
mpThumbnail
->
setPixmap
(
pix
.
scaledToWidth
(
THUMBNAIL_WIDTH
));
}
void
UBFeatureProperties
::
adaptSize
()
{
if
(
NULL
!=
mpOrigPixmap
)
...
...
@@ -819,7 +859,8 @@ void UBFeatureProperties::onAddToPage()
{
QWidget
*
w
=
parentWidget
()
->
parentWidget
();
UBFeaturesWidget
*
featuresWidget
=
dynamic_cast
<
UBFeaturesWidget
*>
(
w
);
featuresWidget
->
getFeaturesController
()
->
addItemToPage
(
*
mpElement
);
if
(
featuresWidget
)
featuresWidget
->
getFeaturesController
()
->
addItemToPage
(
*
mpElement
);
}
void
UBFeatureProperties
::
onAddToLib
()
...
...
src/gui/UBFeaturesWidget.h
View file @
4ccd5a45
...
...
@@ -88,7 +88,11 @@ private:
int
currentStackedWidget
;
UBDownloadHttpFile
*
imageGatherer
;
private
slots
:
void
onPreviewLoaded
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
void
currentSelected
(
const
QModelIndex
&
);
//void currentPathChanged(const QString &);
void
currentPathChanged
(
const
QModelIndex
&
);
...
...
@@ -153,6 +157,9 @@ public:
void
showElement
(
const
UBFeature
&
elem
);
UBFeature
getCurrentElement
()
const
;
void
setOrigPixmap
(
QPixmap
&
pix
);
void
setThumbnail
(
QPixmap
&
pix
);
protected
:
void
resizeEvent
(
QResizeEvent
*
event
);
void
showEvent
(
QShowEvent
*
event
);
...
...
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