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
42a7fef6
Commit
42a7fef6
authored
Aug 09, 2011
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
parents
f7a7e94a
caf68d99
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
353 additions
and
311 deletions
+353
-311
UBPreferencesController.cpp
src/core/UBPreferencesController.cpp
+7
-2
UBSettings.cpp
src/core/UBSettings.cpp
+34
-1
UBSettings.h
src/core/UBSettings.h
+5
-0
UBDesktopAnnotationController.cpp
src/desktop/UBDesktopAnnotationController.cpp
+2
-1
UBPlatformUtils_win.cpp
src/frameworks/UBPlatformUtils_win.cpp
+1
-1
UBKeyboardPalette.cpp
src/gui/UBKeyboardPalette.cpp
+11
-13
UBKeyboardPalette_linux.cpp
src/gui/UBKeyboardPalette_linux.cpp
+189
-189
UBKeyboardPalette_mac.cpp
src/gui/UBKeyboardPalette_mac.cpp
+96
-96
UBGraphicsTriangle.cpp
src/tools/UBGraphicsTriangle.cpp
+8
-8
No files found.
src/core/UBPreferencesController.cpp
View file @
42a7fef6
...
...
@@ -106,8 +106,13 @@ void UBPreferencesController::wire()
// OSK preferences
mPreferencesUI
->
keyboardPaletteKeyButtonSize
->
addItem
(
"29x29"
);
mPreferencesUI
->
keyboardPaletteKeyButtonSize
->
addItem
(
"41x41"
);
for
(
int
i
=
0
;
i
<
settings
->
supportedKeyboardSizes
->
size
();
i
++
)
mPreferencesUI
->
keyboardPaletteKeyButtonSize
->
addItem
(
settings
->
supportedKeyboardSizes
->
at
(
i
));
// mPreferencesUI->keyboardPaletteKeyButtonSize->addItem("29x29");
// mPreferencesUI->keyboardPaletteKeyButtonSize->addItem("30x30");
// mPreferencesUI->keyboardPaletteKeyButtonSize->addItem("41x41");
connect
(
mPreferencesUI
->
keyboardPaletteKeyButtonSize
,
SIGNAL
(
currentIndexChanged
(
const
QString
&
)),
settings
->
boardKeyboardPaletteKeyBtnSize
,
SLOT
(
setString
(
const
QString
&
)));
...
...
src/core/UBSettings.cpp
View file @
42a7fef6
...
...
@@ -120,6 +120,8 @@ QSettings* UBSettings::getAppSettings()
UBSettings
::
UBSettings
(
QObject
*
parent
)
:
QObject
(
parent
)
{
InitKeyboardPaletteKeyBtnSizes
();
mAppSettings
=
UBSettings
::
getAppSettings
();
QString
userSettingsFile
=
UBSettings
::
uniboardDataDirectory
()
+
"/UniboardUser.config"
;
...
...
@@ -133,8 +135,38 @@ UBSettings::UBSettings(QObject *parent)
UBSettings
::~
UBSettings
()
{
delete
mAppSettings
;
if
(
supportedKeyboardSizes
)
delete
supportedKeyboardSizes
;
}
void
UBSettings
::
InitKeyboardPaletteKeyBtnSizes
()
{
supportedKeyboardSizes
=
new
QStringList
();
supportedKeyboardSizes
->
append
(
"29x29"
);
supportedKeyboardSizes
->
append
(
"41x41"
);
}
void
UBSettings
::
ValidateKeyboardPaletteKeyBtnSize
()
{
// if boardKeyboardPaletteKeyBtnSize is not initialized, or supportedKeyboardSizes not initialized or empty
if
(
!
boardKeyboardPaletteKeyBtnSize
||
!
supportedKeyboardSizes
||
supportedKeyboardSizes
->
size
()
==
0
)
return
;
// get original size value
QString
origValue
=
boardKeyboardPaletteKeyBtnSize
->
get
().
toString
();
// parse available size values, for make sure original value is valid
for
(
int
i
=
0
;
i
<
supportedKeyboardSizes
->
size
();
i
++
)
{
int
compareCode
=
QString
::
compare
(
origValue
,
supportedKeyboardSizes
->
at
(
i
));
if
(
compareCode
==
0
)
return
;
}
// if original value is invalid, than set it value to first value from avaliable list
boardKeyboardPaletteKeyBtnSize
->
set
(
supportedKeyboardSizes
->
at
(
0
));
}
void
UBSettings
::
init
()
{
...
...
@@ -192,7 +224,8 @@ void UBSettings::init()
boardUseHighResTabletEvent
=
new
UBSetting
(
this
,
"Board"
,
"UseHighResTabletEvent"
,
true
);
// boardKeyboardPaletteAutoMinimize = new UBSetting(this, "Board", "KeyboardPaletteAutoMinimize", true);
boardKeyboardPaletteKeyBtnSize
=
new
UBSetting
(
this
,
"Board"
,
"KeyboardPaletteKeyBtnSize"
,
"24x24"
);
boardKeyboardPaletteKeyBtnSize
=
new
UBSetting
(
this
,
"Board"
,
"KeyboardPaletteKeyBtnSize"
,
"16x16"
);
ValidateKeyboardPaletteKeyBtnSize
();
QStringList
penLightBackgroundColors
;
penLightBackgroundColors
<<
"#000000"
<<
"#FF0000"
<<
"#004080"
<<
"#008000"
<<
"#C87400"
<<
"#800040"
<<
"#008080"
<<
"#5F2D0A"
;
...
...
src/core/UBSettings.h
View file @
42a7fef6
...
...
@@ -37,6 +37,11 @@ class UBSettings : public QObject
public
:
QStringList
*
supportedKeyboardSizes
;
void
InitKeyboardPaletteKeyBtnSizes
();
void
ValidateKeyboardPaletteKeyBtnSize
();
int
penWidthIndex
();
qreal
currentPenWidth
();
...
...
src/desktop/UBDesktopAnnotationController.cpp
View file @
42a7fef6
...
...
@@ -88,7 +88,8 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
if
(
UBPlatformUtils
::
hasVirtualKeyboard
())
{
mKeyboardPalette
=
UBKeyboardPalette
::
create
(
mTransparentDrawingView
);
//mKeyboardPalette->setParent(mTransparentDrawingView);
mKeyboardPalette
->
setParent
(
mTransparentDrawingView
);
connect
(
mKeyboardPalette
,
SIGNAL
(
keyboardActivated
(
bool
)),
mTransparentDrawingView
,
SLOT
(
virtualKeyboardActivated
(
bool
)));
}
connect
(
mDesktopPalette
,
SIGNAL
(
uniboardClick
()),
this
,
SLOT
(
goToUniboard
()));
...
...
src/frameworks/UBPlatformUtils_win.cpp
View file @
42a7fef6
...
...
@@ -363,7 +363,7 @@ void UBPlatformUtils::initializeKeyboardLayouts()
void
UBPlatformUtils
::
destroyKeyboardLayouts
()
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
i
=
0
;
i
<
nKeyboardLayouts
;
i
++
)
delete
keyboardLayouts
[
i
];
delete
[]
keyboardLayouts
;
keyboardLayouts
=
NULL
;
...
...
src/gui/UBKeyboardPalette.cpp
View file @
42a7fef6
...
...
@@ -82,8 +82,6 @@ UBKeyboardPalette* UBKeyboardPalette::create(QWidget *parent)
connect
(
inst
,
SIGNAL
(
localeChanged
(
int
)),
instance
,
SLOT
(
syncLocale
(
int
)));
connect
(
instance
,
SIGNAL
(
localeChanged
(
int
)),
inst
,
SLOT
(
syncLocale
(
int
)));
// connect(instance, SIGNAL(closed()), inst, )
}
return
instance
;
...
...
@@ -91,7 +89,7 @@ UBKeyboardPalette* UBKeyboardPalette::create(QWidget *parent)
void
UBKeyboardPalette
::
hideKeyboard
()
{
UBApplication
::
mainWindow
->
actionVirtualKeyboard
->
activate
(
QAction
.
Trigger
);
UBApplication
::
mainWindow
->
actionVirtualKeyboard
->
activate
(
QAction
::
Trigger
);
}
void
UBKeyboardPalette
::
syncPosition
(
const
QPoint
&
pos
)
...
...
@@ -125,20 +123,20 @@ void UBKeyboardPalette::setInput(const UBKeyboardLocale* locale)
UBKeyboardPalette
::~
UBKeyboardPalette
()
{
for
(
int
i
=
0
;
i
<
47
;
i
++
)
delete
buttons
[
i
];
//
for (int i=0; i<47; i++)
//
delete buttons[i];
delete
[]
buttons
;
for
(
int
i
=
0
;
i
<
8
;
i
++
)
delete
ctrlButtons
[
i
];
//
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;
//
}
if
(
currBtnImages
!=
NULL
)
{
...
...
src/gui/UBKeyboardPalette_linux.cpp
View file @
42a7fef6
This diff is collapsed.
Click to expand it.
src/gui/UBKeyboardPalette_mac.cpp
View file @
42a7fef6
...
...
@@ -12,99 +12,99 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBKeyboardPalette.h"
#include <stdio.h>
#include <CoreServices/CoreServices.h>
#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
#include <QMap>
#include <QString>
void
UBKeyboardButton
::
sendUnicodeSymbol
(
unsigned
int
nSymbol1
,
unsigned
int
nSymbol2
,
bool
shift
)
{
unsigned
int
nSymbol
=
(
shift
)
?
nSymbol2
:
nSymbol1
;
if
(
shift
)
CGEventPost
(
kCGSessionEventTap
,
CGEventCreateKeyboardEvent
(
NULL
,
56
,
true
));
CGEventPost
(
kCGSessionEventTap
,
CGEventCreateKeyboardEvent
(
NULL
,
nSymbol
,
true
));
CGEventPost
(
kCGSessionEventTap
,
CGEventCreateKeyboardEvent
(
NULL
,
nSymbol
,
false
));
if
(
shift
)
CGEventPost
(
kCGSessionEventTap
,
CGEventCreateKeyboardEvent
(
NULL
,
56
,
false
));
}
void
UBKeyboardButton
::
sendControlSymbol
(
int
nSymbol
)
{
CGEventRef
event1
=
CGEventCreateKeyboardEvent
(
NULL
,
nSymbol
,
true
);
CGEventRef
event2
=
CGEventCreateKeyboardEvent
(
NULL
,
nSymbol
,
false
);
CGEventPost
(
kCGHIDEventTap
,
event1
);
CGEventPost
(
kCGHIDEventTap
,
event2
);
}
void
UBKeyboardPalette
::
createCtrlButtons
()
{
ctrlButtons
=
new
UBKeyboardButton
*
[
7
];
ctrlButtons
[
0
]
=
new
UBCntrlButton
(
this
,
"<-"
,
51
);
ctrlButtons
[
1
]
=
new
UBCntrlButton
(
this
,
"<->"
,
48
);
ctrlButtons
[
2
]
=
new
UBCntrlButton
(
this
,
"Enter"
,
76
);
ctrlButtons
[
3
]
=
new
UBCapsLockButton
(
this
);
ctrlButtons
[
4
]
=
new
UBCapsLockButton
(
this
);
ctrlButtons
[
5
]
=
new
UBLocaleButton
(
this
);
ctrlButtons
[
6
]
=
new
UBCntrlButton
(
this
,
""
,
49
);
ctrlButtons
[
7
]
=
new
UBLocaleButton
(
this
);
}
void
SetMacLocaleByIdentifier
(
const
QString
&
id
)
{
const
char
*
strName
=
id
.
toAscii
().
data
();
CFStringRef
iName
=
CFStringCreateWithCString
(
NULL
,
strName
,
kCFStringEncodingMacRoman
);
CFStringRef
keys
[]
=
{
kTISPropertyInputSourceCategory
,
kTISPropertyInputSourceID
};
CFStringRef
values
[]
=
{
kTISCategoryKeyboardInputSource
,
iName
};
CFDictionaryRef
dict
=
CFDictionaryCreate
(
NULL
,
(
const
void
**
)
keys
,
(
const
void
**
)
values
,
2
,
NULL
,
NULL
);
CFArrayRef
kbds
=
TISCreateInputSourceList
(
dict
,
true
);
if
(
CFArrayGetCount
(
kbds
)
!=
0
)
{
TISInputSourceRef
klRef
=
(
TISInputSourceRef
)
CFArrayGetValueAtIndex
(
kbds
,
0
);
if
(
klRef
!=
NULL
)
TISSelectInputSource
(
klRef
);
}
}
void
UBKeyboardPalette
::
onActivated
(
bool
activated
)
{
if
(
activated
)
{
TISInputSourceRef
selectedLocale
=
TISCopyCurrentKeyboardInputSource
();
CFStringRef
sr
=
(
CFStringRef
)
TISGetInputSourceProperty
(
selectedLocale
,
kTISPropertyInputSourceID
);
if
(
sr
!=
NULL
)
{
char
tmp
[
1024
];
CFStringGetCString
(
sr
,
tmp
,
1024
,
0
);
activeLocale
=
tmp
;
}
else
activeLocale
=
""
;
onLocaleChanged
(
locales
[
nCurrentLocale
]);
}
else
{
if
(
activeLocale
!=
""
)
SetMacLocaleByIdentifier
(
activeLocale
);
}
}
void
UBKeyboardPalette
::
onLocaleChanged
(
UBKeyboardLocale
*
locale
)
{
SetMacLocaleByIdentifier
(
locale
->
id
);
}
#include "UBKeyboardPalette.h"
#include <stdio.h>
#include <CoreServices/CoreServices.h>
#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
#include <QMap>
#include <QString>
void
UBKeyboardButton
::
sendUnicodeSymbol
(
unsigned
int
nSymbol1
,
unsigned
int
nSymbol2
,
bool
shift
)
{
unsigned
int
nSymbol
=
(
shift
)
?
nSymbol2
:
nSymbol1
;
if
(
shift
)
CGEventPost
(
kCGSessionEventTap
,
CGEventCreateKeyboardEvent
(
NULL
,
56
,
true
));
CGEventPost
(
kCGSessionEventTap
,
CGEventCreateKeyboardEvent
(
NULL
,
nSymbol
,
true
));
CGEventPost
(
kCGSessionEventTap
,
CGEventCreateKeyboardEvent
(
NULL
,
nSymbol
,
false
));
if
(
shift
)
CGEventPost
(
kCGSessionEventTap
,
CGEventCreateKeyboardEvent
(
NULL
,
56
,
false
));
}
void
UBKeyboardButton
::
sendControlSymbol
(
int
nSymbol
)
{
CGEventRef
event1
=
CGEventCreateKeyboardEvent
(
NULL
,
nSymbol
,
true
);
CGEventRef
event2
=
CGEventCreateKeyboardEvent
(
NULL
,
nSymbol
,
false
);
CGEventPost
(
kCGHIDEventTap
,
event1
);
CGEventPost
(
kCGHIDEventTap
,
event2
);
}
void
UBKeyboardPalette
::
createCtrlButtons
()
{
ctrlButtons
=
new
UBKeyboardButton
*
[
7
];
ctrlButtons
[
0
]
=
new
UBCntrlButton
(
this
,
"<-"
,
51
);
ctrlButtons
[
1
]
=
new
UBCntrlButton
(
this
,
"<->"
,
48
);
ctrlButtons
[
2
]
=
new
UBCntrlButton
(
this
,
"Enter"
,
76
);
ctrlButtons
[
3
]
=
new
UBCapsLockButton
(
this
,
"capslock"
);
ctrlButtons
[
4
]
=
new
UBCapsLockButton
(
this
,
"capslock"
);
ctrlButtons
[
5
]
=
new
UBLocaleButton
(
this
);
ctrlButtons
[
6
]
=
new
UBCntrlButton
(
this
,
""
,
49
);
ctrlButtons
[
7
]
=
new
UBLocaleButton
(
this
);
}
void
SetMacLocaleByIdentifier
(
const
QString
&
id
)
{
const
char
*
strName
=
id
.
toAscii
().
data
();
CFStringRef
iName
=
CFStringCreateWithCString
(
NULL
,
strName
,
kCFStringEncodingMacRoman
);
CFStringRef
keys
[]
=
{
kTISPropertyInputSourceCategory
,
kTISPropertyInputSourceID
};
CFStringRef
values
[]
=
{
kTISCategoryKeyboardInputSource
,
iName
};
CFDictionaryRef
dict
=
CFDictionaryCreate
(
NULL
,
(
const
void
**
)
keys
,
(
const
void
**
)
values
,
2
,
NULL
,
NULL
);
CFArrayRef
kbds
=
TISCreateInputSourceList
(
dict
,
true
);
if
(
CFArrayGetCount
(
kbds
)
!=
0
)
{
TISInputSourceRef
klRef
=
(
TISInputSourceRef
)
CFArrayGetValueAtIndex
(
kbds
,
0
);
if
(
klRef
!=
NULL
)
TISSelectInputSource
(
klRef
);
}
}
void
UBKeyboardPalette
::
onActivated
(
bool
activated
)
{
if
(
activated
)
{
TISInputSourceRef
selectedLocale
=
TISCopyCurrentKeyboardInputSource
();
CFStringRef
sr
=
(
CFStringRef
)
TISGetInputSourceProperty
(
selectedLocale
,
kTISPropertyInputSourceID
);
if
(
sr
!=
NULL
)
{
char
tmp
[
1024
];
CFStringGetCString
(
sr
,
tmp
,
1024
,
0
);
activeLocale
=
tmp
;
}
else
activeLocale
=
""
;
onLocaleChanged
(
locales
[
nCurrentLocale
]);
}
else
{
if
(
activeLocale
!=
""
)
SetMacLocaleByIdentifier
(
activeLocale
);
}
}
void
UBKeyboardPalette
::
onLocaleChanged
(
UBKeyboardLocale
*
locale
)
{
SetMacLocaleByIdentifier
(
locale
->
id
);
}
src/tools/UBGraphicsTriangle.cpp
View file @
42a7fef6
...
...
@@ -607,13 +607,13 @@ void UBGraphicsTriangle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QPointF
delta
=
event
->
pos
()
-
event
->
lastPos
();
if
(
mOrientation
==
TopLeft
||
mOrientation
==
BottomLeft
)
{
if
(
rect
().
width
()
+
delta
.
x
()
<
sMinWidth
)
delta
.
setX
(
sMinWidth
-
rect
().
width
());
if
(
rect
().
width
()
+
delta
.
x
()
<
(
qreal
)
sMinWidth
)
delta
.
setX
(
(
qreal
)
sMinWidth
-
rect
().
width
());
}
else
{
if
(
rect
().
width
()
-
delta
.
x
()
<
sMinWidth
)
delta
.
setX
(
sMinWidth
-
rect
().
width
());
if
(
rect
().
width
()
-
delta
.
x
()
<
(
qreal
)
sMinWidth
)
delta
.
setX
(
(
qreal
)
sMinWidth
-
rect
().
width
());
}
if
(
mOrientation
==
TopLeft
||
mOrientation
==
BottomLeft
)
{
...
...
@@ -639,13 +639,13 @@ void UBGraphicsTriangle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QPointF
delta
=
event
->
pos
()
-
event
->
lastPos
();
if
(
mOrientation
==
BottomRight
||
mOrientation
==
BottomLeft
)
{
if
(
rect
().
height
()
-
delta
.
y
()
<
sMinHeight
)
delta
.
setY
(
sMinHeight
-
rect
().
height
());
if
(
rect
().
height
()
-
delta
.
y
()
<
(
qreal
)
sMinHeight
)
delta
.
setY
(
(
qreal
)
sMinHeight
-
rect
().
height
());
}
else
{
if
(
rect
().
height
()
+
delta
.
y
()
<
sMinHeight
)
delta
.
setY
(
sMinHeight
-
rect
().
height
());
if
(
rect
().
height
()
+
delta
.
y
()
<
(
qreal
)
sMinHeight
)
delta
.
setY
(
(
qreal
)
sMinHeight
-
rect
().
height
());
}
if
(
mOrientation
==
BottomRight
||
mOrientation
==
BottomLeft
)
setRect
(
QRectF
(
...
...
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