Merge branch 'release-candidate' of https://github.com/Sankore/Sankore-3.1 into release-candidate

Conflicts:
	src/tools/UBGraphicsRuler.cpp
preferencesAboutTextFull
shibakaneki 12 years ago
commit 47844ccf93
  1. 7
      src/adaptors/publishing/UBDocumentPublisher.cpp
  2. 9
      src/board/UBBoardController.cpp
  3. 6
      src/board/UBBoardView.cpp
  4. 1
      src/frameworks/UBFileSystemUtils.cpp
  5. 9
      src/tools/UBGraphicsCompass.cpp
  6. 2
      src/tools/UBGraphicsCompass.h

@ -62,7 +62,6 @@ UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *pa
, mPassword("") , mPassword("")
, bLoginCookieSet(false) , bLoginCookieSet(false)
{ {
//NOOP
init(); init();
} }
@ -109,7 +108,7 @@ void UBDocumentPublisher::buildUbwFile()
if (UBFileSystemUtils::copyDir(mSourceDocument->persistencePath(), tmpDir)) if (UBFileSystemUtils::copyDir(mSourceDocument->persistencePath(), tmpDir))
{ {
QUuid publishingUuid = QUuid::createUuid(); QString documentName = mSourceDocument->name();
mPublishingPath = tmpDir; mPublishingPath = tmpDir;
mPublishingSize = mSourceDocument->pageCount(); mPublishingSize = mSourceDocument->pageCount();
@ -120,11 +119,11 @@ void UBDocumentPublisher::buildUbwFile()
UBExportFullPDF pdfExporter; UBExportFullPDF pdfExporter;
pdfExporter.setVerbode(false); pdfExporter.setVerbode(false);
pdfExporter.persistsDocument(mSourceDocument, mPublishingPath + "/" + UBStringUtils::toCanonicalUuid(publishingUuid) + ".pdf"); pdfExporter.persistsDocument(mSourceDocument, mPublishingPath + "/" + documentName + ".pdf");
UBExportDocument ubzExporter; UBExportDocument ubzExporter;
ubzExporter.setVerbode(false); ubzExporter.setVerbode(false);
ubzExporter.persistsDocument(mSourceDocument, mPublishingPath + "/" + UBStringUtils::toCanonicalUuid(publishingUuid) + ".ubz"); ubzExporter.persistsDocument(mSourceDocument, mPublishingPath + "/" + documentName + ".ubz");
// remove all useless files // remove all useless files

@ -2364,10 +2364,17 @@ void UBBoardController::togglePodcast(bool checked)
void UBBoardController::moveGraphicsWidgetToControlView(UBGraphicsWidgetItem* graphicsWidget) void UBBoardController::moveGraphicsWidgetToControlView(UBGraphicsWidgetItem* graphicsWidget)
{ {
mActiveScene->setURStackEnable(false); mActiveScene->setURStackEnable(false);
UBGraphicsItem *toolW3C = duplicateItem(dynamic_cast<UBItem *>(graphicsWidget));
UBGraphicsWidgetItem *copyedGraphicsWidget = NULL;
if (UBGraphicsWidgetItem::Type == toolW3C->type())
copyedGraphicsWidget = static_cast<UBGraphicsWidgetItem *>(toolW3C);
UBToolWidget *toolWidget = new UBToolWidget(copyedGraphicsWidget, mControlView);
graphicsWidget->remove(false); graphicsWidget->remove(false);
mActiveScene->addItemToDeletion(graphicsWidget); mActiveScene->addItemToDeletion(graphicsWidget);
UBToolWidget *toolWidget = new UBToolWidget(graphicsWidget, mControlView);
mActiveScene->setURStackEnable(true); mActiveScene->setURStackEnable(true);
QPoint controlViewPos = mControlView->mapFromScene(graphicsWidget->sceneBoundingRect().center()); QPoint controlViewPos = mControlView->mapFromScene(graphicsWidget->sceneBoundingRect().center());

@ -866,6 +866,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mMouseDownPos = event->pos (); mMouseDownPos = event->pos ();
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint())); movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint()));
if (!movingItem) if (!movingItem)
emit clickOnBoard(); emit clickOnBoard();
@ -1099,6 +1100,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (currentTool == UBStylusTool::Selector) if (currentTool == UBStylusTool::Selector)
{ {
bool bReleaseIsNeed = true; bool bReleaseIsNeed = true;
if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint()))))
{
movingItem = NULL;
bReleaseIsNeed = false;
}
if (mWidgetMoved) if (mWidgetMoved)
{ {
mWidgetMoved = false; mWidgetMoved = false;

@ -397,7 +397,6 @@ QString UBFileSystemUtils::lastPathComponent(const QString& path)
QString UBFileSystemUtils::mimeTypeFromFileName(const QString& fileName) QString UBFileSystemUtils::mimeTypeFromFileName(const QString& fileName)
{ {
Q_ASSERT(fileName.length());
QString ext = extension(fileName); QString ext = extension(fileName);
if (ext == "xls" || ext == "xlsx") return "application/msexcel"; if (ext == "xls" || ext == "xlsx") return "application/msexcel";

@ -51,6 +51,13 @@ UBGraphicsCompass::UBGraphicsCompass()
, mDrewCenterCross(false) , mDrewCenterCross(false)
{ {
setRect(sDefaultRect); setRect(sDefaultRect);
setBrush(QBrush(Qt::red));
//TODO claudio: remove code duplication
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
mPixelsPerMillimeter = qRound(dpiCommon / 25.4f);
setFlag(QGraphicsItem::ItemIsMovable, true); setFlag(QGraphicsItem::ItemIsMovable, true);
setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemIsSelectable, true);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
@ -399,7 +406,7 @@ void UBGraphicsCompass::paintAngleDisplay(QPainter *painter)
void UBGraphicsCompass::paintRadiusDisplay(QPainter *painter) void UBGraphicsCompass::paintRadiusDisplay(QPainter *painter)
{ {
qreal radiusInCentimeters = rect().width() / (sPixelsPerMillimeter * 10); qreal radiusInCentimeters = rect().width() / (mPixelsPerMillimeter * 10);
QString format = rect().width() >= sDisplayRadiusUnitMinLength ? "%1 cm" : "%1"; QString format = rect().width() >= sDisplayRadiusUnitMinLength ? "%1 cm" : "%1";
QString radiusText = QString(format).arg(radiusInCentimeters, 0, 'f', 1); QString radiusText = QString(format).arg(radiusInCentimeters, 0, 'f', 1);

@ -113,6 +113,7 @@ class UBGraphicsCompass: public QObject, public QGraphicsRectItem, public UBItem
QGraphicsSvgItem* mResizeSvgItem; QGraphicsSvgItem* mResizeSvgItem;
qreal mAntiScaleRatio; qreal mAntiScaleRatio;
bool mDrewCenterCross; bool mDrewCenterCross;
int mPixelsPerMillimeter;
// Constants // Constants
static const QRect sDefaultRect; static const QRect sDefaultRect;
@ -130,7 +131,6 @@ class UBGraphicsCompass: public QObject, public QGraphicsRectItem, public UBItem
static const QColor sDarkBackgroundEdgeFillColor; static const QColor sDarkBackgroundEdgeFillColor;
static const QColor sDarkBackgroundMiddleFillColor; static const QColor sDarkBackgroundMiddleFillColor;
static const QColor sDarkBackgroundDrawColor; static const QColor sDarkBackgroundDrawColor;
static const int sPixelsPerMillimeter = 5;
static const int sDisplayRadiusOnPencilArmMinLength = 300; static const int sDisplayRadiusOnPencilArmMinLength = 300;
static const int sDisplayRadiusUnitMinLength = 250; static const int sDisplayRadiusUnitMinLength = 250;
}; };

Loading…
Cancel
Save