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
56c8bfc3
Commit
56c8bfc3
authored
May 04, 2012
by
Anna Udovichenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed mPath type in UBFeature class to QUrl
parent
dcf9d3be
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
340 additions
and
277 deletions
+340
-277
UBBoardPaletteManager.h
src/board/UBBoardPaletteManager.h
+191
-191
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+56
-43
UBFeaturesController.h
src/board/UBFeaturesController.h
+28
-21
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+60
-20
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+5
-2
No files found.
src/board/UBBoardPaletteManager.h
View file @
56c8bfc3
...
@@ -44,7 +44,7 @@ class UBApplicationController;
...
@@ -44,7 +44,7 @@ class UBApplicationController;
class
UBDockTeacherGuideWidget
;
class
UBDockTeacherGuideWidget
;
// Uncomment this to use old-styles lib paletter
// Uncomment this to use old-styles lib paletter
//
#define USE_WEB_WIDGET
#define USE_WEB_WIDGET
class
UBBoardPaletteManager
:
public
QObject
class
UBBoardPaletteManager
:
public
QObject
...
...
src/board/UBFeaturesController.cpp
View file @
56c8bfc3
...
@@ -18,15 +18,24 @@
...
@@ -18,15 +18,24 @@
#include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsWidgetItem.h"
#include "domain/UBGraphicsWidgetItem.h"
UBFeature
::
UBFeature
(
const
QString
&
url
,
const
QPixmap
&
icon
,
const
QString
&
name
,
const
Q
String
&
realPath
,
UBFeatureElementType
type
)
UBFeature
::
UBFeature
(
const
QString
&
url
,
const
QPixmap
&
icon
,
const
QString
&
name
,
const
Q
Url
&
realPath
,
UBFeatureElementType
type
)
:
virtualPath
(
url
),
mThumbnail
(
icon
),
mName
(
name
),
mPath
(
realPath
),
elementType
(
type
)
:
virtualPath
(
url
),
mThumbnail
(
icon
),
mName
(
name
),
mPath
(
realPath
),
elementType
(
type
)
{
{
}
}
QString
UBFeature
::
getUrl
()
const
{
if
(
elementType
==
FEATURE_INTERNAL
)
return
getFullPath
().
toString
();
/*if ( UBApplication::isFromWeb( getFullPath() ) )
return QUrl( getFullPath() );*/
return
getFullPath
().
toLocalFile
();
}
bool
UBFeature
::
operator
==
(
const
UBFeature
&
f
)
const
bool
UBFeature
::
operator
==
(
const
UBFeature
&
f
)
const
{
{
return
virtualPath
==
f
.
get
Url
()
&&
mName
==
f
.
getName
()
&&
mPath
==
f
.
getFullPath
()
&&
elementType
==
f
.
getType
();
return
virtualPath
==
f
.
get
VirtualPath
()
&&
mName
==
f
.
getName
()
&&
mPath
==
f
.
getFullPath
()
&&
elementType
==
f
.
getType
();
}
}
bool
UBFeature
::
operator
!=
(
const
UBFeature
&
f
)
const
bool
UBFeature
::
operator
!=
(
const
UBFeature
&
f
)
const
...
@@ -55,24 +64,24 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
...
@@ -55,24 +64,24 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
void
UBFeaturesController
::
initDirectoryTree
()
void
UBFeaturesController
::
initDirectoryTree
()
{
{
mUserAudioDirectoryPath
=
UBSettings
::
settings
()
->
userAudioDirectory
(
);
mUserAudioDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userAudioDirectory
()
);
mUserVideoDirectoryPath
=
UBSettings
::
settings
()
->
userVideoDirectory
(
);
mUserVideoDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userVideoDirectory
()
);
mUserPicturesDirectoryPath
=
UBSettings
::
settings
()
->
userImageDirectory
(
);
mUserPicturesDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userImageDirectory
()
);
mUserInteractiveDirectoryPath
=
UBSettings
::
settings
()
->
userInteractiveDirectory
(
);
mUserInteractiveDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userInteractiveDirectory
()
);
mUserAnimationDirectoryPath
=
UBSettings
::
settings
()
->
userAnimationDirectory
(
);
mUserAnimationDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userAnimationDirectory
()
);
mLibPicturesDirectoryPath
=
UBSettings
::
settings
()
->
applicationImageLibraryDirectory
(
);
mLibPicturesDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
applicationImageLibraryDirectory
()
);
mLibInteractiveDirectoryPath
=
UBSettings
::
settings
()
->
applicationInteractivesDirectory
(
);
mLibInteractiveDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
applicationInteractivesDirectory
()
);
mLibApplicationsDirectoryPath
=
UBSettings
::
settings
()
->
applicationApplicationsLibraryDirectory
(
);
mLibApplicationsDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
applicationApplicationsLibraryDirectory
()
);
mLibShapesDirectoryPath
=
UBSettings
::
settings
()
->
applicationShapeLibraryDirectory
()
;
mLibShapesDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
applicationShapeLibraryDirectory
()
)
;
mLibSearchDirectoryPath
=
UBSettings
::
settings
()
->
userSearchDirectory
(
);
mLibSearchDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
userSearchDirectory
()
);
trashDirectoryPath
=
UBSettings
::
userTrashDirPath
(
);
trashDirectoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
userTrashDirPath
()
);
featuresList
=
new
QList
<
UBFeature
>
();
featuresList
=
new
QList
<
UBFeature
>
();
QList
<
UBToolsManager
::
UBToolDescriptor
>
tools
=
UBToolsManager
::
manager
()
->
allTools
();
QList
<
UBToolsManager
::
UBToolDescriptor
>
tools
=
UBToolsManager
::
manager
()
->
allTools
();
featuresList
->
append
(
UBFeature
(
QString
(),
QPixmap
(
":images/libpalette/home.png"
),
"root"
,
Q
String
()
)
);
featuresList
->
append
(
UBFeature
(
QString
(),
QPixmap
(
":images/libpalette/home.png"
),
"root"
,
Q
Url
()
)
);
currentElement
=
featuresList
->
at
(
0
);
currentElement
=
featuresList
->
at
(
0
);
appPath
=
rootPath
+
"/Applications"
;
appPath
=
rootPath
+
"/Applications"
;
...
@@ -99,7 +108,7 @@ void UBFeaturesController::initDirectoryTree()
...
@@ -99,7 +108,7 @@ void UBFeaturesController::initDirectoryTree()
featuresList
->
append
(
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/ShapesCategory.svg"
),
"Shapes"
,
mLibShapesDirectoryPath
)
);
featuresList
->
append
(
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/ShapesCategory.svg"
),
"Shapes"
,
mLibShapesDirectoryPath
)
);
trashElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/TrashCategory.svg"
),
"Trash"
,
trashDirectoryPath
,
FEATURE_TRASH
);
trashElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/TrashCategory.svg"
),
"Trash"
,
trashDirectoryPath
,
FEATURE_TRASH
);
featuresList
->
append
(
trashElement
);
featuresList
->
append
(
trashElement
);
favoriteElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/FavoritesCategory.svg"
),
"Favorites"
,
"favorites"
,
FEATURE_FAVORITE
);
favoriteElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/FavoritesCategory.svg"
),
"Favorites"
,
QUrl
(
"favorites"
)
,
FEATURE_FAVORITE
);
featuresList
->
append
(
favoriteElement
);
featuresList
->
append
(
favoriteElement
);
webSearchElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/WebSearchCategory.svg"
),
"Web search"
,
mLibSearchDirectoryPath
);
webSearchElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/WebSearchCategory.svg"
),
"Web search"
,
mLibSearchDirectoryPath
);
featuresList
->
append
(
webSearchElement
);
featuresList
->
append
(
webSearchElement
);
...
@@ -107,10 +116,10 @@ void UBFeaturesController::initDirectoryTree()
...
@@ -107,10 +116,10 @@ void UBFeaturesController::initDirectoryTree()
foreach
(
UBToolsManager
::
UBToolDescriptor
tool
,
tools
)
foreach
(
UBToolsManager
::
UBToolDescriptor
tool
,
tools
)
{
{
featuresList
->
append
(
UBFeature
(
appPath
,
tool
.
icon
,
tool
.
label
,
tool
.
id
,
FEATURE_INTERNAL
)
);
featuresList
->
append
(
UBFeature
(
appPath
,
tool
.
icon
,
tool
.
label
,
QUrl
(
tool
.
id
)
,
FEATURE_INTERNAL
)
);
if
(
favoriteSet
->
find
(
tool
.
id
)
!=
favoriteSet
->
end
()
)
if
(
favoriteSet
->
find
(
QUrl
(
tool
.
id
)
)
!=
favoriteSet
->
end
()
)
{
{
featuresList
->
append
(
UBFeature
(
favoritePath
,
tool
.
icon
,
tool
.
label
,
tool
.
id
,
FEATURE_INTERNAL
)
);
featuresList
->
append
(
UBFeature
(
favoritePath
,
tool
.
icon
,
tool
.
label
,
QUrl
(
tool
.
id
)
,
FEATURE_INTERNAL
)
);
}
}
}
}
fileSystemScan
(
mUserInteractiveDirectoryPath
,
appPath
);
fileSystemScan
(
mUserInteractiveDirectoryPath
,
appPath
);
...
@@ -129,9 +138,9 @@ void UBFeaturesController::initDirectoryTree()
...
@@ -129,9 +138,9 @@ void UBFeaturesController::initDirectoryTree()
}
}
void
UBFeaturesController
::
fileSystemScan
(
const
Q
String
&
currentPath
,
const
QString
&
currVirtualPath
)
void
UBFeaturesController
::
fileSystemScan
(
const
Q
Url
&
currentPath
,
const
QString
&
currVirtualPath
)
{
{
QFileInfoList
fileInfoList
=
UBFileSystemUtils
::
allElementsInDirectory
(
currentPath
);
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
)
...
@@ -152,6 +161,7 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
...
@@ -152,6 +161,7 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
QPixmap
icon
=
QPixmap
(
":images/libpalette/soundIcon.svg"
);
QPixmap
icon
=
QPixmap
(
":images/libpalette/soundIcon.svg"
);
QString
fullFileName
=
fileInfo
->
filePath
();
QString
fullFileName
=
fileInfo
->
filePath
();
if
(
fileType
==
FEATURE_FOLDER
)
if
(
fileType
==
FEATURE_FOLDER
)
{
{
icon
=
QPixmap
(
":images/libpalette/folder.svg"
);
icon
=
QPixmap
(
":images/libpalette/folder.svg"
);
...
@@ -171,15 +181,15 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
...
@@ -171,15 +181,15 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
icon = QPixmap( thumbnailPath );
icon = QPixmap( thumbnailPath );
else icon = createThumbnail( fullFileName );*/
else icon = createThumbnail( fullFileName );*/
}
}
featuresList
->
append
(
UBFeature
(
currVirtualPath
,
icon
,
fileName
,
fullFileName
,
fileType
)
);
featuresList
->
append
(
UBFeature
(
currVirtualPath
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
)
,
fileType
)
);
if
(
favoriteSet
->
find
(
fullFileName
)
!=
favoriteSet
->
end
()
)
if
(
favoriteSet
->
find
(
QUrl
::
fromLocalFile
(
fullFileName
)
)
!=
favoriteSet
->
end
()
)
{
{
featuresList
->
append
(
UBFeature
(
favoritePath
,
icon
,
fileName
,
fullFileName
,
fileType
)
);
featuresList
->
append
(
UBFeature
(
favoritePath
,
icon
,
fileName
,
QUrl
::
fromLocalFile
(
fullFileName
)
,
fileType
)
);
}
}
if
(
fileType
==
FEATURE_FOLDER
)
if
(
fileType
==
FEATURE_FOLDER
)
{
{
fileSystemScan
(
fullFileName
,
currVirtualPath
+
"/"
+
fileName
);
fileSystemScan
(
QUrl
::
fromLocalFile
(
fullFileName
)
,
currVirtualPath
+
"/"
+
fileName
);
}
}
}
}
...
@@ -187,7 +197,7 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
...
@@ -187,7 +197,7 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
void
UBFeaturesController
::
loadFavoriteList
()
void
UBFeaturesController
::
loadFavoriteList
()
{
{
favoriteSet
=
new
QSet
<
Q
String
>
();
favoriteSet
=
new
QSet
<
Q
Url
>
();
QFile
file
(
UBSettings
::
userDataDirectory
()
+
"/favorites.dat"
);
QFile
file
(
UBSettings
::
userDataDirectory
()
+
"/favorites.dat"
);
if
(
file
.
exists
()
)
if
(
file
.
exists
()
)
{
{
...
@@ -197,7 +207,7 @@ void UBFeaturesController::loadFavoriteList()
...
@@ -197,7 +207,7 @@ void UBFeaturesController::loadFavoriteList()
in
>>
elementsNumber
;
in
>>
elementsNumber
;
for
(
int
i
=
0
;
i
<
elementsNumber
;
++
i
)
for
(
int
i
=
0
;
i
<
elementsNumber
;
++
i
)
{
{
Q
String
path
;
Q
Url
path
;
in
>>
path
;
in
>>
path
;
/*QFileInfo fileInfo( path );
/*QFileInfo fileInfo( path );
QString fileName = fileInfo.fileName();
QString fileName = fileInfo.fileName();
...
@@ -216,7 +226,7 @@ void UBFeaturesController::saveFavoriteList()
...
@@ -216,7 +226,7 @@ void UBFeaturesController::saveFavoriteList()
file
.
open
(
QIODevice
::
WriteOnly
);
file
.
open
(
QIODevice
::
WriteOnly
);
QDataStream
out
(
&
file
);
QDataStream
out
(
&
file
);
out
<<
favoriteSet
->
size
();
out
<<
favoriteSet
->
size
();
for
(
QSet
<
Q
String
>::
iterator
it
=
favoriteSet
->
begin
();
it
!=
favoriteSet
->
end
();
++
it
)
for
(
QSet
<
Q
Url
>::
iterator
it
=
favoriteSet
->
begin
();
it
!=
favoriteSet
->
end
();
++
it
)
{
{
out
<<
(
*
it
);
out
<<
(
*
it
);
}
}
...
@@ -226,12 +236,12 @@ void UBFeaturesController::saveFavoriteList()
...
@@ -226,12 +236,12 @@ void UBFeaturesController::saveFavoriteList()
UBFeature
UBFeaturesController
::
addToFavorite
(
const
QUrl
&
path
)
UBFeature
UBFeaturesController
::
addToFavorite
(
const
QUrl
&
path
)
{
{
QString
filePath
=
fileNameFromUrl
(
path
);
QString
filePath
=
fileNameFromUrl
(
path
);
if
(
favoriteSet
->
find
(
fileP
ath
)
==
favoriteSet
->
end
()
)
if
(
favoriteSet
->
find
(
p
ath
)
==
favoriteSet
->
end
()
)
{
{
QFileInfo
fileInfo
(
filePath
);
QFileInfo
fileInfo
(
filePath
);
QString
fileName
=
fileInfo
.
fileName
();
QString
fileName
=
fileInfo
.
fileName
();
UBFeature
elem
(
favoritePath
,
thumbnailForFile
(
filePath
),
fileName
,
fileP
ath
,
fileTypeFromUrl
(
filePath
)
);
UBFeature
elem
(
favoritePath
,
thumbnailForFile
(
filePath
),
fileName
,
p
ath
,
fileTypeFromUrl
(
filePath
)
);
favoriteSet
->
insert
(
fileP
ath
);
favoriteSet
->
insert
(
p
ath
);
saveFavoriteList
();
saveFavoriteList
();
return
elem
;
return
elem
;
}
}
...
@@ -241,9 +251,9 @@ UBFeature UBFeaturesController::addToFavorite( const QUrl &path )
...
@@ -241,9 +251,9 @@ UBFeature UBFeaturesController::addToFavorite( const QUrl &path )
void
UBFeaturesController
::
removeFromFavorite
(
const
QUrl
&
path
)
void
UBFeaturesController
::
removeFromFavorite
(
const
QUrl
&
path
)
{
{
QString
filePath
=
fileNameFromUrl
(
path
);
QString
filePath
=
fileNameFromUrl
(
path
);
if
(
favoriteSet
->
find
(
fileP
ath
)
!=
favoriteSet
->
end
()
)
if
(
favoriteSet
->
find
(
p
ath
)
!=
favoriteSet
->
end
()
)
{
{
favoriteSet
->
erase
(
favoriteSet
->
find
(
fileP
ath
)
);
favoriteSet
->
erase
(
favoriteSet
->
find
(
p
ath
)
);
saveFavoriteList
();
saveFavoriteList
();
}
}
}
}
...
@@ -256,6 +266,7 @@ QString UBFeaturesController::fileNameFromUrl( const QUrl &url )
...
@@ -256,6 +266,7 @@ QString UBFeaturesController::fileNameFromUrl( const QUrl &url )
return
url
.
toLocalFile
();
return
url
.
toLocalFile
();
}
}
UBFeatureElementType
UBFeaturesController
::
fileTypeFromUrl
(
const
QString
&
path
)
UBFeatureElementType
UBFeaturesController
::
fileTypeFromUrl
(
const
QString
&
path
)
{
{
QFileInfo
fileInfo
(
path
);
QFileInfo
fileInfo
(
path
);
...
@@ -336,24 +347,26 @@ QPixmap UBFeaturesController::createThumbnail(const QString &path)
...
@@ -336,24 +347,26 @@ QPixmap UBFeaturesController::createThumbnail(const QString &path)
UBFeature
UBFeaturesController
::
newFolder
(
const
QString
&
name
)
UBFeature
UBFeaturesController
::
newFolder
(
const
QString
&
name
)
{
{
QString
path
=
currentElement
.
getFullPath
()
+
"/"
+
name
;
QString
path
=
currentElement
.
getFullPath
().
toLocalFile
()
+
"/"
+
name
;
if
(
!
QFileInfo
(
path
).
exists
())
if
(
!
QFileInfo
(
path
).
exists
())
{
{
QDir
().
mkpath
(
path
);
QDir
().
mkpath
(
path
);
}
}
return
UBFeature
(
currentElement
.
getUrl
()
+
"/"
+
currentElement
.
getName
(),
QPixmap
(
":images/libpalette/folder.svg"
),
name
,
path
,
FEATURE_FOLDER
);
return
UBFeature
(
currentElement
.
getFullVirtualPath
(),
QPixmap
(
":images/libpalette/folder.svg"
),
name
,
QUrl
::
fromLocalFile
(
path
),
FEATURE_FOLDER
);
}
}
void
UBFeaturesController
::
addItemToPage
(
const
UBFeature
&
item
)
void
UBFeaturesController
::
addItemToPage
(
const
UBFeature
&
item
)
{
{
if
(
item
.
getType
()
==
FEATURE_INTERNAL
)
UBApplication
::
boardController
->
downloadURL
(
item
.
getFullPath
()
);
/*if ( item.getType() == FEATURE_INTERNAL )
{
{
UBApplication::boardController->downloadURL( QUrl( item.getFullPath() ) );
UBApplication::boardController->downloadURL( QUrl( item.getFullPath() ) );
}
}
else
else
{
{
UBApplication::boardController->downloadURL( QUrl::fromLocalFile( item.getFullPath() ) );
UBApplication::boardController->downloadURL( QUrl::fromLocalFile( item.getFullPath() ) );
}
}
*/
}
}
UBFeature
UBFeaturesController
::
getDestinationForItem
(
const
QUrl
&
url
)
UBFeature
UBFeaturesController
::
getDestinationForItem
(
const
QUrl
&
url
)
...
@@ -394,14 +407,14 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
...
@@ -394,14 +407,14 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
UBFeature
dest
=
destination
;
UBFeature
dest
=
destination
;
if
(
destination
!=
trashElement
&&
if
(
destination
!=
trashElement
&&
!
destination
.
get
VirtualPath
().
startsWith
(
possibleDest
.
get
VirtualPath
(),
Qt
::
CaseInsensitive
)
)
!
destination
.
get
FullVirtualPath
().
startsWith
(
possibleDest
.
getFull
VirtualPath
(),
Qt
::
CaseInsensitive
)
)
{
{
dest
=
possibleDest
;
dest
=
possibleDest
;
}
}
QString
name
=
QFileInfo
(
sourcePath
).
fileName
();
QString
name
=
QFileInfo
(
sourcePath
).
fileName
();
QString
destPath
=
dest
.
getFullPath
();
QString
destPath
=
dest
.
getFullPath
().
toLocalFile
();
QString
destVirtualPath
=
dest
.
getVirtualPath
();
QString
destVirtualPath
=
dest
.
get
Full
VirtualPath
();
QString
newFullPath
=
destPath
+
"/"
+
name
;
QString
newFullPath
=
destPath
+
"/"
+
name
;
QFile
(
sourcePath
).
copy
(
newFullPath
);
QFile
(
sourcePath
).
copy
(
newFullPath
);
...
@@ -410,7 +423,7 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
...
@@ -410,7 +423,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
,
newFullPath
,
type
);
UBFeature
newElement
(
destVirtualPath
,
thumb
,
name
,
QUrl
::
fromLocalFile
(
newFullPath
)
,
type
);
return
newElement
;
return
newElement
;
}
}
...
@@ -420,7 +433,7 @@ void UBFeaturesController::deleteItem( const QUrl &url )
...
@@ -420,7 +433,7 @@ void UBFeaturesController::deleteItem( const QUrl &url )
Q_ASSERT
(
QFileInfo
(
path
).
exists
()
);
Q_ASSERT
(
QFileInfo
(
path
).
exists
()
);
QString
thumbnailPath
=
UBFileSystemUtils
::
thumbnailPath
(
path
);
QString
thumbnailPath
=
UBFileSystemUtils
::
thumbnailPath
(
path
);
if
(
thumbnailPath
.
length
()
&&
QFileInfo
(
thumbnailPath
).
exists
()
)
if
(
thumbnailPath
.
length
()
&&
QFileInfo
(
thumbnailPath
).
exists
()
)
{
{
QFile
::
remove
(
thumbnailPath
);
QFile
::
remove
(
thumbnailPath
);
}
}
...
@@ -429,7 +442,7 @@ void UBFeaturesController::deleteItem( const QUrl &url )
...
@@ -429,7 +442,7 @@ void UBFeaturesController::deleteItem( const QUrl &url )
bool
UBFeaturesController
::
isTrash
(
const
QUrl
&
url
)
bool
UBFeaturesController
::
isTrash
(
const
QUrl
&
url
)
{
{
return
url
.
toLocalFile
().
startsWith
(
trashDirectoryPath
);
return
url
.
toLocalFile
().
startsWith
(
trashDirectoryPath
.
toLocalFile
()
);
}
}
UBFeaturesController
::~
UBFeaturesController
()
UBFeaturesController
::~
UBFeaturesController
()
...
...
src/board/UBFeaturesController.h
View file @
56c8bfc3
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
#include <QVector>
#include <QVector>
#include <QString>
#include <QString>
#include <QPixmap>
#include <QPixmap>
#include <QMap>
#include <QUrl>
//#include "UBDockPaletteWidget.h"
//#include "UBDockPaletteWidget.h"
...
@@ -29,25 +31,30 @@ class UBFeature
...
@@ -29,25 +31,30 @@ class UBFeature
public
:
public
:
UBFeature
()
{;}
UBFeature
()
{;}
//UBFeature(const UBFeature &f);
//UBFeature(const UBFeature &f);
UBFeature
(
const
QString
&
url
,
const
QPixmap
&
icon
,
const
QString
&
name
,
const
Q
String
&
realPath
,
UBFeatureElementType
type
=
FEATURE_CATEGORY
);
UBFeature
(
const
QString
&
url
,
const
QPixmap
&
icon
,
const
QString
&
name
,
const
Q
Url
&
realPath
,
UBFeatureElementType
type
=
FEATURE_CATEGORY
);
virtual
~
UBFeature
()
{;}
virtual
~
UBFeature
()
{;}
QString
getName
()
const
{
return
mName
;
}
QString
getName
()
const
{
return
mName
;
}
QPixmap
getThumbnail
()
const
{
return
mThumbnail
;}
QPixmap
getThumbnail
()
const
{
return
mThumbnail
;}
QString
get
Url
()
const
{
return
virtualPath
;
}
QString
get
VirtualPath
()
const
{
return
virtualPath
;
}
//QString getPath() const { return mPath; };
//QString getPath() const { return mPath; };
QString
getFullPath
()
const
{
return
mPath
;
}
QUrl
getFullPath
()
const
{
return
mPath
;
}
QString
getVirtualPath
()
const
{
return
virtualPath
+
"/"
+
mName
;
}
QString
getFullVirtualPath
()
const
{
return
virtualPath
+
"/"
+
mName
;
}
QString
getUrl
()
const
;
UBFeatureElementType
getType
()
const
{
return
elementType
;
}
UBFeatureElementType
getType
()
const
{
return
elementType
;
}
bool
isFolder
()
const
;
bool
isFolder
()
const
;
bool
isDeletable
()
const
;
bool
isDeletable
()
const
;
bool
operator
==
(
const
UBFeature
&
f
)
const
;
bool
operator
==
(
const
UBFeature
&
f
)
const
;
bool
operator
!=
(
const
UBFeature
&
f
)
const
;
bool
operator
!=
(
const
UBFeature
&
f
)
const
;
const
QMap
<
QString
,
QString
>
&
getMetadata
()
const
{
return
metadata
;
}
void
setMetadata
(
const
QMap
<
QString
,
QString
>
&
data
)
{
metadata
=
data
;
}
private
:
private
:
QString
virtualPath
;
QString
virtualPath
;
QPixmap
mThumbnail
;
QPixmap
mThumbnail
;
QString
mName
;
QString
mName
;
Q
String
mPath
;
Q
Url
mPath
;
UBFeatureElementType
elementType
;
UBFeatureElementType
elementType
;
QMap
<
QString
,
QString
>
metadata
;
};
};
Q_DECLARE_METATYPE
(
UBFeature
)
Q_DECLARE_METATYPE
(
UBFeature
)
...
@@ -80,7 +87,7 @@ public:
...
@@ -80,7 +87,7 @@ public:
static
bool
isDeletable
(
const
QUrl
&
url
);
static
bool
isDeletable
(
const
QUrl
&
url
);
private
:
private
:
void
initDirectoryTree
();
void
initDirectoryTree
();
void
fileSystemScan
(
const
Q
String
&
currPath
,
const
QString
&
currVirtualPath
);
void
fileSystemScan
(
const
Q
Url
&
currPath
,
const
QString
&
currVirtualPath
);
static
QPixmap
createThumbnail
(
const
QString
&
path
);
static
QPixmap
createThumbnail
(
const
QString
&
path
);
//void addImageToCurrentPage( const QString &path );
//void addImageToCurrentPage( const QString &path );
void
loadFavoriteList
();
void
loadFavoriteList
();
...
@@ -92,22 +99,22 @@ private:
...
@@ -92,22 +99,22 @@ private:
QList
<
UBFeature
>
*
featuresList
;
QList
<
UBFeature
>
*
featuresList
;
UBFeature
*
rootElement
;
UBFeature
*
rootElement
;
Q
String
mUserAudioDirectoryPath
;
Q
Url
mUserAudioDirectoryPath
;
Q
String
mUserVideoDirectoryPath
;
Q
Url
mUserVideoDirectoryPath
;
Q
String
mUserPicturesDirectoryPath
;
Q
Url
mUserPicturesDirectoryPath
;
Q
String
mUserInteractiveDirectoryPath
;
Q
Url
mUserInteractiveDirectoryPath
;
Q
String
mUserAnimationDirectoryPath
;
Q
Url
mUserAnimationDirectoryPath
;
QString
libraryPath
;
QString
libraryPath
;
Q
String
mLibAudioDirectoryPath
;
Q
Url
mLibAudioDirectoryPath
;
Q
String
mLibVideoDirectoryPath
;
Q
Url
mLibVideoDirectoryPath
;
Q
String
mLibPicturesDirectoryPath
;
Q
Url
mLibPicturesDirectoryPath
;
Q
String
mLibInteractiveDirectoryPath
;
Q
Url
mLibInteractiveDirectoryPath
;
Q
String
mLibAnimationDirectoryPath
;
Q
Url
mLibAnimationDirectoryPath
;
Q
String
mLibApplicationsDirectoryPath
;
Q
Url
mLibApplicationsDirectoryPath
;
Q
String
mLibShapesDirectoryPath
;
Q
Url
mLibShapesDirectoryPath
;
Q
String
trashDirectoryPath
;
Q
Url
trashDirectoryPath
;
Q
String
mLibSearchDirectoryPath
;
Q
Url
mLibSearchDirectoryPath
;
QString
rootPath
;
QString
rootPath
;
QString
audiosPath
;
QString
audiosPath
;
...
@@ -132,7 +139,7 @@ private:
...
@@ -132,7 +139,7 @@ private:
UBFeature
shapesElement
;
UBFeature
shapesElement
;
UBFeature
webSearchElement
;
UBFeature
webSearchElement
;
QSet
<
Q
String
>
*
favoriteSet
;
QSet
<
Q
Url
>
*
favoriteSet
;
};
};
...
...
src/gui/UBFeaturesWidget.cpp
View file @
56c8bfc3
...
@@ -124,6 +124,8 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
...
@@ -124,6 +124,8 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
connect
(
pathListView
,
SIGNAL
(
clicked
(
const
QModelIndex
&
)
),
connect
(
pathListView
,
SIGNAL
(
clicked
(
const
QModelIndex
&
)
),
this
,
SLOT
(
currentPathChanged
(
const
QModelIndex
&
)
)
);
this
,
SLOT
(
currentPathChanged
(
const
QModelIndex
&
)
)
);
connect
(
thumbSlider
,
SIGNAL
(
sliderMoved
(
int
)
),
this
,
SLOT
(
thumbnailSizeChanged
(
int
)
)
);
connect
(
thumbSlider
,
SIGNAL
(
sliderMoved
(
int
)
),
this
,
SLOT
(
thumbnailSizeChanged
(
int
)
)
);
connect
(
UBApplication
::
boardController
,
SIGNAL
(
displayMetadata
(
QMap
<
QString
,
QString
>
)
),
this
,
SLOT
(
onDisplayMetadata
(
QMap
<
QString
,
QString
>
)
)
);
}
}
bool
UBFeaturesWidget
::
eventFilter
(
QObject
*
target
,
QEvent
*
event
)
bool
UBFeaturesWidget
::
eventFilter
(
QObject
*
target
,
QEvent
*
event
)
...
@@ -165,7 +167,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t)
...
@@ -165,7 +167,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t)
if
(
feature
.
isFolder
()
)
if
(
feature
.
isFolder
()
)
{
{
QString
newPath
=
feature
.
get
Url
()
+
"/"
+
feature
.
getName
();
QString
newPath
=
feature
.
get
FullVirtualPath
();
//pathViewer->addPathElement( feature.getThumbnail(), newPath );
//pathViewer->addPathElement( feature.getThumbnail(), newPath );
controller
->
setCurrentElement
(
feature
);
controller
->
setCurrentElement
(
feature
);
...
@@ -208,7 +210,7 @@ void UBFeaturesWidget::currentPathChanged(const QModelIndex &index)
...
@@ -208,7 +210,7 @@ void UBFeaturesWidget::currentPathChanged(const QModelIndex &index)
if
(
index
.
isValid
()
)
if
(
index
.
isValid
()
)
{
{
UBFeature
feature
=
featuresPathModel
->
data
(
index
,
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
UBFeature
feature
=
featuresPathModel
->
data
(
index
,
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
QString
newPath
=
feature
.
get
Url
()
+
"/"
+
feature
.
getName
();
QString
newPath
=
feature
.
get
FullVirtualPath
();
featuresPathModel
->
setPath
(
newPath
);
featuresPathModel
->
setPath
(
newPath
);
featuresPathModel
->
invalidate
();
featuresPathModel
->
invalidate
();
...
@@ -281,7 +283,7 @@ void UBFeaturesWidget::addToFavorite( const QMimeData & mimeData )
...
@@ -281,7 +283,7 @@ void UBFeaturesWidget::addToFavorite( const QMimeData & mimeData )
foreach
(
QUrl
url
,
urls
)
foreach
(
QUrl
url
,
urls
)
{
{
UBFeature
elem
=
controller
->
addToFavorite
(
url
);
UBFeature
elem
=
controller
->
addToFavorite
(
url
);
if
(
!
elem
.
get
Url
().
isEmpty
()
&&
!
elem
.
getUrl
().
isNull
()
)
if
(
!
elem
.
get
VirtualPath
().
isEmpty
()
&&
!
elem
.
getVirtualPath
().
isNull
()
)
featuresModel
->
addItem
(
elem
);
featuresModel
->
addItem
(
elem
);
}
}
QSortFilterProxyModel
*
model
=
dynamic_cast
<
QSortFilterProxyModel
*>
(
featuresListView
->
model
()
);
QSortFilterProxyModel
*
model
=
dynamic_cast
<
QSortFilterProxyModel
*>
(
featuresListView
->
model
()
);
...
@@ -305,6 +307,16 @@ void UBFeaturesWidget::thumbnailSizeChanged( int value )
...
@@ -305,6 +307,16 @@ void UBFeaturesWidget::thumbnailSizeChanged( int value )
featuresListView
->
setGridSize
(
QSize
(
value
*
1.75
,
value
*
1.75
)
);
featuresListView
->
setGridSize
(
QSize
(
value
*
1.75
,
value
*
1.75
)
);
}
}
void
UBFeaturesWidget
::
onDisplayMetadata
(
QMap
<
QString
,
QString
>
metadata
)
{
UBFeature
feature
(
QString
(),
QPixmap
(
":images/libpalette/notFound.png"
),
QString
(),
metadata
[
"Url"
],
FEATURE_ITEM
);
feature
.
setMetadata
(
metadata
);
featureProperties
->
showElement
(
feature
);
switchToProperties
();
mActionBar
->
setCurrentState
(
IN_PROPERTIES
);
}
void
UBFeaturesWidget
::
switchToListView
()
void
UBFeaturesWidget
::
switchToListView
()
{
{
stackedWidget
->
setCurrentIndex
(
ID_LISTVIEW
);
stackedWidget
->
setCurrentIndex
(
ID_LISTVIEW
);
...
@@ -441,7 +453,7 @@ UBFeaturesWebView::~UBFeaturesWebView()
...
@@ -441,7 +453,7 @@ UBFeaturesWebView::~UBFeaturesWebView()
void
UBFeaturesWebView
::
showElement
(
const
UBFeature
&
elem
)
void
UBFeaturesWebView
::
showElement
(
const
UBFeature
&
elem
)
{
{
QString
qsWidgetName
;
QString
qsWidgetName
;
QString
path
=
elem
.
getFullPath
();
QString
path
=
elem
.
getFullPath
().
toLocalFile
();
QString
qsConfigPath
=
QString
(
"%0/config.xml"
).
arg
(
path
);
QString
qsConfigPath
=
QString
(
"%0/config.xml"
).
arg
(
path
);
...
@@ -490,6 +502,7 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) :
...
@@ -490,6 +502,7 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) :
,
mpThumbnail
(
NULL
)
,
mpThumbnail
(
NULL
)
,
mpOrigPixmap
(
NULL
)
,
mpOrigPixmap
(
NULL
)
,
mpElement
(
NULL
)
,
mpElement
(
NULL
)
,
mpObjInfos
(
NULL
)
{
{
setObjectName
(
name
);
setObjectName
(
name
);
...
@@ -533,6 +546,15 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) :
...
@@ -533,6 +546,15 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) :
mpObjInfoLabel
->
setStyleSheet
(
QString
(
"color: #888888; font-size : 18px; font-weight:bold;"
));
mpObjInfoLabel
->
setStyleSheet
(
QString
(
"color: #888888; font-size : 18px; font-weight:bold;"
));
mpLayout
->
addWidget
(
mpObjInfoLabel
,
0
);
mpLayout
->
addWidget
(
mpObjInfoLabel
,
0
);
mpObjInfos
=
new
QTreeWidget
(
this
);
mpObjInfos
->
setColumnCount
(
2
);
mpObjInfos
->
header
()
->
hide
();
mpObjInfos
->
setAlternatingRowColors
(
true
);
mpObjInfos
->
setRootIsDecorated
(
false
);
mpObjInfos
->
setObjectName
(
"DockPaletteWidgetBox"
);
mpObjInfos
->
setStyleSheet
(
"background:white;"
);
mpLayout
->
addWidget
(
mpObjInfos
,
1
);
connect
(
mpAddPageButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onAddToPage
()));
connect
(
mpAddPageButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onAddToPage
()));
}
}
...
@@ -552,24 +574,24 @@ void UBFeatureProperties::showElement( const UBFeature &elem )
...
@@ -552,24 +574,24 @@ void UBFeatureProperties::showElement( const UBFeature &elem )
mpElement
=
new
UBFeature
(
elem
);
mpElement
=
new
UBFeature
(
elem
);
mpOrigPixmap
=
new
QPixmap
(
elem
.
getThumbnail
()
);
mpOrigPixmap
=
new
QPixmap
(
elem
.
getThumbnail
()
);
mpThumbnail
->
setPixmap
(
elem
.
getThumbnail
().
scaledToWidth
(
THUMBNAIL_WIDTH
));
mpThumbnail
->
setPixmap
(
elem
.
getThumbnail
().
scaledToWidth
(
THUMBNAIL_WIDTH
));
//
populateMetadata();
populateMetadata
();
if
(
UBApplication
::
isFromWeb
(
elem
.
get
Url
()
)
)
if
(
UBApplication
::
isFromWeb
(
elem
.
get
FullPath
().
toString
()
)
)
{
{
mpAddToLibButton
->
show
();
mpAddToLibButton
->
show
();
/*if(elem->metadatas()["Type"].toLower().contains("image")
)
if
(
elem
.
getMetadata
()[
"Type"
].
toLower
().
contains
(
"image"
)
)
{
{
mpSetAsBackgroundButton
->
show
();
mpSetAsBackgroundButton
->
show
();
}
}
else
else
{
{
mpSetAsBackgroundButton
->
hide
();
mpSetAsBackgroundButton
->
hide
();
}
*/
}
}
}
else
else
{
{
mpAddToLibButton
->
hide
();
mpAddToLibButton
->
hide
();
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
elem
.
get
Url
()
).
contains
(
"image"
))
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
elem
.
get
FullPath
().
toLocalFile
()
).
contains
(
"image"
))
{
{
mpSetAsBackgroundButton
->
show
();
mpSetAsBackgroundButton
->
show
();
}
}
...
@@ -580,18 +602,37 @@ void UBFeatureProperties::showElement( const UBFeature &elem )
...
@@ -580,18 +602,37 @@ void UBFeatureProperties::showElement( const UBFeature &elem )
}
}
}
}
void
UBFeatureProperties
::
populateMetadata
()
{
if
(
NULL
!=
mpObjInfos
){
mpObjInfos
->
clear
();
QMap
<
QString
,
QString
>
metas
=
mpElement
->
getMetadata
();
QList
<
QString
>
lKeys
=
metas
.
keys
();
QList
<
QString
>
lValues
=
metas
.
values
();
for
(
int
i
=
0
;
i
<
metas
.
size
();
i
++
){
QStringList
values
;
values
<<
lKeys
.
at
(
i
);
values
<<
lValues
.
at
(
i
);
mpItem
=
new
QTreeWidgetItem
(
values
);
mpObjInfos
->
addTopLevelItem
(
mpItem
);
}
mpObjInfos
->
resizeColumnToContents
(
0
);
}
}
void
UBFeatureProperties
::
onAddToPage
()
void
UBFeatureProperties
::
onAddToPage
()
{
{
QWidget
*
w
=
parentWidget
()
->
parentWidget
();
QWidget
*
w
=
parentWidget
()
->
parentWidget
();
UBFeaturesWidget
*
featuresWidget
=
dynamic_cast
<
UBFeaturesWidget
*>
(
w
);
UBFeaturesWidget
*
featuresWidget
=
dynamic_cast
<
UBFeaturesWidget
*>
(
w
);
featuresWidget
->
getFeaturesController
()
->
addItemToPage
(
*
mpElement
);
featuresWidget
->
getFeaturesController
()
->
addItemToPage
(
*
mpElement
);
/*if ( UBApplication::isFromWeb( mpElement->get
Url
() ) )
/*if ( UBApplication::isFromWeb( mpElement->get
VirtualPath
() ) )
{
{
sDownloadFileDesc desc;
sDownloadFileDesc desc;
desc.isBackground = false;
desc.isBackground = false;
desc.modal = true;
desc.modal = true;
desc.name = QFileInfo( mpElement->getName() ).fileName();
desc.name = QFileInfo( mpElement->getName() ).fileName();
desc.url = mpElement->get
Url
();
desc.url = mpElement->get
VirtualPath
();
UBDownloadManager::downloadManager()->addFileToDownload(desc);
UBDownloadManager::downloadManager()->addFileToDownload(desc);
}
}
...
@@ -641,7 +682,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const
...
@@ -641,7 +682,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const
}
}
else
if
(
role
==
Qt
::
UserRole
)
else
if
(
role
==
Qt
::
UserRole
)
{
{
return
featuresList
->
at
(
index
.
row
()).
get
Url
();
return
featuresList
->
at
(
index
.
row
()).
get
VirtualPath
();
}
}
else
if
(
role
==
Qt
::
UserRole
+
1
)
else
if
(
role
==
Qt
::
UserRole
+
1
)
{
{
...
@@ -669,7 +710,7 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const
...
@@ -669,7 +710,7 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const
}
}
else
if
(
element
.
getType
()
==
FEATURE_INTERACTIVE
||
element
.
getType
()
==
FEATURE_ITEM
)
else
if
(
element
.
getType
()
==
FEATURE_INTERACTIVE
||
element
.
getType
()
==
FEATURE_ITEM
)
{
{
urlList
.
push_back
(
QUrl
::
fromLocalFile
(
element
.
getFullPath
()
)
);
urlList
.
push_back
(
element
.
getFullPath
(
)
);
}
}
}
}
}
}
...
@@ -731,8 +772,8 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path )
...
@@ -731,8 +772,8 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path )
{
{
for
(
int
i
=
0
;
i
<
featuresList
->
size
();
++
i
)
for
(
int
i
=
0
;
i
<
featuresList
->
size
();
++
i
)
{
{
if
(
!
QString
::
compare
(
featuresList
->
at
(
i
).
get
FullPath
(),
path
,
Qt
::
CaseInsensitive
)
&&
if
(
!
QString
::
compare
(
featuresList
->
at
(
i
).
get
Url
(),
path
,
Qt
::
CaseInsensitive
)
&&
!
QString
::
compare
(
featuresList
->
at
(
i
).
get
Url
(),
"/root/favorites"
,
Qt
::
CaseInsensitive
)
)
!
QString
::
compare
(
featuresList
->
at
(
i
).
get
VirtualPath
(),
"/root/favorites"
,
Qt
::
CaseInsensitive
)
)
{
{
removeRow
(
i
,
QModelIndex
()
);
removeRow
(
i
,
QModelIndex
()
);
return
;
return
;
...
@@ -776,7 +817,7 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
...
@@ -776,7 +817,7 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
item
.
getType
()
==
FEATURE_ITEM
||
item
.
getType
()
==
FEATURE_ITEM
||
item
.
getType
()
==
FEATURE_INTERNAL
)
item
.
getType
()
==
FEATURE_INTERNAL
)
return
Qt
::
ItemIsDragEnabled
|
defaultFlags
;
return
Qt
::
ItemIsDragEnabled
|
defaultFlags
;
if
(
item
.
isFolder
()
&&
!
item
.
get
Ful
lPath
().
isNull
()
)
if
(
item
.
isFolder
()
&&
!
item
.
get
Virtua
lPath
().
isNull
()
)
return
defaultFlags
|
Qt
::
ItemIsDropEnabled
;
return
defaultFlags
|
Qt
::
ItemIsDropEnabled
;
else
return
defaultFlags
|
Qt
::
ItemIsDropEnabled
;
else
return
defaultFlags
|
Qt
::
ItemIsDropEnabled
;
}
}
...
@@ -846,9 +887,8 @@ bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelInde
...
@@ -846,9 +887,8 @@ bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelInde
eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/
eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/
UBFeature
feature
=
sourceModel
()
->
data
(
index
,
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
UBFeature
feature
=
sourceModel
()
->
data
(
index
,
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
QString
virtualFullPath
=
feature
.
getUrl
()
+
"/"
+
feature
.
getName
();
return
feature
.
isFolder
()
&&
path
.
startsWith
(
virtualFullPath
);
return
feature
.
isFolder
()
&&
path
.
startsWith
(
feature
.
getFullVirtualPath
()
);
}
}
QString
UBFeaturesItemDelegate
::
displayText
(
const
QVariant
&
value
,
const
QLocale
&
locale
)
const
QString
UBFeaturesItemDelegate
::
displayText
(
const
QVariant
&
value
,
const
QLocale
&
locale
)
const
...
...
src/gui/UBFeaturesWidget.h
View file @
56c8bfc3
...
@@ -99,6 +99,7 @@ private slots:
...
@@ -99,6 +99,7 @@ private slots:
void
addToFavorite
(
const
QMimeData
&
);
void
addToFavorite
(
const
QMimeData
&
);
void
removeFromFavorite
(
const
QMimeData
&
);
void
removeFromFavorite
(
const
QMimeData
&
);
void
thumbnailSizeChanged
(
int
);
void
thumbnailSizeChanged
(
int
);
void
onDisplayMetadata
(
QMap
<
QString
,
QString
>
);
protected
:
protected
:
bool
eventFilter
(
QObject
*
target
,
QEvent
*
event
);
bool
eventFilter
(
QObject
*
target
,
QEvent
*
event
);
};
};
...
@@ -160,18 +161,20 @@ private slots:
...
@@ -160,18 +161,20 @@ private slots:
//void onBack();
//void onBack();
private
:
private
:
void
populateMetadata
();
QVBoxLayout
*
mpLayout
;
QVBoxLayout
*
mpLayout
;
QHBoxLayout
*
mpButtonLayout
;
QHBoxLayout
*
mpButtonLayout
;
UBFeatureItemButton
*
mpAddPageButton
;
UBFeatureItemButton
*
mpAddPageButton
;
UBFeatureItemButton
*
mpAddToLibButton
;
UBFeatureItemButton
*
mpAddToLibButton
;
UBFeatureItemButton
*
mpSetAsBackgroundButton
;
UBFeatureItemButton
*
mpSetAsBackgroundButton
;
QLabel
*
mpObjInfoLabel
;
QLabel
*
mpObjInfoLabel
;
//
QTreeWidget* mpObjInfos;
QTreeWidget
*
mpObjInfos
;
QLabel
*
mpThumbnail
;
QLabel
*
mpThumbnail
;
QPixmap
*
mpOrigPixmap
;
QPixmap
*
mpOrigPixmap
;
int
maxThumbHeight
;
int
maxThumbHeight
;
UBFeature
*
mpElement
;
UBFeature
*
mpElement
;
//
QTreeWidgetItem* mpItem;
QTreeWidgetItem
*
mpItem
;
};
};
...
...
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