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
eaff36a9
Commit
eaff36a9
authored
Apr 28, 2012
by
Ivan Ilyin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'FeatureWidget'
parents
2b678dd9
c6e8b92d
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1771 additions
and
8 deletions
+1771
-8
style.qss
resources/style.qss
+9
-1
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+5
-0
UBBoardPaletteManager.h
src/board/UBBoardPaletteManager.h
+3
-0
UBBoardView.cpp
src/board/UBBoardView.cpp
+6
-5
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+369
-0
UBFeaturesController.h
src/board/UBFeaturesController.h
+124
-0
board.pri
src/board/board.pri
+4
-2
UBFeaturesActionBar.cpp
src/gui/UBFeaturesActionBar.cpp
+200
-0
UBFeaturesActionBar.h
src/gui/UBFeaturesActionBar.h
+68
-0
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+737
-0
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+241
-0
UBLibraryWidget.h
src/gui/UBLibraryWidget.h
+1
-0
gui.pri
src/gui/gui.pri
+4
-0
No files found.
resources/style.qss
View file @
eaff36a9
...
@@ -4,7 +4,8 @@ QWidget#UBLibPathViewer,
...
@@ -4,7 +4,8 @@ QWidget#UBLibPathViewer,
QWidget#UBLibNavigatorWidget,
QWidget#UBLibNavigatorWidget,
QWidget#UBLibItemProperties,
QWidget#UBLibItemProperties,
QWidget#UBDownloadWidget,
QWidget#UBDownloadWidget,
QWidget#UBTeacherGuideWidget
QWidget#UBTeacherGuideWidget,
QWidget#UBFeatureProperties
{
{
background: #EEEEEE;
background: #EEEEEE;
border-radius: 10px;
border-radius: 10px;
...
@@ -25,6 +26,13 @@ QWidget#UBLibWebView
...
@@ -25,6 +26,13 @@ QWidget#UBLibWebView
border: 2px solid #999999;
border: 2px solid #999999;
}
}
QListView
{
background: #EEEEEE;
border-radius : 10px;
border: 2px solid #999999;
}
QWebView#SearchEngineView
QWebView#SearchEngineView
{
{
background:white;
background:white;
...
...
src/board/UBBoardPaletteManager.cpp
View file @
eaff36a9
...
@@ -138,6 +138,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
...
@@ -138,6 +138,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mpDownloadWidget
=
new
UBDockDownloadWidget
();
mpDownloadWidget
=
new
UBDockDownloadWidget
();
mpTeacherGuideWidget
=
new
UBDockTeacherGuideWidget
();
mpTeacherGuideWidget
=
new
UBDockTeacherGuideWidget
();
mpFeaturesWidget
=
new
UBFeaturesWidget
();
// Add the dock palettes
// Add the dock palettes
mLeftPalette
=
new
UBLeftPalette
(
mContainer
);
mLeftPalette
=
new
UBLeftPalette
(
mContainer
);
...
@@ -153,6 +154,10 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
...
@@ -153,6 +154,10 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mRightPalette
=
new
UBRightPalette
(
mContainer
);
mRightPalette
=
new
UBRightPalette
(
mContainer
);
// RIGHT palette widgets
// RIGHT palette widgets
mRightPalette
->
registerWidget
(
mpFeaturesWidget
);
mRightPalette
->
addTab
(
mpFeaturesWidget
);
mRightPalette
->
registerWidget
(
mpLibWidget
);
mRightPalette
->
registerWidget
(
mpLibWidget
);
mRightPalette
->
addTab
(
mpLibWidget
);
mRightPalette
->
addTab
(
mpLibWidget
);
// The cache widget will be visible only if a cache is put on the page
// The cache widget will be visible only if a cache is put on the page
...
...
src/board/UBBoardPaletteManager.h
View file @
eaff36a9
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "gui/UBCachePropertiesWidget.h"
#include "gui/UBCachePropertiesWidget.h"
#include "gui/UBDockDownloadWidget.h"
#include "gui/UBDockDownloadWidget.h"
#include "core/UBApplicationController.h"
#include "core/UBApplicationController.h"
#include "gui/UBFeaturesWidget.h"
class
UBStylusPalette
;
class
UBStylusPalette
;
...
@@ -129,6 +130,8 @@ class UBBoardPaletteManager : public QObject
...
@@ -129,6 +130,8 @@ class UBBoardPaletteManager : public QObject
/** The cache properties widget */
/** The cache properties widget */
UBCachePropertiesWidget
*
mpCachePropWidget
;
UBCachePropertiesWidget
*
mpCachePropWidget
;
UBFeaturesWidget
*
mpFeaturesWidget
;
/** The download widget */
/** The download widget */
UBDockDownloadWidget
*
mpDownloadWidget
;
UBDockDownloadWidget
*
mpDownloadWidget
;
// HACK: here we duplicate the lib widget for the desktop mode
// HACK: here we duplicate the lib widget for the desktop mode
...
...
src/board/UBBoardView.cpp
View file @
eaff36a9
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include <QtGui>
#include <QtGui>
#include <QtXml>
#include <QtXml>
#include <QListView>
#include "UBDrawingController.h"
#include "UBDrawingController.h"
...
@@ -843,17 +844,17 @@ void UBBoardView::dropEvent (QDropEvent *event)
...
@@ -843,17 +844,17 @@ void UBBoardView::dropEvent (QDropEvent *event)
QGraphicsItem
*
graphicsItemAtPos
=
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
QGraphicsItem
*
graphicsItemAtPos
=
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
UBGraphicsWidgetItem
*
graphicsWidget
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
graphicsItemAtPos
);
UBGraphicsWidgetItem
*
graphicsWidget
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
graphicsItemAtPos
);
qDebug
()
<<
event
->
source
();
if
(
graphicsWidget
&&
graphicsWidget
->
acceptDrops
())
{
if
(
graphicsWidget
&&
graphicsWidget
->
acceptDrops
())
{
graphicsWidget
->
processDropEvent
(
event
);
graphicsWidget
->
processDropEvent
(
event
);
event
->
acceptProposedAction
();
event
->
acceptProposedAction
();
}
}
else
if
(
!
event
->
source
()
else
if
(
!
event
->
source
()
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
QWebView
*>
(
event
->
source
())
||
dynamic_cast
<
UBTGMediaWidget
*>
(
event
->
source
()))
{
||
dynamic_cast
<
UBTGMediaWidget
*>
(
event
->
source
())
||
dynamic_cast
<
QListView
*>
(
event
->
source
())
)
{
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
mController
->
processMimeData
(
event
->
mimeData
(),
mapToScene
(
event
->
pos
()));
event
->
acceptProposedAction
();
event
->
acceptProposedAction
();
}
}
...
...
src/board/UBFeaturesController.cpp
0 → 100644
View file @
eaff36a9
This diff is collapsed.
Click to expand it.
src/board/UBFeaturesController.h
0 → 100644
View file @
eaff36a9
#ifndef UBFEATURESCONTROLLER_H
#define UBFEATURESCONTROLLER_H
#include <QMetaType>
#include <QObject>
#include <QWidget>
#include <QVector>
#include <QString>
#include <QPixmap>
//#include "UBDockPaletteWidget.h"
enum
UBFeatureElementType
{
FEATURE_CATEGORY
,
FEATURE_VIRTUALFOLDER
,
FEATURE_FOLDER
,
FEATURE_INTERACTIVE
,
FEATURE_INTERNAL
,
FEATURE_ITEM
,
FEATURE_TRASH
,
FEATURE_FAVORITE
};
class
UBFeature
{
public
:
UBFeature
()
{;}
//UBFeature(const UBFeature &f);
UBFeature
(
const
QString
&
url
,
const
QPixmap
&
icon
,
const
QString
&
name
,
const
QString
&
realPath
,
UBFeatureElementType
type
=
FEATURE_CATEGORY
);
virtual
~
UBFeature
()
{;}
QString
getName
()
const
{
return
mName
;
}
QPixmap
getThumbnail
()
const
{
return
mThumbnail
;}
QString
getUrl
()
const
{
return
virtualPath
;
}
//QString getPath() const { return mPath; };
QString
getFullPath
()
const
{
return
mPath
;
}
UBFeatureElementType
getType
()
const
{
return
elementType
;
}
bool
isFolder
()
const
;
private
:
QString
virtualPath
;
QPixmap
mThumbnail
;
QString
mName
;
QString
mPath
;
UBFeatureElementType
elementType
;
};
Q_DECLARE_METATYPE
(
UBFeature
)
class
UBFeaturesController
:
public
QObject
{
Q_OBJECT
public
:
UBFeaturesController
(
QWidget
*
parentWidget
);
virtual
~
UBFeaturesController
();
QList
<
UBFeature
>*
getFeatures
()
const
{
return
featuresList
;
}
const
QString
&
getRootPath
()
const
{
return
rootPath
;
}
void
addItemToPage
(
const
UBFeature
&
item
);
const
UBFeature
&
getCurrentElement
()
const
{
return
currentElement
;
}
void
setCurrentElement
(
const
UBFeature
&
elem
)
{
currentElement
=
elem
;
}
const
UBFeature
&
getTrashElement
()
const
{
return
trashElement
;
}
UBFeature
moveItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
UBFeature
copyItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
void
deleteItem
(
const
QUrl
&
url
);
bool
isTrash
(
const
QUrl
&
url
);
UBFeature
newFolder
(
const
QString
&
name
);
UBFeature
addToFavorite
(
const
QUrl
&
path
);
void
removeFromFavorite
(
const
QUrl
&
path
);
static
QString
fileNameFromUrl
(
const
QUrl
&
url
);
static
QPixmap
thumbnailForFile
(
const
QString
&
path
);
private
:
void
initDirectoryTree
();
void
fileSystemScan
(
const
QString
&
currPath
,
const
QString
&
currVirtualPath
);
static
QPixmap
createThumbnail
(
const
QString
&
path
);
//void addImageToCurrentPage( const QString &path );
void
loadFavoriteList
();
void
saveFavoriteList
();
static
UBFeatureElementType
fileTypeFromUrl
(
const
QString
&
path
);
QList
<
UBFeature
>
*
featuresList
;
UBFeature
*
rootElement
;
QString
mUserAudioDirectoryPath
;
QString
mUserVideoDirectoryPath
;
QString
mUserPicturesDirectoryPath
;
QString
mUserInteractiveDirectoryPath
;
QString
mUserAnimationDirectoryPath
;
QString
libraryPath
;
QString
mLibAudioDirectoryPath
;
QString
mLibVideoDirectoryPath
;
QString
mLibPicturesDirectoryPath
;
QString
mLibInteractiveDirectoryPath
;
QString
mLibAnimationDirectoryPath
;
QString
mLibApplicationsDirectoryPath
;
QString
mLibShapesDirectoryPath
;
QString
trashDirectoryPath
;
QString
rootPath
;
QString
audiosPath
;
QString
moviesPath
;
QString
picturesPath
;
QString
appPath
;
QString
flashPath
;
QString
shapesPath
;
QString
interactPath
;
QString
trashPath
;
QString
favoritePath
;
int
mLastItemOffsetIndex
;
UBFeature
currentElement
;
UBFeature
trashElement
;
UBFeature
favoriteElement
;
QSet
<
QString
>
*
favoriteSet
;
};
#endif
src/board/board.pri
View file @
eaff36a9
...
@@ -3,13 +3,15 @@ HEADERS += src/board/UBBoardController.h \
...
@@ -3,13 +3,15 @@ HEADERS += src/board/UBBoardController.h \
src/board/UBBoardPaletteManager.h \
src/board/UBBoardPaletteManager.h \
src/board/UBBoardView.h \
src/board/UBBoardView.h \
src/board/UBLibraryController.h \
src/board/UBLibraryController.h \
src/board/UBDrawingController.h
src/board/UBDrawingController.h \
src/board/UBFeaturesController.h
SOURCES += src/board/UBBoardController.cpp \
SOURCES += src/board/UBBoardController.cpp \
src/board/UBBoardPaletteManager.cpp \
src/board/UBBoardPaletteManager.cpp \
src/board/UBBoardView.cpp \
src/board/UBBoardView.cpp \
src/board/UBLibraryController.cpp \
src/board/UBLibraryController.cpp \
src/board/UBDrawingController.cpp
src/board/UBDrawingController.cpp \
src/board/UBFeaturesController.cpp
...
...
src/gui/UBFeaturesActionBar.cpp
0 → 100644
View file @
eaff36a9
#include "UBFeaturesActionBar.h"
UBFeaturesActionBar
::
UBFeaturesActionBar
(
UBFeaturesController
*
controller
,
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
featuresController
(
controller
)
,
mButtonGroup
(
NULL
)
,
mSearchBar
(
NULL
)
,
mLayout
(
NULL
)
,
mpFavoriteAction
(
NULL
)
,
mpSocialAction
(
NULL
)
,
mpDeleteAction
(
NULL
)
,
mpSearchAction
(
NULL
)
,
mpCloseAction
(
NULL
)
,
mpRemoveFavorite
(
NULL
)
,
mpNewFolderAction
(
NULL
)
,
mpFavoriteBtn
(
NULL
)
,
mpSocialBtn
(
NULL
)
,
mpDeleteBtn
(
NULL
)
,
mpCloseBtn
(
NULL
)
,
mpRemoveFavoriteBtn
(
NULL
)
,
mpNewFolderBtn
(
NULL
)
{
setObjectName
(
name
);
setStyleSheet
(
QString
(
"background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;"
));
setAcceptDrops
(
true
);
mButtonGroup
=
new
QButtonGroup
(
this
);
mSearchBar
=
new
QLineEdit
(
this
);
mSearchBar
->
setStyleSheet
(
QString
(
"background-color:white; border-radius : 10px; padding : 2px;"
));
//connect(mSearchBar, SIGNAL(returnPressed()), this, SLOT(onActionSearch()));
mLayout
=
new
QHBoxLayout
();
setLayout
(
mLayout
);
setMaximumHeight
(
ACTIONBAR_HEIGHT
);
// Create the actions
mpFavoriteAction
=
new
QAction
(
QIcon
(
":/images/libpalette/miniFavorite.png"
),
tr
(
"Add to favorites"
),
this
);
mpSocialAction
=
new
QAction
(
QIcon
(
":/images/libpalette/social.png"
),
tr
(
"Share"
),
this
);
mpSearchAction
=
new
QAction
(
QIcon
(
":/images/libpalette/miniSearch.png"
),
tr
(
"Search"
),
this
);
mpDeleteAction
=
new
QAction
(
QIcon
(
":/images/libpalette/miniTrash.png"
),
tr
(
"Delete"
),
this
);
mpCloseAction
=
new
QAction
(
QIcon
(
":/images/close.svg"
),
tr
(
"Back to folder"
),
this
);
mpRemoveFavorite
=
new
QAction
(
QIcon
(
":/images/libpalette/trash_favorite.svg"
),
tr
(
"Remove from favorites"
),
this
);
mpNewFolderAction
=
new
QAction
(
QIcon
(
":/images/libpalette/miniNewFolder.png"
),
tr
(
"Create new folder"
),
this
);
// Create the buttons
mpFavoriteBtn
=
new
UBActionButton
(
this
,
mpFavoriteAction
);
mpSocialBtn
=
new
UBActionButton
(
this
,
mpSocialAction
);
//mpSearchBtn = new UBActionButton(this, mpSearchAction);
mpDeleteBtn
=
new
UBActionButton
(
this
,
mpDeleteAction
);
mpCloseBtn
=
new
UBActionButton
(
this
,
mpCloseAction
);
mpRemoveFavoriteBtn
=
new
UBActionButton
(
this
,
mpRemoveFavorite
);
mpNewFolderBtn
=
new
UBActionButton
(
this
,
mpNewFolderAction
);
// Initialize the buttons
//mpSearchBtn->setEnabled(false);
mpNewFolderBtn
->
setEnabled
(
false
);
// Add the buttons to the button group
mButtonGroup
->
addButton
(
mpFavoriteBtn
);
mButtonGroup
->
addButton
(
mpSocialBtn
);
//mButtonGroup->addButton(mpSearchBtn);
mButtonGroup
->
addButton
(
mpDeleteBtn
);
mButtonGroup
->
addButton
(
mpCloseBtn
);
mButtonGroup
->
addButton
(
mpRemoveFavoriteBtn
);
mButtonGroup
->
addButton
(
mpNewFolderBtn
);
// Connect signals & slots
/*connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite()));
connect(mpSocialAction,SIGNAL(triggered()), this, SLOT(onActionSocial()));
connect(mpSearchAction,SIGNAL(triggered()), this, SLOT(onActionSearch()));
connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash()));
connect(mpCloseAction, SIGNAL(triggered()), this, SLOT(onActionClose()));
connect(mpRemoveFavorite, SIGNAL(triggered()), this, SLOT(onActionRemoveFavorite()));
connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString)));
connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));*/
connect
(
mSearchBar
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
onSearchTextChanged
(
QString
)));
connect
(
mpNewFolderAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionNewFolder
()));
// Build the default toolbar
mLayout
->
addWidget
(
mpFavoriteBtn
);
mLayout
->
addWidget
(
mpSocialBtn
);
mLayout
->
addWidget
(
mpNewFolderBtn
);
mLayout
->
addWidget
(
mSearchBar
);
//mLayout->addWidget(mpSearchBtn);
mLayout
->
addWidget
(
mpDeleteBtn
);
mLayout
->
addWidget
(
mpCloseBtn
);
mLayout
->
addWidget
(
mpRemoveFavoriteBtn
);
setCurrentState
(
IN_ROOT
);
mpDeleteBtn
->
setAcceptDrops
(
true
);
setAcceptDrops
(
true
);
}
void
UBFeaturesActionBar
::
setCurrentState
(
UBFeaturesActionBarState
state
)
{
currentState
=
state
;
setButtons
();
}
void
UBFeaturesActionBar
::
setButtons
()
{
switch
(
currentState
)
{
case
IN_FOLDER
:
mpFavoriteBtn
->
show
();
mpSocialBtn
->
hide
();
mSearchBar
->
show
();
mpDeleteBtn
->
show
();
mpCloseBtn
->
hide
();
mpRemoveFavoriteBtn
->
hide
();
mpNewFolderBtn
->
show
();
mpNewFolderBtn
->
setEnabled
(
true
);
mpDeleteBtn
->
setEnabled
(
true
);
break
;
case
IN_ROOT
:
mpFavoriteBtn
->
show
();
mpSocialBtn
->
hide
();
mSearchBar
->
show
();
mpDeleteBtn
->
show
();
mpCloseBtn
->
hide
();
mpRemoveFavoriteBtn
->
hide
();
mpNewFolderBtn
->
show
();
mpNewFolderBtn
->
setEnabled
(
false
);
mpDeleteBtn
->
setEnabled
(
false
);
break
;
case
IN_PROPERTIES
:
mpFavoriteBtn
->
show
();
mpSocialBtn
->
hide
();
mSearchBar
->
show
();
//mpSearchBtn->show();
mpDeleteBtn
->
hide
();
mpCloseBtn
->
hide
();
mpRemoveFavoriteBtn
->
hide
();
mpNewFolderBtn
->
hide
();
break
;
case
IN_FAVORITE
:
mpFavoriteBtn
->
hide
();
mpSocialBtn
->
hide
();
mSearchBar
->
show
();
//mpSearchBtn->show();
mpDeleteBtn
->
hide
();
mpCloseBtn
->
hide
();
mpRemoveFavoriteBtn
->
show
();
mpNewFolderBtn
->
hide
();
break
;
default
:
break
;
}
}
void
UBFeaturesActionBar
::
onSearchTextChanged
(
QString
txt
)
{
Q_UNUSED
(
txt
)
emit
searchElement
(
mSearchBar
->
text
());
}
void
UBFeaturesActionBar
::
onActionNewFolder
()
{
emit
newFolderToCreate
();
}
/*
void UBFeaturesActionBar::dragMoveEvent(QDragMoveEvent *event)
{
event->acceptProposedAction();
}
*/
void
UBFeaturesActionBar
::
dragEnterEvent
(
QDragEnterEvent
*
event
)
{
if
(
event
->
mimeData
()
->
hasFormat
(
"text/uri-list"
))
event
->
acceptProposedAction
();
}
void
UBFeaturesActionBar
::
dropEvent
(
QDropEvent
*
event
)
{
QWidget
*
dest
=
childAt
(
event
->
pos
()
);
if
(
dest
==
mpDeleteBtn
)
{
event
->
setDropAction
(
Qt
::
MoveAction
);
event
->
accept
();
emit
deleteElements
(
*
event
->
mimeData
()
);
}
else
if
(
dest
==
mpFavoriteBtn
)
{
event
->
setDropAction
(
Qt
::
CopyAction
);
event
->
accept
();
emit
addToFavorite
(
*
event
->
mimeData
()
);
}
else
if
(
dest
==
mpRemoveFavoriteBtn
)
{
event
->
setDropAction
(
Qt
::
MoveAction
);
event
->
accept
();
emit
removeFromFavorite
(
*
event
->
mimeData
()
);
}
}
UBFeaturesActionBar
::~
UBFeaturesActionBar
()
{
}
src/gui/UBFeaturesActionBar.h
0 → 100644
View file @
eaff36a9
#ifndef UBFEATURESACTIONBAR_H
#define UBFEATURESACTIONBAR_H
#include <QWidget>
#include <QToolButton>
#include <QDropEvent>
#include "UBLibActionBar.h"
#include "board/UBFeaturesController.h"
enum
UBFeaturesActionBarState
{
IN_ROOT
,
IN_FOLDER
,
IN_PROPERTIES
,
IN_FAVORITE
};
class
UBFeaturesActionBar
:
public
QWidget
{
Q_OBJECT
public
:
UBFeaturesActionBar
(
UBFeaturesController
*
controller
,
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBFeaturesActionBar"
);
~
UBFeaturesActionBar
();
void
setCurrentState
(
UBFeaturesActionBarState
state
);
signals
:
void
searchElement
(
const
QString
&
text
);
void
newFolderToCreate
();
void
deleteElements
(
const
QMimeData
&
data
);
void
addToFavorite
(
const
QMimeData
&
data
);
void
removeFromFavorite
(
const
QMimeData
&
data
);
private
slots
:
void
onSearchTextChanged
(
QString
txt
);
void
onActionNewFolder
();
protected
:
//void dragMoveEvent(QDragMoveEvent *event);
void
dragEnterEvent
(
QDragEnterEvent
*
event
);
void
dropEvent
(
QDropEvent
*
event
);
private
:
void
setButtons
();
UBFeaturesController
*
featuresController
;
UBFeaturesActionBarState
currentState
;
eButtonSet
mCrntButtonSet
;
eButtonSet
mPreviousButtonSet
;
QButtonGroup
*
mButtonGroup
;
QLineEdit
*
mSearchBar
;
QHBoxLayout
*
mLayout
;
QAction
*
mpFavoriteAction
;
QAction
*
mpSocialAction
;
QAction
*
mpDeleteAction
;
QAction
*
mpSearchAction
;
QAction
*
mpCloseAction
;
QAction
*
mpRemoveFavorite
;
QAction
*
mpNewFolderAction
;
UBActionButton
*
mpFavoriteBtn
;
UBActionButton
*
mpSocialBtn
;
UBActionButton
*
mpDeleteBtn
;
//UBActionButton* mpSearchBtn;
UBActionButton
*
mpCloseBtn
;
UBActionButton
*
mpRemoveFavoriteBtn
;
UBActionButton
*
mpNewFolderBtn
;
};
#endif
\ No newline at end of file
src/gui/UBFeaturesWidget.cpp
0 → 100644
View file @
eaff36a9
This diff is collapsed.
Click to expand it.
src/gui/UBFeaturesWidget.h
0 → 100644
View file @
eaff36a9
#ifndef UBFEATURESWIDGET_H
#define UBFEATURESWIDGET_H
#include <QWidget>
#include <QListView>
#include <QGraphicsView>
#include <QAbstractListModel>
#include <QPixmap>
#include <QVBoxLayout>
#include <QSlider>
#include <QUrl>
#include <QStyledItemDelegate>
#include <QLocale>
#include <QGraphicsLinearLayout>
#include <QStackedWidget>
#include <QDropEvent>
#include "UBDockPaletteWidget.h"
//#include "UBLibActionBar.h"
#include "board/UBFeaturesController.h"
#include "UBFeaturesActionBar.h"
#define THUMBNAIL_WIDTH 400
#define ID_LISTVIEW 0
#define ID_PROPERTIES 1
class
UBListModel
;
class
UBFeaturesModel
;
class
UBFeaturesItemDelegate
;
class
UBFeaturesPathItemDelegate
;
class
UBFeaturesProxyModel
;
class
UBFeaturesSearchProxyModel
;
class
UBFeaturesPathProxyModel
;
class
UBFeaturesPathViewer
;
class
UBFeatureProperties
;
class
UBFeatureItemButton
;
class
UBFeaturesListView
;
class
UBFeaturesWidget
:
public
UBDockPaletteWidget
{
Q_OBJECT
public
:
UBFeaturesWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBFeaturesWidget"
);
virtual
~
UBFeaturesWidget
();
bool
visibleInMode
(
eUBDockPaletteWidgetMode
mode
)
{
return
mode
==
eUBDockPaletteWidget_BOARD
||
mode
==
eUBDockPaletteWidget_DESKTOP
;
}
UBFeaturesController
*
getFeaturesController
()
const
{
return
controller
;
};
static
const
int
minThumbnailSize
=
20
;
static
const
int
maxThumbnailSize
=
100
;
static
const
int
defaultThumbnailSize
=
40
;
private
:
void
switchToListView
();
void
switchToProperties
();
UBFeaturesController
*
controller
;
UBFeaturesItemDelegate
*
itemDelegate
;
UBFeaturesPathItemDelegate
*
pathItemDelegate
;
UBFeaturesModel
*
featuresModel
;
UBFeaturesProxyModel
*
featuresProxyModel
;
UBFeaturesSearchProxyModel
*
featuresSearchModel
;
UBFeaturesPathProxyModel
*
featuresPathModel
;
UBFeaturesListView
*
featuresListView
;
UBFeaturesListView
*
pathListView
;
QSlider
*
thumbSlider
;
QVBoxLayout
*
layout
;
//UBFeaturesPathViewer *pathViewer;
QGraphicsScene
*
pathScene
;
UBFeaturesActionBar
*
mActionBar
;
UBFeatureProperties
*
featureProperties
;
QStackedWidget
*
stackedWidget
;
int
currentStackedWidget
;
QModelIndex
trashIndex
;
private
slots
:
void
currentSelected
(
const
QModelIndex
&
);
//void currentPathChanged(const QString &);
void
currentPathChanged
(
const
QModelIndex
&
);
void
searchStarted
(
const
QString
&
);
void
createNewFolder
();
void
deleteElements
(
const
QMimeData
&
);
void
addToFavorite
(
const
QMimeData
&
);
void
removeFromFavorite
(
const
QMimeData
&
);
void
thumbnailSizeChanged
(
int
);
protected
:
bool
eventFilter
(
QObject
*
target
,
QEvent
*
event
);
};
class
UBFeaturesListView
:
public
QListView
{
Q_OBJECT
public
:
UBFeaturesListView
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBFeaturesListView"
);
virtual
~
UBFeaturesListView
()
{;}
protected
:
virtual
void
dragEnterEvent
(
QDragEnterEvent
*
event
);
virtual
void
dropEvent
(
QDropEvent
*
event
);
};
class
UBFeatureProperties
:
public
QWidget
{
Q_OBJECT
public
:
UBFeatureProperties
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBFeatureProperties"
);
~
UBFeatureProperties
();
void
showElement
(
const
UBFeature
&
elem
);
protected
:
//void resizeEvent(QResizeEvent *event);
//void showEvent(QShowEvent *event);
private
slots
:
void
onAddToPage
();
//void onAddToLib();
//void onSetAsBackground();
//void onBack();
private
:
QVBoxLayout
*
mpLayout
;
QHBoxLayout
*
mpButtonLayout
;
UBFeatureItemButton
*
mpAddPageButton
;
UBFeatureItemButton
*
mpAddToLibButton
;
UBFeatureItemButton
*
mpSetAsBackgroundButton
;
QLabel
*
mpObjInfoLabel
;
//QTreeWidget* mpObjInfos;
QLabel
*
mpThumbnail
;
QPixmap
*
mpOrigPixmap
;
int
maxThumbHeight
;
UBFeature
*
mpElement
;
//QTreeWidgetItem* mpItem;
};
class
UBFeatureItemButton
:
public
QPushButton
{
public
:
UBFeatureItemButton
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBFeatureItemButton"
);
~
UBFeatureItemButton
();
};
class
UBFeaturesModel
:
public
QAbstractListModel
{
Q_OBJECT
public
:
UBFeaturesModel
(
QObject
*
parent
=
0
)
:
QAbstractListModel
(
parent
)
{;}
virtual
~
UBFeaturesModel
(){;}
void
addItem
(
const
UBFeature
&
item
);
void
deleteFavoriteItem
(
const
QString
&
path
);
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
QMimeData
*
mimeData
(
const
QModelIndexList
&
indexes
)
const
;
QStringList
mimeTypes
()
const
;
int
rowCount
(
const
QModelIndex
&
parent
)
const
;
Qt
::
ItemFlags
flags
(
const
QModelIndex
&
index
)
const
;
bool
dropMimeData
(
const
QMimeData
*
mimeData
,
Qt
::
DropAction
action
,
int
row
,
int
column
,
const
QModelIndex
&
parent
);
bool
removeRows
(
int
row
,
int
count
,
const
QModelIndex
&
parent
=
QModelIndex
());
bool
removeRow
(
int
row
,
const
QModelIndex
&
parent
=
QModelIndex
());
Qt
::
DropActions
supportedDropActions
()
const
{
return
Qt
::
MoveAction
|
Qt
::
CopyAction
;
}
void
setFeaturesList
(
QList
<
UBFeature
>
*
flist
)
{
featuresList
=
flist
;
}
private
:
QList
<
UBFeature
>
*
featuresList
;
};
class
UBFeaturesProxyModel
:
public
QSortFilterProxyModel
{
Q_OBJECT
public
:
UBFeaturesProxyModel
(
QObject
*
parent
=
0
)
:
QSortFilterProxyModel
(
parent
)
{;}
virtual
~
UBFeaturesProxyModel
()
{}
protected
:
virtual
bool
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
;
};
class
UBFeaturesSearchProxyModel
:
public
QSortFilterProxyModel
{
Q_OBJECT
public
:
UBFeaturesSearchProxyModel
(
QObject
*
parent
=
0
)
:
QSortFilterProxyModel
(
parent
)
{;}
virtual
~
UBFeaturesSearchProxyModel
()
{}
protected
:
virtual
bool
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
;
};
class
UBFeaturesPathProxyModel
:
public
QSortFilterProxyModel
{
Q_OBJECT
public
:
UBFeaturesPathProxyModel
(
QObject
*
parent
=
0
)
:
QSortFilterProxyModel
(
parent
)
{;}
virtual
~
UBFeaturesPathProxyModel
()
{}
void
setPath
(
const
QString
&
p
)
{
path
=
p
;
}
protected
:
virtual
bool
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
;
private
:
QString
path
;
};
class
UBFeaturesItemDelegate
:
public
QStyledItemDelegate
{
Q_OBJECT
public
:
UBFeaturesItemDelegate
(
QWidget
*
parent
=
0
,
const
QListView
*
lw
=
0
)
:
QStyledItemDelegate
(
parent
)
{
listView
=
lw
;
}
~
UBFeaturesItemDelegate
()
{}
//UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; };
//void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
//QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual
QString
displayText
(
const
QVariant
&
value
,
const
QLocale
&
locale
)
const
;
private
:
const
QListView
*
listView
;
};
class
UBFeaturesPathItemDelegate
:
public
QStyledItemDelegate
{
Q_OBJECT
public
:
UBFeaturesPathItemDelegate
(
QWidget
*
parent
=
0
);
~
UBFeaturesPathItemDelegate
();
virtual
QString
displayText
(
const
QVariant
&
value
,
const
QLocale
&
locale
)
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
;
private
:
QPixmap
*
arrowPixmap
;
};
#endif // UBFEATURESWIDGET_H
src/gui/UBLibraryWidget.h
View file @
eaff36a9
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <QVBoxLayout>
#include <QVBoxLayout>
#include "UBThumbnailWidget.h"
#include "UBThumbnailWidget.h"
#include "board/UBLibraryController.h"
class
UBLibraryController
;
class
UBLibraryController
;
class
UBChainedLibElement
;
class
UBChainedLibElement
;
...
...
src/gui/gui.pri
View file @
eaff36a9
...
@@ -46,6 +46,8 @@ HEADERS += src/gui/UBThumbnailView.h \
...
@@ -46,6 +46,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBLibWebView.h \
src/gui/UBLibWebView.h \
src/gui/UBDownloadWidget.h \
src/gui/UBDownloadWidget.h \
src/gui/UBDockDownloadWidget.h \
src/gui/UBDockDownloadWidget.h \
src/gui/UBFeaturesWidget.h \
src/gui/UBFeaturesActionBar.h \
src/gui/UBDockTeacherGuideWidget.h \
src/gui/UBDockTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidgetsTools.h \
src/gui/UBTeacherGuideWidgetsTools.h \
...
@@ -99,6 +101,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
...
@@ -99,6 +101,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBLibWebView.cpp \
src/gui/UBLibWebView.cpp \
src/gui/UBDownloadWidget.cpp \
src/gui/UBDownloadWidget.cpp \
src/gui/UBDockDownloadWidget.cpp \
src/gui/UBDockDownloadWidget.cpp \
src/gui/UBFeaturesWidget.cpp \
src/gui/UBFeaturesActionBar.cpp \
src/gui/UBDockTeacherGuideWidget.cpp \
src/gui/UBDockTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidgetsTools.cpp \
src/gui/UBTeacherGuideWidgetsTools.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