SANKORE-329 last part of issue - refactoring virtual keyboard. source code still require testing and defect correction for Linux and Mac OS

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent 0b449cc407
commit 7a6776a4a9
  1. 123
      src/board/UBBoardPaletteManager.cpp
  2. 7
      src/core/UBApplicationController.cpp
  3. 85
      src/desktop/UBDesktopAnnotationController.cpp
  4. 8
      src/desktop/UBDesktopAnnotationController.h
  5. 18
      src/document/UBDocumentController.cpp
  6. 6
      src/document/UBDocumentController.h
  7. 57
      src/gui/UBKeyboardPalette.cpp
  8. 7
      src/gui/UBKeyboardPalette.h
  9. 31
      src/web/UBWebController.cpp
  10. 14
      src/web/UBWebController.h

@ -220,15 +220,38 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
void UBBoardPaletteManager::slot_changeMainMode(UBApplicationController::MainMode mainMode) void UBBoardPaletteManager::slot_changeMainMode(UBApplicationController::MainMode mainMode)
{ {
// Board = 0, Internet, Document, Tutorial, ParaschoolEditor, WebDocument
switch( mainMode ) switch( mainMode )
{ {
case UBApplicationController::Board: case UBApplicationController::Board:
{
// call changeMode only when switch NOT from desktop mode // call changeMode only when switch NOT from desktop mode
if(!UBApplication::applicationController->isShowingDesktop()) if(!UBApplication::applicationController->isShowingDesktop())
changeMode(eUBDockPaletteWidget_BOARD); changeMode(eUBDockPaletteWidget_BOARD);
}
break;
case UBApplicationController::Tutorial:
{
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
mKeyboardPalette->hide();
}
break;
case UBApplicationController::Internet:
changeMode(eUBDockPaletteWidget_WEB);
break;
case UBApplicationController::Document:
changeMode(eUBDockPaletteWidget_DOCUMENT);
break; break;
default: default:
{
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
mKeyboardPalette->hide();
}
break; break;
} }
} }
@ -255,25 +278,25 @@ void UBBoardPaletteManager::slot_changeDesktopMode(bool isDesktop)
void UBBoardPaletteManager::setupPalettes() void UBBoardPaletteManager::setupPalettes()
{ {
setupDockPaletteWidgets();
// Add the other palettes
mStylusPalette = new UBStylusPalette(mContainer, UBSettings::settings()->appToolBarOrientationVertical->get().toBool() ? Qt::Vertical : Qt::Horizontal);
connect(mStylusPalette, SIGNAL(stylusToolDoubleClicked(int)), UBApplication::boardController, SLOT(stylusToolDoubleClicked(int)));
mStylusPalette->show(); // always show stylus palette at startup
if (UBPlatformUtils::hasVirtualKeyboard()) if (UBPlatformUtils::hasVirtualKeyboard())
{ {
mKeyboardPalette = UBKeyboardPalette::create(0); mKeyboardPalette = new UBKeyboardPalette(0);
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
connect(mKeyboardPalette, SIGNAL(closed()), mKeyboardPalette, SLOT(onDeactivated())); connect(mKeyboardPalette, SIGNAL(closed()), mKeyboardPalette, SLOT(onDeactivated()));
#endif #endif
#ifndef Q_WS_MAC #ifndef Q_WS_MAC
mKeyboardPalette->setParent(mContainer); // mKeyboardPalette->setParent(mContainer);
#endif #endif
} }
setupDockPaletteWidgets();
// Add the other palettes
mStylusPalette = new UBStylusPalette(mContainer, UBSettings::settings()->appToolBarOrientationVertical->get().toBool() ? Qt::Vertical : Qt::Horizontal);
connect(mStylusPalette, SIGNAL(stylusToolDoubleClicked(int)), UBApplication::boardController, SLOT(stylusToolDoubleClicked(int)));
mStylusPalette->show(); // always show stylus palette at startup
mZoomPalette = new UBZoomPalette(mContainer); mZoomPalette = new UBZoomPalette(mContainer);
QList<QAction*> backgroundsActions; QList<QAction*> backgroundsActions;
@ -483,7 +506,7 @@ void UBBoardPaletteManager::connectPalettes()
} }
bool isFirstResized = true;
void UBBoardPaletteManager::containerResized() void UBBoardPaletteManager::containerResized()
{ {
int innerMargin = UBSettings::boardMargin; int innerMargin = UBSettings::boardMargin;
@ -493,26 +516,40 @@ void UBBoardPaletteManager::containerResized()
int userTop = innerMargin; int userTop = innerMargin;
int userHeight = mContainer->height() - (2 * innerMargin); int userHeight = mContainer->height() - (2 * innerMargin);
if(mStylusPalette)
{
mStylusPalette->move(userLeft, userTop); mStylusPalette->move(userLeft, userTop);
mStylusPalette->adjustSizeAndPosition(); mStylusPalette->adjustSizeAndPosition();
mStylusPalette->initPosition(); mStylusPalette->initPosition();
}
if(mZoomPalette)
{
mZoomPalette->move(userLeft + userWidth - mZoomPalette->width() mZoomPalette->move(userLeft + userWidth - mZoomPalette->width()
, userTop + userHeight /*- mPageNumberPalette->height()*/ - innerMargin - mZoomPalette->height()); , userTop + userHeight /*- mPageNumberPalette->height()*/ - innerMargin - mZoomPalette->height());
mZoomPalette->adjustSizeAndPosition(); mZoomPalette->adjustSizeAndPosition();
}
if (mKeyboardPalette) if (isFirstResized && mKeyboardPalette && mKeyboardPalette->parent() == UBApplication::boardController->controlContainer())
{ {
isFirstResized = false;
mKeyboardPalette->move(userLeft + (userWidth - mKeyboardPalette->width())/2, mKeyboardPalette->move(userLeft + (userWidth - mKeyboardPalette->width())/2,
userTop + userHeight - mKeyboardPalette->height()); userTop + (userHeight - mKeyboardPalette->height())/2);
mKeyboardPalette->adjustSizeAndPosition(); mKeyboardPalette->adjustSizeAndPosition();
} }
if(mLeftPalette)
{
mLeftPalette->resize(mLeftPalette->width()-1, mContainer->height()); mLeftPalette->resize(mLeftPalette->width()-1, mContainer->height());
mRightPalette->resize(mRightPalette->width()-1, mContainer->height());
mLeftPalette->resize(mLeftPalette->width(), mContainer->height()); mLeftPalette->resize(mLeftPalette->width(), mContainer->height());
}
if(mRightPalette)
{
mRightPalette->resize(mRightPalette->width()-1, mContainer->height());
mRightPalette->resize(mRightPalette->width(), mContainer->height()); mRightPalette->resize(mRightPalette->width(), mContainer->height());
} }
}
void UBBoardPaletteManager::changeBackground() void UBBoardPaletteManager::changeBackground()
@ -683,6 +720,18 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
{ {
mLeftPalette->setParent(UBApplication::boardController->controlContainer()); mLeftPalette->setParent(UBApplication::boardController->controlContainer());
mRightPalette->setParent(UBApplication::boardController->controlContainer()); mRightPalette->setParent(UBApplication::boardController->controlContainer());
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
if(mKeyboardPalette->m_isVisible)
{
mKeyboardPalette->hide();
mKeyboardPalette->setParent(UBApplication::boardController->controlContainer());
mKeyboardPalette->show();
}
else
mKeyboardPalette->setParent(UBApplication::boardController->controlContainer());
}
mLeftPalette->setVisible(true); mLeftPalette->setVisible(true);
mRightPalette->setVisible(true); mRightPalette->setVisible(true);
@ -696,6 +745,18 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
{ {
mLeftPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mLeftPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
mRightPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mRightPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
if(mKeyboardPalette->m_isVisible)
{
mKeyboardPalette->hide();
mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
mKeyboardPalette->show();
}
else
mKeyboardPalette->setParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView());
}
mLeftPalette->setVisible(false); mLeftPalette->setVisible(false);
mRightPalette->setVisible(true); mRightPalette->setVisible(true);
@ -705,12 +766,46 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is
} }
break; break;
case eUBDockPaletteWidget_WEB:
{
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
WBBrowserWindow* brWnd = UBApplication::webController->GetCurrentWebBrowser();
if(mKeyboardPalette->m_isVisible)
{
mKeyboardPalette->hide();
mKeyboardPalette->setParent(brWnd);
mKeyboardPalette->show();
}
else
mKeyboardPalette->setParent(brWnd);
}
}
break;
default: default:
{ {
mLeftPalette->setVisible(false); mLeftPalette->setVisible(false);
mRightPalette->setVisible(false); mRightPalette->setVisible(false);
mLeftPalette->setParent(0); mLeftPalette->setParent(0);
mRightPalette->setParent(0); mRightPalette->setParent(0);
if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
{
if(mKeyboardPalette->m_isVisible)
{
mKeyboardPalette->hide();
mKeyboardPalette->setParent(0);
mKeyboardPalette->show();
}
else
mKeyboardPalette->setParent(0);
// mKeyboardPalette->update();
}
} }
break; break;
} }

@ -368,6 +368,8 @@ void UBApplicationController::showInternet()
if (UBSettings::settings()->webUseExternalBrowser->get().toBool()) if (UBSettings::settings()->webUseExternalBrowser->get().toBool())
{ {
showDesktop(true); showDesktop(true);
UBApplication::webController->show(UBWebController::WebBrowser);
// really no have emit mainModeChanged here ? potential problem with virtual keyboard ?
} }
else else
{ {
@ -382,10 +384,11 @@ void UBApplicationController::showInternet()
mMainWindow->show(); mMainWindow->show();
mUninoteController->hideWindow(); mUninoteController->hideWindow();
emit mainModeChanged(Internet);
}
UBApplication::webController->show(UBWebController::WebBrowser); UBApplication::webController->show(UBWebController::WebBrowser);
emit mainModeChanged(Internet);
}
} }

@ -52,7 +52,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, mTransparentDrawingView(0) , mTransparentDrawingView(0)
, mTransparentDrawingScene(0) , mTransparentDrawingScene(0)
, mDesktopPalette(NULL) , mDesktopPalette(NULL)
, mKeyboardPalette(0) // , mKeyboardPalette(0)
, mDesktopPenPalette(NULL) , mDesktopPenPalette(NULL)
, mDesktopMarkerPalette(NULL) , mDesktopMarkerPalette(NULL)
, mDesktopEraserPalette(NULL) , mDesktopEraserPalette(NULL)
@ -64,7 +64,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, mPendingMarkerButtonPressed(false) , mPendingMarkerButtonPressed(false)
, mPendingEraserButtonPressed(false) , mPendingEraserButtonPressed(false)
, mbArrowClicked(false) , mbArrowClicked(false)
, mBoardStylusTool(UBStylusTool::Pen) , mBoardStylusTool(UBStylusTool::Selector /*UBStylusTool::Pen*/)
, mDesktopStylusTool(UBStylusTool::Selector) , mDesktopStylusTool(UBStylusTool::Selector)
{ {
@ -101,10 +101,15 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
connect(mTransparentDrawingView, SIGNAL(hidden()), mKeyboardPalette, SLOT(hide())); connect(mTransparentDrawingView, SIGNAL(hidden()), mKeyboardPalette, SLOT(hide()));
connect(mTransparentDrawingView, SIGNAL(shown()), this, SLOT(showKeyboard())); connect(mTransparentDrawingView, SIGNAL(shown()), this, SLOT(showKeyboard()));
#else #else
mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView); // mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView);
mKeyboardPalette->setParent(mTransparentDrawingView); // mKeyboardPalette->setParent(mTransparentDrawingView);
#endif #endif
connect(mKeyboardPalette, SIGNAL(keyboardActivated(bool)), mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool))); connect( UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(keyboardActivated(bool)),
mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool)));
// connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)),
// mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool)));
#ifdef Q_WS_X11 #ifdef Q_WS_X11
connect(mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask())); connect(mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask()));
connect(mDesktopPalette,SIGNAL(refreshMask()), this, SLOT(refreshMask())); connect(mDesktopPalette,SIGNAL(refreshMask()), this, SLOT(refreshMask()));
@ -117,7 +122,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
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(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool)));
connect(mTransparentDrawingView, SIGNAL(resized(QResizeEvent*)), this, SLOT(onTransparentWidgetResized())); connect(mTransparentDrawingView, SIGNAL(resized(QResizeEvent*)), this, SLOT(onTransparentWidgetResized()));
@ -164,31 +169,32 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
onDesktopPaletteMaximized(); onDesktopPaletteMaximized();
} }
void UBDesktopAnnotationController::showKeyboard(bool show) // void UBDesktopAnnotationController::showKeyboard(bool show)
{ // {
#ifdef Q_WS_X11 // #ifdef Q_WS_X11
if (!mTransparentDrawingView->isVisible()) // if (!mTransparentDrawingView->isVisible())
return; // return;
#endif // #endif
//
if(mKeyboardPalette) // if(mKeyboardPalette)
{ // {
if(show) // if(show)
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); // UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
mKeyboardPalette->setVisible(show); // mKeyboardPalette->setVisible(show);
//
#ifdef Q_WS_X11 // #ifdef Q_WS_X11
updateMask(true); // updateMask(true);
#endif // #endif
//
} // }
//
} // }
void UBDesktopAnnotationController::showKeyboard()
{ // void UBDesktopAnnotationController::showKeyboard()
if (UBApplication::mainWindow->actionVirtualKeyboard->isChecked()) // {
mKeyboardPalette->show(); // if (UBApplication::mainWindow->actionVirtualKeyboard->isChecked())
} // mKeyboardPalette->show();
// }
UBDesktopAnnotationController::~UBDesktopAnnotationController() UBDesktopAnnotationController::~UBDesktopAnnotationController()
{ {
@ -366,12 +372,12 @@ void UBDesktopAnnotationController::close()
void UBDesktopAnnotationController::stylusToolChanged(int tool) void UBDesktopAnnotationController::stylusToolChanged(int tool)
{ {
UBStylusTool::Enum eTool = (UBStylusTool::Enum)tool; // UBStylusTool::Enum eTool = (UBStylusTool::Enum)tool;
if(eTool != UBStylusTool::Selector && eTool != UBStylusTool::Text) // if(eTool != UBStylusTool::Selector && eTool != UBStylusTool::Text)
{ // {
if(mKeyboardPalette->m_isVisible) // if(mKeyboardPalette->m_isVisible)
UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger); // UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger);
} // }
updateBackground(); updateBackground();
} }
@ -910,9 +916,10 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
{ {
p.drawRect(mDesktopPalette->geometry().x(), mDesktopPalette->geometry().y(), mDesktopPalette->width(), mDesktopPalette->height()); p.drawRect(mDesktopPalette->geometry().x(), mDesktopPalette->geometry().y(), mDesktopPalette->width(), mDesktopPalette->height());
} }
if(mKeyboardPalette->isVisible()) if(UBApplication::boardController->paletteManager()->mKeyboardPalette->isVisible())
{ {
p.drawRect(mKeyboardPalette->geometry().x(), mKeyboardPalette->geometry().y(), mKeyboardPalette->width(), mKeyboardPalette->height()); p.drawRect(UBApplication::boardController->paletteManager()->mKeyboardPalette->geometry().x(), UBApplication::boardController->paletteManager()->mKeyboardPalette->geometry().y(),
UBApplication::boardController->paletteManager()->mKeyboardPalette->width(), UBApplication::boardController->paletteManager()->mKeyboardPalette->height());
} }
// UBApplication::boardController->paletteManager()->mDesktopRightPalette // UBApplication::boardController->paletteManager()->mDesktopRightPalette

@ -29,7 +29,7 @@ class UBDesktopPenPalette;
class UBDesktopMarkerPalette; class UBDesktopMarkerPalette;
class UBDesktopEraserPalette; class UBDesktopEraserPalette;
class UBActionPalette; class UBActionPalette;
class UBKeyboardPalette; //class UBKeyboardPalette;
class UBMainWindow; class UBMainWindow;
#define PROPERTY_PALETTE_TIMER 1000 #define PROPERTY_PALETTE_TIMER 1000
@ -72,8 +72,8 @@ class UBDesktopAnnotationController : public QObject
void stylusToolChanged(int tool); void stylusToolChanged(int tool);
void updateBackground(); void updateBackground();
void showKeyboard(bool show); // void showKeyboard(bool show);
void showKeyboard(); //X11 virtual keyboard working only needed // void showKeyboard(); //X11 virtual keyboard working only needed
signals: signals:
/** /**
@ -118,7 +118,7 @@ class UBDesktopAnnotationController : public QObject
void updateMask(bool bTransparent); void updateMask(bool bTransparent);
UBDesktopPalette *mDesktopPalette; UBDesktopPalette *mDesktopPalette;
UBKeyboardPalette *mKeyboardPalette; //UBKeyboardPalette *mKeyboardPalette;
UBDesktopPenPalette* mDesktopPenPalette; UBDesktopPenPalette* mDesktopPenPalette;
UBDesktopMarkerPalette* mDesktopMarkerPalette; UBDesktopMarkerPalette* mDesktopMarkerPalette;
UBDesktopEraserPalette* mDesktopEraserPalette; UBDesktopEraserPalette* mDesktopEraserPalette;

@ -38,7 +38,7 @@
#include "board/UBBoardPaletteManager.h" #include "board/UBBoardPaletteManager.h"
#include "board/UBDrawingController.h" #include "board/UBDrawingController.h"
#include "gui/UBKeyboardPalette.h" //#include "gui/UBKeyboardPalette.h"
#include "gui/UBThumbnailView.h" #include "gui/UBThumbnailView.h"
#include "gui/UBDocumentTreeWidget.h" #include "gui/UBDocumentTreeWidget.h"
@ -70,7 +70,7 @@ UBDocumentController::UBDocumentController(UBMainWindow* mainWindow)
, mToolsPalette(0) , mToolsPalette(0)
, mToolsPalettePositionned(false) , mToolsPalettePositionned(false)
, mTrashTi(0) , mTrashTi(0)
, mKeyboardPalette(0) // , mKeyboardPalette(0)
{ {
setupViews(); setupViews();
setupToolbar(); setupToolbar();
@ -444,12 +444,12 @@ void UBDocumentController::setupViews()
mMessageWindow = new UBMessageWindow(mDocumentUI->thumbnailWidget); mMessageWindow = new UBMessageWindow(mDocumentUI->thumbnailWidget);
mMessageWindow->hide(); mMessageWindow->hide();
if (UBPlatformUtils::hasVirtualKeyboard()) // if (UBPlatformUtils::hasVirtualKeyboard())
{ // {
mKeyboardPalette = UBKeyboardPalette::create(0); // mKeyboardPalette = UBKeyboardPalette::create(0);
mKeyboardPalette->setParent(controlView()); // mKeyboardPalette->setParent(controlView());
connect(mMainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool))); // connect(mMainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool)));
} // }
} }
} }
@ -467,6 +467,7 @@ void UBDocumentController::setupToolbar()
connect(mMainWindow->actionDocumentTools, SIGNAL(triggered()), this, SLOT(toggleDocumentToolsPalette())); connect(mMainWindow->actionDocumentTools, SIGNAL(triggered()), this, SLOT(toggleDocumentToolsPalette()));
} }
/*
void UBDocumentController::showKeyboard(bool show) void UBDocumentController::showKeyboard(bool show)
{ {
if(mKeyboardPalette) if(mKeyboardPalette)
@ -477,6 +478,7 @@ void UBDocumentController::showKeyboard(bool show)
} }
} }
*/
void UBDocumentController::setupPalettes() void UBDocumentController::setupPalettes()
{ {

@ -34,7 +34,7 @@ class UBDocumentGroupTreeItem;
class UBDocumentProxyTreeItem; class UBDocumentProxyTreeItem;
class UBMainWindow; class UBMainWindow;
class UBDocumentToolsPalette; class UBDocumentToolsPalette;
class UBKeyboardPalette; //class UBKeyboardPalette;
class UBDocumentController : public QObject class UBDocumentController : public QObject
{ {
@ -76,7 +76,7 @@ class UBDocumentController : public QObject
void paste(); void paste();
void focusChanged(QWidget *old, QWidget *current); void focusChanged(QWidget *old, QWidget *current);
void showKeyboard(bool show); // void showKeyboard(bool show);
protected: protected:
virtual void setupViews(); virtual void setupViews();
@ -112,7 +112,7 @@ class UBDocumentController : public QObject
UBDocumentGroupTreeItem* mTrashTi; UBDocumentGroupTreeItem* mTrashTi;
UBDocumentProxy* mCurrentDocument; UBDocumentProxy* mCurrentDocument;
UBKeyboardPalette *mKeyboardPalette; // UBKeyboardPalette *mKeyboardPalette;
private slots: private slots:

@ -27,6 +27,9 @@
UBKeyboardPalette::UBKeyboardPalette(QWidget *parent) UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
: UBActionPalette(Qt::TopRightCorner, parent) : UBActionPalette(Qt::TopRightCorner, parent)
{ {
// setWindowFlags(/*Qt::CustomizeWindowHint|*/Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint);
setCustomCloseProcessing(true); setCustomCloseProcessing(true);
setCustomPosition(true); setCustomPosition(true);
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
@ -56,57 +59,25 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
setContentsMargins( 22, 22, 22, 22 ); setContentsMargins( 22, 22, 22, 22 );
connect(this, SIGNAL(keyboardActivated(bool)), this, SLOT(onActivated(bool))); init();
} }
QList<UBKeyboardPalette*> UBKeyboardPalette::instances; //QList<UBKeyboardPalette*> UBKeyboardPalette::instances;
UBKeyboardPalette* UBKeyboardPalette::create(QWidget *parent) void UBKeyboardPalette::init()
{
//------------------------------//
if (!UBPlatformUtils::hasVirtualKeyboard())
return NULL;
//------------------------------//
UBKeyboardPalette* firstKeyboard = NULL;
// if we already have keyboards inside, get it position and show/hide status, for new keyboard
if(instances.size() > 0)
firstKeyboard = instances.at(0);
//------------------------------//
UBKeyboardPalette* instance = new UBKeyboardPalette(parent);
instance->setKeyButtonSize(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize->get().toString());
instance->m_isVisible = firstKeyboard ? firstKeyboard->m_isVisible : false;
instance->setVisible(instance->m_isVisible);
if( firstKeyboard )
instance->move(firstKeyboard->m_pos);
connect(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize, SIGNAL(changed(QVariant)), instance, SLOT(keyboardPaletteButtonSizeChanged(QVariant)));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), instance, SLOT(showKeyboard(bool)));
// connect(instance, SIGNAL(moved(const QPoint&)), instance, SLOT(syncPosition(const QPoint&)));
connect(instance, SIGNAL(closed()), instance, SLOT(hideKeyboard()));
//------------------------------//
instances.append(instance);
foreach(UBKeyboardPalette* inst, instances)
{ {
connect(inst, SIGNAL(moved(const QPoint&)), instance, SLOT(syncPosition(const QPoint&))); m_isVisible = false;
connect(instance, SIGNAL(moved(const QPoint&)), inst, SLOT(syncPosition(const QPoint&))); setVisible(false);
connect(inst, SIGNAL(localeChanged(int)), instance, SLOT(syncLocale(int))); setKeyButtonSize(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize->get().toString());
connect(instance, SIGNAL(localeChanged(int)), inst, SLOT(syncLocale(int)));
// connect(instance, SIGNAL(closed()), inst, ) connect(this, SIGNAL(keyboardActivated(bool)), this, SLOT(onActivated(bool)));
} connect(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize, SIGNAL(changed(QVariant)), this, SLOT(keyboardPaletteButtonSizeChanged(QVariant)));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool)));
connect(this, SIGNAL(closed()), this, SLOT(hideKeyboard()));
//------------------------------// //------------------------------//
return instance; UBPlatformUtils::setWindowNonActivableFlag(this, true);
} }
void UBKeyboardPalette::showKeyboard(bool show) void UBKeyboardPalette::showKeyboard(bool show)

@ -67,6 +67,7 @@ friend class UBCapsLockButton;
friend class UBLocaleButton; friend class UBLocaleButton;
public: public:
UBKeyboardPalette(QWidget *parent);
~UBKeyboardPalette(); ~UBKeyboardPalette();
BTNImages *currBtnImages; BTNImages *currBtnImages;
@ -77,8 +78,6 @@ public:
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);
static UBKeyboardPalette* create(QWidget *parent);
static QList<UBKeyboardPalette*> instances;
bool m_isVisible; bool m_isVisible;
QPoint m_pos; QPoint m_pos;
@ -120,9 +119,9 @@ protected:
const QString* getLocaleName(); const QString* getLocaleName();
private: void init();
UBKeyboardPalette(QWidget *parent); private:
QRect originalRect; QRect originalRect;

@ -32,7 +32,7 @@
#include "gui/UBScreenMirror.h" #include "gui/UBScreenMirror.h"
#include "gui/UBMainWindow.h" #include "gui/UBMainWindow.h"
#include "gui/UBWebToolsPalette.h" #include "gui/UBWebToolsPalette.h"
#include "gui/UBKeyboardPalette.h" //#include "gui/UBKeyboardPalette.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/UBSetting.h" #include "core/UBSetting.h"
@ -55,7 +55,7 @@ UBWebController::UBWebController(UBMainWindow* mainWindow)
, mBrowserWidget(0) , mBrowserWidget(0)
, mTrapFlashController(0) , mTrapFlashController(0)
, mToolsCurrentPalette(0) , mToolsCurrentPalette(0)
, mKeyboardCurrentPalette(0) // , mKeyboardCurrentPalette(0)
, mToolsPalettePositionned(false) , mToolsPalettePositionned(false)
, mDownloadViewIsVisible(false) , mDownloadViewIsVisible(false)
@ -113,7 +113,7 @@ void UBWebController::webBrowserInstance()
{ {
mCurrentWebBrowser = &mWebBrowserList[WebBrowser]; mCurrentWebBrowser = &mWebBrowserList[WebBrowser];
mToolsCurrentPalette = &mToolsPaletteList[WebBrowser]; mToolsCurrentPalette = &mToolsPaletteList[WebBrowser];
mKeyboardCurrentPalette = &mKeyboardPaletteList[WebBrowser]; // mKeyboardCurrentPalette = &mKeyboardPaletteList[WebBrowser];
mToolsPalettePositionned = mToolsPalettePositionnedList[WebBrowser]; mToolsPalettePositionned = mToolsPalettePositionnedList[WebBrowser];
if (!(*mCurrentWebBrowser)) if (!(*mCurrentWebBrowser))
{ {
@ -191,7 +191,7 @@ void UBWebController::tutorialWebInstance()
{ {
mCurrentWebBrowser = &mWebBrowserList[Tutorial]; mCurrentWebBrowser = &mWebBrowserList[Tutorial];
mToolsCurrentPalette = &mToolsPaletteList[Tutorial]; mToolsCurrentPalette = &mToolsPaletteList[Tutorial];
mKeyboardCurrentPalette = &mKeyboardPaletteList[Tutorial]; // mKeyboardCurrentPalette = &mKeyboardPaletteList[Tutorial];
mToolsPalettePositionned = &mToolsPalettePositionnedList[Tutorial]; mToolsPalettePositionned = &mToolsPalettePositionnedList[Tutorial];
if (!(*mCurrentWebBrowser)) if (!(*mCurrentWebBrowser))
{ {
@ -249,7 +249,7 @@ void UBWebController::paraschoolWebInstance()
else { else {
mCurrentWebBrowser = &mWebBrowserList[Paraschool]; mCurrentWebBrowser = &mWebBrowserList[Paraschool];
mToolsCurrentPalette = &mToolsPaletteList[Paraschool]; mToolsCurrentPalette = &mToolsPaletteList[Paraschool];
mKeyboardCurrentPalette = &mKeyboardPaletteList[Paraschool]; // mKeyboardCurrentPalette = &mKeyboardPaletteList[Paraschool];
mToolsPalettePositionned = &mToolsPalettePositionnedList[Paraschool]; mToolsPalettePositionned = &mToolsPalettePositionnedList[Paraschool];
if (!(*mCurrentWebBrowser)){ if (!(*mCurrentWebBrowser)){
(*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true); (*mCurrentWebBrowser) = new WBBrowserWindow(mMainWindow->centralWidget(), mMainWindow, true);
@ -391,7 +391,7 @@ void UBWebController::setupPalettes()
{ {
(*mToolsCurrentPalette) = new UBWebToolsPalette((*mCurrentWebBrowser),false); (*mToolsCurrentPalette) = new UBWebToolsPalette((*mCurrentWebBrowser),false);
(*mKeyboardCurrentPalette) = UBKeyboardPalette::create(*mCurrentWebBrowser); // (*mKeyboardCurrentPalette) = UBKeyboardPalette::create(*mCurrentWebBrowser);
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
if (*mKeyboardCurrentPalette) if (*mKeyboardCurrentPalette)
connect(*mKeyboardCurrentPalette, SIGNAL(closed()), *mKeyboardCurrentPalette, SLOT(onDeactivated())); connect(*mKeyboardCurrentPalette, SIGNAL(closed()), *mKeyboardCurrentPalette, SLOT(onDeactivated()));
@ -411,7 +411,7 @@ void UBWebController::setupPalettes()
(*mToolsCurrentPalette)->hide(); (*mToolsCurrentPalette)->hide();
(*mToolsCurrentPalette)->adjustSizeAndPosition(); (*mToolsCurrentPalette)->adjustSizeAndPosition();
(*mKeyboardCurrentPalette)->adjustSizeAndPosition(); // (*mKeyboardCurrentPalette)->adjustSizeAndPosition();
if (controlView()){ if (controlView()){
int left = controlView()->width() - 20 - (*mToolsCurrentPalette)->width(); int left = controlView()->width() - 20 - (*mToolsCurrentPalette)->width();
@ -435,15 +435,14 @@ void UBWebController::toggleWebTrap(bool checked)
} }
} }
void UBWebController::showKeyboard(bool checked) // void UBWebController::showKeyboard(bool checked)
{ // {
if (mKeyboardCurrentPalette // if (mKeyboardCurrentPalette
&& (*mKeyboardCurrentPalette)) // && (*mKeyboardCurrentPalette))
{ // {
(*mKeyboardCurrentPalette)->setVisible(checked); // (*mKeyboardCurrentPalette)->setVisible(checked);
} // }
} // }
void UBWebController::toggleWebToolsPalette(bool checked) void UBWebController::toggleWebToolsPalette(bool checked)
{ {

@ -28,7 +28,7 @@ class UBMainWindow;
class UBWebToolsPalette; class UBWebToolsPalette;
class WBWebView; class WBWebView;
class UBServerXMLHttpRequest; class UBServerXMLHttpRequest;
class UBKeyboardPalette; //class UBKeyboardPalette;
class UBWebController : public QObject class UBWebController : public QObject
@ -58,6 +58,12 @@ class UBWebController : public QObject
void show(WebInstance type = UBWebController::WebBrowser); void show(WebInstance type = UBWebController::WebBrowser);
WBBrowserWindow* GetCurrentWebBrowser()
{
if( mCurrentWebBrowser != NULL ) return *mCurrentWebBrowser;
else return NULL;
};
protected: protected:
void setupPalettes(); void setupPalettes();
@ -101,8 +107,8 @@ class UBWebController : public QObject
UBTrapFlashController* mTrapFlashController; UBTrapFlashController* mTrapFlashController;
UBWebToolsPalette** mToolsCurrentPalette; UBWebToolsPalette** mToolsCurrentPalette;
UBWebToolsPalette* mToolsPaletteList[TotalNumberOfWebInstances]; UBWebToolsPalette* mToolsPaletteList[TotalNumberOfWebInstances];
UBKeyboardPalette** mKeyboardCurrentPalette; // UBKeyboardPalette** mKeyboardCurrentPalette;
UBKeyboardPalette* mKeyboardPaletteList[TotalNumberOfWebInstances]; // UBKeyboardPalette* mKeyboardPaletteList[TotalNumberOfWebInstances];
bool mToolsPalettePositionned; bool mToolsPalettePositionned;
bool mToolsPalettePositionnedList[TotalNumberOfWebInstances]; bool mToolsPalettePositionnedList[TotalNumberOfWebInstances];
@ -124,7 +130,7 @@ class UBWebController : public QObject
void toggleWebTrap(bool checked); void toggleWebTrap(bool checked);
void showKeyboard(bool checked); // void showKeyboard(bool checked);
signals: signals:
/** /**

Loading…
Cancel
Save