|
|
@ -32,7 +32,7 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent) |
|
|
|
btnWidth = btnHeight = 16; |
|
|
|
btnWidth = btnHeight = 16; |
|
|
|
|
|
|
|
|
|
|
|
buttons = new UBKeyButton*[47]; |
|
|
|
buttons = new UBKeyButton*[47]; |
|
|
|
for(int i=0; i<47; i++) |
|
|
|
for (int i=0; i<47; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
buttons[i] = new UBKeyButton(this); |
|
|
|
buttons[i] = new UBKeyButton(this); |
|
|
|
} |
|
|
|
} |
|
|
@ -102,7 +102,7 @@ void UBKeyboardPalette::setInput(const UBKeyboardLocale* locale) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (locale!=NULL) |
|
|
|
if (locale!=NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for(int i=0; i<47; i++) |
|
|
|
for (int i=0; i<47; i++) |
|
|
|
buttons[i]->setKeyBt((*locale)[i]); |
|
|
|
buttons[i]->setKeyBt((*locale)[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -113,17 +113,17 @@ void UBKeyboardPalette::setInput(const UBKeyboardLocale* locale) |
|
|
|
|
|
|
|
|
|
|
|
UBKeyboardPalette::~UBKeyboardPalette() |
|
|
|
UBKeyboardPalette::~UBKeyboardPalette() |
|
|
|
{ |
|
|
|
{ |
|
|
|
for(int i=0; i<47; i++) |
|
|
|
for (int i=0; i<47; i++) |
|
|
|
delete buttons[i]; |
|
|
|
delete buttons[i]; |
|
|
|
delete [] buttons; |
|
|
|
delete [] buttons; |
|
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<8; i++) |
|
|
|
for (int i=0; i<8; i++) |
|
|
|
delete ctrlButtons[i]; |
|
|
|
delete ctrlButtons[i]; |
|
|
|
delete [] ctrlButtons; |
|
|
|
delete [] ctrlButtons; |
|
|
|
|
|
|
|
|
|
|
|
if (locales!=NULL) |
|
|
|
if (locales!=NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for(int i=0; i<nLocalesCount; i++) |
|
|
|
for (int i=0; i<nLocalesCount; i++) |
|
|
|
delete locales[i]; |
|
|
|
delete locales[i]; |
|
|
|
delete [] locales; |
|
|
|
delete [] locales; |
|
|
|
} |
|
|
|
} |
|
|
@ -247,7 +247,7 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event) |
|
|
|
ltop = (r.height() - (bth * 5 + 4)) / 2; |
|
|
|
ltop = (r.height() - (bth * 5 + 4)) / 2; |
|
|
|
|
|
|
|
|
|
|
|
int off = lleft;; |
|
|
|
int off = lleft;; |
|
|
|
for(int i = 0; i<13; i++) |
|
|
|
for (int i = 0; i<13; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QRect cr(off, ltop, btw, bth); |
|
|
|
QRect cr(off, ltop, btw, bth); |
|
|
|
buttons[i]->setGeometry(cr); |
|
|
|
buttons[i]->setGeometry(cr); |
|
|
@ -262,7 +262,7 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event) |
|
|
|
off = (r.width() - lwidth) / 2; |
|
|
|
off = (r.width() - lwidth) / 2; |
|
|
|
ctrlButtons[1]->setGeometry(off, ltop, btw * 1.3, bth); |
|
|
|
ctrlButtons[1]->setGeometry(off, ltop, btw * 1.3, bth); |
|
|
|
off += btw * 1.3 + 1; |
|
|
|
off += btw * 1.3 + 1; |
|
|
|
for(int i=0; i<12; i++) |
|
|
|
for (int i=0; i<12; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QRect cr(off, ltop, btw, bth); |
|
|
|
QRect cr(off, ltop, btw, bth); |
|
|
|
buttons[13 + i]->setGeometry(cr); |
|
|
|
buttons[13 + i]->setGeometry(cr); |
|
|
@ -272,7 +272,7 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event) |
|
|
|
ltop += bth + 1; |
|
|
|
ltop += bth + 1; |
|
|
|
lwidth = 12 * btw + 12 + btw * 2; |
|
|
|
lwidth = 12 * btw + 12 + btw * 2; |
|
|
|
off = (r.width() - lwidth) / 2; |
|
|
|
off = (r.width() - lwidth) / 2; |
|
|
|
for(int i=0; i<12; i++) |
|
|
|
for (int i=0; i<12; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QRect cr(off, ltop, btw, bth); |
|
|
|
QRect cr(off, ltop, btw, bth); |
|
|
|
buttons[13 + 12 + i]->setGeometry(cr); |
|
|
|
buttons[13 + 12 + i]->setGeometry(cr); |
|
|
@ -285,7 +285,7 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event) |
|
|
|
off = (r.width() - lwidth) / 2; |
|
|
|
off = (r.width() - lwidth) / 2; |
|
|
|
ctrlButtons[3]->setGeometry(off, ltop, btw, bth); |
|
|
|
ctrlButtons[3]->setGeometry(off, ltop, btw, bth); |
|
|
|
off+=btw+1; |
|
|
|
off+=btw+1; |
|
|
|
for(int i=0; i<10; i++) |
|
|
|
for (int i=0; i<10; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QRect cr(off, ltop, btw, bth); |
|
|
|
QRect cr(off, ltop, btw, bth); |
|
|
|
buttons[13 + 12 + 12 + i]->setGeometry(cr); |
|
|
|
buttons[13 + 12 + 12 + i]->setGeometry(cr); |
|
|
@ -309,9 +309,9 @@ void UBKeyboardPalette::paintEvent( QPaintEvent* event) |
|
|
|
|
|
|
|
|
|
|
|
UBKeyboardButton::UBKeyboardButton(UBKeyboardPalette* parent) |
|
|
|
UBKeyboardButton::UBKeyboardButton(UBKeyboardPalette* parent) |
|
|
|
:QWidget(parent), |
|
|
|
:QWidget(parent), |
|
|
|
|
|
|
|
keyboard(parent), |
|
|
|
bFocused(false), |
|
|
|
bFocused(false), |
|
|
|
bPressed(false), |
|
|
|
bPressed(false) |
|
|
|
keyboard(parent) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
setCursor(Qt::PointingHandCursor); |
|
|
|
setCursor(Qt::PointingHandCursor); |
|
|
|
} |
|
|
|
} |
|
|
@ -361,8 +361,8 @@ void UBKeyboardButton::mouseReleaseEvent ( QMouseEvent * ) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBKeyButton::UBKeyButton(UBKeyboardPalette* parent) |
|
|
|
UBKeyButton::UBKeyButton(UBKeyboardPalette* parent) |
|
|
|
:UBKeyboardButton(parent), |
|
|
|
:UBKeyboardButton(parent), |
|
|
|
keybt(0) |
|
|
|
keybt(0) |
|
|
|
{} |
|
|
|
{} |
|
|
|
|
|
|
|
|
|
|
|
UBKeyButton::~UBKeyButton() |
|
|
|
UBKeyButton::~UBKeyButton() |
|
|
@ -390,9 +390,9 @@ void UBKeyButton::paintContent(QPainter& painter) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBCntrlButton::UBCntrlButton(UBKeyboardPalette* parent, const QString& _label, int _code ) |
|
|
|
UBCntrlButton::UBCntrlButton(UBKeyboardPalette* parent, const QString& _label, int _code ) |
|
|
|
:UBKeyboardButton(parent), |
|
|
|
:UBKeyboardButton(parent), |
|
|
|
label(_label), |
|
|
|
label(_label), |
|
|
|
code(_code) |
|
|
|
code(_code) |
|
|
|
{} |
|
|
|
{} |
|
|
|
|
|
|
|
|
|
|
|
UBCntrlButton::~UBCntrlButton() |
|
|
|
UBCntrlButton::~UBCntrlButton() |
|
|
@ -412,7 +412,7 @@ void UBCntrlButton::paintContent(QPainter& painter) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBCapsLockButton::UBCapsLockButton(UBKeyboardPalette* parent) |
|
|
|
UBCapsLockButton::UBCapsLockButton(UBKeyboardPalette* parent) |
|
|
|
:UBKeyboardButton(parent) |
|
|
|
:UBKeyboardButton(parent) |
|
|
|
{} |
|
|
|
{} |
|
|
|
|
|
|
|
|
|
|
|
UBCapsLockButton::~UBCapsLockButton() |
|
|
|
UBCapsLockButton::~UBCapsLockButton() |
|
|
@ -434,11 +434,11 @@ void UBCapsLockButton::paintContent(QPainter& painter) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBLocaleButton::UBLocaleButton(UBKeyboardPalette* parent) |
|
|
|
UBLocaleButton::UBLocaleButton(UBKeyboardPalette* parent) |
|
|
|
:UBKeyboardButton(parent) |
|
|
|
:UBKeyboardButton(parent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
localeMenu = new QMenu(this); |
|
|
|
localeMenu = new QMenu(this); |
|
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<parent->nLocalesCount; i++) |
|
|
|
for (int i=0; i<parent->nLocalesCount; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QAction* action = (parent->locales[i]->icon!=NULL) ? |
|
|
|
QAction* action = (parent->locales[i]->icon!=NULL) ? |
|
|
|
localeMenu->addAction(*parent->locales[i]->icon, parent->locales[i]->fullName) |
|
|
|
localeMenu->addAction(*parent->locales[i]->icon, parent->locales[i]->fullName) |
|
|
|