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);
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)),

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

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

@ -47,7 +47,7 @@
#include "core/memcheck.h"
UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UBRightPalette* rightPalette)
: QObject(parent)
, mTransparentDrawingView(0)
, mTransparentDrawingScene(0)
@ -86,7 +86,9 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingView->setScene(mTransparentDrawingScene);
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())
{

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

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

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

@ -112,8 +112,8 @@ void UBGraphicsItemUndoCommand::undo()
}
QMapIterator<UBGraphicsGroupContainerItem*, QUuid> curMapElement(mExcludedFromGroup);
UBGraphicsGroupContainerItem *nextGroup = 0;
UBGraphicsGroupContainerItem *previousGroupItem;
UBGraphicsGroupContainerItem *nextGroup = NULL;
UBGraphicsGroupContainerItem *previousGroupItem = NULL;
bool groupChanged = false;
while (curMapElement.hasNext()) {
@ -157,8 +157,8 @@ void UBGraphicsItemUndoCommand::redo()
}
QMapIterator<UBGraphicsGroupContainerItem*, QUuid> curMapElement(mExcludedFromGroup);
UBGraphicsGroupContainerItem *nextGroup = 0;
UBGraphicsGroupContainerItem *previousGroupItem;
UBGraphicsGroupContainerItem *nextGroup = NULL;
UBGraphicsGroupContainerItem *previousGroupItem = NULL;
bool groupChanged = false;
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)
{
QWidget *parent = parentWidget();
@ -136,7 +141,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position)
if (parent)
{
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()));
if (!mCustomPosition && !mIsMoving)
@ -147,7 +152,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position)
}
else
{
newX = qMax(margin, parent->width() - width() - margin);
newX = qMax(margin, getParentWidth(parent) - width() - margin);
}
}
move(newX, newY);

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

Loading…
Cancel
Save