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
9ceff120
Commit
9ceff120
authored
Aug 29, 2012
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UBFeatures translations
parent
1b3a3a61
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
59 deletions
+96
-59
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+71
-44
UBFeaturesController.h
src/board/UBFeaturesController.h
+21
-11
UBApplication.cpp
src/core/UBApplication.cpp
+1
-1
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+3
-3
No files found.
src/board/UBFeaturesController.cpp
View file @
9ceff120
...
@@ -20,6 +20,19 @@
...
@@ -20,6 +20,19 @@
#include "gui/UBFeaturesWidget.h"
#include "gui/UBFeaturesWidget.h"
const
QString
UBFeaturesController
::
virtualRootName
=
"root"
;
const
QString
UBFeaturesController
::
virtualRootName
=
"root"
;
const
QString
UBFeaturesController
::
rootPath
=
"/"
+
virtualRootName
;
const
QString
UBFeaturesController
::
appPath
=
rootPath
+
"/Applications"
;
const
QString
UBFeaturesController
::
audiosPath
=
rootPath
+
"/Audios"
;
const
QString
UBFeaturesController
::
moviesPath
=
rootPath
+
"/Movies"
;
const
QString
UBFeaturesController
::
picturesPath
=
rootPath
+
"/Pictures"
;
const
QString
UBFeaturesController
::
flashPath
=
rootPath
+
"/Animations"
;
const
QString
UBFeaturesController
::
interactPath
=
rootPath
+
"/Interactivities"
;
const
QString
UBFeaturesController
::
shapesPath
=
rootPath
+
"/Shapes"
;
const
QString
UBFeaturesController
::
trashPath
=
rootPath
+
"/Trash"
;
const
QString
UBFeaturesController
::
favoritePath
=
rootPath
+
"/Favorites"
;
const
QString
UBFeaturesController
::
webSearchPath
=
rootPath
+
"/Web search"
;
void
UBFeaturesComputingThread
::
scanFS
(
const
QUrl
&
currentPath
,
const
QString
&
currVirtualPath
,
const
QSet
<
QUrl
>
&
pFavoriteSet
)
void
UBFeaturesComputingThread
::
scanFS
(
const
QUrl
&
currentPath
,
const
QString
&
currVirtualPath
,
const
QSet
<
QUrl
>
&
pFavoriteSet
)
{
{
...
@@ -43,7 +56,7 @@ void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString &
...
@@ -43,7 +56,7 @@ void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString &
if
(
fullFileName
.
contains
(
".thumbnail."
))
if
(
fullFileName
.
contains
(
".thumbnail."
))
continue
;
continue
;
UBFeature
testFeature
(
currVirtualPath
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
);
UBFeature
testFeature
(
currVirtualPath
+
"/"
+
fileName
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
);
emit
sendFeature
(
testFeature
);
emit
sendFeature
(
testFeature
);
emit
featureSent
();
emit
featureSent
();
...
@@ -51,7 +64,7 @@ void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString &
...
@@ -51,7 +64,7 @@ void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString &
if
(
pFavoriteSet
.
find
(
QUrl
::
fromLocalFile
(
fullFileName
))
!=
pFavoriteSet
.
end
())
{
if
(
pFavoriteSet
.
find
(
QUrl
::
fromLocalFile
(
fullFileName
))
!=
pFavoriteSet
.
end
())
{
//TODO send favoritePath from the controller or make favoritePath public and static
//TODO send favoritePath from the controller or make favoritePath public and static
emit
sendFeature
(
UBFeature
(
"/root/Favorites"
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
));
emit
sendFeature
(
UBFeature
(
UBFeaturesController
::
favoritePath
+
"/"
+
fileName
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
));
}
}
if
(
featureType
==
FEATURE_FOLDER
)
{
if
(
featureType
==
FEATURE_FOLDER
)
{
...
@@ -182,14 +195,42 @@ UBFeaturesComputingThread::~UBFeaturesComputingThread()
...
@@ -182,14 +195,42 @@ UBFeaturesComputingThread::~UBFeaturesComputingThread()
}
}
UBFeature
::
UBFeature
(
const
QString
&
url
,
const
QImage
&
icon
,
const
QString
&
name
,
const
QUrl
&
realPath
,
UBFeatureElementType
type
)
UBFeature
::
UBFeature
(
const
QString
&
url
,
const
QImage
&
icon
,
const
QString
&
name
,
const
QUrl
&
realPath
,
UBFeatureElementType
type
)
:
virtualDir
(
url
),
mThumbnail
(
icon
),
m
Name
(
name
),
mPath
(
realPath
),
elementType
(
type
)
:
mThumbnail
(
icon
),
mDisplay
Name
(
name
),
mPath
(
realPath
),
elementType
(
type
)
{
{
mName
=
getNameFromVirtualPath
(
url
);
virtualDir
=
getVirtualDirFromVirtualPath
(
url
);
}
}
UBFeature
::~
UBFeature
()
UBFeature
::~
UBFeature
()
{
{
}
}
QString
UBFeature
::
getNameFromVirtualPath
(
const
QString
&
pVirtPath
)
{
QString
result
;
int
slashPos
=
pVirtPath
.
lastIndexOf
(
"/"
);
if
(
slashPos
!=
-
1
)
{
result
=
pVirtPath
.
right
(
pVirtPath
.
count
()
-
slashPos
-
1
);
}
else
{
qDebug
()
<<
"UBFeature: incorrect virtual path parameter specified"
;
}
return
result
;
}
QString
UBFeature
::
getVirtualDirFromVirtualPath
(
const
QString
&
pVirtPath
)
{
QString
result
;
int
slashPos
=
pVirtPath
.
lastIndexOf
(
"/"
);
if
(
slashPos
!=
-
1
)
{
result
=
pVirtPath
.
left
(
slashPos
);
}
else
{
qDebug
()
<<
"UBFeature: incorrect virtual path parameter specified"
;
}
return
result
;
}
QString
UBFeature
::
getUrl
()
const
QString
UBFeature
::
getUrl
()
const
{
{
if
(
elementType
==
FEATURE_INTERNAL
)
if
(
elementType
==
FEATURE_INTERNAL
)
...
@@ -233,20 +274,6 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
...
@@ -233,20 +274,6 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
,
featuresList
(
0
)
,
featuresList
(
0
)
,
mLastItemOffsetIndex
(
0
)
,
mLastItemOffsetIndex
(
0
)
{
{
//Initializing virtual structure of the list
rootPath
=
"/"
+
virtualRootName
;
appPath
=
rootPath
+
"/Applications"
;
audiosPath
=
rootPath
+
"/Audios"
;
moviesPath
=
rootPath
+
"/Movies"
;
picturesPath
=
rootPath
+
"/Pictures"
;
flashPath
=
rootPath
+
"/Animations"
;
interactPath
=
rootPath
+
"/Interactivities"
;
shapesPath
=
rootPath
+
"/Shapes"
;
trashPath
=
rootPath
+
"/Trash"
;
favoritePath
=
rootPath
+
"/Favorites"
;
webSearchPath
=
rootPath
+
"/Web search"
;
//Initializing physical directories from UBSettings
//Initializing physical directories from UBSettings
mUserAudioDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userAudioDirectory
());
mUserAudioDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userAudioDirectory
());
mUserVideoDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userVideoDirectory
());
mUserVideoDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userVideoDirectory
());
...
@@ -264,18 +291,18 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
...
@@ -264,18 +291,18 @@ 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
()
,
QImage
(
":images/libpalette/home.png"
),
"root"
,
QUrl
());
rootElement
=
UBFeature
(
rootPath
,
QImage
(
":images/libpalette/home.png"
),
"root"
,
QUrl
());
audiosElement
=
UBFeature
(
root
Path
,
QImage
(
":images/libpalette/AudiosCategory.svg"
),
tr
(
"Audios"
)
,
mUserAudioDirectoryPath
,
FEATURE_CATEGORY
);
audiosElement
=
UBFeature
(
audios
Path
,
QImage
(
":images/libpalette/AudiosCategory.svg"
),
tr
(
"Audios"
)
,
mUserAudioDirectoryPath
,
FEATURE_CATEGORY
);
moviesElement
=
UBFeature
(
root
Path
,
QImage
(
":images/libpalette/MoviesCategory.svg"
),
tr
(
"Movies"
)
,
mUserVideoDirectoryPath
,
FEATURE_CATEGORY
);
moviesElement
=
UBFeature
(
movies
Path
,
QImage
(
":images/libpalette/MoviesCategory.svg"
),
tr
(
"Movies"
)
,
mUserVideoDirectoryPath
,
FEATURE_CATEGORY
);
picturesElement
=
UBFeature
(
root
Path
,
QImage
(
":images/libpalette/PicturesCategory.svg"
),
tr
(
"Pictures"
)
,
mUserPicturesDirectoryPath
,
FEATURE_CATEGORY
);
picturesElement
=
UBFeature
(
pictures
Path
,
QImage
(
":images/libpalette/PicturesCategory.svg"
),
tr
(
"Pictures"
)
,
mUserPicturesDirectoryPath
,
FEATURE_CATEGORY
);
flashElement
=
UBFeature
(
root
Path
,
QImage
(
":images/libpalette/FlashCategory.svg"
),
tr
(
"Animations"
)
,
mUserAnimationDirectoryPath
,
FEATURE_CATEGORY
);
flashElement
=
UBFeature
(
flash
Path
,
QImage
(
":images/libpalette/FlashCategory.svg"
),
tr
(
"Animations"
)
,
mUserAnimationDirectoryPath
,
FEATURE_CATEGORY
);
interactElement
=
UBFeature
(
roo
tPath
,
QImage
(
":images/libpalette/InteractivesCategory.svg"
),
tr
(
"Interactivities"
)
,
mLibInteractiveDirectoryPath
,
FEATURE_CATEGORY
);
interactElement
=
UBFeature
(
interac
tPath
,
QImage
(
":images/libpalette/InteractivesCategory.svg"
),
tr
(
"Interactivities"
)
,
mLibInteractiveDirectoryPath
,
FEATURE_CATEGORY
);
applicationsElement
=
UBFeature
(
root
Path
,
QImage
(
":images/libpalette/ApplicationsCategory.svg"
),
tr
(
"Applications"
)
,
mUserInteractiveDirectoryPath
,
FEATURE_CATEGORY
);
applicationsElement
=
UBFeature
(
app
Path
,
QImage
(
":images/libpalette/ApplicationsCategory.svg"
),
tr
(
"Applications"
)
,
mUserInteractiveDirectoryPath
,
FEATURE_CATEGORY
);
shapesElement
=
UBFeature
(
root
Path
,
QImage
(
":images/libpalette/ShapesCategory.svg"
),
tr
(
"Shapes"
)
,
mLibShapesDirectoryPath
,
FEATURE_CATEGORY
);
shapesElement
=
UBFeature
(
shapes
Path
,
QImage
(
":images/libpalette/ShapesCategory.svg"
),
tr
(
"Shapes"
)
,
mLibShapesDirectoryPath
,
FEATURE_CATEGORY
);
favoriteElement
=
UBFeature
(
root
Path
,
QImage
(
":images/libpalette/FavoritesCategory.svg"
),
tr
(
"Favorites"
),
QUrl
(
"favorites"
),
FEATURE_FAVORITE
);
favoriteElement
=
UBFeature
(
favorite
Path
,
QImage
(
":images/libpalette/FavoritesCategory.svg"
),
tr
(
"Favorites"
),
QUrl
(
"favorites"
),
FEATURE_FAVORITE
);
webSearchElement
=
UBFeature
(
root
Path
,
QImage
(
":images/libpalette/WebSearchCategory.svg"
),
tr
(
"Web search"
),
mLibSearchDirectoryPath
,
FEATURE_CATEGORY
);
webSearchElement
=
UBFeature
(
webSearch
Path
,
QImage
(
":images/libpalette/WebSearchCategory.svg"
),
tr
(
"Web search"
),
mLibSearchDirectoryPath
,
FEATURE_CATEGORY
);
trashElement
=
UBFeature
(
rootPath
,
QImage
(
":images/libpalette/TrashCategory.svg"
),
tr
(
"Trash"
),
trashDirectoryPath
,
FEATURE_TRASH
);
trashElement
=
UBFeature
(
trashPath
,
QImage
(
":images/libpalette/TrashCategory.svg"
),
tr
(
"Trash"
),
trashDirectoryPath
,
FEATURE_TRASH
);
featuresList
=
new
QList
<
UBFeature
>
();
featuresList
=
new
QList
<
UBFeature
>
();
...
@@ -340,7 +367,7 @@ void UBFeaturesController::createNpApiFeature(const QString &str)
...
@@ -340,7 +367,7 @@ void UBFeaturesController::createNpApiFeature(const QString &str)
QString
widgetName
=
QFileInfo
(
str
).
fileName
();
QString
widgetName
=
QFileInfo
(
str
).
fileName
();
featuresModel
->
addItem
(
UBFeature
(
QString
(
appPath
+
"/Web"
),
QImage
(
UBGraphicsWidgetItem
::
iconFilePath
(
QUrl
::
fromLocalFile
(
str
))),
widgetName
,
QUrl
::
fromLocalFile
(
str
),
FEATURE_INTERACTIVE
));
featuresModel
->
addItem
(
UBFeature
(
QString
(
appPath
+
"/Web/"
+
widgetName
),
QImage
(
UBGraphicsWidgetItem
::
iconFilePath
(
QUrl
::
fromLocalFile
(
str
))),
widgetName
,
QUrl
::
fromLocalFile
(
str
),
FEATURE_INTERACTIVE
));
}
}
void
UBFeaturesController
::
scanFS
()
void
UBFeaturesController
::
scanFS
()
...
@@ -365,9 +392,9 @@ void UBFeaturesController::scanFS()
...
@@ -365,9 +392,9 @@ 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
.
toImage
(),
tool
.
label
,
QUrl
(
tool
.
id
),
FEATURE_INTERNAL
));
featuresList
->
append
(
UBFeature
(
appPath
+
"/"
+
tool
.
label
,
tool
.
icon
.
toImage
(),
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
.
toImage
(),
tool
.
label
,
QUrl
(
tool
.
id
),
FEATURE_INTERNAL
));
featuresList
->
append
(
UBFeature
(
favoritePath
+
"/"
+
tool
.
label
,
tool
.
icon
.
toImage
(),
tool
.
label
,
QUrl
(
tool
.
id
),
FEATURE_INTERNAL
));
}
}
}
}
}
}
...
@@ -386,12 +413,12 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin
...
@@ -386,12 +413,12 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin
if
(
fullFileName
.
contains
(
".thumbnail."
))
if
(
fullFileName
.
contains
(
".thumbnail."
))
continue
;
continue
;
UBFeature
testFeature
(
currVirtualPath
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
);
UBFeature
testFeature
(
currVirtualPath
+
"/"
+
fileName
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
);
featuresList
->
append
(
testFeature
);
featuresList
->
append
(
testFeature
);
if
(
favoriteSet
->
find
(
QUrl
::
fromLocalFile
(
fullFileName
)
)
!=
favoriteSet
->
end
()
)
{
if
(
favoriteSet
->
find
(
QUrl
::
fromLocalFile
(
fullFileName
)
)
!=
favoriteSet
->
end
()
)
{
featuresList
->
append
(
UBFeature
(
favoritePath
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
)
);
featuresList
->
append
(
UBFeature
(
favoritePath
+
"/"
+
fileName
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
),
featureType
)
);
}
}
if
(
featureType
==
FEATURE_FOLDER
)
{
if
(
featureType
==
FEATURE_FOLDER
)
{
...
@@ -466,7 +493,7 @@ void UBFeaturesController::addToFavorite( const QUrl &path )
...
@@ -466,7 +493,7 @@ void UBFeaturesController::addToFavorite( const QUrl &path )
QFileInfo
fileInfo
(
filePath
);
QFileInfo
fileInfo
(
filePath
);
QString
fileName
=
fileInfo
.
fileName
();
QString
fileName
=
fileInfo
.
fileName
();
UBFeatureElementType
type
=
fileTypeFromUrl
(
fileInfo
.
absoluteFilePath
());
UBFeatureElementType
type
=
fileTypeFromUrl
(
fileInfo
.
absoluteFilePath
());
UBFeature
elem
(
favoritePath
,
getIcon
(
filePath
,
type
),
fileName
,
path
,
fileTypeFromUrl
(
filePath
)
);
UBFeature
elem
(
favoritePath
+
"/"
+
fileName
,
getIcon
(
filePath
,
type
),
fileName
,
path
,
fileTypeFromUrl
(
filePath
)
);
favoriteSet
->
insert
(
path
);
favoriteSet
->
insert
(
path
);
saveFavoriteList
();
saveFavoriteList
();
...
@@ -631,7 +658,7 @@ void UBFeaturesController::importImage( const QImage &image, const UBFeature &de
...
@@ -631,7 +658,7 @@ void UBFeaturesController::importImage( const QImage &image, const UBFeature &de
image
.
save
(
filePath
);
image
.
save
(
filePath
);
QImage
thumb
=
createThumbnail
(
filePath
);
QImage
thumb
=
createThumbnail
(
filePath
);
UBFeature
resultItem
=
UBFeature
(
dest
.
getFullVirtualPath
(),
thumb
,
mFileName
,
UBFeature
resultItem
=
UBFeature
(
dest
.
getFullVirtualPath
()
+
"/"
+
mFileName
,
thumb
,
mFileName
,
QUrl
::
fromLocalFile
(
filePath
),
FEATURE_ITEM
);
QUrl
::
fromLocalFile
(
filePath
),
FEATURE_ITEM
);
featuresModel
->
addItem
(
resultItem
);
featuresModel
->
addItem
(
resultItem
);
...
@@ -671,10 +698,10 @@ void UBFeaturesController::addNewFolder(QString name)
...
@@ -671,10 +698,10 @@ void UBFeaturesController::addNewFolder(QString name)
if
(
!
QFileInfo
(
path
).
exists
())
{
if
(
!
QFileInfo
(
path
).
exists
())
{
QDir
().
mkpath
(
path
);
QDir
().
mkpath
(
path
);
}
}
UBFeature
newFeatureFolder
=
UBFeature
(
currentElement
.
getFullVirtualPath
(),
QImage
(
":images/libpalette/folder.svg"
),
UBFeature
newFeatureFolder
=
UBFeature
(
currentElement
.
getFullVirtualPath
()
+
"/"
+
name
,
QImage
(
":images/libpalette/folder.svg"
),
name
,
QUrl
::
fromLocalFile
(
path
),
FEATURE_FOLDER
);
name
,
QUrl
::
fromLocalFile
(
path
),
FEATURE_FOLDER
);
featuresModel
->
addItem
(
newFeatureFolder
);
featuresModel
->
addItem
(
newFeatureFolder
);
featuresProxyModel
->
invalidate
();
featuresProxyModel
->
invalidate
();
}
}
...
@@ -710,9 +737,9 @@ UBFeature UBFeaturesController::getDestinationFeatureForUrl( const QUrl &url )
...
@@ -710,9 +737,9 @@ UBFeature UBFeaturesController::getDestinationFeatureForUrl( const QUrl &url )
void
UBFeaturesController
::
addDownloadedFile
(
const
QUrl
&
sourceUrl
,
const
QByteArray
&
pData
)
void
UBFeaturesController
::
addDownloadedFile
(
const
QUrl
&
sourceUrl
,
const
QByteArray
&
pData
)
{
{
UBFeature
dest
=
getDestinationFeatureForUrl
(
sourceUrl
);
UBFeature
dest
=
getDestinationFeatureForUrl
(
sourceUrl
);
if
(
dest
==
UBFeature
()
)
if
(
dest
==
UBFeature
()
)
return
;
return
;
QString
fileName
=
QFileInfo
(
sourceUrl
.
toString
()
).
fileName
();
QString
fileName
=
QFileInfo
(
sourceUrl
.
toString
()
).
fileName
();
...
@@ -724,7 +751,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
...
@@ -724,7 +751,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
file
.
write
(
pData
);
file
.
write
(
pData
);
file
.
close
();
file
.
close
();
UBFeature
downloadedFeature
=
UBFeature
(
dest
.
getFullVirtualPath
()
,
getIcon
(
filePath
),
UBFeature
downloadedFeature
=
UBFeature
(
dest
.
getFullVirtualPath
()
+
"/"
+
fileName
,
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
);
...
@@ -742,7 +769,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
...
@@ -742,7 +769,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
Q_ASSERT
(
QFileInfo
(
sourcePath
).
exists
()
);
Q_ASSERT
(
QFileInfo
(
sourcePath
).
exists
()
);
UBFeature
possibleDest
=
getDestinationFeatureForUrl
(
url
);
UBFeature
possibleDest
=
getDestinationFeatureForUrl
(
url
);
UBFeature
dest
=
destination
;
UBFeature
dest
=
destination
;
...
@@ -767,7 +794,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
...
@@ -767,7 +794,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu
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
+
"/"
+
name
,
thumb
,
name
,
QUrl
::
fromLocalFile
(
newFullPath
),
type
);
return
newElement
;
return
newElement
;
}
}
...
@@ -861,7 +888,7 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
...
@@ -861,7 +888,7 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
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
+
"/"
+
name
,
thumb
,
name
,
QUrl
::
fromLocalFile
(
newFullPath
),
type
);
return
newElement
;
return
newElement
;
}
}
...
@@ -899,7 +926,7 @@ void UBFeaturesController::moveExternalData(const QUrl &url, const UBFeature &de
...
@@ -899,7 +926,7 @@ void UBFeaturesController::moveExternalData(const QUrl &url, const UBFeature &de
Q_ASSERT
(
QFileInfo
(
newFullPath
).
exists
());
Q_ASSERT
(
QFileInfo
(
newFullPath
).
exists
());
QImage
thumb
=
getIcon
(
newFullPath
,
type
);
QImage
thumb
=
getIcon
(
newFullPath
,
type
);
UBFeature
newElement
(
destVirtualPath
,
thumb
,
name
,
QUrl
::
fromLocalFile
(
newFullPath
),
type
);
UBFeature
newElement
(
destVirtualPath
+
"/"
+
name
,
thumb
,
name
,
QUrl
::
fromLocalFile
(
newFullPath
),
type
);
featuresModel
->
addItem
(
newElement
);
featuresModel
->
addItem
(
newElement
);
}
}
...
...
src/board/UBFeaturesController.h
View file @
9ceff120
...
@@ -94,6 +94,7 @@ public:
...
@@ -94,6 +94,7 @@ public:
// UBFeature();
// UBFeature();
virtual
~
UBFeature
();
virtual
~
UBFeature
();
QString
getName
()
const
{
return
mName
;
}
QString
getName
()
const
{
return
mName
;
}
QString
getDisplayName
()
const
{
return
mDisplayName
;}
QImage
getThumbnail
()
const
{
return
mThumbnail
;}
QImage
getThumbnail
()
const
{
return
mThumbnail
;}
QString
getVirtualPath
()
const
{
return
virtualDir
;
}
QString
getVirtualPath
()
const
{
return
virtualDir
;
}
//QString getPath() const { return mPath; };
//QString getPath() const { return mPath; };
...
@@ -112,11 +113,17 @@ public:
...
@@ -112,11 +113,17 @@ public:
const
QMap
<
QString
,
QString
>
&
getMetadata
()
const
{
return
metadata
;
}
const
QMap
<
QString
,
QString
>
&
getMetadata
()
const
{
return
metadata
;
}
void
setMetadata
(
const
QMap
<
QString
,
QString
>
&
data
)
{
metadata
=
data
;
}
void
setMetadata
(
const
QMap
<
QString
,
QString
>
&
data
)
{
metadata
=
data
;
}
private
:
QString
getNameFromVirtualPath
(
const
QString
&
pVirtPath
);
QString
getVirtualDirFromVirtualPath
(
const
QString
&
pVirtPath
);
private
:
private
:
QString
virtualDir
;
QString
virtualDir
;
QString
virtualPath
;
QString
virtualPath
;
QImage
mThumbnail
;
QImage
mThumbnail
;
QString
mName
;
QString
mName
;
QString
mDisplayName
;
QUrl
mPath
;
QUrl
mPath
;
UBFeatureElementType
elementType
;
UBFeatureElementType
elementType
;
QMap
<
QString
,
QString
>
metadata
;
QMap
<
QString
,
QString
>
metadata
;
...
@@ -182,6 +189,19 @@ public:
...
@@ -182,6 +189,19 @@ public:
void
assignFeaturesListVeiw
(
UBFeaturesListView
*
pList
);
void
assignFeaturesListVeiw
(
UBFeaturesListView
*
pList
);
void
assignPathListView
(
UBFeaturesListView
*
pList
);
void
assignPathListView
(
UBFeaturesListView
*
pList
);
public
:
static
const
QString
rootPath
;
static
const
QString
audiosPath
;
static
const
QString
moviesPath
;
static
const
QString
picturesPath
;
static
const
QString
appPath
;
static
const
QString
flashPath
;
static
const
QString
shapesPath
;
static
const
QString
interactPath
;
static
const
QString
trashPath
;
static
const
QString
favoritePath
;
static
const
QString
webSearchPath
;
signals
:
signals
:
void
maxFilesCountEvaluated
(
int
pLimit
);
void
maxFilesCountEvaluated
(
int
pLimit
);
void
scanStarted
();
void
scanStarted
();
...
@@ -235,17 +255,7 @@ private:
...
@@ -235,17 +255,7 @@ private:
QUrl
trashDirectoryPath
;
QUrl
trashDirectoryPath
;
QUrl
mLibSearchDirectoryPath
;
QUrl
mLibSearchDirectoryPath
;
QString
rootPath
;
QString
audiosPath
;
QString
moviesPath
;
QString
picturesPath
;
QString
appPath
;
QString
flashPath
;
QString
shapesPath
;
QString
interactPath
;
QString
trashPath
;
QString
favoritePath
;
QString
webSearchPath
;
int
mLastItemOffsetIndex
;
int
mLastItemOffsetIndex
;
UBFeature
currentElement
;
UBFeature
currentElement
;
...
...
src/core/UBApplication.cpp
View file @
9ceff120
...
@@ -233,7 +233,7 @@ void UBApplication::setupTranslator(QString forcedLanguage)
...
@@ -233,7 +233,7 @@ void UBApplication::setupTranslator(QString forcedLanguage)
mApplicationTranslator
=
new
QTranslator
(
this
);
mApplicationTranslator
=
new
QTranslator
(
this
);
mQtGuiTranslator
=
new
QTranslator
(
this
);
mQtGuiTranslator
=
new
QTranslator
(
this
);
mApplicationTranslator
->
load
(
UBPlatformUtils
::
translationPath
(
QString
(
"sankore_"
),
language
));
mApplicationTranslator
->
load
(
UBPlatformUtils
::
translationPath
(
QString
(
"sankore_"
),
language
));
installTranslator
(
mApplicationTranslator
);
installTranslator
(
mApplicationTranslator
);
...
...
src/gui/UBFeaturesWidget.cpp
View file @
9ceff120
...
@@ -259,7 +259,7 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
...
@@ -259,7 +259,7 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
}
break
;
}
break
;
}
}
UBFeature
feature
(
QString
()
,
QImage
(
previewImageUrl
),
QString
(),
metadata
[
"Url"
],
FEATURE_ITEM
);
UBFeature
feature
(
"/root"
,
QImage
(
previewImageUrl
),
QString
(),
metadata
[
"Url"
],
FEATURE_ITEM
);
feature
.
setMetadata
(
metadata
);
feature
.
setMetadata
(
metadata
);
centralWidget
->
showElement
(
feature
,
UBFeaturesCentralWidget
::
FeaturePropertiesList
);
centralWidget
->
showElement
(
feature
,
UBFeaturesCentralWidget
::
FeaturePropertiesList
);
...
@@ -1080,7 +1080,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const
...
@@ -1080,7 +1080,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const
return
QVariant
();
return
QVariant
();
if
(
role
==
Qt
::
DisplayRole
)
{
if
(
role
==
Qt
::
DisplayRole
)
{
return
featuresList
->
at
(
index
.
row
()).
get
Name
();
return
featuresList
->
at
(
index
.
row
()).
getDisplay
Name
();
}
}
else
if
(
role
==
Qt
::
DecorationRole
)
{
else
if
(
role
==
Qt
::
DecorationRole
)
{
...
@@ -1311,7 +1311,7 @@ void UBFeaturesModel::moveData(const UBFeature &source, const UBFeature &destina
...
@@ -1311,7 +1311,7 @@ void UBFeaturesModel::moveData(const UBFeature &source, const UBFeature &destina
}
}
}
}
UBFeature
newElement
(
destVirtualPath
,
sourceIcon
,
name
,
QUrl
::
fromLocalFile
(
destFullPath
),
sourceType
);
UBFeature
newElement
(
destVirtualPath
+
"/"
+
name
,
sourceIcon
,
name
,
QUrl
::
fromLocalFile
(
destFullPath
),
sourceType
);
addItem
(
newElement
);
addItem
(
newElement
);
if
(
deleteManualy
)
{
if
(
deleteManualy
)
{
...
...
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