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
ff9a74b1
Commit
ff9a74b1
authored
Sep 01, 2011
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issue
http://188.165.53.52/jira/browse/SANKORE-213
parent
e59ac4ca
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
687 additions
and
959 deletions
+687
-959
UBBoardController.cpp
src/board/UBBoardController.cpp
+0
-4
UBBoardController.h
src/board/UBBoardController.h
+0
-7
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+2
-25
UBLibraryController.cpp
src/board/UBLibraryController.cpp
+75
-60
UBLibraryController.h
src/board/UBLibraryController.h
+7
-4
UBApplication.cpp
src/core/UBApplication.cpp
+3
-4
UBLibActionBar.cpp
src/gui/UBLibActionBar.cpp
+3
-2
UBLibItemProperties.cpp
src/gui/UBLibItemProperties.cpp
+6
-5
UBLibNavigatorWidget.cpp
src/gui/UBLibNavigatorWidget.cpp
+15
-17
UBLibNavigatorWidget.h
src/gui/UBLibNavigatorWidget.h
+2
-0
UBLibPalette.cpp
src/gui/UBLibPalette.cpp
+0
-177
UBLibPalette.h
src/gui/UBLibPalette.h
+0
-79
UBLibWidget.h
src/gui/UBLibWidget.h
+1
-0
UBLibraryWidget.cpp
src/gui/UBLibraryWidget.cpp
+566
-570
UBLibraryWidget.h
src/gui/UBLibraryWidget.h
+7
-3
gui.pri
src/gui/gui.pri
+0
-2
No files found.
src/board/UBBoardController.cpp
View file @
ff9a74b1
...
@@ -54,7 +54,6 @@
...
@@ -54,7 +54,6 @@
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h"
#include "document/UBDocumentController.h"
#include "board/UBLibraryController.h"
#include "board/UBDrawingController.h"
#include "board/UBDrawingController.h"
#include "board/UBBoardView.h"
#include "board/UBBoardView.h"
...
@@ -72,7 +71,6 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
...
@@ -72,7 +71,6 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
,
mActiveDocument
(
0
)
,
mActiveDocument
(
0
)
,
mActiveScene
(
0
)
,
mActiveScene
(
0
)
,
mActiveSceneIndex
(
-
1
)
,
mActiveSceneIndex
(
-
1
)
,
mLibraryController
(
0
)
,
mPaletteManager
(
0
)
,
mPaletteManager
(
0
)
,
mSoftwareUpdateDialog
(
0
)
,
mSoftwareUpdateDialog
(
0
)
,
mMessageWindow
(
0
)
,
mMessageWindow
(
0
)
...
@@ -85,8 +83,6 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
...
@@ -85,8 +83,6 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
,
mSystemScaleFactor
(
1.0
)
,
mSystemScaleFactor
(
1.0
)
,
mCleanupDone
(
false
)
,
mCleanupDone
(
false
)
{
{
mLibraryController
=
new
UBLibraryController
(
mMainWindow
->
centralWidget
(),
this
);
mZoomFactor
=
UBSettings
::
settings
()
->
boardZoomFactor
->
get
().
toDouble
();
mZoomFactor
=
UBSettings
::
settings
()
->
boardZoomFactor
->
get
().
toDouble
();
int
penColorIndex
=
UBSettings
::
settings
()
->
penColorIndex
();
int
penColorIndex
=
UBSettings
::
settings
()
->
penColorIndex
();
...
...
src/board/UBBoardController.h
View file @
ff9a74b1
...
@@ -25,7 +25,6 @@ class UBApplication;
...
@@ -25,7 +25,6 @@ class UBApplication;
class
UBBoardView
;
class
UBBoardView
;
class
UBDocumentController
;
class
UBDocumentController
;
class
UBLibraryController
;
class
UBMessageWindow
;
class
UBMessageWindow
;
class
UBGraphicsScene
;
class
UBGraphicsScene
;
class
UBDocumentProxy
;
class
UBDocumentProxy
;
...
@@ -129,11 +128,6 @@ class UBBoardController : public QObject
...
@@ -129,11 +128,6 @@ class UBBoardController : public QObject
return
mMarkerColorOnLightBackground
;
return
mMarkerColorOnLightBackground
;
}
}
UBLibraryController
*
libraryController
()
{
return
mLibraryController
;
}
qreal
systemScaleFactor
()
qreal
systemScaleFactor
()
{
{
return
mSystemScaleFactor
;
return
mSystemScaleFactor
;
...
@@ -285,7 +279,6 @@ class UBBoardController : public QObject
...
@@ -285,7 +279,6 @@ class UBBoardController : public QObject
UBGraphicsScene
*
mActiveScene
;
UBGraphicsScene
*
mActiveScene
;
int
mActiveSceneIndex
;
int
mActiveSceneIndex
;
UBLibraryController
*
mLibraryController
;
UBBoardPaletteManager
*
mPaletteManager
;
UBBoardPaletteManager
*
mPaletteManager
;
UBSoftwareUpdateDialog
*
mSoftwareUpdateDialog
;
UBSoftwareUpdateDialog
*
mSoftwareUpdateDialog
;
...
...
src/board/UBBoardPaletteManager.cpp
View file @
ff9a74b1
...
@@ -49,7 +49,6 @@
...
@@ -49,7 +49,6 @@
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentProxy.h"
#include "podcast/UBPodcastController.h"
#include "podcast/UBPodcastController.h"
#include "board/UBLibraryController.h"
#include "board/UBDrawingController.h"
#include "board/UBDrawingController.h"
#include "tools/UBToolsManager.h"
#include "tools/UBToolsManager.h"
...
@@ -569,7 +568,8 @@ void UBBoardPaletteManager::addItemToLibrary()
...
@@ -569,7 +568,8 @@ void UBBoardPaletteManager::addItemToLibrary()
,
Qt
::
KeepAspectRatio
,
Qt
::
SmoothTransformation
);
,
Qt
::
KeepAspectRatio
,
Qt
::
SmoothTransformation
);
}
}
QImage
image
=
mPixmap
.
toImage
();
QImage
image
=
mPixmap
.
toImage
();
UBApplication
::
boardController
->
libraryController
()
->
importImageOnLibrary
(
image
);
//UBApplication::boardController->libraryController()->importImageOnLibrary(image);
}
}
else
else
{
{
...
@@ -579,29 +579,6 @@ void UBBoardPaletteManager::addItemToLibrary()
...
@@ -579,29 +579,6 @@ void UBBoardPaletteManager::addItemToLibrary()
mAddItemPalette
->
hide
();
mAddItemPalette
->
hide
();
}
}
//void UBBoardPaletteManager::shareItemOnWeb()
//{
// QPixmap pixmap = mPixmap;
// if(mPixmap.isNull())
// {
// pixmap = QPixmap(mItemUrl.toLocalFile());
// }
// if(!pixmap.isNull())
// {
// UBCapturePublisher* publisher = new UBCapturePublisher(pixmap, this);
// publisher->publish();
// }
// else
// {
// UBApplication::showMessage(tr("Error Publishing Image to the Web"));
// }
// mAddItemPalette->hide();
//}
void
UBBoardPaletteManager
::
zoomButtonPressed
()
void
UBBoardPaletteManager
::
zoomButtonPressed
()
{
{
mZoomButtonPressedTime
=
QTime
::
currentTime
();
mZoomButtonPressedTime
=
QTime
::
currentTime
();
...
...
src/board/UBLibraryController.cpp
View file @
ff9a74b1
...
@@ -45,10 +45,10 @@
...
@@ -45,10 +45,10 @@
static
quint32
magicNumber
=
0xACDCAFE0
;
static
quint32
magicNumber
=
0xACDCAFE0
;
static
QString
favoriteVirtualPath
=
"$favorite$"
;
static
QString
favoriteVirtualPath
=
"$favorite$"
;
UBLibraryController
::
UBLibraryController
(
QWidget
*
pParentWidget
,
UBBoardController
*
pBoardController
)
:
UBLibraryController
::
UBLibraryController
(
QWidget
*
pParentWidget
)
:
QObject
(
pParentWidget
),
QObject
(
pParentWidget
),
mParentWidget
(
pParentWidget
),
mParentWidget
(
pParentWidget
),
mBoardController
(
pB
oardController
),
mBoardController
(
UBApplication
::
b
oardController
),
mLastItemOffsetIndex
(
0
)
mLastItemOffsetIndex
(
0
)
{
{
readFavoriteList
();
readFavoriteList
();
...
@@ -84,7 +84,7 @@ void UBLibraryController::createInternalWidgetItems()
...
@@ -84,7 +84,7 @@ void UBLibraryController::createInternalWidgetItems()
UBToolsManager
::
UBToolDescriptor
tool
=
UBToolsManager
::
manager
()
->
toolByID
(
toolUri
);
UBToolsManager
::
UBToolDescriptor
tool
=
UBToolsManager
::
manager
()
->
toolByID
(
toolUri
);
UBLibElement
*
newTool
=
new
UBLibElement
(
eUBLibElementType_InteractiveItem
,
QUrl
(
tool
.
id
),
tool
.
label
);
UBLibElement
*
newTool
=
new
UBLibElement
(
eUBLibElementType_InteractiveItem
,
QUrl
(
tool
.
id
),
tool
.
label
);
QImage
toolImage
=
tool
.
icon
.
toImage
();
QImage
toolImage
=
tool
.
icon
.
toImage
();
newTool
->
setThumbnail
(
&
toolImage
);
newTool
->
setThumbnail
(
toolImage
);
newTool
->
setInformation
(
tool
.
label
+
" "
+
tool
.
version
);
newTool
->
setInformation
(
tool
.
label
+
" "
+
tool
.
version
);
mInternalLibElements
<<
newTool
;
mInternalLibElements
<<
newTool
;
...
@@ -201,64 +201,54 @@ QList<UBLibElement*> UBLibraryController::rootCategoriesList()
...
@@ -201,64 +201,54 @@ QList<UBLibElement*> UBLibraryController::rootCategoriesList()
QList
<
UBLibElement
*>
categories
;
QList
<
UBLibElement
*>
categories
;
UBLibElement
*
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mAudioStandardDirectoryPath
,
tr
(
"Audios"
,
"Audio category element"
));
UBLibElement
*
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mAudioStandardDirectoryPath
,
tr
(
"Audios"
,
"Audio category element"
));
QImage
*
categoryImage
=
new
QImage
(
":images/libpalette/AudiosCategory.svg"
);
element
->
setThumbnail
(
QImage
(
":images/libpalette/AudiosCategory.svg"
));
element
->
setThumbnail
(
categoryImage
);
element
->
setMoveable
(
false
);
element
->
setMoveable
(
false
);
categories
<<
element
;
categories
<<
element
;
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mVideoStandardDirectoryPath
,
tr
(
"Movies"
,
"Movies category element"
));
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mVideoStandardDirectoryPath
,
tr
(
"Movies"
,
"Movies category element"
));
categoryImage
=
new
QImage
(
":images/libpalette/MoviesCategory.svg"
);
element
->
setThumbnail
(
QImage
(
":images/libpalette/MoviesCategory.svg"
));
element
->
setThumbnail
(
categoryImage
);
element
->
setMoveable
(
false
);
element
->
setMoveable
(
false
);
categories
<<
element
;
categories
<<
element
;
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mPicturesStandardDirectoryPath
,
tr
(
"Pictures"
,
"Pictures category element"
));
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mPicturesStandardDirectoryPath
,
tr
(
"Pictures"
,
"Pictures category element"
));
categoryImage
=
new
QImage
(
":images/libpalette/PicturesCategory.svg"
);
element
->
setThumbnail
(
QImage
(
":images/libpalette/PicturesCategory.svg"
));
element
->
setThumbnail
(
categoryImage
);
element
->
setMoveable
(
false
);
element
->
setMoveable
(
false
);
categories
<<
element
;
categories
<<
element
;
QString
path
=
UBSettings
::
settings
()
->
uniboardShapeLibraryDirectory
();
QString
path
=
UBSettings
::
settings
()
->
uniboardShapeLibraryDirectory
();
categoryImage
=
new
QImage
(
":images/libpalette/ShapesCategory.svg"
);
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
QUrl
::
fromLocalFile
(
path
),
tr
(
"Shapes"
,
"Shapes category element"
));
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
QUrl
::
fromLocalFile
(
path
),
tr
(
"Shapes"
,
"Shapes category element"
));
element
->
setThumbnail
(
categoryImage
);
element
->
setThumbnail
(
QImage
(
":images/libpalette/ShapesCategory.svg"
)
);
element
->
setMoveable
(
false
);
element
->
setMoveable
(
false
);
categories
<<
element
;
categories
<<
element
;
categoryImage
=
new
QImage
(
":images/libpalette/ApplicationsCategory.svg"
);
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mInteractiveUserDirectoryPath
,
tr
(
"Applications"
,
"Applications category element"
));
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mInteractiveUserDirectoryPath
,
tr
(
"Applications"
,
"Applications category element"
));
element
->
setThumbnail
(
categoryImage
);
element
->
setThumbnail
(
QImage
(
":images/libpalette/ApplicationsCategory.svg"
)
);
element
->
setMoveable
(
false
);
element
->
setMoveable
(
false
);
categories
<<
element
;
categories
<<
element
;
categoryImage
=
new
QImage
(
":images/libpalette/FavoritesCategory.svg"
);
element
=
new
UBLibElement
(
eUBLibElementType_VirtualFolder
,
favoriteVirtualPath
,
tr
(
"Favorite"
,
"Favorite category element"
));
element
=
new
UBLibElement
(
eUBLibElementType_VirtualFolder
,
favoriteVirtualPath
,
tr
(
"Favorite"
,
"Favorite category element"
));
element
->
setThumbnail
(
categoryImage
);
element
->
setThumbnail
(
QImage
(
":images/libpalette/FavoritesCategory.svg"
)
);
element
->
setMoveable
(
false
);
element
->
setMoveable
(
false
);
categories
<<
element
;
categories
<<
element
;
categoryImage
=
new
QImage
(
":images/libpalette/InteractivesCategory.svg"
);
mInteractiveCategoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
uniboardGipLibraryDirectory
());
mInteractiveCategoryPath
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
uniboardGipLibraryDirectory
());
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mInteractiveCategoryPath
,
tr
(
"Interactivities"
,
"Interactives category element"
));
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mInteractiveCategoryPath
,
tr
(
"Interactivities"
,
"Interactives category element"
));
element
->
setThumbnail
(
categoryImage
);
element
->
setThumbnail
(
QImage
(
":images/libpalette/InteractivesCategory.svg"
)
);
element
->
setMoveable
(
false
);
element
->
setMoveable
(
false
);
categories
<<
element
;
categories
<<
element
;
categoryImage
=
new
QImage
(
":images/libpalette/FlashCategory.svg"
);
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mAnimationUserDirectoryPath
,
tr
(
"Animations"
,
"Animations category element"
));
element
=
new
UBLibElement
(
eUBLibElementType_Folder
,
mAnimationUserDirectoryPath
,
tr
(
"Animations"
,
"Animations category element"
));
element
->
setThumbnail
(
categoryImage
);
element
->
setThumbnail
(
QImage
(
":images/libpalette/FlashCategory.svg"
)
);
element
->
setMoveable
(
false
);
element
->
setMoveable
(
false
);
categories
<<
element
;
categories
<<
element
;
categories
<<
UBLibElement
::
trashElement
();
categories
<<
UBLibElement
::
trashElement
();
return
categories
;
return
categories
;
}
}
QImage
*
UBLibraryController
::
createThumbnail
(
UBLibElement
*
pElement
)
QImage
UBLibraryController
::
createThumbnail
(
UBLibElement
*
pElement
)
{
{
QString
thumbnailPath
=
UBFileSystemUtils
::
thumbnailPath
(
pElement
->
path
().
toLocalFile
());
QString
thumbnailPath
=
UBFileSystemUtils
::
thumbnailPath
(
pElement
->
path
().
toLocalFile
());
QString
mimetype
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
pElement
->
path
().
toLocalFile
());
QString
mimetype
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
pElement
->
path
().
toLocalFile
());
...
@@ -287,17 +277,17 @@ QImage* UBLibraryController::createThumbnail(UBLibElement* pElement)
...
@@ -287,17 +277,17 @@ QImage* UBLibraryController::createThumbnail(UBLibElement* pElement)
}
}
}
}
return
new
QImage
(
thumbnailPath
);
return
QImage
(
thumbnailPath
);
}
}
QImage
*
UBLibraryController
::
thumbnailForFile
(
UBLibElement
*
pElement
)
QImage
UBLibraryController
::
thumbnailForFile
(
UBLibElement
*
pElement
)
{
{
if
(
pElement
->
path
().
toString
().
contains
(
"uniboardTool://"
)){
if
(
pElement
->
path
().
toString
().
contains
(
"uniboardTool://"
)){
QImage
*
image
=
new
QImage
(
UBToolsManager
::
manager
()
->
iconFromToolId
(
pElement
->
path
().
toString
()));
QImage
image
=
QImage
(
UBToolsManager
::
manager
()
->
iconFromToolId
(
pElement
->
path
().
toString
()));
return
image
;
return
image
;
}
}
if
(
pElement
->
type
()
==
eUBLibElementType_InteractiveItem
){
if
(
pElement
->
type
()
==
eUBLibElementType_InteractiveItem
){
QImage
*
image
=
new
QImage
(
UBAbstractWidget
::
iconFilePath
(
pElement
->
path
()));
QImage
image
=
QImage
(
UBAbstractWidget
::
iconFilePath
(
pElement
->
path
()));
return
image
;
return
image
;
}
}
...
@@ -307,7 +297,7 @@ QImage* UBLibraryController::thumbnailForFile(UBLibElement* pElement)
...
@@ -307,7 +297,7 @@ QImage* UBLibraryController::thumbnailForFile(UBLibElement* pElement)
qWarning
()
<<
"thumbnailForFile impossible to create thumbnail path for the element "
+
pElement
->
path
().
toLocalFile
();
qWarning
()
<<
"thumbnailForFile impossible to create thumbnail path for the element "
+
pElement
->
path
().
toLocalFile
();
if
(
QFileInfo
(
thumbnailPath
).
exists
())
if
(
QFileInfo
(
thumbnailPath
).
exists
())
return
new
QImage
(
thumbnailPath
);
return
QImage
(
thumbnailPath
);
else
else
return
createThumbnail
(
pElement
);
return
createThumbnail
(
pElement
);
}
}
...
@@ -318,7 +308,8 @@ QList<UBLibElement*> UBLibraryController::addVirtualElementsForItemPath(const QS
...
@@ -318,7 +308,8 @@ QList<UBLibElement*> UBLibraryController::addVirtualElementsForItemPath(const QS
if
(
pPath
==
mInteractiveUserDirectoryPath
.
toLocalFile
()){
if
(
pPath
==
mInteractiveUserDirectoryPath
.
toLocalFile
()){
content
<<
listElementsInPath
(
UBSettings
::
settings
()
->
uniboardInteractiveLibraryDirectory
());
content
<<
listElementsInPath
(
UBSettings
::
settings
()
->
uniboardInteractiveLibraryDirectory
());
content
<<
listElementsInPath
(
UBSettings
::
settings
()
->
uniboardInteractiveFavoritesDirectory
());
content
<<
listElementsInPath
(
UBSettings
::
settings
()
->
uniboardInteractiveFavoritesDirectory
());
content
<<
mInternalLibElements
;
foreach
(
UBLibElement
*
eachElement
,
mInternalLibElements
)
content
<<
new
UBLibElement
(
eachElement
);
}
}
else
if
(
pPath
==
mPicturesStandardDirectoryPath
.
toLocalFile
()){
else
if
(
pPath
==
mPicturesStandardDirectoryPath
.
toLocalFile
()){
QUrl
path
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
uniboardImageLibraryDirectory
());
QUrl
path
=
QUrl
::
fromLocalFile
(
UBSettings
::
settings
()
->
uniboardImageLibraryDirectory
());
...
@@ -353,8 +344,8 @@ QList<UBLibElement*> UBLibraryController::listElementsInPath(const QString& pPat
...
@@ -353,8 +344,8 @@ QList<UBLibElement*> UBLibraryController::listElementsInPath(const QString& pPat
UBLibElement
*
element
=
new
UBLibElement
(
fileType
,
QUrl
::
fromLocalFile
(
fileInfo
->
absoluteFilePath
()),
itemName
);
UBLibElement
*
element
=
new
UBLibElement
(
fileType
,
QUrl
::
fromLocalFile
(
fileInfo
->
absoluteFilePath
()),
itemName
);
if
(
fileType
==
eUBLibElementType_Folder
)
{
if
(
fileType
==
eUBLibElementType_Folder
)
{
QImage
*
directoryImage
=
new
QImage
(
":images/libpalette/folder.svg"
);
//
QImage* directoryImage = new QImage(":images/libpalette/folder.svg");
element
->
setThumbnail
(
directoryImage
);
element
->
setThumbnail
(
QImage
(
":images/libpalette/folder.svg"
)
);
}
}
else
if
(
fileType
==
eUBLibElementType_Item
)
{
else
if
(
fileType
==
eUBLibElementType_Item
)
{
if
(
element
->
path
().
toLocalFile
().
contains
(
".thumbnail."
))
if
(
element
->
path
().
toLocalFile
().
contains
(
".thumbnail."
))
...
@@ -373,7 +364,10 @@ QList<UBLibElement*> UBLibraryController::listElementsInPath(const QString& pPat
...
@@ -373,7 +364,10 @@ QList<UBLibElement*> UBLibraryController::listElementsInPath(const QString& pPat
QList
<
UBLibElement
*>
UBLibraryController
::
listElementsInVirtualForlder
(
UBLibElement
*
pElement
)
QList
<
UBLibElement
*>
UBLibraryController
::
listElementsInVirtualForlder
(
UBLibElement
*
pElement
)
{
{
Q_UNUSED
(
pElement
);
Q_UNUSED
(
pElement
);
return
mFavoriteList
;
QList
<
UBLibElement
*>
copyOfTheFavoriteList
;
foreach
(
UBLibElement
*
eachElement
,
mFavoriteList
)
copyOfTheFavoriteList
<<
new
UBLibElement
(
eachElement
);
return
copyOfTheFavoriteList
;
}
}
void
UBLibraryController
::
moveContent
(
QList
<
UBLibElement
*>
sourceList
,
UBLibElement
*
pDestination
)
void
UBLibraryController
::
moveContent
(
QList
<
UBLibElement
*>
sourceList
,
UBLibElement
*
pDestination
)
...
@@ -416,21 +410,31 @@ void UBLibraryController::emptyElementsOnTrash( QList<UBLibElement*> elementsLis
...
@@ -416,21 +410,31 @@ void UBLibraryController::emptyElementsOnTrash( QList<UBLibElement*> elementsLis
}
}
}
}
void
UBLibraryController
::
cleanElementsList
()
{
// qDebug() << "cleanElementsList()";
// qDebug() << this;
// foreach(UBLibElement*eachElement, mElementsList)
// qDebug() << eachElement;
qDeleteAll
(
mElementsList
);
mElementsList
.
clear
();
}
QList
<
UBLibElement
*>
UBLibraryController
::
getContent
(
UBLibElement
*
element
)
QList
<
UBLibElement
*>
UBLibraryController
::
getContent
(
UBLibElement
*
element
)
{
{
QList
<
UBLibElement
*>
elementsList
;
cleanElementsList
()
;
switch
(
element
->
type
())
{
switch
(
element
->
type
())
{
case
eUBLibElementType_Category
:
{
case
eUBLibElementType_Category
:
{
e
lementsList
=
rootCategoriesList
();
mE
lementsList
=
rootCategoriesList
();
break
;
break
;
}
}
case
eUBLibElementType_VirtualFolder
:
{
case
eUBLibElementType_VirtualFolder
:
{
e
lementsList
=
listElementsInVirtualForlder
(
element
);
mE
lementsList
=
listElementsInVirtualForlder
(
element
);
break
;
break
;
}
}
case
eUBLibElementType_Folder
:
{
case
eUBLibElementType_Folder
:
{
e
lementsList
=
listElementsInPath
(
element
->
path
().
toLocalFile
());
mE
lementsList
=
listElementsInPath
(
element
->
path
().
toLocalFile
());
break
;
break
;
}
}
case
eUBLibElementType_Item
:
{
case
eUBLibElementType_Item
:
{
...
@@ -443,16 +447,20 @@ QList<UBLibElement*> UBLibraryController::getContent(UBLibElement *element)
...
@@ -443,16 +447,20 @@ QList<UBLibElement*> UBLibraryController::getContent(UBLibElement *element)
break
;
break
;
}
}
return
elementsList
;
// qDebug() << "getContent()";
// qDebug() << this;
// foreach(UBLibElement*eachElement, mElementsList)
// qDebug() << eachElement;
return
mElementsList
;
}
}
UBLibraryController
::~
UBLibraryController
()
UBLibraryController
::~
UBLibraryController
()
{
{
cleanElementsList
();
//NOOP
//NOOP
}
}
void
UBLibraryController
::
setItemAsBackground
(
UBLibElement
*
image
)
void
UBLibraryController
::
setItemAsBackground
(
UBLibElement
*
image
)
{
{
if
(
!
activeScene
()){
if
(
!
activeScene
()){
...
@@ -501,9 +509,6 @@ void UBLibraryController::addItemToPage(UBLibElement* item)
...
@@ -501,9 +509,6 @@ void UBLibraryController::addItemToPage(UBLibElement* item)
else
{
else
{
UBApplication
::
showMessage
(
tr
(
"Adding to page failed for item %1."
).
arg
(
item
->
name
()));
UBApplication
::
showMessage
(
tr
(
"Adding to page failed for item %1."
).
arg
(
item
->
name
()));
}
}
}
}
void
UBLibraryController
::
removeBackground
()
void
UBLibraryController
::
removeBackground
()
...
@@ -564,6 +569,7 @@ void UBLibraryController::readFavoriteList()
...
@@ -564,6 +569,7 @@ void UBLibraryController::readFavoriteList()
eachElement
->
setInformation
(
info
);
eachElement
->
setInformation
(
info
);
eachElement
->
setExtension
(
extension
);
eachElement
->
setExtension
(
extension
);
eachElement
->
setThumbnail
(
thumbnailForFile
(
eachElement
));
eachElement
->
setThumbnail
(
thumbnailForFile
(
eachElement
));
if
(
!
isOnFavoriteList
(
eachElement
))
mFavoriteList
<<
eachElement
;
mFavoriteList
<<
eachElement
;
}
}
...
@@ -582,10 +588,10 @@ UBLibElement* UBLibraryController::isOnFavoriteList(UBLibElement * element)
...
@@ -582,10 +588,10 @@ UBLibElement* UBLibraryController::isOnFavoriteList(UBLibElement * element)
void
UBLibraryController
::
addToFavorite
(
QList
<
UBLibElement
*>
elementList
)
void
UBLibraryController
::
addToFavorite
(
QList
<
UBLibElement
*>
elementList
)
{
{
foreach
(
UBLibElement
*
eachElement
,
elementList
)
{
foreach
(
UBLibElement
*
eachElement
,
elementList
)
if
(
!
isOnFavoriteList
(
eachElement
))
if
(
!
isOnFavoriteList
(
eachElement
))
mFavoriteList
<<
eachElement
;
mFavoriteList
<<
new
UBLibElement
(
eachElement
)
;
}
persistFavoriteList
();
persistFavoriteList
();
}
}
...
@@ -601,7 +607,8 @@ void UBLibraryController::removeFromFavorite(QList<UBLibElement*> elementList)
...
@@ -601,7 +607,8 @@ void UBLibraryController::removeFromFavorite(QList<UBLibElement*> elementList)
persistFavoriteList
();
persistFavoriteList
();
}
}
QRectF
UBLibraryController
::
visibleSceneRect
()
{
QRectF
UBLibraryController
::
visibleSceneRect
()
{
QRectF
visibleSceneRect
(
0
,
0
,
0
,
0
);
QRectF
visibleSceneRect
(
0
,
0
,
0
,
0
);
if
(
activeScene
()
&&
mBoardController
&&
mBoardController
->
controlView
())
{
if
(
activeScene
()
&&
mBoardController
&&
mBoardController
->
controlView
())
{
...
@@ -621,7 +628,8 @@ QRectF UBLibraryController::visibleSceneRect() {
...
@@ -621,7 +628,8 @@ QRectF UBLibraryController::visibleSceneRect() {
return
visibleSceneRect
;
return
visibleSceneRect
;
}
}
void
UBLibraryController
::
addImagesToCurrentPage
(
const
QList
<
QUrl
>&
images
)
{
void
UBLibraryController
::
addImagesToCurrentPage
(
const
QList
<
QUrl
>&
images
)
{
QPointF
pos
=
visibleSceneRect
().
topLeft
();
QPointF
pos
=
visibleSceneRect
().
topLeft
();
foreach
(
const
QUrl
url
,
images
)
foreach
(
const
QUrl
url
,
images
)
...
@@ -652,7 +660,8 @@ void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images) {
...
@@ -652,7 +660,8 @@ void UBLibraryController::addImagesToCurrentPage(const QList<QUrl>& images) {
}
}
}
}
void
UBLibraryController
::
addVideosToCurrentPage
(
const
QList
<
QUrl
>&
videos
)
{
void
UBLibraryController
::
addVideosToCurrentPage
(
const
QList
<
QUrl
>&
videos
)
{
QPointF
pos
=
visibleSceneRect
().
topLeft
();
QPointF
pos
=
visibleSceneRect
().
topLeft
();
foreach
(
const
QUrl
url
,
videos
)
foreach
(
const
QUrl
url
,
videos
)
...
@@ -665,7 +674,8 @@ void UBLibraryController::addVideosToCurrentPage(const QList<QUrl>& videos) {
...
@@ -665,7 +674,8 @@ void UBLibraryController::addVideosToCurrentPage(const QList<QUrl>& videos) {
}
}
}
}
void
UBLibraryController
::
addAudiosToCurrentPage
(
const
QList
<
QUrl
>&
sounds
)
{
void
UBLibraryController
::
addAudiosToCurrentPage
(
const
QList
<
QUrl
>&
sounds
)
{
QPointF
topLeftPos
=
visibleSceneRect
().
topLeft
();
QPointF
topLeftPos
=
visibleSceneRect
().
topLeft
();
QPointF
pos
=
topLeftPos
;
QPointF
pos
=
topLeftPos
;
...
@@ -680,12 +690,10 @@ void UBLibraryController::addAudiosToCurrentPage(const QList<QUrl>& sounds) {
...
@@ -680,12 +690,10 @@ void UBLibraryController::addAudiosToCurrentPage(const QList<QUrl>& sounds) {
}
}
}
}
void
UBLibraryController
::
addInteractivesToCurrentPage
(
void
UBLibraryController
::
addInteractivesToCurrentPage
(
const
QList
<
QUrl
>&
widgets
)
const
QList
<
QUrl
>&
widgets
)
{
{
foreach
(
const
QUrl
url
,
widgets
)
foreach
(
const
QUrl
url
,
widgets
)
{
mBoardController
->
downloadURL
(
url
,
QPointF
(
0
,
0
));
mBoardController
->
downloadURL
(
url
,
QPointF
(
0
,
0
));
}
}
}
QString
UBLibraryController
::
favoritePath
()
QString
UBLibraryController
::
favoritePath
()
...
@@ -699,6 +707,17 @@ UBLibElement::UBLibElement() {
...
@@ -699,6 +707,17 @@ UBLibElement::UBLibElement() {
mbMoveable
=
false
;
mbMoveable
=
false
;
}
}
UBLibElement
::
UBLibElement
(
UBLibElement
*
element
)
{
mType
=
element
->
type
();
mPath
=
element
->
path
();
mThumbnail
=
*
element
->
thumbnail
();
mInfo
=
element
->
information
();
mName
=
element
->
name
();
mExtension
=
element
->
extension
();
mbMoveable
=
element
->
isMoveable
();
}
UBLibElement
::
UBLibElement
(
eUBLibElementType
type
,
const
QUrl
&
path
,
const
QString
&
name
)
UBLibElement
::
UBLibElement
(
eUBLibElementType
type
,
const
QUrl
&
path
,
const
QString
&
name
)
{
{
...
@@ -728,7 +747,7 @@ UBLibElement::~UBLibElement()
...
@@ -728,7 +747,7 @@ UBLibElement::~UBLibElement()
UBChainedLibElement
::
UBChainedLibElement
(
UBLibElement
*
pElem
,
UBChainedLibElement
*
pNextElem
)
UBChainedLibElement
::
UBChainedLibElement
(
UBLibElement
*
pElem
,
UBChainedLibElement
*
pNextElem
)
{
{
mpElem
=
pElem
;
mpElem
=
new
UBLibElement
(
pElem
)
;
mpNextElem
=
pNextElem
;
mpNextElem
=
pNextElem
;
}
}
...
@@ -747,13 +766,9 @@ void UBChainedLibElement::setNextElement(UBChainedLibElement *nextElem)
...
@@ -747,13 +766,9 @@ void UBChainedLibElement::setNextElement(UBChainedLibElement *nextElem)
UBLibElement
*
UBLibElement
::
trashElement
()
UBLibElement
*
UBLibElement
::
trashElement
()
{
{
static
UBLibElement
*
trashElement
;
UBLibElement
*
trashElement
;
if
(
trashElement
)
return
trashElement
;
trashElement
=
new
UBLibElement
(
eUBLibElementType_Folder
,
QUrl
::
fromLocalFile
(
UBSettings
::
trashLibraryPaletteDirPath
()),
QObject
::
tr
(
"Trash"
,
"Pictures category element"
));
trashElement
=
new
UBLibElement
(
eUBLibElementType_Folder
,
QUrl
::
fromLocalFile
(
UBSettings
::
trashLibraryPaletteDirPath
()),
QObject
::
tr
(
"Trash"
,
"Pictures category element"
));
QImage
*
categoryImage
=
new
QImage
(
":images/libpalette/TrashCategory.svg"
);
trashElement
->
setThumbnail
(
QImage
(
":images/libpalette/TrashCategory.svg"
));
trashElement
->
setThumbnail
(
categoryImage
);
trashElement
->
setMoveable
(
false
);
trashElement
->
setMoveable
(
false
);
return
trashElement
;
return
trashElement
;
...
...
src/board/UBLibraryController.h
View file @
ff9a74b1
...
@@ -42,6 +42,7 @@ class UBLibElement
...
@@ -42,6 +42,7 @@ class UBLibElement
public
:
public
:
UBLibElement
();
UBLibElement
();
UBLibElement
(
eUBLibElementType
type
,
const
QUrl
&
path
,
const
QString
&
name
);
UBLibElement
(
eUBLibElementType
type
,
const
QUrl
&
path
,
const
QString
&
name
);
UBLibElement
(
UBLibElement
*
element
);
~
UBLibElement
();
~
UBLibElement
();
static
UBLibElement
*
trashElement
();
static
UBLibElement
*
trashElement
();
...
@@ -51,7 +52,7 @@ public:
...
@@ -51,7 +52,7 @@ public:
QUrl
path
(){
return
mPath
;}
QUrl
path
(){
return
mPath
;}
void
setPath
(
QUrl
path
){
mPath
=
path
;}
void
setPath
(
QUrl
path
){
mPath
=
path
;}
QImage
*
thumbnail
(){
return
&
mThumbnail
;}
QImage
*
thumbnail
(){
return
&
mThumbnail
;}
void
setThumbnail
(
QImage
*
pThumb
){
mThumbnail
=
*
pThumb
;}
void
setThumbnail
(
QImage
pThumb
){
mThumbnail
=
pThumb
;}
QString
information
(){
return
mInfo
;}
QString
information
(){
return
mInfo
;}
void
setInformation
(
QString
info
){
mInfo
=
info
;}
void
setInformation
(
QString
info
){
mInfo
=
info
;}
QString
name
(){
return
mName
;}
QString
name
(){
return
mName
;}
...
@@ -91,7 +92,7 @@ class UBLibraryController : public QObject
...
@@ -91,7 +92,7 @@ class UBLibraryController : public QObject
Q_OBJECT
;
Q_OBJECT
;
public
:
public
:
UBLibraryController
(
QWidget
*
parentWidget
,
UBBoardController
*
boardController
);
UBLibraryController
(
QWidget
*
parentWidget
);
virtual
~
UBLibraryController
();
virtual
~
UBLibraryController
();
QList
<
UBLibElement
*>
getContent
(
UBLibElement
*
pElement
);
QList
<
UBLibElement
*>
getContent
(
UBLibElement
*
pElement
);
...
@@ -134,14 +135,16 @@ class UBLibraryController : public QObject
...
@@ -134,14 +135,16 @@ class UBLibraryController : public QObject
void
persistFavoriteList
();
void
persistFavoriteList
();
void
readFavoriteList
();
void
readFavoriteList
();
QList
<
UBLibElement
*>
mInternalLibElements
;
QList
<
UBLibElement
*>
mInternalLibElements
;
QList
<
UBLibElement
*>
mElementsList
;
void
cleanElementsList
();
private
:
private
:
QList
<
UBLibElement
*>
rootCategoriesList
();
QList
<
UBLibElement
*>
rootCategoriesList
();
QList
<
UBLibElement
*>
listElementsInPath
(
const
QString
&
pPath
);
QList
<
UBLibElement
*>
listElementsInPath
(
const
QString
&
pPath
);
QList
<
UBLibElement
*>
listElementsInVirtualForlder
(
UBLibElement
*
pElement
);
QList
<
UBLibElement
*>
listElementsInVirtualForlder
(
UBLibElement
*
pElement
);
void
userPath
(
QUrl
&
pPath
);
void
userPath
(
QUrl
&
pPath
);
QImage
*
thumbnailForFile
(
UBLibElement
*
pPath
);
QImage
thumbnailForFile
(
UBLibElement
*
pPath
);
QImage
*
createThumbnail
(
UBLibElement
*
pPath
);
QImage
createThumbnail
(
UBLibElement
*
pPath
);
QList
<
UBLibElement
*>
addVirtualElementsForItemPath
(
const
QString
&
pPath
);
QList
<
UBLibElement
*>
addVirtualElementsForItemPath
(
const
QString
&
pPath
);
void
createInternalWidgetItems
();
void
createInternalWidgetItems
();
...
...
src/core/UBApplication.cpp
View file @
ff9a74b1
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
#include "board/UBBoardController.h"
#include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
#include "board/UBDrawingController.h"
#include "board/UBLibraryController.h"
#include "board/UBBoardView.h"
#include "board/UBBoardView.h"
#include "web/UBWebController.h"
#include "web/UBWebController.h"
...
...
src/gui/UBLibActionBar.cpp
View file @
ff9a74b1
...
@@ -16,9 +16,9 @@
...
@@ -16,9 +16,9 @@
#include <QSize>
#include <QSize>
#include <QDebug>
#include <QDebug>
#include "UBLibWidget.h"
#include "UBLibActionBar.h"
#include "UBLibActionBar.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
...
@@ -361,7 +361,8 @@ void UBLibActionBar::onSelectionChanged(QList<UBLibElement *> itemList, bool isI
...
@@ -361,7 +361,8 @@ void UBLibActionBar::onSelectionChanged(QList<UBLibElement *> itemList, bool isI
*/
*/
UBLibraryController
*
UBLibActionBar
::
libraryController
()
UBLibraryController
*
UBLibActionBar
::
libraryController
()
{
{
return
UBApplication
::
boardController
->
libraryController
();
UBLibWidget
*
libWidget
=
dynamic_cast
<
UBLibWidget
*>
(
parentWidget
());
return
libWidget
->
libNavigator
()
->
libraryWidget
()
->
libraryController
();
}
}
/**
/**
...
...
src/gui/UBLibItemProperties.cpp
View file @
ff9a74b1
...
@@ -12,15 +12,14 @@
...
@@ -12,15 +12,14 @@
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include "UBLibWidget.h"
#include "UBLibItemProperties.h"
#include "UBLibItemProperties.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "frameworks/UBFileSystemUtils.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
/**
/**
...
@@ -223,7 +222,8 @@ void UBLibItemProperties::adaptSize()
...
@@ -223,7 +222,8 @@ void UBLibItemProperties::adaptSize()
*/
*/
void
UBLibItemProperties
::
onAddToPage
()
void
UBLibItemProperties
::
onAddToPage
()
{
{
UBApplication
::
boardController
->
libraryController
()
->
addItemToPage
(
mpElement
);
UBLibWidget
*
libWidget
=
dynamic_cast
<
UBLibWidget
*>
(
parentWidget
()
->
parentWidget
());
libWidget
->
libNavigator
()
->
libraryWidget
()
->
libraryController
()
->
addItemToPage
(
mpElement
);
}
}
/**
/**
...
@@ -239,7 +239,8 @@ void UBLibItemProperties::onAddToLib()
...
@@ -239,7 +239,8 @@ void UBLibItemProperties::onAddToLib()
*/
*/
void
UBLibItemProperties
::
onSetAsBackground
()
void
UBLibItemProperties
::
onSetAsBackground
()
{
{
UBApplication
::
boardController
->
libraryController
()
->
setItemAsBackground
(
mpElement
);
UBLibWidget
*
libWidget
=
dynamic_cast
<
UBLibWidget
*>
(
parentWidget
()
->
parentWidget
());
libWidget
->
libNavigator
()
->
libraryWidget
()
->
libraryController
()
->
setItemAsBackground
(
mpElement
);
}
}
/**
/**
...
...
src/gui/UBLibNavigatorWidget.cpp
View file @
ff9a74b1
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include "UBLibNavigatorWidget.h"
#include "UBLibNavigatorWidget.h"
#include "UB
RightPalette
.h"
#include "UB
LibWidget
.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
...
@@ -36,10 +36,9 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
...
@@ -36,10 +36,9 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
setObjectName
(
name
);
setObjectName
(
name
);
setAcceptDrops
(
true
);
setAcceptDrops
(
true
);
UB
RightPalette
*
pRightPalette
=
dynamic_cast
<
UBRightPalette
*>
(
parentWidget
());
UB
LibWidget
*
libWidget
=
dynamic_cast
<
UBLibWidget
*>
(
parentWidget
());
mLayout
=
new
QVBoxLayout
(
this
);
mLayout
=
new
QVBoxLayout
(
this
);
// mLayout->setContentsMargins(20, 5, 5, 5);
setLayout
(
mLayout
);
setLayout
(
mLayout
);
mPathViewer
=
new
UBLibPathViewer
(
this
);
mPathViewer
=
new
UBLibPathViewer
(
this
);
...
@@ -66,15 +65,13 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
...
@@ -66,15 +65,13 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
connect
(
mSlider
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
updateThumbnailsSize
(
int
)));
connect
(
mSlider
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
updateThumbnailsSize
(
int
)));
connect
(
mPathViewer
,
SIGNAL
(
elementsDropped
(
QList
<
QString
>
,
UBLibElement
*
)),
mLibWidget
,
SLOT
(
onElementsDropped
(
QList
<
QString
>
,
UBLibElement
*
)));
connect
(
mPathViewer
,
SIGNAL
(
elementsDropped
(
QList
<
QString
>
,
UBLibElement
*
)),
mLibWidget
,
SLOT
(
onElementsDropped
(
QList
<
QString
>
,
UBLibElement
*
)));
if
(
NULL
!=
pRightPalette
)
{
connect
(
mLibWidget
,
SIGNAL
(
navigBarUpdate
(
UBLibElement
*
)),
libWidget
->
actionBar
(),
SLOT
(
onNavigbarUpdate
(
UBLibElement
*
)));
connect
(
mLibWidget
,
SIGNAL
(
navigBarUpdate
(
UBLibElement
*
)),
pRightPalette
->
libWidget
()
->
actionBar
(),
SLOT
(
onNavigbarUpdate
(
UBLibElement
*
)));
connect
(
mLibWidget
,
SIGNAL
(
itemsSelected
(
QList
<
UBLibElement
*>
,
bool
)),
libWidget
->
actionBar
(),
SLOT
(
onSelectionChanged
(
QList
<
UBLibElement
*>
,
bool
)));
connect
(
mLibWidget
,
SIGNAL
(
itemsSelected
(
QList
<
UBLibElement
*>
,
bool
)),
pRightPalette
->
libWidget
()
->
actionBar
(),
SLOT
(
onSelectionChanged
(
QList
<
UBLibElement
*>
,
bool
)));
connect
(
libWidget
->
actionBar
(),
SIGNAL
(
deleteDone
()),
mLibWidget
,
SLOT
(
onRefreshCurrentFolder
()));
connect
(
pRightPalette
->
libWidget
()
->
actionBar
(),
SIGNAL
(
deleteDone
()),
mLibWidget
,
SLOT
(
onRefreshCurrentFolder
()));
connect
(
mLibWidget
,
SIGNAL
(
favoritesEntered
(
bool
)),
libWidget
->
actionBar
(),
SLOT
(
onFavoritesEntered
(
bool
)));
connect
(
mLibWidget
,
SIGNAL
(
favoritesEntered
(
bool
)),
pRightPalette
->
libWidget
()
->
actionBar
(),
SLOT
(
onFavoritesEntered
(
bool
)));
connect
(
libWidget
->
actionBar
(),
SIGNAL
(
searchElement
(
QString
)),
mLibWidget
,
SLOT
(
onSearchElement
(
QString
)));
connect
(
pRightPalette
->
libWidget
()
->
actionBar
(),
SIGNAL
(
searchElement
(
QString
)),
mLibWidget
,
SLOT
(
onSearchElement
(
QString
)));
connect
(
libWidget
->
actionBar
(),
SIGNAL
(
newFolderToCreate
()),
mLibWidget
,
SLOT
(
onNewFolderToCreate
()));
connect
(
pRightPalette
->
libWidget
()
->
actionBar
(),
SIGNAL
(
newFolderToCreate
()),
mLibWidget
,
SLOT
(
onNewFolderToCreate
()));
}
mLibWidget
->
init
();
mLibWidget
->
init
();
}
}
...
@@ -147,6 +144,7 @@ void UBLibNavigatorWidget::removeNextChainedElements(UBChainedLibElement *fromEl
...
@@ -147,6 +144,7 @@ void UBLibNavigatorWidget::removeNextChainedElements(UBChainedLibElement *fromEl
if
(
NULL
!=
fromElem
->
nextElement
())
if
(
NULL
!=
fromElem
->
nextElement
())
{
{
removeNextChainedElements
(
fromElem
->
nextElement
());
removeNextChainedElements
(
fromElem
->
nextElement
());
delete
fromElem
->
nextElement
()
->
element
();
delete
fromElem
->
nextElement
();
delete
fromElem
->
nextElement
();
fromElem
->
setNextElement
(
NULL
);
fromElem
->
setNextElement
(
NULL
);
}
}
...
...
src/gui/UBLibNavigatorWidget.h
View file @
ff9a74b1
...
@@ -32,6 +32,8 @@ public:
...
@@ -32,6 +32,8 @@ public:
~
UBLibNavigatorWidget
();
~
UBLibNavigatorWidget
();
void
dropMe
(
const
QMimeData
*
_data
);
void
dropMe
(
const
QMimeData
*
_data
);
UBLibraryWidget
*
libraryWidget
(){
return
mLibWidget
;};
signals
:
signals
:
void
propertiesRequested
(
UBLibElement
*
elem
);
void
propertiesRequested
(
UBLibElement
*
elem
);
...
...
src/gui/UBLibPalette.cpp
deleted
100644 → 0
View file @
e59ac4ca
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QDebug>
#include "UBLibPalette.h"
#include "core/memcheck.h"
/**
* \brief Constructor
* @param parent as the parent widget
* @param name as the object name
*/
UBLibPalette
::
UBLibPalette
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPalette
(
parent
,
name
)
,
mLayout
(
NULL
)
,
mStackedWidget
(
NULL
)
,
mNavigator
(
NULL
)
,
mProperties
(
NULL
)
,
mActionBar
(
NULL
)
{
setOrientation
(
eUBDockOrientation_Right
);
setAcceptDrops
(
true
);
resize
(
UBSettings
::
settings
()
->
libPaletteWidth
->
get
().
toInt
(),
parentWidget
()
->
height
());
setContentsMargins
(
border
(),
0
,
0
,
0
);
mCollapseWidth
=
180
;
mLastWidth
=
300
;
mLayout
=
new
QVBoxLayout
(
this
);
mLayout
->
setContentsMargins
(
20
,
customMargin
(),
customMargin
(),
customMargin
());
setLayout
(
mLayout
);
// Build the GUI
mStackedWidget
=
new
QStackedWidget
(
this
);
mActionBar
=
new
UBLibActionBar
(
this
);
mNavigator
=
new
UBLibNavigatorWidget
(
this
);
mProperties
=
new
UBLibItemProperties
(
this
);
mLayout
->
addWidget
(
mStackedWidget
,
1
);
mLayout
->
addWidget
(
mActionBar
,
0
);
mStackedWidget
->
addWidget
(
mNavigator
);
mStackedWidget
->
addWidget
(
mProperties
);
mStackedWidget
->
setCurrentIndex
(
ID_NAVIGATOR
);
miCrntStackWidget
=
ID_NAVIGATOR
;
connect
(
mNavigator
,
SIGNAL
(
propertiesRequested
(
UBLibElement
*
)),
this
,
SLOT
(
showProperties
(
UBLibElement
*
)));
connect
(
mProperties
,
SIGNAL
(
showFolderContent
()),
this
,
SLOT
(
showFolder
()));
}
/**
* \brief Destructor
*/
UBLibPalette
::~
UBLibPalette
()
{
if
(
NULL
!=
mProperties
)
{
delete
mProperties
;
mProperties
=
NULL
;
}
if
(
NULL
!=
mActionBar
)
{
delete
mActionBar
;
mActionBar
=
NULL
;
}
}
/**
* \brief Update the maximum width
*/
void
UBLibPalette
::
updateMaxWidth
()
{
setMaximumWidth
((
int
)((
parentWidget
()
->
width
()
*
2
)
/
3
));
setMaximumHeight
(
parentWidget
()
->
height
());
setMinimumHeight
(
parentWidget
()
->
height
());
}
/**
* \brief Handles the drag enter event
* @param pEvent as the drag enter event
*/
void
UBLibPalette
::
dragEnterEvent
(
QDragEnterEvent
*
pEvent
)
{
setBackgroundRole
(
QPalette
::
Highlight
);
pEvent
->
acceptProposedAction
();
}
void
UBLibPalette
::
dragLeaveEvent
(
QDragLeaveEvent
*
pEvent
)
{
pEvent
->
accept
();
}
/**
* \brief Handles the drop event
* @param pEvent as the drop event
*/
void
UBLibPalette
::
dropEvent
(
QDropEvent
*
pEvent
)
{
processMimeData
(
pEvent
->
mimeData
());
setBackgroundRole
(
QPalette
::
Dark
);
mStackedWidget
->
setCurrentIndex
(
miCrntStackWidget
);
pEvent
->
acceptProposedAction
();
}
/**
* \brief Handles the drag move event
* @param pEvent as the drag move event
*/
void
UBLibPalette
::
dragMoveEvent
(
QDragMoveEvent
*
pEvent
)
{
pEvent
->
acceptProposedAction
();
}
/**
* \brief Process the dropped MIME data
* @param pData as the mime dropped data
*/
void
UBLibPalette
::
processMimeData
(
const
QMimeData
*
pData
)
{
// Display the different mime types contained in the mime data
QStringList
qslFormats
=
pData
->
formats
();
for
(
int
i
=
0
;
i
<
qslFormats
.
size
();
i
++
)
{
qDebug
()
<<
"Dropped element format "
<<
i
<<
" = "
<<
qslFormats
.
at
(
i
);
}
}
void
UBLibPalette
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
if
(
mCanResize
)
{
UBDockPalette
::
mouseMoveEvent
(
event
);
}
else
{
//qDebug() << "Mouse move event detected!" ;
}
}
void
UBLibPalette
::
showProperties
(
UBLibElement
*
elem
)
{
if
(
NULL
!=
elem
)
{
mActionBar
->
setButtons
(
eButtonSet_Properties
);
// Show the properties of this object
mProperties
->
showElement
(
elem
);
mStackedWidget
->
setCurrentIndex
(
ID_PROPERTIES
);
miCrntStackWidget
=
ID_PROPERTIES
;
}
}
void
UBLibPalette
::
showFolder
()
{
mActionBar
->
setButtons
(
mActionBar
->
previousButtonSet
());
mStackedWidget
->
setCurrentIndex
(
ID_NAVIGATOR
);
miCrntStackWidget
=
ID_NAVIGATOR
;
}
void
UBLibPalette
::
resizeEvent
(
QResizeEvent
*
event
)
{
UBDockPalette
::
resizeEvent
(
event
);
UBSettings
::
settings
()
->
libPaletteWidth
->
set
(
width
());
emit
resized
();
}
src/gui/UBLibPalette.h
deleted
100644 → 0
View file @
e59ac4ca
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBLIBPALETTE_H
#define UBLIBPALETTE_H
#include <QWidget>
#include <QVBoxLayout>
#include <QStackedWidget>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QDragMoveEvent>
#include <QMimeData>
#include <QMouseEvent>
#include <QResizeEvent>
#include <QLabel>
#include "UBDockPalette.h"
#include "UBLibNavigatorWidget.h"
#include "UBLibItemProperties.h"
#include "UBLibActionBar.h"
#define ID_NAVIGATOR 0
#define ID_PROPERTIES 1
class
UBLibPalette
:
public
UBDockPalette
{
Q_OBJECT
public
:
UBLibPalette
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"libPalette"
);
~
UBLibPalette
();
UBLibActionBar
*
actionBar
(){
return
mActionBar
;}
signals
:
void
resized
();
protected
:
void
updateMaxWidth
();
void
dragEnterEvent
(
QDragEnterEvent
*
pEvent
);
void
dropEvent
(
QDropEvent
*
pEvent
);
void
dragMoveEvent
(
QDragMoveEvent
*
pEvent
);
void
dragLeaveEvent
(
QDragLeaveEvent
*
pEvent
);
void
mouseMoveEvent
(
QMouseEvent
*
event
);
void
resizeEvent
(
QResizeEvent
*
event
);
private
slots
:
void
showProperties
(
UBLibElement
*
elem
);
void
showFolder
();
private
:
void
processMimeData
(
const
QMimeData
*
pData
);
/** The layout */
QVBoxLayout
*
mLayout
;
/** The stacked layout */
QStackedWidget
*
mStackedWidget
;
/** The Navigator widget */
UBLibNavigatorWidget
*
mNavigator
;
/** The Properties widget */
UBLibItemProperties
*
mProperties
;
/** UBLibActionBar */
UBLibActionBar
*
mActionBar
;
/** The current stack widget index*/
int
miCrntStackWidget
;
};
#endif // UBLIBPALETTE_H
src/gui/UBLibWidget.h
View file @
ff9a74b1
...
@@ -42,6 +42,7 @@ public:
...
@@ -42,6 +42,7 @@ public:
~
UBLibWidget
();
~
UBLibWidget
();
UBLibActionBar
*
actionBar
(){
return
mActionBar
;}
UBLibActionBar
*
actionBar
(){
return
mActionBar
;}
UBLibNavigatorWidget
*
libNavigator
()
{
return
mNavigator
;};
signals
:
signals
:
void
resized
();
void
resized
();
...
...
src/gui/UBLibraryWidget.cpp
View file @
ff9a74b1
...
@@ -34,11 +34,11 @@ UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailW
...
@@ -34,11 +34,11 @@ UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailW
,
chainedElements
(
NULL
)
,
chainedElements
(
NULL
)
,
mpCrntDir
(
NULL
)
,
mpCrntDir
(
NULL
)
,
mpCrntElem
(
NULL
)
,
mpCrntElem
(
NULL
)
,
mCrntPath
(
"/"
)
{
{
setObjectName
(
name
);
setObjectName
(
name
);
setSpacing
(
5
);
setSpacing
(
5
);
setStyleSheet
(
QString
(
"background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;"
));
setStyleSheet
(
QString
(
"background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;"
));
mLibraryController
=
new
UBLibraryController
(
parentWidget
());
}
}
/**
/**
...
@@ -46,21 +46,26 @@ UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailW
...
@@ -46,21 +46,26 @@ UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailW
*/
*/
UBLibraryWidget
::~
UBLibraryWidget
()
UBLibraryWidget
::~
UBLibraryWidget
()
{
{
if
(
mLibraryController
){
delete
mLibraryController
;
mLibraryController
=
NULL
;
}
// if(NULL != chainedElements)
// if(NULL != chainedElements)
// {
// {
// delete chainedElements;
// delete chainedElements;
// chainedElements = NULL;
// chainedElements = NULL;
// }
// }
// if(NULL != mpCrntDir)
if
(
NULL
!=
mpCrntDir
)
// {
{
// delete mpCrntDir;
delete
mpCrntDir
;
// mpCrntDir = NULL;
mpCrntDir
=
NULL
;
// }
}
// if(NULL != mpCrntElem)
if
(
NULL
!=
mpCrntElem
)
// {
{
// delete mpCrntElem;
delete
mpCrntElem
;
// mpCrntElem = NULL;
mpCrntElem
=
NULL
;
// }
}
}
}
/**
/**
...
@@ -70,9 +75,9 @@ void UBLibraryWidget::init()
...
@@ -70,9 +75,9 @@ void UBLibraryWidget::init()
{
{
setAcceptDrops
(
true
);
setAcceptDrops
(
true
);
mpCrntElem
=
new
UBLibElement
();
mpCrntElem
=
new
UBLibElement
();
mpCrntElem
->
setThumbnail
(
new
QImage
(
":images/libpalette/home.png"
));
mpCrntElem
->
setThumbnail
(
QImage
(
":images/libpalette/home.png"
));
chainedElements
=
new
UBChainedLibElement
(
mpCrntElem
);
chainedElements
=
new
UBChainedLibElement
(
mpCrntElem
);
QList
<
UBLibElement
*>
qlElems
=
libraryController
()
->
getContent
(
mpCrntElem
);
QList
<
UBLibElement
*>
qlElems
=
mLibraryController
->
getContent
(
mpCrntElem
);
mCurrentElems
=
qlElems
;
mCurrentElems
=
qlElems
;
setCurrentElemsAndRefresh
(
chainedElements
);
setCurrentElemsAndRefresh
(
chainedElements
);
...
@@ -104,7 +109,7 @@ void UBLibraryWidget::refreshView()
...
@@ -104,7 +109,7 @@ void UBLibraryWidget::refreshView()
emit
navigBarUpdate
(
mpCrntElem
);
emit
navigBarUpdate
(
mpCrntElem
);
bool
bFavorite
=
false
;
bool
bFavorite
=
false
;
if
(
NULL
!=
mpCrntDir
&&
libraryController
()
->
favoritePath
()
==
mpCrntDir
->
path
().
toLocalFile
())
if
(
NULL
!=
mpCrntDir
&&
mLibraryController
->
favoritePath
()
==
mpCrntDir
->
path
().
toLocalFile
())
{
{
bFavorite
=
true
;
bFavorite
=
true
;
}
}
...
@@ -142,18 +147,17 @@ void UBLibraryWidget::onItemClicked(QGraphicsItem *item, int index)
...
@@ -142,18 +147,17 @@ void UBLibraryWidget::onItemClicked(QGraphicsItem *item, int index)
UBLibElement
*
pElem
=
mCurrentElems
.
at
(
iItem
);
UBLibElement
*
pElem
=
mCurrentElems
.
at
(
iItem
);
if
(
NULL
!=
pElem
)
if
(
NULL
!=
pElem
)
{
{
mpCrntElem
=
pElem
;
delete
mpCrntElem
;
if
(
eUBLibElementType_Folder
==
pElem
->
type
()
||
mpCrntElem
=
new
UBLibElement
(
pElem
);
eUBLibElementType_VirtualFolder
==
pElem
->
type
())
if
(
eUBLibElementType_Folder
==
pElem
->
type
()
||
eUBLibElementType_VirtualFolder
==
pElem
->
type
())
{
{
// Add the clicked element to the end of the elements list
// Add the clicked element to the end of the elements list
// (at this level, the user can only go down in the path)
// (at this level, the user can only go down in the path)
UBChainedLibElement
*
pNextElem
=
new
UBChainedLibElement
(
pElem
);
UBChainedLibElement
*
pNextElem
=
new
UBChainedLibElement
(
pElem
);
appendChainedElement
(
pNextElem
,
chainedElements
);
appendChainedElement
(
pNextElem
,
chainedElements
);
delete
mpCrntDir
;
mpCrntDir
=
pElem
;
mpCrntDir
=
new
UBLibElement
(
pElem
);
// Display the content of the folder
// Display the content of the folder
QList
<
UBLibElement
*>
qlElems
=
libraryController
()
->
getContent
(
pElem
);
QList
<
UBLibElement
*>
qlElems
=
mLibraryController
->
getContent
(
mpCrntDir
);
mCurrentElems
=
qlElems
;
mCurrentElems
=
qlElems
;
refreshView
();
refreshView
();
}
}
...
@@ -200,13 +204,15 @@ void UBLibraryWidget::setCurrentElemsAndRefresh(UBChainedLibElement *elem)
...
@@ -200,13 +204,15 @@ void UBLibraryWidget::setCurrentElemsAndRefresh(UBChainedLibElement *elem)
{
{
if
(
eUBLibElementType_Item
!=
pLibElem
->
type
())
if
(
eUBLibElementType_Item
!=
pLibElem
->
type
())
{
{
QList
<
UBLibElement
*>
qlElements
=
libraryController
()
->
getContent
(
pLibElem
);
QList
<
UBLibElement
*>
qlElements
=
mLibraryController
->
getContent
(
pLibElem
);
mCurrentElems
=
qlElements
;
mCurrentElems
=
qlElements
;
mpCrntElem
=
pLibElem
;
delete
mpCrntElem
;
mpCrntElem
=
new
UBLibElement
(
pLibElem
);
refreshView
();
refreshView
();
mpCrntDir
=
pLibElem
;
delete
mpCrntDir
;
mpCrntDir
=
new
UBLibElement
(
pLibElem
);
bool
bFavorite
=
false
;
bool
bFavorite
=
false
;
if
(
NULL
!=
mpCrntDir
&&
libraryController
()
->
favoritePath
()
==
mpCrntDir
->
path
().
toLocalFile
())
if
(
NULL
!=
mpCrntDir
&&
mLibraryController
->
favoritePath
()
==
mpCrntDir
->
path
().
toLocalFile
())
{
{
bFavorite
=
true
;
bFavorite
=
true
;
}
}
...
@@ -234,9 +240,7 @@ void UBLibraryWidget::onSelectionChanged()
...
@@ -234,9 +240,7 @@ void UBLibraryWidget::onSelectionChanged()
UBLibElement
*
pElem
=
mCurrentElems
.
at
(
itIndex
);
UBLibElement
*
pElem
=
mCurrentElems
.
at
(
itIndex
);
if
(
NULL
!=
pElem
)
if
(
NULL
!=
pElem
)
{
{
if
(
eUBLibElementType_Category
!=
pElem
->
type
()
&&
if
(
eUBLibElementType_Category
!=
pElem
->
type
()
&&
eUBLibElementType_VirtualFolder
!=
pElem
->
type
())
{
eUBLibElementType_VirtualFolder
!=
pElem
->
type
())
{
qlSelectedItems
<<
pElem
;
qlSelectedItems
<<
pElem
;
}
}
...
@@ -268,7 +272,7 @@ void UBLibraryWidget::onSelectionChanged()
...
@@ -268,7 +272,7 @@ void UBLibraryWidget::onSelectionChanged()
void
UBLibraryWidget
::
onRefreshCurrentFolder
()
void
UBLibraryWidget
::
onRefreshCurrentFolder
()
{
{
// Refresh the current view
// Refresh the current view
mCurrentElems
=
libraryController
()
->
getContent
(
mpCrntDir
);
mCurrentElems
=
mLibraryController
->
getContent
(
mpCrntDir
);
refreshView
();
refreshView
();
}
}
...
@@ -341,7 +345,7 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
...
@@ -341,7 +345,7 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
{
{
qDebug
()
<<
"hasImage"
;
qDebug
()
<<
"hasImage"
;
QImage
image
=
qvariant_cast
<
QImage
>
(
pMimeData
->
imageData
());
QImage
image
=
qvariant_cast
<
QImage
>
(
pMimeData
->
imageData
());
libraryController
()
->
importImageOnLibrary
(
image
);
mLibraryController
->
importImageOnLibrary
(
image
);
bDropAccepted
=
true
;
bDropAccepted
=
true
;
}
}
else
if
(
pMimeData
->
hasHtml
())
else
if
(
pMimeData
->
hasHtml
())
...
@@ -353,7 +357,7 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
...
@@ -353,7 +357,7 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
// On linux external dragged element are considered as text;
// On linux external dragged element are considered as text;
qDebug
()
<<
"hasText: "
<<
pMimeData
->
text
();
qDebug
()
<<
"hasText: "
<<
pMimeData
->
text
();
QString
filePath
=
QUrl
(
pMimeData
->
text
()).
toLocalFile
();
QString
filePath
=
QUrl
(
pMimeData
->
text
()).
toLocalFile
();
libraryController
()
->
importItemOnLibrary
(
filePath
);
mLibraryController
->
importItemOnLibrary
(
filePath
);
bDropAccepted
=
true
;
bDropAccepted
=
true
;
}
}
else
if
(
pMimeData
->
hasUrls
())
else
if
(
pMimeData
->
hasUrls
())
...
@@ -363,7 +367,7 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
...
@@ -363,7 +367,7 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
for
(
int
i
=
0
;
i
<
urlList
.
size
()
&&
i
<
32
;
++
i
)
for
(
int
i
=
0
;
i
<
urlList
.
size
()
&&
i
<
32
;
++
i
)
{
{
QString
filePath
=
QUrl
(
urlList
.
at
(
i
).
path
()).
toLocalFile
();
QString
filePath
=
QUrl
(
urlList
.
at
(
i
).
path
()).
toLocalFile
();
libraryController
()
->
importItemOnLibrary
(
filePath
);
mLibraryController
->
importItemOnLibrary
(
filePath
);
bDropAccepted
=
true
;
bDropAccepted
=
true
;
}
}
}
}
...
@@ -427,14 +431,6 @@ UBLibElement* UBLibraryWidget::elementFromFilePath(const QString &filePath)
...
@@ -427,14 +431,6 @@ UBLibElement* UBLibraryWidget::elementFromFilePath(const QString &filePath)
return
pElem
;
return
pElem
;
}
}
/**
* \brief Get a pointer on the library controller
* @return a pointer on the library controller
*/
UBLibraryController
*
UBLibraryWidget
::
libraryController
()
{
return
UBApplication
::
boardController
->
libraryController
();
}
/**
/**
* \brief Update the thumbnails size
* \brief Update the thumbnails size
...
@@ -460,8 +456,8 @@ void UBLibraryWidget::onElementsDropped(QList<QString> elements, UBLibElement *t
...
@@ -460,8 +456,8 @@ void UBLibraryWidget::onElementsDropped(QList<QString> elements, UBLibElement *t
foreach
(
QString
qsElem
,
elements
)
foreach
(
QString
qsElem
,
elements
)
qlElements
<<
elementFromFilePath
(
qsElem
);
qlElements
<<
elementFromFilePath
(
qsElem
);
libraryController
()
->
moveContent
(
qlElements
,
target
);
mLibraryController
->
moveContent
(
qlElements
,
target
);
mCurrentElems
=
libraryController
()
->
getContent
(
mpCrntDir
);
mCurrentElems
=
mLibraryController
->
getContent
(
mpCrntDir
);
refreshView
();
refreshView
();
}
}
}
}
...
@@ -473,7 +469,7 @@ void UBLibraryWidget::onElementsDropped(QList<QString> elements, UBLibElement *t
...
@@ -473,7 +469,7 @@ void UBLibraryWidget::onElementsDropped(QList<QString> elements, UBLibElement *t
void
UBLibraryWidget
::
onSearchElement
(
QString
elem
)
void
UBLibraryWidget
::
onSearchElement
(
QString
elem
)
{
{
// Store the original list of items
// Store the original list of items
mOrigCurrentElems
=
libraryController
()
->
getContent
(
mpCrntDir
);
mOrigCurrentElems
=
mLibraryController
->
getContent
(
mpCrntDir
);
// Build the filtered list
// Build the filtered list
mCurrentElems
.
clear
();
mCurrentElems
.
clear
();
...
@@ -503,7 +499,7 @@ void UBLibraryWidget::onNewFolderToCreate()
...
@@ -503,7 +499,7 @@ void UBLibraryWidget::onNewFolderToCreate()
UBNewFolderDlg
dlg
;
UBNewFolderDlg
dlg
;
if
(
QDialog
::
Accepted
==
dlg
.
exec
())
if
(
QDialog
::
Accepted
==
dlg
.
exec
())
{
{
libraryController
()
->
createNewFolder
(
dlg
.
folderName
(),
mpCrntElem
);
mLibraryController
->
createNewFolder
(
dlg
.
folderName
(),
mpCrntElem
);
onRefreshCurrentFolder
();
onRefreshCurrentFolder
();
}
}
}
}
...
...
src/gui/UBLibraryWidget.h
View file @
ff9a74b1
...
@@ -29,7 +29,10 @@
...
@@ -29,7 +29,10 @@
#include <QVBoxLayout>
#include <QVBoxLayout>
#include "UBThumbnailWidget.h"
#include "UBThumbnailWidget.h"
#include "board/UBLibraryController.h"
class
UBLibraryController
;
class
UBChainedLibElement
;
class
UBLibElement
;
class
UBLibraryWidget
:
public
UBThumbnailWidget
class
UBLibraryWidget
:
public
UBThumbnailWidget
{
{
...
@@ -44,6 +47,8 @@ public:
...
@@ -44,6 +47,8 @@ public:
void
updateThumbnailsSize
(
int
newSize
);
void
updateThumbnailsSize
(
int
newSize
);
void
init
();
void
init
();
UBLibraryController
*
libraryController
()
{
return
mLibraryController
;};
public
slots
:
public
slots
:
void
onRefreshCurrentFolder
();
void
onRefreshCurrentFolder
();
void
onElementsDropped
(
QList
<
QString
>
elements
,
UBLibElement
*
target
);
void
onElementsDropped
(
QList
<
QString
>
elements
,
UBLibElement
*
target
);
...
@@ -71,14 +76,13 @@ private:
...
@@ -71,14 +76,13 @@ private:
void
appendChainedElement
(
UBChainedLibElement
*
element
,
UBChainedLibElement
*
toElem
);
void
appendChainedElement
(
UBChainedLibElement
*
element
,
UBChainedLibElement
*
toElem
);
UBLibElement
*
elementAt
(
QPoint
p
);
UBLibElement
*
elementAt
(
QPoint
p
);
UBLibElement
*
elementFromFilePath
(
const
QString
&
filePath
);
UBLibElement
*
elementFromFilePath
(
const
QString
&
filePath
);
UBLibraryController
*
libraryController
()
;
UBLibraryController
*
mLibraryController
;
UBLibElement
*
mpCrntDir
;
UBLibElement
*
mpCrntDir
;
UBLibElement
*
mpCrntElem
;
UBLibElement
*
mpCrntElem
;
QList
<
UBLibElement
*>
mCurrentElems
;
QList
<
UBLibElement
*>
mCurrentElems
;
QList
<
UBLibElement
*>
mOrigCurrentElems
;
QList
<
UBLibElement
*>
mOrigCurrentElems
;
QList
<
QGraphicsItem
*>
mItems
;
QList
<
QGraphicsItem
*>
mItems
;
QString
mCrntPath
;
};
};
...
...
src/gui/gui.pri
View file @
ff9a74b1
...
@@ -29,7 +29,6 @@ HEADERS += src/gui/UBThumbnailView.h \
...
@@ -29,7 +29,6 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBFavoriteToolPalette.h \
src/gui/UBFavoriteToolPalette.h \
src/gui/UBKeyboardPalette.h \
src/gui/UBKeyboardPalette.h \
src/gui/UBNavigatorPalette.h \
src/gui/UBNavigatorPalette.h \
src/gui/UBLibPalette.h \
src/gui/UBDocumentNavigator.h \
src/gui/UBDocumentNavigator.h \
src/gui/UBDockPalette.h \
src/gui/UBDockPalette.h \
src/gui/UBPropertyPalette.h \
src/gui/UBPropertyPalette.h \
...
@@ -76,7 +75,6 @@ SOURCES += src/gui/UBThumbnailView.cpp \
...
@@ -76,7 +75,6 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFavoriteToolPalette.cpp \
src/gui/UBFavoriteToolPalette.cpp \
src/gui/UBKeyboardPalette.cpp \
src/gui/UBKeyboardPalette.cpp \
src/gui/UBNavigatorPalette.cpp \
src/gui/UBNavigatorPalette.cpp \
src/gui/UBLibPalette.cpp \
src/gui/UBDocumentNavigator.cpp \
src/gui/UBDocumentNavigator.cpp \
src/gui/UBDockPalette.cpp \
src/gui/UBDockPalette.cpp \
src/gui/UBPropertyPalette.cpp \
src/gui/UBPropertyPalette.cpp \
...
...
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