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
e870c310
Commit
e870c310
authored
Apr 11, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
856f3257
896383fd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
192 additions
and
18 deletions
+192
-18
UBSettings.cpp
src/core/UBSettings.cpp
+1
-0
UBSettings.h
src/core/UBSettings.h
+1
-0
UBGraphicsDelegateFrame.cpp
src/domain/UBGraphicsDelegateFrame.cpp
+53
-17
UBGraphicsDelegateFrame.h
src/domain/UBGraphicsDelegateFrame.h
+1
-0
UBGraphicsPixmapItem.cpp
src/domain/UBGraphicsPixmapItem.cpp
+1
-1
WBBrowserWindow.cpp
src/web/browser/WBBrowserWindow.cpp
+128
-0
WBBrowserWindow.h
src/web/browser/WBBrowserWindow.h
+7
-0
No files found.
src/core/UBSettings.cpp
View file @
e870c310
...
@@ -380,6 +380,7 @@ void UBSettings::init()
...
@@ -380,6 +380,7 @@ void UBSettings::init()
swapControlAndDisplayScreens
=
new
UBSetting
(
this
,
"App"
,
"SwapControlAndDisplayScreens"
,
false
);
swapControlAndDisplayScreens
=
new
UBSetting
(
this
,
"App"
,
"SwapControlAndDisplayScreens"
,
false
);
angleTolerance
=
new
UBSetting
(
this
,
"App"
,
"AngleTolerance"
,
4
);
angleTolerance
=
new
UBSetting
(
this
,
"App"
,
"AngleTolerance"
,
4
);
historyLimit
=
new
UBSetting
(
this
,
"Web"
,
"HistoryLimit"
,
15
);
}
}
...
...
src/core/UBSettings.h
View file @
e870c310
...
@@ -327,6 +327,7 @@ class UBSettings : public QObject
...
@@ -327,6 +327,7 @@ class UBSettings : public QObject
UBSetting
*
swapControlAndDisplayScreens
;
UBSetting
*
swapControlAndDisplayScreens
;
UBSetting
*
angleTolerance
;
UBSetting
*
angleTolerance
;
UBSetting
*
historyLimit
;
public
slots
:
public
slots
:
...
...
src/domain/UBGraphicsDelegateFrame.cpp
View file @
e870c310
...
@@ -192,7 +192,7 @@ void UBGraphicsDelegateFrame::initializeTransform()
...
@@ -192,7 +192,7 @@ void UBGraphicsDelegateFrame::initializeTransform()
mAngle
=
topLine
.
angle
();
mAngle
=
topLine
.
angle
();
//
the fact the the lenght
is used we loose the horizontalFlip information
//
the fact the the length
is used we loose the horizontalFlip information
// a better way to do this is using DeltaX that preserve the direction information.
// a better way to do this is using DeltaX that preserve the direction information.
mTotalScaleX
=
(
width
/
itemRect
.
width
())
*
horizontalFlip
;
mTotalScaleX
=
(
width
/
itemRect
.
width
())
*
horizontalFlip
;
mTotalScaleY
=
height
/
itemRect
.
height
()
*
verticalFlip
;
mTotalScaleY
=
height
/
itemRect
.
height
()
*
verticalFlip
;
...
@@ -230,6 +230,22 @@ void UBGraphicsDelegateFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
...
@@ -230,6 +230,22 @@ void UBGraphicsDelegateFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
event
->
accept
();
event
->
accept
();
}
}
bool
UBGraphicsDelegateFrame
::
canResizeBottomRight
(
qreal
width
,
qreal
height
,
qreal
scaleFactor
)
{
bool
res
=
false
;
if
(
!
mMirrorX
&&
!
mMirrorX
&&
((
width
*
scaleFactor
)
>
2
*
mFrameWidth
&&
(
height
*
scaleFactor
)
>
2
*
mFrameWidth
)){
res
=
true
;
}
else
if
(
mMirrorX
&&
!
mMirrorY
&&
(
-
width
*
scaleFactor
)
>
2
*
mFrameWidth
&&
(
height
*
scaleFactor
)
>
2
*
mFrameWidth
){
res
=
true
;
}
else
if
(
!
mMirrorX
&&
mMirrorY
&&
(
width
*
scaleFactor
)
>
2
*
mFrameWidth
&&
(
-
height
*
scaleFactor
)
>
2
*
mFrameWidth
){
res
=
true
;
}
else
if
(
mMirrorX
&&
mMirrorY
&&
(
-
width
*
scaleFactor
)
>
2
*
mFrameWidth
&&
(
-
height
*
scaleFactor
)
>
2
*
mFrameWidth
){
res
=
true
;
}
return
res
;
}
void
UBGraphicsDelegateFrame
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
void
UBGraphicsDelegateFrame
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
{
...
@@ -240,27 +256,33 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -240,27 +256,33 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
qreal
height
=
delegated
()
->
boundingRect
().
height
()
*
mTotalScaleY
;
qreal
height
=
delegated
()
->
boundingRect
().
height
()
*
mTotalScaleY
;
mTranslateX
=
moveX
;
mTranslateX
=
moveX
;
if
(
mOperationMode
==
Scaling
)
if
(
mOperationMode
==
Scaling
)
{
{
// // Hide the buttons
// mDelegate->setButtonsVisible(false);
// mResizing = true;
// Perform the resize
// Perform the resize
if
(
resizingBottomRight
())
if
(
resizingBottomRight
())
{
{
// -----------------------------------------------------
// -----------------------------------------------------
// ! We want to keep the aspect ratio with this resize !
// ! We want to keep the aspect ratio with this resize !
// -----------------------------------------------------
// -----------------------------------------------------
qreal
scaleX
=
(
width
+
moveX
)
/
width
;
qreal
scaleX
;
qreal
scaleY
=
(
height
+
moveY
)
/
height
;
qreal
scaleY
;
if
(
!
mMirrorX
){
scaleX
=
(
width
+
moveX
)
/
width
;
}
else
{
scaleX
=
(
width
-
moveX
)
/
width
;
}
if
(
!
mMirrorY
){
scaleY
=
(
height
+
moveY
)
/
height
;
}
else
{
scaleY
=
(
height
-
moveY
)
/
height
;
}
qreal
scaleFactor
=
(
scaleX
+
scaleY
)
/
2
;
qreal
scaleFactor
=
(
scaleX
+
scaleY
)
/
2
;
// Do not allow resizing of image size under frame size
// Do not allow resizing of image size under frame size
if
(
scaleFactor
>
1
if
(
canResizeBottomRight
(
width
,
height
,
scaleFactor
))
||
((
width
*
scaleFactor
)
>
2
*
mFrameWidth
&&
(
height
*
scaleFactor
)
>
2
*
mFrameWidth
))
{
{
if
(
mRespectRatio
)
if
(
mRespectRatio
)
{
{
...
@@ -285,7 +307,6 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -285,7 +307,6 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if
(
mDelegate
->
isFlippable
()
&&
qAbs
(
scaleX
)
!=
0
){
if
(
mDelegate
->
isFlippable
()
&&
qAbs
(
scaleX
)
!=
0
){
if
((
qAbs
(
width
*
scaleX
))
<
2
*
mFrameWidth
){
if
((
qAbs
(
width
*
scaleX
))
<
2
*
mFrameWidth
){
bool
negative
=
(
scaleX
<
0
)
?
true
:
false
;
bool
negative
=
(
scaleX
<
0
)
?
true
:
false
;
//mMirrorX = (negative?mMirrorX:!mMirrorX);
if
(
negative
){
if
(
negative
){
scaleX
=
-
2
*
mFrameWidth
/
width
;
scaleX
=
-
2
*
mFrameWidth
/
width
;
}
else
{
}
else
{
...
@@ -363,9 +384,6 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -363,9 +384,6 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QSizeF
newSize
=
resizableItem
->
size
()
+
incVector
;
QSizeF
newSize
=
resizableItem
->
size
()
+
incVector
;
// if (newSize.width() < 50 /*0*/ || newSize.height() < /*0*/ 50)
// return;
resizableItem
->
resize
(
newSize
);
resizableItem
->
resize
(
newSize
);
}
}
}
}
...
@@ -417,10 +435,28 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
...
@@ -417,10 +435,28 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
//TODO UB 4.x: Could find a better solution ?
//TODO UB 4.x: Could find a better solution ?
if
(
resizingRight
()
||
resizingBottom
()
||
resizingBottomRight
())
if
(
resizingRight
()
||
resizingBottom
()
||
resizingBottomRight
())
{
{
QPointF
topLeft
=
tr
.
map
(
delegated
()
->
boundingRect
().
topLeft
());
QPointF
ref
;
QPointF
fixedPoint
=
mInitialTransform
.
map
(
delegated
()
->
boundingRect
().
topLeft
());
if
(
!
mMirrorX
&&
!
mMirrorY
){
ref
=
delegated
()
->
boundingRect
().
topLeft
();
}
else
if
(
mMirrorX
&&
!
mMirrorY
){
ref
=
delegated
()
->
boundingRect
().
topRight
();
}
else
if
(
!
mMirrorX
&&
mMirrorY
){
ref
=
delegated
()
->
boundingRect
().
bottomLeft
();
}
else
if
(
mMirrorX
&&
mMirrorY
){
ref
=
delegated
()
->
boundingRect
().
bottomRight
();
}
// Map the item topleft point to the current mouse move transform
QPointF
topLeft
=
tr
.
map
(
ref
);
// Map the item topleft point to the mouse press transform
QPointF
fixedPoint
=
mInitialTransform
.
map
(
ref
);
// Update the translation coordinates
mTranslateX
+=
fixedPoint
.
x
()
-
topLeft
.
x
();
mTranslateX
+=
fixedPoint
.
x
()
-
topLeft
.
x
();
mTranslateY
+=
fixedPoint
.
y
()
-
topLeft
.
y
();
mTranslateY
+=
fixedPoint
.
y
()
-
topLeft
.
y
();
// Update the transform
tr
=
buildTransform
();
tr
=
buildTransform
();
}
}
else
if
(
resizingTop
()
||
resizingLeft
())
else
if
(
resizingTop
()
||
resizingLeft
())
...
...
src/domain/UBGraphicsDelegateFrame.h
View file @
e870c310
...
@@ -65,6 +65,7 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
...
@@ -65,6 +65,7 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
inline
bool
resizingTop
()
const
{
return
mCurrentTool
==
ResizeTop
;
}
inline
bool
resizingTop
()
const
{
return
mCurrentTool
==
ResizeTop
;
}
inline
bool
rotating
()
const
{
return
mCurrentTool
==
Rotate
;
}
inline
bool
rotating
()
const
{
return
mCurrentTool
==
Rotate
;
}
inline
bool
moving
()
const
{
return
mCurrentTool
==
Move
;
}
inline
bool
moving
()
const
{
return
mCurrentTool
==
Move
;
}
bool
canResizeBottomRight
(
qreal
width
,
qreal
height
,
qreal
scaleFactor
);
QTransform
buildTransform
();
QTransform
buildTransform
();
void
updateResizeCursors
();
void
updateResizeCursors
();
...
...
src/domain/UBGraphicsPixmapItem.cpp
View file @
e870c310
...
@@ -32,7 +32,7 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
...
@@ -32,7 +32,7 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
mDelegate
->
init
();
mDelegate
->
init
();
// NOTE: Do not remove this code, I'm just doing a backup of my changes! thx..
// NOTE: Do not remove this code, I'm just doing a backup of my changes! thx..
mDelegate
->
setFlippable
(
true
);
//
mDelegate->setFlippable(true);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setTransformationMode
(
Qt
::
SmoothTransformation
);
setTransformationMode
(
Qt
::
SmoothTransformation
);
...
...
src/web/browser/WBBrowserWindow.cpp
View file @
e870c310
...
@@ -196,6 +196,36 @@ void WBBrowserWindow::setupToolBar()
...
@@ -196,6 +196,36 @@ void WBBrowserWindow::setupToolBar()
mTabWidget
->
addWebAction
(
mUniboardMainWindow
->
actionWebReload
,
QWebPage
::
Reload
);
mTabWidget
->
addWebAction
(
mUniboardMainWindow
->
actionWebReload
,
QWebPage
::
Reload
);
mTabWidget
->
addWebAction
(
mUniboardMainWindow
->
actionStopLoading
,
QWebPage
::
Stop
);
mTabWidget
->
addWebAction
(
mUniboardMainWindow
->
actionStopLoading
,
QWebPage
::
Stop
);
mHistoryBackMenu
=
new
QMenu
(
this
);
connect
(
mHistoryBackMenu
,
SIGNAL
(
aboutToShow
()),
this
,
SLOT
(
aboutToShowBackMenu
()));
connect
(
mHistoryBackMenu
,
SIGNAL
(
triggered
(
QAction
*
)),
this
,
SLOT
(
openActionUrl
(
QAction
*
)));
foreach
(
QWidget
*
menuWidget
,
mUniboardMainWindow
->
actionWebBack
->
associatedWidgets
())
{
QToolButton
*
tb
=
qobject_cast
<
QToolButton
*>
(
menuWidget
);
if
(
tb
&&
!
tb
->
menu
())
{
tb
->
setMenu
(
mHistoryBackMenu
);
tb
->
setStyleSheet
(
"QToolButton::menu-indicator { subcontrol-position: bottom left; }"
);
}
}
mHistoryForwardMenu
=
new
QMenu
(
this
);
connect
(
mHistoryForwardMenu
,
SIGNAL
(
aboutToShow
()),
this
,
SLOT
(
aboutToShowForwardMenu
()));
connect
(
mHistoryForwardMenu
,
SIGNAL
(
triggered
(
QAction
*
)),
this
,
SLOT
(
openActionUrl
(
QAction
*
)));
foreach
(
QWidget
*
menuWidget
,
mUniboardMainWindow
->
actionWebForward
->
associatedWidgets
())
{
QToolButton
*
tb
=
qobject_cast
<
QToolButton
*>
(
menuWidget
);
if
(
tb
&&
!
tb
->
menu
())
{
tb
->
setMenu
(
mHistoryForwardMenu
);
tb
->
setStyleSheet
(
"QToolButton { padding-right: 8px; }"
);
}
}
mWebToolBar
->
insertWidget
(
mUniboardMainWindow
->
actionWebBigger
,
mTabWidget
->
lineEditStack
());
mWebToolBar
->
insertWidget
(
mUniboardMainWindow
->
actionWebBigger
,
mTabWidget
->
lineEditStack
());
mSearchToolBar
=
new
WBToolbarSearch
(
mWebToolBar
);
mSearchToolBar
=
new
WBToolbarSearch
(
mWebToolBar
);
...
@@ -224,6 +254,22 @@ void WBBrowserWindow::setupToolBarForTutorial()
...
@@ -224,6 +254,22 @@ void WBBrowserWindow::setupToolBarForTutorial()
mTabWidget
->
addWebAction
(
mUniboardMainWindow
->
actionWebBack
,
QWebPage
::
Back
);
mTabWidget
->
addWebAction
(
mUniboardMainWindow
->
actionWebBack
,
QWebPage
::
Back
);
mTabWidget
->
addWebAction
(
mUniboardMainWindow
->
actionWebForward
,
QWebPage
::
Forward
);
mTabWidget
->
addWebAction
(
mUniboardMainWindow
->
actionWebForward
,
QWebPage
::
Forward
);
foreach
(
QWidget
*
menuWidget
,
mUniboardMainWindow
->
actionWebBack
->
associatedWidgets
())
{
QToolButton
*
tb
=
qobject_cast
<
QToolButton
*>
(
menuWidget
);
if
(
tb
&&
tb
->
menu
())
tb
->
setMenu
(
NULL
);
}
foreach
(
QWidget
*
menuWidget
,
mUniboardMainWindow
->
actionWebForward
->
associatedWidgets
())
{
QToolButton
*
tb
=
qobject_cast
<
QToolButton
*>
(
menuWidget
);
if
(
tb
&&
tb
->
menu
())
tb
->
setMenu
(
NULL
);
}
// mTabWidget->addWebAction(mUniboardMainWindow->actionWebReload, QWebPage::Reload);
// mTabWidget->addWebAction(mUniboardMainWindow->actionWebReload, QWebPage::Reload);
// mTabWidget->addWebAction(mUniboardMainWindow->actionStopLoading, QWebPage::Stop);
// mTabWidget->addWebAction(mUniboardMainWindow->actionStopLoading, QWebPage::Stop);
...
@@ -534,4 +580,86 @@ void WBBrowserWindow::showTabAtTop(bool attop)
...
@@ -534,4 +580,86 @@ void WBBrowserWindow::showTabAtTop(bool attop)
mTabWidget
->
setTabPosition
(
QTabWidget
::
South
);
mTabWidget
->
setTabPosition
(
QTabWidget
::
South
);
}
}
void
WBBrowserWindow
::
aboutToShowBackMenu
()
{
mHistoryBackMenu
->
clear
();
if
(
!
currentTabWebView
())
return
;
QWebHistory
*
history
=
currentTabWebView
()
->
history
();
int
historyCount
=
history
->
count
();
int
historyLimit
=
history
->
backItems
(
historyCount
).
count
()
-
UBSettings
::
settings
()
->
historyLimit
->
get
().
toReal
();
if
(
historyLimit
<
0
)
historyLimit
=
0
;
for
(
int
i
=
history
->
backItems
(
historyCount
).
count
()
-
1
;
i
>=
historyLimit
;
--
i
)
{
QWebHistoryItem
item
=
history
->
backItems
(
historyCount
).
at
(
i
);
QAction
*
action
=
new
QAction
(
this
);
action
->
setData
(
-
1
*
(
historyCount
-
i
-
1
));
if
(
!
QWebSettings
::
iconForUrl
(
item
.
originalUrl
()).
isNull
())
action
->
setIcon
(
item
.
icon
());
action
->
setText
(
item
.
title
().
isEmpty
()
?
item
.
url
().
toString
()
:
item
.
title
());
mHistoryBackMenu
->
addAction
(
action
);
}
mHistoryBackMenu
->
addSeparator
();
QAction
*
action
=
new
QAction
(
this
);
action
->
setData
(
"clear"
);
action
->
setText
(
"Clear history"
);
mHistoryBackMenu
->
addAction
(
action
);
}
void
WBBrowserWindow
::
aboutToShowForwardMenu
()
{
mHistoryForwardMenu
->
clear
();
if
(
!
currentTabWebView
())
return
;
QWebHistory
*
history
=
currentTabWebView
()
->
history
();
int
historyCount
=
history
->
count
();
int
historyLimit
=
history
->
forwardItems
(
historyCount
).
count
();
if
(
historyLimit
>
UBSettings
::
settings
()
->
historyLimit
->
get
().
toReal
())
historyLimit
=
UBSettings
::
settings
()
->
historyLimit
->
get
().
toReal
();
for
(
int
i
=
0
;
i
<
historyLimit
;
++
i
)
{
QWebHistoryItem
item
=
history
->
forwardItems
(
historyCount
).
at
(
i
);
QAction
*
action
=
new
QAction
(
this
);
action
->
setData
(
historyCount
-
i
);
if
(
!
QWebSettings
::
iconForUrl
(
item
.
originalUrl
()).
isNull
())
action
->
setIcon
(
item
.
icon
());
action
->
setText
(
item
.
title
().
isEmpty
()
?
item
.
url
().
toString
()
:
item
.
title
());
mHistoryForwardMenu
->
addAction
(
action
);
}
mHistoryForwardMenu
->
addSeparator
();
QAction
*
action
=
new
QAction
(
this
);
action
->
setData
(
"clear"
);
action
->
setText
(
"Clear history"
);
mHistoryForwardMenu
->
addAction
(
action
);
}
void
WBBrowserWindow
::
openActionUrl
(
QAction
*
action
)
{
QWebHistory
*
history
=
currentTabWebView
()
->
history
();
if
(
action
->
data
()
==
"clear"
)
{
history
->
clear
();
return
;
}
int
offset
=
action
->
data
().
toInt
();
if
(
offset
<
0
)
history
->
goToItem
(
history
->
backItems
(
-
1
*
offset
).
first
());
else
if
(
offset
>
0
)
history
->
goToItem
(
history
->
forwardItems
(
history
->
count
()
-
offset
+
1
).
back
());
}
\ No newline at end of file
src/web/browser/WBBrowserWindow.h
View file @
e870c310
...
@@ -112,6 +112,10 @@ class WBBrowserWindow : public QWidget
...
@@ -112,6 +112,10 @@ class WBBrowserWindow : public QWidget
void
showTabAtTop
(
bool
attop
);
void
showTabAtTop
(
bool
attop
);
void
aboutToShowBackMenu
();
void
aboutToShowForwardMenu
();
void
openActionUrl
(
QAction
*
action
);
signals
:
signals
:
void
activeViewPageChanged
();
void
activeViewPageChanged
();
void
activeViewChange
(
QWidget
*
);
void
activeViewChange
(
QWidget
*
);
...
@@ -160,6 +164,9 @@ class WBBrowserWindow : public QWidget
...
@@ -160,6 +164,9 @@ class WBBrowserWindow : public QWidget
QString
mLastSearch
;
QString
mLastSearch
;
Ui
::
MainWindow
*
mUniboardMainWindow
;
Ui
::
MainWindow
*
mUniboardMainWindow
;
QMenu
*
mHistoryBackMenu
;
QMenu
*
mHistoryForwardMenu
;
};
};
#endif // WBBROWSERMAINWINDOW_H
#endif // WBBROWSERMAINWINDOW_H
...
...
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