preferencesAboutTextFull
shibakaneki 13 years ago
parent f6c3ee89b7
commit cd9820ab8b
  1. 7
      resources/sankore.qrc
  2. 52
      src/adaptors/UBSvgSubsetAdaptor.cpp
  3. 6
      src/adaptors/UBSvgSubsetAdaptor.h
  4. 9
      src/board/UBBoardController.cpp
  5. 22
      src/domain/UBGraphicsScene.cpp
  6. 9
      src/domain/UBGraphicsScene.h
  7. 79
      src/gui/UBDockPalette.cpp
  8. 14
      src/gui/UBDockPalette.h
  9. 36
      src/gui/UBDockPaletteWidget.cpp
  10. 27
      src/gui/UBDockPaletteWidget.h
  11. 2
      src/gui/UBLibPalette.cpp
  12. 2
      src/gui/UBNavigatorPalette.cpp
  13. 6
      src/gui/gui.pri
  14. 142
      src/tools/UBGraphicsCache.cpp
  15. 61
      src/tools/UBGraphicsCache.h
  16. 8
      src/tools/UBToolsManager.cpp
  17. 3
      src/tools/UBToolsManager.h
  18. 38
      src/tools/tools.pri

@ -176,7 +176,7 @@
<file>images/cursors/rotate.png</file> <file>images/cursors/rotate.png</file>
<file>images/cursors/resize.png</file> <file>images/cursors/resize.png</file>
<file>images/cursors/drawCompass.png</file> <file>images/cursors/drawCompass.png</file>
<file>images/cursors/drawRulerLine.png</file> <file>images/cursors/drawRulerLine.png</file>
<file>images/print/onepage.png</file> <file>images/print/onepage.png</file>
<file>images/print/thumbnails.png</file> <file>images/print/thumbnails.png</file>
<file>images/print/twopages.png</file> <file>images/print/twopages.png</file>
@ -289,8 +289,6 @@
<file>images/toolbar/hide.png</file> <file>images/toolbar/hide.png</file>
<file>images/toolbar/record.png</file> <file>images/toolbar/record.png</file>
<file>images/libpalette/MoviesCategory.svg</file> <file>images/libpalette/MoviesCategory.svg</file>
<file>images/virtual.keyboard/41/centre-passive.png</file> <file>images/virtual.keyboard/41/centre-passive.png</file>
<file>images/virtual.keyboard/41/left-passive.png</file> <file>images/virtual.keyboard/41/left-passive.png</file>
<file>images/virtual.keyboard/41/right-passive.png</file> <file>images/virtual.keyboard/41/right-passive.png</file>
@ -300,7 +298,6 @@
<file>images/virtual.keyboard/41/backspace.png</file> <file>images/virtual.keyboard/41/backspace.png</file>
<file>images/virtual.keyboard/41/capslock.png</file> <file>images/virtual.keyboard/41/capslock.png</file>
<file>images/virtual.keyboard/41/tab.png</file> <file>images/virtual.keyboard/41/tab.png</file>
<file>images/virtual.keyboard/29/centre-passive.png</file> <file>images/virtual.keyboard/29/centre-passive.png</file>
<file>images/virtual.keyboard/29/left-passive.png</file> <file>images/virtual.keyboard/29/left-passive.png</file>
<file>images/virtual.keyboard/29/right-passive.png</file> <file>images/virtual.keyboard/29/right-passive.png</file>
@ -310,6 +307,6 @@
<file>images/virtual.keyboard/29/backspace.png</file> <file>images/virtual.keyboard/29/backspace.png</file>
<file>images/virtual.keyboard/29/capslock.png</file> <file>images/virtual.keyboard/29/capslock.png</file>
<file>images/virtual.keyboard/29/tab.png</file> <file>images/virtual.keyboard/29/tab.png</file>
<file>images/toolPalette/cacheTool.png</file>
</qresource> </qresource>
</RCC> </RCC>

@ -35,6 +35,7 @@
#include "tools/UBGraphicsProtractor.h" #include "tools/UBGraphicsProtractor.h"
#include "tools/UBGraphicsCurtainItem.h" #include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsTriangle.h" #include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsCache.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
@ -654,7 +655,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
scene->registerTool(protractor); scene->registerTool(protractor);
} }
} }
else if (mXmlReader.name() == "protractor") else if (mXmlReader.name() == "triangle")
{ {
UBGraphicsTriangle *triangle = triangleFromSvg(); UBGraphicsTriangle *triangle = triangleFromSvg();
@ -664,6 +665,15 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
scene->registerTool(triangle); scene->registerTool(triangle);
} }
} }
else if(mXmlReader.name() == "cache")
{
UBGraphicsCache* cache = cacheFromSvg();
if(cache)
{
scene->addItem(cache);
scene->registerTool(cache);
}
}
else if (mXmlReader.name() == "foreignObject") else if (mXmlReader.name() == "foreignObject")
{ {
QString href = mXmlReader.attributes().value(nsXLink, "href").toString(); QString href = mXmlReader.attributes().value(nsXLink, "href").toString();
@ -1045,6 +1055,13 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene()
continue; continue;
} }
UBGraphicsCache* cache = qgraphicsitem_cast<UBGraphicsCache*>(item);
if(cache && cache->isVisible())
{
cacheToSvg(cache);
continue;
}
UBGraphicsCompass *compass = qgraphicsitem_cast<UBGraphicsCompass*> (item); UBGraphicsCompass *compass = qgraphicsitem_cast<UBGraphicsCompass*> (item);
if (compass && compass->isVisible()) if (compass && compass->isVisible())
@ -1060,6 +1077,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene()
protractorToSvg(protractor); protractorToSvg(protractor);
continue; continue;
} }
} }
if (openStroke) if (openStroke)
@ -2615,6 +2633,38 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
return triangle; return triangle;
} }
UBGraphicsCache* UBSvgSubsetAdaptor::UBSvgSubsetReader::cacheFromSvg()
{
UBGraphicsCache* pCache = new UBGraphicsCache();
pCache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
pCache->setVisible(true);
return pCache;
}
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::cacheToSvg(UBGraphicsCache* item)
{
mXmlWriter.writeStartElement(UBSettings::uniboardDocumentNamespaceUri, "cache");
mXmlWriter.writeAttribute("x", QString("%1").arg(item->rect().x()));
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()));
QString zs;
zs.setNum(item->zValue(), 'f'); // 'f' keeps precision
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "z-value", zs);
UBItem* ubItem = dynamic_cast<UBItem*>(item);
if (ubItem)
{
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(ubItem->uuid()));
}
mXmlWriter.writeEndElement();
}
void UBSvgSubsetAdaptor::convertPDFObjectsToImages(UBDocumentProxy* proxy) void UBSvgSubsetAdaptor::convertPDFObjectsToImages(UBDocumentProxy* proxy)
{ {
for (int i = 0; i < proxy->pageCount(); i++) for (int i = 0; i < proxy->pageCount(); i++)

@ -40,6 +40,7 @@ class UBDocumentProxy;
class UBGraphicsStroke; class UBGraphicsStroke;
class UBPersistenceManager; class UBPersistenceManager;
class UBGraphicsTriangle; class UBGraphicsTriangle;
class UBGraphicsCache;
class UBSvgSubsetAdaptor class UBSvgSubsetAdaptor
{ {
@ -127,7 +128,9 @@ class UBSvgSubsetAdaptor
UBGraphicsProtractor* protractorFromSvg(); UBGraphicsProtractor* protractorFromSvg();
UBGraphicsTriangle* triangleFromSvg(); UBGraphicsTriangle* triangleFromSvg();
UBGraphicsCache* cacheFromSvg();
void graphicsItemFromSvg(QGraphicsItem* gItem); void graphicsItemFromSvg(QGraphicsItem* gItem);
@ -210,6 +213,7 @@ class UBSvgSubsetAdaptor
void rulerToSvg(UBGraphicsRuler *item); void rulerToSvg(UBGraphicsRuler *item);
void compassToSvg(UBGraphicsCompass *item); void compassToSvg(UBGraphicsCompass *item);
void protractorToSvg(UBGraphicsProtractor *item); void protractorToSvg(UBGraphicsProtractor *item);
void cacheToSvg(UBGraphicsCache* item);
void writeSvgElement(); void writeSvgElement();
private: private:

@ -1009,11 +1009,16 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
mActiveScene->addProtractor(pPos); mActiveScene->addProtractor(pPos);
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector);
} }
else if (sourceUrl.toString() == UBToolsManager::manager()->triangle.id) else if (sourceUrl.toString() == UBToolsManager::manager()->triangle.id)
{ {
mActiveScene->addTriangle(pPos); mActiveScene->addTriangle(pPos);
UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); 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()->mask.id) else if (sourceUrl.toString() == UBToolsManager::manager()->mask.id)
{ {
mActiveScene->addMask(); mActiveScene->addMask();
@ -1557,7 +1562,7 @@ void UBBoardController::stylusToolChanged(int tool)
if(eTool != UBStylusTool::Selector && eTool != UBStylusTool::Text) if(eTool != UBStylusTool::Selector && eTool != UBStylusTool::Text)
{ {
if(mPaletteManager->mKeyboardPalette->m_isVisible) if(mPaletteManager->mKeyboardPalette->m_isVisible)
UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger); UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger);
} }
} }

@ -34,6 +34,7 @@
#include "tools/UBGraphicsCompass.h" #include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsTriangle.h" #include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsCurtainItem.h" #include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsCache.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
@ -68,6 +69,7 @@ qreal UBGraphicsScene::toolOffsetProtractor = 100;
qreal UBGraphicsScene::toolOffsetTriangle = 100; qreal UBGraphicsScene::toolOffsetTriangle = 100;
qreal UBGraphicsScene::toolOffsetCompass = 100; qreal UBGraphicsScene::toolOffsetCompass = 100;
qreal UBGraphicsScene::toolOffsetEraser = 200; qreal UBGraphicsScene::toolOffsetEraser = 200;
qreal UBGraphicsScene::toolOffsetCache = 1000;
qreal UBGraphicsScene::toolOffsetCurtain = 1000; qreal UBGraphicsScene::toolOffsetCurtain = 1000;
qreal UBGraphicsScene::toolOffsetPointer = 1100; qreal UBGraphicsScene::toolOffsetPointer = 1100;
@ -132,7 +134,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
} }
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing()));
mHasCache = false;
} }
@ -1484,6 +1486,24 @@ void UBGraphicsScene::addCompass(QPointF center)
setModified(true); 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);
}
void UBGraphicsScene::addMask() void UBGraphicsScene::addMask()
{ {

@ -44,6 +44,7 @@ class UBAbstractWidget;
class UBDocumentProxy; class UBDocumentProxy;
class UBGraphicsCurtainItem; class UBGraphicsCurtainItem;
class UBGraphicsStroke; class UBGraphicsStroke;
class UBGraphicsCache;
const double PI = 4.0 * atan(1.0); const double PI = 4.0 * atan(1.0);
@ -164,9 +165,10 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
qreal getNextObjectZIndex(); qreal getNextObjectZIndex();
void addRuler(QPointF center); void addRuler(QPointF center);
void addTriangle(QPointF center); void addTriangle(QPointF center);
void addProtractor(QPointF center); void addProtractor(QPointF center);
void addCompass(QPointF center); void addCompass(QPointF center);
void addCache();
void addMask(); void addMask();
@ -243,7 +245,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
static qreal toolOffsetProtractor; static qreal toolOffsetProtractor;
static qreal toolOffsetCompass; static qreal toolOffsetCompass;
static qreal toolOffsetCurtain; static qreal toolOffsetCurtain;
static qreal toolOffsetTriangle; static qreal toolOffsetTriangle;
static qreal toolOffsetCache;
QSet<QGraphicsItem*> tools(){ return mTools;} QSet<QGraphicsItem*> tools(){ return mTools;}
@ -347,6 +350,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
QList<QGraphicsItem*> mFastAccessItems; // a local copy as QGraphicsScene::items() is very slow in Qt 4.6 QList<QGraphicsItem*> mFastAccessItems; // a local copy as QGraphicsScene::items() is very slow in Qt 4.6
//int mMesure1Ms, mMesure2Ms; //int mMesure1Ms, mMesure2Ms;
bool mHasCache;
}; };
#endif /* UBGRAPHICSSCENE_H_ */ #endif /* UBGRAPHICSSCENE_H_ */

@ -53,9 +53,13 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
, mCollapseWidth(150) , mCollapseWidth(150)
, mLastWidth(-1) , mLastWidth(-1)
, mHTab(0) , mHTab(0)
, mpStackWidget(NULL)
{ {
setObjectName(name); setObjectName(name);
// clear the tab widgets
mTabWidgets.clear();
// We let 2 pixels in order to keep a small border for the resizing // We let 2 pixels in order to keep a small border for the resizing
setMinimumWidth(2*border() + 2); setMinimumWidth(2*border() + 2);
@ -91,7 +95,11 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
*/ */
UBDockPalette::~UBDockPalette() UBDockPalette::~UBDockPalette()
{ {
if(NULL != mpStackWidget)
{
delete mpStackWidget;
mpStackWidget = NULL;
}
} }
/** /**
@ -314,36 +322,39 @@ void UBDockPalette::paintEvent(QPaintEvent *event)
painter.setPen(Qt::NoPen); painter.setPen(Qt::NoPen);
painter.setBrush(mBackgroundBrush); painter.setBrush(mBackgroundBrush);
if(eUBDockTabOrientation_Up == mTabsOrientation) for(int i = 0; i < mTabWidgets.size(); i++)
{ {
mHTab = border(); if(eUBDockTabOrientation_Up == mTabsOrientation)
} {
else mHTab = border();
{ }
mHTab = height() - border() - TABSIZE; else
} {
mHTab = height() - border() - i*TABSIZE;
}
if(mOrientation == eUBDockOrientation_Left) if(mOrientation == eUBDockOrientation_Left)
{ {
QPainterPath path; QPainterPath path;
path.setFillRule(Qt::WindingFill); path.setFillRule(Qt::WindingFill);
path.addRect(0.0, 0.0, width()-2*border(), height()); path.addRect(0.0, 0.0, width()-2*border(), height());
path.addRoundedRect(width()-4*border(), mHTab, 4*border(), TABSIZE, radius(), radius()); path.addRoundedRect(width()-4*border(), mHTab, 4*border(), TABSIZE, radius(), radius());
painter.drawPath(path); painter.drawPath(path);
painter.drawPixmap(width() - border() + 1, mHTab + 1 , border() - 4, TABSIZE - 2, mIcon); //painter.drawPixmap(width() - border() + 1, mHTab + 1 , border() - 4, TABSIZE - 2, mIcon);
} }
else if(mOrientation == eUBDockOrientation_Right) else if(mOrientation == eUBDockOrientation_Right)
{ {
QPainterPath path; QPainterPath path;
path.setFillRule(Qt::WindingFill); path.setFillRule(Qt::WindingFill);
path.addRect(2*border(), 0.0, width()-2*border(), height()); path.addRect(2*border(), 0.0, width()-2*border(), height());
path.addRoundedRect(0.0, mHTab, 4*border(), TABSIZE, radius(), radius()); path.addRoundedRect(0.0, mHTab, 4*border(), TABSIZE, radius(), radius());
painter.drawPath(path); painter.drawPath(path);
painter.drawPixmap(2, mHTab + 1, border() - 3, TABSIZE - 2, mIcon); //painter.drawPixmap(2, mHTab + 1, border() - 3, TABSIZE - 2, mIcon);
} }
else else
{ {
painter.drawRoundedRect(border(), border(), width() - 2 * border(), height() - 2 * border(), radius(), radius()); painter.drawRoundedRect(border(), border(), width() - 2 * border(), height() - 2 * border(), radius(), radius());
}
} }
} }
@ -437,3 +448,13 @@ int UBDockPalette::customMargin()
{ {
return 5; return 5;
} }
void UBDockPalette::addTabWidget(const QString &widgetName, UBDockPaletteWidget *widget)
{
mTabWidgets[widgetName] = widget;
}
void UBDockPalette::removeTab(const QString &widgetName)
{
mTabWidgets.remove(widgetName);
}

@ -24,6 +24,10 @@
#include <QTime> #include <QTime>
#include <QPoint> #include <QPoint>
#include <QPixmap> #include <QPixmap>
#include <QMap>
#include <QStackedWidget>
#include "UBDockPaletteWidget.h"
#define TABSIZE 50 #define TABSIZE 50
#define CLICKTIME 1000000 #define CLICKTIME 1000000
@ -64,6 +68,8 @@ public:
virtual void leaveEvent(QEvent *); virtual void leaveEvent(QEvent *);
void setBackgroundBrush(const QBrush& brush); void setBackgroundBrush(const QBrush& brush);
void addTabWidget(const QString& widgetName, UBDockPaletteWidget* widget);
void removeTab(const QString& widgetName);
protected: protected:
virtual int border(); virtual int border();
@ -93,12 +99,16 @@ protected:
QTime mClickTime; QTime mClickTime;
/** The mouse pressed position */ /** The mouse pressed position */
QPoint mMousePressPos; QPoint mMousePressPos;
/** The palette icon */ ///** The palette icon */
QPixmap mIcon; //QPixmap mIcon;
/** The tab orientation */ /** The tab orientation */
eUBDockTabOrientation mTabsOrientation; eUBDockTabOrientation mTabsOrientation;
/** The h position of the tab */ /** The h position of the tab */
int mHTab; int mHTab;
/** The tab widgets */
QMap<QString, UBDockPaletteWidget*> mTabWidgets;
/** The stacked widget */
QStackedWidget* mpStackWidget;
private slots: private slots:
void onToolbarPosUpdated(); void onToolbarPosUpdated();

@ -0,0 +1,36 @@
#include "UBDockPaletteWidget.h"
UBDockPaletteWidget::UBDockPaletteWidget(const char *name, QWidget *parent):QWidget(parent)
, mpWidget(NULL)
{
setObjectName(name);
}
UBDockPaletteWidget::~UBDockPaletteWidget()
{
if(NULL != mpWidget)
{
delete mpWidget;
mpWidget = NULL;
}
}
QWidget* UBDockPaletteWidget::widget()
{
return mpWidget;
}
QIcon UBDockPaletteWidget::icon()
{
return mIcon;
}
QIcon UBDockPaletteWidget::collapsedIcon()
{
return mCollapsedIcon;
}
QString UBDockPaletteWidget::name()
{
return mName;
}

@ -0,0 +1,27 @@
#ifndef UBDOCKPALETTEWIDGET_H
#define UBDOCKPALETTEWIDGET_H
#include <QWidget>
#include <QIcon>
#include <QString>
class UBDockPaletteWidget : public QWidget
{
public:
UBDockPaletteWidget(const char* name="UBDockPaletteWidget", QWidget* parent=0);
~UBDockPaletteWidget();
QWidget* widget();
QIcon icon();
QIcon collapsedIcon();
QString name();
protected:
QWidget* mpWidget;
QIcon mIcon;
QIcon mCollapsedIcon;
QString mName;
};
#endif // UBDOCKPALETTEWIDGET_H

@ -31,7 +31,7 @@ UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(pare
, mDropWidget(NULL) , mDropWidget(NULL)
{ {
setOrientation(eUBDockOrientation_Right); setOrientation(eUBDockOrientation_Right);
mIcon = QPixmap(":images/paletteLibrary.png"); //mIcon = QPixmap(":images/paletteLibrary.png");
setAcceptDrops(true); setAcceptDrops(true);
resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height()); resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height());

@ -32,7 +32,7 @@ UBNavigatorPalette::UBNavigatorPalette(QWidget *parent, const char *name):UBDock
{ {
setOrientation(eUBDockOrientation_Left); setOrientation(eUBDockOrientation_Left);
setMaximumWidth(300); setMaximumWidth(300);
mIcon = QPixmap(":images/paletteNavigator.png"); //mIcon = QPixmap(":images/paletteNavigator.png");
resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), height()); resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), height());
mLastWidth = 300; mLastWidth = 300;

@ -38,7 +38,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBLibActionBar.h \ src/gui/UBLibActionBar.h \
src/gui/UBLibraryWidget.h \ src/gui/UBLibraryWidget.h \
src/gui/UBLibPathViewer.h \ src/gui/UBLibPathViewer.h \
src/gui/UBUpdateDlg.h src/gui/UBUpdateDlg.h \
src/gui/UBDockPaletteWidget.h
SOURCES += src/gui/UBThumbnailView.cpp \ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \ src/gui/UBFloatingPalette.cpp \
@ -79,7 +80,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBLibActionBar.cpp \ src/gui/UBLibActionBar.cpp \
src/gui/UBLibraryWidget.cpp \ src/gui/UBLibraryWidget.cpp \
src/gui/UBLibPathViewer.cpp \ src/gui/UBLibPathViewer.cpp \
src/gui/UBUpdateDlg.cpp src/gui/UBUpdateDlg.cpp \
src/gui/UBDockPaletteWidget.cpp
win32 { win32 {

@ -0,0 +1,142 @@
/*
* 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 <QDebug>
#include "UBGraphicsCache.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "board/UBBoardView.h"
#include "domain/UBGraphicsScene.h"
UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
, mMaskColor(Qt::black)
, mMaskShape(eMaskShape_Circle)
, mShapeWidth(100)
, mDrawMask(false)
{
// Get the board size and pass it to the shape
QRect boardRect = UBApplication::boardController->displayView()->rect();
setRect(-15*boardRect.width(), -15*boardRect.height(), 30*boardRect.width(), 30*boardRect.height());
setZValue(CACHE_ZVALUE);
}
UBGraphicsCache::~UBGraphicsCache()
{
}
UBItem* UBGraphicsCache::deepCopy() const
{
UBGraphicsCache* copy = new UBGraphicsCache();
copy->setPos(this->pos());
copy->setRect(this->rect());
copy->setZValue(this->zValue());
copy->setTransform(this->transform());
// TODO UB 4.7 ... complete all members ?
return copy;
}
QColor UBGraphicsCache::maskColor()
{
return mMaskColor;
}
void UBGraphicsCache::setMaskColor(QColor color)
{
mMaskColor = color;
}
eMaskShape UBGraphicsCache::maskshape()
{
return mMaskShape;
}
void UBGraphicsCache::setMaskShape(eMaskShape shape)
{
mMaskShape = shape;
}
void UBGraphicsCache::init()
{
setFlag(QGraphicsItem::ItemIsMovable, true);
setFlag(QGraphicsItem::ItemIsSelectable, true);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
}
void UBGraphicsCache::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
setZValue(CACHE_ZVALUE);
painter->setBrush(mMaskColor);
painter->setPen(mMaskColor);
QPainterPath path;
path.addRect(rect());
if(mDrawMask)
{
if(eMaskShape_Circle == mMaskShape)
{
path.addEllipse(mShapePos, mShapeWidth, mShapeWidth);
}
else if(eMaskShap_Rectangle == mMaskShape)
{
path.addRect(mShapePos.x(), mShapePos.y(), mShapeWidth, mShapeWidth);
}
path.setFillRule(Qt::OddEvenFill);
}
painter->drawPath(path);
}
void UBGraphicsCache::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_UNUSED(event);
mShapePos = event->pos();
mDrawMask = true;
update();
}
void UBGraphicsCache::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
mShapePos = event->pos();
update();
}
void UBGraphicsCache::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_UNUSED(event);
mDrawMask = false;
update();
}
int UBGraphicsCache::shapeWidth()
{
return mShapeWidth;
}
void UBGraphicsCache::setShapeWidth(int width)
{
mShapeWidth = width;
}

@ -0,0 +1,61 @@
/*
* 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 UBGRAPHICSCACHE_H
#define UBGRAPHICSCACHE_H
#include <QColor>
#include <QGraphicsSceneMouseEvent>
#include "domain/UBItem.h"
#define CACHE_ZVALUE 100000
typedef enum
{
eMaskShape_Circle,
eMaskShap_Rectangle
}eMaskShape;
class UBGraphicsCache : public QGraphicsRectItem, public UBItem
{
public:
UBGraphicsCache();
~UBGraphicsCache();
virtual UBItem* deepCopy() const;
QColor maskColor();
void setMaskColor(QColor color);
eMaskShape maskshape();
void setMaskShape(eMaskShape shape);
int shapeWidth();
void setShapeWidth(int width);
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private:
void init();
QColor mMaskColor;
eMaskShape mMaskShape;
int mShapeWidth;
bool mDrawMask;
QPointF mShapePos;
};
#endif // UBGRAPHICSCACHE_H

@ -58,9 +58,15 @@ UBToolsManager::UBToolsManager(QObject *parent)
mToolsIcon.insert(triangle.id,":/images/toolPalette/triangleTool.png"); mToolsIcon.insert(triangle.id,":/images/toolPalette/triangleTool.png");
mDescriptors << triangle; mDescriptors << triangle;
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() UBToolsManager::~UBToolsManager()
{ {
// NOOP // NOOP
} }

@ -77,7 +77,8 @@ class UBToolsManager : public QObject
UBToolDescriptor protractor; UBToolDescriptor protractor;
UBToolDescriptor compass; UBToolDescriptor compass;
UBToolDescriptor mask; UBToolDescriptor mask;
UBToolDescriptor triangle; UBToolDescriptor triangle;
UBToolDescriptor cache;
QString iconFromToolId(QString id) { return mToolsIcon.value(id);} QString iconFromToolId(QString id) { return mToolsIcon.value(id);}

@ -1,18 +1,20 @@
HEADERS += src/tools/UBGraphicsRuler.h \ HEADERS += src/tools/UBGraphicsRuler.h \
src/tools/UBGraphicsTriangle.h \ src/tools/UBGraphicsTriangle.h \
src/tools/UBGraphicsProtractor.h \ src/tools/UBGraphicsProtractor.h \
src/tools/UBGraphicsCompass.h \ src/tools/UBGraphicsCompass.h \
src/tools/UBToolsManager.h \ src/tools/UBToolsManager.h \
src/tools/UBGraphicsCurtainItem.h \ src/tools/UBGraphicsCurtainItem.h \
src/tools/UBGraphicsCurtainItemDelegate.h \ src/tools/UBGraphicsCurtainItemDelegate.h \
src/tools/UBAbstractDrawRuler.h src/tools/UBAbstractDrawRuler.h \
src/tools/UBGraphicsCache.h
SOURCES += src/tools/UBGraphicsRuler.cpp \
src/tools/UBGraphicsTriangle.cpp \ SOURCES += src/tools/UBGraphicsRuler.cpp \
src/tools/UBGraphicsProtractor.cpp \ src/tools/UBGraphicsTriangle.cpp \
src/tools/UBGraphicsCompass.cpp \ src/tools/UBGraphicsProtractor.cpp \
src/tools/UBToolsManager.cpp \ src/tools/UBGraphicsCompass.cpp \
src/tools/UBGraphicsCurtainItem.cpp \ src/tools/UBToolsManager.cpp \
src/tools/UBGraphicsCurtainItemDelegate.cpp \ src/tools/UBGraphicsCurtainItem.cpp \
src/tools/UBAbstractDrawRuler.cpp src/tools/UBGraphicsCurtainItemDelegate.cpp \
src/tools/UBAbstractDrawRuler.cpp \
src/tools/UBGraphicsCache.cpp

Loading…
Cancel
Save