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
97a96846
Commit
97a96846
authored
Jul 23, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
7c649e4a
ea51150c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
24 deletions
+124
-24
UBBoardController.cpp
src/board/UBBoardController.cpp
+11
-13
UB.h
src/core/UB.h
+17
-0
UBFileSystemUtils.cpp
src/frameworks/UBFileSystemUtils.cpp
+53
-0
UBFileSystemUtils.h
src/frameworks/UBFileSystemUtils.h
+6
-0
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+37
-11
No files found.
src/board/UBBoardController.cpp
View file @
97a96846
...
...
@@ -868,6 +868,8 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
if
(
position
!=
-
1
)
mimeType
=
mimeType
.
left
(
position
);
UBMimeType
::
Enum
itemMimeType
=
UBFileSystemUtils
::
mimeTypeFromString
(
mimeType
);
if
(
!
pSuccess
)
{
UBApplication
::
showMessage
(
tr
(
"Downloading content %1 failed"
).
arg
(
sourceUrl
.
toString
()));
...
...
@@ -877,11 +879,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
if
(
!
sourceUrl
.
toString
().
startsWith
(
"file://"
)
&&
!
sourceUrl
.
toString
().
startsWith
(
"uniboardTool://"
))
UBApplication
::
showMessage
(
tr
(
"Download finished"
));
if
(
mimeType
==
"image/jpeg"
||
mimeType
==
"image/png"
||
mimeType
==
"image/gif"
||
mimeType
==
"image/tiff"
||
mimeType
==
"image/bmp"
)
if
(
UBMimeType
::
RasterImage
==
itemMimeType
)
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as raster image"
;
...
...
@@ -904,7 +902,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
else
if
(
mimeType
==
"image/svg+xml"
)
else
if
(
UBMimeType
::
VectorImage
==
itemMimeType
)
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as vecto image"
;
...
...
@@ -922,7 +920,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
else
if
(
mimeType
==
"application/vnd.apple-widget"
)
//mime type invented by us :-(
else
if
(
UBMimeType
::
AppleWidget
==
itemMimeType
)
//mime type invented by us :-(
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as Apple widget"
;
...
...
@@ -946,7 +944,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
else
if
(
mimeType
==
"application/widget"
)
else
if
(
UBMimeType
::
W3CWidget
==
itemMimeType
)
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as W3C widget"
;
QUrl
widgetUrl
=
sourceUrl
;
...
...
@@ -967,7 +965,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
else
if
(
mimeType
.
startsWith
(
"video/"
)
)
else
if
(
UBMimeType
::
Video
==
itemMimeType
)
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as video"
;
...
...
@@ -996,7 +994,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
else
if
(
mimeType
.
startsWith
(
"audio/"
)
)
else
if
(
UBMimeType
::
Audio
==
itemMimeType
)
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as audio"
;
...
...
@@ -1026,7 +1024,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
else
if
(
mimeType
.
startsWith
(
"application/x-shockwave-flash"
)
)
else
if
(
UBMimeType
::
Flash
==
itemMimeType
)
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as flash"
;
...
...
@@ -1073,7 +1071,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
delete
eduMediaFile
;
}
else
if
(
mimeType
.
startsWith
(
"application/pdf"
)
)
else
if
(
UBMimeType
::
PDF
==
itemMimeType
)
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as PDF"
;
qDebug
()
<<
"pdf data length: "
<<
pData
.
size
();
...
...
@@ -1097,7 +1095,7 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
selectedDocument
()
->
setMetaData
(
UBSettings
::
documentUpdatedAt
,
UBStringUtils
::
toUtcIsoDateTime
(
QDateTime
::
currentDateTime
()));
}
}
else
if
(
mimeType
.
startsWith
(
"application/vnd.mnemis-uniboard-tool"
)
)
else
if
(
UBMimeType
::
UniboardTool
==
itemMimeType
)
{
qDebug
()
<<
"accepting mime type"
<<
mimeType
<<
"as Uniboard Tool"
;
...
...
src/core/UB.h
View file @
97a96846
...
...
@@ -20,6 +20,23 @@
#define UB_MAX_ZOOM 15
struct
UBMimeType
{
enum
Enum
{
RasterImage
=
0
,
VectorImage
,
AppleWidget
,
W3CWidget
,
Video
,
Audio
,
Flash
,
PDF
,
UniboardTool
,
UNKNOWN
};
};
struct
UBStylusTool
{
enum
Enum
...
...
src/frameworks/UBFileSystemUtils.cpp
View file @
97a96846
...
...
@@ -535,6 +535,59 @@ QString UBFileSystemUtils::fileExtensionFromMimeType(const QString& pMimeType)
}
UBMimeType
::
Enum
UBFileSystemUtils
::
mimeTypeFromString
(
const
QString
&
typeString
)
{
UBMimeType
::
Enum
type
=
UBMimeType
::
UNKNOWN
;
if
(
typeString
==
"image/jpeg"
||
typeString
==
"image/png"
||
typeString
==
"image/gif"
||
typeString
==
"image/tiff"
||
typeString
==
"image/bmp"
)
{
type
=
UBMimeType
::
RasterImage
;
}
else
if
(
typeString
==
"image/svg+xml"
)
{
type
=
UBMimeType
::
VectorImage
;
}
else
if
(
typeString
==
"application/vnd.apple-widget"
)
{
type
=
UBMimeType
::
AppleWidget
;
}
else
if
(
typeString
==
"application/widget"
)
{
type
=
UBMimeType
::
W3CWidget
;
}
else
if
(
typeString
.
startsWith
(
"video/"
))
{
type
=
UBMimeType
::
Video
;
}
else
if
(
typeString
.
startsWith
(
"audio/"
))
{
type
=
UBMimeType
::
Audio
;
}
else
if
(
typeString
.
startsWith
(
"application/x-shockwave-flash"
))
{
type
=
UBMimeType
::
Flash
;
}
else
if
(
typeString
.
startsWith
(
"application/pdf"
))
{
type
=
UBMimeType
::
PDF
;
}
else
if
(
typeString
.
startsWith
(
"application/vnd.mnemis-uniboard-tool"
))
{
type
=
UBMimeType
::
UniboardTool
;
}
return
type
;
}
UBMimeType
::
Enum
UBFileSystemUtils
::
mimeTypeFromUrl
(
const
QUrl
&
url
)
{
return
mimeTypeFromString
(
mimeTypeFromFileName
(
url
.
toString
()));
}
QString
UBFileSystemUtils
::
getFirstExistingFileFromList
(
const
QString
&
path
,
const
QStringList
&
files
)
{
...
...
src/frameworks/UBFileSystemUtils.h
View file @
97a96846
...
...
@@ -18,6 +18,8 @@
#include <QtCore>
#include "core/UB.h"
class
QuaZipFile
;
class
UBProcessingProgressListener
;
...
...
@@ -57,6 +59,10 @@ class UBFileSystemUtils
static
QString
fileExtensionFromMimeType
(
const
QString
&
pMimeType
);
static
UBMimeType
::
Enum
mimeTypeFromString
(
const
QString
&
typeString
);
static
UBMimeType
::
Enum
mimeTypeFromUrl
(
const
QUrl
&
url
);
static
QString
normalizeFilePath
(
const
QString
&
pFilePath
);
static
QString
extension
(
const
QString
&
filaname
);
...
...
src/gui/UBFeaturesWidget.cpp
View file @
97a96846
...
...
@@ -359,27 +359,52 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
{
QString
previewImageUrl
;
previewImageUrl
=
":images/libpalette/loading.png"
;
switch
(
UBFileSystemUtils
::
mimeTypeFromUrl
(
QUrl
(
metadata
[
"Url"
])))
{
case
UBMimeType
:
:
RasterImage
:
case
UBMimeType
:
:
VectorImage
:
{
previewImageUrl
=
":images/libpalette/loading.png"
;
if
(
!
imageGatherer
)
imageGatherer
=
new
UBDownloadHttpFile
(
0
,
this
);
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
)));
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
);
// 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
);
}
break
;
case
UBMimeType
:
:
Audio
:
{
previewImageUrl
=
":images/libpalette/soundIcon.svg"
;
}
break
;
case
UBMimeType
:
:
Video
:
{
previewImageUrl
=
":images/libpalette/movieIcon.svg"
;
}
break
;
case
UBMimeType
:
:
Flash
:
{
previewImageUrl
=
":images/libpalette/FlashIcon.svg"
;
}
break
;
}
UBFeature
feature
(
QString
(),
QPixmap
(
previewImageUrl
),
QString
(),
metadata
[
"Url"
],
FEATURE_ITEM
);
feature
.
setMetadata
(
metadata
);
UBFeature
feature
(
QString
(),
QPixmap
(
previewImageUrl
),
QString
(),
metadata
[
"Url"
],
FEATURE_ITEM
);
feature
.
setMetadata
(
metadata
);
featureProperties
->
showElement
(
feature
);
switchToProperties
();
mActionBar
->
setCurrentState
(
IN_PROPERTIES
);
featureProperties
->
showElement
(
feature
);
switchToProperties
();
mActionBar
->
setCurrentState
(
IN_PROPERTIES
);
}
void
UBFeaturesWidget
::
onPreviewLoaded
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
)
{
Q_UNUSED
(
id
);
Q_UNUSED
(
pSuccess
);
Q_UNUSED
(
isBackground
);
Q_UNUSED
(
pSize
);
Q_UNUSED
(
pPos
);
QImage
img
;
img
.
loadFromData
(
pData
);
QPixmap
pix
=
QPixmap
::
fromImage
(
img
);
...
...
@@ -776,6 +801,7 @@ void UBFeatureProperties::setOrigPixmap(QPixmap &pix)
void
UBFeatureProperties
::
setThumbnail
(
QPixmap
&
pix
)
{
mpThumbnail
->
setPixmap
(
pix
.
scaledToWidth
(
THUMBNAIL_WIDTH
));
adaptSize
();
}
void
UBFeatureProperties
::
adaptSize
()
...
...
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