| 955 | } |
| 956 | |
| 957 | void UBPersistenceManager::copyDocumentScene(std::shared_ptr<UBDocumentProxy> from, int fromIndex, std::shared_ptr<UBDocumentProxy> to, int toIndex) |
| 958 | { |
| 959 | if (from == to && toIndex <= fromIndex) { |
| 960 | qDebug() << "operation is not supported" << Q_FUNC_INFO; |
| 961 | return; |
| 962 | } |
| 963 | |
| 964 | checkIfDocumentRepositoryExists(); |
| 965 | |
| 966 | for (int i = to->pageCount(); i > toIndex; i--) { |
| 967 | renamePage(to, i - 1, i); |
| 968 | mSceneCache.moveScene(to, i - 1, i); |
| 969 | } |
| 970 | |
| 971 | UBForeighnObjectsHandler hl; |
| 972 | hl.copyPage(QUrl::fromLocalFile(from->persistencePath()), fromIndex, |
| 973 | QUrl::fromLocalFile(to->persistencePath()), toIndex); |
| 974 | |
| 975 | to->incPageCount(); |
| 976 | |
| 977 | QString thumbTmp(from->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", fromIndex)); |
| 978 | QString thumbTo(to->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", toIndex)); |
| 979 | |
| 980 | QFile::remove(thumbTo); |
| 981 | QFile::copy(thumbTmp, thumbTo); |
| 982 | |
| 983 | Q_ASSERT(QFileInfo(thumbTmp).exists()); |
| 984 | Q_ASSERT(QFileInfo(thumbTo).exists()); |
| 985 | auto pix = std::make_shared<QPixmap>(thumbTmp); |
| 986 | UBDocumentController *ctrl = UBApplication::documentController; |
| 987 | ctrl->TreeViewSelectionChanged(ctrl->firstSelectedTreeIndex(), QModelIndex()); |
| 988 | } |
| 989 | |
| 990 | |
| 991 | std::shared_ptr<UBGraphicsScene> UBPersistenceManager::createDocumentSceneAt(std::shared_ptr<UBDocumentProxy> proxy, int index, bool useUndoRedoStack) |
no test coverage detected