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
107f2b64
Commit
107f2b64
authored
12 years ago
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
Conflicts: src/gui/UBFeaturesWidget.h
parents
047be003
51e90964
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
198 additions
and
51 deletions
+198
-51
style.qss
resources/style.qss
+7
-0
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+39
-30
UBFeaturesController.h
src/board/UBFeaturesController.h
+7
-4
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+119
-15
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+26
-2
No files found.
resources/style.qss
View file @
107f2b64
...
@@ -26,6 +26,13 @@ QWidget#UBLibWebView
...
@@ -26,6 +26,13 @@ QWidget#UBLibWebView
border: 2px solid #999999;
border: 2px solid #999999;
}
}
QWidget#UBFeaturesWebView
{
background: #EEEEEE;
border-radius : 10px;
border: 2px solid #999999;
}
QListView
QListView
{
{
background: #EEEEEE;
background: #EEEEEE;
...
...
This diff is collapsed.
Click to expand it.
src/board/UBFeaturesController.cpp
View file @
107f2b64
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
#include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsWidgetItem.h"
#include "domain/UBGraphicsWidgetItem.h"
#include "core/memcheck.h"
UBFeature
::
UBFeature
(
const
QString
&
url
,
const
QPixmap
&
icon
,
const
QString
&
name
,
const
QString
&
realPath
,
UBFeatureElementType
type
)
UBFeature
::
UBFeature
(
const
QString
&
url
,
const
QPixmap
&
icon
,
const
QString
&
name
,
const
QString
&
realPath
,
UBFeatureElementType
type
)
:
virtualPath
(
url
),
mThumbnail
(
icon
),
mName
(
name
),
mPath
(
realPath
),
elementType
(
type
)
:
virtualPath
(
url
),
mThumbnail
(
icon
),
mName
(
name
),
mPath
(
realPath
),
elementType
(
type
)
{
{
...
@@ -67,12 +65,15 @@ void UBFeaturesController::initDirectoryTree()
...
@@ -67,12 +65,15 @@ void UBFeaturesController::initDirectoryTree()
mLibInteractiveDirectoryPath
=
UBSettings
::
settings
()
->
applicationInteractivesDirectory
();
mLibInteractiveDirectoryPath
=
UBSettings
::
settings
()
->
applicationInteractivesDirectory
();
mLibApplicationsDirectoryPath
=
UBSettings
::
settings
()
->
applicationApplicationsLibraryDirectory
();
mLibApplicationsDirectoryPath
=
UBSettings
::
settings
()
->
applicationApplicationsLibraryDirectory
();
mLibShapesDirectoryPath
=
UBSettings
::
settings
()
->
applicationShapeLibraryDirectory
()
;
mLibShapesDirectoryPath
=
UBSettings
::
settings
()
->
applicationShapeLibraryDirectory
()
;
mLibSearchDirectoryPath
=
UBSettings
::
settings
()
->
userSearchDirectory
();
trashDirectoryPath
=
UBSettings
::
userTrashDirPath
();
trashDirectoryPath
=
UBSettings
::
userTrashDirPath
();
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"
,
QString
()
)
);
featuresList
->
append
(
UBFeature
(
QString
(),
QPixmap
(
":images/libpalette/home.png"
),
"root"
,
QString
()
)
);
currentElement
=
featuresList
.
at
(
0
);
currentElement
=
featuresList
->
at
(
0
);
appPath
=
rootPath
+
"/Applications"
;
appPath
=
rootPath
+
"/Applications"
;
audiosPath
=
rootPath
+
"/Audios"
;
audiosPath
=
rootPath
+
"/Audios"
;
...
@@ -85,30 +86,31 @@ void UBFeaturesController::initDirectoryTree()
...
@@ -85,30 +86,31 @@ void UBFeaturesController::initDirectoryTree()
favoritePath
=
rootPath
+
"/Favorites"
;
favoritePath
=
rootPath
+
"/Favorites"
;
audiosElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/AudiosCategory.svg"
),
"Audios"
,
mUserAudioDirectoryPath
);
audiosElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/AudiosCategory.svg"
),
"Audios"
,
mUserAudioDirectoryPath
);
featuresList
.
append
(
audiosElement
);
featuresList
->
append
(
audiosElement
);
moviesElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/MoviesCategory.svg"
),
"Movies"
,
mUserVideoDirectoryPath
);
moviesElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/MoviesCategory.svg"
),
"Movies"
,
mUserVideoDirectoryPath
);
featuresList
.
append
(
moviesElement
);
featuresList
->
append
(
moviesElement
);
picturesElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/PicturesCategory.svg"
),
"Pictures"
,
mUserPicturesDirectoryPath
);
picturesElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/PicturesCategory.svg"
),
"Pictures"
,
mUserPicturesDirectoryPath
);
featuresList
.
append
(
picturesElement
);
featuresList
->
append
(
picturesElement
);
featuresList
.
append
(
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/ApplicationsCategory.svg"
),
"Applications"
,
mUserInteractiveDirectoryPath
)
);
featuresList
->
append
(
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/ApplicationsCategory.svg"
),
"Applications"
,
mUserInteractiveDirectoryPath
)
);
flashElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/FlashCategory.svg"
),
"Animations"
,
mUserAnimationDirectoryPath
);
flashElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/FlashCategory.svg"
),
"Animations"
,
mUserAnimationDirectoryPath
);
featuresList
.
append
(
flashElement
);
featuresList
->
append
(
flashElement
);
interactElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/InteractivesCategory.svg"
),
"Interactivities"
,
mLibInteractiveDirectoryPath
);
interactElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/InteractivesCategory.svg"
),
"Interactivities"
,
mLibInteractiveDirectoryPath
);
featuresList
.
append
(
interactElement
);
featuresList
->
append
(
interactElement
);
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"
,
"favorites"
,
FEATURE_FAVORITE
);
featuresList
.
append
(
favoriteElement
);
featuresList
->
append
(
favoriteElement
);
searchElement
=
UBFeature
(
rootPath
,
QPixmap
(
":images/libpalette/WebSearchCategory.svg"
),
"Web search"
,
mLibSearchDirectoryPath
);
featuresList
->
append
(
searchElement
);
loadFavoriteList
();
loadFavoriteList
();
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
,
tool
.
id
,
FEATURE_INTERNAL
)
);
if
(
favoriteSet
.
find
(
tool
.
id
)
!=
favoriteSet
.
end
()
)
if
(
favoriteSet
->
find
(
tool
.
id
)
!=
favoriteSet
->
end
()
)
{
{
featuresList
.
append
(
UBFeature
(
favoritePath
,
tool
.
icon
,
tool
.
label
,
tool
.
id
,
FEATURE_INTERNAL
)
);
featuresList
->
append
(
UBFeature
(
favoritePath
,
tool
.
icon
,
tool
.
label
,
tool
.
id
,
FEATURE_INTERNAL
)
);
}
}
}
}
fileSystemScan
(
mUserInteractiveDirectoryPath
,
appPath
);
fileSystemScan
(
mUserInteractiveDirectoryPath
,
appPath
);
...
@@ -122,7 +124,7 @@ void UBFeaturesController::initDirectoryTree()
...
@@ -122,7 +124,7 @@ void UBFeaturesController::initDirectoryTree()
fileSystemScan
(
mLibShapesDirectoryPath
,
shapesPath
);
fileSystemScan
(
mLibShapesDirectoryPath
,
shapesPath
);
fileSystemScan
(
mLibInteractiveDirectoryPath
,
interactPath
);
fileSystemScan
(
mLibInteractiveDirectoryPath
,
interactPath
);
fileSystemScan
(
trashDirectoryPath
,
trashPath
);
fileSystemScan
(
trashDirectoryPath
,
trashPath
);
fileSystemScan
(
mLibSearchDirectoryPath
,
rootPath
+
"/"
+
"Web search"
);
}
}
...
@@ -137,8 +139,14 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
...
@@ -137,8 +139,14 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
UBFeatureElementType
fileType
=
fileInfo
->
isDir
()
?
FEATURE_FOLDER
:
FEATURE_ITEM
;
UBFeatureElementType
fileType
=
fileInfo
->
isDir
()
?
FEATURE_FOLDER
:
FEATURE_ITEM
;
QString
fileName
=
fileInfo
->
fileName
();
QString
fileName
=
fileInfo
->
fileName
();
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
fileName
).
contains
(
"application"
)
)
{
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
fileName
).
contains
(
"application"
)
)
fileType
=
FEATURE_INTERACTIVE
;
{
if
(
UBFileSystemUtils
::
mimeTypeFromFileName
(
fileName
).
contains
(
"application/search"
)
)
{
fileType
=
FEATURE_SEARCH
;
}
else
fileType
=
FEATURE_INTERACTIVE
;
}
}
QString
itemName
=
(
fileType
!=
FEATURE_ITEM
)
?
fileName
:
fileInfo
->
completeBaseName
();
QString
itemName
=
(
fileType
!=
FEATURE_ITEM
)
?
fileName
:
fileInfo
->
completeBaseName
();
QPixmap
icon
=
QPixmap
(
":images/libpalette/soundIcon.svg"
);
QPixmap
icon
=
QPixmap
(
":images/libpalette/soundIcon.svg"
);
...
@@ -163,10 +171,10 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
...
@@ -163,10 +171,10 @@ 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
,
fullFileName
,
fileType
)
);
if
(
favoriteSet
.
find
(
fullFileName
)
!=
favoriteSet
.
end
()
)
if
(
favoriteSet
->
find
(
fullFileName
)
!=
favoriteSet
->
end
()
)
{
{
featuresList
.
append
(
UBFeature
(
favoritePath
,
icon
,
fileName
,
fullFileName
,
fileType
)
);
featuresList
->
append
(
UBFeature
(
favoritePath
,
icon
,
fileName
,
fullFileName
,
fileType
)
);
}
}
if
(
fileType
==
FEATURE_FOLDER
)
if
(
fileType
==
FEATURE_FOLDER
)
...
@@ -179,6 +187,7 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
...
@@ -179,6 +187,7 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
void
UBFeaturesController
::
loadFavoriteList
()
void
UBFeaturesController
::
loadFavoriteList
()
{
{
favoriteSet
=
new
QSet
<
QString
>
();
QFile
file
(
UBSettings
::
userDataDirectory
()
+
"/favorites.dat"
);
QFile
file
(
UBSettings
::
userDataDirectory
()
+
"/favorites.dat"
);
if
(
file
.
exists
()
)
if
(
file
.
exists
()
)
{
{
...
@@ -195,7 +204,7 @@ void UBFeaturesController::loadFavoriteList()
...
@@ -195,7 +204,7 @@ void UBFeaturesController::loadFavoriteList()
UBFeature elem( favoritePath, thumbnailForFile( path ), fileName, path, fileTypeFromUrl(path) );
UBFeature elem( favoritePath, thumbnailForFile( path ), fileName, path, fileTypeFromUrl(path) );
featuresList->append( elem );*/
featuresList->append( elem );*/
favoriteSet
.
insert
(
path
);
favoriteSet
->
insert
(
path
);
}
}
}
}
}
}
...
@@ -206,8 +215,8 @@ void UBFeaturesController::saveFavoriteList()
...
@@ -206,8 +215,8 @@ void UBFeaturesController::saveFavoriteList()
file
.
resize
(
0
);
file
.
resize
(
0
);
file
.
open
(
QIODevice
::
WriteOnly
);
file
.
open
(
QIODevice
::
WriteOnly
);
QDataStream
out
(
&
file
);
QDataStream
out
(
&
file
);
out
<<
favoriteSet
.
size
();
out
<<
favoriteSet
->
size
();
for
(
QSet
<
QString
>::
iterator
it
=
favoriteSet
.
begin
();
it
!=
favoriteSet
.
end
();
++
it
)
for
(
QSet
<
QString
>::
iterator
it
=
favoriteSet
->
begin
();
it
!=
favoriteSet
->
end
();
++
it
)
{
{
out
<<
(
*
it
);
out
<<
(
*
it
);
}
}
...
@@ -217,12 +226,12 @@ void UBFeaturesController::saveFavoriteList()
...
@@ -217,12 +226,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
(
filePath
)
==
favoriteSet
.
end
()
)
if
(
favoriteSet
->
find
(
filePath
)
==
favoriteSet
->
end
()
)
{
{
QFileInfo
fileInfo
(
filePath
);
QFileInfo
fileInfo
(
filePath
);
QString
fileName
=
fileInfo
.
fileName
();
QString
fileName
=
fileInfo
.
fileName
();
UBFeature
elem
(
favoritePath
,
thumbnailForFile
(
filePath
),
fileName
,
filePath
,
fileTypeFromUrl
(
filePath
)
);
UBFeature
elem
(
favoritePath
,
thumbnailForFile
(
filePath
),
fileName
,
filePath
,
fileTypeFromUrl
(
filePath
)
);
favoriteSet
.
insert
(
filePath
);
favoriteSet
->
insert
(
filePath
);
saveFavoriteList
();
saveFavoriteList
();
return
elem
;
return
elem
;
}
}
...
@@ -232,9 +241,9 @@ UBFeature UBFeaturesController::addToFavorite( const QUrl &path )
...
@@ -232,9 +241,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
(
filePath
)
!=
favoriteSet
.
end
()
)
if
(
favoriteSet
->
find
(
filePath
)
!=
favoriteSet
->
end
()
)
{
{
favoriteSet
.
erase
(
favoriteSet
.
find
(
filePath
)
);
favoriteSet
->
erase
(
favoriteSet
->
find
(
filePath
)
);
saveFavoriteList
();
saveFavoriteList
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/board/UBFeaturesController.h
View file @
107f2b64
...
@@ -20,7 +20,8 @@ enum UBFeatureElementType
...
@@ -20,7 +20,8 @@ enum UBFeatureElementType
FEATURE_INTERNAL
,
FEATURE_INTERNAL
,
FEATURE_ITEM
,
FEATURE_ITEM
,
FEATURE_TRASH
,
FEATURE_TRASH
,
FEATURE_FAVORITE
FEATURE_FAVORITE
,
FEATURE_SEARCH
};
};
class
UBFeature
class
UBFeature
...
@@ -58,7 +59,7 @@ public:
...
@@ -58,7 +59,7 @@ public:
UBFeaturesController
(
QWidget
*
parentWidget
);
UBFeaturesController
(
QWidget
*
parentWidget
);
virtual
~
UBFeaturesController
();
virtual
~
UBFeaturesController
();
const
QList
<
UBFeature
>&
getFeatures
()
const
{
return
featuresList
;
}
QList
<
UBFeature
>*
getFeatures
()
const
{
return
featuresList
;
}
const
QString
&
getRootPath
()
const
{
return
rootPath
;
}
const
QString
&
getRootPath
()
const
{
return
rootPath
;
}
...
@@ -88,7 +89,7 @@ private:
...
@@ -88,7 +89,7 @@ private:
static
UBFeatureElementType
fileTypeFromUrl
(
const
QString
&
path
);
static
UBFeatureElementType
fileTypeFromUrl
(
const
QString
&
path
);
QList
<
UBFeature
>
featuresList
;
QList
<
UBFeature
>
*
featuresList
;
UBFeature
*
rootElement
;
UBFeature
*
rootElement
;
QString
mUserAudioDirectoryPath
;
QString
mUserAudioDirectoryPath
;
...
@@ -106,6 +107,7 @@ private:
...
@@ -106,6 +107,7 @@ private:
QString
mLibApplicationsDirectoryPath
;
QString
mLibApplicationsDirectoryPath
;
QString
mLibShapesDirectoryPath
;
QString
mLibShapesDirectoryPath
;
QString
trashDirectoryPath
;
QString
trashDirectoryPath
;
QString
mLibSearchDirectoryPath
;
QString
rootPath
;
QString
rootPath
;
QString
audiosPath
;
QString
audiosPath
;
...
@@ -128,8 +130,9 @@ private:
...
@@ -128,8 +130,9 @@ private:
UBFeature
interactElement
;
UBFeature
interactElement
;
UBFeature
flashElement
;
UBFeature
flashElement
;
UBFeature
shapesElement
;
UBFeature
shapesElement
;
UBFeature
searchElement
;
QSet
<
QString
>
favoriteSet
;
QSet
<
QString
>
*
favoriteSet
;
};
};
...
...
This diff is collapsed.
Click to expand it.
src/gui/UBFeaturesWidget.cpp
View file @
107f2b64
#include <QDomDocument>
#include "UBFeaturesWidget.h"
#include "UBFeaturesWidget.h"
#include "domain/UBAbstractWidget.h"
#include "domain/UBAbstractWidget.h"
#include "gui/UBThumbnailWidget.h"
#include "gui/UBThumbnailWidget.h"
...
@@ -6,7 +8,7 @@
...
@@ -6,7 +8,7 @@
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/UBDownloadManager.h"
#include "core/UBDownloadManager.h"
#include "globals/UBGlobals.h"
#include "globals/UBGlobals.h"
#include "
core/memcheck
.h"
#include "
board/UBBoardController
.h"
UBFeaturesWidget
::
UBFeaturesWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
UBFeaturesWidget
::
UBFeaturesWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
{
{
...
@@ -83,6 +85,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
...
@@ -83,6 +85,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
pathScene
=
new
QGraphicsScene
(
this
);
pathScene
=
new
QGraphicsScene
(
this
);
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
featureProperties
=
new
UBFeatureProperties
(
this
);
featureProperties
=
new
UBFeatureProperties
(
this
);
webView
=
new
UBFeaturesWebView
(
this
);
//layout->addWidget( pathViewer );
//layout->addWidget( pathViewer );
//pathViewer->show();
//pathViewer->show();
...
@@ -92,6 +95,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
...
@@ -92,6 +95,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
stackedWidget
->
addWidget
(
featuresListView
);
stackedWidget
->
addWidget
(
featuresListView
);
stackedWidget
->
addWidget
(
featureProperties
);
stackedWidget
->
addWidget
(
featureProperties
);
stackedWidget
->
addWidget
(
webView
);
stackedWidget
->
setCurrentIndex
(
ID_LISTVIEW
);
stackedWidget
->
setCurrentIndex
(
ID_LISTVIEW
);
currentStackedWidget
=
ID_LISTVIEW
;
currentStackedWidget
=
ID_LISTVIEW
;
...
@@ -184,6 +188,11 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t)
...
@@ -184,6 +188,11 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t)
mActionBar
->
setCurrentState
(
IN_FOLDER
);
mActionBar
->
setCurrentState
(
IN_FOLDER
);
}
}
}
}
else
if
(
feature
.
getType
()
==
FEATURE_SEARCH
)
{
webView
->
showElement
(
feature
);
switchToWebView
();
}
else
else
{
{
featureProperties
->
showElement
(
feature
);
featureProperties
->
showElement
(
feature
);
...
@@ -308,6 +317,11 @@ void UBFeaturesWidget::switchToProperties()
...
@@ -308,6 +317,11 @@ void UBFeaturesWidget::switchToProperties()
currentStackedWidget
=
ID_PROPERTIES
;
currentStackedWidget
=
ID_PROPERTIES
;
}
}
void
UBFeaturesWidget
::
switchToWebView
()
{
stackedWidget
->
setCurrentIndex
(
ID_WEBVIEW
);
currentStackedWidget
=
ID_WEBVIEW
;
}
/*
/*
...
@@ -376,6 +390,96 @@ void UBFeaturesListView::dropEvent( QDropEvent *event )
...
@@ -376,6 +390,96 @@ void UBFeaturesListView::dropEvent( QDropEvent *event )
}
}
UBFeaturesWebView
::
UBFeaturesWebView
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
mpView
(
NULL
)
,
mpWebSettings
(
NULL
)
,
mpLayout
(
NULL
)
,
mpSankoreAPI
(
NULL
)
{
setObjectName
(
name
);
SET_STYLE_SHEET
();
mpLayout
=
new
QVBoxLayout
();
setLayout
(
mpLayout
);
mpView
=
new
QWebView
(
this
);
mpView
->
setObjectName
(
"SearchEngineView"
);
mpSankoreAPI
=
new
UBWidgetUniboardAPI
(
UBApplication
::
boardController
->
activeScene
());
mpView
->
page
()
->
mainFrame
()
->
addToJavaScriptWindowObject
(
"sankore"
,
mpSankoreAPI
);
mpWebSettings
=
QWebSettings
::
globalSettings
();
mpWebSettings
->
setAttribute
(
QWebSettings
::
JavaEnabled
,
true
);
mpWebSettings
->
setAttribute
(
QWebSettings
::
PluginsEnabled
,
true
);
mpWebSettings
->
setAttribute
(
QWebSettings
::
LocalStorageDatabaseEnabled
,
true
);
mpWebSettings
->
setAttribute
(
QWebSettings
::
OfflineWebApplicationCacheEnabled
,
true
);
mpWebSettings
->
setAttribute
(
QWebSettings
::
OfflineStorageDatabaseEnabled
,
true
);
mpWebSettings
->
setAttribute
(
QWebSettings
::
JavascriptCanAccessClipboard
,
true
);
mpWebSettings
->
setAttribute
(
QWebSettings
::
DnsPrefetchEnabled
,
true
);
mpLayout
->
addWidget
(
mpView
);
connect
(
mpView
,
SIGNAL
(
loadFinished
(
bool
)),
this
,
SLOT
(
onLoadFinished
(
bool
)));
}
UBFeaturesWebView
::~
UBFeaturesWebView
()
{
if
(
NULL
!=
mpSankoreAPI
){
delete
mpSankoreAPI
;
mpSankoreAPI
=
NULL
;
}
if
(
NULL
!=
mpView
){
delete
mpView
;
mpView
=
NULL
;
}
if
(
NULL
!=
mpLayout
){
delete
mpLayout
;
mpLayout
=
NULL
;
}
}
void
UBFeaturesWebView
::
showElement
(
const
UBFeature
&
elem
)
{
QString
qsWidgetName
;
QString
path
=
elem
.
getFullPath
();
QString
qsConfigPath
=
QString
(
"%0/config.xml"
).
arg
(
path
);
if
(
QFile
::
exists
(
qsConfigPath
))
{
QFile
f
(
qsConfigPath
);
if
(
f
.
open
(
QIODevice
::
ReadOnly
))
{
QDomDocument
domDoc
;
domDoc
.
setContent
(
QString
(
f
.
readAll
()));
QDomElement
root
=
domDoc
.
documentElement
();
QDomNode
node
=
root
.
firstChild
();
while
(
!
node
.
isNull
())
{
if
(
node
.
toElement
().
tagName
()
==
"content"
)
{
QDomAttr
srcAttr
=
node
.
toElement
().
attributeNode
(
"src"
);
qsWidgetName
=
srcAttr
.
value
();
break
;
}
node
=
node
.
nextSibling
();
}
f
.
close
();
}
}
mpView
->
load
(
QUrl
::
fromLocalFile
(
QString
(
"%0/%1"
).
arg
(
path
).
arg
(
qsWidgetName
)));
}
void
UBFeaturesWebView
::
onLoadFinished
(
bool
ok
)
{
if
(
ok
&&
NULL
!=
mpSankoreAPI
){
mpView
->
page
()
->
mainFrame
()
->
addToJavaScriptWindowObject
(
"sankore"
,
mpSankoreAPI
);
}
}
UBFeatureProperties
::
UBFeatureProperties
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
UBFeatureProperties
::
UBFeatureProperties
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
mpLayout
(
NULL
)
,
mpLayout
(
NULL
)
,
mpButtonLayout
(
NULL
)
,
mpButtonLayout
(
NULL
)
...
@@ -530,19 +634,19 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const
...
@@ -530,19 +634,19 @@ 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
()).
getName
();
return
featuresList
->
at
(
index
.
row
()).
getName
();
else
if
(
role
==
Qt
::
DecorationRole
)
else
if
(
role
==
Qt
::
DecorationRole
)
{
{
return
QIcon
(
featuresList
.
at
(
index
.
row
()).
getThumbnail
()
);
return
QIcon
(
featuresList
->
at
(
index
.
row
()).
getThumbnail
()
);
}
}
else
if
(
role
==
Qt
::
UserRole
)
else
if
(
role
==
Qt
::
UserRole
)
{
{
return
featuresList
.
at
(
index
.
row
()).
getUrl
();
return
featuresList
->
at
(
index
.
row
()).
getUrl
();
}
}
else
if
(
role
==
Qt
::
UserRole
+
1
)
else
if
(
role
==
Qt
::
UserRole
+
1
)
{
{
//return featuresList->at(index.row()).getType();
//return featuresList->at(index.row()).getType();
UBFeature
f
=
featuresList
.
at
(
index
.
row
());
UBFeature
f
=
featuresList
->
at
(
index
.
row
());
return
QVariant
::
fromValue
(
f
);
return
QVariant
::
fromValue
(
f
);
}
}
...
@@ -618,17 +722,17 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
...
@@ -618,17 +722,17 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
void
UBFeaturesModel
::
addItem
(
const
UBFeature
&
item
)
void
UBFeaturesModel
::
addItem
(
const
UBFeature
&
item
)
{
{
beginInsertRows
(
QModelIndex
(),
featuresList
.
size
(),
featuresList
.
size
()
);
beginInsertRows
(
QModelIndex
(),
featuresList
->
size
(),
featuresList
->
size
()
);
featuresList
.
push_back
(
item
);
featuresList
->
push_back
(
item
);
endInsertRows
();
endInsertRows
();
}
}
void
UBFeaturesModel
::
deleteFavoriteItem
(
const
QString
&
path
)
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
).
getFullPath
(),
path
,
Qt
::
CaseInsensitive
)
&&
if
(
!
QString
::
compare
(
featuresList
->
at
(
i
).
getFullPath
(),
path
,
Qt
::
CaseInsensitive
)
&&
!
QString
::
compare
(
featuresList
.
at
(
i
).
getUrl
(),
"/root/favorites"
,
Qt
::
CaseInsensitive
)
)
!
QString
::
compare
(
featuresList
->
at
(
i
).
getUrl
(),
"/root/favorites"
,
Qt
::
CaseInsensitive
)
)
{
{
removeRow
(
i
,
QModelIndex
()
);
removeRow
(
i
,
QModelIndex
()
);
return
;
return
;
...
@@ -640,11 +744,11 @@ bool UBFeaturesModel::removeRows( int row, int count, const QModelIndex & parent
...
@@ -640,11 +744,11 @@ bool UBFeaturesModel::removeRows( int row, int count, const QModelIndex & parent
{
{
if
(
row
<
0
)
if
(
row
<
0
)
return
false
;
return
false
;
if
(
row
+
count
>
featuresList
.
size
()
)
if
(
row
+
count
>
featuresList
->
size
()
)
return
false
;
return
false
;
beginRemoveRows
(
parent
,
row
,
row
+
count
-
1
);
beginRemoveRows
(
parent
,
row
,
row
+
count
-
1
);
//featuresList->remove( row, count );
//featuresList->remove( row, count );
featuresList
.
erase
(
featuresList
.
begin
()
+
row
,
featuresList
.
begin
()
+
row
+
count
);
featuresList
->
erase
(
featuresList
->
begin
()
+
row
,
featuresList
->
begin
()
+
row
+
count
);
endRemoveRows
();
endRemoveRows
();
return
true
;
return
true
;
}
}
...
@@ -653,11 +757,11 @@ bool UBFeaturesModel::removeRow( int row, const QModelIndex & parent )
...
@@ -653,11 +757,11 @@ bool UBFeaturesModel::removeRow( int row, const QModelIndex & parent )
{
{
if
(
row
<
0
)
if
(
row
<
0
)
return
false
;
return
false
;
if
(
row
>=
featuresList
.
size
()
)
if
(
row
>=
featuresList
->
size
()
)
return
false
;
return
false
;
beginRemoveRows
(
parent
,
row
,
row
);
beginRemoveRows
(
parent
,
row
,
row
);
//featuresList->remove( row );
//featuresList->remove( row );
featuresList
.
erase
(
featuresList
.
begin
()
+
row
);
featuresList
->
erase
(
featuresList
->
begin
()
+
row
);
endRemoveRows
();
endRemoveRows
();
return
true
;
return
true
;
}
}
...
@@ -709,7 +813,7 @@ int UBFeaturesModel::rowCount(const QModelIndex &parent) const
...
@@ -709,7 +813,7 @@ int UBFeaturesModel::rowCount(const QModelIndex &parent) const
if
(
parent
.
isValid
())
if
(
parent
.
isValid
())
return
0
;
return
0
;
else
else
return
featuresList
.
size
();
return
featuresList
->
size
();
}
}
...
...
This diff is collapsed.
Click to expand it.
src/gui/UBFeaturesWidget.h
View file @
107f2b64
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "UBDockPaletteWidget.h"
#include "UBDockPaletteWidget.h"
//#include "UBLibActionBar.h"
//#include "UBLibActionBar.h"
#include "board/UBFeaturesController.h"
#include "board/UBFeaturesController.h"
#include "api/UBWidgetUniboardAPI.h"
#include "UBFeaturesActionBar.h"
#include "UBFeaturesActionBar.h"
#include "UBRubberBand.h"
#include "UBRubberBand.h"
...
@@ -25,6 +26,7 @@
...
@@ -25,6 +26,7 @@
#define THUMBNAIL_WIDTH 400
#define THUMBNAIL_WIDTH 400
#define ID_LISTVIEW 0
#define ID_LISTVIEW 0
#define ID_PROPERTIES 1
#define ID_PROPERTIES 1
#define ID_WEBVIEW 2
class
UBListModel
;
class
UBListModel
;
...
@@ -38,6 +40,7 @@ class UBFeaturesPathViewer;
...
@@ -38,6 +40,7 @@ class UBFeaturesPathViewer;
class
UBFeatureProperties
;
class
UBFeatureProperties
;
class
UBFeatureItemButton
;
class
UBFeatureItemButton
;
class
UBFeaturesListView
;
class
UBFeaturesListView
;
class
UBFeaturesWebView
;
class
UBFeaturesWidget
:
public
UBDockPaletteWidget
class
UBFeaturesWidget
:
public
UBDockPaletteWidget
{
{
...
@@ -59,6 +62,7 @@ public:
...
@@ -59,6 +62,7 @@ public:
private
:
private
:
void
switchToListView
();
void
switchToListView
();
void
switchToProperties
();
void
switchToProperties
();
void
switchToWebView
();
UBFeaturesController
*
controller
;
UBFeaturesController
*
controller
;
...
@@ -79,7 +83,9 @@ private:
...
@@ -79,7 +83,9 @@ private:
QGraphicsScene
*
pathScene
;
QGraphicsScene
*
pathScene
;
UBFeaturesActionBar
*
mActionBar
;
UBFeaturesActionBar
*
mActionBar
;
UBFeatureProperties
*
featureProperties
;
UBFeatureProperties
*
featureProperties
;
UBFeaturesWebView
*
webView
;
QStackedWidget
*
stackedWidget
;
QStackedWidget
*
stackedWidget
;
int
currentStackedWidget
;
int
currentStackedWidget
;
QModelIndex
trashIndex
;
QModelIndex
trashIndex
;
...
@@ -114,6 +120,24 @@ private:
...
@@ -114,6 +120,24 @@ private:
//QPoint rubberOrigin;
//QPoint rubberOrigin;
};
};
class
UBFeaturesWebView
:
public
QWidget
{
Q_OBJECT
public
:
UBFeaturesWebView
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBFeaturesWebView"
);
~
UBFeaturesWebView
();
void
showElement
(
const
UBFeature
&
elem
);
private
slots
:
void
onLoadFinished
(
bool
ok
);
private
:
QWebView
*
mpView
;
QWebSettings
*
mpWebSettings
;
QVBoxLayout
*
mpLayout
;
UBWidgetUniboardAPI
*
mpSankoreAPI
;
};
class
UBFeatureProperties
:
public
QWidget
class
UBFeatureProperties
:
public
QWidget
{
{
...
@@ -181,9 +205,9 @@ public:
...
@@ -181,9 +205,9 @@ public:
Qt
::
DropActions
supportedDropActions
()
const
{
return
Qt
::
MoveAction
|
Qt
::
CopyAction
;
}
Qt
::
DropActions
supportedDropActions
()
const
{
return
Qt
::
MoveAction
|
Qt
::
CopyAction
;
}
void
setFeaturesList
(
const
QList
<
UBFeature
>
&
flist
)
{
featuresList
=
flist
;
}
void
setFeaturesList
(
QList
<
UBFeature
>
*
flist
)
{
featuresList
=
flist
;
}
private
:
private
:
QList
<
UBFeature
>
featuresList
;
QList
<
UBFeature
>
*
featuresList
;
};
};
class
UBFeaturesProxyModel
:
public
QSortFilterProxyModel
class
UBFeaturesProxyModel
:
public
QSortFilterProxyModel
...
...
This diff is collapsed.
Click to expand it.
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