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
44616b34
Commit
44616b34
authored
May 11, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
70efd6d9
a77937cd
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
757 additions
and
229 deletions
+757
-229
Sankore 3.1.iss
Sankore 3.1.iss
+5
-1
release.linux.sh
release.linux.sh
+24
-19
release.win7.vc9.64.bat
release.win7.vc9.64.bat
+1
-1
release.win7.vc9.bat
release.win7.vc9.bat
+1
-1
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+14
-1
UBBoardController.cpp
src/board/UBBoardController.cpp
+6
-4
UBBoardView.cpp
src/board/UBBoardView.cpp
+7
-5
UBBoardView.h
src/board/UBBoardView.h
+1
-0
UBDrawingController.cpp
src/board/UBDrawingController.cpp
+8
-2
UBDrawingController.h
src/board/UBDrawingController.h
+2
-0
UB.h
src/core/UB.h
+2
-1
UBGraphicsDelegateFrame.cpp
src/domain/UBGraphicsDelegateFrame.cpp
+1
-1
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+34
-22
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+2
-5
UBGraphicsPolygonItem.cpp
src/domain/UBGraphicsPolygonItem.cpp
+14
-9
UBGraphicsPolygonItem.h
src/domain/UBGraphicsPolygonItem.h
+5
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+238
-95
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+2
-2
UBGraphicsStrokesGroup.h
src/domain/UBGraphicsStrokesGroup.h
+5
-0
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+5
-0
UBGraphicsWidgetItem.h
src/domain/UBGraphicsWidgetItem.h
+2
-0
ubgraphicsgroupcontaineritem.cpp
src/domain/ubgraphicsgroupcontaineritem.cpp
+151
-7
ubgraphicsgroupcontaineritem.h
src/domain/ubgraphicsgroupcontaineritem.h
+16
-2
ubgraphicsgroupcontaineritemdelegate.cpp
src/domain/ubgraphicsgroupcontaineritemdelegate.cpp
+14
-10
ubgraphicsgroupcontaineritemdelegate.h
src/domain/ubgraphicsgroupcontaineritemdelegate.h
+3
-3
UBGeometryUtils.cpp
src/frameworks/UBGeometryUtils.cpp
+2
-1
UBFeaturesActionBar.cpp
src/gui/UBFeaturesActionBar.cpp
+17
-2
UBFeaturesActionBar.h
src/gui/UBFeaturesActionBar.h
+4
-0
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+157
-27
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+8
-5
UBGraphicsCompass.cpp
src/tools/UBGraphicsCompass.cpp
+1
-0
UBGraphicsProtractor.cpp
src/tools/UBGraphicsProtractor.cpp
+1
-0
UBGraphicsProtractor.h
src/tools/UBGraphicsProtractor.h
+1
-1
UBGraphicsRuler.cpp
src/tools/UBGraphicsRuler.cpp
+2
-1
UBGraphicsTriangle.cpp
src/tools/UBGraphicsTriangle.cpp
+1
-0
No files found.
Sankore 3.1.iss
View file @
44616b34
...
...
@@ -45,7 +45,10 @@ Type: files ; Name: "{app}\*.dll"
[Files]
Source: "..\Sankore-ThirdParty\microsoft\vcredist_x86.exe"; DestDir:"{tmp}"
Source: ".\build\win32\release\product\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "build\win32\release\product\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
;Sankore plugins
Source: "plugins\cffadaptor\build\win32\release\lib\CFF_Adaptor.dll"; DestDir: "{app}"; Flags: ignoreversion
;OpenSSL
Source: "..\Sankore-ThirdParty\openssl\win32\libeay32.dll"; DestDir:"{app}"; Flags: ignoreversion
...
...
@@ -60,6 +63,7 @@ Source: "..\Qt-sankore3.1\lib\QtWebKit4.dll"; DestDir: "{app}"; Flags: ignorever
Source: "..\Qt-sankore3.1\lib\phonon4.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Qt-sankore3.1\lib\QtNetwork4.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Qt-sankore3.1\lib\QtSvg4.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\Qt-sankore3.1\lib\QtOpenGL4.dll"; DestDir: "{app}"; Flags: ignoreversion
;Qt plugins
Source: "..\Qt-sankore3.1\plugins\accessible\qtaccessiblecompatwidgets4.dll"; DestDir: "{app}\accessible"; Flags: ignoreversion
...
...
release.linux.sh
View file @
44616b34
...
...
@@ -39,14 +39,18 @@ checkDirectory(){
# path definition #
#######################################################################
QT_PATH
=
"/usr/local/Trolltech/Qt-4.7.3"
PLUGINS_PATH
=
"
$QT_PATH
/plugins"
QT_
PLUGINS_PATH
=
"
$QT_PATH
/plugins"
RELEASE_DIR
=
build/linux/release
BUILD_DIR
=
$RELEASE_DIR
/product
GUI_TRANSLATIONS_DIRECTORY_PATH
=
"../Qt-sankore3.1/translations"
QT_LIBRARY_SOURCE_PATH
=
"
$QT_PATH
/lib"
SANKORE_SRC_PLUGINS_PATH
=
"plugins"
SANKORE_DST_PLUGINS_PATH
=
build/linux/release/product/plugins
CFF_ADAPTOR_SRC_PLUGIN_PATH
=
$SANKORE_SRC_PLUGINS_PATH
/cffadaptor/build/linux/release/lib
QMAKE_PATH
=
"
$QT_PATH
/bin/qmake"
LRELEASE
=
"/usr/local/Trolltech/Qt-4.7.3/bin/lrelease"
LRELEASE
=
"../Qt-sankore3.1/bin/lrelease"
#LRELEASE="/usr/local/Trolltech/Qt-4.7.3/bin/lrelease"
ARCHITECTURE
=
`
uname
-m
`
...
...
@@ -57,13 +61,15 @@ checkExecutable $QMAKE_PATH
checkExecutable
$LRELEASE
checkDirectory
$GUI_TRANSLATIONS_DIRECTORY_PATH
checkDirectory
$PLUGINS_PATH
checkDirectory
$
QT_
PLUGINS_PATH
checkDirectory
$QT_LIBRARY_SOURCE_PATH
checkDirectory
$CFF_ADAPTOR_PLUGIN_PATH
#######################################################################
# cleaning #
#######################################################################
rm
-rf
$RELEASE_DIR
#
rm -rf $RELEASE_DIR
#######################################################################
...
...
@@ -126,21 +132,26 @@ cp -R resources/linux/qtlinux/* $BUILD_DIR
cp
-R
resources/customizations
$BUILD_DIR
notify-send
"Sankore"
"Copying plugins..."
mkdir
"
$SANKORE_DST_PLUGINS_PATH
"
mkdir
"
$SANKORE_DST_PLUGINS_PATH
/cffadaptor"
cp
-R
$CFF_ADAPTOR_SRC_PLUGIN_PATH
/
*
.so
*
"
$SANKORE_DST_PLUGINS_PATH
/cffadaptor"
notify-send
"QT"
"Coping plugins and library ..."
cp
-R
$PLUGINS_PATH
$BUILD_DIR
cp
-R
$
QT_
PLUGINS_PATH
$BUILD_DIR
#copying custom qt library
QT_LIBRARY_DEST_PATH
=
"
$BUILD_DIR
/qtlib"
mkdir
$QT_LIBRARY_DEST_PATH
copyQtLibrary
(){
if
[
!
-e
"
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4
.7.3
"
]
;
then
if
[
!
-e
"
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4"
]
;
then
notifyError
"
$1
library not found in path:
$QT_LIBRARY_SOURCE_PATH
"
fi
cp
"
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4"
"
$QT_LIBRARY_DEST_PATH
/"
cp
"
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4.7.3"
"
$QT_LIBRARY_DEST_PATH
/"
cp
$QT_LIBRARY_SOURCE_PATH
/
$1
.so.4.
*
$QT_LIBRARY_DEST_PATH
/
}
copyQtLibrary libphonon
copyQtLibrary libQtWebKit
copyQtLibrary libQtDBus
copyQtLibrary libQtScript
...
...
@@ -150,14 +161,8 @@ copyQtLibrary libQtNetwork
copyQtLibrary libQtXml
copyQtLibrary libQtGui
copyQtLibrary libQtCore
if
[
!
-e
"
$QT_LIBRARY_SOURCE_PATH
/libphonon.so.4.4.0"
]
;
then
notifyError
"phonon library not found in path:
$QT_LIBRARY_SOURCE_PATH
"
else
cp
"
$QT_LIBRARY_SOURCE_PATH
/libphonon.so.4"
"
$QT_LIBRARY_DEST_PATH
/"
cp
"
$QT_LIBRARY_SOURCE_PATH
/libphonon.so.4.4.0"
"
$QT_LIBRARY_DEST_PATH
/"
fi
# uncomment for Qt 4.8
#copyQtLibrary libQtOpenGL
#######################################################################
# Removing unwanted files #
...
...
@@ -279,7 +284,7 @@ echo "Priority: optional" >> "$CONTROL_FILE"
echo
"Architecture:
$ARCHITECTURE
"
>>
"
$CONTROL_FILE
"
echo
"Essential: no"
>>
"
$CONTROL_FILE
"
echo
"Installed-Size:
`
du
-s
$SANKORE_PACKAGE_DIRECTORY
|
awk
'{ print $1 }'
`
"
>>
"
$CONTROL_FILE
"
echo
"Maintainer: Open-Sankor
é
Developers team <dev@open-sankore.org>"
>>
"
$CONTROL_FILE
"
echo
"Maintainer: Open-Sankor
e
Developers team <dev@open-sankore.org>"
>>
"
$CONTROL_FILE
"
echo
"Homepage: http://dev.open-sankore.org"
>>
"
$CONTROL_FILE
"
echo
-n
"Depends: "
>>
"
$CONTROL_FILE
"
unset
tab
...
...
@@ -318,7 +323,7 @@ echo "Version=$VERSION" >> $SANKORE_SHORTCUT
echo
"Encoding=UTF-8"
>>
$SANKORE_SHORTCUT
echo
"Name=Open-Sankore (
$VERSION
)"
>>
$SANKORE_SHORTCUT
echo
"GenericName=Open-Sankore"
>>
$SANKORE_SHORTCUT
echo
"Comment=Logiciel de cr
éation de présentations pour tableau numé
rique interactif (TNI)"
>>
$SANKORE_SHORTCUT
echo
"Comment=Logiciel de cr
eation de presentations pour tableau nume
rique interactif (TNI)"
>>
$SANKORE_SHORTCUT
echo
"Exec=/usr/local/
$SANKORE_DIRECTORY_NAME
/run.sh"
>>
$SANKORE_SHORTCUT
echo
"Icon=/usr/local/
$SANKORE_DIRECTORY_NAME
/sankore.png"
>>
$SANKORE_SHORTCUT
echo
"StartupNotify=true"
>>
$SANKORE_SHORTCUT
...
...
@@ -353,4 +358,4 @@ cd $RELEASE_DIR
rm
../../../install/linux/Open-Sankore.tar.gz
tar
cvzf ../../../install/linux/Open-Sankore.tar.gz Open-Sankore.
$VERSION
-C
.
notify-send
"Open-Sankore"
"tar.gz Build done"
notify-send
"Open-Sankore"
"tar.gz Build done"
\ No newline at end of file
release.win7.vc9.64.bat
View file @
44616b34
...
...
@@ -62,7 +62,7 @@ nmake release-install
copy %BASE_QT_TRANSLATIONS_DIRECTORY%\qt_*.qm build\win32\release\product\i18n\
del build\win32\release\product\i18n\qt_help*
del "
.\
build\win32\release\product\Sankore.pdb"
del "build\win32\release\product\Sankore.pdb"
set INSTALLER_NAME=Open-Sankore
...
...
release.win7.vc9.bat
View file @
44616b34
...
...
@@ -66,7 +66,7 @@ copy resources\customizations build\win32\release\product\
del build\win32\release\product\i18n\qt_help*
del "
.\
build\win32\release\product\Sankore.pdb"
del "build\win32\release\product\Sankore.pdb"
set INSTALLER_NAME=Open-Sankore
...
...
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
44616b34
...
...
@@ -30,6 +30,7 @@
#include "domain/UBAbstractWidget.h"
#include "domain/UBGraphicsStroke.h"
#include "domain/UBGraphicsStrokesGroup.h"
#include "domain/ubgraphicsgroupcontaineritem.h"
#include "domain/UBItem.h"
#include "tools/UBGraphicsRuler.h"
...
...
@@ -1004,8 +1005,13 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::writeSvgElement()
bool
UBSvgSubsetAdaptor
::
UBSvgSubsetWriter
::
persistScene
(
int
pageIndex
)
{
if
(
mScene
->
isModified
())
{
static
int
i
=
0
;
qDebug
()
<<
"persist call no is "
<<
++
i
;
QBuffer
buffer
;
buffer
.
open
(
QBuffer
::
WriteOnly
);
mXmlWriter
.
setDevice
(
&
buffer
);
...
...
@@ -1218,6 +1224,14 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
triangleToSvg
(
triangle
);
continue
;
}
UBGraphicsGroupContainerItem
*
groupItem
=
qgraphicsitem_cast
<
UBGraphicsGroupContainerItem
*>
(
item
);
if
(
groupItem
&&
groupItem
->
isVisible
())
{
qDebug
()
<<
"came across the group during the parsing"
;
continue
;
}
}
if
(
openStroke
)
...
...
@@ -1269,7 +1283,6 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
return
true
;
}
void
UBSvgSubsetAdaptor
::
UBSvgSubsetWriter
::
polygonItemToSvgLine
(
UBGraphicsPolygonItem
*
polygonItem
,
bool
groupHoldsInfo
)
{
mXmlWriter
.
writeStartElement
(
"line"
);
...
...
src/board/UBBoardController.cpp
View file @
44616b34
...
...
@@ -1259,10 +1259,12 @@ void UBBoardController::ClearUndoStack()
while
(
itUniq
.
hasNext
())
{
QGraphicsItem
*
item
=
itUniq
.
next
();
UBGraphicsScene
*
scene
=
dynamic_cast
<
UBGraphicsScene
*>
(
item
->
scene
());
if
(
!
scene
)
{
mActiveScene
->
deleteItem
(
item
);
if
(
item
->
scene
())
{
UBGraphicsScene
*
scene
=
dynamic_cast
<
UBGraphicsScene
*>
(
item
->
scene
());
if
(
!
scene
)
{
mActiveScene
->
deleteItem
(
item
);
}
}
}
...
...
src/board/UBBoardView.cpp
View file @
44616b34
...
...
@@ -50,6 +50,8 @@
#include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsAudioItem.h"
#include "domain/UBGraphicsSvgItem.h"
#include "domain/ubgraphicsgroupcontaineritem.h"
#include "domain/UBGraphicsStrokesGroup.h"
#include "document/UBDocumentProxy.h"
...
...
@@ -435,8 +437,8 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
||
movingItem
->
type
()
==
UBGraphicsCache
::
Type
||
movingItem
->
type
()
==
UBGraphicsTriangle
::
Type
||
movingItem
==
this
->
scene
()
->
backgroundObject
()
||
movingItem
->
group
(
))
{
||
(
movingItem
->
parentItem
()
&&
movingItem
->
parentItem
()
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
))
{
movingItem
=
NULL
;
QGraphicsView
::
mousePressEvent
(
event
);
...
...
@@ -515,8 +517,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
}
}
QSet
<
QGraphicsItem
*>
mJustSelectedItems
;
void
UBBoardView
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
...
...
@@ -562,7 +562,9 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
||
item
->
type
()
==
UBGraphicsPixmapItem
::
Type
||
item
->
type
()
==
UBGraphicsVideoItem
::
Type
||
item
->
type
()
==
UBGraphicsAudioItem
::
Type
||
item
->
type
()
==
UBGraphicsSvgItem
::
Type
)
{
||
item
->
type
()
==
UBGraphicsSvgItem
::
Type
||
item
->
type
()
==
UBGraphicsTextItem
::
Type
||
item
->
type
()
==
UBGraphicsStrokesGroup
::
Type
)
{
if
(
!
mJustSelectedItems
.
contains
(
item
))
{
item
->
setSelected
(
true
);
...
...
src/board/UBBoardView.h
View file @
44616b34
...
...
@@ -125,6 +125,7 @@ class UBBoardView : public QGraphicsView
QMouseEvent
*
suspendedMousePressEvent
;
UBRubberBand
*
mUBRubberBand
;
QSet
<
QGraphicsItem
*>
mJustSelectedItems
;
private
slots
:
...
...
src/board/UBDrawingController.cpp
View file @
44616b34
...
...
@@ -45,7 +45,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
,
mActiveRuler
(
NULL
)
,
mStylusTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mLatestDrawingTool
((
UBStylusTool
::
Enum
)
-
1
)
//, mDrawingMode(
eDrawingMode_Vector)
,
mDrawingMode
(
/*DRAWING_MODE*/
eDrawingMode_Vector
)
{
connect
(
UBSettings
::
settings
(),
SIGNAL
(
colorContextChanged
()),
this
,
SIGNAL
(
colorPaletteChanged
()));
...
...
@@ -106,10 +106,16 @@ void UBDrawingController::setStylusTool(int tool)
mStylusTool
=
(
UBStylusTool
::
Enum
)
tool
;
if
(
eDrawingMode_Vector
==
DRAWING_MODE
){
mDrawingMode
=
eDrawingMode_Vector
;
}
if
(
mStylusTool
==
UBStylusTool
::
Pen
)
UBApplication
::
mainWindow
->
actionPen
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Eraser
)
else
if
(
mStylusTool
==
UBStylusTool
::
Eraser
)
{
UBApplication
::
mainWindow
->
actionEraser
->
setChecked
(
true
);
//mDrawingMode = eDrawingMode_Artistic;
}
else
if
(
mStylusTool
==
UBStylusTool
::
Marker
)
UBApplication
::
mainWindow
->
actionMarker
->
setChecked
(
true
);
else
if
(
mStylusTool
==
UBStylusTool
::
Selector
)
...
...
src/board/UBDrawingController.h
View file @
44616b34
...
...
@@ -27,6 +27,8 @@ typedef enum{
eDrawingMode_Vector
}
eDrawingMode
;
#define DRAWING_MODE eDrawingMode_Vector
class
UBDrawingController
:
public
QObject
{
Q_OBJECT
;
...
...
src/core/UB.h
View file @
44616b34
...
...
@@ -123,7 +123,8 @@ struct UBGraphicsItemType
StrokeItemType
,
TriangleItemType
,
MagnifierItemType
,
cacheItemType
cacheItemType
,
groupContainerType
};
};
...
...
src/domain/UBGraphicsDelegateFrame.cpp
View file @
44616b34
...
...
@@ -583,7 +583,7 @@ void UBGraphicsDelegateFrame::positionHandles()
{
QRectF
itemRect
=
delegated
()
->
boundingRect
();
if
(
mDelegate
->
getToolBarItem
()
->
isVisibleOnBoard
()
if
(
mDelegate
->
getToolBarItem
()
->
isVisibleOnBoard
()
&&
mDelegate
->
getToolBarItem
()
->
isShifting
())
itemRect
.
setHeight
(
itemRect
.
height
()
+
mDelegate
->
getToolBarItem
()
->
rect
().
height
()
*
mDelegate
->
antiScaleRatio
()
*
1.1
);
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
44616b34
...
...
@@ -40,6 +40,7 @@
#include "domain/UBGraphicsTextItem.h"
#include "domain/UBGraphicsAudioItem.h"
#include "domain/UBGraphicsVideoItem.h"
#include "domain/ubgraphicsgroupcontaineritem.h"
#include "web/UBWebController.h"
...
...
@@ -167,7 +168,9 @@ UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
QVariant
UBGraphicsItemDelegate
::
itemChange
(
QGraphicsItem
::
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
if
(
change
==
QGraphicsItem
::
ItemSelectedHasChanged
)
{
if
(
change
==
QGraphicsItem
::
ItemChildAddedChange
){
}
else
if
(
change
==
QGraphicsItem
::
ItemSelectedHasChanged
)
{
bool
ok
;
bool
selected
=
value
.
toUInt
(
&
ok
);
if
(
ok
)
{
...
...
@@ -217,10 +220,9 @@ bool UBGraphicsItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event)
startUndoStep
();
if
(
!
mDelegated
->
isSelected
())
if
(
!
delegated
()
->
isSelected
())
{
mDelegated
->
setSelected
(
true
);
positionHandles
();
delegated
()
->
setSelected
(
true
);
return
true
;
}
else
...
...
@@ -236,33 +238,31 @@ void UBGraphicsItemDelegate::setMimeData(QMimeData *mimeData)
bool
UBGraphicsItemDelegate
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
((
NULL
!=
mMimeData
)
&&
((
event
->
pos
()
-
mDragStartPosition
).
manhattanLength
()
<
QApplication
::
startDragDistance
()))
{
QDrag
*
mDrag
=
new
QDrag
(
event
->
widget
());
mDrag
->
setMimeData
(
mMimeData
);
if
(
!
mDragPixmap
.
isNull
())
{
mDrag
->
setPixmap
(
mDragPixmap
);
mDrag
->
setHotSpot
(
mDragPixmap
.
rect
().
center
());
}
mDrag
->
exec
();
mDragPixmap
=
QPixmap
();
return
true
;
if
(
mMimeData
)
{
QDrag
*
mDrag
=
new
QDrag
(
event
->
widget
());
mDrag
->
setMimeData
(
mMimeData
);
if
(
!
mDragPixmap
.
isNull
())
{
mDrag
->
setPixmap
(
mDragPixmap
);
mDrag
->
setHotSpot
(
mDragPixmap
.
rect
().
center
());
}
mDrag
->
exec
();
mDragPixmap
=
QPixmap
();
if
(
isLocked
())
{
event
->
accept
();
return
true
;
}
return
true
;
if
(
isLocked
())
{
event
->
accept
();
return
true
;
}
else
{
return
false
;
}
}
bool
UBGraphicsItemDelegate
::
weelEvent
(
QGraphicsSceneWheelEvent
*
event
)
{
Q_UNUSED
(
event
);
if
(
mDelegated
->
isSelected
()
)
if
(
delegated
()
->
isSelected
()
)
{
// event->accept();
return
true
;
...
...
@@ -310,6 +310,18 @@ void UBGraphicsItemDelegate::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
// }
}
QGraphicsItem
*
UBGraphicsItemDelegate
::
delegated
()
{
QGraphicsItem
*
curDelegate
=
0
;
if
(
mDelegated
->
parentItem
()
&&
mDelegated
->
parentItem
()
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
)
{
curDelegate
=
mDelegated
->
parentItem
();
// considering delegated item as an item's group which contains everything
}
else
{
curDelegate
=
mDelegated
;
}
return
curDelegate
;
}
void
UBGraphicsItemDelegate
::
positionHandles
()
{
if
(
mDelegated
->
isSelected
())
{
...
...
@@ -363,7 +375,7 @@ void UBGraphicsItemDelegate::setZOrderButtonsVisible(bool visible)
void
UBGraphicsItemDelegate
::
remove
(
bool
canUndo
)
{
// QGraphicsScene* scene = mDelegated->scene();
UBGraphicsScene
*
scene
=
(
UBGraphicsScene
*
)
(
mDelegated
->
scene
());
UBGraphicsScene
*
scene
=
dynamic_cast
<
UBGraphicsScene
*>
(
mDelegated
->
scene
());
if
(
scene
)
{
foreach
(
DelegateButton
*
button
,
mButtons
)
...
...
src/domain/UBGraphicsItemDelegate.h
View file @
44616b34
...
...
@@ -4,7 +4,7 @@
* 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,
* This progra
scene
m 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.
...
...
@@ -121,10 +121,7 @@ class UBGraphicsItemDelegate : public QObject
void
printMessage
(
const
QString
&
mess
)
{
qDebug
()
<<
mess
;}
QGraphicsItem
*
delegated
()
{
return
mDelegated
;
}
QGraphicsItem
*
delegated
();
void
setCanDuplicate
(
bool
allow
){
mCanDuplicate
=
allow
;
}
...
...
src/domain/UBGraphicsPolygonItem.cpp
View file @
44616b34
...
...
@@ -39,6 +39,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QPolygonF & polygon, QGraphi
,
mOriginalWidth
(
-
1
)
,
mIsNominalLine
(
false
)
,
mStroke
(
0
)
,
mpGroup
(
NULL
)
{
// NOOP
initialize
();
...
...
@@ -77,6 +78,10 @@ UBGraphicsPolygonItem::~UBGraphicsPolygonItem()
clearStroke
();
}
void
UBGraphicsPolygonItem
::
setStrokesGroup
(
UBGraphicsStrokesGroup
*
group
)
{
mpGroup
=
group
;
}
void
UBGraphicsPolygonItem
::
setStroke
(
UBGraphicsStroke
*
stroke
)
{
...
...
@@ -156,7 +161,7 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con
copy
->
mIsNominalLine
=
false
;
copy
->
setStroke
(
this
->
stroke
());
copy
->
set
Group
(
this
->
g
roup
());
copy
->
set
StrokesGroup
(
this
->
strokesG
roup
());
copy
->
setBrush
(
this
->
brush
());
copy
->
setPen
(
this
->
pen
());
copy
->
mHasAlpha
=
this
->
mHasAlpha
;
...
...
@@ -184,18 +189,18 @@ void UBGraphicsPolygonItem::paint ( QPainter * painter, const QStyleOptionGraphi
QGraphicsPolygonItem
::
paint
(
painter
,
option
,
widget
);
}
QPainterPath
UBGraphicsPolygonItem
::
shape
()
const
{
//
QPainterPath UBGraphicsPolygonItem::shape() const
//
{
QPainterPath
path
;
path
.
addRect
(
boundingRect
());
//
QPainterPath path;
//
path.addRect(boundingRect());
return
path
;
//
return path;
// static QPainterPath shapePath = QGraphicsPolygonItem::shape();
//
//
static QPainterPath shapePath = QGraphicsPolygonItem::shape();
// return shapePath;
}
//
//
return shapePath;
//
}
UBGraphicsScene
*
UBGraphicsPolygonItem
::
scene
()
...
...
src/domain/UBGraphicsPolygonItem.h
View file @
44616b34
...
...
@@ -19,6 +19,7 @@
#include "core/UB.h"
#include "UBItem.h"
#include "UBGraphicsStrokesGroup.h"
class
UBItem
;
class
UBGraphicsScene
;
...
...
@@ -37,6 +38,8 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
void
initialize
();
void
setStrokesGroup
(
UBGraphicsStrokesGroup
*
group
);
UBGraphicsStrokesGroup
*
strokesGroup
()
const
{
return
mpGroup
;}
void
setColor
(
const
QColor
&
color
);
QColor
color
()
const
;
...
...
@@ -115,7 +118,7 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
protected
:
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
QPainterPath
shape
()
const
;
//
QPainterPath shape () const;
private
:
...
...
@@ -132,6 +135,7 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
QColor
mColorOnLightBackground
;
UBGraphicsStroke
*
mStroke
;
UBGraphicsStrokesGroup
*
mpGroup
;
};
...
...
src/domain/UBGraphicsScene.cpp
View file @
44616b34
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsScene.h
View file @
44616b34
...
...
@@ -306,8 +306,8 @@ public slots:
void
setToolCursor
(
int
tool
);
void
selectionChangedProcessing
();
void
enableGroupingButton
();
void
processGroupItems
();
void
updateGroupButtonState
();
void
groupButtonClicked
();
void
moveMagnifier
(
QPoint
newPos
);
void
closeMagnifier
();
...
...
src/domain/UBGraphicsStrokesGroup.h
View file @
44616b34
...
...
@@ -16,6 +16,11 @@ public:
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
remove
();
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
{
return
mDelegate
;}
enum
{
Type
=
UBGraphicsItemType
::
StrokeItemType
};
virtual
int
type
()
const
{
return
Type
;
}
protected
:
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
...
...
src/domain/UBGraphicsWidgetItem.cpp
View file @
44616b34
...
...
@@ -91,6 +91,11 @@ void UBGraphicsWidgetItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
mDelegate
->
hoverLeaveEvent
(
event
);
UBGraphicsProxyWidget
::
hoverLeaveEvent
(
event
);
}
void
UBGraphicsWidgetItem
::
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
UBGraphicsProxyWidget
::
hoverMoveEvent
(
event
);
}
bool
UBGraphicsWidgetItem
::
eventFilter
(
QObject
*
obj
,
QEvent
*
event
)
{
...
...
src/domain/UBGraphicsWidgetItem.h
View file @
44616b34
...
...
@@ -87,6 +87,8 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
bool
eventFilter
(
QObject
*
obj
,
QEvent
*
event
);
...
...
src/domain/ubgraphicsgroupcontaineritem.cpp
View file @
44616b34
...
...
@@ -9,7 +9,7 @@
#include "core/memcheck.h"
UBGraphicsGroupContainerItem
::
UBGraphicsGroupContainerItem
(
QGraphicsItem
*
parent
)
:
QGraphicsItem
Group
(
parent
)
:
QGraphicsItem
(
parent
)
{
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
...
...
@@ -23,12 +23,137 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent
UBGraphicsGroupContainerItem
::
setAcceptHoverEvents
(
true
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
}
void
UBGraphicsGroupContainerItem
::
addToGroup
(
QGraphicsItem
*
item
)
{
if
(
!
item
)
{
qWarning
(
"UBGraphicsGroupContainerItem::addToGroup: cannot add null item"
);
return
;
}
if
(
item
==
this
)
{
qWarning
(
"UBGraphicsGroupContainerItem::addToGroup: cannot add a group to itself"
);
return
;
}
// COMBINE
bool
ok
;
QTransform
itemTransform
=
item
->
itemTransform
(
this
,
&
ok
);
if
(
!
ok
)
{
qWarning
(
"UBGraphicsGroupContainerItem::addToGroup: could not find a valid transformation from item to group coordinates"
);
return
;
}
//setting item flags to given item
item
->
setSelected
(
false
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
false
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsFocusable
,
true
);
QTransform
newItemTransform
(
itemTransform
);
item
->
setPos
(
mapFromItem
(
item
,
0
,
0
));
item
->
setParentItem
(
this
);
// removing position from translation component of the new transform
if
(
!
item
->
pos
().
isNull
())
newItemTransform
*=
QTransform
::
fromTranslate
(
-
item
->
x
(),
-
item
->
y
());
// removing additional transformations properties applied with itemTransform()
QPointF
origin
=
item
->
transformOriginPoint
();
QMatrix4x4
m
;
QList
<
QGraphicsTransform
*>
transformList
=
item
->
transformations
();
for
(
int
i
=
0
;
i
<
transformList
.
size
();
++
i
)
transformList
.
at
(
i
)
->
applyTo
(
&
m
);
newItemTransform
*=
m
.
toTransform
().
inverted
();
newItemTransform
.
translate
(
origin
.
x
(),
origin
.
y
());
newItemTransform
.
rotate
(
-
item
->
rotation
());
newItemTransform
.
scale
(
1
/
item
->
scale
(),
1
/
item
->
scale
());
newItemTransform
.
translate
(
-
origin
.
x
(),
-
origin
.
y
());
// ### Expensive, we could maybe use dirtySceneTransform bit for optimization
item
->
setTransform
(
newItemTransform
);
// item->d_func()->setIsMemberOfGroup(true);
prepareGeometryChange
();
itemsBoundingRect
|=
itemTransform
.
mapRect
(
item
->
boundingRect
()
|
item
->
childrenBoundingRect
());
update
();
}
void
UBGraphicsGroupContainerItem
::
removeFromGroup
(
QGraphicsItem
*
item
)
{
if
(
!
item
)
{
qWarning
(
"QGraphicsItemGroup::removeFromGroup: cannot remove null item"
);
return
;
}
QGraphicsItem
*
newParent
=
parentItem
();
// COMBINE
bool
ok
;
QTransform
itemTransform
;
if
(
newParent
)
itemTransform
=
item
->
itemTransform
(
newParent
,
&
ok
);
else
itemTransform
=
item
->
sceneTransform
();
QPointF
oldPos
=
item
->
mapToItem
(
newParent
,
0
,
0
);
item
->
setParentItem
(
newParent
);
item
->
setPos
(
oldPos
);
// removing position from translation component of the new transform
if
(
!
item
->
pos
().
isNull
())
itemTransform
*=
QTransform
::
fromTranslate
(
-
item
->
x
(),
-
item
->
y
());
// removing additional transformations properties applied
// with itemTransform() or sceneTransform()
QPointF
origin
=
item
->
transformOriginPoint
();
QMatrix4x4
m
;
QList
<
QGraphicsTransform
*>
transformList
=
item
->
transformations
();
for
(
int
i
=
0
;
i
<
transformList
.
size
();
++
i
)
transformList
.
at
(
i
)
->
applyTo
(
&
m
);
itemTransform
*=
m
.
toTransform
().
inverted
();
itemTransform
.
translate
(
origin
.
x
(),
origin
.
y
());
itemTransform
.
rotate
(
-
item
->
rotation
());
itemTransform
.
scale
(
1
/
item
->
scale
(),
1
/
item
->
scale
());
itemTransform
.
translate
(
-
origin
.
x
(),
-
origin
.
y
());
// ### Expensive, we could maybe use dirtySceneTransform bit for optimization
item
->
setTransform
(
itemTransform
);
// item->d_func()->setIsMemberOfGroup(item->group() != 0);
// ### Quite expensive. But removeFromGroup() isn't called very often.
prepareGeometryChange
();
itemsBoundingRect
=
childrenBoundingRect
();
}
QRectF
UBGraphicsGroupContainerItem
::
boundingRect
()
const
{
return
itemsBoundingRect
;
}
void
UBGraphicsGroupContainerItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
Q_UNUSED
(
widget
);
Q_UNUSED
(
painter
);
Q_UNUSED
(
option
);
// we would not use paint smth for the moment
// if (option->state & QStyle::State_Selected) {
// painter->setBrush(Qt::NoBrush);
// QPen tmpPen;
// qreal tmpPenWidth = 1.0;
// tmpPen.setWidth(tmpPenWidth);
// tmpPen.setColor(Qt::lightGray);
// painter->setPen(tmpPen);
// painter->drawRect(itemsBoundingRect.adjusted(tmpPenWidth / 2, tmpPenWidth / 2, -tmpPenWidth / 2, -tmpPenWidth / 2));
// }
}
UBGraphicsScene
*
UBGraphicsGroupContainerItem
::
scene
()
{
UBGraphicsScene
*
castScene
=
dynamic_cast
<
UBGraphicsScene
*>
(
scene
());
UBGraphicsScene
*
castScene
=
dynamic_cast
<
UBGraphicsScene
*>
(
QGraphicsItem
::
scene
());
return
castScene
;
}
...
...
@@ -55,15 +180,33 @@ void UBGraphicsGroupContainerItem::remove()
mDelegate
->
remove
();
}
void
UBGraphicsGroupContainerItem
::
destroy
()
{
foreach
(
QGraphicsItem
*
item
,
childItems
())
{
removeFromGroup
(
item
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsFocusable
,
true
);
}
remove
();
if
(
scene
())
{
qDebug
()
<<
"scene is well casted"
;
scene
()
->
removeItem
(
this
);
}
}
void
UBGraphicsGroupContainerItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
mDelegate
->
mousePressEvent
(
event
))
{
//NOOP
}
else
{
QGraphicsItemGroup
::
mousePressEvent
(
event
);
QGraphicsItem
::
mousePressEvent
(
event
);
setSelected
(
true
);
}
}
void
UBGraphicsGroupContainerItem
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
...
...
@@ -71,18 +214,19 @@ void UBGraphicsGroupContainerItem::mouseMoveEvent(QGraphicsSceneMouseEvent *even
if
(
mDelegate
->
mouseMoveEvent
(
event
))
{
// NOOP;
}
else
{
QGraphicsItem
Group
::
mouseMoveEvent
(
event
);
QGraphicsItem
::
mouseMoveEvent
(
event
);
}
}
void
UBGraphicsGroupContainerItem
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
mDelegate
->
mouseReleaseEvent
(
event
);
QGraphicsItem
Group
::
mouseReleaseEvent
(
event
);
//
mDelegate->mouseReleaseEvent(event);
QGraphicsItem
::
mouseReleaseEvent
(
event
);
}
QVariant
UBGraphicsGroupContainerItem
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
QVariant
newValue
=
mDelegate
->
itemChange
(
change
,
value
);
return
QGraphicsItem
Group
::
itemChange
(
change
,
newValue
);
return
QGraphicsItem
::
itemChange
(
change
,
newValue
);
}
src/domain/ubgraphicsgroupcontaineritem.h
View file @
44616b34
...
...
@@ -5,20 +5,33 @@
#include "domain/UBItem.h"
class
UBGraphicsGroupContainerItem
:
public
QGraphicsItem
Group
,
public
UBItem
,
public
UBGraphicsItem
class
UBGraphicsGroupContainerItem
:
public
QGraphicsItem
,
public
UBItem
,
public
UBGraphicsItem
{
public
:
UBGraphicsGroupContainerItem
(
QGraphicsItem
*
parent
=
0
);
void
addToGroup
(
QGraphicsItem
*
item
);
void
removeFromGroup
(
QGraphicsItem
*
item
);
QRectF
boundingRect
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
{
return
mDelegate
;}
virtual
UBGraphicsScene
*
scene
();
virtual
UBGraphicsGroupContainerItem
*
deepCopy
()
const
;
virtual
void
remove
();
enum
{
Type
=
UBGraphicsItemType
::
groupContainerType
};
virtual
int
type
()
const
{
return
Type
;
}
protected
:
void
destroy
();
protected
:
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
...
...
@@ -26,6 +39,7 @@ protected:
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
private
:
QRectF
itemsBoundingRect
;
};
...
...
src/domain/ubgraphicsgroupcontaineritemdelegate.cpp
View file @
44616b34
...
...
@@ -45,21 +45,25 @@ void UBGraphicsGroupContainerItemDelegate::decorateMenu(QMenu *menu)
void
UBGraphicsGroupContainerItemDelegate
::
buildButtons
()
{
UBGraphicsItemDelegate
::
buildButtons
();
}
mDestroyGroupButton
=
new
DelegateButton
(
":/images/font.svg"
,
mDelegated
,
mFrame
,
Qt
::
TopLeftSection
);
bool
UBGraphicsGroupContainerItemDelegate
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
Q_UNUSED
(
event
)
mButtons
<<
mDestroyGroupButton
;
return
false
;
}
bool
UBGraphicsGroupContainerItemDelegate
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
Q_UNUSED
(
event
)
connect
(
mDestroyGroupButton
,
SIGNAL
(
clicked
()),
(
UBGraphicsGroupContainerItemDelegate
*
)
this
,
SLOT
(
destroyGroup
()))
;
return
false
;
}
void
UBGraphicsGroupContainerItemDelegate
::
destroyGroup
(
)
bool
UBGraphicsGroupContainerItemDelegate
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
qDebug
()
<<
"got an event"
;
foreach
(
QGraphicsItem
*
item
,
delegated
()
->
childItems
())
{
delegated
()
->
removeFromGroup
(
item
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
}
Q_UNUSED
(
event
)
re
move
(
true
)
;
re
turn
false
;
}
src/domain/ubgraphicsgroupcontaineritemdelegate.h
View file @
44616b34
...
...
@@ -17,9 +17,9 @@ protected:
virtual
void
decorateMenu
(
QMenu
*
menu
);
virtual
void
buildButtons
();
private
slots
:
v
oid
destroyGroup
(
);
virtual
bool
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
bool
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
v
irtual
bool
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
private
:
DelegateButton
*
mDestroyGroupButton
;
...
...
src/frameworks/UBGeometryUtils.cpp
View file @
44616b34
...
...
@@ -198,8 +198,9 @@ QRectF UBGeometryUtils::lineToInnerRect(const QLineF& pLine, const qreal& pWidth
qreal
centerX
=
(
pLine
.
x1
()
+
pLine
.
x2
())
/
2
;
qreal
centerY
=
(
pLine
.
y1
()
+
pLine
.
y2
())
/
2
;
// Please put a fucking comment here
qreal
side
=
sqrt
((
pWidth
*
pWidth
)
/
2
);
qreal
halfSide
=
side
/
2
;
qreal
halfSide
=
side
/
2
;
return
QRectF
(
centerX
-
halfSide
,
centerY
-
halfSide
,
side
,
side
);
}
...
...
src/gui/UBFeaturesActionBar.cpp
View file @
44616b34
...
...
@@ -66,8 +66,8 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
mButtonGroup
->
addButton
(
mpRemoveFavoriteBtn
);
mButtonGroup
->
addButton
(
mpNewFolderBtn
);
// Connect signals & slots
connect
(
mpFavoriteAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionFavorite
()));
/*
connect(mpSocialAction,SIGNAL(triggered()), this, SLOT(onActionSocial()));
/*
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()));
...
...
@@ -75,8 +75,11 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString)));
connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder()));*/
connect
(
mpFavoriteAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionFavorite
()));
connect
(
mSearchBar
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
onSearchTextChanged
(
QString
)));
connect
(
mpNewFolderAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionNewFolder
()));
connect
(
mpRemoveFavorite
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionRemoveFavorite
()));
connect
(
mpDeleteAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionTrash
()));
// Build the default toolbar
mLayout
->
addWidget
(
mpFavoriteBtn
);
...
...
@@ -148,6 +151,8 @@ void UBFeaturesActionBar::setButtons()
mpFavoriteBtn
->
hide
();
mpSocialBtn
->
hide
();
mSearchBar
->
show
();
mpDeleteBtn
->
show
();
mpDeleteBtn
->
setEnabled
(
true
);
//mpSearchBtn->show();
//mpDeleteBtn->hide();
mpCloseBtn
->
hide
();
...
...
@@ -175,6 +180,16 @@ void UBFeaturesActionBar::onActionFavorite()
emit
addElementsToFavorite
();
}
void
UBFeaturesActionBar
::
onActionRemoveFavorite
()
{
emit
removeElementsFromFavorite
();
}
void
UBFeaturesActionBar
::
onActionTrash
()
{
emit
deleteSelectedElements
();
}
/*
void UBFeaturesActionBar::dragMoveEvent(QDragMoveEvent *event)
{
...
...
src/gui/UBFeaturesActionBar.h
View file @
44616b34
...
...
@@ -31,10 +31,14 @@ signals:
void
addToFavorite
(
const
QMimeData
&
data
);
void
removeFromFavorite
(
const
QMimeData
&
data
);
void
addElementsToFavorite
();
void
removeElementsFromFavorite
();
void
deleteSelectedElements
();
private
slots
:
void
onSearchTextChanged
(
QString
txt
);
void
onActionNewFolder
();
void
onActionFavorite
();
void
onActionRemoveFavorite
();
void
onActionTrash
();
protected
:
//void dragMoveEvent(QDragMoveEvent *event);
void
dragEnterEvent
(
QDragEnterEvent
*
event
);
...
...
src/gui/UBFeaturesWidget.cpp
View file @
44616b34
...
...
@@ -10,7 +10,7 @@
#include "globals/UBGlobals.h"
#include "board/UBBoardController.h"
UBFeaturesWidget
::
UBFeaturesWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
UBFeaturesWidget
::
UBFeaturesWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
{
setObjectName
(
name
);
mName
=
"FeaturesWidget"
;
...
...
@@ -82,7 +82,6 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
//pathListView->setMovement( QListView::Static );
pathListView
->
setDragDropMode
(
QAbstractItemView
::
DropOnly
);
pathScene
=
new
QGraphicsScene
(
this
);
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
featureProperties
=
new
UBFeatureProperties
(
this
);
webView
=
new
UBFeaturesWebView
(
this
);
...
...
@@ -121,7 +120,9 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
connect
(
mActionBar
,
SIGNAL
(
deleteElements
(
const
QMimeData
&
)
),
this
,
SLOT
(
deleteElements
(
const
QMimeData
&
)
)
);
connect
(
mActionBar
,
SIGNAL
(
addToFavorite
(
const
QMimeData
&
)
),
this
,
SLOT
(
addToFavorite
(
const
QMimeData
&
)
)
);
connect
(
mActionBar
,
SIGNAL
(
removeFromFavorite
(
const
QMimeData
&
)
),
this
,
SLOT
(
removeFromFavorite
(
const
QMimeData
&
)
)
);
connect
(
mActionBar
,
SIGNAL
(
addElementsToFavorite
()
),
this
,
SLOT
(
addElementsToFavorite
()
)
);
connect
(
mActionBar
,
SIGNAL
(
addElementsToFavorite
()
),
this
,
SLOT
(
addElementsToFavorite
()
)
);
connect
(
mActionBar
,
SIGNAL
(
removeElementsFromFavorite
()
),
this
,
SLOT
(
removeElementsFromFavorite
()
)
);
connect
(
mActionBar
,
SIGNAL
(
deleteSelectedElements
()
),
this
,
SLOT
(
deleteSelectedElements
()
)
);
connect
(
pathListView
,
SIGNAL
(
clicked
(
const
QModelIndex
&
)
),
this
,
SLOT
(
currentPathChanged
(
const
QModelIndex
&
)
)
);
connect
(
thumbSlider
,
SIGNAL
(
sliderMoved
(
int
)
),
this
,
SLOT
(
thumbnailSizeChanged
(
int
)
)
);
...
...
@@ -131,6 +132,15 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
this
,
SLOT
(
onAddDownloadedFileToLibrary
(
bool
,
QUrl
,
QString
,
QByteArray
)
)
);
}
UBFeaturesWidget
::~
UBFeaturesWidget
()
{
if
(
thumbSlider
!=
NULL
)
{
delete
thumbSlider
;
thumbSlider
=
NULL
;
}
}
bool
UBFeaturesWidget
::
eventFilter
(
QObject
*
target
,
QEvent
*
event
)
{
if
(
target
==
featuresListView
&&
event
->
type
()
==
QEvent
::
Resize
)
...
...
@@ -277,6 +287,37 @@ void UBFeaturesWidget::deleteElements( const QMimeData & mimeData )
model
->
invalidate
();
}
void
UBFeaturesWidget
::
deleteSelectedElements
()
{
QModelIndexList
selected
=
featuresListView
->
selectionModel
()
->
selectedIndexes
();
QList
<
QUrl
>
urls
;
foreach
(
QModelIndex
sel
,
selected
)
{
UBFeature
feature
=
sel
.
data
(
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
if
(
feature
.
isDeletable
()
)
urls
.
append
(
feature
.
getFullPath
()
);
}
foreach
(
QUrl
url
,
urls
)
{
if
(
controller
->
isTrash
(
url
)
)
{
controller
->
deleteItem
(
url
);
}
else
{
UBFeature
elem
=
controller
->
moveItemToFolder
(
url
,
controller
->
getTrashElement
()
);
controller
->
removeFromFavorite
(
url
);
featuresModel
->
addItem
(
elem
);
featuresModel
->
deleteFavoriteItem
(
url
.
toString
()
);
}
featuresModel
->
deleteItem
(
url
.
toString
()
);
}
QSortFilterProxyModel
*
model
=
dynamic_cast
<
QSortFilterProxyModel
*>
(
featuresListView
->
model
()
);
model
->
invalidate
();
}
void
UBFeaturesWidget
::
addToFavorite
(
const
QMimeData
&
mimeData
)
{
if
(
!
mimeData
.
hasUrls
()
)
...
...
@@ -335,14 +376,45 @@ void UBFeaturesWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUr
}
void
UBFeaturesWidget
::
addElementsToFavorite
()
{
if
(
currentStackedWidget
==
ID_PROPERTIES
)
{
UBFeature
feature
=
featureProperties
->
getCurrentElement
();
if
(
feature
!=
UBFeature
()
&&
!
UBApplication
::
isFromWeb
(
feature
.
getFullPath
().
toString
()
)
)
{
UBFeature
elem
=
controller
->
addToFavorite
(
feature
.
getFullPath
()
);
featuresModel
->
addItem
(
elem
);
}
}
else
if
(
currentStackedWidget
==
ID_LISTVIEW
)
{
QModelIndexList
selected
=
featuresListView
->
selectionModel
()
->
selectedIndexes
();
for
(
int
i
=
0
;
i
<
selected
.
size
();
++
i
)
{
UBFeature
feature
=
selected
.
at
(
i
).
data
(
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
UBFeature
elem
=
controller
->
addToFavorite
(
feature
.
getFullPath
()
);
if
(
!
elem
.
getVirtualPath
().
isEmpty
()
&&
!
elem
.
getVirtualPath
().
isNull
()
)
featuresModel
->
addItem
(
elem
);
}
}
QSortFilterProxyModel
*
model
=
dynamic_cast
<
QSortFilterProxyModel
*>
(
featuresListView
->
model
()
);
model
->
invalidate
();
}
void
UBFeaturesWidget
::
removeElementsFromFavorite
()
{
QModelIndexList
selected
=
featuresListView
->
selectionModel
()
->
selectedIndexes
();
//qSort( selected.begin(), selected.end(), qGreater<QModelIndex>() );
QList
<
QUrl
>
items
;
for
(
int
i
=
0
;
i
<
selected
.
size
();
++
i
)
{
UBFeature
feature
=
selected
.
at
(
i
).
data
(
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
UBFeature
elem
=
controller
->
addToFavorite
(
feature
.
getFullPath
()
);
if
(
!
elem
.
getVirtualPath
().
isEmpty
()
&&
!
elem
.
getVirtualPath
().
isNull
()
)
featuresModel
->
addItem
(
elem
);
items
.
append
(
feature
.
getFullPath
()
);
}
foreach
(
QUrl
url
,
items
)
{
controller
->
removeFromFavorite
(
url
);
featuresModel
->
deleteFavoriteItem
(
url
.
toString
()
);
}
QSortFilterProxyModel
*
model
=
dynamic_cast
<
QSortFilterProxyModel
*>
(
featuresListView
->
model
()
);
model
->
invalidate
();
...
...
@@ -380,9 +452,7 @@ void UBFeaturesWidget::currentPathChanged(const QString &path)
*/
UBFeaturesWidget
::~
UBFeaturesWidget
()
{
}
UBFeaturesListView
::
UBFeaturesListView
(
QWidget
*
parent
,
const
char
*
name
)
:
QListView
(
parent
)
...
...
@@ -435,7 +505,7 @@ void UBFeaturesListView::dropEvent( QDropEvent *event )
{
event
->
setDropAction
(
Qt
::
MoveAction
);
}
QListView
::
dropEvent
(
event
);
QListView
::
dropEvent
(
event
);
}
...
...
@@ -473,15 +543,18 @@ UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(
UBFeaturesWebView
::~
UBFeaturesWebView
()
{
if
(
NULL
!=
mpSankoreAPI
){
if
(
NULL
!=
mpSankoreAPI
)
{
delete
mpSankoreAPI
;
mpSankoreAPI
=
NULL
;
}
if
(
NULL
!=
mpView
){
if
(
NULL
!=
mpView
)
{
delete
mpView
;
mpView
=
NULL
;
}
if
(
NULL
!=
mpLayout
){
if
(
NULL
!=
mpLayout
)
{
delete
mpLayout
;
mpLayout
=
NULL
;
}
...
...
@@ -597,6 +670,55 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) :
connect
(
mpAddToLibButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
onAddToLib
()
)
);
}
UBFeatureProperties
::~
UBFeatureProperties
()
{
if
(
mpOrigPixmap
)
{
delete
mpOrigPixmap
;
mpOrigPixmap
=
NULL
;
}
if
(
mpElement
)
{
delete
mpElement
;
mpElement
=
NULL
;
}
if
(
mpThumbnail
)
{
delete
mpThumbnail
;
mpThumbnail
=
NULL
;
}
if
(
mpButtonLayout
)
{
delete
mpButtonLayout
;
mpButtonLayout
=
NULL
;
}
if
(
mpAddPageButton
)
{
delete
mpAddPageButton
;
mpAddPageButton
=
NULL
;
}
if
(
mpSetAsBackgroundButton
)
{
delete
mpSetAsBackgroundButton
;
mpSetAsBackgroundButton
=
NULL
;
}
if
(
mpAddToLibButton
)
{
delete
mpAddToLibButton
;
mpAddToLibButton
=
NULL
;
}
if
(
mpObjInfoLabel
)
{
delete
mpObjInfoLabel
;
mpObjInfoLabel
=
NULL
;
}
if
(
mpObjInfos
)
{
delete
mpObjInfos
;
mpObjInfos
=
NULL
;
}
}
void
UBFeatureProperties
::
resizeEvent
(
QResizeEvent
*
event
)
{
Q_UNUSED
(
event
);
...
...
@@ -609,6 +731,13 @@ void UBFeatureProperties::showEvent (QShowEvent *event )
adaptSize
();
}
UBFeature
UBFeatureProperties
::
getCurrentElement
()
const
{
if
(
mpElement
)
return
*
mpElement
;
return
UBFeature
();
}
void
UBFeatureProperties
::
adaptSize
()
{
if
(
NULL
!=
mpOrigPixmap
)
...
...
@@ -716,19 +845,7 @@ void UBFeatureProperties::onSetAsBackground()
featuresWidget
->
getFeaturesController
()
->
addItemAsBackground
(
*
mpElement
);
}
UBFeatureProperties
::~
UBFeatureProperties
()
{
if
(
mpOrigPixmap
)
{
delete
mpOrigPixmap
;
mpOrigPixmap
=
NULL
;
}
if
(
mpElement
)
{
delete
mpElement
;
mpElement
=
NULL
;
}
}
UBFeatureItemButton
::
UBFeatureItemButton
(
QWidget
*
parent
,
const
char
*
name
)
:
QPushButton
(
parent
)
{
...
...
@@ -854,7 +971,7 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path )
{
for
(
int
i
=
0
;
i
<
featuresList
->
size
();
++
i
)
{
if
(
!
QString
::
compare
(
featuresList
->
at
(
i
).
getUrl
(),
path
,
Qt
::
CaseInsensitive
)
&&
if
(
!
QString
::
compare
(
featuresList
->
at
(
i
).
getFullPath
().
toString
(),
path
,
Qt
::
CaseInsensitive
)
&&
!
QString
::
compare
(
featuresList
->
at
(
i
).
getVirtualPath
(),
"/root/favorites"
,
Qt
::
CaseInsensitive
)
)
{
removeRow
(
i
,
QModelIndex
()
);
...
...
@@ -863,6 +980,18 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path )
}
}
void
UBFeaturesModel
::
deleteItem
(
const
QString
&
path
)
{
for
(
int
i
=
0
;
i
<
featuresList
->
size
();
++
i
)
{
if
(
!
QString
::
compare
(
featuresList
->
at
(
i
).
getFullPath
().
toString
(),
path
,
Qt
::
CaseInsensitive
)
)
{
removeRow
(
i
,
QModelIndex
()
);
return
;
}
}
}
bool
UBFeaturesModel
::
removeRows
(
int
row
,
int
count
,
const
QModelIndex
&
parent
)
{
if
(
row
<
0
)
...
...
@@ -889,6 +1018,7 @@ bool UBFeaturesModel::removeRow( int row, const QModelIndex & parent )
return
true
;
}
Qt
::
ItemFlags
UBFeaturesModel
::
flags
(
const
QModelIndex
&
index
)
const
{
Qt
::
ItemFlags
defaultFlags
=
QAbstractItemModel
::
flags
(
index
);
...
...
src/gui/UBFeaturesWidget.h
View file @
44616b34
...
...
@@ -80,7 +80,7 @@ private:
QSlider
*
thumbSlider
;
QVBoxLayout
*
layout
;
//UBFeaturesPathViewer *pathViewer;
QGraphicsScene
*
pathScene
;
//
QGraphicsScene *pathScene;
UBFeaturesActionBar
*
mActionBar
;
UBFeatureProperties
*
featureProperties
;
UBFeaturesWebView
*
webView
;
...
...
@@ -88,7 +88,6 @@ private:
int
currentStackedWidget
;
QModelIndex
trashIndex
;
private
slots
:
void
currentSelected
(
const
QModelIndex
&
);
//void currentPathChanged(const QString &);
...
...
@@ -102,6 +101,8 @@ private slots:
void
onDisplayMetadata
(
QMap
<
QString
,
QString
>
);
void
onAddDownloadedFileToLibrary
(
bool
,
QUrl
,
QString
,
QByteArray
);
void
addElementsToFavorite
();
void
removeElementsFromFavorite
();
void
deleteSelectedElements
();
protected
:
bool
eventFilter
(
QObject
*
target
,
QEvent
*
event
);
};
...
...
@@ -129,7 +130,7 @@ class UBFeaturesWebView : public QWidget
Q_OBJECT
public
:
UBFeaturesWebView
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBFeaturesWebView"
);
~
UBFeaturesWebView
();
virtual
~
UBFeaturesWebView
();
void
showElement
(
const
UBFeature
&
elem
);
...
...
@@ -151,8 +152,7 @@ public:
~
UBFeatureProperties
();
void
showElement
(
const
UBFeature
&
elem
);
UBFeature
getCurrentElement
()
const
;
protected
:
void
resizeEvent
(
QResizeEvent
*
event
);
void
showEvent
(
QShowEvent
*
event
);
...
...
@@ -200,6 +200,7 @@ public:
void
addItem
(
const
UBFeature
&
item
);
void
deleteFavoriteItem
(
const
QString
&
path
);
void
deleteItem
(
const
QString
&
path
);
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
QMimeData
*
mimeData
(
const
QModelIndexList
&
indexes
)
const
;
...
...
@@ -209,6 +210,8 @@ public:
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
());
//bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
//bool insertRow(int row, const QModelIndex &parent = QModelIndex());
Qt
::
DropActions
supportedDropActions
()
const
{
return
Qt
::
MoveAction
|
Qt
::
CopyAction
;
}
...
...
src/tools/UBGraphicsCompass.cpp
View file @
44616b34
...
...
@@ -71,6 +71,7 @@ UBGraphicsCompass::UBGraphicsCompass()
unsetCursor
();
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
connect
(
UBApplication
::
boardController
,
SIGNAL
(
penColorChanged
()),
this
,
SLOT
(
penColorChanged
()));
connect
(
UBDrawingController
::
drawingController
(),
SIGNAL
(
lineWidthIndexChanged
(
int
)),
this
,
SLOT
(
lineWidthChanged
()));
...
...
src/tools/UBGraphicsProtractor.cpp
View file @
44616b34
...
...
@@ -64,6 +64,7 @@ UBGraphicsProtractor::UBGraphicsProtractor()
mRotateSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
scale
(
1.5
,
1.5
);
}
...
...
src/tools/UBGraphicsProtractor.h
View file @
44616b34
...
...
@@ -28,7 +28,7 @@ class UBGraphicsScene;
class
UBGraphicsProtractor
:
public
UBAbstractDrawRuler
,
public
QGraphicsEllipseItem
,
public
UBItem
{
Q_OBJECT
;
Q_OBJECT
public
:
UBGraphicsProtractor
();
...
...
src/tools/UBGraphicsRuler.cpp
View file @
44616b34
...
...
@@ -46,7 +46,8 @@ UBGraphicsRuler::UBGraphicsRuler()
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
updateResizeCursor
();
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
updateResizeCursor
();
}
void
UBGraphicsRuler
::
updateResizeCursor
()
...
...
src/tools/UBGraphicsTriangle.cpp
View file @
44616b34
...
...
@@ -55,6 +55,7 @@ UBGraphicsTriangle::UBGraphicsTriangle()
mRotateSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
updateResizeCursor
();
}
...
...
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