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
34e778e1
Commit
34e778e1
authored
Jan 03, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first draft of 'nouvelle barre du prof'
parent
304c97f3
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
243 additions
and
199 deletions
+243
-199
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+4
-6
UBDockPaletteWidget.cpp
src/gui/UBDockPaletteWidget.cpp
+3
-0
UBDockPaletteWidget.h
src/gui/UBDockPaletteWidget.h
+4
-0
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+126
-3
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+28
-0
UBVideoPlayer.h
src/gui/UBVideoPlayer.h
+5
-0
gui.pri
src/gui/gui.pri
+46
-42
UBYouTubePublisher.cpp
src/podcast/youtube/UBYouTubePublisher.cpp
+1
-1
UBWebController.cpp
src/web/UBWebController.cpp
+6
-130
UBWebController.h
src/web/UBWebController.h
+16
-13
web.pri
src/web/web.pri
+4
-4
No files found.
src/board/UBBoardPaletteManager.cpp
View file @
34e778e1
...
...
@@ -199,6 +199,10 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mLeftPalette
->
registerWidget
(
mpPageNavigWidget
);
mLeftPalette
->
addTab
(
mpPageNavigWidget
);
// The teacher bar widget will always be there
mLeftPalette
->
registerWidget
(
mpTeacherBarWidget
);
mLeftPalette
->
addTab
(
mpTeacherBarWidget
);
mLeftPalette
->
connectSignals
();
mRightPalette
=
new
UBRightPalette
(
mContainer
);
...
...
@@ -207,9 +211,6 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mRightPalette
->
addTab
(
mpLibWidget
);
// The cache widget will be visible only if a cache is put on the page
mRightPalette
->
registerWidget
(
mpCachePropWidget
);
// The teacher bar widget will always be there
mRightPalette
->
registerWidget
(
mpTeacherBarWidget
);
mRightPalette
->
addTab
(
mpTeacherBarWidget
);
// The download widget will be part of the right palette but
// will become visible only when the first download starts
mRightPalette
->
registerWidget
(
mpDownloadWidget
);
...
...
@@ -820,9 +821,6 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
}
else
mKeyboardPalette
->
setParent
(
0
);
// mKeyboardPalette->update();
}
}
break
;
...
...
src/gui/UBDockPaletteWidget.cpp
View file @
34e778e1
...
...
@@ -27,6 +27,9 @@ QString UBDockPaletteWidget::name()
return
mName
;
}
/**
* When a widget registers a mode it means that it would be displayed on that mode
*/
void
UBDockPaletteWidget
::
registerMode
(
eUBDockPaletteWidgetMode
mode
)
{
if
(
!
mRegisteredModes
.
contains
(
mode
))
...
...
src/gui/UBDockPaletteWidget.h
View file @
34e778e1
...
...
@@ -5,6 +5,10 @@
#include <QPixmap>
#include <QString>
/**
* This enum defines the different mode availables.
*/
typedef
enum
{
eUBDockPaletteWidget_BOARD
,
...
...
src/gui/UBTeacherBarWidget.cpp
View file @
34e778e1
...
...
@@ -32,6 +32,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
,
mpAction1
(
NULL
)
,
mpAction2
(
NULL
)
,
mpAction3
(
NULL
)
,
mpDropMediaZone
(
NULL
)
,
mpContainer
(
NULL
)
,
mpContainerLayout
(
NULL
)
{
...
...
@@ -122,6 +123,10 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
mpLayout
->
addWidget
(
mpAction2
);
mpLayout
->
addWidget
(
mpAction3
);
// Media
mpDropMediaZone
=
new
UBTeacherBarDropMediaZone
();
mpLayout
->
addWidget
(
mpDropMediaZone
);
populateCombos
();
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneWillChange
()),
this
,
SLOT
(
saveContent
()));
...
...
@@ -142,6 +147,11 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
UBTeacherBarWidget
::~
UBTeacherBarWidget
()
{
if
(
NULL
!=
mpDropMediaZone
)
{
delete
mpDropMediaZone
;
mpDropMediaZone
=
NULL
;
}
if
(
NULL
!=
mpAction3
)
{
delete
mpAction3
;
...
...
@@ -356,9 +366,7 @@ UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent
mpTeacherLayout
=
new
QHBoxLayout
();
//TODO: I'm not able to translate this string using the normal way *qm file why?
mpTeacherLabel
=
new
QLabel
(
tr
(
"Teacher"
),
this
);
// mpTeacherLabel = new QLabel(tr("Enseignant"), this);
mpTeacherLabel
->
setAlignment
(
Qt
::
AlignTop
);
mpTeacher
=
new
QTextEdit
(
this
);
mpTeacher
->
setObjectName
(
"TeacherStudentBox"
);
...
...
@@ -369,7 +377,6 @@ UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent
mpStudentLayout
=
new
QHBoxLayout
();
mpStudentLabel
=
new
QLabel
(
tr
(
"Student"
),
this
);
// mpStudentLabel = new QLabel(tr("Élève"), this);
mpStudentLabel
->
setAlignment
(
Qt
::
AlignTop
);
mpStudent
=
new
QTextEdit
(
this
);
mpStudent
->
setObjectName
(
"TeacherStudentBox"
);
...
...
@@ -452,3 +459,119 @@ QTextEdit* UBTeacherStudentAction::student()
{
return
mpStudent
;
}
#include "gui/UBMediaPlayer.h"
#include "gui/UBVideoPlayer.h"
#include "frameworks/UBFileSystemUtils.h"
UBTeacherBarDropMediaZone
::
UBTeacherBarDropMediaZone
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
mpTitleLabel
(
NULL
)
,
mpImageTab
(
NULL
)
,
mpTabWidget
(
NULL
)
,
mpLayout
(
NULL
)
{
setObjectName
(
name
);
setAcceptDrops
(
true
);
setAttribute
(
Qt
::
WA_StyledBackground
,
true
);
setStyleSheet
(
UBApplication
::
globalStyleSheet
());
// Create the GUI
mpLayout
=
new
QVBoxLayout
(
this
);
setLayout
(
mpLayout
);
mpImageTab
=
new
QLabel
();
mpVideoTab
=
new
UBMediaPlayer
();
mpAudioTab
=
new
UBMediaPlayer
();
mpTitleLabel
=
new
QLabel
(
tr
(
"Drop media here"
));
mpLayout
->
addWidget
(
mpTitleLabel
);
mpTabWidget
=
new
QTabWidget
();
mpTabWidget
->
setMinimumHeight
(
200
);
mpTabWidget
->
addTab
(
mpImageTab
,
QIcon
(
":images/toolbar/extraTool.png"
),
""
);
mpTabWidget
->
addTab
(
mpVideoTab
,
QIcon
(
":images/libpalette/movieIcon.svg"
),
""
);
mpTabWidget
->
addTab
(
mpAudioTab
,
QIcon
(
":images/libpalette/soundIcon.svg"
),
""
);
mpLayout
->
addWidget
(
mpTabWidget
);
}
UBTeacherBarDropMediaZone
::~
UBTeacherBarDropMediaZone
()
{
if
(
NULL
!=
mpTitleLabel
)
{
delete
mpTitleLabel
;
mpTitleLabel
=
NULL
;
}
if
(
NULL
!=
mpImageTab
)
{
delete
mpImageTab
;
mpImageTab
=
NULL
;
}
if
(
NULL
!=
mpVideoTab
)
{
delete
mpVideoTab
;
mpVideoTab
=
NULL
;
}
if
(
NULL
!=
mpAudioTab
)
{
delete
mpAudioTab
;
mpAudioTab
=
NULL
;
}
if
(
NULL
!=
mpTabWidget
)
{
delete
mpTabWidget
;
mpTabWidget
=
NULL
;
}
if
(
NULL
!=
mpLayout
)
{
delete
mpLayout
;
mpLayout
=
NULL
;
}
}
void
UBTeacherBarDropMediaZone
::
dragEnterEvent
(
QDragEnterEvent
*
pEvent
)
{
setBackgroundRole
(
QPalette
::
Highlight
);
pEvent
->
acceptProposedAction
();
}
void
UBTeacherBarDropMediaZone
::
dragLeaveEvent
(
QDragLeaveEvent
*
pEvent
)
{
setBackgroundRole
(
QPalette
::
Dark
);
pEvent
->
accept
();
}
void
UBTeacherBarDropMediaZone
::
dropEvent
(
QDropEvent
*
pEvent
)
{
setBackgroundRole
(
QPalette
::
Dark
);
if
(
pEvent
->
mimeData
()
->
hasHtml
())
qDebug
()
<<
pEvent
->
mimeData
()
->
html
();
if
(
pEvent
->
mimeData
()
->
hasUrls
())
qDebug
()
<<
pEvent
->
mimeData
()
->
urls
();
if
(
pEvent
->
mimeData
()
->
hasText
())
qDebug
()
<<
pEvent
->
mimeData
()
->
text
();
QString
mimeType
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
pEvent
->
mimeData
()
->
urls
().
at
(
0
).
toLocalFile
());
if
(
mimeType
.
contains
(
"image"
)){
QPixmap
pix
=
QPixmap
(
pEvent
->
mimeData
()
->
urls
().
at
(
0
).
toLocalFile
());
mpImageTab
->
setPixmap
(
pix
);
mpTabWidget
->
setCurrentWidget
(
mpImageTab
);
}
else
if
(
mimeType
.
contains
(
"video"
)){
mpVideoTab
->
setFile
(
pEvent
->
mimeData
()
->
urls
().
at
(
0
).
toLocalFile
());
mpVideoTab
->
playPause
();
mpTabWidget
->
setCurrentWidget
(
mpVideoTab
);
}
else
if
(
mimeType
.
contains
(
"audio"
)){
mpVideoTab
->
setFile
(
pEvent
->
mimeData
()
->
urls
().
at
(
0
).
toLocalFile
());
mpVideoTab
->
playPause
();
mpTabWidget
->
setCurrentWidget
(
mpAudioTab
);
}
else
{
qWarning
()
<<
"bad idea to come here"
;
}
pEvent
->
acceptProposedAction
();
}
void
UBTeacherBarDropMediaZone
::
dragMoveEvent
(
QDragMoveEvent
*
pEvent
)
{
pEvent
->
acceptProposedAction
();
}
src/gui/UBTeacherBarWidget.h
View file @
34e778e1
#ifndef UBTEACHERBARWIDGET_H
#define UBTEACHERBARWIDGET_H
class
UBMediaPlayer
;
class
UBVideoPlayer
;
#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
...
...
@@ -39,6 +42,30 @@ private:
QHBoxLayout
*
mpStudentLayout
;
};
class
UBTeacherBarDropMediaZone
:
public
QWidget
{
Q_OBJECT
public
:
UBTeacherBarDropMediaZone
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTeacherBarDropMediaZone"
);
~
UBTeacherBarDropMediaZone
();
private
:
QLabel
*
mpTitleLabel
;
QLabel
*
mpImageTab
;
UBMediaPlayer
*
mpVideoTab
;
UBMediaPlayer
*
mpAudioTab
;
QTabWidget
*
mpTabWidget
;
QVBoxLayout
*
mpLayout
;
protected
:
void
dragEnterEvent
(
QDragEnterEvent
*
pEvent
);
void
dropEvent
(
QDropEvent
*
pEvent
);
void
dragMoveEvent
(
QDragMoveEvent
*
pEvent
);
void
dragLeaveEvent
(
QDragLeaveEvent
*
pEvent
);
};
class
UBTeacherBarWidget
:
public
UBDockPaletteWidget
{
Q_OBJECT
...
...
@@ -75,6 +102,7 @@ private:
UBTeacherStudentAction
*
mpAction1
;
UBTeacherStudentAction
*
mpAction2
;
UBTeacherStudentAction
*
mpAction3
;
UBTeacherBarDropMediaZone
*
mpDropMediaZone
;
QWidget
*
mpContainer
;
QVBoxLayout
*
mpContainerLayout
;
};
...
...
src/gui/UBVideoPlayer.h
View file @
34e778e1
...
...
@@ -35,6 +35,11 @@ class UBVideoPlayer : public QWidget
return
mVideoPlayer
;
}
void
loadMedia
(
QUrl
url
)
{
mVideoPlayer
->
load
(
Phonon
::
MediaSource
(
url
));
}
protected
:
Phonon
::
VideoPlayer
*
mVideoPlayer
;
...
...
src/gui/gui.pri
View file @
34e778e1
...
...
@@ -26,27 +26,28 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBActionPalette.h \
src/gui/UBFavoriteToolPalette.h \
src/gui/UBKeyboardPalette.h \
src/gui/UBNavigatorPalette.h \
src/gui/UBDocumentNavigator.h \
src/gui/UBDockPalette.h \
src/gui/UBPropertyPalette.h \
src/gui/UBLibNavigatorWidget.h \
src/gui/UBLibItemProperties.h \
src/gui/UBLibActionBar.h \
src/gui/UBLibraryWidget.h \
src/gui/UBLibPathViewer.h \
src/gui/UBUpdateDlg.h \
src/gui/UBDockPaletteWidget.h \
src/gui/UBLeftPalette.h \
src/gui/UBRightPalette.h \
src/gui/UBPageNavigationWidget.h \
src/gui/UBLibWidget.h \
src/gui/UBMagnifer.h \
src/gui/UBCachePropertiesWidget.h \
src/gui/UBTeacherBarWidget.h \
src/gui/UBLibWebView.h \
src/gui/UBDownloadWidget.h \
src/gui/UBDockDownloadWidget.h
src/gui/UBNavigatorPalette.h \
src/gui/UBDocumentNavigator.h \
src/gui/UBDockPalette.h \
src/gui/UBPropertyPalette.h \
src/gui/UBLibNavigatorWidget.h \
src/gui/UBLibItemProperties.h \
src/gui/UBLibActionBar.h \
src/gui/UBLibraryWidget.h \
src/gui/UBLibPathViewer.h \
src/gui/UBUpdateDlg.h \
src/gui/UBDockPaletteWidget.h \
src/gui/UBLeftPalette.h \
src/gui/UBRightPalette.h \
src/gui/UBPageNavigationWidget.h \
src/gui/UBLibWidget.h \
src/gui/UBMagnifer.h \
src/gui/UBCachePropertiesWidget.h \
src/gui/UBTeacherBarWidget.h \
src/gui/UBLibWebView.h \
src/gui/UBDownloadWidget.h \
src/gui/UBDockDownloadWidget.h \
src/gui/UBMediaPlayer.h
SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \
...
...
@@ -75,27 +76,28 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBActionPalette.cpp \
src/gui/UBFavoriteToolPalette.cpp \
src/gui/UBKeyboardPalette.cpp \
src/gui/UBNavigatorPalette.cpp \
src/gui/UBDocumentNavigator.cpp \
src/gui/UBDockPalette.cpp \
src/gui/UBPropertyPalette.cpp \
src/gui/UBLibNavigatorWidget.cpp \
src/gui/UBLibItemProperties.cpp \
src/gui/UBLibActionBar.cpp \
src/gui/UBLibraryWidget.cpp \
src/gui/UBLibPathViewer.cpp \
src/gui/UBUpdateDlg.cpp \
src/gui/UBDockPaletteWidget.cpp \
src/gui/UBLeftPalette.cpp \
src/gui/UBRightPalette.cpp \
src/gui/UBPageNavigationWidget.cpp \
src/gui/UBLibWidget.cpp \
src/gui/UBMagnifer.cpp \
src/gui/UBCachePropertiesWidget.cpp \
src/gui/UBTeacherBarWidget.cpp \
src/gui/UBLibWebView.cpp \
src/gui/UBDownloadWidget.cpp \
src/gui/UBDockDownloadWidget.cpp
src/gui/UBNavigatorPalette.cpp \
src/gui/UBDocumentNavigator.cpp \
src/gui/UBDockPalette.cpp \
src/gui/UBPropertyPalette.cpp \
src/gui/UBLibNavigatorWidget.cpp \
src/gui/UBLibItemProperties.cpp \
src/gui/UBLibActionBar.cpp \
src/gui/UBLibraryWidget.cpp \
src/gui/UBLibPathViewer.cpp \
src/gui/UBUpdateDlg.cpp \
src/gui/UBDockPaletteWidget.cpp \
src/gui/UBLeftPalette.cpp \
src/gui/UBRightPalette.cpp \
src/gui/UBPageNavigationWidget.cpp \
src/gui/UBLibWidget.cpp \
src/gui/UBMagnifer.cpp \
src/gui/UBCachePropertiesWidget.cpp \
src/gui/UBTeacherBarWidget.cpp \
src/gui/UBLibWebView.cpp \
src/gui/UBDownloadWidget.cpp \
src/gui/UBDockDownloadWidget.cpp \
src/gui/UBMediaPlayer.cpp
win32 {
...
...
@@ -123,3 +125,5 @@ linux-g++-64 {
SOURCES += src/gui/UBKeyboardPalette_linux.cpp
}
src/podcast/youtube/UBYouTubePublisher.cpp
View file @
34e778e1
...
...
@@ -24,7 +24,7 @@
#include "core/UBSetting.h"
#include "gui/UBMainWindow.h"
#include "gui/UBVideoPlayer.h"
//
#include "gui/UBVideoPlayer.h"
#include "network/UBNetworkAccessManager.h"
#include "network/UBServerXMLHttpRequest.h"
...
...
src/web/UBWebController.cpp
View file @
34e778e1
...
...
@@ -14,8 +14,6 @@
*/
#include <QtGui>
#include <QDomDocument>
#include <QXmlQuery>
#include "frameworks/UBPlatformUtils.h"
...
...
@@ -62,6 +60,7 @@ UBWebController::UBWebController(UBMainWindow* mainWindow)
// , mKeyboardCurrentPalette(0)
,
mToolsPalettePositionned
(
false
)
,
mDownloadViewIsVisible
(
false
)
{
connect
(
mMainWindow
->
actionWebTools
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
toggleWebToolsPalette
(
bool
)));
...
...
@@ -73,13 +72,11 @@ UBWebController::UBWebController(UBMainWindow* mainWindow)
mToolsPalettePositionnedList
[
i
]
=
false
;
}
connect
(
&
mOEmbedParser
,
SIGNAL
(
oembedParsed
(
QVector
<
sOEmbedContent
>
)),
this
,
SLOT
(
onOEmbedParsed
(
QVector
<
sOEmbedContent
>
)));
// TODO : Comment the next line to continue the Youtube button bugfix
initialiazemOEmbedProviders
();
}
UBWebController
::~
UBWebController
()
{
// NOOP
...
...
@@ -96,6 +93,7 @@ void UBWebController::initialiazemOEmbedProviders()
mOEmbedProviders
<<
"metacafe.com"
;
mOEmbedProviders
<<
"qik.com"
;
mOEmbedProviders
<<
"slideshare"
;
mOEmbedProviders
<<
"5min.com"
;
mOEmbedProviders
<<
"twitpic.com"
;
mOEmbedProviders
<<
"viddler.com"
;
mOEmbedProviders
<<
"vimeo.com"
;
...
...
@@ -328,53 +326,16 @@ void UBWebController::activePageChanged()
mTrapFlashController
->
updateTrapFlashFromPage
((
*
mCurrentWebBrowser
)
->
currentTabWebView
()
->
page
()
->
currentFrame
());
}
mMainWindow
->
actionWebTrap
->
setChecked
(
false
);
QUrl
latestUrl
=
(
*
mCurrentWebBrowser
)
->
currentTabWebView
()
->
url
();
// TODO : Uncomment the next line to continue the youtube button bugfix
//UBApplication::mainWindow->actionWebOEmbed->setEnabled(hasEmbeddedContent());
// And remove this line once the previous one is uncommented
UBApplication
::
mainWindow
->
actionWebOEmbed
->
setEnabled
(
isOEmbedable
(
latestUrl
));
UBApplication
::
mainWindow
->
actionEduMedia
->
setEnabled
(
isEduMedia
(
latestUrl
));
emit
activeWebPageChanged
((
*
mCurrentWebBrowser
)
->
currentTabWebView
());
}
}
bool
UBWebController
::
hasEmbeddedContent
()
{
bool
bHasContent
=
false
;
if
(
mCurrentWebBrowser
){
QString
html
=
(
*
mCurrentWebBrowser
)
->
currentTabWebView
()
->
webPage
()
->
mainFrame
()
->
toHtml
();
// search the presence of "+oembed"
QString
query
=
"
\\
+oembed([^>]*)>"
;
QRegExp
exp
(
query
);
exp
.
indexIn
(
html
);
QStringList
results
=
exp
.
capturedTexts
();
if
(
2
<=
results
.
size
()
&&
""
!=
results
.
at
(
1
)){
// An embedded content has been found, no need to check the other ones
bHasContent
=
true
;
}
else
{
QList
<
QUrl
>
contentUrls
;
lookForEmbedContent
(
&
html
,
"embed"
,
"src"
,
&
contentUrls
);
lookForEmbedContent
(
&
html
,
"video"
,
"src"
,
&
contentUrls
);
lookForEmbedContent
(
&
html
,
"object"
,
"data"
,
&
contentUrls
);
// TODO: check the hidden iFrame
if
(
!
contentUrls
.
empty
()){
bHasContent
=
true
;
}
}
}
return
bHasContent
;
}
QPixmap
UBWebController
::
captureCurrentPage
()
{
...
...
@@ -580,12 +541,9 @@ void UBWebController::showTabAtTop(bool attop)
void
UBWebController
::
captureoEmbed
()
{
if
(
mCurrentWebBrowser
&&
(
*
mCurrentWebBrowser
)
&&
(
*
mCurrentWebBrowser
)
->
currentTabWebView
()){
// TODO : Uncomment the next lines to continue the youtube button bugfix
// getEmbeddableContent();
// And comment from here
if
(
mCurrentWebBrowser
&&
(
*
mCurrentWebBrowser
)
&&
(
*
mCurrentWebBrowser
)
->
currentTabWebView
())
{
QWebView
*
webView
=
(
*
mCurrentWebBrowser
)
->
currentTabWebView
();
QUrl
currentUrl
=
webView
->
url
();
...
...
@@ -599,56 +557,9 @@ void UBWebController::captureoEmbed()
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
// --> Until here
}
}
void
UBWebController
::
lookForEmbedContent
(
QString
*
pHtml
,
QString
tag
,
QString
attribute
,
QList
<
QUrl
>
*
pList
)
{
if
(
NULL
!=
pHtml
&&
NULL
!=
pList
){
QVector
<
QString
>
urlsFound
;
// Check for <embed> content
QRegExp
exp
(
QString
(
"<%0(.*)"
).
arg
(
tag
));
exp
.
indexIn
(
*
pHtml
);
QStringList
strl
=
exp
.
capturedTexts
();
if
(
2
<=
strl
.
size
()
&&
strl
.
at
(
1
)
!=
""
){
// Here we call this regular expression:
// src\s?=\s?['"]([^'"]*)['"]
// It says: give me all characters that are after src=" (or src = ")
QRegExp
src
(
QString
(
"%0
\\
s?=
\\
s?['
\"
]([^'
\"
]*)['
\"
]"
).
arg
(
attribute
));
for
(
int
i
=
1
;
i
<
strl
.
size
();
i
++
){
src
.
indexIn
(
strl
.
at
(
i
));
QStringList
urls
=
src
.
capturedTexts
();
if
(
2
<=
urls
.
size
()
&&
urls
.
at
(
1
)
!=
""
&&
!
urlsFound
.
contains
(
urls
.
at
(
1
))){
urlsFound
<<
urls
.
at
(
1
);
pList
->
append
(
QUrl
(
urls
.
at
(
1
)));
}
}
}
}
}
void
UBWebController
::
checkForOEmbed
(
QString
*
pHtml
)
{
mOEmbedParser
.
parse
(
*
pHtml
);
}
void
UBWebController
::
getEmbeddableContent
()
{
// Get the source code of the page
if
(
mCurrentWebBrowser
){
QNetworkAccessManager
*
pNam
=
(
*
mCurrentWebBrowser
)
->
currentTabWebView
()
->
webPage
()
->
networkAccessManager
();
if
(
NULL
!=
pNam
){
QString
html
=
(
*
mCurrentWebBrowser
)
->
currentTabWebView
()
->
webPage
()
->
mainFrame
()
->
toHtml
();
mOEmbedParser
.
setNetworkAccessManager
(
pNam
);
// First, we have to check if there is some oembed content
checkForOEmbed
(
&
html
);
// Note: The other contents will be verified once the oembed ones have been checked
}
}
}
void
UBWebController
::
captureEduMedia
()
{
...
...
@@ -809,38 +720,3 @@ void UBWebController::cut()
act
->
trigger
();
}
}
void
UBWebController
::
onOEmbedParsed
(
QVector
<
sOEmbedContent
>
contents
)
{
QList
<
QUrl
>
urls
;
foreach
(
sOEmbedContent
cnt
,
contents
){
urls
<<
QUrl
(
cnt
.
url
);
}
// TODO : Implement this
//lookForEmbedContent(&html, "embed", "src", &urls);
//lookForEmbedContent(&html, "video", "src", &contentUrls);
//lookForEmbedContent(&html, "object", "data", &contentUrls);
// TODO: check the hidden iFrame
if
(
!
urls
.
empty
()){
QUrl
contentUrl
;
// The selected content url
if
(
1
==
urls
.
size
()){
contentUrl
=
urls
.
at
(
0
);
}
else
{
// TODO : Display a dialog box asking the user which content to get and set contentUrl to the selected content
}
UBGraphicsW3CWidgetItem
*
widget
=
UBApplication
::
boardController
->
activeScene
()
->
addOEmbed
(
contentUrl
);
if
(
widget
)
{
UBApplication
::
applicationController
->
showBoard
();
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
}
src/web/UBWebController.h
View file @
34e778e1
...
...
@@ -19,7 +19,6 @@
#include <QtGui>
#include <QtWebKit>
#include "web/UBOEmbedParser.h"
class
WBBrowserWindow
;
class
UBApplication
;
...
...
@@ -31,6 +30,7 @@ class WBWebView;
class
UBServerXMLHttpRequest
;
//class UBKeyboardPalette;
class
UBWebController
:
public
QObject
{
Q_OBJECT
;
...
...
@@ -88,9 +88,6 @@ class UBWebController : public QObject
void
captureEduMedia
();
bool
isOEmbedable
(
const
QUrl
&
pUrl
);
bool
hasEmbeddedContent
();
void
getEmbeddableContent
();
bool
isEduMedia
(
const
QUrl
&
pUrl
);
void
copy
();
...
...
@@ -98,36 +95,41 @@ class UBWebController : public QObject
void
cut
();
private
:
void
initialiazemOEmbedProviders
();
void
tutorialWebInstance
();
void
webBrowserInstance
();
void
paraschoolWebInstance
();
void
lookForEmbedContent
(
QString
*
pHtml
,
QString
tag
,
QString
attribute
,
QList
<
QUrl
>*
pList
);
void
checkForOEmbed
(
QString
*
pHtml
);
QStackedWidget
mStackedWidget
[
TotalNumberOfWebInstances
];
UBMainWindow
*
mMainWindow
;
WBBrowserWindow
*
mWebBrowserList
[
TotalNumberOfWebInstances
];
WBBrowserWindow
**
mCurrentWebBrowser
;
QWidget
*
mBrowserWidget
;
UBTrapFlashController
*
mTrapFlashController
;
UBWebToolsPalette
**
mToolsCurrentPalette
;
UBWebToolsPalette
*
mToolsPaletteList
[
TotalNumberOfWebInstances
];
// UBKeyboardPalette** mKeyboardCurrentPalette;
// UBKeyboardPalette* mKeyboardPaletteList[TotalNumberOfWebInstances];
bool
mToolsPalettePositionned
;
bool
mToolsPalettePositionnedList
[
TotalNumberOfWebInstances
];
bool
mDownloadViewIsVisible
;
QStringList
mOEmbedProviders
;
UBOEmbedParser
mOEmbedParser
;
void
initialiazemOEmbedProviders
();
void
tutorialWebInstance
();
void
webBrowserInstance
();
void
paraschoolWebInstance
();
private
slots
:
void
activePageChanged
();
void
trapFlash
();
void
toggleWebTrap
(
bool
checked
);
void
onOEmbedParsed
(
QVector
<
sOEmbedContent
>
contents
);
// void showKeyboard(bool checked);
signals
:
...
...
@@ -137,6 +139,7 @@ class UBWebController : public QObject
* @param pCapturedPixmap QPixmap corresponding to the capture.
*/
void
imageCaptured
(
const
QPixmap
&
pCapturedPixmap
,
bool
pageMode
,
const
QUrl
&
source
);
void
activeWebPageChanged
(
WBWebView
*
pWebView
);
};
...
...
src/web/web.pri
View file @
34e778e1
...
...
@@ -26,8 +26,7 @@ HEADERS += src/web/UBWebController.h \
src/web/browser/WBUrlLineEdit.h \
src/web/browser/WBWebView.h \
src/web/browser/WBHistory.h \
src/web/browser/WBWebTrapWebView.h \
src/web/UBOEmbedParser.h
src/web/browser/WBWebTrapWebView.h
SOURCES += src/web/UBWebController.cpp \
src/web/UBTrapFlashController.cpp \
...
...
@@ -47,7 +46,8 @@ SOURCES += src/web/UBWebController.cpp \
src/web/browser/WBUrlLineEdit.cpp \
src/web/browser/WBWebView.cpp \
src/web/browser/WBHistory.cpp \
src/web/browser/WBWebTrapWebView.cpp \
src/web/UBOEmbedParser.cpp
src/web/browser/WBWebTrapWebView.cpp
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