Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Ivan Ilin 13 years ago
commit 3bd44ffc16
  1. 4
      Sankore_3.1.pro
  2. 3277
      resources/forms/mainWindow.ui
  3. BIN
      resources/images/cache_circle.png
  4. BIN
      resources/images/cache_close.png
  5. BIN
      resources/images/cache_open.png
  6. BIN
      resources/images/cache_square.png
  7. 5
      resources/sankore.qrc
  8. 52
      resources/style.qss
  9. 25
      src/adaptors/UBSvgSubsetAdaptor.cpp
  10. 32
      src/board/UBBoardController.cpp
  11. 6
      src/board/UBBoardController.h
  12. 10
      src/board/UBBoardPaletteManager.cpp
  13. 16
      src/core/UBApplication.cpp
  14. 1
      src/core/UBApplication.h
  15. 24
      src/desktop/UBDesktopAnnotationController.cpp
  16. 3
      src/desktop/UBDesktopAnnotationController.h
  17. 15
      src/desktop/UBDesktopPalette.cpp
  18. 5
      src/desktop/UBDesktopPalette.h
  19. 85
      src/desktop/UBDesktopToolsPalette.cpp
  20. 29
      src/desktop/UBDesktopToolsPalette.h
  21. 2
      src/desktop/desktop.pri
  22. 20
      src/domain/UBGraphicsScene.cpp
  23. 4
      src/domain/UBGraphicsScene.h
  24. 317
      src/gui/UBCachePropertiesWidget.cpp
  25. 60
      src/gui/UBCachePropertiesWidget.h
  26. 84
      src/gui/UBClockPalette.cpp
  27. 9
      src/gui/UBDockPalette.cpp
  28. 3
      src/gui/UBDockPalette.h
  29. 3
      src/gui/UBPageNavigationWidget.cpp
  30. 60
      src/gui/UBPageNumberPalette.cpp
  31. 51
      src/gui/UBPageNumberPalette.h
  32. 50
      src/gui/UBRightPalette.cpp
  33. 6
      src/gui/UBRightPalette.h
  34. 10
      src/gui/gui.pri
  35. 6
      src/tools/UBGraphicsCache.cpp
  36. 11
      src/tools/UBToolsManager.cpp
  37. 1
      src/tools/UBToolsManager.h

@ -7,8 +7,8 @@ CONFIG += debug_and_release \
no_include_pwd
VERSION_MAJ = 1
VERSION_MIN = 20
VERSION_TYPE = r # a = alpha, b = beta, r = release, other => error
VERSION_MIN = 26
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 00
VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}"

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

@ -317,5 +317,10 @@
<file>images/library_open.png</file>
<file>images/pages_close.png</file>
<file>images/pages_open.png</file>
<file>images/cache_close.png</file>
<file>images/cache_open.png</file>
<file>style.qss</file>
<file>images/cache_circle.png</file>
<file>images/cache_square.png</file>
</qresource>
</RCC>

@ -0,0 +1,52 @@
QWidget#DockPaletteWidgetBox
{
background: #EEEEEE;
border-radius: 10px;
border: 2px solid #999999;
}
QColorDialog
{
background: #EEEEEE;
}
QLabel#DockPaletteWidgetTitle
{
color: #FFFFFF;
font-size : 18px;
font-weight:bold;
}
QPushButton#DockPaletteWidgetButton
{
background-color : #DDDDDD;
color : #555555;
border-radius : 6px;
padding : 5px;
font-weight : bold;
font-size : 12px;
}
QPushButton#DockPaletteWidgetButton::checked
{
background-color: #BBBBBB;
}
QSlider::handle::horizontal
{
background-color:#EEEEEE;
margin-top:-5px;
margin-bottom:-5px;
height:20px;
width:18px;
border-radius:10px;
border:1px solid #555555;
}
QSlider::groove::horizontal
{
background-color:#999999;
height:10px;
border-radius:5px;
border:1px solid #555555;
}

@ -48,6 +48,7 @@
#include "core/UBSettings.h"
#include "core/UBSetting.h"
#include "core/UBPersistenceManager.h"
#include "core/UBApplication.h"
#include "pdf/PDFRenderer.h"
@ -672,6 +673,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{
scene->addItem(cache);
scene->registerTool(cache);
UBApplication::boardController->notifyCache(true);
}
}
else if (mXmlReader.name() == "foreignObject")
@ -2680,7 +2682,24 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
UBGraphicsCache* UBSvgSubsetAdaptor::UBSvgSubsetReader::cacheFromSvg()
{
UBGraphicsCache* pCache = new UBGraphicsCache();
//pCache->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCache);
pCache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
graphicsItemFromSvg(pCache);
QStringRef colorR = mXmlReader.attributes().value("colorR");
QStringRef colorG = mXmlReader.attributes().value("colorG");
QStringRef colorB = mXmlReader.attributes().value("colorB");
QStringRef colorA = mXmlReader.attributes().value("colorA");
QStringRef shape = mXmlReader.attributes().value("shape");
QStringRef shapeSize = mXmlReader.attributes().value("shapeSize");
QColor color(colorR.toString().toInt(), colorG.toString().toInt(), colorB.toString().toInt(), colorA.toString().toInt());
pCache->setMaskColor(color);
pCache->setShapeWidth(shapeSize.toString().toInt());
pCache->setMaskShape(static_cast<eMaskShape>(shape.toString().toInt()));
pCache->setVisible(true);
return pCache;
@ -2694,6 +2713,12 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::cacheToSvg(UBGraphicsCache* item)
mXmlWriter.writeAttribute("y", QString("%1").arg(item->rect().y()));
mXmlWriter.writeAttribute("width", QString("%1").arg(item->rect().width()));
mXmlWriter.writeAttribute("height", QString("%1").arg(item->rect().height()));
mXmlWriter.writeAttribute("colorR", QString("%1").arg(item->maskColor().red()));
mXmlWriter.writeAttribute("colorG", QString("%1").arg(item->maskColor().green()));
mXmlWriter.writeAttribute("colorB", QString("%1").arg(item->maskColor().blue()));
mXmlWriter.writeAttribute("colorA", QString("%1").arg(item->maskColor().alpha()));
mXmlWriter.writeAttribute("shape", QString("%1").arg(item->maskshape()));
mXmlWriter.writeAttribute("shapeSize", QString("%1").arg(item->shapeWidth()));
QString zs;
zs.setNum(item->zValue(), 'f'); // 'f' keeps precision

@ -484,6 +484,7 @@ void UBBoardController::addScene(UBDocumentProxy* proxy, int sceneIndex, bool re
if (scene)
{
addScene(scene, replaceActiveIfEmpty);
emit pageChanged();
}
}
@ -501,6 +502,8 @@ void UBBoardController::duplicateScene()
setActiveDocumentScene(mActiveDocument, mActiveSceneIndex + 1);
QApplication::restoreOverrideCursor();
emit pageChanged();
}
@ -669,6 +672,7 @@ void UBBoardController::previousScene()
}
updateActionStates();
emit pageChanged();
}
@ -683,7 +687,7 @@ void UBBoardController::nextScene()
}
updateActionStates();
emit pageChanged();
}
@ -698,6 +702,7 @@ void UBBoardController::firstScene()
}
updateActionStates();
emit pageChanged();
}
@ -712,6 +717,7 @@ void UBBoardController::lastScene()
}
updateActionStates();
emit pageChanged();
}
@ -1017,6 +1023,11 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
mActiveScene->addTriangle(pPos);
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
}
else if (sourceUrl.toString() == UBToolsManager::manager()->cache.id)
{
mActiveScene->addCache();
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
}
else if (sourceUrl.toString() == UBToolsManager::manager()->magnifier.id)
{
UBMagnifierParams params;
@ -1145,7 +1156,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
}
// Notify the navigator palette that the document has changed
mPaletteManager->leftPalette()->pageNavigator()->setDocument(pDocumentProxy);
mPaletteManager->leftPalette()->pageNavigator()->setDocument(pDocumentProxy);
if (sceneChange)
emit activeSceneChanged();
@ -1516,6 +1527,17 @@ void UBBoardController::setPageSize(QSize newSize)
}
}
void UBBoardController::notifyCache(bool visible)
{
if(visible)
{
emit cacheEnabled();
}
else
{
emit cacheDisabled();
}
}
void UBBoardController::updatePageSizeState()
{
@ -1928,7 +1950,6 @@ void UBBoardController::addItem()
}
}
void UBBoardController::importPage()
{
int pageCount = mActiveDocument->pageCount();
@ -1939,7 +1960,10 @@ void UBBoardController::importPage()
}
}
void UBBoardController::notifyPageChanged()
{
emit pageChanged();
}

@ -157,6 +157,9 @@ class UBBoardController : public QObject
return mPaletteManager;
}
void notifyCache(bool visible);
void notifyPageChanged();
public slots:
void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0);
@ -255,6 +258,9 @@ class UBBoardController : public QObject
void controlViewportChanged();
void backgroundChanged();
void cacheEnabled();
void cacheDisabled();
void pageChanged();
protected:

@ -25,9 +25,7 @@
#include "gui/UBMainWindow.h"
#include "gui/UBStylusPalette.h"
#include "gui/UBClockPalette.h"
#include "gui/UBKeyboardPalette.h"
#include "gui/UBPageNumberPalette.h"
#include "gui/UBToolWidget.h"
#include "gui/UBZoomPalette.h"
#include "gui/UBActionPalette.h"
@ -138,10 +136,6 @@ void UBBoardPaletteManager::setupPalettes()
mZoomPalette = new UBZoomPalette(mContainer);
//mClockPalette->addAssociatedPalette(mKeyboardPalette);
//mKeyboardPalette->addAssociatedPalette(mClockPalette);
QList<QAction*> backgroundsActions;
backgroundsActions << UBApplication::mainWindow->actionPlainLightBackground;
@ -568,7 +562,9 @@ void UBBoardPaletteManager::addItemToLibrary()
, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
QImage image = mPixmap.toImage();
//UBApplication::boardController->libraryController()->importImageOnLibrary(image);
// TODO:Claudio
// This is a wrong way of calling importImageOnLibrary but for the moment it works because element on mRightPalette are predefined.
mRightPalette->libWidget()->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image);
}
else

@ -600,3 +600,19 @@ void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment,
if (textRole != QPalette::NoRole)
painter->setPen(savedPen);
}
QString UBApplication::globalStyleSheet()
{
QString style;
QFile f(":style.qss");
if(f.exists())
{
if(f.open(QIODevice::ReadOnly))
{
style = QString(f.readAll());
}
}
return style;
}

@ -78,6 +78,7 @@ class UBApplication : public QtSingleApplication
static void setDisabled(bool disable);
static QObject* staticMemoryCleaner;
static QString globalStyleSheet();
void decorateActionMenu(QAction* action);
void insertSpaceToToolbarBeforeAction(QToolBar* toolbar, QAction* action, int width = -1);

@ -37,7 +37,6 @@
#include "UBCustomCaptureWindow.h"
#include "UBWindowCapture.h"
#include "UBDesktopPalette.h"
#include "UBDesktopToolsPalette.h"
#include "UBDesktopPenPalette.h"
#include "UBDesktopMarkerPalette.h"
#include "UBDesktopEraserPalette.h"
@ -52,7 +51,6 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, mTransparentDrawingScene(0)
, mDesktopPalette(NULL)
, mKeyboardPalette(0)
, mDesktopToolsPalette(NULL)
, mDesktopPenPalette(NULL)
, mDesktopMarkerPalette(NULL)
, mDesktopEraserPalette(NULL)
@ -106,6 +104,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
connect(mKeyboardPalette, SIGNAL(keyboardActivated(bool)), mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool)));
#ifdef Q_WS_X11
connect(mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask()));
connect(mDesktopPalette,SIGNAL(refreshMask()), this, SLOT(refreshMask()));
#endif
}
@ -124,7 +123,6 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
, this, SLOT(stylusToolChanged(int)));
// Add the desktop associated palettes
mDesktopToolsPalette = new UBDesktopToolsPalette(mTransparentDrawingView);
mDesktopPenPalette = new UBDesktopPenPalette(mTransparentDrawingView);
connect(mDesktopPalette, SIGNAL(maximized()), mDesktopPenPalette, SLOT(onParentMaximized()));
@ -134,12 +132,10 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView);
mDesktopPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopToolsPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopPenPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopMarkerPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopEraserPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopToolsPalette->setVisible(UBApplication::mainWindow->actionDesktopTools->isChecked());
// Hack : the size of the property palettes is computed the first time the palette is visible
// In order to prevent palette overlap on if the desktop palette is on the right of the
@ -151,7 +147,6 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mDesktopMarkerPalette->setVisible(false);
mDesktopEraserPalette->setVisible(false);
connect(UBApplication::mainWindow->actionDesktopTools, SIGNAL(triggered(bool)), this, SLOT(desktopToolsActionToogled(bool)));
connect(UBApplication::mainWindow->actionEraseDesktopAnnotations, SIGNAL(triggered()), this, SLOT(eraseDesktopAnnotations()));
connect(&mHoldTimerPen, SIGNAL(timeout()), this, SLOT(penActionReleased()));
@ -226,23 +221,6 @@ UBDesktopPalette* UBDesktopAnnotationController::desktopPalette()
return mDesktopPalette;
}
void UBDesktopAnnotationController::desktopToolsActionToogled(bool checked)
{
if (!mDesktopToolsPalettePositioned)
{
QPoint pos = mDesktopPalette->geometry().bottomLeft();
pos += QPoint(0, 10);
mDesktopToolsPalette->setCustomPosition(true);
mDesktopToolsPalette->move(pos);
mDesktopToolsPalettePositioned = true;
}
mDesktopToolsPalette->setVisible(checked);
}
/**
* \brief Toggle the visibility of the pen associated palette
* @param checked as the visibility state

@ -23,7 +23,6 @@
#include "gui/UBRightPalette.h"
class UBDesktopPalette;
class UBDesktopToolsPalette;
class UBBoardView;
class UBGraphicsScene;
class UBDesktopPenPalette;
@ -89,7 +88,6 @@ class UBDesktopAnnotationController : public QObject
UBGraphicsScene* mTransparentDrawingScene;
private slots:
void desktopToolsActionToogled(bool);
void desktopPenActionToggled(bool checked);
void desktopMarkerActionToggled(bool checked);
void desktopEraserActionToggled(bool checked);
@ -112,7 +110,6 @@ class UBDesktopAnnotationController : public QObject
UBDesktopPalette *mDesktopPalette;
UBKeyboardPalette *mKeyboardPalette;
UBDesktopToolsPalette *mDesktopToolsPalette;
UBDesktopPenPalette* mDesktopPenPalette;
UBDesktopMarkerPalette* mDesktopMarkerPalette;
UBDesktopEraserPalette* mDesktopEraserPalette;

@ -136,8 +136,11 @@ void UBDesktopPalette::minimizeMe(eMinimizedLocation location)
actions << mMaximizeAction;
setActions(actions);
QSize newSize = preferredSize();
this->resize(newSize);
adjustSizeAndPosition();
#ifdef Q_WS_X11
emit refreshMask();
#endif
}
// Called when the user wants to maximize the palette
@ -159,15 +162,15 @@ void UBDesktopPalette::maximizeMe()
actions << mDisplaySelectAction;
actions << mShowHideAction;
//actions << UBApplication::mainWindow->actionDesktopTools;
setActions(actions);
QSize newSize = preferredSize();
this->resize(newSize);
adjustSizeAndPosition();
// Notify that the maximization has been done
emit maximized();
#ifdef Q_WS_X11
emit refreshMask();
#endif
}
void UBDesktopPalette::showEvent(QShowEvent *event)

@ -33,7 +33,10 @@ class UBDesktopPalette : public UBActionPalette
void customClick();
void windowClick();
void screenClick();
// void showVirtualKeyboard(bool);
#ifdef Q_WS_X11
void refreshMask();
#endif
public slots:

@ -1,85 +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 3 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 "UBDesktopToolsPalette.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"
UBDesktopToolsPalette::UBDesktopToolsPalette(QWidget *parent)
: UBActionPalette(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(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged()));
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(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int))
, lineWidthChoice, SLOT(setCurrentIndex(int)));
layout()->addWidget(lineWidthChoice);
// 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)));
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 3 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 UBDESKTOPTOOLSPALETTE_H
#define UBDESKTOPTOOLSPALETTE_H
#include <QtGui>
#include "gui/UBActionPalette.h"
class UBDesktopToolsPalette : public UBActionPalette
{
public:
UBDesktopToolsPalette(QWidget *parent = 0);
virtual ~UBDesktopToolsPalette(){}
};
#endif // UBDESKTOPTOOLSPALETTE_H

@ -2,7 +2,6 @@ HEADERS += src/desktop/UBDesktopPalette.h \
src/desktop/UBDesktopAnnotationController.h \
src/desktop/UBCustomCaptureWindow.h \
src/desktop/UBWindowCapture.h \
src/desktop/UBDesktopToolsPalette.h \
src/desktop/UBDesktopPenPalette.h \
src/desktop/UBDesktopMarkerPalette.h \
src/desktop/UBDesktopEraserPalette.h
@ -10,7 +9,6 @@ HEADERS += src/desktop/UBDesktopPalette.h \
SOURCES += src/desktop/UBDesktopPalette.cpp \
src/desktop/UBDesktopAnnotationController.cpp \
src/desktop/UBCustomCaptureWindow.cpp \
src/desktop/UBDesktopToolsPalette.cpp \
src/desktop/UBDesktopPenPalette.cpp \
src/desktop/UBDesktopMarkerPalette.cpp \
src/desktop/UBDesktopEraserPalette.cpp

@ -36,6 +36,7 @@
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsCache.h"
#include "document/UBDocumentProxy.h"
@ -1626,6 +1627,25 @@ void UBGraphicsScene::addCompass(QPointF center)
setModified(true);
}
void UBGraphicsScene::addCache()
{
UBGraphicsCache* cache = new UBGraphicsCache();
mTools << cache;
QGraphicsView* view;
if(UBApplication::applicationController->displayManager()->hasDisplay())
{
view = (QGraphicsView*)(UBApplication::boardController->displayView());
}
else
{
view = (QGraphicsView*)(UBApplication::boardController->controlView());
}
addItem(cache);
cache->setVisible(true);
cache->setSelected(true);
UBApplication::boardController->notifyCache(true);
}
void UBGraphicsScene::addMask()
{

@ -46,6 +46,7 @@ class UBGraphicsCurtainItem;
class UBGraphicsStroke;
class UBMagnifierParams;
class UBMagnifier;
class UBGraphicsCache;
const double PI = 4.0 * atan(1.0);
@ -172,6 +173,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void addMagnifier(UBMagnifierParams params);
void addMask();
void addCache();
class SceneViewState
{
@ -247,6 +249,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
static qreal toolOffsetCompass;
static qreal toolOffsetCurtain;
static qreal toolOffsetTriangle;
static qreal toolOffsetCache;
QSet<QGraphicsItem*> tools(){ return mTools;}
@ -358,6 +361,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
//int mMesure1Ms, mMesure2Ms;
bool mHasCache;
UBMagnifier *magniferControlViewWidget;
UBMagnifier *magniferDisplayViewWidget;
};

@ -0,0 +1,317 @@
#include <QColor>
#include <QPainter>
#include <QPixmap>
#include <QColorDialog>
#include "UBCachePropertiesWidget.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h"
static QVector<UBGraphicsCache*> mCaches;
UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent)
, mpLayout(NULL)
, mpCachePropertiesLabel(NULL)
, mpColorLabel(NULL)
, mpShapeLabel(NULL)
, mpSizeLabel(NULL)
, mpColor(NULL)
, mpSquareButton(NULL)
, mpCircleButton(NULL)
, mpCloseButton(NULL)
, mpSizeSlider(NULL)
, mpColorLayout(NULL)
, mpShapeLayout(NULL)
, mpSizeLayout(NULL)
, mpCloseLayout(NULL)
, mpProperties(NULL)
, mpPropertiesLayout(NULL)
, mpCurrentCache(NULL)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
mName = "CachePropWidget";
mIconToLeft = QPixmap(":images/cache_open.png");
mIconToRight = QPixmap(":images/cache_close.png");
setContentsMargins(10, 10, 10, 10);
// Build the UI
mpLayout = new QVBoxLayout();
setLayout(mpLayout);
// Title
mpCachePropertiesLabel = new QLabel(tr("Cache Properties"), this);
mpCachePropertiesLabel->setObjectName("DockPaletteWidgetTitle");
mpLayout->addWidget(mpCachePropertiesLabel, 0);
// Properties Box
mpProperties = new QWidget(this);
mpProperties->setObjectName("DockPaletteWidgetBox");
mpLayout->addWidget(mpProperties, 1);
mpPropertiesLayout = new QVBoxLayout();
mpProperties->setLayout(mpPropertiesLayout);
// Color
mpColorLayout = new QHBoxLayout();
mpColorLabel = new QLabel(tr("Color:"), mpProperties);
mpColor = new QPushButton(mpProperties);
mpColor->setObjectName("DockPaletteWidgetButton");
// TODO: Check in the document if the page has a color and assign it to this cache
// else set the black color by default
updateCacheColor(Qt::black);
mpColorLayout->addWidget(mpColorLabel, 0);
mpColorLayout->addWidget(mpColor, 0);
mpColorLayout->addStretch(1);
mpPropertiesLayout->addLayout(mpColorLayout, 0);
// Shape
mpShapeLayout = new QHBoxLayout();
mpShapeLabel = new QLabel(tr("Shape:"), mpProperties);
mpSquareButton = new QPushButton(mpProperties);
mpSquareButton->setIcon(QIcon(":images/cache_square.png"));
mpSquareButton->setObjectName("DockPaletteWidgetButton");
mpSquareButton->setCheckable(true);
mpCircleButton = new QPushButton(mpProperties);
mpCircleButton->setIcon(QIcon(":images/cache_circle.png"));
mpCircleButton->setObjectName("DockPaletteWidgetButton");
mpCircleButton->setCheckable(true);
mpShapeLayout->addWidget(mpShapeLabel, 0);
mpShapeLayout->addWidget(mpSquareButton, 0);
mpShapeLayout->addWidget(mpCircleButton, 0);
mpShapeLayout->addStretch(1);
mpPropertiesLayout->addLayout(mpShapeLayout, 0);
// TODO: Check in the document which shape is saved and check the corresponding button
mpCircleButton->setChecked(true);
// Shape Size
mpSizeLayout = new QHBoxLayout();
mpSizeLabel = new QLabel(tr("Size:"), mpProperties);
mpSizeSlider = new QSlider(Qt::Horizontal, mpProperties);
mpSizeSlider->setMinimumHeight(20);
mpSizeSlider->setMinimum(0);
mpSizeSlider->setMaximum(MAX_SHAPE_WIDTH);
mpSizeLayout->addWidget(mpSizeLabel, 0);
mpSizeLayout->addWidget(mpSizeSlider, 1);
mpPropertiesLayout->addLayout(mpSizeLayout, 0);
// Close
mpCloseLayout = new QHBoxLayout();
mpCloseButton = new QPushButton(tr("Close"), mpProperties);
mpCloseButton->setObjectName("DockPaletteWidgetButton");
mpCloseLayout->addWidget(mpCloseButton, 0);
mpCloseLayout->addStretch(1);
mpPropertiesLayout->addLayout(mpCloseLayout, 0);
// Fill the empty space
mpPropertiesLayout->addStretch(1);
// Connect signals / slots
connect(mpCloseButton, SIGNAL(clicked()), this, SLOT(onCloseClicked()));
connect(mpColor, SIGNAL(clicked()), this, SLOT(onColorClicked()));
connect(mpCircleButton, SIGNAL(clicked()), this, SLOT(updateShapeButtons()));
connect(mpSquareButton, SIGNAL(clicked()), this, SLOT(updateShapeButtons()));
connect(mpSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(onSizeChanged(int)));
connect(UBApplication::boardController, SIGNAL(pageChanged()), this, SLOT(updateCurrentCache()));
}
UBCachePropertiesWidget::~UBCachePropertiesWidget()
{
if(NULL != mpCachePropertiesLabel)
{
delete mpCachePropertiesLabel;
mpCachePropertiesLabel = NULL;
}
if(NULL != mpColorLabel)
{
delete mpColorLabel;
mpColorLabel = NULL;
}
if(NULL != mpShapeLabel)
{
delete mpShapeLabel;
mpShapeLabel = NULL;
}
if(NULL != mpSizeLabel)
{
delete mpSizeLabel;
mpSizeLabel = NULL;
}
if(NULL != mpColor)
{
delete mpColor;
mpColor = NULL;
}
if(NULL != mpSquareButton)
{
delete mpSquareButton;
mpSquareButton = NULL;
}
if(NULL != mpCircleButton)
{
delete mpCircleButton;
mpCircleButton = NULL;
}
if(NULL != mpCloseButton)
{
delete mpCloseButton;
mpCloseButton = NULL;
}
if(NULL != mpSizeSlider)
{
delete mpSizeSlider;
mpSizeSlider = NULL;
}
if(NULL != mpColorLayout)
{
delete mpColorLayout;
mpColorLayout = NULL;
}
if(NULL != mpShapeLayout)
{
delete mpShapeLayout;
mpShapeLayout = NULL;
}
if(NULL != mpSizeLayout)
{
delete mpSizeLayout;
mpSizeLayout = NULL;
}
if(NULL != mpCloseLayout)
{
delete mpCloseLayout;
mpCloseLayout = NULL;
}
if(NULL != mpPropertiesLayout)
{
delete mpPropertiesLayout;
mpPropertiesLayout = NULL;
}
if(NULL != mpProperties)
{
delete mpProperties;
mpProperties = NULL;
}
if(NULL != mpLayout)
{
delete mpLayout;
mpLayout = NULL;
}
}
void UBCachePropertiesWidget::onCloseClicked()
{
// Remove the current cache from the list
mCaches.remove(mCaches.indexOf(mpCurrentCache));
// Remove the cache from the board
UBApplication::boardController->activeScene()->removeItem(mpCurrentCache);
mpCurrentCache = NULL;
if(mCaches.empty())
{
emit cacheListEmpty();
}
}
void UBCachePropertiesWidget::updateCacheColor(QColor color)
{
mActualColor = color;
// Update the color on the color button
QPixmap pix(32, 32);
QPainter p;
p.begin(&pix);
p.setBackground(Qt::transparent);
p.setBrush(color); // The current color
p.drawRect(0, 0, 32, 32);
p.end();
mpColor->setIcon(QIcon(pix));
if(NULL != mpCurrentCache)
{
mpCurrentCache->setMaskColor(mActualColor);
}
}
void UBCachePropertiesWidget::onColorClicked()
{
// Show the color picker
QColor newColor = QColorDialog::getColor(mActualColor,this);
updateCacheColor(newColor);
}
void UBCachePropertiesWidget::updateShapeButtons()
{
if(mpCircleButton->hasFocus())
{
mActualShape = eMaskShape_Circle;
mpSquareButton->setChecked(false);
}
else if(mpSquareButton->hasFocus())
{
mActualShape = eMaskShap_Rectangle;
mpCircleButton->setChecked(false);
}
if(NULL != mpCurrentCache)
{
mpCurrentCache->setMaskShape(mActualShape);
}
}
void UBCachePropertiesWidget::updateCurrentCache()
{
// Get the current page cache
QList<QGraphicsItem*> items = UBApplication::boardController->activeScene()->items();
foreach(QGraphicsItem* it, items)
{
if("Cache" == it->data(Qt::UserRole).toString())
{
setEnabled(true);
mpCurrentCache = dynamic_cast<UBGraphicsCache*>(it);
if((NULL != mpCurrentCache) && (!mCaches.contains(mpCurrentCache)))
{
mCaches.append(mpCurrentCache);
}
// Update the values of the cache properties
mpSizeSlider->setValue(mpCurrentCache->shapeWidth());
updateCacheColor(mpCurrentCache->maskColor());
switch(mpCurrentCache->maskshape())
{
case eMaskShape_Circle:
mpCircleButton->setChecked(true);
mpSquareButton->setChecked(false);
break;
case eMaskShap_Rectangle:
mpCircleButton->setChecked(false);
mpSquareButton->setChecked(true);
break;
}
return;
}
}
// If we fall here, that means that this page has no cache
mpCurrentCache = NULL;
setDisabled(true);
}
void UBCachePropertiesWidget::onSizeChanged(int newSize)
{
if(NULL != mpCurrentCache)
{
mpCurrentCache->setShapeWidth(newSize);
}
}

@ -0,0 +1,60 @@
#ifndef UBCACHEPROPERTIESWIDGET_H
#define UBCACHEPROPERTIESWIDGET_H
#include <QWidget>
#include <QVBoxLayout>
#include <QLabel>
#include <QHBoxLayout>
#include <QPushButton>
#include <QSlider>
#include <QVector>
#include "UBDockPaletteWidget.h"
#include "tools/UBGraphicsCache.h"
#define MAX_SHAPE_WIDTH 200
class UBCachePropertiesWidget : public UBDockPaletteWidget
{
Q_OBJECT
public:
UBCachePropertiesWidget(QWidget* parent=0, const char* name="UBCachePropertiesWidget");
~UBCachePropertiesWidget();
public slots:
void updateCurrentCache();
signals:
void cacheListEmpty();
private slots:
void onCloseClicked();
void updateCacheColor(QColor color);
void onColorClicked();
void updateShapeButtons();
void onSizeChanged(int newSize);
private:
QVBoxLayout* mpLayout;
QLabel* mpCachePropertiesLabel;
QLabel* mpColorLabel;
QLabel* mpShapeLabel;
QLabel* mpSizeLabel;
QPushButton* mpColor;
QPushButton* mpSquareButton;
QPushButton* mpCircleButton;
QPushButton* mpCloseButton;
QSlider* mpSizeSlider;
QHBoxLayout* mpColorLayout;
QHBoxLayout* mpShapeLayout;
QHBoxLayout* mpSizeLayout;
QHBoxLayout* mpCloseLayout;
QWidget* mpProperties;
QVBoxLayout* mpPropertiesLayout;
QColor mActualColor;
eMaskShape mActualShape;
UBGraphicsCache* mpCurrentCache;
};
#endif // UBCACHEPROPERTIESWIDGET_H

@ -1,84 +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 3 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 <QtGui>
#include "UBClockPalette.h"
#include "core/memcheck.h"
UBClockPalette::UBClockPalette(QWidget *parent)
: UBFloatingPalette(Qt::TopRightCorner, parent)
, mTimeLabel(0)
{
setLayout(new QHBoxLayout());
mTimeLabel = new QLabel(parent);
mTimeLabel->setStyleSheet(QString("QLabel {color: white; background-color: transparent; font-family: Arial; font-weight: bold; font-size: 20px}"));
layout()->setContentsMargins(radius() + 15, 4, radius() + 15, 4);
layout()->addWidget(mTimeLabel);
mTimeFormat = QLocale::system().timeFormat(QLocale::ShortFormat);
//strip seconds
mTimeFormat = mTimeFormat.remove(":ss");
mTimeFormat = mTimeFormat.remove(":s");
}
UBClockPalette::~UBClockPalette()
{
// NOOP
}
int UBClockPalette::radius()
{
return 10;
}
void UBClockPalette::updateTime()
{
if (mTimeLabel)
{
mTimeLabel->setText(QLocale::system().toString (QTime::currentTime(), mTimeFormat));
}
adjustSizeAndPosition();
}
void UBClockPalette::timerEvent(QTimerEvent *event)
{
Q_UNUSED(event);
updateTime();
}
void UBClockPalette::showEvent ( QShowEvent * event )
{
Q_UNUSED(event);
updateTime();
mTimerID = startTimer(1000);
}
void UBClockPalette::hideEvent ( QShowEvent * event )
{
Q_UNUSED(event);
killTimer(mTimerID);
}

@ -515,9 +515,12 @@ int UBDockPalette::customMargin()
void UBDockPalette::addTabWidget(UBDockPaletteWidget *widget)
{
mTabWidgets.append(widget);
mpStackWidget->addWidget(widget);
update();
if(!mTabWidgets.contains(widget))
{
mTabWidgets.append(widget);
mpStackWidget->addWidget(widget);
update();
}
}
void UBDockPalette::removeTab(const QString &widgetName)

@ -61,6 +61,7 @@ public:
eUBDockOrientation orientation();
void setOrientation(eUBDockOrientation orientation);
void setTabsOrientation(eUBDockTabOrientation orientation);
void showTabWidget(int tabIndex);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
@ -127,7 +128,7 @@ private slots:
private:
void tabClicked(int tabIndex);
int tabSpacing();
void showTabWidget(int tabIndex);
void toggleCollapseExpand();
};

@ -127,6 +127,9 @@ void UBPageNavigationWidget::changeCurrentPage()
{
// Display the selected page
UBApplication::boardController->setActiveDocumentScene(mNavigator->currentDoc(), iPage);
// emit here the signal to indicate that page change
UBApplication::boardController->notifyPageChanged();
}
}

@ -1,60 +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 3 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 <QtGui>
#include "UBPageNumberPalette.h"
#include "core/memcheck.h"
UBPageNumberPalette::UBPageNumberPalette(QWidget *parent)
: UBFloatingPalette(Qt::BottomRightCorner, parent)
{
mLayout = new QHBoxLayout(this);
mButton = new QPushButton(parent);
mButton->setStyleSheet(QString("QPushButton { color: white; background-color: transparent; border: none; font-family: Arial; font-weight: bold; font-size: 20px }"));
mButton->setFocusPolicy(Qt::NoFocus);
connect(mButton, SIGNAL(clicked(bool)), this, SLOT(buttonClicked(bool)));
mLayout->setContentsMargins(radius() + 15, 4, radius() + 15, 4);
mLayout->addWidget(mButton);
setPageNumber(0, 0);
}
UBPageNumberPalette::~UBPageNumberPalette()
{
delete mButton;
delete mLayout;
}
void UBPageNumberPalette::buttonClicked(bool checked)
{
Q_UNUSED(checked);
emit clicked();
}
int UBPageNumberPalette::radius()
{
return 10;
}
void UBPageNumberPalette::setPageNumber(int current, int total)
{
mButton->setText(QString("%1 / %2").arg(current).arg(total));
adjustSizeAndPosition();
}

@ -1,51 +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 3 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 UBPAGENUMBERPALLETTE_H_
#define UBPAGENUMBERPALLETTE_H_
class QHBoxLayout;
class QPushButton;
#include "UBFloatingPalette.h"
class UBPageNumberPalette : public UBFloatingPalette
{
Q_OBJECT;
public:
UBPageNumberPalette(QWidget *parent = 0);
virtual ~UBPageNumberPalette();
protected:
int radius();
private:
QHBoxLayout *mLayout;
QPushButton *mButton;
private slots:
void buttonClicked(bool checked);
public slots:
void setPageNumber(int current, int total);
signals:
void clicked();
};
#endif /* UBPAGENUMBERPALLETTE_H_ */

@ -12,8 +12,12 @@
* 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 "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "UBRightPalette.h"
UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(parent)
, mpLibWidget(NULL)
{
@ -25,8 +29,16 @@ UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(
resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height());
mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin());
// Add the tab widgets
mpLibWidget = new UBLibWidget(this);
addTabWidget(mpLibWidget);
mpCachePropWidget = new UBCachePropertiesWidget(this);
mpCachePropWidget->hide();
// Connect signals/slots
connect(UBApplication::boardController, SIGNAL(cacheEnabled()), this, SLOT(onCacheEnabled()));
connect(mpCachePropWidget, SIGNAL(cacheListEmpty()), this, SLOT(onCacheDisabled()));
}
UBRightPalette::~UBRightPalette()
@ -36,6 +48,11 @@ UBRightPalette::~UBRightPalette()
delete mpLibWidget;
mpLibWidget = NULL;
}
if(NULL != mpCachePropWidget)
{
delete mpCachePropWidget;
mpCachePropWidget = NULL;
}
}
UBLibWidget* UBRightPalette::libWidget()
@ -62,12 +79,39 @@ void UBRightPalette::resizeEvent(QResizeEvent *event)
emit resized();
}
/**
* \brief Update the maximum width
*/
void UBRightPalette::updateMaxWidth()
{
setMaximumWidth((int)((parentWidget()->width() * 2)/3));
setMaximumHeight(parentWidget()->height());
setMinimumHeight(parentWidget()->height());
}
void UBRightPalette::onCacheEnabled()
{
if(mpCachePropWidget->isHidden())
{
mpCachePropWidget->setVisible(true);
// Add the cache tab
addTabWidget(mpCachePropWidget);
}
// Set the cache of the current page as the active one for the properties widget
mpCachePropWidget->updateCurrentCache();
// Show the cache properties widget
for(int i = 0; i < mTabWidgets.size(); i++)
{
if((NULL != mTabWidgets.at(i)) && ("CachePropWidget" == mTabWidgets.at(i)->name()))
{
showTabWidget(i);
break;
}
}
}
void UBRightPalette::onCacheDisabled()
{
removeTab(mpCachePropWidget->name());
mpCachePropWidget->hide();
}

@ -17,6 +17,7 @@
#include "UBDockPalette.h"
#include "UBLibWidget.h"
#include "UBCachePropertiesWidget.h"
class UBRightPalette : public UBDockPalette
{
@ -35,8 +36,13 @@ protected:
void mouseMoveEvent(QMouseEvent *event);
void resizeEvent(QResizeEvent *event);
private slots:
void onCacheEnabled();
void onCacheDisabled();
private:
UBLibWidget* mpLibWidget;
UBCachePropertiesWidget* mpCachePropWidget;
};
#endif // UBRIGHTPALETTE_H

@ -4,8 +4,6 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBToolbarButtonGroup.h \
src/gui/UBStylusPalette.h \
src/gui/UBIconButton.h \
src/gui/UBClockPalette.h \
src/gui/UBPageNumberPalette.h \
src/gui/UBThumbnailWidget.h \
src/gui/UBCircleFrame.h \
src/gui/UBColorPicker.h \
@ -43,15 +41,14 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBRightPalette.h \
src/gui/UBPageNavigationWidget.h \
src/gui/UBLibWidget.h \
src/gui/UBMagnifer.h
src/gui/UBMagnifer.h \
src/gui/UBCachePropertiesWidget.h
SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \
src/gui/UBToolbarButtonGroup.cpp \
src/gui/UBStylusPalette.cpp \
src/gui/UBIconButton.cpp \
src/gui/UBClockPalette.cpp \
src/gui/UBPageNumberPalette.cpp \
src/gui/UBThumbnailWidget.cpp \
src/gui/UBCircleFrame.cpp \
src/gui/UBColorPicker.cpp \
@ -89,7 +86,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBRightPalette.cpp \
src/gui/UBPageNavigationWidget.cpp \
src/gui/UBLibWidget.cpp \
src/gui/UBMagnifer.cpp
src/gui/UBMagnifer.cpp \
src/gui/UBCachePropertiesWidget.cpp
win32 {

@ -33,6 +33,7 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
QRect boardRect = UBApplication::boardController->displayView()->rect();
setRect(-15*boardRect.width(), -15*boardRect.height(), 30*boardRect.width(), 30*boardRect.height());
setZValue(CACHE_ZVALUE);
setData(Qt::UserRole, QVariant("Cache"));
}
UBGraphicsCache::~UBGraphicsCache()
@ -62,6 +63,7 @@ QColor UBGraphicsCache::maskColor()
void UBGraphicsCache::setMaskColor(QColor color)
{
mMaskColor = color;
update();
}
eMaskShape UBGraphicsCache::maskshape()
@ -72,6 +74,7 @@ eMaskShape UBGraphicsCache::maskshape()
void UBGraphicsCache::setMaskShape(eMaskShape shape)
{
mMaskShape = shape;
update();
}
void UBGraphicsCache::init()
@ -102,7 +105,7 @@ void UBGraphicsCache::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
}
else if(eMaskShap_Rectangle == mMaskShape)
{
path.addRect(mShapePos.x(), mShapePos.y(), mShapeWidth, mShapeWidth);
path.addRect(mShapePos.x() - mShapeWidth / 2, mShapePos.y() - mShapeWidth / 2, mShapeWidth, mShapeWidth);
}
path.setFillRule(Qt::OddEvenFill);
}
@ -139,4 +142,5 @@ int UBGraphicsCache::shapeWidth()
void UBGraphicsCache::setShapeWidth(int width)
{
mShapeWidth = width;
update();
}

@ -65,6 +65,17 @@ UBToolsManager::UBToolsManager(QObject *parent)
mToolsIcon.insert(magnifier.id,":/images/toolPalette/magnifierTool.png");
mDescriptors << magnifier;
// --------------------------------------------------------------------------------
// DO NOT ERASE THIS COMMENTED CODE! IT WILL BE UNCOMMENTED DURING THE NEXT DAYS!!!
// --------------------------------------------------------------------------------
cache.id = "uniboardTool://uniboard.mnemis.com/cache";
cache.icon = QPixmap(":/images/toolPalette/cacheTool.png");
cache.label = tr("Cache");
cache.version = "1.0";
mToolsIcon.insert(cache.id, ":/images/toolPalette/cacheTool.png");
mDescriptors << cache;
// --------------------------------------------------------------------------------
}
UBToolsManager::~UBToolsManager()

@ -79,6 +79,7 @@ class UBToolsManager : public QObject
UBToolDescriptor mask;
UBToolDescriptor triangle;
UBToolDescriptor magnifier;
UBToolDescriptor cache;
QString iconFromToolId(QString id) { return mToolsIcon.value(id);}

Loading…
Cancel
Save