SANKORE-1077

Desktop mode is broken
SANKORE-633
Positioning of floating palettes inside layers .
preferencesAboutTextFull
Anatoly Mihalchenko 12 years ago
parent 1a799632ab
commit 50d136f8d1
  1. 6
      src/core/UBApplication.cpp
  2. 9
      src/core/UBApplicationController.cpp
  3. 3
      src/core/UBApplicationController.h
  4. 6
      src/desktop/UBDesktopAnnotationController.cpp
  5. 4
      src/desktop/UBDesktopAnnotationController.h
  6. 20
      src/desktop/UBDesktopPalette.cpp
  7. 12
      src/desktop/UBDesktopPalette.h
  8. 8
      src/domain/UBGraphicsItemUndoCommand.cpp
  9. 9
      src/gui/UBFloatingPalette.cpp
  10. 2
      src/gui/UBFloatingPalette.h

@ -316,7 +316,11 @@ int UBApplication::exec(const QString& pFileToImport)
UBDrawingController::drawingController()->setStylusTool((int)UBStylusTool::Pen); UBDrawingController::drawingController()->setStylusTool((int)UBStylusTool::Pen);
applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner); applicationController = new UBApplicationController(boardController->controlView(),
boardController->displayView(),
mainWindow,
staticMemoryCleaner,
boardController->paletteManager()->rightPalette());
connect(applicationController, SIGNAL(mainModeChanged(UBApplicationController::MainMode)), connect(applicationController, SIGNAL(mainModeChanged(UBApplicationController::MainMode)),

@ -59,8 +59,11 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBApplicationController::UBApplicationController(UBBoardView *pControlView,
UBMainWindow* pMainWindow, QObject* parent) UBBoardView *pDisplayView,
UBMainWindow* pMainWindow,
QObject* parent,
UBRightPalette* rightPalette)
: QObject(parent) : QObject(parent)
, mMainWindow(pMainWindow) , mMainWindow(pMainWindow)
, mControlView(pControlView) , mControlView(pControlView)
@ -75,7 +78,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBo
{ {
mDisplayManager = new UBDisplayManager(this); mDisplayManager = new UBDisplayManager(this);
mUninoteController = new UBDesktopAnnotationController(this); mUninoteController = new UBDesktopAnnotationController(this, rightPalette);
connect(mDisplayManager, SIGNAL(screenLayoutChanged()), this, SLOT(screenLayoutChanged())); connect(mDisplayManager, SIGNAL(screenLayoutChanged()), this, SLOT(screenLayoutChanged()));
connect(mDisplayManager, SIGNAL(screenLayoutChanged()), mUninoteController, SLOT(screenLayoutChanged())); connect(mDisplayManager, SIGNAL(screenLayoutChanged()), mUninoteController, SLOT(screenLayoutChanged()));

@ -31,6 +31,7 @@ class UBSoftwareUpdate;
class QNetworkAccessManager; class QNetworkAccessManager;
class QNetworkReply; class QNetworkReply;
class QHttp; class QHttp;
class UBRightPalette;
class UBApplicationController : public QObject class UBApplicationController : public QObject
@ -39,7 +40,7 @@ class UBApplicationController : public QObject
public: public:
UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBMainWindow *pMainWindow, QObject* parent = 0); UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBMainWindow *pMainWindow, QObject* parent, UBRightPalette* rightPalette);
virtual ~UBApplicationController(); virtual ~UBApplicationController();
int initialHScroll() { return mInitialHScroll; } int initialHScroll() { return mInitialHScroll; }

@ -47,7 +47,7 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UBRightPalette* rightPalette)
: QObject(parent) : QObject(parent)
, mTransparentDrawingView(0) , mTransparentDrawingView(0)
, mTransparentDrawingScene(0) , mTransparentDrawingScene(0)
@ -86,7 +86,9 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingView->setScene(mTransparentDrawingScene); mTransparentDrawingView->setScene(mTransparentDrawingScene);
mTransparentDrawingScene->setDrawingMode(true); mTransparentDrawingScene->setDrawingMode(true);
mDesktopPalette = new UBDesktopPalette(NULL); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView, rightPalette);
// This was not fix, parent reverted
// FIX #633: The palette must be 'floating' in order to stay on top of the library palette
if (UBPlatformUtils::hasVirtualKeyboard()) if (UBPlatformUtils::hasVirtualKeyboard())
{ {

@ -29,8 +29,8 @@ class UBDesktopPenPalette;
class UBDesktopMarkerPalette; class UBDesktopMarkerPalette;
class UBDesktopEraserPalette; class UBDesktopEraserPalette;
class UBActionPalette; class UBActionPalette;
//class UBKeyboardPalette;
class UBMainWindow; class UBMainWindow;
class UBRightPalette;
#define PROPERTY_PALETTE_TIMER 1000 #define PROPERTY_PALETTE_TIMER 1000
@ -47,7 +47,7 @@ class UBDesktopAnnotationController : public QObject
Q_OBJECT; Q_OBJECT;
public: public:
UBDesktopAnnotationController(QObject *parent = 0); UBDesktopAnnotationController(QObject *parent, UBRightPalette* rightPalette);
virtual ~UBDesktopAnnotationController(); virtual ~UBDesktopAnnotationController();
void showWindow(); void showWindow();
void hideWindow(); void hideWindow();

@ -21,10 +21,11 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBDesktopPalette::UBDesktopPalette(QWidget *parent) UBDesktopPalette::UBDesktopPalette(QWidget *parent, UBRightPalette* _rightPalette)
: UBActionPalette(Qt::TopLeftCorner, parent) : UBActionPalette(Qt::TopLeftCorner, parent)
, mShowHideAction(0) , rightPalette(_rightPalette)
, mDisplaySelectAction(0) , mShowHideAction(0)
, mDisplaySelectAction(0)
{ {
QList<QAction*> actions; QList<QAction*> actions;
@ -72,6 +73,8 @@ UBDesktopPalette::UBDesktopPalette(QWidget *parent)
connect(this, SIGNAL(maximizeStart()), this, SLOT(maximizeMe())); connect(this, SIGNAL(maximizeStart()), this, SLOT(maximizeMe()));
connect(this, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(minimizeMe(eMinimizedLocation))); connect(this, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(minimizeMe(eMinimizedLocation)));
setMinimizePermission(true); setMinimizePermission(true);
connect(rightPalette, SIGNAL(resized()), this, SLOT(parentResized()));
} }
@ -217,3 +220,14 @@ QPoint UBDesktopPalette::buttonPos(QAction *action)
return p; return p;
} }
int UBDesktopPalette::getParentWidth(QWidget *parent)
{
return parent->width() - rightPalette->width();
}
void UBDesktopPalette::parentResized()
{
moveInsideParent(pos());
}

@ -12,6 +12,7 @@
#include <QHideEvent> #include <QHideEvent>
#include "gui/UBActionPalette.h" #include "gui/UBActionPalette.h"
#include "gui/UBRightPalette.h"
/** /**
* The uninotes window. This window is controlled by UBUninotesWindowController. * The uninotes window. This window is controlled by UBUninotesWindowController.
@ -21,7 +22,7 @@ class UBDesktopPalette : public UBActionPalette
Q_OBJECT; Q_OBJECT;
public: public:
UBDesktopPalette(QWidget *parent = 0); UBDesktopPalette(QWidget *parent, UBRightPalette* rightPalette);
virtual ~UBDesktopPalette(); virtual ~UBDesktopPalette();
void disappearForCapture(); void disappearForCapture();
@ -41,17 +42,19 @@ class UBDesktopPalette : public UBActionPalette
public slots: public slots:
void showHideClick(bool checked); void showHideClick(bool checked);
void updateShowHideState(bool pShowEnabled); void updateShowHideState(bool pShowEnabled);
void setShowHideButtonVisible(bool visible); void setShowHideButtonVisible(bool visible);
void setDisplaySelectButtonVisible(bool show); void setDisplaySelectButtonVisible(bool show);
void minimizeMe(eMinimizedLocation location); void minimizeMe(eMinimizedLocation location);
void maximizeMe(); void maximizeMe();
void parentResized();
protected: protected:
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event); void hideEvent(QHideEvent *event);
int getParentWidth(QWidget *parent);
private: private:
QAction *mShowHideAction; QAction *mShowHideAction;
QAction *mDisplaySelectAction; QAction *mDisplaySelectAction;
@ -60,6 +63,9 @@ protected:
QAction *mActionCustomSelect; QAction *mActionCustomSelect;
QAction* mActionTest; QAction* mActionTest;
UBRightPalette* rightPalette;
signals: signals:
void stylusToolChanged(int tool); void stylusToolChanged(int tool);

@ -112,8 +112,8 @@ void UBGraphicsItemUndoCommand::undo()
} }
QMapIterator<UBGraphicsGroupContainerItem*, QUuid> curMapElement(mExcludedFromGroup); QMapIterator<UBGraphicsGroupContainerItem*, QUuid> curMapElement(mExcludedFromGroup);
UBGraphicsGroupContainerItem *nextGroup = 0; UBGraphicsGroupContainerItem *nextGroup = NULL;
UBGraphicsGroupContainerItem *previousGroupItem; UBGraphicsGroupContainerItem *previousGroupItem = NULL;
bool groupChanged = false; bool groupChanged = false;
while (curMapElement.hasNext()) { while (curMapElement.hasNext()) {
@ -157,8 +157,8 @@ void UBGraphicsItemUndoCommand::redo()
} }
QMapIterator<UBGraphicsGroupContainerItem*, QUuid> curMapElement(mExcludedFromGroup); QMapIterator<UBGraphicsGroupContainerItem*, QUuid> curMapElement(mExcludedFromGroup);
UBGraphicsGroupContainerItem *nextGroup = 0; UBGraphicsGroupContainerItem *nextGroup = NULL;
UBGraphicsGroupContainerItem *previousGroupItem; UBGraphicsGroupContainerItem *previousGroupItem = NULL;
bool groupChanged = false; bool groupChanged = false;
while (curMapElement.hasNext()) { while (curMapElement.hasNext()) {

@ -129,6 +129,11 @@ void UBFloatingPalette::mouseReleaseEvent(QMouseEvent *event)
} }
} }
int UBFloatingPalette::getParentWidth(QWidget *parent)
{
return parent->width();
}
void UBFloatingPalette::moveInsideParent(const QPoint &position) void UBFloatingPalette::moveInsideParent(const QPoint &position)
{ {
QWidget *parent = parentWidget(); QWidget *parent = parentWidget();
@ -136,7 +141,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position)
if (parent) if (parent)
{ {
int margin = UBSettings::boardMargin - border(); int margin = UBSettings::boardMargin - border();
qreal newX = qMax(margin, qMin(parent->width() - width() - margin, position.x())); qreal newX = qMax(margin, qMin(getParentWidth(parent) - width() - margin, position.x()));
qreal newY = qMax(margin, qMin(parent->height() - height() - margin, position.y())); qreal newY = qMax(margin, qMin(parent->height() - height() - margin, position.y()));
if (!mCustomPosition && !mIsMoving) if (!mCustomPosition && !mIsMoving)
@ -147,7 +152,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position)
} }
else else
{ {
newX = qMax(margin, parent->width() - width() - margin); newX = qMax(margin, getParentWidth(parent) - width() - margin);
} }
} }
move(newX, newY); move(newX, newY);

@ -63,6 +63,8 @@ class UBFloatingPalette : public QWidget
bool mCustomPosition; bool mCustomPosition;
bool mIsMoving; bool mIsMoving;
virtual int getParentWidth(QWidget *parent);
private: private:
void removeAllAssociatedPalette(); void removeAllAssociatedPalette();
void minimizePalette(const QPoint& pos); void minimizePalette(const QPoint& pos);

Loading…
Cancel
Save