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
383fd02a
Commit
383fd02a
authored
Jun 30, 2011
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some cleaning (code and warning)
parent
5e1e41a1
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
269 additions
and
274 deletions
+269
-274
UBDocumentPublisher.h
src/adaptors/publishing/UBDocumentPublisher.h
+2
-3
UBDrawingController.cpp
src/board/UBDrawingController.cpp
+3
-2
UBDrawingController.h
src/board/UBDrawingController.h
+1
-1
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+2
-1
UBApplicationController.h
src/core/UBApplicationController.h
+1
-2
UBSceneCache.h
src/core/UBSceneCache.h
+1
-1
UBPlatformUtils_linux.cpp
src/frameworks/UBPlatformUtils_linux.cpp
+5
-0
UBFloatingPalette.cpp
src/gui/UBFloatingPalette.cpp
+2
-2
UBFloatingPalette.h
src/gui/UBFloatingPalette.h
+3
-3
UBKeyboardPalette.cpp
src/gui/UBKeyboardPalette.cpp
+247
-247
UBKeyboardPalette_linux.cpp
src/gui/UBKeyboardPalette_linux.cpp
+1
-1
UBLibNavigatorWidget.cpp
src/gui/UBLibNavigatorWidget.cpp
+1
-11
No files found.
src/adaptors/publishing/UBDocumentPublisher.h
View file @
383fd02a
...
...
@@ -42,6 +42,8 @@ private slots:
private
:
UBDocumentProxy
*
mSourceDocument
;
UBDocumentProxy
*
mPublishingDocument
;
void
init
();
void
sendUbw
();
QString
getBase64Of
(
QString
stringToEncode
);
...
...
@@ -58,8 +60,5 @@ private:
void
buildUbwFile
();
QString
mTmpZipFile
;
UBDocumentProxy
*
mSourceDocument
;
UBDocumentProxy
*
mPublishingDocument
;
};
#endif // UBDOCUMENTPUBLISHER_H
src/board/UBDrawingController.cpp
View file @
383fd02a
...
...
@@ -27,9 +27,10 @@ UBDrawingController* UBDrawingController::drawingController()
UBDrawingController
::
UBDrawingController
(
QObject
*
parent
)
:
QObject
(
parent
)
,
mActiveRuler
(
NULL
)
,
mStylusTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mLatestDrawingTool
((
UBStylusTool
::
Enum
)
-
1
)
,
mActiveRuler
(
NULL
)
{
connect
(
UBSettings
::
settings
(),
SIGNAL
(
colorContextChanged
()),
this
,
SIGNAL
(
colorPaletteChanged
()));
...
...
@@ -171,7 +172,7 @@ void UBDrawingController::setLineWidthIndex(int index)
{
UBSettings
::
settings
()
->
setPenWidthIndex
(
index
);
if
(
stylusTool
()
!=
UBStylusTool
::
Line
if
(
stylusTool
()
!=
UBStylusTool
::
Line
&&
stylusTool
()
!=
UBStylusTool
::
Selector
)
{
setStylusTool
(
UBStylusTool
::
Pen
);
...
...
src/board/UBDrawingController.h
View file @
383fd02a
...
...
@@ -41,7 +41,7 @@ class UBDrawingController : public QObject
void
setMarkerColor
(
bool
onDarkBackground
,
const
QColor
&
color
,
int
pIndex
);
void
setMarkerAlpha
(
qreal
alpha
);
UBAbstractDrawRuler
*
mActiveRuler
;
UBAbstractDrawRuler
*
mActiveRuler
;
public
slots
:
...
...
src/core/UBApplicationController.cpp
View file @
383fd02a
...
...
@@ -50,12 +50,13 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBo
,
mControlView
(
pControlView
)
,
mDisplayView
(
pDisplayView
)
,
mMirror
(
0
)
,
mFtp
(
0
)
,
mMainMode
(
Board
)
,
mDisplayManager
(
0
)
,
mAutomaticCheckForUpdates
(
false
)
,
mCheckingForUpdates
(
false
)
,
mIsShowingDesktop
(
false
)
,
mFtp
(
0
)
{
mDisplayManager
=
new
UBDisplayManager
(
this
);
...
...
src/core/UBApplicationController.h
View file @
383fd02a
...
...
@@ -24,8 +24,7 @@ class UBApplicationController : public QObject
public
:
UBApplicationController
(
UBBoardView
*
pControlView
,
UBBoardView
*
pDisplayView
,
UBMainWindow
*
pMainWindow
,
QObject
*
parent
=
0
);
UBApplicationController
(
UBBoardView
*
pControlView
,
UBBoardView
*
pDisplayView
,
UBMainWindow
*
pMainWindow
,
QObject
*
parent
=
0
);
virtual
~
UBApplicationController
();
int
initialHScroll
()
{
return
mInitialHScroll
;
}
...
...
src/core/UBSceneCache.h
View file @
383fd02a
...
...
@@ -7,7 +7,7 @@
class
UBDocumentProxy
;
class
UBGraphicsScene
;
class
UBGraphicsScene
::
SceneViewState
;
class
UBGraphicsScene
;
class
UBSceneCacheID
{
...
...
src/frameworks/UBPlatformUtils_linux.cpp
View file @
383fd02a
...
...
@@ -56,6 +56,8 @@ QString UBPlatformUtils::preferredLanguage()
void
UBPlatformUtils
::
runInstaller
(
const
QString
&
installerFilePath
)
{
// TODO UB 4.x - auto update & installer are deactivated on Linux
Q_UNUSED
(
installerFilePath
);
}
void
UBPlatformUtils
::
bringPreviousProcessToFront
()
...
...
@@ -77,6 +79,8 @@ QString UBPlatformUtils::computerName()
void
UBPlatformUtils
::
setWindowNonActivableFlag
(
QWidget
*
widget
,
bool
nonAcivable
)
{
Q_UNUSED
(
widget
);
Q_UNUSED
(
nonAcivable
);
}
...
...
@@ -84,6 +88,7 @@ void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivabl
void
UBPlatformUtils
::
setDesktopMode
(
bool
desktop
)
{
// NOOP
Q_UNUSED
(
desktop
);
}
const
KEYBT
ENGLISH_LOCALE
[]
=
{
...
...
src/gui/UBFloatingPalette.cpp
View file @
383fd02a
...
...
@@ -12,8 +12,8 @@
UBFloatingPalette
::
UBFloatingPalette
(
Qt
::
Corner
position
,
QWidget
*
parent
)
:
QWidget
(
parent
,
parent
?
Qt
::
Widget
:
Qt
::
Tool
|
(
Qt
::
FramelessWindowHint
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
X11BypassWindowManagerHint
))
,
mIsMoving
(
false
)
,
mCustomPosition
(
false
)
,
mIsMoving
(
false
)
,
mCanBeMinimized
(
false
)
,
mMinimizedLocation
(
eMinimizedLocation_None
)
,
mDefaultPosition
(
position
)
...
...
@@ -27,7 +27,7 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
else
{
// standalone window
// !!!! Should be included into Windows after QT recompilation
// !!!! Should be included into Windows after QT recompilation
#ifndef Q_WS_WIN
setAttribute
(
Qt
::
WA_TranslucentBackground
);
setAttribute
(
Qt
::
WA_MacAlwaysShowToolWindow
);
...
...
src/gui/UBFloatingPalette.h
View file @
383fd02a
...
...
@@ -68,13 +68,13 @@ class UBFloatingPalette : public QWidget
QList
<
UBFloatingPalette
*>
mAssociatedPalette
;
QPoint
mDragPosition
;
bool
mCanBeMinimized
;
eMinimizedLocation
mMinimizedLocation
;
eMinimizedLocation
mMinimizedLocation
;
Qt
::
Corner
mDefaultPosition
;
signals
:
void
mouseEntered
();
void
minimizeStart
(
eMinimizedLocation
location
);
void
maximizeStart
();
void
minimizeStart
(
eMinimizedLocation
location
);
void
maximizeStart
();
void
maximized
();
};
...
...
src/gui/UBKeyboardPalette.cpp
View file @
383fd02a
...
...
@@ -17,303 +17,303 @@
/*
UBKeyboardPalette
UBKeyboardPalette
*/
UBKeyboardPalette
::
UBKeyboardPalette
(
QWidget
*
parent
)
:
UBFloatingPalette
(
Qt
::
TopRightCorner
,
parent
)
:
UBFloatingPalette
(
Qt
::
TopRightCorner
,
parent
)
{
setCustomPosition
(
true
);
setSizePolicy
(
QSizePolicy
::
Minimum
,
QSizePolicy
::
Minimum
);
setFocusPolicy
(
Qt
::
NoFocus
);
capsLock
=
false
;
languagePopupActive
=
false
;
keyboardActive
=
false
;
btnWidth
=
btnHeight
=
16
;
setCustomPosition
(
true
);
setSizePolicy
(
QSizePolicy
::
Minimum
,
QSizePolicy
::
Minimum
);
setFocusPolicy
(
Qt
::
NoFocus
);
capsLock
=
false
;
languagePopupActive
=
false
;
keyboardActive
=
false
;
btnWidth
=
btnHeight
=
16
;
buttons
=
new
UBKeyButton
*
[
47
];
for
(
int
i
=
0
;
i
<
47
;
i
++
)
{
buttons
[
i
]
=
new
UBKeyButton
(
this
);
}
buttons
=
new
UBKeyButton
*
[
47
];
for
(
int
i
=
0
;
i
<
47
;
i
++
)
{
buttons
[
i
]
=
new
UBKeyButton
(
this
);
}
locales
=
UBPlatformUtils
::
getKeyboardLayouts
(
this
->
nLocalesCount
);
locales
=
UBPlatformUtils
::
getKeyboardLayouts
(
this
->
nLocalesCount
);
createCtrlButtons
();
createCtrlButtons
();
nCurrentLocale
=
0
;
setInput
(
locales
[
nCurrentLocale
]);
nCurrentLocale
=
0
;
setInput
(
locales
[
nCurrentLocale
]);
setContentsMargins
(
radius
()
+
15
,
4
,
radius
()
+
15
,
4
);
connect
(
this
,
SIGNAL
(
keyboardActivated
(
bool
)),
this
,
SLOT
(
onActivated
(
bool
)));
connect
(
this
,
SIGNAL
(
keyboardActivated
(
bool
)),
this
,
SLOT
(
onActivated
(
bool
)));
}
QList
<
UBKeyboardPalette
*>
UBKeyboardPalette
::
instances
;
UBKeyboardPalette
*
UBKeyboardPalette
::
create
(
QWidget
*
parent
)
{
if
(
!
UBPlatformUtils
::
hasVirtualKeyboard
())
return
NULL
;
if
(
!
UBPlatformUtils
::
hasVirtualKeyboard
())
return
NULL
;
UBKeyboardPalette
*
instance
=
new
UBKeyboardPalette
(
parent
);
instances
.
append
(
instance
);
UBKeyboardPalette
*
instance
=
new
UBKeyboardPalette
(
parent
);
instances
.
append
(
instance
);
instance
->
setKeyButtonSize
(
UBSettings
::
settings
()
->
boardKeyboardPaletteKeyBtnSize
->
get
().
toString
());
instance
->
setAutoMinimize
(
UBSettings
::
settings
()
->
boardKeyboardPaletteAutoMinimize
->
get
().
toBool
());
instance
->
setVisible
(
false
);
connect
(
UBSettings
::
settings
()
->
boardKeyboardPaletteAutoMinimize
,
SIGNAL
(
changed
(
QVariant
)),
instance
,
SLOT
(
keyboardPaletteAutoMinimizeChanged
(
QVariant
)));
connect
(
UBSettings
::
settings
()
->
boardKeyboardPaletteKeyBtnSize
,
SIGNAL
(
changed
(
QVariant
)),
instance
,
SLOT
(
keyboardPaletteButtonSizeChanged
(
QVariant
)));
instance
->
setKeyButtonSize
(
UBSettings
::
settings
()
->
boardKeyboardPaletteKeyBtnSize
->
get
().
toString
());
instance
->
setAutoMinimize
(
UBSettings
::
settings
()
->
boardKeyboardPaletteAutoMinimize
->
get
().
toBool
());
instance
->
setVisible
(
false
);
connect
(
UBSettings
::
settings
()
->
boardKeyboardPaletteAutoMinimize
,
SIGNAL
(
changed
(
QVariant
)),
instance
,
SLOT
(
keyboardPaletteAutoMinimizeChanged
(
QVariant
)));
connect
(
UBSettings
::
settings
()
->
boardKeyboardPaletteKeyBtnSize
,
SIGNAL
(
changed
(
QVariant
)),
instance
,
SLOT
(
keyboardPaletteButtonSizeChanged
(
QVariant
)));
foreach
(
UBKeyboardPalette
*
inst
,
instances
)
{
connect
(
inst
,
SIGNAL
(
moved
(
const
QPoint
&
)),
instance
,
SLOT
(
syncPosition
(
const
QPoint
&
)));
connect
(
instance
,
SIGNAL
(
moved
(
const
QPoint
&
)),
inst
,
SLOT
(
syncPosition
(
const
QPoint
&
)));
foreach
(
UBKeyboardPalette
*
inst
,
instances
)
{
connect
(
inst
,
SIGNAL
(
moved
(
const
QPoint
&
)),
instance
,
SLOT
(
syncPosition
(
const
QPoint
&
)));
connect
(
instance
,
SIGNAL
(
moved
(
const
QPoint
&
)),
inst
,
SLOT
(
syncPosition
(
const
QPoint
&
)));
connect
(
inst
,
SIGNAL
(
localeChanged
(
int
)),
instance
,
SLOT
(
syncLocale
(
int
)));
connect
(
instance
,
SIGNAL
(
localeChanged
(
int
)),
inst
,
SLOT
(
syncLocale
(
int
)));
connect
(
inst
,
SIGNAL
(
localeChanged
(
int
)),
instance
,
SLOT
(
syncLocale
(
int
)));
connect
(
instance
,
SIGNAL
(
localeChanged
(
int
)),
inst
,
SLOT
(
syncLocale
(
int
)));
}
}
return
instance
;
return
instance
;
}
void
UBKeyboardPalette
::
syncPosition
(
const
QPoint
&
pos
)
{
move
(
pos
);
move
(
pos
);
}
void
UBKeyboardPalette
::
syncLocale
(
int
nLocale
)
{
nCurrentLocale
=
nLocale
;
setInput
(
locales
[
nCurrentLocale
]);
nCurrentLocale
=
nLocale
;
setInput
(
locales
[
nCurrentLocale
]);
}
void
UBKeyboardPalette
::
keyboardPaletteAutoMinimizeChanged
(
QVariant
b
)
{
setAutoMinimize
(
b
.
toBool
());
setAutoMinimize
(
b
.
toBool
());
}
void
UBKeyboardPalette
::
keyboardPaletteButtonSizeChanged
(
QVariant
size
)
{
setKeyButtonSize
(
size
.
toString
());
setKeyButtonSize
(
size
.
toString
());
}
void
UBKeyboardPalette
::
setInput
(
const
UBKeyboardLocale
*
locale
)
{
if
(
locale
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
47
;
i
++
)
buttons
[
i
]
->
setKeyBt
((
*
locale
)[
i
]);
}
else
{
this
->
hide
();
}
if
(
locale
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
47
;
i
++
)
buttons
[
i
]
->
setKeyBt
((
*
locale
)[
i
]);
}
else
{
this
->
hide
();
}
}
UBKeyboardPalette
::~
UBKeyboardPalette
()
{
for
(
int
i
=
0
;
i
<
47
;
i
++
)
delete
buttons
[
i
];
delete
[]
buttons
;
for
(
int
i
=
0
;
i
<
47
;
i
++
)
delete
buttons
[
i
];
delete
[]
buttons
;
for
(
int
i
=
0
;
i
<
8
;
i
++
)
delete
ctrlButtons
[
i
];
delete
[]
ctrlButtons
;
for
(
int
i
=
0
;
i
<
8
;
i
++
)
delete
ctrlButtons
[
i
];
delete
[]
ctrlButtons
;
if
(
locales
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
nLocalesCount
;
i
++
)
delete
locales
[
i
];
delete
[]
locales
;
}
if
(
locales
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
nLocalesCount
;
i
++
)
delete
locales
[
i
];
delete
[]
locales
;
}
}
QSize
UBKeyboardPalette
::
sizeHint
()
const
{
if
((
autoMinimize
&&
keyboardActive
)
||
!
autoMinimize
)
{
int
w
=
contentsMargins
().
left
()
+
contentsMargins
().
right
()
+
13
+
14.5
*
btnWidth
;
int
h
=
contentsMargins
().
top
()
+
contentsMargins
().
bottom
()
+
5
*
btnHeight
+
4
;
return
QSize
(
w
,
h
);
}
else
{
int
MIN_WITH
=
4
,
MIN_HEIGTH
=
4
;
int
w
=
contentsMargins
().
left
()
+
contentsMargins
().
right
()
+
13
+
14.5
*
MIN_WITH
;
int
h
=
contentsMargins
().
top
()
+
contentsMargins
().
bottom
()
+
5
*
MIN_HEIGTH
+
4
;
return
QSize
(
w
,
h
);
}
if
((
autoMinimize
&&
keyboardActive
)
||
!
autoMinimize
)
{
int
w
=
contentsMargins
().
left
()
+
contentsMargins
().
right
()
+
13
+
14.5
*
btnWidth
;
int
h
=
contentsMargins
().
top
()
+
contentsMargins
().
bottom
()
+
5
*
btnHeight
+
4
;
return
QSize
(
w
,
h
);
}
else
{
int
MIN_WITH
=
4
,
MIN_HEIGTH
=
4
;
int
w
=
contentsMargins
().
left
()
+
contentsMargins
().
right
()
+
13
+
14.5
*
MIN_WITH
;
int
h
=
contentsMargins
().
top
()
+
contentsMargins
().
bottom
()
+
5
*
MIN_HEIGTH
+
4
;
return
QSize
(
w
,
h
);
}
}
const
QString
*
UBKeyboardPalette
::
getLocaleName
()
{
if
(
locales
==
NULL
)
return
NULL
;
return
&
(
locales
[
nCurrentLocale
]
->
name
);
if
(
locales
==
NULL
)
return
NULL
;
return
&
(
locales
[
nCurrentLocale
]
->
name
);
}
void
UBKeyboardPalette
::
setLocale
(
int
nLocale
)
{
if
(
locales
!=
NULL
)
{
nCurrentLocale
=
nLocale
;
if
(
locales
!=
NULL
)
{
nCurrentLocale
=
nLocale
;
setInput
(
locales
[
nCurrentLocale
]);
onLocaleChanged
(
locales
[
nCurrentLocale
]);
update
();
}
emit
localeChanged
(
nLocale
);
setInput
(
locales
[
nCurrentLocale
]);
onLocaleChanged
(
locales
[
nCurrentLocale
]);
update
();
}
emit
localeChanged
(
nLocale
);
}
void
UBKeyboardPalette
::
setKeyButtonSize
(
const
QString
&
strSize
)
{
QStringList
strs
=
strSize
.
split
(
'x'
);
QStringList
strs
=
strSize
.
split
(
'x'
);
if
(
strs
.
size
()
==
2
)
{
btnWidth
=
strs
[
0
].
toInt
();
btnHeight
=
strs
[
1
].
toInt
();
adjustSizeAndPosition
();
}
if
(
strs
.
size
()
==
2
)
{
btnWidth
=
strs
[
0
].
toInt
();
btnHeight
=
strs
[
1
].
toInt
();
adjustSizeAndPosition
();
}
}
void
UBKeyboardPalette
::
setAutoMinimize
(
bool
autoMinimize
)
{
this
->
autoMinimize
=
autoMinimize
;
adjustSizeAndPosition
();
this
->
autoMinimize
=
autoMinimize
;
adjustSizeAndPosition
();
}
void
UBKeyboardPalette
::
enterEvent
(
QEvent
*
)
{
if
(
keyboardActive
)
return
;
if
(
keyboardActive
)
return
;
keyboardActive
=
true
;
keyboardActive
=
true
;
adjustSizeAndPosition
();
adjustSizeAndPosition
();
emit
keyboardActivated
(
true
);
emit
keyboardActivated
(
true
);
}
void
UBKeyboardPalette
::
leaveEvent
(
QEvent
*
)
{
if
(
languagePopupActive
||
!
keyboardActive
||
mIsMoving
)
return
;
return
;
keyboardActive
=
false
;
keyboardActive
=
false
;
adjustSizeAndPosition
();
adjustSizeAndPosition
();
emit
keyboardActivated
(
false
);
emit
keyboardActivated
(
false
);
}
void
UBKeyboardPalette
::
moveEvent
(
QMoveEvent
*
event
)
{
UBFloatingPalette
::
moveEvent
(
event
);
emit
moved
(
event
->
pos
());
UBFloatingPalette
::
moveEvent
(
event
);
emit
moved
(
event
->
pos
());
}
void
UBKeyboardPalette
::
adjustSizeAndPosition
(
bool
pUp
)
{
QSize
rSize
=
sizeHint
();
if
(
rSize
!=
size
())
{
int
dx
=
(
rSize
.
width
()
-
size
().
width
())
/
2
;
int
dy
=
rSize
.
height
()
-
size
().
height
();
QSize
rSize
=
sizeHint
();
if
(
rSize
!=
size
())
{
int
dx
=
(
rSize
.
width
()
-
size
().
width
())
/
2
;
int
dy
=
rSize
.
height
()
-
size
().
height
();
this
->
move
(
x
()
-
dx
,
y
()
-
dy
);
this
->
resize
(
rSize
.
width
(),
rSize
.
height
());
}
UBFloatingPalette
::
adjustSizeAndPosition
(
pUp
);
this
->
move
(
x
()
-
dx
,
y
()
-
dy
);
this
->
resize
(
rSize
.
width
(),
rSize
.
height
());
}
UBFloatingPalette
::
adjustSizeAndPosition
(
pUp
);
}
void
UBKeyboardPalette
::
paintEvent
(
QPaintEvent
*
event
)
{
UBFloatingPalette
::
paintEvent
(
event
);
QRect
r
=
this
->
geometry
();
int
lleft
,
ltop
,
lright
,
lbottom
;
getContentsMargins
(
&
lleft
,
&
ltop
,
&
lright
,
&
lbottom
)
;
int
btw
=
(
r
.
width
()
-
lleft
-
lright
-
13
)
/
14.5
;
int
bth
=
(
r
.
height
()
-
ltop
-
lbottom
-
4
)
/
5
;
lleft
=
(
r
.
width
()
-
(
btw
*
14.5
+
13
))
/
2
;
ltop
=
(
r
.
height
()
-
(
bth
*
5
+
4
))
/
2
;
int
off
=
lleft
;;
for
(
int
i
=
0
;
i
<
13
;
i
++
)
{
QRect
cr
(
off
,
ltop
,
btw
,
bth
);
buttons
[
i
]
->
setGeometry
(
cr
);
off
+=
btw
+
1
;
}
ctrlButtons
[
0
]
->
setGeometry
(
off
,
ltop
,
btw
*
1.5
,
bth
);
off
+=
btw
*
1.5
;
lright
=
off
;
ltop
+=
bth
+
1
;
int
lwidth
=
12
*
btw
+
12
+
btw
*
1.3
;
off
=
(
r
.
width
()
-
lwidth
)
/
2
;
ctrlButtons
[
1
]
->
setGeometry
(
off
,
ltop
,
btw
*
1.3
,
bth
);
off
+=
btw
*
1.3
+
1
;
for
(
int
i
=
0
;
i
<
12
;
i
++
)
{
QRect
cr
(
off
,
ltop
,
btw
,
bth
);
buttons
[
13
+
i
]
->
setGeometry
(
cr
);
off
+=
btw
+
1
;
}
ltop
+=
bth
+
1
;
lwidth
=
12
*
btw
+
12
+
btw
*
2
;
off
=
(
r
.
width
()
-
lwidth
)
/
2
;
for
(
int
i
=
0
;
i
<
12
;
i
++
)
{
QRect
cr
(
off
,
ltop
,
btw
,
bth
);
buttons
[
13
+
12
+
i
]
->
setGeometry
(
cr
);
off
+=
btw
+
1
;
}
ctrlButtons
[
2
]
->
setGeometry
(
off
,
ltop
,
btw
*
2
,
bth
);
ltop
+=
bth
+
1
;
lwidth
=
12
*
btw
+
11
;
off
=
(
r
.
width
()
-
lwidth
)
/
2
;
ctrlButtons
[
3
]
->
setGeometry
(
off
,
ltop
,
btw
,
bth
);
off
+=
btw
+
1
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
QRect
cr
(
off
,
ltop
,
btw
,
bth
);
buttons
[
13
+
12
+
12
+
i
]
->
setGeometry
(
cr
);
off
+=
btw
+
1
;
}
ctrlButtons
[
4
]
->
setGeometry
(
r
.
x
()
+
off
,
ltop
,
btw
,
bth
);
ltop
+=
bth
+
1
;
lwidth
=
11
*
btw
+
2
;
off
=
(
r
.
width
()
-
lwidth
)
/
2
;
ctrlButtons
[
5
]
->
setGeometry
(
off
,
ltop
,
btw
,
bth
);
ctrlButtons
[
6
]
->
setGeometry
(
off
+
btw
+
1
,
ltop
,
btw
*
9
,
bth
);
ctrlButtons
[
7
]
->
setGeometry
(
off
+
btw
*
10
+
2
,
ltop
,
btw
,
bth
);
UBFloatingPalette
::
paintEvent
(
event
);
QRect
r
=
this
->
geometry
();
int
lleft
,
ltop
,
lright
,
lbottom
;
getContentsMargins
(
&
lleft
,
&
ltop
,
&
lright
,
&
lbottom
)
;
int
btw
=
(
r
.
width
()
-
lleft
-
lright
-
13
)
/
14.5
;
int
bth
=
(
r
.
height
()
-
ltop
-
lbottom
-
4
)
/
5
;
lleft
=
(
r
.
width
()
-
(
btw
*
14.5
+
13
))
/
2
;
ltop
=
(
r
.
height
()
-
(
bth
*
5
+
4
))
/
2
;
int
off
=
lleft
;;
for
(
int
i
=
0
;
i
<
13
;
i
++
)
{
QRect
cr
(
off
,
ltop
,
btw
,
bth
);
buttons
[
i
]
->
setGeometry
(
cr
);
off
+=
btw
+
1
;
}
ctrlButtons
[
0
]
->
setGeometry
(
off
,
ltop
,
btw
*
1.5
,
bth
);
off
+=
btw
*
1.5
;
lright
=
off
;
ltop
+=
bth
+
1
;
int
lwidth
=
12
*
btw
+
12
+
btw
*
1.3
;
off
=
(
r
.
width
()
-
lwidth
)
/
2
;
ctrlButtons
[
1
]
->
setGeometry
(
off
,
ltop
,
btw
*
1.3
,
bth
);
off
+=
btw
*
1.3
+
1
;
for
(
int
i
=
0
;
i
<
12
;
i
++
)
{
QRect
cr
(
off
,
ltop
,
btw
,
bth
);
buttons
[
13
+
i
]
->
setGeometry
(
cr
);
off
+=
btw
+
1
;
}
ltop
+=
bth
+
1
;
lwidth
=
12
*
btw
+
12
+
btw
*
2
;
off
=
(
r
.
width
()
-
lwidth
)
/
2
;
for
(
int
i
=
0
;
i
<
12
;
i
++
)
{
QRect
cr
(
off
,
ltop
,
btw
,
bth
);
buttons
[
13
+
12
+
i
]
->
setGeometry
(
cr
);
off
+=
btw
+
1
;
}
ctrlButtons
[
2
]
->
setGeometry
(
off
,
ltop
,
btw
*
2
,
bth
);
ltop
+=
bth
+
1
;
lwidth
=
12
*
btw
+
11
;
off
=
(
r
.
width
()
-
lwidth
)
/
2
;
ctrlButtons
[
3
]
->
setGeometry
(
off
,
ltop
,
btw
,
bth
);
off
+=
btw
+
1
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
QRect
cr
(
off
,
ltop
,
btw
,
bth
);
buttons
[
13
+
12
+
12
+
i
]
->
setGeometry
(
cr
);
off
+=
btw
+
1
;
}
ctrlButtons
[
4
]
->
setGeometry
(
r
.
x
()
+
off
,
ltop
,
btw
,
bth
);
ltop
+=
bth
+
1
;
lwidth
=
11
*
btw
+
2
;
off
=
(
r
.
width
()
-
lwidth
)
/
2
;
ctrlButtons
[
5
]
->
setGeometry
(
off
,
ltop
,
btw
,
bth
);
ctrlButtons
[
6
]
->
setGeometry
(
off
+
btw
+
1
,
ltop
,
btw
*
9
,
bth
);
ctrlButtons
[
7
]
->
setGeometry
(
off
+
btw
*
10
+
2
,
ltop
,
btw
,
bth
);
}
/*
UBKeyboardButton
UBKeyboardButton
*/
UBKeyboardButton
::
UBKeyboardButton
(
UBKeyboardPalette
*
parent
)
:
QWidget
(
parent
),
bFocused
(
false
),
bPres
sed
(
false
),
keyboard
(
parent
)
:
QWidget
(
parent
),
keyboard
(
parent
),
bFocu
sed
(
false
),
bPressed
(
false
)
{
setCursor
(
Qt
::
PointingHandCursor
);
setCursor
(
Qt
::
PointingHandCursor
);
}
UBKeyboardButton
::~
UBKeyboardButton
()
...
...
@@ -321,48 +321,48 @@ UBKeyboardButton::~UBKeyboardButton()
void
UBKeyboardButton
::
paintEvent
(
QPaintEvent
*
)
{
QPainter
painter
(
this
);
QPainter
painter
(
this
);
if
(
bPressed
)
painter
.
setBrush
(
QBrush
(
QColor
(
0
,
0xcc
,
0
)));
else
if
(
bFocused
)
painter
.
setBrush
(
QBrush
(
QColor
(
0xcc
,
0
,
0
)));
if
(
bPressed
)
painter
.
setBrush
(
QBrush
(
QColor
(
0
,
0xcc
,
0
)));
else
if
(
bFocused
)
painter
.
setBrush
(
QBrush
(
QColor
(
0xcc
,
0
,
0
)));
painter
.
drawRoundedRect
(
0
,
0
,
width
()
-
1
,
height
()
-
1
,
3
,
3
);
this
->
paintContent
(
painter
);
this
->
paintContent
(
painter
);
}
void
UBKeyboardButton
::
enterEvent
(
QEvent
*
)
{
bFocused
=
true
;
update
();
bFocused
=
true
;
update
();
}
void
UBKeyboardButton
::
leaveEvent
(
QEvent
*
)
{
bFocused
=
false
;
update
();
bFocused
=
false
;
update
();
}
void
UBKeyboardButton
::
mousePressEvent
(
QMouseEvent
*
event
)
{
event
->
accept
();
bPressed
=
true
;
update
();
this
->
onPress
();
event
->
accept
();
bPressed
=
true
;
update
();
this
->
onPress
();
}
void
UBKeyboardButton
::
mouseReleaseEvent
(
QMouseEvent
*
)
{
bPressed
=
false
;
update
();
this
->
onRelease
();
bPressed
=
false
;
update
();
this
->
onRelease
();
}
UBKeyButton
::
UBKeyButton
(
UBKeyboardPalette
*
parent
)
:
UBKeyboardButton
(
parent
),
keybt
(
0
)
:
UBKeyboardButton
(
parent
),
keybt
(
0
)
{}
UBKeyButton
::~
UBKeyButton
()
...
...
@@ -370,8 +370,8 @@ UBKeyButton::~UBKeyButton()
void
UBKeyButton
::
onPress
()
{
if
(
keybt
!=
NULL
)
sendUnicodeSymbol
(
keybt
->
code1
,
keybt
->
code2
,
capsLock
());
if
(
keybt
!=
NULL
)
sendUnicodeSymbol
(
keybt
->
code1
,
keybt
->
code2
,
capsLock
());
}
void
UBKeyButton
::
onRelease
()
...
...
@@ -380,19 +380,19 @@ void UBKeyButton::onRelease()
void
UBKeyButton
::
paintContent
(
QPainter
&
painter
)
{
if
(
keybt
)
{
QString
text
(
QChar
(
capsLock
()
?
keybt
->
symbol2
:
keybt
->
symbol1
));
QRect
textRect
(
rect
().
x
()
+
2
,
rect
().
y
()
+
2
,
rect
().
width
()
-
4
,
rect
().
height
()
-
4
);
painter
.
drawText
(
textRect
,
Qt
::
AlignCenter
,
text
);
}
if
(
keybt
)
{
QString
text
(
QChar
(
capsLock
()
?
keybt
->
symbol2
:
keybt
->
symbol1
));
QRect
textRect
(
rect
().
x
()
+
2
,
rect
().
y
()
+
2
,
rect
().
width
()
-
4
,
rect
().
height
()
-
4
);
painter
.
drawText
(
textRect
,
Qt
::
AlignCenter
,
text
);
}
}
UBCntrlButton
::
UBCntrlButton
(
UBKeyboardPalette
*
parent
,
const
QString
&
_label
,
int
_code
)
:
UBKeyboardButton
(
parent
),
label
(
_label
),
code
(
_code
)
:
UBKeyboardButton
(
parent
),
label
(
_label
),
code
(
_code
)
{}
UBCntrlButton
::~
UBCntrlButton
()
...
...
@@ -400,7 +400,7 @@ UBCntrlButton::~UBCntrlButton()
void
UBCntrlButton
::
onPress
()
{
sendControlSymbol
(
code
);
sendControlSymbol
(
code
);
}
void
UBCntrlButton
::
onRelease
()
...
...
@@ -408,11 +408,11 @@ void UBCntrlButton::onRelease()
void
UBCntrlButton
::
paintContent
(
QPainter
&
painter
)
{
painter
.
drawText
(
rect
(),
Qt
::
AlignCenter
,
label
);
painter
.
drawText
(
rect
(),
Qt
::
AlignCenter
,
label
);
}
UBCapsLockButton
::
UBCapsLockButton
(
UBKeyboardPalette
*
parent
)
:
UBKeyboardButton
(
parent
)
:
UBKeyboardButton
(
parent
)
{}
UBCapsLockButton
::~
UBCapsLockButton
()
...
...
@@ -420,8 +420,8 @@ UBCapsLockButton::~UBCapsLockButton()
void
UBCapsLockButton
::
onPress
()
{
keyboard
->
capsLock
=
!
keyboard
->
capsLock
;
keyboard
->
update
();
keyboard
->
capsLock
=
!
keyboard
->
capsLock
;
keyboard
->
update
();
}
void
UBCapsLockButton
::
onRelease
()
...
...
@@ -429,27 +429,27 @@ void UBCapsLockButton::onRelease()
void
UBCapsLockButton
::
paintContent
(
QPainter
&
painter
)
{
painter
.
drawText
(
rect
(),
Qt
::
AlignCenter
,
"^"
);
painter
.
drawText
(
rect
(),
Qt
::
AlignCenter
,
"^"
);
}
UBLocaleButton
::
UBLocaleButton
(
UBKeyboardPalette
*
parent
)
:
UBKeyboardButton
(
parent
)
:
UBKeyboardButton
(
parent
)
{
localeMenu
=
new
QMenu
(
this
);
localeMenu
=
new
QMenu
(
this
);
for
(
int
i
=
0
;
i
<
parent
->
nLocalesCount
;
i
++
)
{
QAction
*
action
=
(
parent
->
locales
[
i
]
->
icon
!=
NULL
)
?
localeMenu
->
addAction
(
*
parent
->
locales
[
i
]
->
icon
,
parent
->
locales
[
i
]
->
fullName
)
:
localeMenu
->
addAction
(
parent
->
locales
[
i
]
->
fullName
);
action
->
setData
(
QVariant
(
i
));
}
for
(
int
i
=
0
;
i
<
parent
->
nLocalesCount
;
i
++
)
{
QAction
*
action
=
(
parent
->
locales
[
i
]
->
icon
!=
NULL
)
?
localeMenu
->
addAction
(
*
parent
->
locales
[
i
]
->
icon
,
parent
->
locales
[
i
]
->
fullName
)
:
localeMenu
->
addAction
(
parent
->
locales
[
i
]
->
fullName
);
action
->
setData
(
QVariant
(
i
));
}
}
UBLocaleButton
::~
UBLocaleButton
()
{
delete
localeMenu
;
delete
localeMenu
;
}
void
UBLocaleButton
::
onPress
()
...
...
@@ -458,19 +458,19 @@ void UBLocaleButton::onPress()
void
UBLocaleButton
::
onRelease
()
{
keyboard
->
languagePopupActive
=
true
;
QAction
*
action
=
localeMenu
->
exec
(
mapToGlobal
(
QPoint
(
0
,
0
)));
keyboard
->
languagePopupActive
=
false
;
if
(
action
!=
NULL
)
{
int
nLocale
=
action
->
data
().
toInt
();
keyboard
->
setLocale
(
nLocale
);
}
keyboard
->
languagePopupActive
=
true
;
QAction
*
action
=
localeMenu
->
exec
(
mapToGlobal
(
QPoint
(
0
,
0
)));
keyboard
->
languagePopupActive
=
false
;
if
(
action
!=
NULL
)
{
int
nLocale
=
action
->
data
().
toInt
();
keyboard
->
setLocale
(
nLocale
);
}
}
void
UBLocaleButton
::
paintContent
(
QPainter
&
painter
)
{
const
QString
*
localeName
=
keyboard
->
getLocaleName
();
if
(
localeName
!=
NULL
)
painter
.
drawText
(
rect
(),
Qt
::
AlignCenter
,
*
localeName
);
const
QString
*
localeName
=
keyboard
->
getLocaleName
();
if
(
localeName
!=
NULL
)
painter
.
drawText
(
rect
(),
Qt
::
AlignCenter
,
*
localeName
);
}
src/gui/UBKeyboardPalette_linux.cpp
View file @
383fd02a
...
...
@@ -41,7 +41,7 @@ void x11SendKey(Display *display, int keyCode, int modifiers)
// Get the root window for the current display.
Window
winRoot
=
XDefaultRootWindow
(
display
);
if
(
winRoot
==
NULL
)
if
(
winRoot
==
0
)
return
;
// Find the window which has the current keyboard focus.
...
...
src/gui/UBLibNavigatorWidget.cpp
View file @
383fd02a
...
...
@@ -69,16 +69,6 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
*/
UBLibNavigatorWidget
::~
UBLibNavigatorWidget
()
{
//if(NULL != mLayout)
//{
// delete mLayout;
// mLayout = NULL;
//}
//if(NULL != mLibWidget)
//{
// delete mLibWidget;
// mLibWidget = NULL;
//}
if
(
NULL
!=
mPathViewer
)
{
delete
mPathViewer
;
...
...
@@ -99,7 +89,7 @@ UBLibNavigatorWidget::~UBLibNavigatorWidget()
void
UBLibNavigatorWidget
::
dropMe
(
const
QMimeData
*
_data
)
{
// Forward the mime data to the library widget
Q_UNUSED
(
_data
);
}
/**
...
...
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