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
ef7441b5
Commit
ef7441b5
authored
Oct 19, 2011
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SANKORE-329 half fix. implement single instance of left and right palettes
parent
b24a787e
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
202 additions
and
31 deletions
+202
-31
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+103
-18
UBBoardPaletteManager.h
src/board/UBBoardPaletteManager.h
+11
-5
UBBoardView.cpp
src/board/UBBoardView.cpp
+1
-1
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+15
-1
UBDesktopAnnotationController.cpp
src/desktop/UBDesktopAnnotationController.cpp
+34
-6
UBDesktopAnnotationController.h
src/desktop/UBDesktopAnnotationController.h
+3
-0
UBDockPalette.h
src/gui/UBDockPalette.h
+2
-0
UBDockPaletteWidget.cpp
src/gui/UBDockPaletteWidget.cpp
+13
-0
UBDockPaletteWidget.h
src/gui/UBDockPaletteWidget.h
+20
-0
No files found.
src/board/UBBoardPaletteManager.cpp
View file @
ef7441b5
...
...
@@ -38,6 +38,9 @@
#include "web/browser/WBTabWidget.h"
#include "web/browser/WBWebView.h"
#include "desktop/UBDesktopAnnotationController.h"
#include "network/UBNetworkAccessManager.h"
#include "network/UBServerXMLHttpRequest.h"
...
...
@@ -76,7 +79,7 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
,
mpPageNavigWidget
(
NULL
)
,
mpLibWidget
(
NULL
)
,
mpCachePropWidget
(
NULL
)
,
mDesktopRightPalette
(
NULL
)
//
, mDesktopRightPalette(NULL)
,
mpTeacherBarWidget
(
NULL
)
,
mpDesktopLibWidget
(
NULL
)
{
...
...
@@ -131,11 +134,11 @@ UBBoardPaletteManager::~UBBoardPaletteManager()
delete
mpDesktopLibWidget
;
mpDesktopLibWidget
=
NULL
;
}
if
(
NULL
!=
mDesktopRightPalette
)
{
delete
mDesktopRightPalette
;
mDesktopRightPalette
=
NULL
;
}
//
if(NULL != mDesktopRightPalette)
//
{
//
delete mDesktopRightPalette;
//
mDesktopRightPalette = NULL;
//
}
}
void
UBBoardPaletteManager
::
initPalettesPosAtStartup
()
...
...
@@ -153,34 +156,65 @@ void UBBoardPaletteManager::setupLayout()
*/
void
UBBoardPaletteManager
::
setupDockPaletteWidgets
()
{
//------------------------------------------------//
// Create the widgets for the dock palettes
mpPageNavigWidget
=
new
UBPageNavigationWidget
();
mpPageNavigWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
connect
(
this
,
SIGNAL
(
signal_changeMode
(
eUBDockPaletteWidgetMode
)),
mpPageNavigWidget
,
SLOT
(
slot_changeMode
(
eUBDockPaletteWidgetMode
)));
mpLibWidget
=
new
UBLibWidget
();
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_DESKTOP
);
connect
(
this
,
SIGNAL
(
signal_changeMode
(
eUBDockPaletteWidgetMode
)),
mpLibWidget
,
SLOT
(
slot_changeMode
(
eUBDockPaletteWidgetMode
)));
// mpCachePropWidget = new UBCachePropertiesWidget();
// mpCachePropWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
// mpTeacherBarWidget = new UBTeacherBarWidget();
// mpTeacherBarWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
//------------------------------------------------//
// Add the dock palettes
mLeftPalette
=
new
UBLeftPalette
(
mContainer
);
// LEFT palette widgets
mLeftPalette
->
registerWidget
(
mpPageNavigWidget
);
mLeftPalette
->
addTabWidget
(
mpPageNavigWidget
);
mLeftPalette
->
connectSignals
();
//------------------------------------------------//
mRightPalette
=
new
UBRightPalette
(
mContainer
);
// RIGHT palette widgets
mRightPalette
->
registerWidget
(
mpLibWidget
);
mRightPalette
->
registerWidget
(
mpCachePropWidget
);
mRightPalette
->
addTabWidget
(
mpLibWidget
);
mRightPalette
->
registerWidget
(
mpTeacherBarWidget
);
//mRightPalette->addTabWidget(mpTeacherBarWidget);
// // ???
// mRightPalette->registerWidget(mpCachePropWidget);
// mRightPalette->addTabWidget(mpCachePropWidget);
// // ???
// mRightPalette->registerWidget(mpTeacherBarWidget);
// mRightPalette->addTabWidget(mpTeacherBarWidget);
mRightPalette
->
connectSignals
();
//------------------------------------------------//
mLeftPalette
->
showTabWidget
(
0
);
mRightPalette
->
showTabWidget
(
0
);
//------------------------------------------------//
}
void
UBBoardPaletteManager
::
setupPalettes
()
{
// Add the dock palettes
mLeftPalette
=
new
UBLeftPalette
(
mContainer
);
mRightPalette
=
new
UBRightPalette
(
mContainer
);
// Create the widgets for the dock palettes
mpPageNavigWidget
=
new
UBPageNavigationWidget
();
mpLibWidget
=
new
UBLibWidget
();
mpCachePropWidget
=
new
UBCachePropertiesWidget
();
mpTeacherBarWidget
=
new
UBTeacherBarWidget
();
setupDockPaletteWidgets
();
...
...
@@ -435,6 +469,8 @@ void UBBoardPaletteManager::containerResized()
mKeyboardPalette
->
adjustSizeAndPosition
();
}
mLeftPalette
->
resize
(
mLeftPalette
->
width
()
-
1
,
mContainer
->
height
());
mRightPalette
->
resize
(
mRightPalette
->
width
()
-
1
,
mContainer
->
height
());
mLeftPalette
->
resize
(
mLeftPalette
->
width
(),
mContainer
->
height
());
mRightPalette
->
resize
(
mRightPalette
->
width
(),
mContainer
->
height
());
}
...
...
@@ -569,6 +605,53 @@ void UBBoardPaletteManager::addItem(const QUrl& pUrl)
}
void
UBBoardPaletteManager
::
changeMode
(
eUBDockPaletteWidgetMode
newMode
)
{
switch
(
newMode
)
{
case
eUBDockPaletteWidget_BOARD
:
{
mLeftPalette
->
setParent
(
UBApplication
::
boardController
->
controlContainer
());
mRightPalette
->
setParent
(
UBApplication
::
boardController
->
controlContainer
());
mLeftPalette
->
setVisible
(
true
);
mRightPalette
->
setVisible
(
true
);
containerResized
();
}
break
;
case
eUBDockPaletteWidget_DESKTOP
:
{
mLeftPalette
->
setParent
((
QWidget
*
)
UBApplication
::
applicationController
->
uninotesController
()
->
drawingView
());
mRightPalette
->
setParent
((
QWidget
*
)
UBApplication
::
applicationController
->
uninotesController
()
->
drawingView
());
mLeftPalette
->
setVisible
(
false
);
mRightPalette
->
setVisible
(
true
);
UBApplication
::
applicationController
->
uninotesController
()
->
TransparentWidgetResized
();
}
break
;
default
:
{
mLeftPalette
->
setVisible
(
false
);
mRightPalette
->
setVisible
(
false
);
mLeftPalette
->
setParent
(
0
);
mRightPalette
->
setParent
(
0
);
}
break
;
}
emit
signal_changeMode
(
newMode
);
}
/*
void UBBoardPaletteManager::slot_changeMode(eUBDockPaletteWidgetMode newMode)
{
emit signal_changeMode(newMode);
}
*/
void
UBBoardPaletteManager
::
addItem
(
const
QPixmap
&
pPixmap
,
const
QPointF
&
pos
,
qreal
scaleFactor
,
const
QUrl
&
sourceUrl
)
{
...
...
@@ -719,6 +802,7 @@ void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var)
mStylusPalette
->
setVisible
(
bVisible
);
// always show stylus palette at startup
}
/*
UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent)
{
mpDesktopLibWidget = new UBLibWidget();
...
...
@@ -729,6 +813,7 @@ UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent
return mDesktopRightPalette;
}
*/
void
UBBoardPaletteManager
::
connectToDocumentController
()
{
...
...
src/board/UBBoardPaletteManager.h
View file @
ef7441b5
...
...
@@ -48,15 +48,19 @@ class UBBoardPaletteManager : public QObject
void
setupLayout
();
UBLeftPalette
*
leftPalette
(){
return
mLeftPalette
;}
UBRightPalette
*
rightPalette
(){
return
mRightPalette
;}
void
showVirtualKeyboard
(
bool
show
=
true
);
void
initPalettesPosAtStartup
();
void
connectToDocumentController
();
UBKeyboardPalette
*
mKeyboardPalette
;
UBRightPalette
*
createDesktopRightPalette
(
QWidget
*
parent
);
// UBRightPalette* createDesktopRightPalette(QWidget* parent);
void
changeMode
(
eUBDockPaletteWidgetMode
newMode
);
signals
:
void
connectToDocController
();
void
signal_changeMode
(
eUBDockPaletteWidgetMode
newMode
);
public
slots
:
...
...
@@ -65,6 +69,8 @@ class UBBoardPaletteManager : public QObject
void
addItem
(
const
QUrl
&
pUrl
);
void
addItem
(
const
QPixmap
&
pPixmap
,
const
QPointF
&
p
=
QPointF
(
0
.
0
,
0
.
0
),
qreal
scale
=
1
.
0
,
const
QUrl
&
sourceUrl
=
QUrl
());
// void slot_changeMode(eUBDockPaletteWidgetMode newMode);
private
:
void
setupPalettes
();
...
...
@@ -84,10 +90,10 @@ class UBBoardPaletteManager : public QObject
/** The right dock palette */
UBRightPalette
*
mRightPalette
;
// HACK: here we duplicate the right palette for the desktop mode
// we MUST refactor the architecture in order to use only one
// right palette!
UBRightPalette
*
mDesktopRightPalette
;
//
// HACK: here we duplicate the right palette for the desktop mode
//
// we MUST refactor the architecture in order to use only one
//
// right palette!
//
UBRightPalette* mDesktopRightPalette;
UBActionPalette
*
mBackgroundsPalette
;
UBActionPalette
*
mToolsPalette
;
...
...
src/board/UBBoardView.cpp
View file @
ef7441b5
...
...
@@ -660,8 +660,8 @@ UBBoardView::wheelEvent (QWheelEvent *wheelEvent)
QBool
isSlectedAndMouseHower
=
itemsList
.
contains
(
selItem
);
if
(
isSlectedAndMouseHower
)
{
wheelEvent
->
accept
();
QGraphicsView
::
wheelEvent
(
wheelEvent
);
wheelEvent
->
accept
();
}
}
...
...
src/core/UBApplicationController.cpp
View file @
ef7441b5
...
...
@@ -336,6 +336,7 @@ void UBApplicationController::showBoard()
mMainWindow
->
boardToolBar
->
show
();
mMainMode
=
Board
;
UBApplication
::
boardController
->
paletteManager
()
->
changeMode
(
eUBDockPaletteWidget_BOARD
);
adaptToolBar
();
...
...
@@ -352,6 +353,8 @@ void UBApplicationController::showBoard()
mUninoteController
->
hideWindow
();
mMainWindow
->
show
();
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_BOARD);
emit
mainModeChanged
(
Board
);
}
...
...
@@ -365,6 +368,8 @@ void UBApplicationController::showInternet()
UBApplication
::
boardController
->
hide
();
}
UBApplication
::
boardController
->
paletteManager
()
->
changeMode
(
eUBDockPaletteWidget_WEB
);
if
(
UBSettings
::
settings
()
->
webUseExternalBrowser
->
get
().
toBool
())
{
showDesktop
(
true
);
...
...
@@ -384,8 +389,10 @@ void UBApplicationController::showInternet()
mUninoteController
->
hideWindow
();
emit
mainModeChanged
(
Internet
);
}
UBApplication
::
webController
->
show
(
UBWebController
::
WebBrowser
);
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_WEB);
UBApplication
::
webController
->
show
(
UBWebController
::
WebBrowser
);
}
...
...
@@ -397,6 +404,7 @@ void UBApplicationController::showDocument()
mMainWindow
->
documentToolBar
->
show
();
mMainMode
=
Document
;
UBApplication
::
boardController
->
paletteManager
()
->
changeMode
(
eUBDockPaletteWidget_DOCUMENT
);
adaptToolBar
();
...
...
@@ -418,6 +426,8 @@ void UBApplicationController::showDocument()
mUninoteController
->
hideWindow
();
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DOCUMENT);
emit
mainModeChanged
(
Document
);
}
...
...
@@ -429,6 +439,8 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
UBApplication
::
boardController
->
hide
();
mMainWindow
->
hide
();
UBApplication
::
boardController
->
paletteManager
()
->
changeMode
(
eUBDockPaletteWidget_DESKTOP
);
mUninoteController
->
showWindow
();
if
(
mMirror
)
...
...
@@ -444,6 +456,8 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
UBPlatformUtils
::
bringPreviousProcessToFront
();
}
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DESKTOP);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
...
...
src/desktop/UBDesktopAnnotationController.cpp
View file @
ef7441b5
...
...
@@ -56,7 +56,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
,
mDesktopPenPalette
(
NULL
)
,
mDesktopMarkerPalette
(
NULL
)
,
mDesktopEraserPalette
(
NULL
)
,
mRightPalette
(
NULL
)
//
, mRightPalette(NULL)
,
mWindowPositionInitialized
(
0
)
,
mIsFullyTransparent
(
false
)
,
mDesktopToolsPalettePositioned
(
false
)
...
...
@@ -89,7 +89,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingScene
=
new
UBGraphicsScene
(
0
);
mTransparentDrawingView
->
setScene
(
mTransparentDrawingScene
);
mRightPalette
=
UBApplication
::
boardController
->
paletteManager
()
->
createDesktopRightPalette
(
mTransparentDrawingView
);
//
mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView);
//mRightPalette = new UBRightPalette(mTransparentDrawingView);
mDesktopPalette
=
new
UBDesktopPalette
(
mTransparentDrawingView
);
...
...
@@ -158,7 +158,8 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
#ifdef Q_WS_X11
connect
(
mDesktopPalette
,
SIGNAL
(
moving
()),
this
,
SLOT
(
refreshMask
()));
connect
(
mRightPalette
,
SIGNAL
(
resized
()),
this
,
SLOT
(
refreshMask
()));
// connect(mRightPalette, SIGNAL(resized()), this, SLOT(refreshMask()));
connect
(
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
(),
SIGNAL
(
resized
()),
this
,
SLOT
(
refreshMask
()));
#endif
onDesktopPaletteMaximized
();
}
...
...
@@ -859,12 +860,34 @@ void UBDesktopAnnotationController::onDesktopPaletteMinimize()
}
}
void
UBDesktopAnnotationController
::
TransparentWidgetResized
()
{
/*
int rW = UBApplication::boardController->paletteManager()->rightPalette()->width();
int rH_ = UBApplication::boardController->paletteManager()->rightPalette()->height();
int rH = mTransparentDrawingView->height();
UBApplication::boardController->paletteManager()->rightPalette()->resize(rW+1, rH);
// UBApplication::boardController->paletteManager()->rightPalette()->resize(500, 500);
*/
onTransparentWidgetResized
();
}
/**
* \brief Resize the library palette.
*/
void
UBDesktopAnnotationController
::
onTransparentWidgetResized
()
{
mRightPalette
->
resize
(
mRightPalette
->
width
(),
mTransparentDrawingView
->
height
());
int
rW
=
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
width
();
int
rH_
=
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
height
();
int
rH
=
mTransparentDrawingView
->
height
();
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
resize
(
rW
+
1
,
rH
);
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
resize
(
rW
,
rH
);
// mRightPalette->resize(mRightPalette->width(), mTransparentDrawingView->height());
}
void
UBDesktopAnnotationController
::
updateMask
(
bool
bTransparent
)
...
...
@@ -891,10 +914,15 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
{
p
.
drawRect
(
mKeyboardPalette
->
geometry
().
x
(),
mKeyboardPalette
->
geometry
().
y
(),
mKeyboardPalette
->
width
(),
mKeyboardPalette
->
height
());
}
if
(
mRightPalette
->
isVisible
())
// UBApplication::boardController->paletteManager()->mDesktopRightPalette
if
(
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
isVisible
())
{
qDebug
()
<<
">>>>>> Drawing the mask for the right palette"
;
p
.
drawRect
(
mRightPalette
->
geometry
().
x
(),
mRightPalette
->
geometry
().
y
(),
mRightPalette
->
width
(),
mRightPalette
->
height
());
p
.
drawRect
(
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
geometry
().
x
(),
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
geometry
().
y
(),
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
width
(),
UBApplication
::
boardController
->
paletteManager
()
->
rightPalette
()
->
height
());
}
p
.
end
();
...
...
src/desktop/UBDesktopAnnotationController.h
View file @
ef7441b5
...
...
@@ -55,6 +55,9 @@ class UBDesktopAnnotationController : public QObject
UBDesktopPalette
*
desktopPalette
();
UBBoardView
*
drawingView
();
void
TransparentWidgetResized
();
public
slots
:
void
screenLayoutChanged
();
...
...
src/gui/UBDockPalette.h
View file @
ef7441b5
...
...
@@ -123,6 +123,8 @@ protected:
/** The current widget */
QVector
<
UBDockPaletteWidget
*>
mRegisteredWidgets
;
// QVector<UBDockPaletteWidget*> mVisibleWidgets; // ???
private
slots
:
void
onToolbarPosUpdated
();
void
onResizeRequest
(
QResizeEvent
*
event
);
...
...
src/gui/UBDockPaletteWidget.cpp
View file @
ef7441b5
...
...
@@ -24,3 +24,16 @@ QString UBDockPaletteWidget::name()
{
return
mName
;
}
void
UBDockPaletteWidget
::
registerMode
(
eUBDockPaletteWidgetMode
mode
)
{
if
(
!
mRegisteredModes
.
contains
(
mode
))
mRegisteredModes
.
append
(
mode
);
}
void
UBDockPaletteWidget
::
slot_changeMode
(
eUBDockPaletteWidgetMode
newMode
)
{
this
->
setVisible
(
mRegisteredModes
.
contains
(
newMode
));
}
src/gui/UBDockPaletteWidget.h
View file @
ef7441b5
...
...
@@ -5,8 +5,17 @@
#include <QPixmap>
#include <QString>
typedef
enum
{
eUBDockPaletteWidget_BOARD
,
eUBDockPaletteWidget_WEB
,
eUBDockPaletteWidget_DOCUMENT
,
eUBDockPaletteWidget_DESKTOP
,
}
eUBDockPaletteWidgetMode
;
class
UBDockPaletteWidget
:
public
QWidget
{
Q_OBJECT
public
:
UBDockPaletteWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDockPaletteWidget"
);
...
...
@@ -16,10 +25,21 @@ public:
QPixmap
iconToLeft
();
QString
name
();
void
registerMode
(
eUBDockPaletteWidgetMode
mode
);
/* The current widget available mode list */
QVector
<
eUBDockPaletteWidgetMode
>
mRegisteredModes
;
signals
:
void
hideTab
(
const
QString
&
widgetName
);
void
showTab
(
const
QString
&
widgetName
);
public
slots
:
void
slot_changeMode
(
eUBDockPaletteWidgetMode
newMode
);
protected
:
QPixmap
mIconToRight
;
// arrow like this: >
QPixmap
mIconToLeft
;
// arrow like this: <
...
...
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