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

preferencesAboutTextFull
shibakaneki 13 years ago
commit 0bfa298344
  1. 7
      Sankore_3.1.pro
  2. 37
      plugins/cffadaptor/UBCFFAdaptor.pro
  3. 2
      plugins/cffadaptor/src/UBCFFAdaptor.cpp
  4. 2
      src/board/UBBoardController.h
  5. 11
      src/core/UBApplicationController.cpp
  6. 1
      src/gui/UBDocumentNavigator.cpp
  7. 1
      src/gui/UBDocumentNavigator.h
  8. 36
      src/gui/UBDocumentTreeWidget.cpp
  9. 4
      src/gui/UBDocumentTreeWidget.h
  10. 78
      src/gui/UBThumbnailWidget.cpp
  11. 4
      src/gui/UBThumbnailWidget.h

@ -109,8 +109,9 @@ MOC_DIR = $$BUILD_DIR/moc
RCC_DIR = $$BUILD_DIR/rcc
UI_DIR = $$BUILD_DIR/ui
LIBS += "-Lplugins/cffadaptor/$$BUILD_DIR/lib" "-lCFF_Adaptor"
win32 {
LIBS += "-Lplugins/cffadaptor/lib/win32" "-lCFF_Adaptor"
RC_FILE = resources/win/sankore.rc
CONFIG += qaxcontainer
exists(console):CONFIG += console
@ -131,7 +132,6 @@ win32 {
}
macx {
LIBS += "-Lplugins/cffadaptor/lib/macx" "-lCFF_Adaptor"
LIBS += -framework Foundation
LIBS += -lcrypto
LIBS += -framework AppKit
@ -329,7 +329,6 @@ macx {
}
linux-g++ {
LIBS += "-Lplugins/cffadaptor/lib/linux" "-lCFF_Adaptor"
LIBS += -lcrypto
QMAKE_CFLAGS += -fopenmp
QMAKE_CXXFLAGS += -fopenmp
@ -345,7 +344,6 @@ linux-g++ {
}
linux-g++-32 {
LIBS += "-Lplugins/cffadaptor/lib/linux" "-lCFF_Adaptor"
LIBS += -lcrypto
QMAKE_CFLAGS += -fopenmp
QMAKE_CXXFLAGS += -fopenmp
@ -361,7 +359,6 @@ linux-g++-32 {
}
linux-g++-64 {
LIBS += "-Lplugins/cffadaptor/lib/linux" "-lCFF_Adaptor"
LIBS += -lcrypto
QMAKE_CFLAGS += -fopenmp
QMAKE_CXXFLAGS += -fopenmp

@ -4,6 +4,9 @@
#
#-------------------------------------------------
TARGET = CFF_Adaptor
TEMPLATE = lib
win32: SUB_DIR = win32
macx: SUB_DIR = macx
linux-g++: SUB_DIR = linux
@ -13,11 +16,21 @@ linux-g++-64: SUB_DIR = linux
THIRD_PARTY_PATH = ../../../Sankore-ThirdParty
QUAZIP_DIR = "$$PWD/../../../Sankore-ThirdParty/quazip/quazip-0.3"
INCLUDEPATH += src
BUILD_DIR = $$PWD/build/$$SUB_DIR
CONFIG(debug, debug|release):BUILD_DIR = $$BUILD_DIR/debug
CONFIG(release, debug|release) {
BUILD_DIR = $$BUILD_DIR/release
CONFIG += warn_off
}
DEPENDPATH += $$THIRD_PARTY_PATH/quazip/
INCLUDEPATH += $$THIRD_PARTY_PATH/quazip/
include($$THIRD_PARTY_PATH/quazip/quazip.pri)
win32{
CONFIG += dll
}
OBJECTS_DIR = $$BUILD_DIR/objects
MOC_DIR = $$BUILD_DIR/moc
DESTDIR = $$BUILD_DIR/lib
RCC_DIR = $$BUILD_DIR/rcc
LIBS += "-L$$THIRD_PARTY_PATH/quazip/lib/$$SUB_DIR" "-lquazip"
@ -25,15 +38,17 @@ QT += xml xmlpatterns core
QT += gui
QT += svg
TARGET = CFF_Adaptor
TEMPLATE = lib
win32{
CONFIG += dll
}
DEFINES += UBCFFADAPTOR_LIBRARY
DEFINES += NO_THIRD_PARTY_WARNINGS
INCLUDEPATH += src
DEPENDPATH += $$THIRD_PARTY_PATH/quazip/
INCLUDEPATH += $$THIRD_PARTY_PATH/quazip/
include($$THIRD_PARTY_PATH/quazip/quazip.pri)
SOURCES += \
src/UBCFFAdaptor.cpp
@ -43,9 +58,5 @@ HEADERS +=\
src/UBCFFAdaptor_global.h \
src/UBCFFConstants.h
OBJECTS_DIR = $$PWD/objects
MOC_DIR = $$PWD/moc
DESTDIR = $$PWD/lib/$$SUB_DIR
RESOURCES += \
resources/resources.qrc

@ -1878,6 +1878,8 @@ UBCFFAdaptor::UBToCFFConverter::~UBToCFFConverter()
delete mDataModel;
if (mIWBContentWriter)
delete mIWBContentWriter;
if (mDocumentToWrite)
delete mDocumentToWrite;
}
bool UBCFFAdaptor::UBToCFFConverter::isValid() const
{

@ -152,6 +152,7 @@ class UBBoardController : public QObject
void displayMetaData(QMap<QString, QString> metadatas);
void ClearUndoStack();
void emitScrollSignal() { emit scrollToSelectedPage(); }
public slots:
void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0);
@ -230,6 +231,7 @@ class UBBoardController : public QObject
void setDocOnPageNavigator(UBDocumentProxy* doc);
void documentReorganized(int index);
void displayMetadata(QMap<QString, QString> metadata);
void scrollToSelectedPage();
protected:
void setupViews();

@ -337,8 +337,15 @@ void UBApplicationController::showBoard()
mMainWindow->tutorialToolBar->hide();
mMainWindow->boardToolBar->show();
if (mMainMode == Document && UBApplication::documentController->getSelectedItemIndex() != -1)
UBApplication::boardController->setActiveDocumentScene(UBApplication::documentController->getCurrentDocument(), UBApplication::documentController->getSelectedItemIndex());
if (mMainMode == Document)
{
int selectedSceneIndex = UBApplication::documentController->getSelectedItemIndex();
if (selectedSceneIndex != -1)
{
UBApplication::boardController->setActiveDocumentScene(UBApplication::documentController->getCurrentDocument(), selectedSceneIndex);
UBApplication::boardController->emitScrollSignal();
}
}
mMainMode = Board;

@ -58,6 +58,7 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(addNewPage()));
connect(mScene, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
connect(UBApplication::boardController, SIGNAL(documentReorganized(int)), this, SLOT(onMovedToIndex(int)));
connect(UBApplication::boardController, SIGNAL(scrollToSelectedPage()), this, SLOT(onScrollToSelectedPage()));
}
/**

@ -46,6 +46,7 @@ signals:
public slots:
void onMovedToIndex(int index);
void onScrollToSelectedPage() { centerOn(mCrntItem); }
protected:
virtual void resizeEvent(QResizeEvent *event);

@ -39,11 +39,14 @@ UBDocumentTreeWidget::UBDocumentTreeWidget(QWidget * parent)
setDragDropMode(QAbstractItemView::InternalMove);
setAutoScroll(true);
mScrollTimer = new QTimer(this);
connect(UBDocumentManager::documentManager(), SIGNAL(documentUpdated(UBDocumentProxy*))
, this, SLOT(documentUpdated(UBDocumentProxy*)));
connect(this, SIGNAL(itemChanged(QTreeWidgetItem *, int))
, this, SLOT(itemChangedValidation(QTreeWidgetItem *, int)));
connect(mScrollTimer, SIGNAL(timeout())
, this, SLOT(autoScroll()));
}
@ -104,6 +107,12 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event)
{
Q_UNUSED(event);
if (mScrollTimer->isActive())
{
mScrollMagnitude = 0;
mScrollTimer->stop();
}
if (mDropTargetProxyTi)
{
mDropTargetProxyTi->setBackground(0, mBackground);
@ -114,6 +123,27 @@ void UBDocumentTreeWidget::dragLeaveEvent(QDragLeaveEvent *event)
void UBDocumentTreeWidget::dragMoveEvent(QDragMoveEvent *event)
{
QRect boundingFrame = frameRect();
//setting up automatic scrolling
const int SCROLL_DISTANCE = 4;
int bottomDist = boundingFrame.bottom() - event->pos().y(), topDist = boundingFrame.top() - event->pos().y();
if(qAbs(bottomDist) <= SCROLL_DISTANCE)
{
mScrollMagnitude = (SCROLL_DISTANCE - bottomDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
}
else if(qAbs(topDist) <= SCROLL_DISTANCE)
{
mScrollMagnitude = (- SCROLL_DISTANCE - topDist)*4;
if(verticalScrollBar()->isVisible() && !mScrollTimer->isActive()) mScrollTimer->start(100);
}
else
{
mScrollMagnitude = 0;
mScrollTimer->stop();
}
QTreeWidgetItem* underlyingItem = this->itemAt(event->pos());
if (event->mimeData()->hasFormat(UBApplication::mimeTypeUniboardPage))
@ -417,3 +447,9 @@ bool UBDocumentGroupTreeItem::isDefaultFolder() const
{
return (0 == (flags() & Qt::ItemIsEditable)) && (groupName() == UBSettings::defaultDocumentGroupName);
}
void UBDocumentTreeWidget::autoScroll()
{
this->verticalScrollBar()->setValue(this->verticalScrollBar()->value() + mScrollMagnitude);
}

@ -43,10 +43,14 @@ class UBDocumentTreeWidget : public QTreeWidget
void itemChangedValidation(QTreeWidgetItem * item, int column);
void autoScroll();
private:
UBDocumentProxyTreeItem *mSelectedProxyTi;
QTreeWidgetItem *mDropTargetProxyTi;
QBrush mBackground;
QTimer* mScrollTimer;
int mScrollMagnitude;
};

@ -33,6 +33,7 @@ UBThumbnailWidget::UBThumbnailWidget(QWidget* parent)
, mLastSelectedThumbnail(0)
, mSelectionSpan(0)
, mLassoRectItem(0)
, mPrevLassoRect(QRect())
{
// By default, the drag is possible
bCanDrag = true;
@ -217,6 +218,7 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
QStyleOption option;
option.initFrom(&rubberBand);
mPrevLassoRect = QRect();
mLassoRectItem = new QGraphicsRectItem(0, scene());
#ifdef Q_WS_MAC
@ -248,6 +250,8 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
}
mSelectedThumbnailItems.clear();
mPreviouslyIncrementalSelectedItemsX.clear();
mPreviouslyIncrementalSelectedItemsY.clear();
QGraphicsView::mousePressEvent(event);
}
else if (Qt::ShiftModifier & event->modifiers())
@ -305,6 +309,8 @@ void UBThumbnailWidget::mouseMoveEvent(QMouseEvent *event)
QRectF lassoRect(
qMin(mMousePressScenePos.x(), currentScenePos.x()), qMin(mMousePressScenePos.y(), currentScenePos.y()),
qAbs(mMousePressScenePos.x() - currentScenePos.x()), qAbs(mMousePressScenePos.y() - currentScenePos.y()));
if (QPoint() == prevMoveMousePos)
prevMoveMousePos = currentScenePos;
QRectF incrementXSelection(
qMin(prevMoveMousePos.x(), currentScenePos.x()), qMin(mMousePressScenePos.y(), currentScenePos.y()),
qAbs(prevMoveMousePos.x() - currentScenePos.x())+incrementLassoMinWidth, qAbs(mMousePressScenePos.y() - currentScenePos.y()));
@ -315,50 +321,83 @@ void UBThumbnailWidget::mouseMoveEvent(QMouseEvent *event)
prevMoveMousePos = currentScenePos;
mLassoRectItem->setRect(lassoRect);
QSet<QGraphicsItem*> lassoSelectedThumbnailItems;
QSet<QGraphicsItem*> incSelectedItems = scene()->items(incrementXSelection, Qt::IntersectsItemBoundingRect).toSet()
+ scene()->items(incrementYSelection, Qt::IntersectsItemBoundingRect).toSet();
QSet<QGraphicsItem*> toUnset;
QSet<QGraphicsItem*> toSet;
mPreviouslyIncrementalSelectedItems = incSelectedItems;
QSet<QGraphicsItem*> lassoSelectedItems;
QSet<QGraphicsItem*> lassoSelectedThumbnailItems;
foreach (QGraphicsItem *lassoSelectedItem, incSelectedItems)
// for horizontal moving
QSet<QGraphicsItem*> incSelectedItemsX = scene()->items(incrementXSelection, Qt::IntersectsItemBoundingRect).toSet();
foreach (QGraphicsItem *lassoSelectedItem, incSelectedItemsX)
{
if (lassoSelectedItem)
{
UBSceneThumbnailPixmap *thumbnailItem = dynamic_cast<UBSceneThumbnailPixmap*>(lassoSelectedItem);
if (thumbnailItem)
{
lassoSelectedItem->setSelected(true);
lassoSelectedThumbnailItems += lassoSelectedItem;
}
}
if(lassoRect.width() < mPrevLassoRect.width())
{
if (!lassoSelectedThumbnailItems.contains(mPreviouslyIncrementalSelectedItemsX))
toUnset += mPreviouslyIncrementalSelectedItemsX - lassoSelectedThumbnailItems;
}
mPreviouslyIncrementalSelectedItemsX = lassoSelectedThumbnailItems;
QSet<QGraphicsItem*> toUnset;
toUnset = mSelectedThumbnailItems - lassoSelectedThumbnailItems;
foreach(QGraphicsItem* item, toUnset)
toSet += lassoSelectedThumbnailItems + mPreviouslyIncrementalSelectedItemsX;
lassoSelectedThumbnailItems.clear();
// for vertical moving
QSet<QGraphicsItem*> incSelectedItemsY = scene()->items(incrementYSelection, Qt::IntersectsItemBoundingRect).toSet();
foreach (QGraphicsItem *lassoSelectedItem, incSelectedItemsY)
{
item->setSelected(false);
if (lassoSelectedItem)
{
UBSceneThumbnailPixmap *thumbnailItem = dynamic_cast<UBSceneThumbnailPixmap*>(lassoSelectedItem);
if (thumbnailItem)
lassoSelectedThumbnailItems += lassoSelectedItem;
}
}
if(lassoRect.height() < mPrevLassoRect.height())
{
if (!lassoSelectedThumbnailItems.contains(mPreviouslyIncrementalSelectedItemsY))
toUnset += mPreviouslyIncrementalSelectedItemsY - lassoSelectedThumbnailItems;
}
mPreviouslyIncrementalSelectedItemsY = lassoSelectedThumbnailItems;
toSet += lassoSelectedThumbnailItems + mPreviouslyIncrementalSelectedItemsY;
toSet -= toUnset;
mSelectedThumbnailItems += lassoSelectedItems;
// foreach (QGraphicsItem *lassoSelectedItem, lassoSelectedThumbnailItems)
foreach (QGraphicsItem *item, toSet)
{
item->setSelected(true);
}
foreach (QGraphicsItem *item, toUnset)
{
item->setSelected(false);
}
mSelectedThumbnailItems += lassoSelectedThumbnailItems;
mPrevLassoRect = lassoRect;
if (Qt::ControlModifier & event->modifiers())
{
for (int i = 0; i < mSelectedThumbnailItems.count()-1; i++)
{
mSelectedThumbnailItems.values().at(i)->setSelected(true);
}
// foreach (QGraphicsItem *selectedItem, mSelectedThumbnailItems)
{
// selectedItem->setSelected(true);
}
}
}
else
@ -404,6 +443,7 @@ void UBThumbnailWidget::mouseMoveEvent(QMouseEvent *event)
void UBThumbnailWidget::mouseReleaseEvent(QMouseEvent *event)
{
int elapsedTimeSincePress = mClickTime.elapsed();
prevMoveMousePos = QPoint();
deleteLasso();
QGraphicsView::mouseReleaseEvent(event);

@ -113,9 +113,11 @@ class UBThumbnailWidget : public QGraphicsView
UBThumbnail *mLastSelectedThumbnail;
int mSelectionSpan;
QRectF mPrevLassoRect;
QGraphicsRectItem *mLassoRectItem;
QSet<QGraphicsItem*> mSelectedThumbnailItems;
QSet<QGraphicsItem*> mPreviouslyIncrementalSelectedItems;
QSet<QGraphicsItem*> mPreviouslyIncrementalSelectedItemsX;
QSet<QGraphicsItem*> mPreviouslyIncrementalSelectedItemsY;
QTime mClickTime;
};

Loading…
Cancel
Save