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

preferencesAboutTextFull
Claudio Valerio 13 years ago
commit 68958a9520
  1. 4
      release.win7.vc9.bat
  2. 13
      src/board/UBBoardController.cpp
  3. 22
      src/domain/UBGraphicsItemUndoCommand.cpp
  4. 5
      src/domain/UBGraphicsPixmapItem.cpp
  5. 5
      src/domain/UBGraphicsScene.cpp
  6. 1
      src/domain/UBGraphicsScene.h

@ -59,6 +59,10 @@ REM echo %LAST_TAG_VERSION%
nmake release-install nmake release-install
set CUSTOMIZATIONS=build\win32\release\product\customizations
mkdir %CUSTOMIZATIONS%
xcopy /s resources\customizations %CUSTOMIZATIONS%
set I18n=build\win32\release\product\i18n set I18n=build\win32\release\product\i18n
mkdir %I18n% mkdir %I18n%
xcopy /s resources\i18n\*.qm %I18n% xcopy /s resources\i18n\*.qm %I18n%

@ -855,6 +855,10 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground) void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground)
{ {
QGraphicsItem *oldBackgroundObject = NULL;
if (isBackground)
oldBackgroundObject = mActiveScene->backgroundObject();
QString mimeType = pContentTypeHeader; QString mimeType = pContentTypeHeader;
// In some cases "image/jpeg;charset=" is returned by the drag-n-drop. That is // In some cases "image/jpeg;charset=" is returned by the drag-n-drop. That is
@ -1193,6 +1197,15 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString
UBApplication::showMessage(tr("Unknown content type %1").arg(pContentTypeHeader)); UBApplication::showMessage(tr("Unknown content type %1").arg(pContentTypeHeader));
qWarning() << "ignoring mime type" << pContentTypeHeader ; qWarning() << "ignoring mime type" << pContentTypeHeader ;
} }
if (isBackground && oldBackgroundObject != mActiveScene->backgroundObject())
{
if (mActiveScene->isURStackIsEnabled()) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(mActiveScene, oldBackgroundObject, mActiveScene->backgroundObject());
UBApplication::undoStack->push(uc);
}
}
} }

@ -91,8 +91,15 @@ void UBGraphicsItemUndoCommand::undo()
while (itRemoved.hasNext()) while (itRemoved.hasNext())
{ {
QGraphicsItem* item = itRemoved.next(); QGraphicsItem* item = itRemoved.next();
mScene->addItem(item); if (item)
UBApplication::boardController->freezeW3CWidget(item, false); {
if (UBItemLayerType::FixedBackground == item->data(UBGraphicsItemData::ItemLayerType))
mScene->setAsBackgroundObject(item);
else
mScene->addItem(item);
UBApplication::boardController->freezeW3CWidget(item, false);
}
} }
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint // force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
@ -123,8 +130,15 @@ void UBGraphicsItemUndoCommand::redo()
while (itAdded.hasNext()) while (itAdded.hasNext())
{ {
QGraphicsItem* item = itAdded.next(); QGraphicsItem* item = itAdded.next();
mScene->addItem(item); if (item)
UBApplication::boardController->freezeW3CWidget(item, false); {
if (UBItemLayerType::FixedBackground == item->data(UBGraphicsItemData::ItemLayerType))
mScene->setAsBackgroundObject(item);
else
mScene->addItem(item);
UBApplication::boardController->freezeW3CWidget(item, false);
}
} }
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2) to trigger repaint // force refresh, QT is a bit lazy and take a lot of time (nb item ^2) to trigger repaint

@ -65,8 +65,9 @@ void UBGraphicsPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
QMimeData* pMime = new QMimeData(); QMimeData* pMime = new QMimeData();
pMime->setImageData(pixmap().toImage()); pMime->setImageData(pixmap().toImage());
mDelegate->setMimeData(pMime); mDelegate->setMimeData(pMime);
int k = pixmap().width() / 100; qreal k = (qreal)pixmap().width() / 100.0;
QSize newSize(pixmap().width() / k, pixmap().height() / k);
QSize newSize((int)(pixmap().width() / k), (int)(pixmap().height() / k));
mDelegate->setDragPixmap(pixmap().scaled(newSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); mDelegate->setDragPixmap(pixmap().scaled(newSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));

@ -1292,6 +1292,11 @@ void UBGraphicsScene::clearBackground()
{ {
if(mBackgroundObject){ if(mBackgroundObject){
removeItem(mBackgroundObject); removeItem(mBackgroundObject);
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, mBackgroundObject, NULL);
UBApplication::undoStack->push(uc);
}
mBackgroundObject = 0; mBackgroundObject = 0;
} }
update(sceneRect()); update(sceneRect());

@ -102,6 +102,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
// tmp stub for divide addings scene objects from undo mechanism implementation // tmp stub for divide addings scene objects from undo mechanism implementation
void setURStackEnable(bool set = true) {enableUndoRedoStack = set;} void setURStackEnable(bool set = true) {enableUndoRedoStack = set;}
bool isURStackIsEnabled(){ return enableUndoRedoStack;}
UBGraphicsScene(UBDocumentProxy *parent); UBGraphicsScene(UBDocumentProxy *parent);
virtual ~UBGraphicsScene(); virtual ~UBGraphicsScene();

Loading…
Cancel
Save