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
d82fdd7d
Commit
d82fdd7d
authored
Aug 02, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
e0d30027
450c7859
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
162 additions
and
111 deletions
+162
-111
script.js
...es/library/interactivities/Ordre lettres.wgt/js/script.js
+1
-1
script.js
...interactivities/Ordre lettres.wgt/locales/fr/js/script.js
+1
-1
exemple.mp3
...tivities/Ordre lettres.wgt/locales/fr/objects/exemple.mp3
+0
-0
script.js
...interactivities/Ordre lettres.wgt/locales/ru/js/script.js
+1
-1
example.mp3
...tivities/Ordre lettres.wgt/locales/ru/objects/example.mp3
+0
-0
beep.mp3
...ibrary/interactivities/Ordre lettres.wgt/objects/beep.mp3
+0
-0
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+4
-0
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+123
-96
UBFeaturesController.h
src/board/UBFeaturesController.h
+9
-5
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+21
-6
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+1
-0
UBTeacherGuideWidget.cpp
src/gui/UBTeacherGuideWidget.cpp
+1
-1
No files found.
resources/library/interactivities/Ordre lettres.wgt/js/script.js
View file @
d82fdd7d
...
@@ -337,7 +337,7 @@ function showExample(){
...
@@ -337,7 +337,7 @@ function showExample(){
var
audio_block
=
$
(
"<div class='audio_block'>"
).
appendTo
(
text
);
var
audio_block
=
$
(
"<div class='audio_block'>"
).
appendTo
(
text
);
$
(
"<div class='play'>"
).
appendTo
(
audio_block
);
$
(
"<div class='play'>"
).
appendTo
(
audio_block
);
$
(
"<div class='replay'>"
).
appendTo
(
audio_block
);
$
(
"<div class='replay'>"
).
appendTo
(
audio_block
);
var
source
=
$
(
"<source/>"
).
attr
(
"src"
,
"objects/beep.
wav
"
);
var
source
=
$
(
"<source/>"
).
attr
(
"src"
,
"objects/beep.
mp3
"
);
var
audio
=
$
(
"<audio>"
).
appendTo
(
audio_block
);
var
audio
=
$
(
"<audio>"
).
appendTo
(
audio_block
);
audio
.
append
(
source
);
audio
.
append
(
source
);
$
(
"<input type='hidden'/>"
).
appendTo
(
audio_block
);
$
(
"<input type='hidden'/>"
).
appendTo
(
audio_block
);
...
...
resources/library/interactivities/Ordre lettres.wgt/locales/fr/js/script.js
View file @
d82fdd7d
...
@@ -331,7 +331,7 @@ function showExample(){
...
@@ -331,7 +331,7 @@ function showExample(){
var
audio_block
=
$
(
"<div class='audio_block'>"
).
appendTo
(
text
);
var
audio_block
=
$
(
"<div class='audio_block'>"
).
appendTo
(
text
);
$
(
"<div class='play'>"
).
appendTo
(
audio_block
);
$
(
"<div class='play'>"
).
appendTo
(
audio_block
);
$
(
"<div class='replay'>"
).
appendTo
(
audio_block
);
$
(
"<div class='replay'>"
).
appendTo
(
audio_block
);
var
source
=
$
(
"<source/>"
).
attr
(
"src"
,
"
../../objects/beep.wav
"
);
var
source
=
$
(
"<source/>"
).
attr
(
"src"
,
"
objects/exemple.mp3
"
);
var
audio
=
$
(
"<audio>"
).
appendTo
(
audio_block
);
var
audio
=
$
(
"<audio>"
).
appendTo
(
audio_block
);
audio
.
append
(
source
);
audio
.
append
(
source
);
$
(
"<input type='hidden'/>"
).
appendTo
(
audio_block
);
$
(
"<input type='hidden'/>"
).
appendTo
(
audio_block
);
...
...
resources/library/interactivities/Ordre lettres.wgt/locales/fr/objects/exemple.mp3
0 → 100644
View file @
d82fdd7d
File added
resources/library/interactivities/Ordre lettres.wgt/locales/ru/js/script.js
View file @
d82fdd7d
...
@@ -332,7 +332,7 @@ function showExample(){
...
@@ -332,7 +332,7 @@ function showExample(){
var
audio_block
=
$
(
"<div class='audio_block'>"
).
appendTo
(
text
);
var
audio_block
=
$
(
"<div class='audio_block'>"
).
appendTo
(
text
);
$
(
"<div class='play'>"
).
appendTo
(
audio_block
);
$
(
"<div class='play'>"
).
appendTo
(
audio_block
);
$
(
"<div class='replay'>"
).
appendTo
(
audio_block
);
$
(
"<div class='replay'>"
).
appendTo
(
audio_block
);
var
source
=
$
(
"<source/>"
).
attr
(
"src"
,
"
../../objects/beep.wav
"
);
var
source
=
$
(
"<source/>"
).
attr
(
"src"
,
"
objects/example.mp3
"
);
var
audio
=
$
(
"<audio>"
).
appendTo
(
audio_block
);
var
audio
=
$
(
"<audio>"
).
appendTo
(
audio_block
);
audio
.
append
(
source
);
audio
.
append
(
source
);
$
(
"<input type='hidden'/>"
).
appendTo
(
audio_block
);
$
(
"<input type='hidden'/>"
).
appendTo
(
audio_block
);
...
...
resources/library/interactivities/Ordre lettres.wgt/locales/ru/objects/example.mp3
0 → 100644
View file @
d82fdd7d
File added
resources/library/interactivities/Ordre lettres.wgt/objects/beep.mp3
0 → 100644
View file @
d82fdd7d
File added
src/board/UBBoardPaletteManager.cpp
View file @
d82fdd7d
...
@@ -884,6 +884,10 @@ void UBBoardPaletteManager::addItemToLibrary()
...
@@ -884,6 +884,10 @@ void UBBoardPaletteManager::addItemToLibrary()
#ifdef USE_WEB_WIDGET
#ifdef USE_WEB_WIDGET
mpLibWidget
->
libNavigator
()
->
libraryWidget
()
->
libraryController
()
->
importImageOnLibrary
(
image
);
mpLibWidget
->
libNavigator
()
->
libraryWidget
()
->
libraryController
()
->
importImageOnLibrary
(
image
);
#else
QDateTime
now
=
QDateTime
::
currentDateTime
();
QString
capturedName
=
tr
(
"CapturedImage"
)
+
"-"
+
now
.
toString
(
"dd-MM-yyyy hh-mm-ss"
)
+
".png"
;
mpFeaturesWidget
->
importImage
(
image
,
capturedName
);
#endif
#endif
}
}
...
...
src/board/UBFeaturesController.cpp
View file @
d82fdd7d
...
@@ -108,8 +108,6 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
...
@@ -108,8 +108,6 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
mLibSearchDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userSearchDirectory
());
mLibSearchDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userSearchDirectory
());
trashDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
userTrashDirPath
());
trashDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
userTrashDirPath
());
rootElement
=
UBFeature
(
QString
(),
QPixmap
(
":images/libpalette/home.png"
),
"root"
,
QUrl
());
rootElement
=
UBFeature
(
QString
(),
QPixmap
(
":images/libpalette/home.png"
),
"root"
,
QUrl
());
audiosElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/AudiosCategory.svg"
),
"Audios"
,
mUserAudioDirectoryPath
,
FEATURE_CATEGORY
);
audiosElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/AudiosCategory.svg"
),
"Audios"
,
mUserAudioDirectoryPath
,
FEATURE_CATEGORY
);
moviesElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/MoviesCategory.svg"
),
"Movies"
,
mUserVideoDirectoryPath
,
FEATURE_CATEGORY
);
moviesElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/MoviesCategory.svg"
),
"Movies"
,
mUserVideoDirectoryPath
,
FEATURE_CATEGORY
);
...
@@ -167,15 +165,12 @@ void UBFeaturesController::scanFS()
...
@@ -167,15 +165,12 @@ void UBFeaturesController::scanFS()
QList
<
UBToolsManager
::
UBToolDescriptor
>
tools
=
UBToolsManager
::
manager
()
->
allTools
();
QList
<
UBToolsManager
::
UBToolDescriptor
>
tools
=
UBToolsManager
::
manager
()
->
allTools
();
foreach
(
UBToolsManager
::
UBToolDescriptor
tool
,
tools
)
foreach
(
UBToolsManager
::
UBToolDescriptor
tool
,
tools
)
{
{
featuresList
->
append
(
UBFeature
(
appPath
,
tool
.
icon
,
tool
.
label
,
QUrl
(
tool
.
id
),
FEATURE_INTERNAL
));
featuresList
->
append
(
UBFeature
(
appPath
,
tool
.
icon
,
tool
.
label
,
QUrl
(
tool
.
id
),
FEATURE_INTERNAL
)
);
if
(
favoriteSet
->
find
(
QUrl
(
tool
.
id
))
!=
favoriteSet
->
end
())
{
if
(
favoriteSet
->
find
(
QUrl
(
tool
.
id
)
)
!=
favoriteSet
->
end
()
)
featuresList
->
append
(
UBFeature
(
favoritePath
,
tool
.
icon
,
tool
.
label
,
QUrl
(
tool
.
id
),
FEATURE_INTERNAL
));
{
featuresList
->
append
(
UBFeature
(
favoritePath
,
tool
.
icon
,
tool
.
label
,
QUrl
(
tool
.
id
),
FEATURE_INTERNAL
)
);
}
}
}
}
//Claudio:
//Claudio:
// don't change the order of the scans
// don't change the order of the scans
fileSystemScan
(
mLibAudiosDirectoryPath
,
audiosPath
);
fileSystemScan
(
mLibAudiosDirectoryPath
,
audiosPath
);
...
@@ -194,7 +189,6 @@ void UBFeaturesController::scanFS()
...
@@ -194,7 +189,6 @@ void UBFeaturesController::scanFS()
fileSystemScan
(
mLibInteractiveDirectoryPath
,
interactPath
);
fileSystemScan
(
mLibInteractiveDirectoryPath
,
interactPath
);
fileSystemScan
(
trashDirectoryPath
,
trashPath
);
fileSystemScan
(
trashDirectoryPath
,
trashPath
);
fileSystemScan
(
mLibSearchDirectoryPath
,
rootPath
+
"/"
+
"Web search"
);
fileSystemScan
(
mLibSearchDirectoryPath
,
rootPath
+
"/"
+
"Web search"
);
}
}
void
UBFeaturesController
::
fileSystemScan
(
const
QUrl
&
currentPath
,
const
QString
&
currVirtualPath
)
void
UBFeaturesController
::
fileSystemScan
(
const
QUrl
&
currentPath
,
const
QString
&
currVirtualPath
)
...
@@ -202,63 +196,28 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin
...
@@ -202,63 +196,28 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin
QFileInfoList
fileInfoList
=
UBFileSystemUtils
::
allElementsInDirectory
(
currentPath
.
toLocalFile
());
QFileInfoList
fileInfoList
=
UBFileSystemUtils
::
allElementsInDirectory
(
currentPath
.
toLocalFile
());
QFileInfoList
::
iterator
fileInfo
;
QFileInfoList
::
iterator
fileInfo
;
for
(
fileInfo
=
fileInfoList
.
begin
();
fileInfo
!=
fileInfoList
.
end
();
fileInfo
+=
1
)
for
(
fileInfo
=
fileInfoList
.
begin
();
fileInfo
!=
fileInfoList
.
end
();
fileInfo
+=
1
)
{
{
QString
fullFileName
=
fileInfo
->
absoluteFilePath
();
UBFeatureElementType
fileType
=
fileInfo
->
isDir
()
?
FEATURE_FOLDER
:
FEATURE_ITEM
;
UBFeatureElementType
featureType
=
fileTypeFromUrl
(
fullFileName
);
QString
fileName
=
fileInfo
->
fileName
();
QString
fileName
=
fileInfo
->
fileName
();
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
fileName
).
contains
(
"application"
)
)
{
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
fileName
).
contains
(
"application/search"
)
)
{
fileType
=
FEATURE_SEARCH
;
}
else
fileType
=
FEATURE_INTERACTIVE
;
}
QString
itemName
=
(
fileType
!=
FEATURE_ITEM
)
?
fileName
:
fileInfo
->
completeBaseName
();
QPixmap
icon
=
QPixmap
(
":images/libpalette/soundIcon.svg"
);
QString
fullFileName
=
fileInfo
->
filePath
();
if
(
fileType
==
FEATURE_FOLDER
)
{
icon
=
QPixmap
(
":images/libpalette/folder.svg"
);
}
else
if
(
fileType
==
FEATURE_INTERACTIVE
)
{
icon
=
QPixmap
(
UBAbstractWidget
::
iconFilePath
(
QUrl
::
fromLocalFile
(
fullFileName
)
)
);
}
else
{
if
(
fullFileName
.
contains
(
".thumbnail."
)
)
continue
;
icon
=
thumbnailForFile
(
fullFileName
);
/*QString thumbnailPath = UBFileSystemUtils::thumbnailPath( fullFileName );
if (QFileInfo( thumbnailPath).exists() )
icon = QPixmap( thumbnailPath );
else icon = createThumbnail( fullFileName );*/
}
UBFeature
testFeature
(
currVirtualPath
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
fileType
);
QPixmap
icon
(
getIcon
(
fullFileName
,
featureType
)
);
if
(
featuresList
->
contains
(
testFeature
))
{
if
(
fullFileName
.
contains
(
".thumbnail."
))
qDebug
()
<<
"the same feature found"
;
continue
;
}
UBFeature
testFeature
(
currVirtualPath
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
);
featuresList
->
append
(
testFeature
);
featuresList
->
append
(
testFeature
);
if
(
favoriteSet
->
find
(
QUrl
::
fromLocalFile
(
fullFileName
)
)
!=
favoriteSet
->
end
()
)
{
featuresList
->
append
(
UBFeature
(
favoritePath
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
fileType
)
);
}
if
(
fileType
==
FEATURE_FOLDER
)
if
(
favoriteSet
->
find
(
QUrl
::
fromLocalFile
(
fullFileName
)
)
!=
favoriteSet
->
end
()
)
{
{
featuresList
->
append
(
UBFeature
(
favoritePath
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
)
);
fileSystemScan
(
QUrl
::
fromLocalFile
(
fullFileName
),
currVirtualPath
+
"/"
+
fileName
);
}
}
}
if
(
featureType
==
FEATURE_FOLDER
)
{
fileSystemScan
(
QUrl
::
fromLocalFile
(
fullFileName
),
currVirtualPath
+
"/"
+
fileName
);
}
}
}
}
void
UBFeaturesController
::
loadFavoriteList
()
void
UBFeaturesController
::
loadFavoriteList
()
...
@@ -301,7 +260,7 @@ void UBFeaturesController::addToFavorite( const QUrl &path )
...
@@ -301,7 +260,7 @@ void UBFeaturesController::addToFavorite( const QUrl &path )
{
{
QFileInfo
fileInfo
(
filePath
);
QFileInfo
fileInfo
(
filePath
);
QString
fileName
=
fileInfo
.
fileName
();
QString
fileName
=
fileInfo
.
fileName
();
UBFeature
elem
(
favoritePath
,
thumbnailForFile
(
filePath
),
fileName
,
path
,
fileTypeFromUrl
(
filePath
)
);
UBFeature
elem
(
favoritePath
,
getIcon
(
filePath
,
FEATURE_CATEGORY
),
fileName
,
path
,
fileTypeFromUrl
(
filePath
)
);
favoriteSet
->
insert
(
path
);
favoriteSet
->
insert
(
path
);
saveFavoriteList
();
saveFavoriteList
();
...
@@ -335,44 +294,63 @@ QString UBFeaturesController::fileNameFromUrl( const QUrl &url )
...
@@ -335,44 +294,63 @@ QString UBFeaturesController::fileNameFromUrl( const QUrl &url )
UBFeatureElementType
UBFeaturesController
::
fileTypeFromUrl
(
const
QString
&
path
)
UBFeatureElementType
UBFeaturesController
::
fileTypeFromUrl
(
const
QString
&
path
)
{
{
QFileInfo
fileInfo
(
path
);
QFileInfo
fileInfo
(
path
);
QString
fileName
=
fileInfo
.
fileName
();
UBFeatureElementType
fileType
=
fileInfo
.
isDir
()
?
FEATURE_FOLDER
:
FEATURE_ITEM
;
if
(
!
fileInfo
.
exists
())
{
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
fileName
).
contains
(
"application"
)
)
return
FEATURE_INVALID
;
{
}
fileType
=
FEATURE_INTERACTIVE
;
}
QString
fileName
=
fileInfo
.
fileName
();
else
if
(
path
.
contains
(
"uniboardTool://"
)
)
QString
mimeString
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
fileName
);
{
UBFeatureElementType
fileType
=
fileInfo
.
isDir
()
?
FEATURE_FOLDER
:
FEATURE_ITEM
;
if
(
mimeString
.
contains
(
"application"
))
{
if
(
mimeString
.
contains
(
"application/search"
))
{
fileType
=
FEATURE_SEARCH
;
}
else
{
fileType
=
FEATURE_INTERACTIVE
;
}
}
else
if
(
path
.
contains
(
"uniboardTool://"
))
{
fileType
=
FEATURE_INTERNAL
;
fileType
=
FEATURE_INTERNAL
;
}
}
return
fileType
;
return
fileType
;
}
}
QPixmap
UBFeaturesController
::
thumbnailForFile
(
const
QString
&
path
)
QPixmap
UBFeaturesController
::
getIcon
(
const
QString
&
path
,
UBFeatureElementType
pFType
=
FEATURE_INVALID
)
{
{
if
(
path
.
contains
(
"uniboardTool://"
)
)
if
(
pFType
==
FEATURE_FOLDER
)
{
{
return
QPixmap
(
":images/libpalette/folder.svg"
);
}
else
if
(
pFType
==
FEATURE_INTERACTIVE
)
{
return
QPixmap
(
UBAbstractWidget
::
iconFilePath
(
QUrl
::
fromLocalFile
(
path
)
)
);
}
if
(
path
.
contains
(
"uniboardTool://"
)
)
{
return
QPixmap
(
UBToolsManager
::
manager
()
->
iconFromToolId
(
path
)
);
return
QPixmap
(
UBToolsManager
::
manager
()
->
iconFromToolId
(
path
)
);
}
}
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
path
).
contains
(
"application"
)
)
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
path
).
contains
(
"application"
)
)
{
{
return
QPixmap
(
UBAbstractWidget
::
iconFilePath
(
QUrl
::
fromLocalFile
(
path
)
)
);
return
QPixmap
(
UBAbstractWidget
::
iconFilePath
(
QUrl
::
fromLocalFile
(
path
)
)
);
}
}
QPixmap
thumb
;
QPixmap
thumb
;
QString
thumbnailPath
=
UBFileSystemUtils
::
thumbnailPath
(
path
);
QString
thumbnailPath
=
UBFileSystemUtils
::
thumbnailPath
(
path
);
if
(
QFileInfo
(
thumbnailPath
).
exists
()
)
if
(
QFileInfo
(
thumbnailPath
).
exists
()
)
thumb
=
QPixmap
(
thumbnailPath
);
thumb
=
QPixmap
(
thumbnailPath
);
else
thumb
=
createThumbnail
(
path
);
else
thumb
=
createThumbnail
(
path
);
return
thumb
;
return
thumb
;
}
}
bool
UBFeaturesController
::
isDeletable
(
const
QUrl
&
url
)
bool
UBFeaturesController
::
isDeletable
(
const
QUrl
&
url
)
{
{
UBFeatureElementType
type
=
fileTypeFromUrl
(
fileNameFromUrl
(
url
)
);
UBFeatureElementType
type
=
fileTypeFromUrl
(
fileNameFromUrl
(
url
)
);
return
type
==
FEATURE_ITEM
;
return
type
==
FEATURE_ITEM
;
}
}
...
@@ -411,10 +389,18 @@ QPixmap UBFeaturesController::createThumbnail(const QString &path)
...
@@ -411,10 +389,18 @@ QPixmap UBFeaturesController::createThumbnail(const QString &path)
return
QPixmap
(
thumbnailPath
);
return
QPixmap
(
thumbnailPath
);
}
}
UBFeature
UBFeaturesController
::
importImage
(
const
QImage
&
image
,
const
UBFeature
&
destination
)
void
UBFeaturesController
::
importImage
(
const
QImage
&
image
,
const
QString
&
fileName
)
{
{
QDateTime
now
=
QDateTime
::
currentDateTime
();
importImage
(
image
,
currentElement
,
fileName
);
QString
fileName
=
tr
(
"ImportedImage"
)
+
"-"
+
now
.
toString
(
"dd-MM-yyyy hh-mm-ss"
)
+
".png"
;
}
void
UBFeaturesController
::
importImage
(
const
QImage
&
image
,
const
UBFeature
&
destination
,
const
QString
&
fileName
)
{
QString
mFileName
=
fileName
;
if
(
mFileName
.
isNull
())
{
QDateTime
now
=
QDateTime
::
currentDateTime
();
mFileName
=
tr
(
"ImportedImage"
)
+
"-"
+
now
.
toString
(
"dd-MM-yyyy hh-mm-ss"
)
+
".png"
;
}
UBFeature
dest
=
destination
;
UBFeature
dest
=
destination
;
...
@@ -423,13 +409,15 @@ UBFeature UBFeaturesController::importImage( const QImage &image, const UBFeatur
...
@@ -423,13 +409,15 @@ UBFeature UBFeaturesController::importImage( const QImage &image, const UBFeatur
dest
=
picturesElement
;
dest
=
picturesElement
;
}
}
QString
filePath
=
dest
.
getFullPath
().
toLocalFile
()
+
"/"
+
f
ileName
;
QString
filePath
=
dest
.
getFullPath
().
toLocalFile
()
+
"/"
+
mF
ileName
;
image
.
save
(
filePath
);
image
.
save
(
filePath
);
QPixmap
thumb
=
createThumbnail
(
filePath
);
QPixmap
thumb
=
createThumbnail
(
filePath
);
return
UBFeature
(
dest
.
getFullVirtualPath
(),
thumb
,
fileName
,
UBFeature
resultItem
=
UBFeature
(
dest
.
getFullVirtualPath
(),
thumb
,
mFileName
,
QUrl
::
fromLocalFile
(
filePath
),
FEATURE_ITEM
);
QUrl
::
fromLocalFile
(
filePath
),
FEATURE_ITEM
);
featuresModel
->
addItem
(
resultItem
);
}
}
void
UBFeaturesController
::
addNewFolder
(
const
QString
&
name
)
void
UBFeaturesController
::
addNewFolder
(
const
QString
&
name
)
...
@@ -456,7 +444,7 @@ void UBFeaturesController::addItemAsBackground(const UBFeature &item)
...
@@ -456,7 +444,7 @@ void UBFeaturesController::addItemAsBackground(const UBFeature &item)
UBApplication
::
boardController
->
downloadURL
(
item
.
getFullPath
(),
QPointF
(),
QSize
(),
true
);
UBApplication
::
boardController
->
downloadURL
(
item
.
getFullPath
(),
QPointF
(),
QSize
(),
true
);
}
}
UBFeature
UBFeaturesController
::
get
Parent
FeatureForUrl
(
const
QUrl
&
url
)
UBFeature
UBFeaturesController
::
get
Destination
FeatureForUrl
(
const
QUrl
&
url
)
{
{
QString
mimetype
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
url
.
toString
()
);
QString
mimetype
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
url
.
toString
()
);
...
@@ -478,7 +466,7 @@ UBFeature UBFeaturesController::getParentFeatureForUrl( const QUrl &url )
...
@@ -478,7 +466,7 @@ UBFeature UBFeaturesController::getParentFeatureForUrl( const QUrl &url )
void
UBFeaturesController
::
addDownloadedFile
(
const
QUrl
&
sourceUrl
,
const
QByteArray
&
pData
)
void
UBFeaturesController
::
addDownloadedFile
(
const
QUrl
&
sourceUrl
,
const
QByteArray
&
pData
)
{
{
UBFeature
dest
=
get
Parent
FeatureForUrl
(
sourceUrl
);
UBFeature
dest
=
get
Destination
FeatureForUrl
(
sourceUrl
);
if
(
dest
==
UBFeature
()
)
if
(
dest
==
UBFeature
()
)
return
;
return
;
...
@@ -492,7 +480,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
...
@@ -492,7 +480,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
file
.
write
(
pData
);
file
.
write
(
pData
);
file
.
close
();
file
.
close
();
UBFeature
downloadedFeature
=
UBFeature
(
dest
.
getFullVirtualPath
(),
thumbnailForFile
(
filePath
),
UBFeature
downloadedFeature
=
UBFeature
(
dest
.
getFullVirtualPath
(),
getIcon
(
filePath
),
fileName
,
QUrl
::
fromLocalFile
(
filePath
),
FEATURE_ITEM
);
fileName
,
QUrl
::
fromLocalFile
(
filePath
),
FEATURE_ITEM
);
if
(
downloadedFeature
!=
UBFeature
())
{
if
(
downloadedFeature
!=
UBFeature
())
{
featuresModel
->
addItem
(
downloadedFeature
);
featuresModel
->
addItem
(
downloadedFeature
);
...
@@ -510,7 +498,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
...
@@ -510,7 +498,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
Q_ASSERT
(
QFileInfo
(
sourcePath
).
exists
()
);
Q_ASSERT
(
QFileInfo
(
sourcePath
).
exists
()
);
UBFeature
possibleDest
=
get
Parent
FeatureForUrl
(
url
);
UBFeature
possibleDest
=
get
Destination
FeatureForUrl
(
url
);
UBFeature
dest
=
destination
;
UBFeature
dest
=
destination
;
...
@@ -530,7 +518,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
...
@@ -530,7 +518,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
deleteItem
(
url
);
deleteItem
(
url
);
}
}
QPixmap
thumb
=
thumbnailForFile
(
newFullPath
);
QPixmap
thumb
=
getIcon
(
newFullPath
);
UBFeatureElementType
type
=
FEATURE_ITEM
;
UBFeatureElementType
type
=
FEATURE_ITEM
;
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
newFullPath
).
contains
(
"application"
)
)
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
newFullPath
).
contains
(
"application"
)
)
...
@@ -589,7 +577,7 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
...
@@ -589,7 +577,7 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
Q_ASSERT
(
QFileInfo
(
sourcePath
).
exists
()
);
Q_ASSERT
(
QFileInfo
(
sourcePath
).
exists
()
);
UBFeature
possibleDest
=
get
Parent
FeatureForUrl
(
url
);
UBFeature
possibleDest
=
get
Destination
FeatureForUrl
(
url
);
UBFeature
dest
=
destination
;
UBFeature
dest
=
destination
;
...
@@ -599,22 +587,61 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
...
@@ -599,22 +587,61 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
dest
=
possibleDest
;
dest
=
possibleDest
;
}
}
QString
name
=
QFileInfo
(
sourcePath
).
fileName
();
QString
name
=
QFileInfo
(
sourcePath
).
fileName
();
QString
destPath
=
dest
.
getFullPath
().
toLocalFile
();
QString
destPath
=
dest
.
getFullPath
().
toLocalFile
();
QString
destVirtualPath
=
dest
.
getFullVirtualPath
();
QString
destVirtualPath
=
dest
.
getFullVirtualPath
();
QString
newFullPath
=
destPath
+
"/"
+
name
;
QString
newFullPath
=
destPath
+
"/"
+
name
;
if
(
!
sourcePath
.
compare
(
newFullPath
,
Qt
::
CaseInsensitive
)
)
if
(
!
sourcePath
.
compare
(
newFullPath
,
Qt
::
CaseInsensitive
)
)
QFile
(
sourcePath
).
copy
(
newFullPath
);
QFile
(
sourcePath
).
copy
(
newFullPath
);
QPixmap
thumb
=
thumbnailForFile
(
newFullPath
);
QPixmap
thumb
=
getIcon
(
newFullPath
);
UBFeatureElementType
type
=
FEATURE_ITEM
;
UBFeatureElementType
type
=
FEATURE_ITEM
;
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
newFullPath
).
contains
(
"application"
)
)
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
newFullPath
).
contains
(
"application"
)
)
type
=
FEATURE_INTERACTIVE
;
type
=
FEATURE_INTERACTIVE
;
UBFeature
newElement
(
destVirtualPath
,
thumb
,
name
,
QUrl
::
fromLocalFile
(
newFullPath
),
type
);
UBFeature
newElement
(
destVirtualPath
,
thumb
,
name
,
QUrl
::
fromLocalFile
(
newFullPath
),
type
);
return
newElement
;
return
newElement
;
}
}
void
UBFeaturesController
::
moveExternalData
(
const
QUrl
&
url
,
const
UBFeature
&
destination
)
{
QString
sourcePath
=
url
.
toLocalFile
();
Q_ASSERT
(
QFileInfo
(
sourcePath
).
exists
()
);
UBFeature
possibleDest
=
getDestinationFeatureForUrl
(
url
);
UBFeature
dest
=
destination
;
if
(
destination
!=
trashElement
&&
!
destination
.
getFullVirtualPath
().
startsWith
(
possibleDest
.
getFullVirtualPath
(),
Qt
::
CaseInsensitive
)
)
{
dest
=
possibleDest
;
}
UBFeatureElementType
type
=
fileTypeFromUrl
(
sourcePath
);
if
(
type
==
FEATURE_FOLDER
)
{
return
;
}
QString
name
=
QFileInfo
(
sourcePath
).
fileName
();
QString
destPath
=
dest
.
getFullPath
().
toLocalFile
();
QString
destVirtualPath
=
dest
.
getFullVirtualPath
();
QString
newFullPath
=
destPath
+
"/"
+
name
;
if
(
!
sourcePath
.
compare
(
newFullPath
,
Qt
::
CaseInsensitive
)
||
!
UBFileSystemUtils
::
copy
(
sourcePath
,
newFullPath
))
{
return
;
}
Q_ASSERT
(
QFileInfo
(
newFullPath
).
exists
());
QPixmap
thumb
=
getIcon
(
newFullPath
,
type
);
UBFeature
newElement
(
destVirtualPath
,
thumb
,
name
,
QUrl
::
fromLocalFile
(
newFullPath
),
type
);
featuresModel
->
addItem
(
newElement
);
}
void
UBFeaturesController
::
deleteItem
(
const
QUrl
&
url
)
void
UBFeaturesController
::
deleteItem
(
const
QUrl
&
url
)
{
{
QString
path
=
url
.
toLocalFile
();
QString
path
=
url
.
toLocalFile
();
...
...
src/board/UBFeaturesController.h
View file @
d82fdd7d
...
@@ -33,7 +33,8 @@ enum UBFeatureElementType
...
@@ -33,7 +33,8 @@ enum UBFeatureElementType
FEATURE_ITEM
,
FEATURE_ITEM
,
FEATURE_TRASH
,
FEATURE_TRASH
,
FEATURE_FAVORITE
,
FEATURE_FAVORITE
,
FEATURE_SEARCH
FEATURE_SEARCH
,
FEATURE_INVALID
};
};
class
UBFeature
class
UBFeature
...
@@ -105,6 +106,7 @@ public:
...
@@ -105,6 +106,7 @@ public:
UBFeature
moveItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
UBFeature
moveItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
UBFeature
copyItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
UBFeature
copyItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
void
moveExternalData
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
void
rescanModel
();
void
rescanModel
();
void
siftElements
(
const
QString
&
pSiftValue
);
void
siftElements
(
const
QString
&
pSiftValue
);
...
@@ -120,13 +122,15 @@ public:
...
@@ -120,13 +122,15 @@ public:
void
addNewFolder
(
const
QString
&
name
);
void
addNewFolder
(
const
QString
&
name
);
void
addToFavorite
(
const
QUrl
&
path
);
void
addToFavorite
(
const
QUrl
&
path
);
void
removeFromFavorite
(
const
QUrl
&
path
,
bool
deleteManualy
=
false
);
void
removeFromFavorite
(
const
QUrl
&
path
,
bool
deleteManualy
=
false
);
UBFeature
importImage
(
const
QImage
&
image
,
const
UBFeature
&
destination
);
void
importImage
(
const
QImage
&
image
,
const
QString
&
fileName
=
QString
());
void
importImage
(
const
QImage
&
image
,
const
UBFeature
&
destination
,
const
QString
&
fileName
=
QString
()
);
void
fileSystemScan
(
const
QUrl
&
currPath
,
const
QString
&
currVirtualPath
);
void
fileSystemScan
(
const
QUrl
&
currPath
,
const
QString
&
currVirtualPath
);
static
UBFeatureElementType
fileTypeFromUrl
(
const
QString
&
path
);
static
QString
fileNameFromUrl
(
const
QUrl
&
url
);
static
QString
fileNameFromUrl
(
const
QUrl
&
url
);
static
QPixmap
thumbnailForFile
(
const
QString
&
path
);
static
QPixmap
getIcon
(
const
QString
&
path
,
UBFeatureElementType
pFType
);
static
bool
isDeletable
(
const
QUrl
&
url
);
static
bool
isDeletable
(
const
QUrl
&
url
);
static
char
featureTypeSplitter
()
{
return
':'
;}
static
char
featureTypeSplitter
()
{
return
':'
;}
...
@@ -153,7 +157,7 @@ private:
...
@@ -153,7 +157,7 @@ private:
void
loadFavoriteList
();
void
loadFavoriteList
();
void
saveFavoriteList
();
void
saveFavoriteList
();
static
UBFeatureElementType
fileTypeFromUrl
(
const
QString
&
path
);
QList
<
UBFeature
>
*
featuresList
;
QList
<
UBFeature
>
*
featuresList
;
...
@@ -204,7 +208,7 @@ private:
...
@@ -204,7 +208,7 @@ private:
public
:
public
:
UBFeature
trashElement
;
UBFeature
trashElement
;
UBFeature
get
Parent
FeatureForUrl
(
const
QUrl
&
url
);
UBFeature
get
Destination
FeatureForUrl
(
const
QUrl
&
url
);
};
};
...
...
src/gui/UBFeaturesWidget.cpp
View file @
d82fdd7d
...
@@ -108,6 +108,9 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t)
...
@@ -108,6 +108,9 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t)
return
;
return
;
}
}
//Calling to reset the model for listView. Maybe separate function needed
controller
->
searchStarted
(
""
,
mNavigator
->
listView
());
QString
objName
=
sender
()
->
objectName
();
QString
objName
=
sender
()
->
objectName
();
if
(
objName
.
isEmpty
())
{
if
(
objName
.
isEmpty
())
{
...
@@ -357,6 +360,10 @@ QStringList UBFeaturesMimeData::formats() const
...
@@ -357,6 +360,10 @@ QStringList UBFeaturesMimeData::formats() const
return
QMimeData
::
formats
();
return
QMimeData
::
formats
();
}
}
void
UBFeaturesWidget
::
importImage
(
const
QImage
&
image
,
const
QString
&
fileName
)
{
controller
->
importImage
(
image
,
fileName
);
}
UBFeaturesListView
::
UBFeaturesListView
(
QWidget
*
parent
,
const
char
*
name
)
UBFeaturesListView
::
UBFeaturesListView
(
QWidget
*
parent
,
const
char
*
name
)
:
QListView
(
parent
)
:
QListView
(
parent
)
...
@@ -862,6 +869,8 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
...
@@ -862,6 +869,8 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
Q_UNUSED
(
row
)
Q_UNUSED
(
row
)
const
UBFeaturesMimeData
*
fMimeData
=
qobject_cast
<
const
UBFeaturesMimeData
*>
(
mimeData
);
const
UBFeaturesMimeData
*
fMimeData
=
qobject_cast
<
const
UBFeaturesMimeData
*>
(
mimeData
);
UBFeaturesController
*
curController
=
qobject_cast
<
UBFeaturesController
*>
(
QObject
::
parent
());
bool
dataFromSameModel
=
false
;
bool
dataFromSameModel
=
false
;
if
(
fMimeData
)
if
(
fMimeData
)
...
@@ -876,12 +885,12 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
...
@@ -876,12 +885,12 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
UBFeature
parentFeature
;
UBFeature
parentFeature
;
if
(
!
parent
.
isValid
())
{
if
(
!
parent
.
isValid
())
{
parentFeature
=
dynamic_cast
<
UBFeaturesWidget
*>
(
QObject
::
parent
())
->
getFeaturesController
()
->
getCurrentElement
();
parentFeature
=
curController
->
getCurrentElement
();
}
else
{
}
else
{
parentFeature
=
parent
.
data
(
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
parentFeature
=
parent
.
data
(
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
}
}
if
(
mimeData
->
hasUrls
()
)
{
if
(
dataFromSameModel
)
{
QList
<
UBFeature
>
featList
=
fMimeData
->
features
();
QList
<
UBFeature
>
featList
=
fMimeData
->
features
();
for
(
int
i
=
0
;
i
<
featList
.
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
featList
.
count
();
i
++
)
{
UBFeature
sourceElement
;
UBFeature
sourceElement
;
...
@@ -890,10 +899,16 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
...
@@ -890,10 +899,16 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
moveData
(
sourceElement
,
parentFeature
,
Qt
::
MoveAction
);
moveData
(
sourceElement
,
parentFeature
,
Qt
::
MoveAction
);
}
}
}
}
}
else
if
(
mimeData
->
hasImage
()
)
{
}
else
if
(
mimeData
->
hasUrls
())
{
QList
<
QUrl
>
urlList
=
mimeData
->
urls
();
foreach
(
QUrl
curUrl
,
urlList
)
{
qDebug
()
<<
"URl catched is "
<<
curUrl
.
toLocalFile
();
curController
->
moveExternalData
(
curUrl
,
parentFeature
);
}
}
else
if
(
mimeData
->
hasImage
())
{
QImage
image
=
qvariant_cast
<
QImage
>
(
mimeData
->
imageData
()
);
QImage
image
=
qvariant_cast
<
QImage
>
(
mimeData
->
imageData
()
);
UBFeature
element
=
dynamic_cast
<
UBFeaturesWidget
*>
(
QObject
::
parent
())
->
getFeaturesController
()
->
importImage
(
image
,
parentFeature
);
curController
->
importImage
(
image
,
parentFeature
);
addItem
(
element
);
}
}
return
true
;
return
true
;
...
@@ -1019,7 +1034,7 @@ void UBFeaturesModel::moveData(const UBFeature &source, const UBFeature &destina
...
@@ -1019,7 +1034,7 @@ void UBFeaturesModel::moveData(const UBFeature &source, const UBFeature &destina
curFeature
.
setFullPath
(
newPath
);
curFeature
.
setFullPath
(
newPath
);
}
}
}
}
// processing copy or move action for
re
al FS
// processing copy or move action for
virtu
al FS
if
(
action
==
Qt
::
CopyAction
)
{
if
(
action
==
Qt
::
CopyAction
)
{
copyFeature
.
setFullVirtualPath
(
newVirtualPath
);
copyFeature
.
setFullVirtualPath
(
newVirtualPath
);
}
else
{
}
else
{
...
...
src/gui/UBFeaturesWidget.h
View file @
d82fdd7d
...
@@ -56,6 +56,7 @@ public:
...
@@ -56,6 +56,7 @@ public:
||
mode
==
eUBDockPaletteWidget_DESKTOP
;
||
mode
==
eUBDockPaletteWidget_DESKTOP
;
}
}
UBFeaturesController
*
getFeaturesController
()
const
{
return
controller
;
}
UBFeaturesController
*
getFeaturesController
()
const
{
return
controller
;
}
void
importImage
(
const
QImage
&
image
,
const
QString
&
fileName
=
QString
());
static
const
int
minThumbnailSize
=
20
;
static
const
int
minThumbnailSize
=
20
;
static
const
int
maxThumbnailSize
=
100
;
static
const
int
maxThumbnailSize
=
100
;
...
...
src/gui/UBTeacherGuideWidget.cpp
View file @
d82fdd7d
...
@@ -1163,7 +1163,7 @@ void UBTeacherGuideWidget::connectToStylusPalette()
...
@@ -1163,7 +1163,7 @@ void UBTeacherGuideWidget::connectToStylusPalette()
connect
(
UBApplication
::
mainWindow
->
actionPlay
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionPlay
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionZoomIn
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionZoomIn
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionZoomOut
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionZoomOut
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionCapture
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionCapture
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionHand
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionHand
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionLine
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionLine
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionText
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
connect
(
UBApplication
::
mainWindow
->
actionText
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
onTriggeredAction
(
bool
)));
...
...
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