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
cd9820ab
Commit
cd9820ab
authored
Aug 29, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backup
parent
f6c3ee89
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
456 additions
and
67 deletions
+456
-67
sankore.qrc
resources/sankore.qrc
+2
-5
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+51
-1
UBSvgSubsetAdaptor.h
src/adaptors/UBSvgSubsetAdaptor.h
+5
-1
UBBoardController.cpp
src/board/UBBoardController.cpp
+7
-2
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+21
-1
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+7
-2
UBDockPalette.cpp
src/gui/UBDockPalette.cpp
+50
-29
UBDockPalette.h
src/gui/UBDockPalette.h
+12
-2
UBDockPaletteWidget.cpp
src/gui/UBDockPaletteWidget.cpp
+36
-0
UBDockPaletteWidget.h
src/gui/UBDockPaletteWidget.h
+27
-0
UBLibPalette.cpp
src/gui/UBLibPalette.cpp
+1
-1
UBNavigatorPalette.cpp
src/gui/UBNavigatorPalette.cpp
+1
-1
gui.pri
src/gui/gui.pri
+4
-2
UBGraphicsCache.cpp
src/tools/UBGraphicsCache.cpp
+142
-0
UBGraphicsCache.h
src/tools/UBGraphicsCache.h
+61
-0
UBToolsManager.cpp
src/tools/UBToolsManager.cpp
+7
-1
UBToolsManager.h
src/tools/UBToolsManager.h
+2
-1
tools.pri
src/tools/tools.pri
+20
-18
No files found.
resources/sankore.qrc
View file @
cd9820ab
...
...
@@ -176,7 +176,7 @@
<file>images/cursors/rotate.png</file>
<file>images/cursors/resize.png</file>
<file>images/cursors/drawCompass.png</file>
<file>images/cursors/drawRulerLine.png</file>
<file>images/cursors/drawRulerLine.png</file>
<file>images/print/onepage.png</file>
<file>images/print/thumbnails.png</file>
<file>images/print/twopages.png</file>
...
...
@@ -289,8 +289,6 @@
<file>images/toolbar/hide.png</file>
<file>images/toolbar/record.png</file>
<file>images/libpalette/MoviesCategory.svg</file>
<file>images/virtual.keyboard/41/centre-passive.png</file>
<file>images/virtual.keyboard/41/left-passive.png</file>
<file>images/virtual.keyboard/41/right-passive.png</file>
...
...
@@ -300,7 +298,6 @@
<file>images/virtual.keyboard/41/backspace.png</file>
<file>images/virtual.keyboard/41/capslock.png</file>
<file>images/virtual.keyboard/41/tab.png</file>
<file>images/virtual.keyboard/29/centre-passive.png</file>
<file>images/virtual.keyboard/29/left-passive.png</file>
<file>images/virtual.keyboard/29/right-passive.png</file>
...
...
@@ -310,6 +307,6 @@
<file>images/virtual.keyboard/29/backspace.png</file>
<file>images/virtual.keyboard/29/capslock.png</file>
<file>images/virtual.keyboard/29/tab.png</file>
<file>images/toolPalette/cacheTool.png</file>
</qresource>
</RCC>
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
cd9820ab
...
...
@@ -35,6 +35,7 @@
#include "tools/UBGraphicsProtractor.h"
#include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsCache.h"
#include "document/UBDocumentProxy.h"
...
...
@@ -654,7 +655,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
scene
->
registerTool
(
protractor
);
}
}
else
if
(
mXmlReader
.
name
()
==
"protractor
"
)
else
if
(
mXmlReader
.
name
()
==
"triangle
"
)
{
UBGraphicsTriangle
*
triangle
=
triangleFromSvg
();
...
...
@@ -664,6 +665,15 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
scene
->
registerTool
(
triangle
);
}
}
else
if
(
mXmlReader
.
name
()
==
"cache"
)
{
UBGraphicsCache
*
cache
=
cacheFromSvg
();
if
(
cache
)
{
scene
->
addItem
(
cache
);
scene
->
registerTool
(
cache
);
}
}
else
if
(
mXmlReader
.
name
()
==
"foreignObject"
)
{
QString
href
=
mXmlReader
.
attributes
().
value
(
nsXLink
,
"href"
).
toString
();
...
...
@@ -1045,6 +1055,13 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene()
continue
;
}
UBGraphicsCache
*
cache
=
qgraphicsitem_cast
<
UBGraphicsCache
*>
(
item
);
if
(
cache
&&
cache
->
isVisible
())
{
cacheToSvg
(
cache
);
continue
;
}
UBGraphicsCompass
*
compass
=
qgraphicsitem_cast
<
UBGraphicsCompass
*>
(
item
);
if
(
compass
&&
compass
->
isVisible
())
...
...
@@ -1060,6 +1077,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene()
protractorToSvg
(
protractor
);
continue
;
}
}
if
(
openStroke
)
...
...
@@ -2615,6 +2633,38 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
return
triangle
;
}
UBGraphicsCache
*
UBSvgSubsetAdaptor
::
UBSvgSubsetReader
::
cacheFromSvg
()
{
UBGraphicsCache
*
pCache
=
new
UBGraphicsCache
();
pCache
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Tool
));
pCache
->
setVisible
(
true
);
return
pCache
;
}
void
UBSvgSubsetAdaptor
::
UBSvgSubsetWriter
::
cacheToSvg
(
UBGraphicsCache
*
item
)
{
mXmlWriter
.
writeStartElement
(
UBSettings
::
uniboardDocumentNamespaceUri
,
"cache"
);
mXmlWriter
.
writeAttribute
(
"x"
,
QString
(
"%1"
).
arg
(
item
->
rect
().
x
()));
mXmlWriter
.
writeAttribute
(
"y"
,
QString
(
"%1"
).
arg
(
item
->
rect
().
y
()));
mXmlWriter
.
writeAttribute
(
"width"
,
QString
(
"%1"
).
arg
(
item
->
rect
().
width
()));
mXmlWriter
.
writeAttribute
(
"height"
,
QString
(
"%1"
).
arg
(
item
->
rect
().
height
()));
QString
zs
;
zs
.
setNum
(
item
->
zValue
(),
'f'
);
// 'f' keeps precision
mXmlWriter
.
writeAttribute
(
UBSettings
::
uniboardDocumentNamespaceUri
,
"z-value"
,
zs
);
UBItem
*
ubItem
=
dynamic_cast
<
UBItem
*>
(
item
);
if
(
ubItem
)
{
mXmlWriter
.
writeAttribute
(
UBSettings
::
uniboardDocumentNamespaceUri
,
"uuid"
,
UBStringUtils
::
toCanonicalUuid
(
ubItem
->
uuid
()));
}
mXmlWriter
.
writeEndElement
();
}
void
UBSvgSubsetAdaptor
::
convertPDFObjectsToImages
(
UBDocumentProxy
*
proxy
)
{
for
(
int
i
=
0
;
i
<
proxy
->
pageCount
();
i
++
)
...
...
src/adaptors/UBSvgSubsetAdaptor.h
View file @
cd9820ab
...
...
@@ -40,6 +40,7 @@ class UBDocumentProxy;
class
UBGraphicsStroke
;
class
UBPersistenceManager
;
class
UBGraphicsTriangle
;
class
UBGraphicsCache
;
class
UBSvgSubsetAdaptor
{
...
...
@@ -127,7 +128,9 @@ class UBSvgSubsetAdaptor
UBGraphicsProtractor
*
protractorFromSvg
();
UBGraphicsTriangle
*
triangleFromSvg
();
UBGraphicsTriangle
*
triangleFromSvg
();
UBGraphicsCache
*
cacheFromSvg
();
void
graphicsItemFromSvg
(
QGraphicsItem
*
gItem
);
...
...
@@ -210,6 +213,7 @@ class UBSvgSubsetAdaptor
void
rulerToSvg
(
UBGraphicsRuler
*
item
);
void
compassToSvg
(
UBGraphicsCompass
*
item
);
void
protractorToSvg
(
UBGraphicsProtractor
*
item
);
void
cacheToSvg
(
UBGraphicsCache
*
item
);
void
writeSvgElement
();
private
:
...
...
src/board/UBBoardController.cpp
View file @
cd9820ab
...
...
@@ -1009,11 +1009,16 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
mActiveScene
->
addProtractor
(
pPos
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
else
if
(
sourceUrl
.
toString
()
==
UBToolsManager
::
manager
()
->
triangle
.
id
)
else
if
(
sourceUrl
.
toString
()
==
UBToolsManager
::
manager
()
->
triangle
.
id
)
{
mActiveScene
->
addTriangle
(
pPos
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
else
if
(
sourceUrl
.
toString
()
==
UBToolsManager
::
manager
()
->
cache
.
id
)
{
mActiveScene
->
addCache
();
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
else
if
(
sourceUrl
.
toString
()
==
UBToolsManager
::
manager
()
->
mask
.
id
)
{
mActiveScene
->
addMask
();
...
...
@@ -1557,7 +1562,7 @@ void UBBoardController::stylusToolChanged(int tool)
if
(
eTool
!=
UBStylusTool
::
Selector
&&
eTool
!=
UBStylusTool
::
Text
)
{
if
(
mPaletteManager
->
mKeyboardPalette
->
m_isVisible
)
UBApplication
::
mainWindow
->
actionVirtualKeyboard
->
activate
(
QAction
::
Trigger
);
UBApplication
::
mainWindow
->
actionVirtualKeyboard
->
activate
(
QAction
::
Trigger
);
}
}
...
...
src/domain/UBGraphicsScene.cpp
View file @
cd9820ab
...
...
@@ -34,6 +34,7 @@
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsCache.h"
#include "document/UBDocumentProxy.h"
...
...
@@ -68,6 +69,7 @@ qreal UBGraphicsScene::toolOffsetProtractor = 100;
qreal
UBGraphicsScene
::
toolOffsetTriangle
=
100
;
qreal
UBGraphicsScene
::
toolOffsetCompass
=
100
;
qreal
UBGraphicsScene
::
toolOffsetEraser
=
200
;
qreal
UBGraphicsScene
::
toolOffsetCache
=
1000
;
qreal
UBGraphicsScene
::
toolOffsetCurtain
=
1000
;
qreal
UBGraphicsScene
::
toolOffsetPointer
=
1100
;
...
...
@@ -132,7 +134,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
}
connect
(
this
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
selectionChangedProcessing
()));
mHasCache
=
false
;
}
...
...
@@ -1484,6 +1486,24 @@ void UBGraphicsScene::addCompass(QPointF center)
setModified
(
true
);
}
void
UBGraphicsScene
::
addCache
()
{
UBGraphicsCache
*
cache
=
new
UBGraphicsCache
();
mTools
<<
cache
;
QGraphicsView
*
view
;
if
(
UBApplication
::
applicationController
->
displayManager
()
->
hasDisplay
())
{
view
=
(
QGraphicsView
*
)(
UBApplication
::
boardController
->
displayView
());
}
else
{
view
=
(
QGraphicsView
*
)(
UBApplication
::
boardController
->
controlView
());
}
addItem
(
cache
);
cache
->
setVisible
(
true
);
cache
->
setSelected
(
true
);
}
void
UBGraphicsScene
::
addMask
()
{
...
...
src/domain/UBGraphicsScene.h
View file @
cd9820ab
...
...
@@ -44,6 +44,7 @@ class UBAbstractWidget;
class
UBDocumentProxy
;
class
UBGraphicsCurtainItem
;
class
UBGraphicsStroke
;
class
UBGraphicsCache
;
const
double
PI
=
4
.
0
*
atan
(
1
.
0
);
...
...
@@ -164,9 +165,10 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
qreal
getNextObjectZIndex
();
void
addRuler
(
QPointF
center
);
void
addTriangle
(
QPointF
center
);
void
addTriangle
(
QPointF
center
);
void
addProtractor
(
QPointF
center
);
void
addCompass
(
QPointF
center
);
void
addCache
();
void
addMask
();
...
...
@@ -243,7 +245,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
static
qreal
toolOffsetProtractor
;
static
qreal
toolOffsetCompass
;
static
qreal
toolOffsetCurtain
;
static
qreal
toolOffsetTriangle
;
static
qreal
toolOffsetTriangle
;
static
qreal
toolOffsetCache
;
QSet
<
QGraphicsItem
*>
tools
(){
return
mTools
;}
...
...
@@ -347,6 +350,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
QList
<
QGraphicsItem
*>
mFastAccessItems
;
// a local copy as QGraphicsScene::items() is very slow in Qt 4.6
//int mMesure1Ms, mMesure2Ms;
bool
mHasCache
;
};
#endif
/* UBGRAPHICSSCENE_H_ */
src/gui/UBDockPalette.cpp
View file @
cd9820ab
...
...
@@ -53,9 +53,13 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
,
mCollapseWidth
(
150
)
,
mLastWidth
(
-
1
)
,
mHTab
(
0
)
,
mpStackWidget
(
NULL
)
{
setObjectName
(
name
);
// clear the tab widgets
mTabWidgets
.
clear
();
// We let 2 pixels in order to keep a small border for the resizing
setMinimumWidth
(
2
*
border
()
+
2
);
...
...
@@ -91,7 +95,11 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
*/
UBDockPalette
::~
UBDockPalette
()
{
if
(
NULL
!=
mpStackWidget
)
{
delete
mpStackWidget
;
mpStackWidget
=
NULL
;
}
}
/**
...
...
@@ -314,36 +322,39 @@ void UBDockPalette::paintEvent(QPaintEvent *event)
painter
.
setPen
(
Qt
::
NoPen
);
painter
.
setBrush
(
mBackgroundBrush
);
if
(
eUBDockTabOrientation_Up
==
mTabsOrientation
)
for
(
int
i
=
0
;
i
<
mTabWidgets
.
size
();
i
++
)
{
mHTab
=
border
();
}
else
{
mHTab
=
height
()
-
border
()
-
TABSIZE
;
}
if
(
eUBDockTabOrientation_Up
==
mTabsOrientation
)
{
mHTab
=
border
();
}
else
{
mHTab
=
height
()
-
border
()
-
i
*
TABSIZE
;
}
if
(
mOrientation
==
eUBDockOrientation_Left
)
{
QPainterPath
path
;
path
.
setFillRule
(
Qt
::
WindingFill
);
path
.
addRect
(
0.0
,
0.0
,
width
()
-
2
*
border
(),
height
());
path
.
addRoundedRect
(
width
()
-
4
*
border
(),
mHTab
,
4
*
border
(),
TABSIZE
,
radius
(),
radius
());
painter
.
drawPath
(
path
);
painter
.
drawPixmap
(
width
()
-
border
()
+
1
,
mHTab
+
1
,
border
()
-
4
,
TABSIZE
-
2
,
mIcon
);
}
else
if
(
mOrientation
==
eUBDockOrientation_Right
)
{
QPainterPath
path
;
path
.
setFillRule
(
Qt
::
WindingFill
);
path
.
addRect
(
2
*
border
(),
0.0
,
width
()
-
2
*
border
(),
height
());
path
.
addRoundedRect
(
0.0
,
mHTab
,
4
*
border
(),
TABSIZE
,
radius
(),
radius
());
painter
.
drawPath
(
path
);
painter
.
drawPixmap
(
2
,
mHTab
+
1
,
border
()
-
3
,
TABSIZE
-
2
,
mIcon
);
}
else
{
painter
.
drawRoundedRect
(
border
(),
border
(),
width
()
-
2
*
border
(),
height
()
-
2
*
border
(),
radius
(),
radius
());
if
(
mOrientation
==
eUBDockOrientation_Left
)
{
QPainterPath
path
;
path
.
setFillRule
(
Qt
::
WindingFill
);
path
.
addRect
(
0.0
,
0.0
,
width
()
-
2
*
border
(),
height
());
path
.
addRoundedRect
(
width
()
-
4
*
border
(),
mHTab
,
4
*
border
(),
TABSIZE
,
radius
(),
radius
());
painter
.
drawPath
(
path
);
//painter.drawPixmap(width() - border() + 1, mHTab + 1 , border() - 4, TABSIZE - 2, mIcon);
}
else
if
(
mOrientation
==
eUBDockOrientation_Right
)
{
QPainterPath
path
;
path
.
setFillRule
(
Qt
::
WindingFill
);
path
.
addRect
(
2
*
border
(),
0.0
,
width
()
-
2
*
border
(),
height
());
path
.
addRoundedRect
(
0.0
,
mHTab
,
4
*
border
(),
TABSIZE
,
radius
(),
radius
());
painter
.
drawPath
(
path
);
//painter.drawPixmap(2, mHTab + 1, border() - 3, TABSIZE - 2, mIcon);
}
else
{
painter
.
drawRoundedRect
(
border
(),
border
(),
width
()
-
2
*
border
(),
height
()
-
2
*
border
(),
radius
(),
radius
());
}
}
}
...
...
@@ -437,3 +448,13 @@ int UBDockPalette::customMargin()
{
return
5
;
}
void
UBDockPalette
::
addTabWidget
(
const
QString
&
widgetName
,
UBDockPaletteWidget
*
widget
)
{
mTabWidgets
[
widgetName
]
=
widget
;
}
void
UBDockPalette
::
removeTab
(
const
QString
&
widgetName
)
{
mTabWidgets
.
remove
(
widgetName
);
}
src/gui/UBDockPalette.h
View file @
cd9820ab
...
...
@@ -24,6 +24,10 @@
#include <QTime>
#include <QPoint>
#include <QPixmap>
#include <QMap>
#include <QStackedWidget>
#include "UBDockPaletteWidget.h"
#define TABSIZE 50
#define CLICKTIME 1000000
...
...
@@ -64,6 +68,8 @@ public:
virtual
void
leaveEvent
(
QEvent
*
);
void
setBackgroundBrush
(
const
QBrush
&
brush
);
void
addTabWidget
(
const
QString
&
widgetName
,
UBDockPaletteWidget
*
widget
);
void
removeTab
(
const
QString
&
widgetName
);
protected
:
virtual
int
border
();
...
...
@@ -93,12 +99,16 @@ protected:
QTime
mClickTime
;
/** The mouse pressed position */
QPoint
mMousePressPos
;
/** The palette icon */
QPixmap
mIcon
;
/
//
** The palette icon */
//
QPixmap mIcon;
/** The tab orientation */
eUBDockTabOrientation
mTabsOrientation
;
/** The h position of the tab */
int
mHTab
;
/** The tab widgets */
QMap
<
QString
,
UBDockPaletteWidget
*>
mTabWidgets
;
/** The stacked widget */
QStackedWidget
*
mpStackWidget
;
private
slots
:
void
onToolbarPosUpdated
();
...
...
src/gui/UBDockPaletteWidget.cpp
0 → 100644
View file @
cd9820ab
#include "UBDockPaletteWidget.h"
UBDockPaletteWidget
::
UBDockPaletteWidget
(
const
char
*
name
,
QWidget
*
parent
)
:
QWidget
(
parent
)
,
mpWidget
(
NULL
)
{
setObjectName
(
name
);
}
UBDockPaletteWidget
::~
UBDockPaletteWidget
()
{
if
(
NULL
!=
mpWidget
)
{
delete
mpWidget
;
mpWidget
=
NULL
;
}
}
QWidget
*
UBDockPaletteWidget
::
widget
()
{
return
mpWidget
;
}
QIcon
UBDockPaletteWidget
::
icon
()
{
return
mIcon
;
}
QIcon
UBDockPaletteWidget
::
collapsedIcon
()
{
return
mCollapsedIcon
;
}
QString
UBDockPaletteWidget
::
name
()
{
return
mName
;
}
src/gui/UBDockPaletteWidget.h
0 → 100644
View file @
cd9820ab
#ifndef UBDOCKPALETTEWIDGET_H
#define UBDOCKPALETTEWIDGET_H
#include <QWidget>
#include <QIcon>
#include <QString>
class
UBDockPaletteWidget
:
public
QWidget
{
public
:
UBDockPaletteWidget
(
const
char
*
name
=
"UBDockPaletteWidget"
,
QWidget
*
parent
=
0
);
~
UBDockPaletteWidget
();
QWidget
*
widget
();
QIcon
icon
();
QIcon
collapsedIcon
();
QString
name
();
protected
:
QWidget
*
mpWidget
;
QIcon
mIcon
;
QIcon
mCollapsedIcon
;
QString
mName
;
};
#endif // UBDOCKPALETTEWIDGET_H
src/gui/UBLibPalette.cpp
View file @
cd9820ab
...
...
@@ -31,7 +31,7 @@ UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(pare
,
mDropWidget
(
NULL
)
{
setOrientation
(
eUBDockOrientation_Right
);
mIcon
=
QPixmap
(
":images/paletteLibrary.png"
);
//
mIcon = QPixmap(":images/paletteLibrary.png");
setAcceptDrops
(
true
);
resize
(
UBSettings
::
settings
()
->
libPaletteWidth
->
get
().
toInt
(),
parentWidget
()
->
height
());
...
...
src/gui/UBNavigatorPalette.cpp
View file @
cd9820ab
...
...
@@ -32,7 +32,7 @@ UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name):UBDock
{
setOrientation
(
eUBDockOrientation_Left
);
setMaximumWidth
(
300
);
mIcon
=
QPixmap
(
":images/paletteNavigator.png"
);
//
mIcon = QPixmap(":images/paletteNavigator.png");
resize
(
UBSettings
::
settings
()
->
navigPaletteWidth
->
get
().
toInt
(),
height
());
mLastWidth
=
300
;
...
...
src/gui/gui.pri
View file @
cd9820ab
...
...
@@ -38,7 +38,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBLibActionBar.h \
src/gui/UBLibraryWidget.h \
src/gui/UBLibPathViewer.h \
src/gui/UBUpdateDlg.h
src/gui/UBUpdateDlg.h \
src/gui/UBDockPaletteWidget.h
SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \
...
...
@@ -79,7 +80,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBLibActionBar.cpp \
src/gui/UBLibraryWidget.cpp \
src/gui/UBLibPathViewer.cpp \
src/gui/UBUpdateDlg.cpp
src/gui/UBUpdateDlg.cpp \
src/gui/UBDockPaletteWidget.cpp
win32 {
...
...
src/tools/UBGraphicsCache.cpp
0 → 100644
View file @
cd9820ab
/*
* 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 "UBGraphicsCache.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "board/UBBoardView.h"
#include "domain/UBGraphicsScene.h"
UBGraphicsCache
::
UBGraphicsCache
()
:
QGraphicsRectItem
()
,
mMaskColor
(
Qt
::
black
)
,
mMaskShape
(
eMaskShape_Circle
)
,
mShapeWidth
(
100
)
,
mDrawMask
(
false
)
{
// Get the board size and pass it to the shape
QRect
boardRect
=
UBApplication
::
boardController
->
displayView
()
->
rect
();
setRect
(
-
15
*
boardRect
.
width
(),
-
15
*
boardRect
.
height
(),
30
*
boardRect
.
width
(),
30
*
boardRect
.
height
());
setZValue
(
CACHE_ZVALUE
);
}
UBGraphicsCache
::~
UBGraphicsCache
()
{
}
UBItem
*
UBGraphicsCache
::
deepCopy
()
const
{
UBGraphicsCache
*
copy
=
new
UBGraphicsCache
();
copy
->
setPos
(
this
->
pos
());
copy
->
setRect
(
this
->
rect
());
copy
->
setZValue
(
this
->
zValue
());
copy
->
setTransform
(
this
->
transform
());
// TODO UB 4.7 ... complete all members ?
return
copy
;
}
QColor
UBGraphicsCache
::
maskColor
()
{
return
mMaskColor
;
}
void
UBGraphicsCache
::
setMaskColor
(
QColor
color
)
{
mMaskColor
=
color
;
}
eMaskShape
UBGraphicsCache
::
maskshape
()
{
return
mMaskShape
;
}
void
UBGraphicsCache
::
setMaskShape
(
eMaskShape
shape
)
{
mMaskShape
=
shape
;
}
void
UBGraphicsCache
::
init
()
{
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
}
void
UBGraphicsCache
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
setZValue
(
CACHE_ZVALUE
);
painter
->
setBrush
(
mMaskColor
);
painter
->
setPen
(
mMaskColor
);
QPainterPath
path
;
path
.
addRect
(
rect
());
if
(
mDrawMask
)
{
if
(
eMaskShape_Circle
==
mMaskShape
)
{
path
.
addEllipse
(
mShapePos
,
mShapeWidth
,
mShapeWidth
);
}
else
if
(
eMaskShap_Rectangle
==
mMaskShape
)
{
path
.
addRect
(
mShapePos
.
x
(),
mShapePos
.
y
(),
mShapeWidth
,
mShapeWidth
);
}
path
.
setFillRule
(
Qt
::
OddEvenFill
);
}
painter
->
drawPath
(
path
);
}
void
UBGraphicsCache
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
mShapePos
=
event
->
pos
();
mDrawMask
=
true
;
update
();
}
void
UBGraphicsCache
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
mShapePos
=
event
->
pos
();
update
();
}
void
UBGraphicsCache
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
mDrawMask
=
false
;
update
();
}
int
UBGraphicsCache
::
shapeWidth
()
{
return
mShapeWidth
;
}
void
UBGraphicsCache
::
setShapeWidth
(
int
width
)
{
mShapeWidth
=
width
;
}
src/tools/UBGraphicsCache.h
0 → 100644
View file @
cd9820ab
/*
* 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 UBGRAPHICSCACHE_H
#define UBGRAPHICSCACHE_H
#include <QColor>
#include <QGraphicsSceneMouseEvent>
#include "domain/UBItem.h"
#define CACHE_ZVALUE 100000
typedef
enum
{
eMaskShape_Circle
,
eMaskShap_Rectangle
}
eMaskShape
;
class
UBGraphicsCache
:
public
QGraphicsRectItem
,
public
UBItem
{
public
:
UBGraphicsCache
();
~
UBGraphicsCache
();
virtual
UBItem
*
deepCopy
()
const
;
QColor
maskColor
();
void
setMaskColor
(
QColor
color
);
eMaskShape
maskshape
();
void
setMaskShape
(
eMaskShape
shape
);
int
shapeWidth
();
void
setShapeWidth
(
int
width
);
protected
:
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
private
:
void
init
();
QColor
mMaskColor
;
eMaskShape
mMaskShape
;
int
mShapeWidth
;
bool
mDrawMask
;
QPointF
mShapePos
;
};
#endif // UBGRAPHICSCACHE_H
src/tools/UBToolsManager.cpp
View file @
cd9820ab
...
...
@@ -58,9 +58,15 @@ UBToolsManager::UBToolsManager(QObject *parent)
mToolsIcon
.
insert
(
triangle
.
id
,
":/images/toolPalette/triangleTool.png"
);
mDescriptors
<<
triangle
;
cache
.
id
=
"uniboardTool://uniboard.mnemis.com/cache"
;
cache
.
icon
=
QPixmap
(
":/images/toolPalette/cacheTool.png"
);
cache
.
label
=
tr
(
"Cache"
);
cache
.
version
=
"1.0"
;
mToolsIcon
.
insert
(
cache
.
id
,
":/images/toolPalette/cacheTool.png"
);
mDescriptors
<<
cache
;
}
UBToolsManager
::~
UBToolsManager
()
{
// NOOP
}
\ No newline at end of file
}
src/tools/UBToolsManager.h
View file @
cd9820ab
...
...
@@ -77,7 +77,8 @@ class UBToolsManager : public QObject
UBToolDescriptor
protractor
;
UBToolDescriptor
compass
;
UBToolDescriptor
mask
;
UBToolDescriptor
triangle
;
UBToolDescriptor
triangle
;
UBToolDescriptor
cache
;
QString
iconFromToolId
(
QString
id
)
{
return
mToolsIcon
.
value
(
id
);}
...
...
src/tools/tools.pri
View file @
cd9820ab
HEADERS += src/tools/UBGraphicsRuler.h \
src/tools/UBGraphicsTriangle.h \
src/tools/UBGraphicsProtractor.h \
src/tools/UBGraphicsCompass.h \
src/tools/UBToolsManager.h \
src/tools/UBGraphicsCurtainItem.h \
src/tools/UBGraphicsCurtainItemDelegate.h \
src/tools/UBAbstractDrawRuler.h
SOURCES += src/tools/UBGraphicsRuler.cpp \
src/tools/UBGraphicsTriangle.cpp \
src/tools/UBGraphicsProtractor.cpp \
src/tools/UBGraphicsCompass.cpp \
src/tools/UBToolsManager.cpp \
src/tools/UBGraphicsCurtainItem.cpp \
src/tools/UBGraphicsCurtainItemDelegate.cpp \
src/tools/UBAbstractDrawRuler.cpp
\ No newline at end of file
HEADERS += src/tools/UBGraphicsRuler.h \
src/tools/UBGraphicsTriangle.h \
src/tools/UBGraphicsProtractor.h \
src/tools/UBGraphicsCompass.h \
src/tools/UBToolsManager.h \
src/tools/UBGraphicsCurtainItem.h \
src/tools/UBGraphicsCurtainItemDelegate.h \
src/tools/UBAbstractDrawRuler.h \
src/tools/UBGraphicsCache.h
SOURCES += src/tools/UBGraphicsRuler.cpp \
src/tools/UBGraphicsTriangle.cpp \
src/tools/UBGraphicsProtractor.cpp \
src/tools/UBGraphicsCompass.cpp \
src/tools/UBToolsManager.cpp \
src/tools/UBGraphicsCurtainItem.cpp \
src/tools/UBGraphicsCurtainItemDelegate.cpp \
src/tools/UBAbstractDrawRuler.cpp \
src/tools/UBGraphicsCache.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