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
4f3b163b
Commit
4f3b163b
authored
Aug 15, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented the desktop mode for Linux
parent
80ceb222
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1005 additions
and
886 deletions
+1005
-886
UBBoardView.cpp
src/board/UBBoardView.cpp
+879
-879
UBDesktopAnnotationController.cpp
src/desktop/UBDesktopAnnotationController.cpp
+106
-1
UBDesktopAnnotationController.h
src/desktop/UBDesktopAnnotationController.h
+4
-0
UBDesktopPalette.cpp
src/desktop/UBDesktopPalette.cpp
+5
-4
UBDesktopPalette.h
src/desktop/UBDesktopPalette.h
+1
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+3
-1
UBFloatingPalette.cpp
src/gui/UBFloatingPalette.cpp
+1
-0
UBFloatingPalette.h
src/gui/UBFloatingPalette.h
+1
-0
UBLibPalette.cpp
src/gui/UBLibPalette.cpp
+2
-1
UBLibPalette.h
src/gui/UBLibPalette.h
+3
-0
No files found.
src/board/UBBoardView.cpp
View file @
4f3b163b
This diff is collapsed.
Click to expand it.
src/desktop/UBDesktopAnnotationController.cpp
View file @
4f3b163b
...
...
@@ -90,6 +90,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mKeyboardPalette
=
UBKeyboardPalette
::
create
(
mTransparentDrawingView
);
mKeyboardPalette
->
setParent
(
mTransparentDrawingView
);
connect
(
mKeyboardPalette
,
SIGNAL
(
keyboardActivated
(
bool
)),
mTransparentDrawingView
,
SLOT
(
virtualKeyboardActivated
(
bool
)));
connect
(
mKeyboardPalette
,
SIGNAL
(
moved
(
QPoint
)),
this
,
SLOT
(
refreshMask
()));
}
connect
(
mDesktopPalette
,
SIGNAL
(
uniboardClick
()),
this
,
SLOT
(
goToUniboard
()));
...
...
@@ -143,12 +144,16 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
connect
(
&
mHoldTimerMarker
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
markerActionReleased
()));
connect
(
&
mHoldTimerEraser
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
eraserActionReleased
()));
connect
(
mDesktopPalette
,
SIGNAL
(
moving
()),
this
,
SLOT
(
refreshMask
()));
connect
(
mLibPalette
,
SIGNAL
(
resized
()),
this
,
SLOT
(
refreshMask
()));
onDesktopPaletteMaximized
();
}
void
UBDesktopAnnotationController
::
showKeyboard
(
bool
show
)
{
mKeyboardPalette
->
setVisible
(
show
);
updateMask
(
true
);
// mDesktopPalette->showVirtualKeyboard(show);
}
...
...
@@ -332,6 +337,10 @@ void UBDesktopAnnotationController::showWindow()
UBPlatformUtils
::
setDesktopMode
(
true
);
mDesktopPalette
->
appear
();
#ifdef Q_WS_X11
updateMask
(
true
);
#endif
}
...
...
@@ -343,7 +352,15 @@ void UBDesktopAnnotationController::close()
void
UBDesktopAnnotationController
::
stylusToolChanged
(
int
tool
)
{
Q_UNUSED
(
tool
);
UBStylusTool
::
Enum
eTool
=
(
UBStylusTool
::
Enum
)
tool
;
mDesktopPalette
->
notifySelectorSelection
(
UBStylusTool
::
Selector
==
eTool
);
if
(
UBStylusTool
::
Selector
!=
eTool
)
{
UBApplication
::
mainWindow
->
actionVirtualKeyboard
->
setChecked
(
false
);
mKeyboardPalette
->
setVisible
(
false
);
}
updateBackground
();
}
...
...
@@ -356,6 +373,9 @@ void UBDesktopAnnotationController::updateBackground()
||
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Selector
)
{
newBrush
=
QBrush
(
Qt
::
transparent
);
#ifdef Q_WS_X11
updateMask
(
true
);
#endif
}
else
{
...
...
@@ -363,6 +383,9 @@ void UBDesktopAnnotationController::updateBackground()
newBrush
=
QBrush
(
QColor
(
127
,
127
,
127
,
15
));
#else
newBrush
=
QBrush
(
QColor
(
127
,
127
,
127
,
1
));
#endif
#ifdef Q_WS_X11
updateMask
(
false
);
#endif
}
...
...
@@ -389,6 +412,8 @@ void UBDesktopAnnotationController::goToUniboard()
UBPlatformUtils
::
setDesktopMode
(
false
);
UBApplication
::
mainWindow
->
actionVirtualKeyboard
->
setEnabled
(
true
);
emit
restoreUniboard
();
}
...
...
@@ -751,3 +776,83 @@ void UBDesktopAnnotationController::onTransparentWidgetResized()
// qDebug() << "mLibPalette (" << mLibPalette->width() << "," << mLibPalette->height() << ")";
mLibPalette
->
resize
(
mLibPalette
->
width
(),
mTransparentDrawingView
->
height
());
}
void
UBDesktopAnnotationController
::
updateMask
(
bool
bTransparent
)
{
if
(
bTransparent
)
{
// Here we have to generate a new mask. This method is certainly resource
// consuming but for the moment this is the only solution that I found.
mMask
=
QPixmap
(
mTransparentDrawingView
->
width
(),
mTransparentDrawingView
->
height
());
QPainter
p
;
p
.
begin
(
&
mMask
);
p
.
setPen
(
Qt
::
red
);
p
.
setBrush
(
QBrush
(
Qt
::
red
));
// Here we draw the widget mask
if
(
mDesktopPalette
->
isVisible
())
{
p
.
drawRect
(
mDesktopPalette
->
geometry
().
x
(),
mDesktopPalette
->
geometry
().
y
(),
mDesktopPalette
->
width
(),
mDesktopPalette
->
height
());
}
if
(
mKeyboardPalette
->
isVisible
())
{
p
.
drawRect
(
mKeyboardPalette
->
geometry
().
x
(),
mKeyboardPalette
->
geometry
().
y
(),
mKeyboardPalette
->
width
(),
mKeyboardPalette
->
height
());
}
if
(
mLibPalette
->
isVisible
())
{
p
.
drawRect
(
mLibPalette
->
geometry
().
x
(),
mLibPalette
->
geometry
().
y
(),
mLibPalette
->
width
(),
mLibPalette
->
height
());
}
p
.
end
();
// Then we add the annotations. We create another painter because we need to
// apply transformations on it for coordinates matching
QPainter
annotationPainter
;
QTransform
trans
;
trans
.
translate
(
mTransparentDrawingView
->
width
()
/
2
,
mTransparentDrawingView
->
height
()
/
2
);
annotationPainter
.
begin
(
&
mMask
);
annotationPainter
.
setPen
(
Qt
::
red
);
annotationPainter
.
setBrush
(
Qt
::
red
);
annotationPainter
.
setTransform
(
trans
);
QList
<
QGraphicsItem
*>
allItems
=
mTransparentDrawingScene
->
items
();
for
(
int
i
=
0
;
i
<
allItems
.
size
();
i
++
)
{
QGraphicsItem
*
pCrntItem
=
allItems
.
at
(
i
);
if
(
pCrntItem
->
isVisible
())
{
QPainterPath
crntPath
=
pCrntItem
->
shape
();
QRectF
rect
=
crntPath
.
boundingRect
();
annotationPainter
.
drawRect
(
rect
);
}
}
annotationPainter
.
end
();
mTransparentDrawingView
->
setMask
(
mMask
.
createMaskFromColor
(
Qt
::
black
));
}
else
{
// Remove the mask
QPixmap
noMask
(
mTransparentDrawingView
->
width
(),
mTransparentDrawingView
->
height
());
mTransparentDrawingView
->
setMask
(
noMask
.
mask
());
}
}
void
UBDesktopAnnotationController
::
refreshMask
()
{
if
(
mIsFullyTransparent
||
UBDrawingController
::
drawingController
()
->
stylusTool
()
==
UBStylusTool
::
Selector
)
{
updateMask
(
true
);
}
}
src/desktop/UBDesktopAnnotationController.h
View file @
4f3b163b
...
...
@@ -94,10 +94,12 @@ class UBDesktopAnnotationController : public QObject
void
onDesktopPaletteMaximized
();
void
onDesktopPaletteMinimize
();
void
onTransparentWidgetResized
();
void
refreshMask
();
private
:
void
setAssociatedPalettePosition
(
UBActionPalette
*
palette
,
const
QString
&
actionName
);
void
togglePropertyPalette
(
UBActionPalette
*
palette
);
void
updateMask
(
bool
bTransparent
);
UBDesktopPalette
*
mDesktopPalette
;
UBKeyboardPalette
*
mKeyboardPalette
;
...
...
@@ -126,6 +128,8 @@ class UBDesktopAnnotationController : public QObject
int
mBoardStylusTool
;
int
mDesktopStylusTool
;
QPixmap
mMask
;
};
#endif
/* UBUNINOTESWINDOWCONTROLLER_H_ */
src/desktop/UBDesktopPalette.cpp
View file @
4f3b163b
...
...
@@ -36,9 +36,7 @@ UBDesktopPalette::UBDesktopPalette(QWidget *parent)
actions
<<
UBApplication
::
mainWindow
->
actionPen
;
actions
<<
UBApplication
::
mainWindow
->
actionEraser
;
actions
<<
UBApplication
::
mainWindow
->
actionMarker
;
#ifndef Q_WS_X11
actions
<<
UBApplication
::
mainWindow
->
actionSelector
;
#endif
actions
<<
UBApplication
::
mainWindow
->
actionPointer
;
if
(
UBPlatformUtils
::
hasVirtualKeyboard
())
...
...
@@ -152,9 +150,7 @@ void UBDesktopPalette::maximizeMe()
actions
<<
UBApplication
::
mainWindow
->
actionPen
;
actions
<<
UBApplication
::
mainWindow
->
actionEraser
;
actions
<<
UBApplication
::
mainWindow
->
actionMarker
;
#ifndef Q_WS_X11
actions
<<
UBApplication
::
mainWindow
->
actionSelector
;
#endif
actions
<<
UBApplication
::
mainWindow
->
actionPointer
;
if
(
UBPlatformUtils
::
hasVirtualKeyboard
())
actions
<<
UBApplication
::
mainWindow
->
actionVirtualKeyboard
;
...
...
@@ -221,3 +217,8 @@ QPoint UBDesktopPalette::buttonPos(QAction *action)
return
p
;
}
void
UBDesktopPalette
::
notifySelectorSelection
(
bool
selected
)
{
UBApplication
::
mainWindow
->
actionVirtualKeyboard
->
setEnabled
(
selected
);
}
src/desktop/UBDesktopPalette.h
View file @
4f3b163b
...
...
@@ -27,6 +27,7 @@ class UBDesktopPalette : public UBActionPalette
void
disappearForCapture
();
void
appear
();
QPoint
buttonPos
(
QAction
*
action
);
void
notifySelectorSelection
(
bool
selected
);
signals
:
void
uniboardClick
();
...
...
src/domain/UBGraphicsScene.cpp
View file @
4f3b163b
...
...
@@ -249,6 +249,8 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
{
if
(
currentTool
==
UBStylusTool
::
Line
)
{
// TODO: Verify this beautiful implementation and check if
// it is possible to optimize it
QLineF
radius
(
mPreviousPoint
,
position
);
qreal
angle
=
radius
.
angle
();
angle
=
qRound
(
angle
/
45
)
*
45
;
...
...
@@ -257,7 +259,7 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
mPreviousPoint
.
x
()
+
radiusLength
*
cos
((
angle
*
PI
)
/
180
),
mPreviousPoint
.
y
()
-
radiusLength
*
sin
((
angle
*
PI
)
/
180
));
QLineF
chord
(
position
,
newPosition
);
if
(
chord
.
length
()
<
qMin
((
int
)
16
,
(
int
)(
radiusLength
/
20
)))
if
(
chord
.
length
()
<
qMin
((
int
)
16
,
(
int
)(
radiusLength
/
20
)))
position
=
newPosition
;
}
...
...
src/gui/UBFloatingPalette.cpp
View file @
4f3b163b
...
...
@@ -106,6 +106,7 @@ void UBFloatingPalette::mouseMoveEvent(QMouseEvent *event)
{
moveInsideParent
(
event
->
globalPos
()
-
mDragPosition
);
event
->
accept
();
emit
moving
();
}
else
{
...
...
src/gui/UBFloatingPalette.h
View file @
4f3b163b
...
...
@@ -78,6 +78,7 @@ class UBFloatingPalette : public QWidget
void
minimizeStart
(
eMinimizedLocation
location
);
void
maximizeStart
();
void
maximized
();
void
moving
();
};
...
...
src/gui/UBLibPalette.cpp
View file @
4f3b163b
...
...
@@ -34,7 +34,7 @@ UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(pare
mIcon
=
QPixmap
(
":images/paletteLibrary.png"
);
setAcceptDrops
(
true
);
resize
(
UBSettings
::
settings
()
->
libPaletteWidth
->
get
().
toInt
(),
height
());
resize
(
UBSettings
::
settings
()
->
libPaletteWidth
->
get
().
toInt
(),
parentWidget
()
->
height
());
setContentsMargins
(
border
(),
0
,
0
,
0
);
mCollapseWidth
=
180
;
mLastWidth
=
300
;
...
...
@@ -201,6 +201,7 @@ void UBLibPalette::resizeEvent(QResizeEvent *event)
{
UBDockPalette
::
resizeEvent
(
event
);
UBSettings
::
settings
()
->
libPaletteWidth
->
set
(
width
());
emit
resized
();
}
// --------------------------------------------------------------------------
...
...
src/gui/UBLibPalette.h
View file @
4f3b163b
...
...
@@ -55,6 +55,9 @@ public:
UBLibActionBar
*
actionBar
(){
return
mActionBar
;}
signals
:
void
resized
();
protected
:
void
updateMaxWidth
();
void
dragEnterEvent
(
QDragEnterEvent
*
pEvent
);
...
...
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