From a3f2b08b7d71958e8a3331f1835c97d3f7e7b7ea Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 27 Jul 2012 11:45:26 +0200 Subject: [PATCH] fixed issue 667 --- src/gui/UBActionPalette.cpp | 1 - src/gui/UBActionPalette.h | 1 - src/gui/UBTeacherGuideWidget.cpp | 41 +++++++++++++++++++++++++------- src/gui/UBTeacherGuideWidget.h | 5 ++++ 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/gui/UBActionPalette.cpp b/src/gui/UBActionPalette.cpp index edef3360..5fc02934 100644 --- a/src/gui/UBActionPalette.cpp +++ b/src/gui/UBActionPalette.cpp @@ -231,7 +231,6 @@ void UBActionPalette::mouseReleaseEvent(QMouseEvent * event) void UBActionPalette::actionChanged() { - emit itemOnActionPaletteChanged(); for(int i = 0; i < mActions.length() && i < mButtons.length(); i++) { mButtons.at(i)->setVisible(mActions.at(i)->isVisible()); diff --git a/src/gui/UBActionPalette.h b/src/gui/UBActionPalette.h index 5e5604a8..991337ac 100644 --- a/src/gui/UBActionPalette.h +++ b/src/gui/UBActionPalette.h @@ -61,7 +61,6 @@ class UBActionPalette : public UBFloatingPalette void closed(); void buttonGroupClicked(int id); void customMouseReleased(); - void itemOnActionPaletteChanged(); protected: virtual void paintEvent(QPaintEvent *event); diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 6608d402..fdf30f08 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -1100,6 +1100,7 @@ UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget* parent, const char* name) : , mpPageZeroWidget(NULL) , mpEditionWidget(NULL) , mpPresentationWidget(NULL) + , mKeyboardActionFired(false) { setObjectName(name); if (UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()) { @@ -1113,11 +1114,9 @@ UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget* parent, const char* name) : addWidget(mpPresentationWidget); } - connect(UBApplication::boardController->controlView(), - SIGNAL(clickOnBoard()), this, SLOT(showPresentationMode())); + connect(UBApplication::boardController->controlView(), SIGNAL(clickOnBoard()), this, SLOT(showPresentationMode())); connectToStylusPalette(); - connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, - SLOT(onActiveSceneChanged())); + connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); } UBTeacherGuideWidget::~UBTeacherGuideWidget() @@ -1138,12 +1137,38 @@ void UBTeacherGuideWidget::onActiveSceneChanged() } +#include "core/UBApplication.h" +#include "gui/UBMainWindow.h" + +void UBTeacherGuideWidget::onTriggeredAction(bool checked) +{ + Q_UNUSED(checked); + if(!mKeyboardActionFired) + showPresentationMode(); + mKeyboardActionFired=false; +} + +void UBTeacherGuideWidget::onTriggeredKeyboardAction(bool checked) +{ + Q_UNUSED(checked); + mKeyboardActionFired = true; +} + void UBTeacherGuideWidget::connectToStylusPalette() { - if (UBApplication::boardController->paletteManager()) - connect( UBApplication::boardController->paletteManager()->stylusPalette(), SIGNAL(itemOnActionPaletteChanged()), this, SLOT(showPresentationMode())); - else - QTimer::singleShot(100, this, SLOT(connectToStylusPalette())); + connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool))); + connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(onTriggeredKeyboardAction(bool))); } void UBTeacherGuideWidget::showPresentationMode() diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 16ac64e5..b723e976 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -214,6 +214,11 @@ private: UBTeacherGuideEditionWidget* mpEditionWidget; UBTeacherGuidePresentationWidget* mpPresentationWidget; QVectormCurrentData; + bool mKeyboardActionFired; + +private slots: + void onTriggeredAction(bool checked); + void onTriggeredKeyboardAction(bool checked); }; #endif // UBTEACHERGUIDEWIDGET_H