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
021617ee
Commit
021617ee
authored
Aug 17, 2012
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sankore 942 Trap flash content
parent
38d759fd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
13 deletions
+51
-13
UBBoardController.cpp
src/board/UBBoardController.cpp
+18
-8
UBBoardController.h
src/board/UBBoardController.h
+5
-2
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+18
-1
UBFeaturesController.h
src/board/UBFeaturesController.h
+2
-0
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+4
-1
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+4
-1
No files found.
src/board/UBBoardController.cpp
View file @
021617ee
...
...
@@ -53,6 +53,8 @@
#include "domain/UBPageSizeUndoCommand.h"
#include "domain/UBGraphicsGroupContainerItem.h"
#include "domain/UBItem.h"
#include "board/UBFeaturesController.h"
#include "gui/UBFeaturesWidget.h"
#include "tools/UBToolsManager.h"
...
...
@@ -897,7 +899,7 @@ void UBBoardController::groupButtonClicked()
}
}
void
UBBoardController
::
downloadURL
(
const
QUrl
&
url
,
const
QPointF
&
pPos
,
const
QSize
&
pSize
,
bool
isBackground
)
void
UBBoardController
::
downloadURL
(
const
QUrl
&
url
,
const
QPointF
&
pPos
,
const
QSize
&
pSize
,
bool
isBackground
,
bool
internalData
)
{
qDebug
()
<<
"something has been dropped on the board! Url is: "
<<
url
.
toString
();
QString
sUrl
=
url
.
toString
();
...
...
@@ -922,7 +924,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
if
(
shouldLoadFileData
)
file
.
open
(
QIODevice
::
ReadOnly
);
downloadFinished
(
true
,
url
,
contentType
,
file
.
readAll
(),
pPos
,
pSize
,
isBackground
);
downloadFinished
(
true
,
url
,
contentType
,
file
.
readAll
(),
pPos
,
pSize
,
isBackground
,
internalData
);
if
(
shouldLoadFileData
)
file
.
close
();
...
...
@@ -945,7 +947,9 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
}
UBItem
*
UBBoardController
::
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
)
UBItem
*
UBBoardController
::
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
,
bool
internalData
)
{
QString
mimeType
=
pContentTypeHeader
;
...
...
@@ -1155,7 +1159,10 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
else
size
=
mActiveScene
->
nominalSize
()
*
.8
;
Q_UNUSED
(
internalData
)
QString
widgetUrl
=
UBGraphicsW3CWidgetItem
::
createNPAPIWrapper
(
sUrl
,
mimeType
,
size
);
emit
npapiWidgetCreated
(
widgetUrl
);
if
(
widgetUrl
.
length
()
>
0
)
{
...
...
@@ -1339,7 +1346,6 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
mActiveSceneIndex
=
index
;
setDocument
(
pDocumentProxy
,
forceReload
);
updateSystemScaleFactor
();
mControlView
->
setScene
(
mActiveScene
);
...
...
@@ -1668,13 +1674,11 @@ void UBBoardController::hide()
UBApplication
::
mainWindow
->
actionLibrary
->
setChecked
(
false
);
}
void
UBBoardController
::
show
()
{
UBApplication
::
mainWindow
->
actionLibrary
->
setChecked
(
false
);
}
void
UBBoardController
::
persistCurrentScene
()
{
if
(
UBPersistenceManager
::
persistenceManager
()
...
...
@@ -1689,7 +1693,6 @@ void UBBoardController::persistCurrentScene()
}
}
void
UBBoardController
::
updateSystemScaleFactor
()
{
qreal
newScaleFactor
=
1.0
;
...
...
@@ -2100,9 +2103,16 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
int
index
=
0
;
const
UBFeaturesMimeData
*
internalMimeData
=
qobject_cast
<
const
UBFeaturesMimeData
*>
(
pMimeData
);
bool
internalData
=
false
;
if
(
internalMimeData
)
{
internalData
=
true
;
}
foreach
(
const
QUrl
url
,
urls
){
QPointF
pos
(
pPos
+
QPointF
(
index
*
15
,
index
*
15
));
downloadURL
(
url
,
pos
);
downloadURL
(
url
,
pos
,
QSize
(),
false
,
internalData
);
index
++
;
}
...
...
src/board/UBBoardController.h
View file @
021617ee
...
...
@@ -189,8 +189,10 @@ class UBBoardController : public UBDocumentContainer
void
firstScene
();
void
lastScene
();
void
groupButtonClicked
();
void
downloadURL
(
const
QUrl
&
url
,
const
QPointF
&
pPos
=
QPointF
(
0
.
0
,
0
.
0
),
const
QSize
&
pSize
=
QSize
(),
bool
isBackground
=
false
);
UBItem
*
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
=
false
);
void
downloadURL
(
const
QUrl
&
url
,
const
QPointF
&
pPos
=
QPointF
(
0
.
0
,
0
.
0
),
const
QSize
&
pSize
=
QSize
(),
bool
isBackground
=
false
,
bool
internalData
=
false
);
UBItem
*
downloadFinished
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
=
false
,
bool
internalData
=
false
);
void
changeBackground
(
bool
isDark
,
bool
isCrossed
);
void
setToolCursor
(
int
tool
);
void
showMessage
(
const
QString
&
message
,
bool
showSpinningWheel
=
false
);
...
...
@@ -236,6 +238,7 @@ class UBBoardController : public UBDocumentContainer
void
documentReorganized
(
int
index
);
void
displayMetadata
(
QMap
<
QString
,
QString
>
metadata
);
void
pageSelectionChanged
(
int
index
);
void
npapiWidgetCreated
(
const
QString
&
Url
);
protected
:
void
setupViews
();
...
...
src/board/UBFeaturesController.cpp
View file @
021617ee
...
...
@@ -154,7 +154,9 @@ void UBFeaturesComputingThread::run()
emit
maxFilesCountEvaluated
(
fsCnt
);
emit
scanStarted
();
curTime
=
QTime
::
currentTime
();
scanAll
(
searchData
,
favoriteSet
);
qDebug
()
<<
"Time on finishing"
<<
curTime
.
msecsTo
(
QTime
::
currentTime
());
emit
scanFinished
();
mMutex
.
lock
();
...
...
@@ -303,6 +305,7 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
connect
(
&
mCThread
,
SIGNAL
(
maxFilesCountEvaluated
(
int
)),
this
,
SIGNAL
(
maxFilesCountEvaluated
(
int
)));
connect
(
&
mCThread
,
SIGNAL
(
scanCategory
(
QString
)),
this
,
SIGNAL
(
scanCategory
(
QString
)));
connect
(
&
mCThread
,
SIGNAL
(
scanPath
(
QString
)),
this
,
SIGNAL
(
scanPath
(
QString
)));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
npapiWidgetCreated
(
QString
)),
this
,
SLOT
(
createNpApiFeature
(
QString
)));
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
startThread
()));
}
...
...
@@ -326,11 +329,20 @@ void UBFeaturesController::startThread()
<<
QPair
<
QUrl
,
QString
>
(
mLibShapesDirectoryPath
,
shapesPath
)
<<
QPair
<
QUrl
,
QString
>
(
mLibInteractiveDirectoryPath
,
interactPath
)
<<
QPair
<
QUrl
,
QString
>
(
trashDirectoryPath
,
trashPath
)
<<
QPair
<
QUrl
,
QString
>
(
mLibSearchDirectoryPath
,
rootPath
+
"/"
+
"Web search"
);
<<
QPair
<
QUrl
,
QString
>
(
mLibSearchDirectoryPath
,
rootPath
+
"/"
+
"Web search"
);
mCThread
.
compute
(
computingData
,
favoriteSet
);
}
void
UBFeaturesController
::
createNpApiFeature
(
const
QString
&
str
)
{
Q_ASSERT
(
QFileInfo
(
str
).
exists
()
&&
QFileInfo
(
str
).
isDir
());
QString
widgetName
=
QFileInfo
(
str
).
fileName
();
featuresModel
->
addItem
(
UBFeature
(
QString
(
appPath
+
"/Web"
),
QImage
(
UBGraphicsWidgetItem
::
iconFilePath
(
QUrl
::
fromLocalFile
(
str
))),
widgetName
,
QUrl
::
fromLocalFile
(
str
),
FEATURE_INTERACTIVE
));
}
void
UBFeaturesController
::
scanFS
()
{
featuresList
->
clear
();
...
...
@@ -502,6 +514,8 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl(const QString &path)
if
(
mimeString
.
contains
(
"application"
))
{
if
(
mimeString
.
contains
(
"application/search"
))
{
fileType
=
FEATURE_SEARCH
;
}
else
if
(
mimeString
.
contains
(
"application/x-shockwave-flash"
))
{
fileType
=
FEATURE_FLASH
;
}
else
{
fileType
=
FEATURE_INTERACTIVE
;
}
...
...
@@ -530,6 +544,8 @@ QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType p
return
QImage
(
UBGraphicsWidgetItem
::
iconFilePath
(
QUrl
::
fromLocalFile
(
path
)));
}
else
if
(
pFType
==
FEATURE_INTERNAL
)
{
return
QImage
(
UBToolsManager
::
manager
()
->
iconFromToolId
(
path
));
}
else
if
(
pFType
==
FEATURE_FLASH
)
{
return
QImage
(
":images/libpalette/FlashIcon.svg"
);
}
else
if
(
pFType
==
FEATURE_AUDIO
)
{
return
QImage
(
":images/libpalette/soundIcon.svg"
);
}
else
if
(
pFType
==
FEATURE_VIDEO
)
{
...
...
@@ -802,6 +818,7 @@ void UBFeaturesController::searchStarted(const QString &pattern, QListView *pOnV
curListModel
=
featuresProxyModel
;
}
else
if
(
pattern
.
size
()
>
1
)
{
// featuresSearchModel->setFilterPrefix(currentElement.getFullVirtualPath());
featuresSearchModel
->
setFilterWildcard
(
"*"
+
pattern
+
"*"
);
pOnView
->
setModel
(
featuresSearchModel
);
featuresSearchModel
->
invalidate
();
...
...
src/board/UBFeaturesController.h
View file @
021617ee
...
...
@@ -78,6 +78,7 @@ enum UBFeatureElementType
FEATURE_AUDIO
,
FEATURE_VIDEO
,
FEATURE_IMAGE
,
FEATURE_FLASH
,
FEATURE_TRASH
,
FEATURE_FAVORITE
,
FEATURE_SEARCH
,
...
...
@@ -192,6 +193,7 @@ signals:
private
slots
:
void
addNewFolder
(
QString
name
);
void
startThread
();
void
createNpApiFeature
(
const
QString
&
str
);
private
:
...
...
src/gui/UBFeaturesWidget.cpp
View file @
021617ee
...
...
@@ -1337,6 +1337,7 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
||
item
.
getType
()
==
FEATURE_AUDIO
||
item
.
getType
()
==
FEATURE_VIDEO
||
item
.
getType
()
==
FEATURE_IMAGE
||
item
.
getType
()
==
FEATURE_FLASH
||
item
.
getType
()
==
FEATURE_INTERNAL
||
item
.
getType
()
==
FEATURE_FOLDER
)
...
...
@@ -1387,7 +1388,9 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn
||
feature
.
getType
()
==
FEATURE_VIDEO
||
feature
.
getType
()
==
FEATURE_IMAGE
;
return
isFile
&&
filterRegExp
().
exactMatch
(
feature
.
getName
()
);
return
isFile
&&
feature
.
getFullVirtualPath
().
contains
(
mFilterPrefix
)
&&
filterRegExp
().
exactMatch
(
feature
.
getName
()
);
}
bool
UBFeaturesPathProxyModel
::
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
...
...
src/gui/UBFeaturesWidget.h
View file @
021617ee
...
...
@@ -394,10 +394,13 @@ class UBFeaturesSearchProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public
:
UBFeaturesSearchProxyModel
(
QObject
*
parent
=
0
)
:
QSortFilterProxyModel
(
parent
)
{;}
UBFeaturesSearchProxyModel
(
QObject
*
parent
=
0
)
:
QSortFilterProxyModel
(
parent
)
,
mFilterPrefix
()
{;}
virtual
~
UBFeaturesSearchProxyModel
()
{}
void
setFilterPrefix
(
const
QString
&
newPrefix
)
{
mFilterPrefix
=
newPrefix
;}
protected
:
virtual
bool
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
;
private
:
QString
mFilterPrefix
;
};
class
UBFeaturesPathProxyModel
:
public
QSortFilterProxyModel
...
...
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