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
9efb2695
Commit
9efb2695
authored
Oct 09, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bad fix for b9. to be reworked
parent
6b262cd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
8 deletions
+31
-8
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+24
-4
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+7
-4
No files found.
src/board/UBFeaturesController.cpp
View file @
9efb2695
...
...
@@ -735,7 +735,7 @@ UBFeature UBFeaturesController::getDestinationFeatureForUrl( const QUrl &url )
return
audiosElement
;
if
(
mimetype
.
contains
(
"video"
)
)
return
moviesElement
;
else
if
(
mimetype
.
contains
(
"image"
)
)
else
if
(
mimetype
.
contains
(
"image"
)
||
mimetype
.
isEmpty
()
)
return
picturesElement
;
else
if
(
mimetype
.
contains
(
"application"
)
)
{
...
...
@@ -751,13 +751,32 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
{
UBFeature
dest
=
getDestinationFeatureForUrl
(
sourceUrl
);
//TODO:claudio check this
if
(
dest
==
UBFeature
())
return
;
QString
fileName
=
QFileInfo
(
sourceUrl
.
toString
()
).
fileName
();
QString
filePath
=
dest
.
getFullPath
().
toLocalFile
()
+
"/"
+
fileName
;
QString
fileName
(
""
);
QString
filePath
(
""
);
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
sourceUrl
.
toString
()
).
isEmpty
()){
fileName
=
tr
(
"ImportedImage"
)
+
"-"
+
QDateTime
::
currentDateTime
().
toString
(
"dd-MM-yyyy hh-mm-ss"
)
+
".jpg"
;
filePath
=
dest
.
getFullPath
().
toLocalFile
()
+
"/"
+
fileName
;
QImage
::
fromData
(
pData
).
save
(
filePath
);
UBFeature
downloadedFeature
=
UBFeature
(
dest
.
getFullVirtualPath
()
+
"/"
+
fileName
,
getIcon
(
filePath
,
fileTypeFromUrl
(
filePath
)),
fileName
,
QUrl
::
fromLocalFile
(
filePath
),
FEATURE_ITEM
);
if
(
downloadedFeature
!=
UBFeature
())
{
featuresModel
->
addItem
(
downloadedFeature
);
}
}
else
{
fileName
=
QFileInfo
(
sourceUrl
.
toString
()
).
fileName
();
filePath
=
dest
.
getFullPath
().
toLocalFile
()
+
"/"
+
fileName
;
QFile
file
(
filePath
);
QFile
file
(
filePath
);
if
(
file
.
open
(
QIODevice
::
WriteOnly
))
{
file
.
write
(
pData
);
...
...
@@ -769,6 +788,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
featuresModel
->
addItem
(
downloadedFeature
);
}
}
}
}
...
...
src/gui/UBFeaturesWidget.cpp
View file @
9efb2695
...
...
@@ -231,8 +231,8 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
{
QString
previewImageUrl
=
":images/libpalette/notFound.png"
;
QString
widgetsUrl
=
metadata
.
value
(
"Url"
,
QString
())
;
QString
widgetsThumbsUrl
=
metadata
.
value
(
"thumbnailUrl"
,
QString
()
);
QString
widgetsUrl
=
QUrl
::
fromEncoded
(
metadata
[
"Url"
].
toAscii
()).
toString
()
/*metadata.value("Url", QString())*/
;
QString
widgetsThumbsUrl
=
QUrl
::
fromEncoded
(
metadata
[
"thumbnailUrl"
].
toAscii
()).
toString
(
);
bool
isLocal
=
QFileInfo
(
widgetsUrl
).
exists
();
...
...
@@ -269,8 +269,11 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
// We send here the request and store its reply in order to be able to cancel it if needed
imageGatherer
->
get
(
QUrl
(
widgetsThumbsUrl
),
QPoint
(
0
,
0
),
QSize
(),
false
);
}
QString
tmp
=
QUrl
::
fromEncoded
(
metadata
[
"Url"
].
toAscii
()).
toString
();
qDebug
()
<<
tmp
;
UBFeature
feature
(
"/root"
,
QImage
(
previewImageUrl
),
QString
(),
metadata
[
"Url"
]
,
FEATURE_ITEM
);
UBFeature
feature
(
"/root"
,
QImage
(
previewImageUrl
),
QString
(),
tmp
/*metadata["Url"]*/
,
FEATURE_ITEM
);
feature
.
setMetadata
(
metadata
);
centralWidget
->
showElement
(
feature
,
UBFeaturesCentralWidget
::
FeaturePropertiesList
);
...
...
@@ -299,8 +302,8 @@ void UBFeaturesWidget::onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QU
void
UBFeaturesWidget
::
onAddDownloadedFileToLibrary
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentHeader
,
QByteArray
pData
)
{
Q_UNUSED
(
pContentHeader
)
if
(
pSuccess
)
{
qDebug
()
<<
pData
.
length
();
controller
->
addDownloadedFile
(
sourceUrl
,
pData
);
controller
->
refreshModels
();
}
...
...
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