Merge branch 'dev-qt5.1x' of https://github.com/OpenBoard-org/OpenBoard into dev-qt5.1x

preferencesAboutTextFull
Clément Fauconnier 4 years ago
commit ab705d282e
  1. 2
      src/board/UBDrawingController.h
  2. 3
      src/core/UBApplicationController.cpp
  3. 4
      src/frameworks/UBPlatformUtils_mac.mm
  4. 115
      src/gui/UBDocumentNavigator.cpp
  5. 2
      src/gui/UBDocumentNavigator.h

@ -66,7 +66,7 @@ class UBDrawingController : public QObject
UBAbstractDrawRuler* mActiveRuler; UBAbstractDrawRuler* mActiveRuler;
void setInDestopMode(bool mode){ void setInDesktopMode(bool mode){
mIsDesktopMode = mode; mIsDesktopMode = mode;
} }

@ -371,6 +371,7 @@ void UBApplicationController::showBoard()
mIsShowingDesktop = false; mIsShowingDesktop = false;
UBPlatformUtils::setDesktopMode(false); UBPlatformUtils::setDesktopMode(false);
UBDrawingController::drawingController()->setInDesktopMode(false);
mUninoteController->hideWindow(); mUninoteController->hideWindow();
@ -473,7 +474,7 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
UBPlatformUtils::bringPreviousProcessToFront(); UBPlatformUtils::bringPreviousProcessToFront();
} }
UBDrawingController::drawingController()->setInDestopMode(true); UBDrawingController::drawingController()->setInDesktopMode(true);
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
} }

@ -90,10 +90,10 @@ void UBPlatformUtils::setDesktopMode(bool desktop)
@try { @try {
// temporarily disabled due to bug: when switching to desktop mode (and calling this), // temporarily disabled due to bug: when switching to desktop mode (and calling this),
// openboard switches right back to the board mode. clicking again on desktop mode works. // openboard switches right back to the board mode. clicking again on desktop mode works.
/*if (desktop) { if (desktop) {
[NSApp setPresentationOptions:NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock]; [NSApp setPresentationOptions:NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock];
} }
else*/ else
[NSApp setPresentationOptions:NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock]; [NSApp setPresentationOptions:NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock];
} }

@ -39,6 +39,7 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "UBDocumentNavigator.h" #include "UBDocumentNavigator.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBBoardView.h"
#include "adaptors/UBThumbnailAdaptor.h" #include "adaptors/UBThumbnailAdaptor.h"
#include "adaptors/UBSvgSubsetAdaptor.h" #include "adaptors/UBSvgSubsetAdaptor.h"
#include "document/UBDocumentController.h" #include "document/UBDocumentController.h"
@ -354,6 +355,120 @@ void UBDocumentNavigator::mouseReleaseEvent(QMouseEvent *event)
mLongPressTimer.stop(); mLongPressTimer.stop();
} }
void UBDocumentNavigator::keyPressEvent(QKeyEvent *event)
{
return;
UBBoardController* controller = UBApplication::boardController;
// send to the scene anyway
QApplication::sendEvent (scene (), event);
if (!event->isAccepted ())
{
switch (event->key ())
{
case Qt::Key_Up:
case Qt::Key_PageUp:
case Qt::Key_Left:
{
controller->previousScene ();
break;
}
case Qt::Key_Down:
case Qt::Key_PageDown:
case Qt::Key_Right:
case Qt::Key_Space:
{
controller->nextScene ();
break;
}
case Qt::Key_Home:
{
controller->firstScene ();
break;
}
case Qt::Key_End:
{
controller->lastScene ();
break;
}
case Qt::Key_Insert:
{
controller->addScene ();
break;
}
case Qt::Key_Control:
case Qt::Key_Shift:
{
controller->controlView()->setMultiselection(true);
}break;
}
if (event->modifiers () & Qt::ControlModifier) // keep only ctrl/cmd keys
{
switch (event->key ())
{
case Qt::Key_Plus:
case Qt::Key_I:
{
controller->zoomIn ();
event->accept ();
break;
}
case Qt::Key_Minus:
case Qt::Key_O:
{
controller->zoomOut ();
event->accept ();
break;
}
case Qt::Key_0:
{
controller->zoomRestore ();
event->accept ();
break;
}
case Qt::Key_Left:
{
controller->handScroll (-100, 0);
event->accept ();
break;
}
case Qt::Key_Right:
{
controller->handScroll (100, 0);
event->accept ();
break;
}
case Qt::Key_Up:
{
controller->handScroll (0, -100);
event->accept ();
break;
}
case Qt::Key_Down:
{
controller->handScroll (0, 100);
event->accept ();
break;
}
default:
{
// NOOP
}
}
}
}
// if ctrl of shift was pressed combined with other keys - we need to disable multiple selection.
if (event->isAccepted())
controller->controlView()->setMultiselection(false);
}
void UBDocumentNavigator::longPressTimeout() void UBDocumentNavigator::longPressTimeout()
{ {
if (QApplication::mouseButtons() != Qt::NoButton) if (QApplication::mouseButtons() != Qt::NoButton)

@ -72,6 +72,8 @@ protected:
virtual void dragMoveEvent(QDragMoveEvent* event); virtual void dragMoveEvent(QDragMoveEvent* event);
virtual void dropEvent(QDropEvent* event); virtual void dropEvent(QDropEvent* event);
virtual void keyPressEvent(QKeyEvent *event);
signals: signals:
void mousePressAndHoldEventRequired(); void mousePressAndHoldEventRequired();
void moveThumbnailRequired(int from, int to); void moveThumbnailRequired(int from, int to);

Loading…
Cancel
Save