Commit 3901cc01 authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

OSK - design integration

parent 31d36e64
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -289,5 +289,27 @@ ...@@ -289,5 +289,27 @@
<file>images/toolbar/hide.png</file> <file>images/toolbar/hide.png</file>
<file>images/toolbar/record.png</file> <file>images/toolbar/record.png</file>
<file>images/libpalette/MoviesCategory.svg</file> <file>images/libpalette/MoviesCategory.svg</file>
<file>images/virtual.keyboard/41/centre-passive.png</file>
<file>images/virtual.keyboard/41/left-passive.png</file>
<file>images/virtual.keyboard/41/right-passive.png</file>
<file>images/virtual.keyboard/41/centre-active.png</file>
<file>images/virtual.keyboard/41/left-active.png</file>
<file>images/virtual.keyboard/41/right-active.png</file>
<file>images/virtual.keyboard/41/backspace.png</file>
<file>images/virtual.keyboard/41/capslock.png</file>
<file>images/virtual.keyboard/41/tab.png</file>
<file>images/virtual.keyboard/29/centre-passive.png</file>
<file>images/virtual.keyboard/29/left-passive.png</file>
<file>images/virtual.keyboard/29/right-passive.png</file>
<file>images/virtual.keyboard/29/centre-active.png</file>
<file>images/virtual.keyboard/29/left-active.png</file>
<file>images/virtual.keyboard/29/right-active.png</file>
<file>images/virtual.keyboard/29/backspace.png</file>
<file>images/virtual.keyboard/29/capslock.png</file>
<file>images/virtual.keyboard/29/tab.png</file>
</qresource> </qresource>
</RCC> </RCC>
/* /*
* This program is free software: you can redistribute it and/or modify * UBBoardPaletteManager.cpp
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * Created on: 3 nov. 2009
* but WITHOUT ANY WARRANTY; without even the implied warranty of * Author: Luc
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "UBBoardPaletteManager.h" #include "UBBoardPaletteManager.h"
...@@ -132,7 +124,10 @@ void UBBoardPaletteManager::setupPalettes() ...@@ -132,7 +124,10 @@ void UBBoardPaletteManager::setupPalettes()
mStylusPalette->show(); // always show stylus palette at startup mStylusPalette->show(); // always show stylus palette at startup
if (UBPlatformUtils::hasVirtualKeyboard()) if (UBPlatformUtils::hasVirtualKeyboard())
{
mKeyboardPalette = UBKeyboardPalette::create(0); mKeyboardPalette = UBKeyboardPalette::create(0);
mKeyboardPalette->setParent(mContainer);
}
mZoomPalette = new UBZoomPalette(mContainer); mZoomPalette = new UBZoomPalette(mContainer);
...@@ -647,8 +642,8 @@ void UBBoardPaletteManager::panButtonReleased() ...@@ -647,8 +642,8 @@ void UBBoardPaletteManager::panButtonReleased()
void UBBoardPaletteManager::showVirtualKeyboard(bool show) void UBBoardPaletteManager::showVirtualKeyboard(bool show)
{ {
if (mKeyboardPalette) if (mKeyboardPalette)
mKeyboardPalette->setVisible(show); mKeyboardPalette->setVisible(show);
} }
void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var) void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var)
......
...@@ -106,10 +106,8 @@ void UBPreferencesController::wire() ...@@ -106,10 +106,8 @@ void UBPreferencesController::wire()
// OSK preferences // OSK preferences
mPreferencesUI->keyboardPaletteKeyButtonSize->addItem("16x16"); mPreferencesUI->keyboardPaletteKeyButtonSize->addItem("29x29");
mPreferencesUI->keyboardPaletteKeyButtonSize->addItem("24x24"); mPreferencesUI->keyboardPaletteKeyButtonSize->addItem("41x41");
mPreferencesUI->keyboardPaletteKeyButtonSize->addItem("32x32");
connect(mPreferencesUI->keyboardPaletteAutoMinimize, SIGNAL(clicked(bool)), settings->boardKeyboardPaletteAutoMinimize, SLOT(setBool(bool)));
connect(mPreferencesUI->keyboardPaletteKeyButtonSize, SIGNAL(currentIndexChanged(const QString &)), settings->boardKeyboardPaletteKeyBtnSize, SLOT(setString(const QString &))); connect(mPreferencesUI->keyboardPaletteKeyButtonSize, SIGNAL(currentIndexChanged(const QString &)), settings->boardKeyboardPaletteKeyBtnSize, SLOT(setString(const QString &)));
...@@ -169,7 +167,6 @@ void UBPreferencesController::init() ...@@ -169,7 +167,6 @@ void UBPreferencesController::init()
mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox->setChecked(settings->appEnableAutomaticSoftwareUpdates->get().toBool()); mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox->setChecked(settings->appEnableAutomaticSoftwareUpdates->get().toBool());
// display tab // display tab
mPreferencesUI->keyboardPaletteAutoMinimize->setChecked(settings->boardKeyboardPaletteAutoMinimize->get().toBool());
for(int i=0; i<mPreferencesUI->keyboardPaletteKeyButtonSize->count(); i++) for(int i=0; i<mPreferencesUI->keyboardPaletteKeyButtonSize->count(); i++)
if (mPreferencesUI->keyboardPaletteKeyButtonSize->itemText(i) == if (mPreferencesUI->keyboardPaletteKeyButtonSize->itemText(i) ==
settings->boardKeyboardPaletteKeyBtnSize->get().toString()) settings->boardKeyboardPaletteKeyBtnSize->get().toString())
......
/* /*
* This program is free software: you can redistribute it and/or modify * UBSettings.cpp
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * Created on: Oct 29, 2008
* along with this program. If not, see <http://www.gnu.org/licenses/>. * Author: luc
*/ */
#include "UBSettings.h" #include "UBSettings.h"
...@@ -198,7 +191,7 @@ void UBSettings::init() ...@@ -198,7 +191,7 @@ void UBSettings::init()
boardUseHighResTabletEvent = new UBSetting(this, "Board", "UseHighResTabletEvent", true); boardUseHighResTabletEvent = new UBSetting(this, "Board", "UseHighResTabletEvent", true);
boardKeyboardPaletteAutoMinimize = new UBSetting(this, "Board", "KeyboardPaletteAutoMinimize", true); // boardKeyboardPaletteAutoMinimize = new UBSetting(this, "Board", "KeyboardPaletteAutoMinimize", true);
boardKeyboardPaletteKeyBtnSize = new UBSetting(this, "Board", "KeyboardPaletteKeyBtnSize", "24x24"); boardKeyboardPaletteKeyBtnSize = new UBSetting(this, "Board", "KeyboardPaletteKeyBtnSize", "24x24");
QStringList penLightBackgroundColors; QStringList penLightBackgroundColors;
......
/* /*
* This program is free software: you can redistribute it and/or modify * UBSettings.h
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * Created on: Oct 29, 2008
* but WITHOUT ANY WARRANTY; without even the implied warranty of * Author: luc
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef UBSETTINGS_H_ #ifndef UBSETTINGS_H_
...@@ -236,7 +228,7 @@ class UBSettings : public QObject ...@@ -236,7 +228,7 @@ class UBSettings : public QObject
UBSetting* boardUseHighResTabletEvent; UBSetting* boardUseHighResTabletEvent;
UBSetting* boardKeyboardPaletteAutoMinimize; // UBSetting* boardKeyboardPaletteAutoMinimize;
UBSetting* boardKeyboardPaletteKeyBtnSize; UBSetting* boardKeyboardPaletteKeyBtnSize;
UBColorListSetting* boardPenLightBackgroundColors; UBColorListSetting* boardPenLightBackgroundColors;
......
/* /*
* This program is free software: you can redistribute it and/or modify * UNWindowController.cpp
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * Created on: Jan 15, 2009
* but WITHOUT ANY WARRANTY; without even the implied warranty of * Author: julienbachmann
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 <QDesktopWidget> #include <QDesktopWidget>
...@@ -65,6 +57,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) ...@@ -65,6 +57,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, mbArrowClicked(false) , mbArrowClicked(false)
, mBoardStylusTool(UBStylusTool::Pen) , mBoardStylusTool(UBStylusTool::Pen)
, mDesktopStylusTool(UBStylusTool::Selector) , mDesktopStylusTool(UBStylusTool::Selector)
, mKeyboardPalette(0)
{ {
mTransparentDrawingView = new UBBoardView(UBApplication::boardController, 0); // deleted in UBDesktopAnnotationController::destructor mTransparentDrawingView = new UBBoardView(UBApplication::boardController, 0); // deleted in UBDesktopAnnotationController::destructor
...@@ -92,12 +85,21 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) ...@@ -92,12 +85,21 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView); mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView);
if (UBPlatformUtils::hasVirtualKeyboard())
{
mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView);
//mKeyboardPalette->setParent(mTransparentDrawingView);
}
connect(mDesktopPalette, SIGNAL(uniboardClick()), this, SLOT(goToUniboard())); connect(mDesktopPalette, SIGNAL(uniboardClick()), this, SLOT(goToUniboard()));
connect(mDesktopPalette, SIGNAL(customClick()), this, SLOT(customCapture())); connect(mDesktopPalette, SIGNAL(customClick()), this, SLOT(customCapture()));
connect(mDesktopPalette, SIGNAL(windowClick()), this, SLOT(windowCapture())); connect(mDesktopPalette, SIGNAL(windowClick()), this, SLOT(windowCapture()));
connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture())); connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture()));
connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized())); connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized()));
connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize()));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool)));
// connect(mDesktopPalette, SIGNAL(showVirtualKeyboard(bool)), this, SLOT());
connect(mTransparentDrawingView, SIGNAL(resized(QResizeEvent*)), this, SLOT(onTransparentWidgetResized())); connect(mTransparentDrawingView, SIGNAL(resized(QResizeEvent*)), this, SLOT(onTransparentWidgetResized()));
...@@ -143,6 +145,13 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) ...@@ -143,6 +145,13 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
onDesktopPaletteMaximized(); onDesktopPaletteMaximized();
} }
void UBDesktopAnnotationController::showKeyboard(bool show)
{
mKeyboardPalette->setVisible(show);
// mDesktopPalette->showVirtualKeyboard(show);
}
UBDesktopAnnotationController::~UBDesktopAnnotationController() UBDesktopAnnotationController::~UBDesktopAnnotationController()
{ {
delete mTransparentDrawingScene; delete mTransparentDrawingScene;
......
/* /*
* This program is free software: you can redistribute it and/or modify * UNWindowController.h
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * Created on: Jan 15, 2009
* but WITHOUT ANY WARRANTY; without even the implied warranty of * Author: julienbachmann
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef UBUNINOTESWINDOWCONTROLLER_H_ #ifndef UBUNINOTESWINDOWCONTROLLER_H_
...@@ -70,6 +62,8 @@ class UBDesktopAnnotationController : public QObject ...@@ -70,6 +62,8 @@ class UBDesktopAnnotationController : public QObject
void stylusToolChanged(int tool); void stylusToolChanged(int tool);
void updateBackground(); void updateBackground();
void showKeyboard(bool show);
signals: signals:
/** /**
* This signal is emitted once the screenshot has been performed. This signal is also emitted when user * This signal is emitted once the screenshot has been performed. This signal is also emitted when user
...@@ -106,6 +100,7 @@ class UBDesktopAnnotationController : public QObject ...@@ -106,6 +100,7 @@ class UBDesktopAnnotationController : public QObject
void togglePropertyPalette(UBActionPalette* palette); void togglePropertyPalette(UBActionPalette* palette);
UBDesktopPalette *mDesktopPalette; UBDesktopPalette *mDesktopPalette;
UBKeyboardPalette *mKeyboardPalette;
UBDesktopToolsPalette *mDesktopToolsPalette; UBDesktopToolsPalette *mDesktopToolsPalette;
UBDesktopPenPalette* mDesktopPenPalette; UBDesktopPenPalette* mDesktopPenPalette;
UBDesktopMarkerPalette* mDesktopMarkerPalette; UBDesktopMarkerPalette* mDesktopMarkerPalette;
......
/* /*
* This program is free software: you can redistribute it and/or modify * UBDesktopPalette.cpp
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * Created on: Jan 9, 2009
* but WITHOUT ANY WARRANTY; without even the implied warranty of * Author: julienbachmann
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "UBDesktopPalette.h" #include "UBDesktopPalette.h"
...@@ -49,12 +41,8 @@ UBDesktopPalette::UBDesktopPalette(QWidget *parent) ...@@ -49,12 +41,8 @@ UBDesktopPalette::UBDesktopPalette(QWidget *parent)
#endif #endif
actions << UBApplication::mainWindow->actionPointer; actions << UBApplication::mainWindow->actionPointer;
if (UBPlatformUtils::hasVirtualKeyboard()) if (UBPlatformUtils::hasVirtualKeyboard())
{
actions << UBApplication::mainWindow->actionVirtualKeyboard; actions << UBApplication::mainWindow->actionVirtualKeyboard;
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(toggled(bool)), this, SIGNAL(showVirtualKeyboard(bool)));
}
mActionCustomSelect = new QAction(QIcon(":/images/toolbar/captureArea.png"), tr("Capture Part of the Screen"), this); mActionCustomSelect = new QAction(QIcon(":/images/toolbar/captureArea.png"), tr("Capture Part of the Screen"), this);
connect(mActionCustomSelect, SIGNAL(triggered()), this, SIGNAL(customClick())); connect(mActionCustomSelect, SIGNAL(triggered()), this, SIGNAL(customClick()));
......
/* /*
* This program is free software: you can redistribute it and/or modify * UNWindow.h
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * Created on: Jan 9, 2009
* but WITHOUT ANY WARRANTY; without even the implied warranty of * Author: julienbachmann
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef UBUNINOTESWINDOW_H_ #ifndef UBUNINOTESWINDOW_H_
...@@ -41,7 +33,7 @@ class UBDesktopPalette : public UBActionPalette ...@@ -41,7 +33,7 @@ class UBDesktopPalette : public UBActionPalette
void customClick(); void customClick();
void windowClick(); void windowClick();
void screenClick(); void screenClick();
void showVirtualKeyboard(bool); // void showVirtualKeyboard(bool);
public slots: public slots:
......
/* /*
* This program is free software: you can redistribute it and/or modify * UBActionPalette.cpp
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * Created on: 8 oct. 2009
* but WITHOUT ANY WARRANTY; without even the implied warranty of * Author: Luc
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "UBActionPalette.h" #include "UBActionPalette.h"
...@@ -48,6 +40,8 @@ UBActionPalette::UBActionPalette(Qt::Corner corner, QWidget * parent, Qt::Orient ...@@ -48,6 +40,8 @@ UBActionPalette::UBActionPalette(Qt::Corner corner, QWidget * parent, Qt::Orient
void UBActionPalette::init(Qt::Orientation orientation) void UBActionPalette::init(Qt::Orientation orientation)
{ {
m_customCloseProcessing = false;
mButtonSize = QSize(32, 32); mButtonSize = QSize(32, 32);
mIsClosable = false; mIsClosable = false;
mAutoClose = false; mAutoClose = false;
...@@ -174,7 +168,7 @@ void UBActionPalette::updateLayout() ...@@ -174,7 +168,7 @@ void UBActionPalette::updateLayout()
, sLayoutContentMargin + border(), sLayoutContentMargin + border()); , sLayoutContentMargin + border(), sLayoutContentMargin + border());
} }
update(); update();
} }
...@@ -209,7 +203,9 @@ void UBActionPalette::paintEvent(QPaintEvent *event) ...@@ -209,7 +203,9 @@ void UBActionPalette::paintEvent(QPaintEvent *event)
void UBActionPalette::close() void UBActionPalette::close()
{ {
hide(); if(!m_customCloseProcessing)
hide();
emit closed(); emit closed();
} }
...@@ -240,17 +236,18 @@ void UBActionPalette::clearLayout() ...@@ -240,17 +236,18 @@ void UBActionPalette::clearLayout()
QLayout* pLayout = layout(); QLayout* pLayout = layout();
if(NULL != pLayout) if(NULL != pLayout)
{ {
while(!pLayout->isEmpty()) while(!pLayout->isEmpty())
{ {
QLayoutItem* pItem = pLayout->itemAt(0); QLayoutItem* pItem = pLayout->itemAt(0);
QWidget* pW = pItem->widget(); QWidget* pW = pItem->widget();
pLayout->removeItem(pItem); pLayout->removeItem(pItem);
delete pItem; delete pItem;
pLayout->removeWidget(pW); pLayout->removeWidget(pW);
delete pW; delete pW;
} }
mActions.clear();
mButtons.clear(); mActions.clear();
mButtons.clear();
} }
} }
......
/* /*
* This program is free software: you can redistribute it and/or modify * UBActionPalette.h
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * Created on: 8 oct. 2009
* but WITHOUT ANY WARRANTY; without even the implied warranty of * Author: Luc
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef UBACTIONPALETTE_H_ #ifndef UBACTIONPALETTE_H_
...@@ -48,6 +40,13 @@ class UBActionPalette : public UBFloatingPalette ...@@ -48,6 +40,13 @@ class UBActionPalette : public UBFloatingPalette
{ {
mAutoClose = autoClose; mAutoClose = autoClose;
} }
void setCustomCloseProcessing(bool customCloseProcessing)
{
m_customCloseProcessing = customCloseProcessing;
}
bool m_customCloseProcessing;
virtual int border(); virtual int border();
void clearLayout(); void clearLayout();
QSize buttonSize(); QSize buttonSize();
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 <QtGui> #include <QtGui>
#include <QPainterPath> #include <QPainterPath>
...@@ -56,6 +42,12 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent) ...@@ -56,6 +42,12 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
mbGrip = true; mbGrip = true;
} }
void UBFloatingPalette::setGrip(bool newGrip)
{
mbGrip = newGrip;
update();
}
void UBFloatingPalette::setBackgroundBrush(const QBrush& brush) void UBFloatingPalette::setBackgroundBrush(const QBrush& brush)
{ {
...@@ -157,7 +149,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position) ...@@ -157,7 +149,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position)
} }
} }
move(newX, newY); move(newX, newY);
minimizePalette(QPoint(newX, newY)); minimizePalette(QPoint(newX, newY));
} }
else else
{ {
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBFLOATINGPALLETTE_H_ #ifndef UBFLOATINGPALLETTE_H_
...@@ -55,6 +41,8 @@ class UBFloatingPalette : public QWidget ...@@ -55,6 +41,8 @@ class UBFloatingPalette : public QWidget
QSize preferredSize(); QSize preferredSize();
void setBackgroundBrush(const QBrush& brush); void setBackgroundBrush(const QBrush& brush);
void setGrip(bool newGrip);
void setMinimizePermission(bool permission); void setMinimizePermission(bool permission);
protected: protected:
......
This diff is collapsed.
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBKEYBOARDPALETTE_H #ifndef UBKEYBOARDPALETTE_H
#define UBKEYBOARDPALETTE_H #define UBKEYBOARDPALETTE_H
#include "UBFloatingPalette.h" #include "UBActionPalette.h"
#include <QLayout> #include <QLayout>
#include <QPainter> #include <QPainter>
...@@ -28,7 +13,52 @@ ...@@ -28,7 +13,52 @@
class UBKeyButton; class UBKeyButton;
class UBKeyboardButton; class UBKeyboardButton;
class UBKeyboardPalette : public UBFloatingPalette class UBApplication;
class UBMainWindow;
class BTNImages
{
public:
BTNImages(QString _strHeight, int _width, int _height);
QString m_strHeight;
int m_width;
int m_height;
QImage m_btnLeftPassive;
QImage m_btnCenterPassive;
QImage m_btnRightPassive;
QImage m_btnLeftActive;
QImage m_btnCenterActive;
QImage m_btnRightActive;
private:
QString m_strLeftPassive;
QString m_strCenterPassive;
QString m_strRightPassive;
QString m_strLeftActive;
QString m_strCenterActive;
QString m_strRightActive;
};
class ContentImage
{
public:
ContentImage(QString strHeight, int m_height, QString strContentPath);
QString m_strHeight;
int m_height;
QImage m_btnContent;
private:
QString m_strContent;
};
class UBKeyboardPalette : public UBActionPalette
{ {
Q_OBJECT Q_OBJECT
...@@ -39,12 +69,13 @@ friend class UBLocaleButton; ...@@ -39,12 +69,13 @@ friend class UBLocaleButton;
public: public:
~UBKeyboardPalette(); ~UBKeyboardPalette();
BTNImages *currBtnImages;
bool isEnabled(){return locales!= NULL;} bool isEnabled(){return locales!= NULL;}
virtual QSize sizeHint () const; virtual QSize sizeHint () const;
virtual void adjustSizeAndPosition(bool pUp = true); virtual void adjustSizeAndPosition(bool pUp = true);
QString getKeyButtonSize() const {QString res; res.sprintf("%dx%d", btnWidth, btnHeight); return res;} QString getKeyButtonSize() const {QString res; res.sprintf("%dx%d", btnWidth, btnHeight); return res;}
void setKeyButtonSize(const QString& strSize); void setKeyButtonSize(const QString& strSize);
void setAutoMinimize(bool autoMinimize);
static UBKeyboardPalette* create(QWidget *parent); static UBKeyboardPalette* create(QWidget *parent);
signals: signals:
...@@ -55,9 +86,9 @@ signals: ...@@ -55,9 +86,9 @@ signals:
private slots: private slots:
void syncPosition(const QPoint & pos); void syncPosition(const QPoint & pos);
void syncLocale(int nLocale); void syncLocale(int nLocale);
void keyboardPaletteAutoMinimizeChanged(QVariant b);
void keyboardPaletteButtonSizeChanged(QVariant size); void keyboardPaletteButtonSizeChanged(QVariant size);
void onActivated(bool b); void onActivated(bool b);
void hideKeyboard();
protected: protected:
bool capsLock; bool capsLock;
...@@ -65,16 +96,16 @@ protected: ...@@ -65,16 +96,16 @@ protected:
int nLocalesCount; int nLocalesCount;
UBKeyboardLocale** locales; UBKeyboardLocale** locales;
QString strSize;
int btnWidth; int btnWidth;
int btnHeight; int btnHeight;
//
bool languagePopupActive; bool languagePopupActive;
bool keyboardActive; bool keyboardActive;
bool autoMinimize; //
virtual void enterEvent ( QEvent * event ); virtual void enterEvent ( QEvent * event );
virtual void leaveEvent ( QEvent * event ); virtual void leaveEvent ( QEvent * event );
virtual void paintEvent(QPaintEvent *event); virtual void paintEvent(QPaintEvent *event);
virtual void moveEvent ( QMoveEvent * event ); virtual void moveEvent ( QMoveEvent * event );
void sendKeyEvent(const KEYBT& keybt); void sendKeyEvent(const KEYBT& keybt);
...@@ -110,17 +141,22 @@ private: ...@@ -110,17 +141,22 @@ private:
}; };
class UBKeyboardButton : public QWidget class UBKeyboardButton : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
UBKeyboardButton(UBKeyboardPalette* parent); UBKeyboardButton(UBKeyboardPalette* parent, QString contentImagePath);
~UBKeyboardButton(); ~UBKeyboardButton();
protected: protected:
UBKeyboardPalette* m_parent;
ContentImage *imgContent;
QString m_contentImagePath;
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
virtual void enterEvent ( QEvent * event ); virtual void enterEvent ( QEvent * event );
virtual void leaveEvent ( QEvent * event ); virtual void leaveEvent ( QEvent * event );
virtual void mousePressEvent ( QMouseEvent * event ); virtual void mousePressEvent ( QMouseEvent * event );
...@@ -165,6 +201,7 @@ class UBCntrlButton : public UBKeyboardButton ...@@ -165,6 +201,7 @@ class UBCntrlButton : public UBKeyboardButton
Q_OBJECT Q_OBJECT
public: public:
UBCntrlButton(UBKeyboardPalette* parent, int _code, const QString& _contentImagePath );
UBCntrlButton(UBKeyboardPalette* parent, const QString& _label, int _code ); UBCntrlButton(UBKeyboardPalette* parent, const QString& _label, int _code );
~UBCntrlButton(); ~UBCntrlButton();
...@@ -182,7 +219,7 @@ class UBCapsLockButton : public UBKeyboardButton ...@@ -182,7 +219,7 @@ class UBCapsLockButton : public UBKeyboardButton
Q_OBJECT Q_OBJECT
public: public:
UBCapsLockButton(UBKeyboardPalette* parent); UBCapsLockButton(UBKeyboardPalette* parent, const QString _contentImagePath);
~UBCapsLockButton(); ~UBCapsLockButton();
virtual void onPress(); virtual void onPress();
...@@ -203,7 +240,7 @@ public: ...@@ -203,7 +240,7 @@ public:
virtual void paintContent(QPainter& painter); virtual void paintContent(QPainter& painter);
protected: protected:
QMenu* localeMenu; QMenu* localeMenu;
}; };
#endif // UBKEYBOARDPALETTE_H #endif // UBKEYBOARDPALETTE_H
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "UBKeyboardPalette.h"
...@@ -66,16 +52,19 @@ void UBKeyboardButton::sendControlSymbol(int nSymbol) ...@@ -66,16 +52,19 @@ void UBKeyboardButton::sendControlSymbol(int nSymbol)
void UBKeyboardPalette::createCtrlButtons() void UBKeyboardPalette::createCtrlButtons()
{ {
ctrlButtons = new UBKeyboardButton*[7]; int ctrlID = 0;
ctrlButtons = new UBKeyboardButton*[9];
ctrlButtons[0] = new UBCntrlButton(this, "<-", 0x08);
ctrlButtons[1] = new UBCntrlButton(this, "<->", 0x09); ctrlButtons[ctrlID++] = new UBCntrlButton(this, 0x08, "backspace");// Backspace
ctrlButtons[2] = new UBCntrlButton(this, "Enter", 0x0d); ctrlButtons[ctrlID++] = new UBCntrlButton(this, 0x09, "tab"); // Tab
ctrlButtons[3] = new UBCapsLockButton(this); // ctrlButtons[ctrlID++] = new UBKeyButton(this); // Row 2 Stub
ctrlButtons[4] = new UBCapsLockButton(this); // ctrlButtons[ctrlID++] = new UBKeyButton(this); // Row 3 Stub
ctrlButtons[5] = new UBLocaleButton(this); ctrlButtons[ctrlID++] = new UBCntrlButton(this, "Enter", 0x0d); // Enter
ctrlButtons[6] = new UBCntrlButton(this, "", 0x20); ctrlButtons[ctrlID++] = new UBCapsLockButton(this, "capslock"); // Caps Lock
ctrlButtons[7] = new UBLocaleButton(this); ctrlButtons[ctrlID++] = new UBCapsLockButton(this, "capslock"); // Caps Lock
ctrlButtons[ctrlID++] = new UBLocaleButton(this); // Language Switch
ctrlButtons[ctrlID++] = new UBCntrlButton(this, "", 0x20); // Space
ctrlButtons[ctrlID++] = new UBLocaleButton(this); // Language Switch
} }
void UBKeyboardPalette::onActivated(bool) void UBKeyboardPalette::onActivated(bool)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment