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
f7896e14
Commit
f7896e14
authored
Aug 24, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issue with flash on mac
parent
3fe5c51f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
14 deletions
+70
-14
sankore.qrc
resources/sankore.qrc
+1
-0
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+28
-0
UBPersistenceManager.h
src/core/UBPersistenceManager.h
+1
-0
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+3
-2
UBTeacherGuideWidgetsTools.cpp
src/gui/UBTeacherGuideWidgetsTools.cpp
+35
-10
UBTeacherGuideWidgetsTools.h
src/gui/UBTeacherGuideWidgetsTools.h
+2
-2
No files found.
resources/sankore.qrc
View file @
f7896e14
...
...
@@ -364,5 +364,6 @@
<file>images/teacherGuide/w3c_24x24.svg</file>
<file>images/teacherGuide/pencil.svg</file>
<file>images/duplicateDisabled.svg</file>
<file>images/teacherGuide/flash_24x24.svg</file>
</qresource>
</RCC>
src/core/UBPersistenceManager.cpp
View file @
f7896e14
...
...
@@ -878,6 +878,34 @@ QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy*
return
destPath
;
}
QString
UBPersistenceManager
::
addWidgetToTeacherGuideDirectory
(
UBDocumentProxy
*
pDocumentProxy
,
QString
pPath
)
{
QString
path
=
UBFileSystemUtils
::
removeLocalFilePrefix
(
pPath
);
QFileInfo
fi
(
path
);
Q_ASSERT
(
fi
.
isDir
());
int
lastIndex
=
path
.
lastIndexOf
(
"."
);
QString
extension
(
""
);
if
(
lastIndex
!=
-
1
)
extension
=
path
.
right
(
path
.
length
()
-
lastIndex
);
QString
uuid
=
QUuid
::
createUuid
();
if
(
!
fi
.
exists
()
||
!
pDocumentProxy
)
return
""
;
QString
directoryName
=
UBPersistenceManager
::
teacherGuideDirectory
+
"/"
+
uuid
+
extension
;
QString
destPath
=
pDocumentProxy
->
persistencePath
()
+
"/"
+
directoryName
;
if
(
!
QDir
(
destPath
).
exists
()){
QDir
dir
;
dir
.
mkdir
(
pDocumentProxy
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
teacherGuideDirectory
);
UBFileSystemUtils
::
copyDir
(
path
,
destPath
);
}
return
destPath
;
}
bool
UBPersistenceManager
::
addFileToDocument
(
UBDocumentProxy
*
pDocumentProxy
,
QString
path
,
const
QString
&
subdir
,
...
...
src/core/UBPersistenceManager.h
View file @
f7896e14
...
...
@@ -83,6 +83,7 @@ class UBPersistenceManager : public QObject
QString
teacherGuideAbsoluteObjectPath
(
UBDocumentProxy
*
pDocumentProxy
);
QString
addObjectToTeacherGuideDirectory
(
UBDocumentProxy
*
proxy
,
QString
pPath
);
QString
addWidgetToTeacherGuideDirectory
(
UBDocumentProxy
*
pDocumentProxy
,
QString
pPath
);
virtual
void
addDirectoryContentToDocument
(
const
QString
&
documentRootFolder
,
UBDocumentProxy
*
pDocument
);
...
...
src/gui/UBTeacherGuideWidget.cpp
View file @
f7896e14
...
...
@@ -565,7 +565,7 @@ void UBTeacherGuidePresentationWidget::showData( QVector<tUBGEElementNode*> data
}
else
if
(
element
->
name
==
"media"
)
{
createMediaButtonItem
();
QTreeWidgetItem
*
newWidgetItem
=
new
QTreeWidgetItem
(
mpMediaSwitchItem
);
QTreeWidgetItem
*
newWidgetItem
=
new
QTreeWidgetItem
(
mpMediaSwitchItem
);
newWidgetItem
->
setIcon
(
0
,
QIcon
(
":images/teacherGuide/"
+
element
->
attributes
.
value
(
"mediaType"
)
+
"_24x24.svg"
));
newWidgetItem
->
setText
(
0
,
element
->
attributes
.
value
(
"title"
));
newWidgetItem
->
setData
(
0
,
tUBTGTreeWidgetItemRole_HasAnAction
,
tUBTGActionAssociateOnClickItem_MEDIA
);
...
...
@@ -582,7 +582,8 @@ void UBTeacherGuidePresentationWidget::showData( QVector<tUBGEElementNode*> data
QTreeWidgetItem
*
mediaItem
=
new
QTreeWidgetItem
(
newWidgetItem
);
mediaItem
->
setData
(
0
,
tUBTGTreeWidgetItemRole_HasAnAction
,
tUBTGActionAssociateOnClickItem_NONE
);
UBTGMediaWidget
*
mediaWidget
=
new
UBTGMediaWidget
(
element
->
attributes
.
value
(
"relativePath"
),
newWidgetItem
);
qDebug
()
<<
element
->
attributes
.
value
(
"mediaType"
);
UBTGMediaWidget
*
mediaWidget
=
new
UBTGMediaWidget
(
element
->
attributes
.
value
(
"relativePath"
),
newWidgetItem
,
0
,
element
->
attributes
.
value
(
"mediaType"
).
contains
(
"flash"
));
newWidgetItem
->
setExpanded
(
false
);
mpTreeWidget
->
setItemWidget
(
mediaItem
,
0
,
mediaWidget
);
}
...
...
src/gui/UBTeacherGuideWidgetsTools.cpp
View file @
f7896e14
...
...
@@ -304,7 +304,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
setMinimumHeight
(
250
);
}
UBTGMediaWidget
::
UBTGMediaWidget
(
QString
mediaPath
,
QTreeWidgetItem
*
widget
,
QWidget
*
parent
,
const
char
*
name
)
:
QStackedWidget
(
parent
)
UBTGMediaWidget
::
UBTGMediaWidget
(
QString
mediaPath
,
QTreeWidgetItem
*
widget
,
QWidget
*
parent
,
bool
forceFlashMediaType
,
const
char
*
name
)
:
QStackedWidget
(
parent
)
,
mpTreeWidgetItem
(
widget
)
,
mpDropMeWidget
(
NULL
)
,
mpWorkWidget
(
NULL
)
...
...
@@ -320,7 +320,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi
setObjectName
(
name
);
mMediaPath
=
UBApplication
::
boardController
->
selectedDocument
()
->
persistencePath
()
+
"/"
+
mediaPath
;
setAcceptDrops
(
false
);
createWorkWidget
();
createWorkWidget
(
forceFlashMediaType
);
setFixedHeight
(
200
);
}
...
...
@@ -343,8 +343,7 @@ void UBTGMediaWidget::initializeWithDom(QDomElement element)
mIsInitializationMode
=
true
;
setAcceptDrops
(
false
);
mMediaPath
=
UBApplication
::
boardController
->
selectedDocument
()
->
persistencePath
()
+
"/"
+
element
.
attribute
(
"relativePath"
);
qDebug
()
<<
mMediaPath
;
createWorkWidget
();
createWorkWidget
(
element
.
attribute
(
"mediaType"
).
contains
(
"flash"
));
setFixedHeight
(
200
);
mpTitle
->
setInitialText
(
element
.
attribute
(
"title"
));
mIsInitializationMode
=
false
;
...
...
@@ -369,8 +368,12 @@ void UBTGMediaWidget::hideEvent(QHideEvent* event)
void
UBTGMediaWidget
::
showEvent
(
QShowEvent
*
event
)
{
QWidget
::
showEvent
(
event
);
if
(
mpWebView
)
mpWebView
->
load
(
QUrl
(
mMediaPath
+
"/index.htm"
));
if
(
mpWebView
){
QString
indexPath
=
mMediaPath
+
"/index.htm"
;
if
(
!
QFile
::
exists
(
indexPath
))
indexPath
+=
"l"
;
mpWebView
->
load
(
QUrl
::
fromLocalFile
(
indexPath
));
}
}
tUBGEElementNode
*
UBTGMediaWidget
::
saveData
()
...
...
@@ -392,7 +395,7 @@ void UBTGMediaWidget::dragEnterEvent(QDragEnterEvent *event)
event
->
accept
();
}
void
UBTGMediaWidget
::
createWorkWidget
()
void
UBTGMediaWidget
::
createWorkWidget
(
bool
forceFlashMediaType
)
{
QString
mimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
mMediaPath
);
bool
setMedia
=
true
;
...
...
@@ -419,12 +422,32 @@ void UBTGMediaWidget::createWorkWidget()
mpMediaLabelWidget
->
setPixmap
(
pixmap
);
mpMediaLabelWidget
->
setScaledContents
(
true
);
}
else
if
(
mimeType
.
contains
(
"
application"
)
){
else
if
(
mimeType
.
contains
(
"
widget"
)
&&
!
forceFlashMediaType
){
mMediaType
=
"w3c"
;
if
(
!
(
mIsPresentationMode
||
mIsInitializationMode
)){
mMediaPath
=
UBPersistenceManager
::
persistenceManager
()
->
addWidgetToTeacherGuideDirectory
(
proxyDocument
,
mMediaPath
);
}
mpWebView
=
new
UBDraggableWeb
(
mMediaPath
);
mpWebView
->
setAcceptDrops
(
false
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
JavaEnabled
,
true
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
PluginsEnabled
,
true
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
LocalStorageDatabaseEnabled
,
true
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
OfflineWebApplicationCacheEnabled
,
true
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
OfflineStorageDatabaseEnabled
,
true
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
JavascriptCanAccessClipboard
,
true
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
DnsPrefetchEnabled
,
true
);
QString
indexPath
=
mMediaPath
+
"/index.htm"
;
if
(
!
QFile
::
exists
(
indexPath
))
indexPath
+=
"l"
;
mpWebView
->
load
(
QUrl
::
fromLocalFile
(
indexPath
));
}
else
if
(
mimeType
.
contains
(
"x-shockwave-flash"
)
||
forceFlashMediaType
){
mMediaType
=
"flash"
;
if
(
!
(
mIsPresentationMode
||
mIsInitializationMode
)){
QDir
baseW3CDirectory
(
UBPersistenceManager
::
persistenceManager
()
->
teacherGuideAbsoluteObjectPath
(
proxyDocument
));
mMediaPath
=
UBGraphicsW3CWidgetItem
::
createNPAPIWrapperInDir
(
mMediaPath
,
baseW3CDirectory
,
mimeType
,
QSize
(
100
,
100
),
QUuid
::
createUuid
());
}
qDebug
()
<<
mMediaPath
;
mpWebView
=
new
UBDraggableWeb
(
mMediaPath
);
mpWebView
->
setAcceptDrops
(
false
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
JavaEnabled
,
true
);
...
...
@@ -434,8 +457,10 @@ void UBTGMediaWidget::createWorkWidget()
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
OfflineStorageDatabaseEnabled
,
true
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
JavascriptCanAccessClipboard
,
true
);
mpWebView
->
settings
()
->
setAttribute
(
QWebSettings
::
DnsPrefetchEnabled
,
true
);
mpWebView
->
load
(
QUrl
(
mMediaPath
+
"/index.htm"
));
QString
indexPath
=
mMediaPath
+
"/index.htm"
;
if
(
!
QFile
::
exists
(
indexPath
))
indexPath
+=
"l"
;
mpWebView
->
load
(
QUrl
::
fromLocalFile
(
indexPath
));
}
else
{
qDebug
()
<<
"createWorkWidget mime type not handled"
<<
mimeType
;
...
...
src/gui/UBTeacherGuideWidgetsTools.h
View file @
f7896e14
...
...
@@ -137,7 +137,7 @@ class UBTGMediaWidget : public QStackedWidget , public iUBTGSaveData
Q_OBJECT
public
:
UBTGMediaWidget
(
QTreeWidgetItem
*
widget
=
0
,
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTGMediaWidget"
);
UBTGMediaWidget
(
QString
mediaPath
,
QTreeWidgetItem
*
widget
=
0
,
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTGMediaWidget"
);
UBTGMediaWidget
(
QString
mediaPath
,
QTreeWidgetItem
*
widget
=
0
,
QWidget
*
parent
=
0
,
bool
forceFlashMediaType
=
false
,
const
char
*
name
=
"UBTGMediaWidget"
);
~
UBTGMediaWidget
();
tUBGEElementNode
*
saveData
();
void
initializeWithDom
(
QDomElement
element
);
...
...
@@ -152,7 +152,7 @@ protected:
private
:
void
parseMimeData
(
const
QMimeData
*
pMimeData
);
void
createWorkWidget
();
void
createWorkWidget
(
bool
forceFlashMediaType
=
false
);
void
updateSize
();
QTreeWidgetItem
*
mpTreeWidgetItem
;
...
...
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