Desktop mode: palettes layout (Windows)

preferencesAboutTextFull
Anatoly Mihalchenko 12 years ago
parent a249bcd314
commit a2491be487
  1. 37
      src/desktop/UBDesktopAnnotationController.cpp
  2. 48
      src/desktop/UBDesktopEraserPalette.cpp
  3. 29
      src/desktop/UBDesktopEraserPalette.h
  4. 61
      src/desktop/UBDesktopMarkerPalette.cpp
  5. 29
      src/desktop/UBDesktopMarkerPalette.h
  6. 15
      src/desktop/UBDesktopPalette.cpp
  7. 2
      src/desktop/UBDesktopPalette.h
  8. 103
      src/desktop/UBDesktopPenPalette.cpp
  9. 170
      src/desktop/UBDesktopPropertyPalette.cpp
  10. 38
      src/desktop/UBDesktopPropertyPalette.h
  11. 8
      src/desktop/desktop.pri
  12. 15
      src/gui/UBFloatingPalette.cpp
  13. 4
      src/gui/UBFloatingPalette.h
  14. 2
      src/gui/UBPropertyPalette.cpp
  15. 2
      src/gui/UBPropertyPalette.h

@ -38,9 +38,7 @@
#include "UBCustomCaptureWindow.h" #include "UBCustomCaptureWindow.h"
#include "UBWindowCapture.h" #include "UBWindowCapture.h"
#include "UBDesktopPalette.h" #include "UBDesktopPalette.h"
#include "UBDesktopPenPalette.h" #include "UBDesktopPropertyPalette.h"
#include "UBDesktopMarkerPalette.h"
#include "UBDesktopEraserPalette.h"
#include "gui/UBKeyboardPalette.h" #include "gui/UBKeyboardPalette.h"
#include "gui/UBResources.h" #include "gui/UBResources.h"
@ -55,6 +53,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
, mDesktopPenPalette(NULL) , mDesktopPenPalette(NULL)
, mDesktopMarkerPalette(NULL) , mDesktopMarkerPalette(NULL)
, mDesktopEraserPalette(NULL) , mDesktopEraserPalette(NULL)
, mRightPalette(rightPalette)
, mWindowPositionInitialized(0) , mWindowPositionInitialized(0)
, mIsFullyTransparent(false) , mIsFullyTransparent(false)
, mDesktopToolsPalettePositioned(false) , mDesktopToolsPalettePositioned(false)
@ -121,13 +120,13 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
connect(UBDrawingController::drawingController(), SIGNAL(stylusToolChanged(int)), this, SLOT(stylusToolChanged(int))); connect(UBDrawingController::drawingController(), SIGNAL(stylusToolChanged(int)), this, SLOT(stylusToolChanged(int)));
// Add the desktop associated palettes // Add the desktop associated palettes
mDesktopPenPalette = new UBDesktopPenPalette(mTransparentDrawingView); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette mDesktopPenPalette = new UBDesktopPenPalette(mTransparentDrawingView, rightPalette);
connect(mDesktopPalette, SIGNAL(maximized()), mDesktopPenPalette, SLOT(onParentMaximized())); connect(mDesktopPalette, SIGNAL(maximized()), mDesktopPenPalette, SLOT(onParentMaximized()));
connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), mDesktopPenPalette, SLOT(onParentMinimized())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), mDesktopPenPalette, SLOT(onParentMinimized()));
mDesktopMarkerPalette = new UBDesktopMarkerPalette(mTransparentDrawingView); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette mDesktopMarkerPalette = new UBDesktopMarkerPalette(mTransparentDrawingView, rightPalette);
mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView, rightPalette);
mDesktopPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor); mDesktopPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopPenPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor); mDesktopPenPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
@ -161,36 +160,12 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
//mDesktopEraserPalette->raise(); //mDesktopEraserPalette->raise();
//mDesktopMarkerPalette->raise(); //mDesktopMarkerPalette->raise();
//mDesktopPenPalette->raise(); //mDesktopPenPalette->raise();
//mDesktopPalette->raise();
} }
UBDesktopAnnotationController::~UBDesktopAnnotationController() UBDesktopAnnotationController::~UBDesktopAnnotationController()
{ {
delete mTransparentDrawingScene; delete mTransparentDrawingScene;
delete mTransparentDrawingView; delete mTransparentDrawingView;
/*
if(NULL != mDesktopPenPalette)
{
delete mDesktopPalette;
mDesktopPenPalette = NULL;
}
if(NULL != mDesktopMarkerPalette)
{
delete mDesktopMarkerPalette;
mDesktopMarkerPalette = NULL;
}
if(NULL != mDesktopEraserPalette)
{
delete mDesktopEraserPalette;
mDesktopEraserPalette = NULL;
}
if(NULL != mRightPalette)
{
delete mRightPalette;
mRightPalette = NULL;
}
*/
} }
@ -257,7 +232,7 @@ void UBDesktopAnnotationController::setAssociatedPalettePosition(UBActionPalette
} }
// First determine if the palette must be shown on the left or on the right // First determine if the palette must be shown on the left or on the right
if(desktopPalettePos.x() <= (mTransparentDrawingView->width() - (palette->width() + mDesktopPalette->width() + 20))) // we take a small margin of 20 pixels if(desktopPalettePos.x() <= (mTransparentDrawingView->width() - (palette->width() + mDesktopPalette->width() + mRightPalette->width() + 20))) // we take a small margin of 20 pixels
{ {
// Display it on the right // Display it on the right
desktopPalettePos += QPoint(mDesktopPalette->width(), yPen); desktopPalettePos += QPoint(mDesktopPalette->width(), yPen);

@ -1,48 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBDesktopEraserPalette.h"
#include "core/UBApplication.h"
#include "core/UBSettings.h"
#include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
#include "gui/UBMainWindow.h"
#include "gui/UBToolbarButtonGroup.h"
#include "core/memcheck.h"
UBDesktopEraserPalette::UBDesktopEraserPalette(QWidget *parent)
: UBPropertyPalette(Qt::Horizontal, parent)
{
// Setup eraser width choice widget
QList<QAction *> eraserWidthActions;
eraserWidthActions.append(UBApplication::mainWindow->actionEraserSmall);
eraserWidthActions.append(UBApplication::mainWindow->actionEraserMedium);
eraserWidthActions.append(UBApplication::mainWindow->actionEraserLarge);
UBToolbarButtonGroup *eraserWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, eraserWidthActions);
connect(eraserWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setEraserWidthIndex(int)));
connect(eraserWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
connect(UBApplication::mainWindow->actionEraseDesktopAnnotations, SIGNAL(triggered()), this, SLOT(close()));
eraserWidthChoice->displayText(false);
eraserWidthChoice->setCurrentIndex(UBSettings::settings()->eraserWidthIndex());
layout()->addWidget(eraserWidthChoice);
addAction(UBApplication::mainWindow->actionEraseDesktopAnnotations);
}

@ -1,29 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBDESKTOPERASERPALETTE_H
#define UBDESKTOPERASERPALETTE_H
#include <QtGui>
#include "gui/UBPropertyPalette.h"
class UBDesktopEraserPalette : public UBPropertyPalette
{
public:
UBDesktopEraserPalette(QWidget *parent = 0);
virtual ~UBDesktopEraserPalette(){}
};
#endif // UBDESKTOPERASERPALETTE_H

@ -1,61 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBDesktopMarkerPalette.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
#include "gui/UBMainWindow.h"
#include "gui/UBToolbarButtonGroup.h"
#include "core/memcheck.h"
UBDesktopMarkerPalette::UBDesktopMarkerPalette(QWidget *parent)
: UBPropertyPalette(Qt::Horizontal, parent)
{
// Setup color choice widget
QList<QAction *> colorActions;
colorActions.append(UBApplication::mainWindow->actionColor0);
colorActions.append(UBApplication::mainWindow->actionColor1);
colorActions.append(UBApplication::mainWindow->actionColor2);
colorActions.append(UBApplication::mainWindow->actionColor3);
UBToolbarButtonGroup *colorChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions);
colorChoice->displayText(false);
//connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close()));
connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged()));
connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close()));
layout()->addWidget(colorChoice);
// Setup line width choice widget
QList<QAction *> lineWidthActions;
lineWidthActions.append(UBApplication::mainWindow->actionLineSmall);
lineWidthActions.append(UBApplication::mainWindow->actionLineMedium);
lineWidthActions.append(UBApplication::mainWindow->actionLineLarge);
UBToolbarButtonGroup *lineWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions);
lineWidthChoice->displayText(false);
connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int)));
connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close()));
layout()->addWidget(lineWidthChoice);
}

@ -1,29 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBDESKTOPMARKERPALETTE_H
#define UBDESKTOPMARKERPALETTE_H
#include <QtGui>
#include "gui/UBPropertyPalette.h"
class UBDesktopMarkerPalette : public UBPropertyPalette
{
public:
UBDesktopMarkerPalette(QWidget *parent = 0);
virtual ~UBDesktopMarkerPalette(){}
};
#endif // UBDESKTOPMARKERPALETTE_H

@ -112,6 +112,9 @@ void UBDesktopPalette::updateShowHideState(bool pShowEnabled)
mShowHideAction->setToolTip(tr("Show Board on Secondary Screen")); mShowHideAction->setToolTip(tr("Show Board on Secondary Screen"));
else else
mShowHideAction->setToolTip(tr("Show Desktop on Secondary Screen")); mShowHideAction->setToolTip(tr("Show Desktop on Secondary Screen"));
if (pShowEnabled)
raise();
} }
@ -222,12 +225,18 @@ QPoint UBDesktopPalette::buttonPos(QAction *action)
} }
int UBDesktopPalette::getParentWidth(QWidget *parent) int UBDesktopPalette::getParentRightOffset()
{ {
return parent->width() - rightPalette->width(); return rightPalette->width();
} }
void UBDesktopPalette::parentResized() void UBDesktopPalette::parentResized()
{ {
moveInsideParent(pos()); QPoint p = pos();
if (minimizedLocation() == eMinimizedLocation_Right)
{
p.setX(parentWidget()->width() - getParentRightOffset() -width());
}
moveInsideParent(p);
} }

@ -53,7 +53,7 @@ protected:
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event); void hideEvent(QHideEvent *event);
int getParentWidth(QWidget *parent); virtual int getParentRightOffset();
private: private:
QAction *mShowHideAction; QAction *mShowHideAction;

@ -1,103 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBDesktopPenPalette.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
#include "gui/UBMainWindow.h"
#include "gui/UBToolbarButtonGroup.h"
#include "core/memcheck.h"
UBDesktopPenPalette::UBDesktopPenPalette(QWidget *parent)
: UBPropertyPalette(Qt::Horizontal, parent)
{
// Setup color choice widget
QList<QAction *> colorActions;
colorActions.append(UBApplication::mainWindow->actionColor0);
colorActions.append(UBApplication::mainWindow->actionColor1);
colorActions.append(UBApplication::mainWindow->actionColor2);
colorActions.append(UBApplication::mainWindow->actionColor3);
UBToolbarButtonGroup *colorChoice =
new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions);
colorChoice->displayText(false);
//connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close()));
connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged()));
connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close()));
layout()->addWidget(colorChoice);
// Setup line width choice widget
QList<QAction *> lineWidthActions;
lineWidthActions.append(UBApplication::mainWindow->actionLineSmall);
lineWidthActions.append(UBApplication::mainWindow->actionLineMedium);
lineWidthActions.append(UBApplication::mainWindow->actionLineLarge);
UBToolbarButtonGroup *lineWidthChoice =
new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions);
lineWidthChoice->displayText(false);
connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int)));
connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close()));
onParentMaximized();
layout()->addWidget(lineWidthChoice);
}
void UBDesktopPenPalette::onButtonReleased()
{
qDebug() << "Pen palette released!";
// trigger the related action
// Close the palette
close();
}
/**
* \brief Disconnect the released event of the buttons
*/
void UBDesktopPenPalette::onParentMinimized()
{
for(int i = 0; i < mButtons.size(); i++)
{
disconnect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased()));
}
}
/**
* \brief Connect the released event of the buttons
*/
void UBDesktopPenPalette::onParentMaximized()
{
for(int i = 0; i < mButtons.size(); i++)
{
connect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased()));
}
}
void UBDesktopPenPalette::resizeEvent(QResizeEvent *)
{
qDebug("pen palette resized!");
}

@ -0,0 +1,170 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBDesktopPropertyPalette.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
#include "gui/UBMainWindow.h"
#include "gui/UBToolbarButtonGroup.h"
#include "gui/UBRightPalette.h"
#include "core/memcheck.h"
UBDesktopPropertyPalette::UBDesktopPropertyPalette(QWidget *parent, UBRightPalette* _rightPalette)
:UBPropertyPalette(Qt::Horizontal, parent)
,rightPalette(_rightPalette)
{}
int UBDesktopPropertyPalette::getParentRightOffset()
{
return rightPalette->width();
}
UBDesktopPenPalette::UBDesktopPenPalette(QWidget *parent, UBRightPalette* rightPalette)
: UBDesktopPropertyPalette(parent, rightPalette)
{
// Setup color choice widget
QList<QAction *> colorActions;
colorActions.append(UBApplication::mainWindow->actionColor0);
colorActions.append(UBApplication::mainWindow->actionColor1);
colorActions.append(UBApplication::mainWindow->actionColor2);
colorActions.append(UBApplication::mainWindow->actionColor3);
UBToolbarButtonGroup *colorChoice =
new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions);
colorChoice->displayText(false);
//connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close()));
connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged()));
connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close()));
layout()->addWidget(colorChoice);
// Setup line width choice widget
QList<QAction *> lineWidthActions;
lineWidthActions.append(UBApplication::mainWindow->actionLineSmall);
lineWidthActions.append(UBApplication::mainWindow->actionLineMedium);
lineWidthActions.append(UBApplication::mainWindow->actionLineLarge);
UBToolbarButtonGroup *lineWidthChoice =
new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions);
lineWidthChoice->displayText(false);
connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int)));
connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close()));
onParentMaximized();
layout()->addWidget(lineWidthChoice);
}
void UBDesktopPenPalette::onButtonReleased()
{
close();
}
/**
* \brief Disconnect the released event of the buttons
*/
void UBDesktopPenPalette::onParentMinimized()
{
for(int i = 0; i < mButtons.size(); i++)
{
disconnect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased()));
}
}
/**
* \brief Connect the released event of the buttons
*/
void UBDesktopPenPalette::onParentMaximized()
{
for(int i = 0; i < mButtons.size(); i++)
{
connect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased()));
}
}
UBDesktopEraserPalette::UBDesktopEraserPalette(QWidget *parent, UBRightPalette* rightPalette)
: UBDesktopPropertyPalette(parent, rightPalette)
{
// Setup eraser width choice widget
QList<QAction *> eraserWidthActions;
eraserWidthActions.append(UBApplication::mainWindow->actionEraserSmall);
eraserWidthActions.append(UBApplication::mainWindow->actionEraserMedium);
eraserWidthActions.append(UBApplication::mainWindow->actionEraserLarge);
UBToolbarButtonGroup *eraserWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, eraserWidthActions);
connect(eraserWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setEraserWidthIndex(int)));
connect(eraserWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
connect(UBApplication::mainWindow->actionEraseDesktopAnnotations, SIGNAL(triggered()), this, SLOT(close()));
eraserWidthChoice->displayText(false);
eraserWidthChoice->setCurrentIndex(UBSettings::settings()->eraserWidthIndex());
layout()->addWidget(eraserWidthChoice);
addAction(UBApplication::mainWindow->actionEraseDesktopAnnotations);
}
UBDesktopMarkerPalette::UBDesktopMarkerPalette(QWidget *parent, UBRightPalette* rightPalette)
: UBDesktopPropertyPalette(parent, rightPalette)
{
// Setup color choice widget
QList<QAction *> colorActions;
colorActions.append(UBApplication::mainWindow->actionColor0);
colorActions.append(UBApplication::mainWindow->actionColor1);
colorActions.append(UBApplication::mainWindow->actionColor2);
colorActions.append(UBApplication::mainWindow->actionColor3);
UBToolbarButtonGroup *colorChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions);
colorChoice->displayText(false);
//connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close()));
connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged()));
connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close()));
layout()->addWidget(colorChoice);
// Setup line width choice widget
QList<QAction *> lineWidthActions;
lineWidthActions.append(UBApplication::mainWindow->actionLineSmall);
lineWidthActions.append(UBApplication::mainWindow->actionLineMedium);
lineWidthActions.append(UBApplication::mainWindow->actionLineLarge);
UBToolbarButtonGroup *lineWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions);
lineWidthChoice->displayText(false);
connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int)));
connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int)));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close()));
layout()->addWidget(lineWidthChoice);
}

@ -20,22 +20,48 @@
#include "gui/UBPropertyPalette.h" #include "gui/UBPropertyPalette.h"
class UBDesktopPenPalette : public UBPropertyPalette class UBRightPalette;
class UBDesktopPropertyPalette : public UBPropertyPalette
{ {
Q_OBJECT Q_OBJECT
public: public:
UBDesktopPenPalette(QWidget *parent = 0); UBDesktopPropertyPalette(QWidget *parent, UBRightPalette* _rightPalette);
virtual ~UBDesktopPenPalette(){} private:
UBRightPalette* rightPalette;
protected:
virtual int getParentRightOffset();
};
class UBDesktopPenPalette : public UBDesktopPropertyPalette
{
Q_OBJECT
public:
UBDesktopPenPalette(QWidget *parent, UBRightPalette* rightPalette);
virtual ~UBDesktopPenPalette(){}
public slots: public slots:
void onParentMinimized(); void onParentMinimized();
void onParentMaximized(); void onParentMaximized();
protected:
void resizeEvent(QResizeEvent *);
private slots: private slots:
void onButtonReleased(); void onButtonReleased();
};
class UBDesktopEraserPalette : public UBDesktopPropertyPalette
{
public:
UBDesktopEraserPalette(QWidget *parent, UBRightPalette* rightPalette);
virtual ~UBDesktopEraserPalette(){}
}; };
class UBDesktopMarkerPalette : public UBDesktopPropertyPalette
{
public:
UBDesktopMarkerPalette(QWidget *parent, UBRightPalette* rightPalette);
virtual ~UBDesktopMarkerPalette(){}
};
#endif // UBDESKTOPPENPALETTE_H #endif // UBDESKTOPPENPALETTE_H

@ -2,16 +2,12 @@ HEADERS += src/desktop/UBDesktopPalette.h \
src/desktop/UBDesktopAnnotationController.h \ src/desktop/UBDesktopAnnotationController.h \
src/desktop/UBCustomCaptureWindow.h \ src/desktop/UBCustomCaptureWindow.h \
src/desktop/UBWindowCapture.h \ src/desktop/UBWindowCapture.h \
src/desktop/UBDesktopPenPalette.h \ src/desktop/UBDesktopPropertyPalette.h
src/desktop/UBDesktopMarkerPalette.h \
src/desktop/UBDesktopEraserPalette.h
SOURCES += src/desktop/UBDesktopPalette.cpp \ SOURCES += src/desktop/UBDesktopPalette.cpp \
src/desktop/UBDesktopAnnotationController.cpp \ src/desktop/UBDesktopAnnotationController.cpp \
src/desktop/UBCustomCaptureWindow.cpp \ src/desktop/UBCustomCaptureWindow.cpp \
src/desktop/UBDesktopPenPalette.cpp \ src/desktop/UBDesktopPropertyPalette.cpp
src/desktop/UBDesktopMarkerPalette.cpp \
src/desktop/UBDesktopEraserPalette.cpp
win32 { win32 {
HEADERS += src/desktop/UBWindowCaptureDelegate_win.h HEADERS += src/desktop/UBWindowCaptureDelegate_win.h

@ -129,9 +129,9 @@ void UBFloatingPalette::mouseReleaseEvent(QMouseEvent *event)
} }
} }
int UBFloatingPalette::getParentWidth(QWidget *parent) int UBFloatingPalette::getParentRightOffset()
{ {
return parent->width(); return 0;
} }
void UBFloatingPalette::moveInsideParent(const QPoint &position) void UBFloatingPalette::moveInsideParent(const QPoint &position)
@ -141,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(getParentWidth(parent) - width() - margin, position.x())); qreal newX = qMax(margin, qMin(parent->width() - getParentRightOffset() - 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)
@ -152,7 +152,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position)
} }
else else
{ {
newX = qMax(margin, getParentWidth(parent) - width() - margin); newX = qMax(margin, parent->width() - getParentRightOffset() - width() - margin);
} }
} }
move(newX, newY); move(newX, newY);
@ -265,7 +265,6 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos)
return; return;
} }
QSize parentSize = parentWidget()->size();
if(mMinimizedLocation == eMinimizedLocation_None) if(mMinimizedLocation == eMinimizedLocation_None)
{ {
// Verify if we have to minimize this palette // Verify if we have to minimize this palette
@ -277,7 +276,7 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos)
// { // {
// mMinimizedLocation = eMinimizedLocation_Top; // mMinimizedLocation = eMinimizedLocation_Top;
// } // }
else if(pos.x() == parentSize.width() - width() - 5) else if(pos.x() == parentWidget()->width() - getParentRightOffset() - width() - 5)
{ {
mMinimizedLocation = eMinimizedLocation_Right; mMinimizedLocation = eMinimizedLocation_Right;
} }
@ -297,8 +296,8 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos)
// Restore the palette // Restore the palette
if(pos.x() > 5 && if(pos.x() > 5 &&
pos.y() > 5 && pos.y() > 5 &&
pos.x() < parentSize.width() - width() - 5 && pos.x() < parentWidget()->width() - getParentRightOffset() - width() - 5 &&
pos.y() < parentSize.height() - height() - 5) pos.y() < parentWidget()->size().height() - height() - 5)
{ {
mMinimizedLocation = eMinimizedLocation_None; mMinimizedLocation = eMinimizedLocation_None;
emit maximizeStart(); emit maximizeStart();

@ -63,7 +63,9 @@ class UBFloatingPalette : public QWidget
bool mCustomPosition; bool mCustomPosition;
bool mIsMoving; bool mIsMoving;
virtual int getParentWidth(QWidget *parent); virtual int getParentRightOffset();
eMinimizedLocation minimizedLocation(){return mMinimizedLocation;}
private: private:
void removeAllAssociatedPalette(); void removeAllAssociatedPalette();

@ -25,7 +25,6 @@ UBPropertyPalette::UBPropertyPalette(QWidget *parent, const char *name):UBAction
{ {
setObjectName(name); setObjectName(name);
mbGrip = false; mbGrip = false;
setMaximumHeight(MAX_HEIGHT);
} }
/** /**
@ -36,7 +35,6 @@ UBPropertyPalette::UBPropertyPalette(QWidget *parent, const char *name):UBAction
UBPropertyPalette::UBPropertyPalette(Qt::Orientation orientation, QWidget *parent):UBActionPalette(orientation, parent) UBPropertyPalette::UBPropertyPalette(Qt::Orientation orientation, QWidget *parent):UBActionPalette(orientation, parent)
{ {
mbGrip = false; mbGrip = false;
setMaximumHeight(MAX_HEIGHT);
} }
/** /**

@ -20,8 +20,6 @@
#include "UBActionPalette.h" #include "UBActionPalette.h"
#define MAX_HEIGHT 20
class UBPropertyPalette : public UBActionPalette class UBPropertyPalette : public UBActionPalette
{ {
Q_OBJECT Q_OBJECT

Loading…
Cancel
Save