|
|
@ -1341,6 +1341,7 @@ UBDocumentTreeView::UBDocumentTreeView(QWidget *parent) : QTreeView(parent) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setObjectName("UBDocumentTreeView"); |
|
|
|
setObjectName("UBDocumentTreeView"); |
|
|
|
setRootIsDecorated(true); |
|
|
|
setRootIsDecorated(true); |
|
|
|
|
|
|
|
setSelectionBehavior(SelectRows); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBDocumentTreeView::setSelectedAndExpanded(const QModelIndex &pIndex, bool pExpand, bool pEdit) |
|
|
|
void UBDocumentTreeView::setSelectedAndExpanded(const QModelIndex &pIndex, bool pExpand, bool pEdit) |
|
|
@ -1358,9 +1359,9 @@ void UBDocumentTreeView::setSelectedAndExpanded(const QModelIndex &pIndex, bool |
|
|
|
? QItemSelectionModel::Select |
|
|
|
? QItemSelectionModel::Select |
|
|
|
: QItemSelectionModel::Deselect; |
|
|
|
: QItemSelectionModel::Deselect; |
|
|
|
|
|
|
|
|
|
|
|
setCurrentIndex(pExpand |
|
|
|
setCurrentIndex(indexCurrentDoc); |
|
|
|
? indexCurrentDoc |
|
|
|
|
|
|
|
: QModelIndex()); |
|
|
|
selectionModel()->setCurrentIndex(proxy->mapFromSource(indexCurrentDoc), QItemSelectionModel::SelectCurrent); |
|
|
|
|
|
|
|
|
|
|
|
selectionModel()->select(proxy->mapFromSource(indexCurrentDoc), QItemSelectionModel::Rows | sel); |
|
|
|
selectionModel()->select(proxy->mapFromSource(indexCurrentDoc), QItemSelectionModel::Rows | sel); |
|
|
|
|
|
|
|
|
|
|
@ -1369,7 +1370,7 @@ void UBDocumentTreeView::setSelectedAndExpanded(const QModelIndex &pIndex, bool |
|
|
|
indexCurrentDoc = indexCurrentDoc.parent(); |
|
|
|
indexCurrentDoc = indexCurrentDoc.parent(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
scrollTo(proxy->mapFromSource(pIndex), QAbstractItemView::PositionAtCenter); |
|
|
|
scrollTo(proxy->mapFromSource(pIndex)); |
|
|
|
|
|
|
|
|
|
|
|
if (pEdit) |
|
|
|
if (pEdit) |
|
|
|
edit(proxy->mapFromSource(pIndex)); |
|
|
|
edit(proxy->mapFromSource(pIndex)); |
|
|
@ -1860,7 +1861,8 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (setAsCurrentDocument) { |
|
|
|
if (setAsCurrentDocument) |
|
|
|
|
|
|
|
{ |
|
|
|
UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->setCurrentDocument(proxy); |
|
|
|
UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->setCurrentDocument(proxy); |
|
|
|
QModelIndex indexCurrentDoc = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->indexForProxy(proxy); |
|
|
|
QModelIndex indexCurrentDoc = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->indexForProxy(proxy); |
|
|
|
if (indexCurrentDoc.isValid()) |
|
|
|
if (indexCurrentDoc.isValid()) |
|
|
@ -1873,9 +1875,12 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr |
|
|
|
mBoardController->setActiveDocumentScene(proxy, 0, true, onImport); |
|
|
|
mBoardController->setActiveDocumentScene(proxy, 0, true, onImport); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
qWarning() << "an issue occured while trying to select current index in document tree"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mSelectionType = Document; |
|
|
|
|
|
|
|
setDocument(proxy); |
|
|
|
setDocument(proxy); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1953,7 +1958,7 @@ void UBDocumentController::TreeViewSelectionChanged(const QModelIndex ¤t, |
|
|
|
mCurrentIndexMoved = false; |
|
|
|
mCurrentIndexMoved = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
itemSelectionChanged(docModel->isCatalog(current_index) ? Folder : Document); |
|
|
|
pageSelectionChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//N/C - NNE - 20140402 : workaround for using a proxy model
|
|
|
|
//N/C - NNE - 20140402 : workaround for using a proxy model
|
|
|
@ -2181,8 +2186,6 @@ void UBDocumentController::setupViews() |
|
|
|
connect(mDocumentUI->thumbnailWidget, SIGNAL(mouseDoubleClick(QGraphicsItem*,int)), this, SLOT(thumbnailPageDoubleClicked(QGraphicsItem*,int))); |
|
|
|
connect(mDocumentUI->thumbnailWidget, SIGNAL(mouseDoubleClick(QGraphicsItem*,int)), this, SLOT(thumbnailPageDoubleClicked(QGraphicsItem*,int))); |
|
|
|
connect(mDocumentUI->thumbnailWidget, SIGNAL(mouseClick(QGraphicsItem*, int)), this, SLOT(pageClicked(QGraphicsItem*, int))); |
|
|
|
connect(mDocumentUI->thumbnailWidget, SIGNAL(mouseClick(QGraphicsItem*, int)), this, SLOT(pageClicked(QGraphicsItem*, int))); |
|
|
|
|
|
|
|
|
|
|
|
connect(mDocumentUI->thumbnailWidget->scene(), SIGNAL(selectionChanged()), this, SLOT(pageSelectionChanged())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(UBPersistenceManager::persistenceManager(), SIGNAL(documentSceneCreated(UBDocumentProxy*, int)), this, SLOT(documentSceneChanged(UBDocumentProxy*, int))); |
|
|
|
connect(UBPersistenceManager::persistenceManager(), SIGNAL(documentSceneCreated(UBDocumentProxy*, int)), this, SLOT(documentSceneChanged(UBDocumentProxy*, int))); |
|
|
|
|
|
|
|
|
|
|
|
mDocumentUI->thumbnailWidget->setBackgroundBrush(UBSettings::documentViewLightColor); |
|
|
|
mDocumentUI->thumbnailWidget->setBackgroundBrush(UBSettings::documentViewLightColor); |
|
|
@ -2248,6 +2251,8 @@ void UBDocumentController::sortDocuments(int kind, int order) |
|
|
|
mDocumentUI->documentTreeView->hideColumn(2); |
|
|
|
mDocumentUI->documentTreeView->hideColumn(2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mDocumentUI->documentTreeView->setSelectedAndExpanded(firstSelectedTreeIndex(), true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBDocumentController::onSortOrderChanged(bool order) |
|
|
|
void UBDocumentController::onSortOrderChanged(bool order) |
|
|
@ -2308,6 +2313,8 @@ void UBDocumentController::show() |
|
|
|
{ |
|
|
|
{ |
|
|
|
selectDocument(mBoardController->selectedDocument()); |
|
|
|
selectDocument(mBoardController->selectedDocument()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reorderDocuments(); |
|
|
|
|
|
|
|
|
|
|
|
updateActions(); |
|
|
|
updateActions(); |
|
|
|
|
|
|
|
|
|
|
|
if(!mToolsPalette) |
|
|
|
if(!mToolsPalette) |
|
|
@ -2435,6 +2442,8 @@ void UBDocumentController::deleteSelectedItem() |
|
|
|
deleteSingleItem(indexes.at(0), docModel); |
|
|
|
deleteSingleItem(indexes.at(0), docModel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pageSelectionChanged(); |
|
|
|
|
|
|
|
|
|
|
|
updateActions(); |
|
|
|
updateActions(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -3134,8 +3143,6 @@ void UBDocumentController::pageSelectionChanged() |
|
|
|
itemSelectionChanged(Folder); |
|
|
|
itemSelectionChanged(Folder); |
|
|
|
else |
|
|
|
else |
|
|
|
itemSelectionChanged(None); |
|
|
|
itemSelectionChanged(None); |
|
|
|
|
|
|
|
|
|
|
|
updateActions(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBDocumentController::documentSceneChanged(UBDocumentProxy* proxy, int pSceneIndex) |
|
|
|
void UBDocumentController::documentSceneChanged(UBDocumentProxy* proxy, int pSceneIndex) |
|
|
@ -3401,16 +3408,6 @@ void UBDocumentController::focusChanged(QWidget *old, QWidget *current) |
|
|
|
else |
|
|
|
else |
|
|
|
mSelectionType = None; |
|
|
|
mSelectionType = None; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (old != mDocumentUI->thumbnailWidget && |
|
|
|
|
|
|
|
old != mDocumentUI->documentTreeView && |
|
|
|
|
|
|
|
old != mDocumentUI->documentZoomSlider) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (current && (current->metaObject()->className() != QPushButton::staticMetaObject.className())) |
|
|
|
|
|
|
|
mSelectionType = None; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBDocumentController::updateActions() |
|
|
|
void UBDocumentController::updateActions() |
|
|
@ -3567,6 +3564,24 @@ void UBDocumentController::updateActions() |
|
|
|
mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-empty.png")); |
|
|
|
mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-empty.png")); |
|
|
|
mMainWindow->actionDelete->setText(tr("Empty")); |
|
|
|
mMainWindow->actionDelete->setText(tr("Empty")); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case NoDeletion : |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
if (mSelectionType == Folder) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-delete-folder.png")); |
|
|
|
|
|
|
|
mMainWindow->actionDelete->setText(tr("Delete")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (mSelectionType == Document) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-delete-document.png")); |
|
|
|
|
|
|
|
mMainWindow->actionDelete->setText(tr("Delete")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (mSelectionType == Page) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-document-page.png")); |
|
|
|
|
|
|
|
mMainWindow->actionDelete->setText(tr("Delete")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mMainWindow->actionDocumentAdd->setEnabled((docSelected || pageSelected) && !trashSelected); |
|
|
|
mMainWindow->actionDocumentAdd->setEnabled((docSelected || pageSelected) && !trashSelected); |
|
|
@ -3837,11 +3852,9 @@ void UBDocumentController:: refreshDocumentThumbnailsView(UBDocumentContainer* s |
|
|
|
|
|
|
|
|
|
|
|
if (selection) |
|
|
|
if (selection) |
|
|
|
{ |
|
|
|
{ |
|
|
|
disconnect(mDocumentUI->thumbnailWidget->scene(), SIGNAL(selectionChanged()), this, SLOT(pageSelectionChanged())); |
|
|
|
|
|
|
|
UBSceneThumbnailPixmap *currentSceneThumbnailPixmap = dynamic_cast<UBSceneThumbnailPixmap*>(selection); |
|
|
|
UBSceneThumbnailPixmap *currentSceneThumbnailPixmap = dynamic_cast<UBSceneThumbnailPixmap*>(selection); |
|
|
|
if (currentSceneThumbnailPixmap) |
|
|
|
if (currentSceneThumbnailPixmap) |
|
|
|
mDocumentUI->thumbnailWidget->hightlightItem(currentSceneThumbnailPixmap->sceneIndex()); |
|
|
|
mDocumentUI->thumbnailWidget->hightlightItem(currentSceneThumbnailPixmap->sceneIndex()); |
|
|
|
connect(mDocumentUI->thumbnailWidget->scene(), SIGNAL(selectionChanged()), this, SLOT(pageSelectionChanged())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|