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
1fc6a86b
Commit
1fc6a86b
authored
Dec 26, 2011
by
Ivan Ilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sankore 396 444-446
parent
45ec8db8
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
487 additions
and
196 deletions
+487
-196
Sankore_3.1.pro
Sankore_3.1.pro
+2
-1
tab_mask.png
resources/images/tab_mask.png
+0
-0
sankore.qrc
resources/sankore.qrc
+1
-0
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+3
-3
UBSettings.cpp
src/core/UBSettings.cpp
+2
-2
UBDesktopAnnotationController.cpp
src/desktop/UBDesktopAnnotationController.cpp
+10
-6
UBDesktopPalette.cpp
src/desktop/UBDesktopPalette.cpp
+0
-1
UBDocumentController.cpp
src/document/UBDocumentController.cpp
+1
-1
UBDockPalette.cpp
src/gui/UBDockPalette.cpp
+420
-167
UBDockPalette.h
src/gui/UBDockPalette.h
+39
-6
UBLeftPalette.cpp
src/gui/UBLeftPalette.cpp
+5
-5
UBRightPalette.cpp
src/gui/UBRightPalette.cpp
+3
-4
WBBrowserWindow.cpp
src/web/browser/WBBrowserWindow.cpp
+1
-0
No files found.
Sankore_3.1.pro
View file @
1fc6a86b
...
...
@@ -4,7 +4,8 @@ TEMPLATE = app
THIRD_PARTY_PATH
=../
Sankore
-
ThirdParty
CONFIG
+=
debug_and_release
\
no_include_pwd
no_include_pwd
\
link_prl
VERSION_MAJ
=
1
VERSION_MIN
=
40
...
...
resources/images/tab_mask.png
0 → 100644
View file @
1fc6a86b
137 Bytes
resources/sankore.qrc
View file @
1fc6a86b
...
...
@@ -337,5 +337,6 @@
<file>images/libpalette/WebSearchCategory.svg</file>
<file>images/download_close.png</file>
<file>images/download_open.png</file>
<file>images/tab_mask.png</file>
</qresource>
</RCC>
src/board/UBBoardPaletteManager.cpp
View file @
1fc6a86b
...
...
@@ -727,7 +727,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
case
eUBDockPaletteWidget_BOARD
:
{
mLeftPalette
->
setParent
(
UBApplication
::
boardController
->
controlContainer
());
mRightPalette
->
set
Parent
(
UBApplication
::
boardController
->
controlContainer
());
mRightPalette
->
assign
Parent
(
UBApplication
::
boardController
->
controlContainer
());
if
(
UBPlatformUtils
::
hasVirtualKeyboard
()
&&
mKeyboardPalette
!=
NULL
)
{
...
...
@@ -752,7 +752,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
case
eUBDockPaletteWidget_DESKTOP
:
{
mLeftPalette
->
setParent
((
QWidget
*
)
UBApplication
::
applicationController
->
uninotesController
()
->
drawingView
());
mRightPalette
->
set
Parent
((
QWidget
*
)
UBApplication
::
applicationController
->
uninotesController
()
->
drawingView
());
mRightPalette
->
assign
Parent
((
QWidget
*
)
UBApplication
::
applicationController
->
uninotesController
()
->
drawingView
());
if
(
UBPlatformUtils
::
hasVirtualKeyboard
()
&&
mKeyboardPalette
!=
NULL
)
{
...
...
@@ -802,7 +802,7 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
mLeftPalette
->
setVisible
(
false
);
mRightPalette
->
setVisible
(
false
);
mLeftPalette
->
setParent
(
0
);
mRightPalette
->
set
Parent
(
0
);
mRightPalette
->
assign
Parent
(
0
);
if
(
UBPlatformUtils
::
hasVirtualKeyboard
()
&&
mKeyboardPalette
!=
NULL
)
{
...
...
src/core/UBSettings.cpp
View file @
1fc6a86b
...
...
@@ -194,8 +194,8 @@ void UBSettings::init()
appEnableAutomaticSoftwareUpdates
=
new
UBSetting
(
this
,
"App"
,
"EnableAutomaticSoftwareUpdates"
,
true
);
appEnableSoftwareUpdates
=
new
UBSetting
(
this
,
"App"
,
"EnableSoftwareUpdates"
,
true
);
appToolBarOrientationVertical
=
new
UBSetting
(
this
,
"App"
,
"ToolBarOrientationVertical"
,
false
);
navigPaletteWidth
=
new
UBSetting
(
this
,
"Board"
,
"NavigPaletteWidth"
,
30
0
);
libPaletteWidth
=
new
UBSetting
(
this
,
"Board"
,
"LibPaletteWidth"
,
30
0
);
navigPaletteWidth
=
new
UBSetting
(
this
,
"Board"
,
"NavigPaletteWidth"
,
27
0
);
libPaletteWidth
=
new
UBSetting
(
this
,
"Board"
,
"LibPaletteWidth"
,
27
0
);
appIsInSoftwareUpdateProcess
=
new
UBSetting
(
this
,
"App"
,
"IsInSoftwareUpdateProcess"
,
false
);
appLastSessionDocumentUUID
=
new
UBSetting
(
this
,
"App"
,
"LastSessionDocumentUUID"
,
""
);
...
...
src/desktop/UBDesktopAnnotationController.cpp
View file @
1fc6a86b
...
...
@@ -900,7 +900,7 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
{
if
(
bTransparent
)
{
// Here we have to generate a new mask
.
This method is certainly resource
// 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
());
...
...
@@ -922,13 +922,17 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
UBApplication
::
boardController
->
paletteManager
()
->
mKeyboardPalette
->
width
(),
UBApplication
::
boardController
->
paletteManager
()
->
mKeyboardPalette
->
height
());
}
// UBApplication::boardController->paletteManager()->mDesktopRightPalette
if
(
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
isVisible
())
{
p
.
drawRect
(
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
geometry
().
x
(),
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
geometry
().
y
(),
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
width
(),
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
height
());
QRect
rightPalette
(
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
geometry
().
x
(),
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
geometry
().
y
(),
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
width
(),
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
height
());
QRect
tabsPalette
(
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
getTabPaletteRect
());
p
.
drawRect
(
rightPalette
);
p
.
drawRect
(
tabsPalette
);
}
p
.
end
();
...
...
src/desktop/UBDesktopPalette.cpp
View file @
1fc6a86b
...
...
@@ -111,7 +111,6 @@ void UBDesktopPalette::updateShowHideState(bool pShowEnabled)
mShowHideAction
->
setToolTip
(
tr
(
"Show Board on Secondary Screen"
));
else
mShowHideAction
->
setToolTip
(
tr
(
"Show Desktop on Secondary Screen"
));
}
...
...
src/document/UBDocumentController.cpp
View file @
1fc6a86b
...
...
@@ -1455,7 +1455,7 @@ bool UBDocumentController::isOKToOpenDocument(UBDocumentProxy* proxy)
QString
docVersion
=
proxy
->
metaData
(
UBSettings
::
documentVersion
).
toString
();
if
(
docVersion
.
isEmpty
()
||
docVersion
.
startsWith
(
"4.1"
)
||
docVersion
.
startsWith
(
"4.2"
)
||
docVersion
.
startsWith
(
"4.3"
)
||
docVersion
.
startsWith
(
"4.4"
))
// TODO UB 4.7 update if necessary
||
docVersion
.
startsWith
(
"4.3"
)
||
docVersion
.
startsWith
(
"4.4"
)
||
docVersion
.
startsWith
(
"4.5"
)
)
// TODO UB 4.7 update if necessary
{
return
true
;
}
...
...
src/gui/UBDockPalette.cpp
View file @
1fc6a86b
...
...
@@ -41,6 +41,7 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
,
mpStackWidget
(
NULL
)
,
mpLayout
(
NULL
)
,
mCurrentTab
(
0
)
,
mTabPalette
(
new
UBTabDockPalete
(
this
,
parent
))
{
setObjectName
(
name
);
...
...
@@ -54,7 +55,7 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
mTabWidgets
.
clear
();
// We let 2 pixels in order to keep a small border for the resizing
setMinimumWidth
(
2
*
border
()
+
2
);
setMinimumWidth
(
/*2*border() + 2*/
0
);
if
(
parent
)
{
...
...
@@ -93,6 +94,10 @@ UBDockPalette::~UBDockPalette()
delete
mpLayout
;
mpLayout
=
NULL
;
}
if
(
NULL
!=
mTabPalette
)
{
delete
mTabPalette
;
mTabPalette
=
NULL
;
}
}
/**
...
...
@@ -123,139 +128,139 @@ void UBDockPalette::setOrientation(eUBDockOrientation orientation)
setMaximumWidth
(
parentWidget
()
->
width
());
setMinimumWidth
(
maximumWidth
());
}
}
/**
* \brief Handle the mouse move event
* @param as the mouse event
*/
void
UBDockPalette
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
QPoint
p
=
event
->
pos
();
if
(
mCanResize
&&
((
mMousePressPos
-
p
).
manhattanLength
()
>
QApplication
::
startDragDistance
()))
{
switch
(
mOrientation
)
{
case
eUBDockOrientation_Left
:
if
(
p
.
x
()
<
collapseWidth
()
&&
p
.
x
()
>=
minimumWidth
())
{
resize
(
border
(),
height
());
mLastWidth
=
collapseWidth
()
+
1
;
mResized
=
true
;
}
else
if
(
p
.
x
()
<=
maximumWidth
()
&&
p
.
x
()
>=
minimumWidth
())
{
resize
(
p
.
x
(),
height
());
mResized
=
true
;
}
break
;
case
eUBDockOrientation_Right
:
if
((
this
->
x
()
+
p
.
x
()
>
parentWidget
()
->
width
()
-
collapseWidth
())
&&
(
this
->
x
()
+
p
.
x
()
<
parentWidget
()
->
width
()))
{
resize
(
border
(),
height
());
mLastWidth
=
collapseWidth
()
+
1
;
mResized
=
true
;
}
else
if
((
this
->
x
()
+
p
.
x
()
>=
parentWidget
()
->
width
()
-
maximumWidth
())
&&
(
this
->
x
()
+
p
.
x
()
<=
parentWidget
()
->
width
()
-
this
->
minimumWidth
()))
{
resize
(
parentWidget
()
->
width
()
-
(
this
->
x
()
+
p
.
x
()),
height
());
mResized
=
true
;
}
break
;
case
eUBDockOrientation_Top
:
case
eUBDockOrientation_Bottom
:
if
(
p
.
y
()
<=
maximumHeight
())
{
resize
(
width
(),
p
.
y
());
mResized
=
true
;
}
break
;
default
:
break
;
}
}
}
//void UBDockPalette::mouseMoveEvent(QMouseEvent *event)
//{
// QPoint p = event->pos();
// if(mCanResize && ((mMousePressPos - p).manhattanLength() > QApplication::startDragDistance()))
// {
// switch(mOrientation)
// {
// case eUBDockOrientation_Left:
// if(p.x() < collapseWidth() && p.x() >= minimumWidth())
// {
// resize(border(), height());
// mLastWidth = collapseWidth() + 1;
// mResized = true;
// }
// else if(p.x() <= maximumWidth() && p.x() >= minimumWidth())
// {
// resize(p.x(), height());
// mResized = true;
// }
// break;
// case eUBDockOrientation_Right:
// if((this->x() + p.x() > parentWidget()->width() - collapseWidth()) && (this->x() + p.x() < parentWidget()->width()))
// {
// resize(border(), height());
// mLastWidth = collapseWidth() + 1;
// mResized = true;
// }
// else if((this->x() + p.x() >= parentWidget()->width() - maximumWidth()) && (this->x() + p.x() <= parentWidget()->width() - this->minimumWidth()))
// {
// resize(parentWidget()->width() - (this->x() + p.x()), height());
// mResized = true;
// }
// break;
// case eUBDockOrientation_Top:
// case eUBDockOrientation_Bottom:
// if(p.y() <= maximumHeight())
// {
// resize(width(), p.y());
// mResized = true;
// }
// break;
// default:
// break;
// }
// }
//}
/**
* \brief Handle the mouse press event
* @param as the mouse event
*/
void
UBDockPalette
::
mousePressEvent
(
QMouseEvent
*
event
)
{
mClickTime
=
QTime
::
currentTime
();
// The goal here is to verify if the user can resize the widget.
// It is only possible to resize it if the border is selected
QPoint
p
=
event
->
pos
();
mMousePressPos
=
p
;
mResized
=
false
;
switch
(
mOrientation
)
{
case
eUBDockOrientation_Left
:
if
((
p
.
x
()
>=
width
()
-
2
*
border
())
&&
(
p
.
x
()
<=
width
()))
{
mCanResize
=
true
;
}
break
;
case
eUBDockOrientation_Right
:
if
((
p
.
x
()
>=
0
)
&&
(
p
.
x
()
<=
2
*
border
()))
{
mCanResize
=
true
;
}
break
;
case
eUBDockOrientation_Top
:
// Not supported yet
break
;
case
eUBDockOrientation_Bottom
:
// Not supported yet
break
;
default
:
break
;
}
}
//
void UBDockPalette::mousePressEvent(QMouseEvent *event)
//
{
//
mClickTime = QTime::currentTime();
//
// The goal here is to verify if the user can resize the widget.
//
// It is only possible to resize it if the border is selected
//
QPoint p = event->pos();
//
mMousePressPos = p;
//
mResized = false;
//
switch(mOrientation)
//
{
//
case eUBDockOrientation_Left:
//
if((p.x() >= width() - 2 * border()) && (p.x() <= width()))
//
{
//
mCanResize = true;
//
}
//
break;
//
case eUBDockOrientation_Right:
//
if((p.x() >= 0) && (p.x() <= 2 * border()))
//
{
//
mCanResize = true;
//
}
//
break;
//
case eUBDockOrientation_Top:
//
// Not supported yet
//
break;
//
case eUBDockOrientation_Bottom:
//
// Not supported yet
//
break;
//
default:
//
break;
//
}
//
}
/**
* \brief Handle the mouse release event
* @param event as the mouse event
*/
void
UBDockPalette
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
if
(
!
mResized
&&
mClickTime
.
elapsed
()
<
CLICKTIME
)
{
int
nbTabs
=
mTabWidgets
.
size
();
int
clickedTab
=
0
;
// If the clicked position is in the tab, perform the related action
if
(
eUBDockOrientation_Left
==
mOrientation
)
{
if
(
mMousePressPos
.
x
()
>=
width
()
-
2
*
border
()
&&
mMousePressPos
.
y
()
>=
mHTab
&&
mMousePressPos
.
x
()
<=
width
()
&&
mMousePressPos
.
y
()
<=
mHTab
+
nbTabs
*
TABSIZE
+
(
nbTabs
-
1
)
*
tabSpacing
())
{
clickedTab
=
(
mMousePressPos
.
y
()
-
mHTab
)
/
(
TABSIZE
+
tabSpacing
());
tabClicked
(
clickedTab
);
}
}
else
if
(
eUBDockOrientation_Right
==
mOrientation
)
{
if
(
mMousePressPos
.
x
()
>=
0
&&
mMousePressPos
.
x
()
<=
2
*
border
()
&&
mMousePressPos
.
y
()
>=
mHTab
&&
mMousePressPos
.
y
()
<=
mHTab
+
nbTabs
*
TABSIZE
+
(
nbTabs
-
1
)
*
tabSpacing
())
{
clickedTab
=
(
mMousePressPos
.
y
()
-
mHTab
)
/
(
TABSIZE
+
tabSpacing
());
tabClicked
(
clickedTab
);
}
}
}
mCanResize
=
false
;
}
//
void UBDockPalette::mouseReleaseEvent(QMouseEvent *event)
//
{
//
Q_UNUSED(event);
//
if(!mResized && mClickTime.elapsed() < CLICKTIME)
//
{
//
int nbTabs = mTabWidgets.size();
//
int clickedTab = 0;
//
// If the clicked position is in the tab, perform the related action
//
if(eUBDockOrientation_Left == mOrientation)
//
{
//
if(mMousePressPos.x() >= width() - 2*border() &&
//
mMousePressPos.y() >= mHTab &&
//
mMousePressPos.x() <= width() &&
//
mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing())
//
{
//
clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing());
//
tabClicked(clickedTab);
//
}
//
}
//
else if(eUBDockOrientation_Right == mOrientation)
//
{
//
if(mMousePressPos.x() >= 0 &&
//
mMousePressPos.x() <= 2*border() &&
//
mMousePressPos.y() >= mHTab &&
//
mMousePressPos.y() <= mHTab + nbTabs*TABSIZE + (nbTabs -1)*tabSpacing())
//
{
//
clickedTab = (mMousePressPos.y() - mHTab)/(TABSIZE+tabSpacing());
//
tabClicked(clickedTab);
//
}
//
}
//
}
//
mCanResize = false;
//
}
/**
* \brief Handle the resize event
...
...
@@ -288,6 +293,7 @@ void UBDockPalette::resizeEvent(QResizeEvent *event)
break
;
}
move
(
origin
.
x
(),
origin
.
y
());
moveTabs
();
}
/**
...
...
@@ -332,11 +338,11 @@ void UBDockPalette::paintEvent(QPaintEvent *event)
// First draw the BIG RECTANGLE (I write it big because the rectangle is big...)
if
(
mOrientation
==
eUBDockOrientation_Left
)
{
path
.
addRect
(
0.0
,
0.0
,
width
()
-
2
*
border
()
,
height
());
path
.
addRect
(
0.0
,
0.0
,
width
(),
height
());
}
else
if
(
mOrientation
==
eUBDockOrientation_Right
)
{
path
.
addRect
(
2
*
border
(),
0.0
,
width
()
-
2
*
border
(),
height
());
path
.
addRect
(
0.0
,
0.0
,
width
(),
height
());
}
// THEN DRAW THE small tabs (yes, the tabs are small...)
...
...
@@ -348,52 +354,53 @@ void UBDockPalette::paintEvent(QPaintEvent *event)
{
mHTab
=
height
()
-
border
()
-
nbTabs
*
TABSIZE
-
(
nbTabs
-
1
)
*
tabSpacing
();
}
for
(
int
i
=
0
;
i
<
mTabWidgets
.
size
();
i
++
)
{
UBDockPaletteWidget
*
pCrntWidget
=
mTabWidgets
.
at
(
i
);
if
(
NULL
!=
pCrntWidget
)
{
if
(
mOrientation
==
eUBDockOrientation_Left
)
{
path
.
addRoundedRect
(
width
()
-
4
*
border
(),
mHTab
+
i
*
TABSIZE
+
i
*
tabSpacing
(),
4
*
border
(),
TABSIZE
,
radius
(),
radius
());
painter
.
drawPath
(
path
);
QPixmap
iconPixmap
;
if
(
mCollapseWidth
>=
width
())
{
// Get the collapsed icon
iconPixmap
=
pCrntWidget
->
iconToRight
();
}
else
{
// Get the expanded icon
iconPixmap
=
pCrntWidget
->
iconToLeft
();
}
painter
.
drawPixmap
(
width
()
-
2
*
border
()
+
1
,
mHTab
+
i
*
TABSIZE
+
i
*
tabSpacing
()
+
1
,
2
*
border
()
-
4
,
TABSIZE
-
2
,
iconPixmap
);
}
else
if
(
mOrientation
==
eUBDockOrientation_Right
)
{
path
.
addRoundedRect
(
0.0
,
mHTab
+
i
*
TABSIZE
+
i
*
tabSpacing
(),
4
*
border
(),
TABSIZE
,
radius
(),
radius
());
painter
.
drawPath
(
path
);
QPixmap
iconPixmap
;
if
(
mCollapseWidth
>=
width
())
{
// Get the collapsed icon
iconPixmap
=
pCrntWidget
->
iconToLeft
();
}
else
{
// Get the expanded icon
iconPixmap
=
pCrntWidget
->
iconToRight
();
}
painter
.
drawPixmap
(
2
,
mHTab
+
i
*
TABSIZE
+
i
*
tabSpacing
()
+
1
,
2
*
border
()
-
4
,
TABSIZE
-
2
,
iconPixmap
);
}
else
{
painter
.
drawRoundedRect
(
border
(),
border
(),
width
()
-
2
*
border
(),
height
()
-
2
*
border
(),
radius
(),
radius
());
}
}
}
painter
.
drawPath
(
path
);
// for(int i = 0; i < mTabWidgets.size(); i++)
// {
// UBDockPaletteWidget* pCrntWidget = mTabWidgets.at(i);
// if(NULL != pCrntWidget)
// {
// if(mOrientation == eUBDockOrientation_Left)
// {
// path.addRoundedRect(width()-4*border(), mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius());
// painter.drawPath(path);
// QPixmap iconPixmap;
// if(mCollapseWidth >= width())
// {
// // Get the collapsed icon
// iconPixmap = pCrntWidget->iconToRight();
// }
// else
// {
// // Get the expanded icon
// iconPixmap = pCrntWidget->iconToLeft();
// }
// painter.drawPixmap(width() - 2*border() + 1, mHTab + i*TABSIZE + i*tabSpacing() + 1 , 2*border() - 4, TABSIZE - 2, iconPixmap);
// }
// else if(mOrientation == eUBDockOrientation_Right)
// {
// path.addRoundedRect(0.0, mHTab + i*TABSIZE + i*tabSpacing(), 4*border(), TABSIZE, radius(), radius());
// painter.drawPath(path);
// QPixmap iconPixmap;
// if(mCollapseWidth >= width())
// {
// // Get the collapsed icon
// iconPixmap = pCrntWidget->iconToLeft();
// }
// else
// {
// // Get the expanded icon
// iconPixmap = pCrntWidget->iconToRight();
// }
// painter.drawPixmap(2, mHTab + i*TABSIZE + i*tabSpacing() + 1, 2*border() - 4, TABSIZE - 2, iconPixmap);
// }
// else
// {
// painter.drawRoundedRect(border(), border(), width() - 2 * border(), height() - 2 * border(), radius(), radius());
// }
// }
// }
}
}
...
...
@@ -460,6 +467,7 @@ void UBDockPalette::tabClicked(int tabIndex)
{
toggleCollapseExpand
();
}
mTabPalette
->
update
();
}
/**
...
...
@@ -493,7 +501,7 @@ void UBDockPalette::toggleCollapseExpand()
{
// The palette must be collapsed
mLastWidth
=
width
();
resize
(
2
*
border
()
,
height
());
resize
(
0
,
height
());
}
else
{
...
...
@@ -550,6 +558,7 @@ void UBDockPalette::addTab(UBDockPaletteWidget *widget)
mTabWidgets
.
append
(
widget
);
mpStackWidget
->
addWidget
(
widget
);
mpStackWidget
->
setCurrentWidget
(
widget
);
resizeTabs
();
update
();
}
}
...
...
@@ -571,6 +580,8 @@ void UBDockPalette::removeTab(const QString &widgetName)
break
;
}
}
resizeTabs
();
mCurrentTab
=
qMax
(
mCurrentTab
-
1
,
0
);
}
/**
...
...
@@ -666,3 +677,245 @@ void UBDockPalette::onAllDownloadsFinished()
}
}
}
void
UBDockPalette
::
moveTabs
()
{
if
(
!
mHTab
)
{
if
(
eUBDockTabOrientation_Up
==
mTabsOrientation
)
{
mHTab
=
border
();
}
else
{
mHTab
=
height
()
-
border
()
-
mTabWidgets
.
size
()
*
TABSIZE
-
(
mTabWidgets
.
size
()
-
1
)
*
tabSpacing
();
}
}
QPoint
origin
(
width
(),
mHTab
);
switch
(
mOrientation
)
{
case
eUBDockOrientation_Left
:
origin
.
setX
(
width
());
break
;
case
eUBDockOrientation_Right
:
if
(
parentWidget
())
{
origin
.
setX
(
parentWidget
()
->
width
()
-
width
()
-
mTabPalette
->
width
());
}
break
;
case
eUBDockOrientation_Top
:
;
case
eUBDockOrientation_Bottom
:
;
}
mTabPalette
->
move
(
origin
.
x
(),
origin
.
y
());
}
void
UBDockPalette
::
resizeTabs
()
{
int
numTabs
=
mTabWidgets
.
size
();
mTabPalette
->
resize
(
2
*
border
(),
(
numTabs
*
TABSIZE
)
+
qMax
(
numTabs
-
1
,
0
)
*
tabSpacing
());
}
QRect
UBDockPalette
::
getTabPaletteRect
()
{
QRect
tabsRect
=
mTabPalette
->
rect
();
QPoint
topLeft
=
mTabPalette
->
mapToParent
(
tabsRect
.
topLeft
());
QPoint
bottomRight
=
mTabPalette
->
mapToParent
(
tabsRect
.
bottomRight
());
return
QRect
(
topLeft
,
bottomRight
);
}
void
UBDockPalette
::
assignParent
(
QWidget
*
widget
)
{
setParent
(
widget
);
mTabPalette
->
setParent
(
widget
);
}
void
UBDockPalette
::
setVisible
(
bool
visible
)
{
QWidget
::
setVisible
(
visible
);
mTabPalette
->
setVisible
(
visible
);
}
UBTabDockPalete
::
UBTabDockPalete
(
UBDockPalette
*
dockPalette
,
QWidget
*
parent
)
:
QWidget
(
parent
)
,
dock
(
dockPalette
)
{
int
numTabs
=
dock
->
mTabWidgets
.
size
();
resize
(
2
*
dock
->
border
(),
(
numTabs
*
TABSIZE
)
+
qMax
(
numTabs
-
1
,
0
)
*
dock
->
tabSpacing
());
// move(dock->width(), 20);
setAttribute
(
Qt
::
WA_TranslucentBackground
);
}
void
UBTabDockPalete
::
paintEvent
(
QPaintEvent
*/
*
event
*/
)
{
int
nTabs
=
dock
->
mTabWidgets
.
size
();
if
(
nTabs
<=
0
)
{
qDebug
()
<<
"not enough tabs"
;
return
;
}
QPainter
painter
(
this
);
painter
.
setRenderHint
(
QPainter
::
Antialiasing
);
painter
.
setPen
(
Qt
::
NoPen
);
painter
.
setBrush
(
dock
->
mBackgroundBrush
);
int
yFrom
=
0
;
for
(
int
i
=
0
;
i
<
nTabs
;
i
++
)
{
UBDockPaletteWidget
*
pCrntWidget
=
dock
->
mTabWidgets
.
at
(
i
);
QPainterPath
path
;
path
.
setFillRule
(
Qt
::
WindingFill
);
QPixmap
iconPixmap
;
switch
(
dock
->
mOrientation
)
{
case
eUBDockOrientation_Left
:
path
.
addRect
(
0
,
yFrom
,
width
()
/
2
,
TABSIZE
);
path
.
addRoundedRect
(
0
,
yFrom
,
width
(),
TABSIZE
,
dock
->
radius
(),
dock
->
radius
());
if
(
pCrntWidget
)
{
if
(
dock
->
mCollapseWidth
>=
dock
->
width
())
{
// Get the collapsed icon
iconPixmap
=
pCrntWidget
->
iconToRight
();
}
else
{
// Get the expanded icon
iconPixmap
=
pCrntWidget
->
iconToLeft
();
}
}
break
;
case
eUBDockOrientation_Right
:
path
.
addRect
(
width
()
/
2
,
yFrom
,
width
()
/
2
,
TABSIZE
);
path
.
addRoundedRect
(
0
,
yFrom
,
width
(),
TABSIZE
,
dock
->
radius
(),
dock
->
radius
());
if
(
pCrntWidget
)
{
if
(
dock
->
mCollapseWidth
>=
dock
->
width
())
{
// Get the collapsed icon
iconPixmap
=
pCrntWidget
->
iconToLeft
();
}
else
{
// Get the expanded icon
iconPixmap
=
pCrntWidget
->
iconToRight
();
}
}
break
;
case
eUBDockOrientation_Top
:
;
case
eUBDockOrientation_Bottom
:
;
default
:
break
;
}
painter
.
save
();
QPixmap
transparencyPix
(
":/images/tab_mask.png"
);
if
(
dock
->
mCurrentTab
!=
i
)
{
iconPixmap
.
setAlphaChannel
(
transparencyPix
);
QColor
color
(
0x7F
,
0x7F
,
0x7F
,
0x3F
);
painter
.
setBrush
(
QBrush
(
color
));
}
painter
.
drawPath
(
path
);
painter
.
drawPixmap
(
2
,
yFrom
+
2
,
width
()
-
4
,
TABSIZE
-
4
,
iconPixmap
);
yFrom
+=
(
TABSIZE
+
dock
->
tabSpacing
());
painter
.
restore
();
}
}
UBTabDockPalete
::~
UBTabDockPalete
()
{
}
void
UBTabDockPalete
::
mousePressEvent
(
QMouseEvent
*
event
)
{
dock
->
mClickTime
=
QTime
::
currentTime
();
// The goal here is to verify if the user can resize the widget.
// It is only possible to resize it if the border is selected
QPoint
p
=
event
->
pos
();
dock
->
mMousePressPos
=
p
;
dock
->
mResized
=
false
;
switch
(
dock
->
mOrientation
)
{
case
eUBDockOrientation_Left
:
dock
->
mCanResize
=
true
;
break
;
case
eUBDockOrientation_Right
:
dock
->
mCanResize
=
true
;
break
;
case
eUBDockOrientation_Top
:
// Not supported yet
break
;
case
eUBDockOrientation_Bottom
:
// Not supported yet
break
;
default
:
break
;
}
}
void
UBTabDockPalete
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
QPoint
p
=
event
->
pos
();
if
(
dock
->
mCanResize
&&
((
dock
->
mMousePressPos
-
p
).
manhattanLength
()
>
QApplication
::
startDragDistance
()))
{
switch
(
dock
->
mOrientation
)
{
case
eUBDockOrientation_Left
:
p
.
setX
(
p
.
x
()
+
dock
->
width
());
if
(
p
.
x
()
<
dock
->
collapseWidth
()
&&
p
.
x
()
>=
dock
->
minimumWidth
())
{
dock
->
resize
(
0
,
dock
->
height
());
dock
->
mLastWidth
=
dock
->
collapseWidth
()
+
1
;
dock
->
mResized
=
true
;
}
else
if
(
p
.
x
()
<=
dock
->
maximumWidth
()
&&
p
.
x
()
>=
dock
->
minimumWidth
())
{
dock
->
resize
(
p
.
x
(),
dock
->
height
());
dock
->
mResized
=
true
;
}
break
;
case
eUBDockOrientation_Right
:
p
.
setX
(
p
.
x
()
-
2
*
dock
->
border
());
if
((
dock
->
x
()
+
p
.
x
()
>
dock
->
parentWidget
()
->
width
()
-
dock
->
collapseWidth
())
&&
(
dock
->
x
()
+
p
.
x
()
<
dock
->
parentWidget
()
->
width
()))
{
dock
->
resize
(
0
,
dock
->
height
());
dock
->
mLastWidth
=
dock
->
collapseWidth
()
+
1
;
dock
->
mResized
=
true
;
}
else
if
((
dock
->
x
()
+
p
.
x
()
>=
dock
->
parentWidget
()
->
width
()
-
dock
->
maximumWidth
())
&&
(
dock
->
x
()
+
p
.
x
()
<=
dock
->
parentWidget
()
->
width
()
-
dock
->
minimumWidth
()))
{
dock
->
resize
(
dock
->
parentWidget
()
->
width
()
-
(
dock
->
x
()
+
p
.
x
()),
dock
->
height
());
dock
->
mResized
=
true
;
}
break
;
case
eUBDockOrientation_Top
:
case
eUBDockOrientation_Bottom
:
if
(
p
.
y
()
<=
dock
->
maximumHeight
())
{
dock
->
resize
(
width
(),
p
.
y
());
dock
->
mResized
=
true
;
}
break
;
default
:
break
;
}
}
}
void
UBTabDockPalete
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
if
(
!
dock
->
mResized
&&
dock
->
mClickTime
.
elapsed
()
<
CLICKTIME
)
{
int
nbTabs
=
dock
->
mTabWidgets
.
size
();
int
clickedTab
=
0
;
// If the clicked position is in the tab, perform the related action
if
(
eUBDockOrientation_Left
==
dock
->
mOrientation
)
{
if
(
dock
->
mMousePressPos
.
y
()
>=
dock
->
mHTab
&&
dock
->
mMousePressPos
.
x
()
<=
width
()
&&
dock
->
mMousePressPos
.
y
()
<=
dock
->
mHTab
+
nbTabs
*
TABSIZE
+
(
nbTabs
-
1
)
*
dock
->
tabSpacing
())
{
clickedTab
=
(
dock
->
mMousePressPos
.
y
()
-
dock
->
mHTab
)
/
(
TABSIZE
+
dock
->
tabSpacing
());
dock
->
tabClicked
(
clickedTab
);
}
}
else
if
(
eUBDockOrientation_Right
==
dock
->
mOrientation
)
{
if
(
dock
->
mMousePressPos
.
x
()
>=
0
&&
dock
->
mMousePressPos
.
x
()
<=
width
()
&&
dock
->
mMousePressPos
.
y
()
>=
0
&&
dock
->
mMousePressPos
.
y
()
<=
nbTabs
*
TABSIZE
+
(
nbTabs
-
1
)
*
dock
->
tabSpacing
())
{
clickedTab
=
(
dock
->
mMousePressPos
.
y
())
/
(
TABSIZE
+
dock
->
tabSpacing
());
dock
->
tabClicked
(
clickedTab
);
}
}
}
dock
->
mCanResize
=
false
;
}
src/gui/UBDockPalette.h
View file @
1fc6a86b
...
...
@@ -31,8 +31,8 @@
#include "UBDockPaletteWidget.h"
#define TABSIZE 50
#define CLICKTIME 1000000
#define TABSIZE 50
//Height of the tab of the palette
#define CLICKTIME 1000000
//Clicktime to expand or collapse paltte
/**
* \brief The dock positions
...
...
@@ -51,9 +51,33 @@ typedef enum
eUBDockTabOrientation_Down
/** Down tabs */
}
eUBDockTabOrientation
;
class
UBDockPalette
;
class
UBTabDockPalete
:
public
QWidget
{
Q_OBJECT
friend
class
UBDockPalette
;
public
:
UBTabDockPalete
(
UBDockPalette
*
dockPalette
,
QWidget
*
parent
=
0
);
~
UBTabDockPalete
();
protected
:
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
event
);
virtual
void
paintEvent
(
QPaintEvent
*
event
);
private
:
UBDockPalette
*
dock
;
};
class
UBDockPalette
:
public
QWidget
{
Q_OBJECT
friend
class
UBTabDockPalete
;
public
:
UBDockPalette
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDockPalette"
);
~
UBDockPalette
();
...
...
@@ -62,10 +86,14 @@ public:
void
setOrientation
(
eUBDockOrientation
orientation
);
void
setTabsOrientation
(
eUBDockTabOrientation
orientation
);
void
showTabWidget
(
int
tabIndex
);
QRect
getTabPaletteRect
();
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
event
);
virtual
void
assignParent
(
QWidget
*
widget
);
virtual
void
setVisible
(
bool
visible
);
// virtual void mouseMoveEvent(QMouseEvent *event);
// virtual void mousePressEvent(QMouseEvent *event);
// virtual void mouseReleaseEvent(QMouseEvent *event);
virtual
void
paintEvent
(
QPaintEvent
*
event
);
virtual
void
enterEvent
(
QEvent
*
);
virtual
void
leaveEvent
(
QEvent
*
);
...
...
@@ -77,7 +105,7 @@ public:
void
connectSignals
();
QVector
<
UBDockPaletteWidget
*>
GetWidgetsList
()
{
return
mRegisteredWidgets
;
}
;
QVector
<
UBDockPaletteWidget
*>
GetWidgetsList
()
{
return
mRegisteredWidgets
;
}
public
slots
:
void
onShowTabWidget
(
const
QString
&
widgetName
);
...
...
@@ -137,6 +165,11 @@ private:
void
tabClicked
(
int
tabIndex
);
int
tabSpacing
();
void
toggleCollapseExpand
();
void
moveTabs
();
void
resizeTabs
();
private
:
UBTabDockPalete
*
mTabPalette
;
};
...
...
src/gui/UBLeftPalette.cpp
View file @
1fc6a86b
...
...
@@ -24,11 +24,11 @@ UBLeftPalette::UBLeftPalette(QWidget *parent, const char *name):UBDockPalette(pa
{
setObjectName
(
name
);
setOrientation
(
eUBDockOrientation_Left
);
mLastWidth
=
30
0
;
mCollapseWidth
=
1
8
0
;
mLastWidth
=
27
0
;
mCollapseWidth
=
1
5
0
;
resize
(
UBSettings
::
settings
()
->
navigPaletteWidth
->
get
().
toInt
(),
parentWidget
()
->
height
());
mpLayout
->
setContentsMargins
(
customMargin
(),
customMargin
(),
2
*
border
()
+
customMargin
(),
customMargin
());
//
mpLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin());
}
...
...
@@ -45,7 +45,7 @@ UBLeftPalette::~UBLeftPalette()
*/
void
UBLeftPalette
::
updateMaxWidth
()
{
setMaximumWidth
(
30
0
);
setMaximumWidth
(
27
0
);
}
/**
...
...
@@ -55,5 +55,5 @@ void UBLeftPalette::updateMaxWidth()
void
UBLeftPalette
::
resizeEvent
(
QResizeEvent
*
event
)
{
UBDockPalette
::
resizeEvent
(
event
);
UBSettings
::
settings
()
->
navigPaletteWidth
->
set
(
width
());
//
UBSettings::settings()->navigPaletteWidth->set(width());
}
src/gui/UBRightPalette.cpp
View file @
1fc6a86b
...
...
@@ -26,10 +26,10 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(
{
setObjectName
(
name
);
setOrientation
(
eUBDockOrientation_Right
);
mCollapseWidth
=
1
8
0
;
mLastWidth
=
30
0
;
mCollapseWidth
=
1
5
0
;
mLastWidth
=
27
0
;
resize
(
UBSettings
::
settings
()
->
libPaletteWidth
->
get
().
toInt
(),
parentWidget
()
->
height
());
mpLayout
->
setContentsMargins
(
2
*
border
()
+
customMargin
(),
customMargin
(),
customMargin
(),
customMargin
());
//
mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin());
}
/**
...
...
@@ -37,7 +37,6 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(
*/
UBRightPalette
::~
UBRightPalette
()
{
}
/**
...
...
src/web/browser/WBBrowserWindow.cpp
View file @
1fc6a86b
...
...
@@ -205,6 +205,7 @@ void WBBrowserWindow::setupToolBar()
connect
(
mSearchToolBar
,
SIGNAL
(
search
(
const
QUrl
&
)),
SLOT
(
loadUrl
(
const
QUrl
&
)));
mChaseWidget
=
new
WBChaseWidget
(
this
);
mWebToolBar
->
insertWidget
(
mUniboardMainWindow
->
actionWebBigger
,
mChaseWidget
);
mWebToolBar
->
insertSeparator
(
mUniboardMainWindow
->
actionWebBigger
);
connect
(
mUniboardMainWindow
->
actionHome
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
slotHome
()));
...
...
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