").appendTo(img_block);
$("
").appendTo(img_block);
diff --git a/src/board/UBDrawingController.h b/src/board/UBDrawingController.h
index 0ce1527b..e2f822cf 100644
--- a/src/board/UBDrawingController.h
+++ b/src/board/UBDrawingController.h
@@ -65,6 +65,10 @@ class UBDrawingController : public QObject
mIsDesktopMode = mode;
}
+ bool isInDesktopMode(){
+ return mIsDesktopMode;
+ }
+
public slots:
void setStylusTool(int tool);
diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp
index dec6530f..bfd97da3 100644
--- a/src/domain/UBGraphicsScene.cpp
+++ b/src/domain/UBGraphicsScene.cpp
@@ -779,7 +779,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
if (mShouldUseOMP)
{
- //#pragma omp parallel for
+ #pragma omp parallel for
for (int i = 0; i < collidItemsSize; i++)
{
UBGraphicsPolygonItem *collidingPolygonItem = qgraphicsitem_cast(collidItems.at(i));
@@ -789,7 +789,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
if(eraserInnerRect.contains(collidingPolygonItem->boundingRect()))
{
- //#pragma omp critical
+ #pragma omp critical
// Put the entire polygon into the remove list
toBeRemovedItems << collidingPolygonItem;
}
@@ -826,7 +826,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
}
else */if (croppedPathSimplified.isEmpty())
{
- //#pragma omp critical
+ #pragma omp critical
// Put the entire polygon into the remove list if the eraser removes all its visible content
toBeRemovedItems << collidingPolygonItem;
}
@@ -837,7 +837,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
foreach(const QPolygonF &pol, croppedPathSimplified.toFillPolygons())
{
UBGraphicsPolygonItem* croppedPolygonItem = collidingPolygonItem->deepCopy(pol);
- //#pragma omp critical
+ #pragma omp critical
if(NULL != pGroup){
croppedPolygonItem->setStrokesGroup(pGroup);
//pGroup->addToGroup(croppedPolygonItem);
@@ -845,7 +845,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
// Add this new polygon to the 'added' list
toBeAddedItems << croppedPolygonItem;
}
- //#pragma omp critical
+ #pragma omp critical
// Remove the original polygonitem because it has been replaced by many smaller polygons
toBeRemovedItems << collidingPolygonItem;
}
@@ -902,7 +902,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
}
}
- if(eDrawingMode_Vector == UBDrawingController::drawingController()->drawingMode()){
+ if(eDrawingMode_Vector == DRAWING_MODE && !UBDrawingController::drawingController()->isInDesktopMode()){
foreach(QGraphicsItem* item, toBeRemovedItems){
UBGraphicsPolygonItem* poly = dynamic_cast(item);
if(NULL != poly){
@@ -920,7 +920,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
mRemovedItems += toBeRemovedItems;
}
- if(eDrawingMode_Vector == UBDrawingController::drawingController()->drawingMode()){
+ if(eDrawingMode_Vector == DRAWING_MODE && !UBDrawingController::drawingController()->isInDesktopMode()){
foreach(QGraphicsItem* item, toBeAddedItems){
UBGraphicsPolygonItem* poly = dynamic_cast(item);
if(NULL != poly && NULL != poly->strokesGroup()){
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